From 8faa0e44712a5c738ca4637aa9376538de2097b5 Mon Sep 17 00:00:00 2001 From: Brent Shaffer Date: Mon, 16 Dec 2024 23:15:01 +0000 Subject: [PATCH] chore!: promote Tpu to v2 --- Tpu/.OwlBot.yaml | 2 +- Tpu/metadata/V1/CloudTpu.php | Bin 6967 -> 0 bytes Tpu/owlbot.py | 50 +- Tpu/src/V1/AcceleratorType.php | 101 -- Tpu/src/V1/CreateNodeRequest.php | 145 -- Tpu/src/V1/DeleteNodeRequest.php | 67 - Tpu/src/V1/Gapic/TpuGapicClient.php | 1237 ---------------- Tpu/src/V1/GetAcceleratorTypeRequest.php | 67 - Tpu/src/V1/GetNodeRequest.php | 67 - Tpu/src/V1/GetTensorFlowVersionRequest.php | 68 - Tpu/src/V1/ListAcceleratorTypesRequest.php | 204 --- Tpu/src/V1/ListAcceleratorTypesResponse.php | 136 -- Tpu/src/V1/ListNodesRequest.php | 135 -- Tpu/src/V1/ListNodesResponse.php | 135 -- Tpu/src/V1/ListTensorFlowVersionsRequest.php | 204 --- Tpu/src/V1/ListTensorFlowVersionsResponse.php | 136 -- Tpu/src/V1/NetworkEndpoint.php | 101 -- Tpu/src/V1/Node.php | 797 ---------- Tpu/src/V1/Node/ApiVersion.php | 69 - Tpu/src/V1/Node/Health.php | 85 -- Tpu/src/V1/Node/State.php | 148 -- Tpu/src/V1/OperationMetadata.php | 295 ---- Tpu/src/V1/ReimageNodeRequest.php | 101 -- Tpu/src/V1/SchedulingConfig.php | 101 -- Tpu/src/V1/StartNodeRequest.php | 67 - Tpu/src/V1/StopNodeRequest.php | 67 - Tpu/src/V1/Symptom.php | 179 --- Tpu/src/V1/Symptom/SymptomType.php | 92 -- Tpu/src/V1/TensorFlowVersion.php | 101 -- Tpu/src/V1/TpuClient.php | 34 - Tpu/src/V1/gapic_metadata.json | 83 -- Tpu/src/V1/resources/tpu_client_config.json | 97 -- .../V1/resources/tpu_descriptor_config.php | 122 -- .../V1/resources/tpu_rest_client_config.php | 224 --- Tpu/src/V2/AcceleratorConfig.php | 4 +- Tpu/src/V2/AcceleratorType.php | 4 +- Tpu/src/V2/AccessConfig.php | 2 +- Tpu/src/V2/AttachedDisk.php | 4 +- Tpu/src/V2/Client/TpuClient.php | 38 +- Tpu/src/V2/CreateNodeRequest.php | 6 +- Tpu/src/V2/DeleteNodeRequest.php | 2 +- Tpu/src/V2/GenerateServiceIdentityRequest.php | 2 +- .../V2/GenerateServiceIdentityResponse.php | 2 +- Tpu/src/V2/GetAcceleratorTypeRequest.php | 2 +- Tpu/src/V2/GetGuestAttributesRequest.php | 4 +- Tpu/src/V2/GetNodeRequest.php | 2 +- Tpu/src/V2/GetRuntimeVersionRequest.php | 2 +- Tpu/src/V2/GuestAttributes.php | 4 +- Tpu/src/V2/GuestAttributesEntry.php | 6 +- Tpu/src/V2/ListAcceleratorTypesRequest.php | 10 +- Tpu/src/V2/ListAcceleratorTypesResponse.php | 2 +- Tpu/src/V2/ListNodesRequest.php | 6 +- Tpu/src/V2/ListNodesResponse.php | 2 +- Tpu/src/V2/ListRuntimeVersionsRequest.php | 10 +- Tpu/src/V2/ListRuntimeVersionsResponse.php | 2 +- Tpu/src/V2/NetworkConfig.php | 8 +- Tpu/src/V2/NetworkEndpoint.php | 6 +- Tpu/src/V2/Node.php | 36 +- Tpu/src/V2/OperationMetadata.php | 14 +- Tpu/src/V2/RuntimeVersion.php | 4 +- Tpu/src/V2/SchedulingConfig.php | 4 +- Tpu/src/V2/ServiceAccount.php | 2 +- Tpu/src/V2/ServiceIdentity.php | 2 +- Tpu/src/V2/ShieldedInstanceConfig.php | 2 +- Tpu/src/V2/StartNodeRequest.php | 2 +- Tpu/src/V2/StopNodeRequest.php | 2 +- Tpu/src/V2/Symptom.php | 8 +- Tpu/src/V2/UpdateNodeRequest.php | 4 +- Tpu/tests/Unit/V1/TpuClientTest.php | 1289 ----------------- Tpu/tests/Unit/V2/Client/TpuClientTest.php | 333 ++--- 70 files changed, 292 insertions(+), 7057 deletions(-) delete mode 100644 Tpu/metadata/V1/CloudTpu.php delete mode 100644 Tpu/src/V1/AcceleratorType.php delete mode 100644 Tpu/src/V1/CreateNodeRequest.php delete mode 100644 Tpu/src/V1/DeleteNodeRequest.php delete mode 100644 Tpu/src/V1/Gapic/TpuGapicClient.php delete mode 100644 Tpu/src/V1/GetAcceleratorTypeRequest.php delete mode 100644 Tpu/src/V1/GetNodeRequest.php delete mode 100644 Tpu/src/V1/GetTensorFlowVersionRequest.php delete mode 100644 Tpu/src/V1/ListAcceleratorTypesRequest.php delete mode 100644 Tpu/src/V1/ListAcceleratorTypesResponse.php delete mode 100644 Tpu/src/V1/ListNodesRequest.php delete mode 100644 Tpu/src/V1/ListNodesResponse.php delete mode 100644 Tpu/src/V1/ListTensorFlowVersionsRequest.php delete mode 100644 Tpu/src/V1/ListTensorFlowVersionsResponse.php delete mode 100644 Tpu/src/V1/NetworkEndpoint.php delete mode 100644 Tpu/src/V1/Node.php delete mode 100644 Tpu/src/V1/Node/ApiVersion.php delete mode 100644 Tpu/src/V1/Node/Health.php delete mode 100644 Tpu/src/V1/Node/State.php delete mode 100644 Tpu/src/V1/OperationMetadata.php delete mode 100644 Tpu/src/V1/ReimageNodeRequest.php delete mode 100644 Tpu/src/V1/SchedulingConfig.php delete mode 100644 Tpu/src/V1/StartNodeRequest.php delete mode 100644 Tpu/src/V1/StopNodeRequest.php delete mode 100644 Tpu/src/V1/Symptom.php delete mode 100644 Tpu/src/V1/Symptom/SymptomType.php delete mode 100644 Tpu/src/V1/TensorFlowVersion.php delete mode 100644 Tpu/src/V1/TpuClient.php delete mode 100644 Tpu/src/V1/gapic_metadata.json delete mode 100644 Tpu/src/V1/resources/tpu_client_config.json delete mode 100644 Tpu/src/V1/resources/tpu_descriptor_config.php delete mode 100644 Tpu/src/V1/resources/tpu_rest_client_config.php delete mode 100644 Tpu/tests/Unit/V1/TpuClientTest.php diff --git a/Tpu/.OwlBot.yaml b/Tpu/.OwlBot.yaml index 92eda989c4fe..4fc110437008 100644 --- a/Tpu/.OwlBot.yaml +++ b/Tpu/.OwlBot.yaml @@ -1,4 +1,4 @@ deep-copy-regex: - - source: /google/cloud/tpu/(v1|v2)/.*-php/(.*) + - source: /google/cloud/tpu/(v2)/.*-php/(.*) dest: /owl-bot-staging/Tpu/$1/$2 api-name: Tpu diff --git a/Tpu/metadata/V1/CloudTpu.php b/Tpu/metadata/V1/CloudTpu.php deleted file mode 100644 index e088051a70f0d11c816eb162605a04d233d6f390..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6967 zcmb_h&2QVt6|ba7v7TdFo_xtpvSFDtaoj{&+i8$0o1~OP+iGn|kYsmL7$9hAY;!}C zT#|Cu4SZ=&J@m9d|A4kA&{Ho3dh20bUfiUv z+EHC~XN@o2DY2zHEvvh;z4Q#At*eeB@If4dw;5nrR4ZLCt8>g$IJClgZw-Of>en5MZe@`_cBDis4e*Q1zWM zb=tOOxu#u5(L!OLx;?M4k%b5TwoIM2CoFgv3xy$&&jr`+((vwrU{kki8_zgyrr@Oa zZ70H0lBMlPhG8-^IBQ`^*Qnu+w`NtNdZ$Pa)FaKb$6MNF$C z?XF>H#{N#tVsSa1k-f8PX&7y;dT2!>=4bxsh322I)ampNbQNQLp?3uAK<>jgdAKt| zkdw=vP>yFpjs^eG()@LQrD|!I73=`Kl$gIAn%HArR(5?i`vP+z0o(VbKNY~y`wq*S zJ%QtA+|6H8PVaD)Hb33$EMNP*U~M>1b3>s} zhFKrFLj6N_vR8!!?tV8?!$3rMI6j4x=fdnY+?dx4rZ93|WB* z=NR+CJan=<_c^kgk+w8FDZXm{5ln_bPD0`}J@&I>3X(^v-laS}(uMfbnE3A)BzgRi zt1#PaNiA8~sy6F#sj^y;%bD+BMop9&vec?n*D^7Zh9v$dzskhPG(bbf6%9U>AXAWT z$dyfLjY(c$>&o(m%qNrHWL>H>*kp=K!o_B*RkEu8Ydm*r|^nkm_;`ZF`)uVN_X9rZOJ>$0@bS|6|y z0eR!E(8w%YDa*KRiS2@d!AzXtZdEqr+Ey!*U}C*Fr6pIJwZ`g3?Wbt_99-?sY)X|X z&PvsioJoo`fc`m?8*p8!SCnnJ(X7;}1DMeE?IlIpsIN;)h$;o~?IrX(8(t2E6NSb{ zsRq|s?f2>nhMbc_4wdJH?=fcU7qsm<`M3VJlRVY|ug~S*247F|21XzXv5yn+3&?C} zj>|MS4fsd%!>OSTN@+Gexvr@!|T=O;c>#g`2 zW zM!8*qS&vS22H&VN{VD!32D2qz8`FXD`d~xLAbQ zGIl7JhCz&J$qOJ2svY79g_U6c>^Dj>4tw#QU(O`l!M085shBnc$5n;Wm3BzJePV zKSMhOaZm_DFFxcMa&I)S;vZsgizUL4@?HjhHjsg1=_jM5BUaedo~GkP#3Mb7iJ5kX zB7Hc{rdVQ$U&r8+vw-^PTY}4;`@-I16pbbGy~t!9GJDL-{#^`aq&{zJA#EFoB#bLg z=DaX+KT2PM7!gK;N`5kG5FwEYSR>mVLnt)DdE|+>1#=ib16u^q^Ym2oEb{2NI|@ee zw=uZEj$}Y_FLDY4ku!$w|6knvItDkRLHbei5@rWI7Q{?6YZ@?j%!v6XR-fLTFL*$J zZSEBJW!I5&xi41k2_&l?Q)Z!czBHy6)GRG*zCBO;_qWH8D4V}vdvdW@oJk&>s5V_fFkEZR;6sp zo3#dGXR|Pc{7b2=219X1UFFZ^(iW0eM$gKMN6;?A%%$A7+#f1f;HPqW^7RO@-K_AG{2+oI3b2$GSDKAjt5AjIOM#?l9qHSd7e&EJa zSL=|-h;TnY4=(rY6LE=$<|sG|wnr@su|W2|T7d2fD1sN3HP^|6>A2PzV3hV@+xuCZb=M4KG492pVO!hsblW3BN^*V^gQ z^^`mrrF8X)p-=c7@|PG~!Adn`3;8q>R+MO9NObiX(k#m1au*;!FS3VW=dt#EgUFd@ z2bhR+2J$G;0Qpj+tg@GQJ@&H)UV#lB;^G6AeUra@!X2<y8r+H diff --git a/Tpu/owlbot.py b/Tpu/owlbot.py index 0c04d732756e..6be67d2f7707 100644 --- a/Tpu/owlbot.py +++ b/Tpu/owlbot.py @@ -1,4 +1,4 @@ -# Copyright 2021 Google LLC +# Copyright 2024 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -30,14 +30,7 @@ # Added so that we can pass copy_excludes in the owlbot_main() call _tracked_paths.add(src) -php.owlbot_main( - src=src, - dest=dest, - copy_excludes=[ - src / "**/[A-Z]*_*.php", - src / "**/*GrpcClient.php", - ] -) +php.owlbot_main(src=src, dest=dest) # remove class_alias code s.replace( @@ -48,29 +41,16 @@ + "\n", '') - -### [START] protoc backwards compatibility fixes - -# roll back to private properties. -s.replace( - "src/**/V*/**/*.php", - r"Generated from protobuf field ([^\n]{0,})\n\s{5}\*/\n\s{4}protected \$", - r"""Generated from protobuf field \1 - */ - private $""") - -# Replace "Unwrapped" with "Value" for method names. -s.replace( - "src/**/V*/**/*.php", - r"public function ([s|g]\w{3,})Unwrapped", - r"public function \1Value" -) - -### [END] protoc backwards compatibility fixes - -# fix relative cloud.google.com links -s.replace( - "src/**/V*/**/*.php", - r"(.{0,})\]\((/.{0,})\)", - r"\1](https://cloud.google.com\2)" -) +# format generated clients +subprocess.run([ + 'npm', + 'exec', + '--yes', + '--package=@prettier/plugin-php@^0.16', + '--', + 'prettier', + '**/Client/*', + '--write', + '--parser=php', + '--single-quote', + '--print-width=120']) diff --git a/Tpu/src/V1/AcceleratorType.php b/Tpu/src/V1/AcceleratorType.php deleted file mode 100644 index 1bd8cfa6dec1..000000000000 --- a/Tpu/src/V1/AcceleratorType.php +++ /dev/null @@ -1,101 +0,0 @@ -google.cloud.tpu.v1.AcceleratorType - */ -class AcceleratorType extends \Google\Protobuf\Internal\Message -{ - /** - * The resource name. - * - * Generated from protobuf field string name = 1; - */ - private $name = ''; - /** - * the accelerator type. - * - * Generated from protobuf field string type = 2; - */ - private $type = ''; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $name - * The resource name. - * @type string $type - * the accelerator type. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Tpu\V1\CloudTpu::initOnce(); - parent::__construct($data); - } - - /** - * The resource name. - * - * Generated from protobuf field string name = 1; - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * The resource name. - * - * Generated from protobuf field string name = 1; - * @param string $var - * @return $this - */ - public function setName($var) - { - GPBUtil::checkString($var, True); - $this->name = $var; - - return $this; - } - - /** - * the accelerator type. - * - * Generated from protobuf field string type = 2; - * @return string - */ - public function getType() - { - return $this->type; - } - - /** - * the accelerator type. - * - * Generated from protobuf field string type = 2; - * @param string $var - * @return $this - */ - public function setType($var) - { - GPBUtil::checkString($var, True); - $this->type = $var; - - return $this; - } - -} - diff --git a/Tpu/src/V1/CreateNodeRequest.php b/Tpu/src/V1/CreateNodeRequest.php deleted file mode 100644 index 68092d5f497e..000000000000 --- a/Tpu/src/V1/CreateNodeRequest.php +++ /dev/null @@ -1,145 +0,0 @@ -google.cloud.tpu.v1.CreateNodeRequest - */ -class CreateNodeRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The parent resource name. - * - * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - */ - private $parent = ''; - /** - * The unqualified resource name. - * - * Generated from protobuf field string node_id = 2; - */ - private $node_id = ''; - /** - * Required. The node. - * - * Generated from protobuf field .google.cloud.tpu.v1.Node node = 3 [(.google.api.field_behavior) = REQUIRED]; - */ - private $node = null; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $parent - * Required. The parent resource name. - * @type string $node_id - * The unqualified resource name. - * @type \Google\Cloud\Tpu\V1\Node $node - * Required. The node. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Tpu\V1\CloudTpu::initOnce(); - parent::__construct($data); - } - - /** - * Required. The parent resource name. - * - * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @return string - */ - public function getParent() - { - return $this->parent; - } - - /** - * Required. The parent resource name. - * - * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setParent($var) - { - GPBUtil::checkString($var, True); - $this->parent = $var; - - return $this; - } - - /** - * The unqualified resource name. - * - * Generated from protobuf field string node_id = 2; - * @return string - */ - public function getNodeId() - { - return $this->node_id; - } - - /** - * The unqualified resource name. - * - * Generated from protobuf field string node_id = 2; - * @param string $var - * @return $this - */ - public function setNodeId($var) - { - GPBUtil::checkString($var, True); - $this->node_id = $var; - - return $this; - } - - /** - * Required. The node. - * - * Generated from protobuf field .google.cloud.tpu.v1.Node node = 3 [(.google.api.field_behavior) = REQUIRED]; - * @return \Google\Cloud\Tpu\V1\Node|null - */ - public function getNode() - { - return $this->node; - } - - public function hasNode() - { - return isset($this->node); - } - - public function clearNode() - { - unset($this->node); - } - - /** - * Required. The node. - * - * Generated from protobuf field .google.cloud.tpu.v1.Node node = 3 [(.google.api.field_behavior) = REQUIRED]; - * @param \Google\Cloud\Tpu\V1\Node $var - * @return $this - */ - public function setNode($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Tpu\V1\Node::class); - $this->node = $var; - - return $this; - } - -} - diff --git a/Tpu/src/V1/DeleteNodeRequest.php b/Tpu/src/V1/DeleteNodeRequest.php deleted file mode 100644 index 24fe915b2d64..000000000000 --- a/Tpu/src/V1/DeleteNodeRequest.php +++ /dev/null @@ -1,67 +0,0 @@ -google.cloud.tpu.v1.DeleteNodeRequest - */ -class DeleteNodeRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The resource name. - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - */ - private $name = ''; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $name - * Required. The resource name. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Tpu\V1\CloudTpu::initOnce(); - parent::__construct($data); - } - - /** - * Required. The resource name. - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * Required. The resource name. - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setName($var) - { - GPBUtil::checkString($var, True); - $this->name = $var; - - return $this; - } - -} - diff --git a/Tpu/src/V1/Gapic/TpuGapicClient.php b/Tpu/src/V1/Gapic/TpuGapicClient.php deleted file mode 100644 index ef5c9a8a4500..000000000000 --- a/Tpu/src/V1/Gapic/TpuGapicClient.php +++ /dev/null @@ -1,1237 +0,0 @@ -locationName('[PROJECT]', '[LOCATION]'); - * $node = new Node(); - * $operationResponse = $tpuClient->createNode($formattedParent, $node); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * $result = $operationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $tpuClient->createNode($formattedParent, $node); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $tpuClient->resumeOperation($operationName, 'createNode'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $tpuClient->close(); - * } - * ``` - * - * Many parameters require resource names to be formatted in a particular way. To - * assist with these names, this class includes a format method for each type of - * name, and additionally a parseName method to extract the individual identifiers - * contained within formatted names that are returned by the API. - * - * @deprecated This class will be removed in the next major version update. - */ -class TpuGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.tpu.v1.Tpu'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'tpu.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'tpu.UNIVERSE_DOMAIN'; - - /** The default port of the service. */ - const DEFAULT_SERVICE_PORT = 443; - - /** The name of the code generator, to be included in the agent header. */ - const CODEGEN_NAME = 'gapic'; - - /** The default scopes required by the service. */ - public static $serviceScopes = [ - 'https://www.googleapis.com/auth/cloud-platform', - ]; - - private static $acceleratorTypeNameTemplate; - - private static $locationNameTemplate; - - private static $nodeNameTemplate; - - private static $tensorFlowVersionNameTemplate; - - private static $pathTemplateMap; - - private $operationsClient; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => __DIR__ . '/../resources/tpu_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/tpu_descriptor_config.php', - 'gcpApiConfigPath' => __DIR__ . '/../resources/tpu_grpc_config.json', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/tpu_rest_client_config.php', - ], - ], - ]; - } - - private static function getAcceleratorTypeNameTemplate() - { - if (self::$acceleratorTypeNameTemplate == null) { - self::$acceleratorTypeNameTemplate = new PathTemplate('projects/{project}/locations/{location}/acceleratorTypes/{accelerator_type}'); - } - - return self::$acceleratorTypeNameTemplate; - } - - private static function getLocationNameTemplate() - { - if (self::$locationNameTemplate == null) { - self::$locationNameTemplate = new PathTemplate('projects/{project}/locations/{location}'); - } - - return self::$locationNameTemplate; - } - - private static function getNodeNameTemplate() - { - if (self::$nodeNameTemplate == null) { - self::$nodeNameTemplate = new PathTemplate('projects/{project}/locations/{location}/nodes/{node}'); - } - - return self::$nodeNameTemplate; - } - - private static function getTensorFlowVersionNameTemplate() - { - if (self::$tensorFlowVersionNameTemplate == null) { - self::$tensorFlowVersionNameTemplate = new PathTemplate('projects/{project}/locations/{location}/tensorFlowVersions/{tensor_flow_version}'); - } - - return self::$tensorFlowVersionNameTemplate; - } - - private static function getPathTemplateMap() - { - if (self::$pathTemplateMap == null) { - self::$pathTemplateMap = [ - 'acceleratorType' => self::getAcceleratorTypeNameTemplate(), - 'location' => self::getLocationNameTemplate(), - 'node' => self::getNodeNameTemplate(), - 'tensorFlowVersion' => self::getTensorFlowVersionNameTemplate(), - ]; - } - - return self::$pathTemplateMap; - } - - /** - * Formats a string containing the fully-qualified path to represent a - * accelerator_type resource. - * - * @param string $project - * @param string $location - * @param string $acceleratorType - * - * @return string The formatted accelerator_type resource. - */ - public static function acceleratorTypeName($project, $location, $acceleratorType) - { - return self::getAcceleratorTypeNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'accelerator_type' => $acceleratorType, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a location - * resource. - * - * @param string $project - * @param string $location - * - * @return string The formatted location resource. - */ - public static function locationName($project, $location) - { - return self::getLocationNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a node - * resource. - * - * @param string $project - * @param string $location - * @param string $node - * - * @return string The formatted node resource. - */ - public static function nodeName($project, $location, $node) - { - return self::getNodeNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'node' => $node, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a - * tensor_flow_version resource. - * - * @param string $project - * @param string $location - * @param string $tensorFlowVersion - * - * @return string The formatted tensor_flow_version resource. - */ - public static function tensorFlowVersionName($project, $location, $tensorFlowVersion) - { - return self::getTensorFlowVersionNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'tensor_flow_version' => $tensorFlowVersion, - ]); - } - - /** - * Parses a formatted name string and returns an associative array of the components in the name. - * The following name formats are supported: - * Template: Pattern - * - acceleratorType: projects/{project}/locations/{location}/acceleratorTypes/{accelerator_type} - * - location: projects/{project}/locations/{location} - * - node: projects/{project}/locations/{location}/nodes/{node} - * - tensorFlowVersion: projects/{project}/locations/{location}/tensorFlowVersions/{tensor_flow_version} - * - * The optional $template argument can be supplied to specify a particular pattern, - * and must match one of the templates listed above. If no $template argument is - * provided, or if the $template argument does not match one of the templates - * listed, then parseName will check each of the supported templates, and return - * the first match. - * - * @param string $formattedName The formatted name string - * @param string $template Optional name of template to match - * - * @return array An associative array from name component IDs to component values. - * - * @throws ValidationException If $formattedName could not be matched. - */ - public static function parseName($formattedName, $template = null) - { - $templateMap = self::getPathTemplateMap(); - if ($template) { - if (!isset($templateMap[$template])) { - throw new ValidationException("Template name $template does not exist"); - } - - return $templateMap[$template]->match($formattedName); - } - - foreach ($templateMap as $templateName => $pathTemplate) { - try { - return $pathTemplate->match($formattedName); - } catch (ValidationException $ex) { - // Swallow the exception to continue trying other path templates - } - } - - throw new ValidationException("Input did not match any known format. Input: $formattedName"); - } - - /** - * Return an OperationsClient object with the same endpoint as $this. - * - * @return OperationsClient - */ - public function getOperationsClient() - { - return $this->operationsClient; - } - - /** - * Resume an existing long running operation that was previously started by a long - * running API method. If $methodName is not provided, or does not match a long - * running API method, then the operation can still be resumed, but the - * OperationResponse object will not deserialize the final response. - * - * @param string $operationName The name of the long running operation - * @param string $methodName The name of the method used to start the operation - * - * @return OperationResponse - */ - public function resumeOperation($operationName, $methodName = null) - { - $options = isset($this->descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : []; - $operation = new OperationResponse($operationName, $this->getOperationsClient(), $options); - $operation->reload(); - return $operation; - } - - /** - * Constructor. - * - * @param array $options { - * Optional. Options for configuring the service API wrapper. - * - * @type string $apiEndpoint - * The address of the API remote host. May optionally include the port, formatted - * as ":". Default 'tpu.googleapis.com:443'. - * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials - * The credentials to be used by the client to authorize API calls. This option - * accepts either a path to a credentials file, or a decoded credentials file as a - * PHP array. - * *Advanced usage*: In addition, this option can also accept a pre-constructed - * {@see \Google\Auth\FetchAuthTokenInterface} object or - * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these - * objects are provided, any settings in $credentialsConfig will be ignored. - * @type array $credentialsConfig - * Options used to configure credentials, including auth token caching, for the - * client. For a full list of supporting configuration options, see - * {@see \Google\ApiCore\CredentialsWrapper::build()} . - * @type bool $disableRetries - * Determines whether or not retries defined by the client configuration should be - * disabled. Defaults to `false`. - * @type string|array $clientConfig - * Client method configuration, including retry settings. This option can be either - * a path to a JSON file, or a PHP array containing the decoded JSON data. By - * default this settings points to the default client config file, which is - * provided in the resources folder. - * @type string|TransportInterface $transport - * The transport used for executing network requests. May be either the string - * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. - * *Advanced usage*: Additionally, it is possible to pass in an already - * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note - * that when this object is provided, any settings in $transportConfig, and any - * $apiEndpoint setting, will be ignored. - * @type array $transportConfig - * Configuration options that will be used to construct the transport. Options for - * each supported transport type should be passed in a key for that transport. For - * example: - * $transportConfig = [ - * 'grpc' => [...], - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and - * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the - * supported options. - * @type callable $clientCertSource - * A callable which returns the client cert as a string. This can be used to - * provide a certificate and private key to the transport layer for mTLS. - * } - * - * @throws ValidationException - */ - public function __construct(array $options = []) - { - $clientOptions = $this->buildClientOptions($options); - $this->setClientOptions($clientOptions); - $this->operationsClient = $this->createOperationsClient($clientOptions); - } - - /** - * Creates a node. - * - * Sample code: - * ``` - * $tpuClient = new TpuClient(); - * try { - * $formattedParent = $tpuClient->locationName('[PROJECT]', '[LOCATION]'); - * $node = new Node(); - * $operationResponse = $tpuClient->createNode($formattedParent, $node); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * $result = $operationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $tpuClient->createNode($formattedParent, $node); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $tpuClient->resumeOperation($operationName, 'createNode'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $tpuClient->close(); - * } - * ``` - * - * @param string $parent Required. The parent resource name. - * @param Node $node Required. The node. - * @param array $optionalArgs { - * Optional. - * - * @type string $nodeId - * The unqualified resource name. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function createNode($parent, $node, array $optionalArgs = []) - { - $request = new CreateNodeRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setNode($node); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['nodeId'])) { - $request->setNodeId($optionalArgs['nodeId']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startOperationsCall('CreateNode', $optionalArgs, $request, $this->getOperationsClient())->wait(); - } - - /** - * Deletes a node. - * - * Sample code: - * ``` - * $tpuClient = new TpuClient(); - * try { - * $formattedName = $tpuClient->nodeName('[PROJECT]', '[LOCATION]', '[NODE]'); - * $operationResponse = $tpuClient->deleteNode($formattedName); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * $result = $operationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $tpuClient->deleteNode($formattedName); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $tpuClient->resumeOperation($operationName, 'deleteNode'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $tpuClient->close(); - * } - * ``` - * - * @param string $name Required. The resource name. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function deleteNode($name, array $optionalArgs = []) - { - $request = new DeleteNodeRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startOperationsCall('DeleteNode', $optionalArgs, $request, $this->getOperationsClient())->wait(); - } - - /** - * Gets AcceleratorType. - * - * Sample code: - * ``` - * $tpuClient = new TpuClient(); - * try { - * $formattedName = $tpuClient->acceleratorTypeName('[PROJECT]', '[LOCATION]', '[ACCELERATOR_TYPE]'); - * $response = $tpuClient->getAcceleratorType($formattedName); - * } finally { - * $tpuClient->close(); - * } - * ``` - * - * @param string $name Required. The resource name. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Tpu\V1\AcceleratorType - * - * @throws ApiException if the remote call fails - */ - public function getAcceleratorType($name, array $optionalArgs = []) - { - $request = new GetAcceleratorTypeRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('GetAcceleratorType', AcceleratorType::class, $optionalArgs, $request)->wait(); - } - - /** - * Gets the details of a node. - * - * Sample code: - * ``` - * $tpuClient = new TpuClient(); - * try { - * $formattedName = $tpuClient->nodeName('[PROJECT]', '[LOCATION]', '[NODE]'); - * $response = $tpuClient->getNode($formattedName); - * } finally { - * $tpuClient->close(); - * } - * ``` - * - * @param string $name Required. The resource name. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Tpu\V1\Node - * - * @throws ApiException if the remote call fails - */ - public function getNode($name, array $optionalArgs = []) - { - $request = new GetNodeRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('GetNode', Node::class, $optionalArgs, $request)->wait(); - } - - /** - * Gets TensorFlow Version. - * - * Sample code: - * ``` - * $tpuClient = new TpuClient(); - * try { - * $formattedName = $tpuClient->tensorFlowVersionName('[PROJECT]', '[LOCATION]', '[TENSOR_FLOW_VERSION]'); - * $response = $tpuClient->getTensorFlowVersion($formattedName); - * } finally { - * $tpuClient->close(); - * } - * ``` - * - * @param string $name Required. The resource name. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Tpu\V1\TensorFlowVersion - * - * @throws ApiException if the remote call fails - */ - public function getTensorFlowVersion($name, array $optionalArgs = []) - { - $request = new GetTensorFlowVersionRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('GetTensorFlowVersion', TensorFlowVersion::class, $optionalArgs, $request)->wait(); - } - - /** - * Lists accelerator types supported by this API. - * - * Sample code: - * ``` - * $tpuClient = new TpuClient(); - * try { - * $formattedParent = $tpuClient->acceleratorTypeName('[PROJECT]', '[LOCATION]', '[ACCELERATOR_TYPE]'); - * // Iterate over pages of elements - * $pagedResponse = $tpuClient->listAcceleratorTypes($formattedParent); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $tpuClient->listAcceleratorTypes($formattedParent); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $tpuClient->close(); - * } - * ``` - * - * @param string $parent Required. The parent resource name. - * @param array $optionalArgs { - * Optional. - * - * @type int $pageSize - * The maximum number of resources contained in the underlying API - * response. The API may return fewer values in a page, even if - * there are additional values to be retrieved. - * @type string $pageToken - * A page token is used to specify a page of values to be returned. - * If no page token is specified (the default), the first page - * of values will be returned. Any page token used here must have - * been generated by a previous call to the API. - * @type string $filter - * List filter. - * @type string $orderBy - * Sort results. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\PagedListResponse - * - * @throws ApiException if the remote call fails - */ - public function listAcceleratorTypes($parent, array $optionalArgs = []) - { - $request = new ListAcceleratorTypesRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('ListAcceleratorTypes', $optionalArgs, ListAcceleratorTypesResponse::class, $request); - } - - /** - * Lists nodes. - * - * Sample code: - * ``` - * $tpuClient = new TpuClient(); - * try { - * $formattedParent = $tpuClient->locationName('[PROJECT]', '[LOCATION]'); - * // Iterate over pages of elements - * $pagedResponse = $tpuClient->listNodes($formattedParent); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $tpuClient->listNodes($formattedParent); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $tpuClient->close(); - * } - * ``` - * - * @param string $parent Required. The parent resource name. - * @param array $optionalArgs { - * Optional. - * - * @type int $pageSize - * The maximum number of resources contained in the underlying API - * response. The API may return fewer values in a page, even if - * there are additional values to be retrieved. - * @type string $pageToken - * A page token is used to specify a page of values to be returned. - * If no page token is specified (the default), the first page - * of values will be returned. Any page token used here must have - * been generated by a previous call to the API. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\PagedListResponse - * - * @throws ApiException if the remote call fails - */ - public function listNodes($parent, array $optionalArgs = []) - { - $request = new ListNodesRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('ListNodes', $optionalArgs, ListNodesResponse::class, $request); - } - - /** - * List TensorFlow versions supported by this API. - * - * Sample code: - * ``` - * $tpuClient = new TpuClient(); - * try { - * $formattedParent = $tpuClient->tensorFlowVersionName('[PROJECT]', '[LOCATION]', '[TENSOR_FLOW_VERSION]'); - * // Iterate over pages of elements - * $pagedResponse = $tpuClient->listTensorFlowVersions($formattedParent); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $tpuClient->listTensorFlowVersions($formattedParent); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $tpuClient->close(); - * } - * ``` - * - * @param string $parent Required. The parent resource name. - * @param array $optionalArgs { - * Optional. - * - * @type int $pageSize - * The maximum number of resources contained in the underlying API - * response. The API may return fewer values in a page, even if - * there are additional values to be retrieved. - * @type string $pageToken - * A page token is used to specify a page of values to be returned. - * If no page token is specified (the default), the first page - * of values will be returned. Any page token used here must have - * been generated by a previous call to the API. - * @type string $filter - * List filter. - * @type string $orderBy - * Sort results. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\PagedListResponse - * - * @throws ApiException if the remote call fails - */ - public function listTensorFlowVersions($parent, array $optionalArgs = []) - { - $request = new ListTensorFlowVersionsRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('ListTensorFlowVersions', $optionalArgs, ListTensorFlowVersionsResponse::class, $request); - } - - /** - * Reimages a node's OS. - * - * Sample code: - * ``` - * $tpuClient = new TpuClient(); - * try { - * $operationResponse = $tpuClient->reimageNode(); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * $result = $operationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $tpuClient->reimageNode(); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $tpuClient->resumeOperation($operationName, 'reimageNode'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $tpuClient->close(); - * } - * ``` - * - * @param array $optionalArgs { - * Optional. - * - * @type string $name - * The resource name. - * @type string $tensorflowVersion - * The version for reimage to create. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function reimageNode(array $optionalArgs = []) - { - $request = new ReimageNodeRequest(); - $requestParamHeaders = []; - if (isset($optionalArgs['name'])) { - $request->setName($optionalArgs['name']); - $requestParamHeaders['name'] = $optionalArgs['name']; - } - - if (isset($optionalArgs['tensorflowVersion'])) { - $request->setTensorflowVersion($optionalArgs['tensorflowVersion']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startOperationsCall('ReimageNode', $optionalArgs, $request, $this->getOperationsClient())->wait(); - } - - /** - * Starts a node. - * - * Sample code: - * ``` - * $tpuClient = new TpuClient(); - * try { - * $operationResponse = $tpuClient->startNode(); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * $result = $operationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $tpuClient->startNode(); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $tpuClient->resumeOperation($operationName, 'startNode'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $tpuClient->close(); - * } - * ``` - * - * @param array $optionalArgs { - * Optional. - * - * @type string $name - * The resource name. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function startNode(array $optionalArgs = []) - { - $request = new StartNodeRequest(); - $requestParamHeaders = []; - if (isset($optionalArgs['name'])) { - $request->setName($optionalArgs['name']); - $requestParamHeaders['name'] = $optionalArgs['name']; - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startOperationsCall('StartNode', $optionalArgs, $request, $this->getOperationsClient())->wait(); - } - - /** - * Stops a node, this operation is only available with single TPU nodes. - * - * Sample code: - * ``` - * $tpuClient = new TpuClient(); - * try { - * $operationResponse = $tpuClient->stopNode(); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * $result = $operationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $tpuClient->stopNode(); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $tpuClient->resumeOperation($operationName, 'stopNode'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $tpuClient->close(); - * } - * ``` - * - * @param array $optionalArgs { - * Optional. - * - * @type string $name - * The resource name. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function stopNode(array $optionalArgs = []) - { - $request = new StopNodeRequest(); - $requestParamHeaders = []; - if (isset($optionalArgs['name'])) { - $request->setName($optionalArgs['name']); - $requestParamHeaders['name'] = $optionalArgs['name']; - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startOperationsCall('StopNode', $optionalArgs, $request, $this->getOperationsClient())->wait(); - } - - /** - * Gets information about a location. - * - * Sample code: - * ``` - * $tpuClient = new TpuClient(); - * try { - * $response = $tpuClient->getLocation(); - * } finally { - * $tpuClient->close(); - * } - * ``` - * - * @param array $optionalArgs { - * Optional. - * - * @type string $name - * Resource name for the location. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Location\Location - * - * @throws ApiException if the remote call fails - */ - public function getLocation(array $optionalArgs = []) - { - $request = new GetLocationRequest(); - $requestParamHeaders = []; - if (isset($optionalArgs['name'])) { - $request->setName($optionalArgs['name']); - $requestParamHeaders['name'] = $optionalArgs['name']; - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('GetLocation', Location::class, $optionalArgs, $request, Call::UNARY_CALL, 'google.cloud.location.Locations')->wait(); - } - - /** - * Lists information about the supported locations for this service. - * - * Sample code: - * ``` - * $tpuClient = new TpuClient(); - * try { - * // Iterate over pages of elements - * $pagedResponse = $tpuClient->listLocations(); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $tpuClient->listLocations(); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $tpuClient->close(); - * } - * ``` - * - * @param array $optionalArgs { - * Optional. - * - * @type string $name - * The resource that owns the locations collection, if applicable. - * @type string $filter - * The standard list filter. - * @type int $pageSize - * The maximum number of resources contained in the underlying API - * response. The API may return fewer values in a page, even if - * there are additional values to be retrieved. - * @type string $pageToken - * A page token is used to specify a page of values to be returned. - * If no page token is specified (the default), the first page - * of values will be returned. Any page token used here must have - * been generated by a previous call to the API. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\PagedListResponse - * - * @throws ApiException if the remote call fails - */ - public function listLocations(array $optionalArgs = []) - { - $request = new ListLocationsRequest(); - $requestParamHeaders = []; - if (isset($optionalArgs['name'])) { - $request->setName($optionalArgs['name']); - $requestParamHeaders['name'] = $optionalArgs['name']; - } - - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('ListLocations', $optionalArgs, ListLocationsResponse::class, $request, 'google.cloud.location.Locations'); - } -} diff --git a/Tpu/src/V1/GetAcceleratorTypeRequest.php b/Tpu/src/V1/GetAcceleratorTypeRequest.php deleted file mode 100644 index 0ef7e1f06e85..000000000000 --- a/Tpu/src/V1/GetAcceleratorTypeRequest.php +++ /dev/null @@ -1,67 +0,0 @@ -google.cloud.tpu.v1.GetAcceleratorTypeRequest - */ -class GetAcceleratorTypeRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The resource name. - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - */ - private $name = ''; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $name - * Required. The resource name. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Tpu\V1\CloudTpu::initOnce(); - parent::__construct($data); - } - - /** - * Required. The resource name. - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * Required. The resource name. - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setName($var) - { - GPBUtil::checkString($var, True); - $this->name = $var; - - return $this; - } - -} - diff --git a/Tpu/src/V1/GetNodeRequest.php b/Tpu/src/V1/GetNodeRequest.php deleted file mode 100644 index d4319a4b1d40..000000000000 --- a/Tpu/src/V1/GetNodeRequest.php +++ /dev/null @@ -1,67 +0,0 @@ -google.cloud.tpu.v1.GetNodeRequest - */ -class GetNodeRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The resource name. - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - */ - private $name = ''; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $name - * Required. The resource name. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Tpu\V1\CloudTpu::initOnce(); - parent::__construct($data); - } - - /** - * Required. The resource name. - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * Required. The resource name. - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setName($var) - { - GPBUtil::checkString($var, True); - $this->name = $var; - - return $this; - } - -} - diff --git a/Tpu/src/V1/GetTensorFlowVersionRequest.php b/Tpu/src/V1/GetTensorFlowVersionRequest.php deleted file mode 100644 index 7dc81934401a..000000000000 --- a/Tpu/src/V1/GetTensorFlowVersionRequest.php +++ /dev/null @@ -1,68 +0,0 @@ -google.cloud.tpu.v1.GetTensorFlowVersionRequest - */ -class GetTensorFlowVersionRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The resource name. - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - */ - private $name = ''; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $name - * Required. The resource name. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Tpu\V1\CloudTpu::initOnce(); - parent::__construct($data); - } - - /** - * Required. The resource name. - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * Required. The resource name. - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setName($var) - { - GPBUtil::checkString($var, True); - $this->name = $var; - - return $this; - } - -} - diff --git a/Tpu/src/V1/ListAcceleratorTypesRequest.php b/Tpu/src/V1/ListAcceleratorTypesRequest.php deleted file mode 100644 index 01bb57a9e044..000000000000 --- a/Tpu/src/V1/ListAcceleratorTypesRequest.php +++ /dev/null @@ -1,204 +0,0 @@ -google.cloud.tpu.v1.ListAcceleratorTypesRequest - */ -class ListAcceleratorTypesRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The parent resource name. - * - * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - */ - private $parent = ''; - /** - * The maximum number of items to return. - * - * Generated from protobuf field int32 page_size = 2; - */ - private $page_size = 0; - /** - * The next_page_token value returned from a previous List request, if any. - * - * Generated from protobuf field string page_token = 3; - */ - private $page_token = ''; - /** - * List filter. - * - * Generated from protobuf field string filter = 5; - */ - private $filter = ''; - /** - * Sort results. - * - * Generated from protobuf field string order_by = 6; - */ - private $order_by = ''; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $parent - * Required. The parent resource name. - * @type int $page_size - * The maximum number of items to return. - * @type string $page_token - * The next_page_token value returned from a previous List request, if any. - * @type string $filter - * List filter. - * @type string $order_by - * Sort results. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Tpu\V1\CloudTpu::initOnce(); - parent::__construct($data); - } - - /** - * Required. The parent resource name. - * - * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @return string - */ - public function getParent() - { - return $this->parent; - } - - /** - * Required. The parent resource name. - * - * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setParent($var) - { - GPBUtil::checkString($var, True); - $this->parent = $var; - - return $this; - } - - /** - * The maximum number of items to return. - * - * Generated from protobuf field int32 page_size = 2; - * @return int - */ - public function getPageSize() - { - return $this->page_size; - } - - /** - * The maximum number of items to return. - * - * Generated from protobuf field int32 page_size = 2; - * @param int $var - * @return $this - */ - public function setPageSize($var) - { - GPBUtil::checkInt32($var); - $this->page_size = $var; - - return $this; - } - - /** - * The next_page_token value returned from a previous List request, if any. - * - * Generated from protobuf field string page_token = 3; - * @return string - */ - public function getPageToken() - { - return $this->page_token; - } - - /** - * The next_page_token value returned from a previous List request, if any. - * - * Generated from protobuf field string page_token = 3; - * @param string $var - * @return $this - */ - public function setPageToken($var) - { - GPBUtil::checkString($var, True); - $this->page_token = $var; - - return $this; - } - - /** - * List filter. - * - * Generated from protobuf field string filter = 5; - * @return string - */ - public function getFilter() - { - return $this->filter; - } - - /** - * List filter. - * - * Generated from protobuf field string filter = 5; - * @param string $var - * @return $this - */ - public function setFilter($var) - { - GPBUtil::checkString($var, True); - $this->filter = $var; - - return $this; - } - - /** - * Sort results. - * - * Generated from protobuf field string order_by = 6; - * @return string - */ - public function getOrderBy() - { - return $this->order_by; - } - - /** - * Sort results. - * - * Generated from protobuf field string order_by = 6; - * @param string $var - * @return $this - */ - public function setOrderBy($var) - { - GPBUtil::checkString($var, True); - $this->order_by = $var; - - return $this; - } - -} - diff --git a/Tpu/src/V1/ListAcceleratorTypesResponse.php b/Tpu/src/V1/ListAcceleratorTypesResponse.php deleted file mode 100644 index 9e6d0d475735..000000000000 --- a/Tpu/src/V1/ListAcceleratorTypesResponse.php +++ /dev/null @@ -1,136 +0,0 @@ -google.cloud.tpu.v1.ListAcceleratorTypesResponse - */ -class ListAcceleratorTypesResponse extends \Google\Protobuf\Internal\Message -{ - /** - * The listed nodes. - * - * Generated from protobuf field repeated .google.cloud.tpu.v1.AcceleratorType accelerator_types = 1; - */ - private $accelerator_types; - /** - * The next page token or empty if none. - * - * Generated from protobuf field string next_page_token = 2; - */ - private $next_page_token = ''; - /** - * Locations that could not be reached. - * - * Generated from protobuf field repeated string unreachable = 3; - */ - private $unreachable; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type array<\Google\Cloud\Tpu\V1\AcceleratorType>|\Google\Protobuf\Internal\RepeatedField $accelerator_types - * The listed nodes. - * @type string $next_page_token - * The next page token or empty if none. - * @type array|\Google\Protobuf\Internal\RepeatedField $unreachable - * Locations that could not be reached. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Tpu\V1\CloudTpu::initOnce(); - parent::__construct($data); - } - - /** - * The listed nodes. - * - * Generated from protobuf field repeated .google.cloud.tpu.v1.AcceleratorType accelerator_types = 1; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getAcceleratorTypes() - { - return $this->accelerator_types; - } - - /** - * The listed nodes. - * - * Generated from protobuf field repeated .google.cloud.tpu.v1.AcceleratorType accelerator_types = 1; - * @param array<\Google\Cloud\Tpu\V1\AcceleratorType>|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setAcceleratorTypes($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Tpu\V1\AcceleratorType::class); - $this->accelerator_types = $arr; - - return $this; - } - - /** - * The next page token or empty if none. - * - * Generated from protobuf field string next_page_token = 2; - * @return string - */ - public function getNextPageToken() - { - return $this->next_page_token; - } - - /** - * The next page token or empty if none. - * - * Generated from protobuf field string next_page_token = 2; - * @param string $var - * @return $this - */ - public function setNextPageToken($var) - { - GPBUtil::checkString($var, True); - $this->next_page_token = $var; - - return $this; - } - - /** - * Locations that could not be reached. - * - * Generated from protobuf field repeated string unreachable = 3; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getUnreachable() - { - return $this->unreachable; - } - - /** - * Locations that could not be reached. - * - * Generated from protobuf field repeated string unreachable = 3; - * @param array|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setUnreachable($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); - $this->unreachable = $arr; - - return $this; - } - -} - diff --git a/Tpu/src/V1/ListNodesRequest.php b/Tpu/src/V1/ListNodesRequest.php deleted file mode 100644 index 9a1522813586..000000000000 --- a/Tpu/src/V1/ListNodesRequest.php +++ /dev/null @@ -1,135 +0,0 @@ -google.cloud.tpu.v1.ListNodesRequest - */ -class ListNodesRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The parent resource name. - * - * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - */ - private $parent = ''; - /** - * The maximum number of items to return. - * - * Generated from protobuf field int32 page_size = 2; - */ - private $page_size = 0; - /** - * The next_page_token value returned from a previous List request, if any. - * - * Generated from protobuf field string page_token = 3; - */ - private $page_token = ''; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $parent - * Required. The parent resource name. - * @type int $page_size - * The maximum number of items to return. - * @type string $page_token - * The next_page_token value returned from a previous List request, if any. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Tpu\V1\CloudTpu::initOnce(); - parent::__construct($data); - } - - /** - * Required. The parent resource name. - * - * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @return string - */ - public function getParent() - { - return $this->parent; - } - - /** - * Required. The parent resource name. - * - * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setParent($var) - { - GPBUtil::checkString($var, True); - $this->parent = $var; - - return $this; - } - - /** - * The maximum number of items to return. - * - * Generated from protobuf field int32 page_size = 2; - * @return int - */ - public function getPageSize() - { - return $this->page_size; - } - - /** - * The maximum number of items to return. - * - * Generated from protobuf field int32 page_size = 2; - * @param int $var - * @return $this - */ - public function setPageSize($var) - { - GPBUtil::checkInt32($var); - $this->page_size = $var; - - return $this; - } - - /** - * The next_page_token value returned from a previous List request, if any. - * - * Generated from protobuf field string page_token = 3; - * @return string - */ - public function getPageToken() - { - return $this->page_token; - } - - /** - * The next_page_token value returned from a previous List request, if any. - * - * Generated from protobuf field string page_token = 3; - * @param string $var - * @return $this - */ - public function setPageToken($var) - { - GPBUtil::checkString($var, True); - $this->page_token = $var; - - return $this; - } - -} - diff --git a/Tpu/src/V1/ListNodesResponse.php b/Tpu/src/V1/ListNodesResponse.php deleted file mode 100644 index 082d3304cce9..000000000000 --- a/Tpu/src/V1/ListNodesResponse.php +++ /dev/null @@ -1,135 +0,0 @@ -google.cloud.tpu.v1.ListNodesResponse - */ -class ListNodesResponse extends \Google\Protobuf\Internal\Message -{ - /** - * The listed nodes. - * - * Generated from protobuf field repeated .google.cloud.tpu.v1.Node nodes = 1; - */ - private $nodes; - /** - * The next page token or empty if none. - * - * Generated from protobuf field string next_page_token = 2; - */ - private $next_page_token = ''; - /** - * Locations that could not be reached. - * - * Generated from protobuf field repeated string unreachable = 3; - */ - private $unreachable; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type array<\Google\Cloud\Tpu\V1\Node>|\Google\Protobuf\Internal\RepeatedField $nodes - * The listed nodes. - * @type string $next_page_token - * The next page token or empty if none. - * @type array|\Google\Protobuf\Internal\RepeatedField $unreachable - * Locations that could not be reached. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Tpu\V1\CloudTpu::initOnce(); - parent::__construct($data); - } - - /** - * The listed nodes. - * - * Generated from protobuf field repeated .google.cloud.tpu.v1.Node nodes = 1; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getNodes() - { - return $this->nodes; - } - - /** - * The listed nodes. - * - * Generated from protobuf field repeated .google.cloud.tpu.v1.Node nodes = 1; - * @param array<\Google\Cloud\Tpu\V1\Node>|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setNodes($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Tpu\V1\Node::class); - $this->nodes = $arr; - - return $this; - } - - /** - * The next page token or empty if none. - * - * Generated from protobuf field string next_page_token = 2; - * @return string - */ - public function getNextPageToken() - { - return $this->next_page_token; - } - - /** - * The next page token or empty if none. - * - * Generated from protobuf field string next_page_token = 2; - * @param string $var - * @return $this - */ - public function setNextPageToken($var) - { - GPBUtil::checkString($var, True); - $this->next_page_token = $var; - - return $this; - } - - /** - * Locations that could not be reached. - * - * Generated from protobuf field repeated string unreachable = 3; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getUnreachable() - { - return $this->unreachable; - } - - /** - * Locations that could not be reached. - * - * Generated from protobuf field repeated string unreachable = 3; - * @param array|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setUnreachable($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); - $this->unreachable = $arr; - - return $this; - } - -} - diff --git a/Tpu/src/V1/ListTensorFlowVersionsRequest.php b/Tpu/src/V1/ListTensorFlowVersionsRequest.php deleted file mode 100644 index 21b54cc4e699..000000000000 --- a/Tpu/src/V1/ListTensorFlowVersionsRequest.php +++ /dev/null @@ -1,204 +0,0 @@ -google.cloud.tpu.v1.ListTensorFlowVersionsRequest - */ -class ListTensorFlowVersionsRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The parent resource name. - * - * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - */ - private $parent = ''; - /** - * The maximum number of items to return. - * - * Generated from protobuf field int32 page_size = 2; - */ - private $page_size = 0; - /** - * The next_page_token value returned from a previous List request, if any. - * - * Generated from protobuf field string page_token = 3; - */ - private $page_token = ''; - /** - * List filter. - * - * Generated from protobuf field string filter = 5; - */ - private $filter = ''; - /** - * Sort results. - * - * Generated from protobuf field string order_by = 6; - */ - private $order_by = ''; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $parent - * Required. The parent resource name. - * @type int $page_size - * The maximum number of items to return. - * @type string $page_token - * The next_page_token value returned from a previous List request, if any. - * @type string $filter - * List filter. - * @type string $order_by - * Sort results. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Tpu\V1\CloudTpu::initOnce(); - parent::__construct($data); - } - - /** - * Required. The parent resource name. - * - * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @return string - */ - public function getParent() - { - return $this->parent; - } - - /** - * Required. The parent resource name. - * - * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setParent($var) - { - GPBUtil::checkString($var, True); - $this->parent = $var; - - return $this; - } - - /** - * The maximum number of items to return. - * - * Generated from protobuf field int32 page_size = 2; - * @return int - */ - public function getPageSize() - { - return $this->page_size; - } - - /** - * The maximum number of items to return. - * - * Generated from protobuf field int32 page_size = 2; - * @param int $var - * @return $this - */ - public function setPageSize($var) - { - GPBUtil::checkInt32($var); - $this->page_size = $var; - - return $this; - } - - /** - * The next_page_token value returned from a previous List request, if any. - * - * Generated from protobuf field string page_token = 3; - * @return string - */ - public function getPageToken() - { - return $this->page_token; - } - - /** - * The next_page_token value returned from a previous List request, if any. - * - * Generated from protobuf field string page_token = 3; - * @param string $var - * @return $this - */ - public function setPageToken($var) - { - GPBUtil::checkString($var, True); - $this->page_token = $var; - - return $this; - } - - /** - * List filter. - * - * Generated from protobuf field string filter = 5; - * @return string - */ - public function getFilter() - { - return $this->filter; - } - - /** - * List filter. - * - * Generated from protobuf field string filter = 5; - * @param string $var - * @return $this - */ - public function setFilter($var) - { - GPBUtil::checkString($var, True); - $this->filter = $var; - - return $this; - } - - /** - * Sort results. - * - * Generated from protobuf field string order_by = 6; - * @return string - */ - public function getOrderBy() - { - return $this->order_by; - } - - /** - * Sort results. - * - * Generated from protobuf field string order_by = 6; - * @param string $var - * @return $this - */ - public function setOrderBy($var) - { - GPBUtil::checkString($var, True); - $this->order_by = $var; - - return $this; - } - -} - diff --git a/Tpu/src/V1/ListTensorFlowVersionsResponse.php b/Tpu/src/V1/ListTensorFlowVersionsResponse.php deleted file mode 100644 index 45e22d4d0383..000000000000 --- a/Tpu/src/V1/ListTensorFlowVersionsResponse.php +++ /dev/null @@ -1,136 +0,0 @@ -google.cloud.tpu.v1.ListTensorFlowVersionsResponse - */ -class ListTensorFlowVersionsResponse extends \Google\Protobuf\Internal\Message -{ - /** - * The listed nodes. - * - * Generated from protobuf field repeated .google.cloud.tpu.v1.TensorFlowVersion tensorflow_versions = 1; - */ - private $tensorflow_versions; - /** - * The next page token or empty if none. - * - * Generated from protobuf field string next_page_token = 2; - */ - private $next_page_token = ''; - /** - * Locations that could not be reached. - * - * Generated from protobuf field repeated string unreachable = 3; - */ - private $unreachable; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type array<\Google\Cloud\Tpu\V1\TensorFlowVersion>|\Google\Protobuf\Internal\RepeatedField $tensorflow_versions - * The listed nodes. - * @type string $next_page_token - * The next page token or empty if none. - * @type array|\Google\Protobuf\Internal\RepeatedField $unreachable - * Locations that could not be reached. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Tpu\V1\CloudTpu::initOnce(); - parent::__construct($data); - } - - /** - * The listed nodes. - * - * Generated from protobuf field repeated .google.cloud.tpu.v1.TensorFlowVersion tensorflow_versions = 1; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getTensorflowVersions() - { - return $this->tensorflow_versions; - } - - /** - * The listed nodes. - * - * Generated from protobuf field repeated .google.cloud.tpu.v1.TensorFlowVersion tensorflow_versions = 1; - * @param array<\Google\Cloud\Tpu\V1\TensorFlowVersion>|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setTensorflowVersions($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Tpu\V1\TensorFlowVersion::class); - $this->tensorflow_versions = $arr; - - return $this; - } - - /** - * The next page token or empty if none. - * - * Generated from protobuf field string next_page_token = 2; - * @return string - */ - public function getNextPageToken() - { - return $this->next_page_token; - } - - /** - * The next page token or empty if none. - * - * Generated from protobuf field string next_page_token = 2; - * @param string $var - * @return $this - */ - public function setNextPageToken($var) - { - GPBUtil::checkString($var, True); - $this->next_page_token = $var; - - return $this; - } - - /** - * Locations that could not be reached. - * - * Generated from protobuf field repeated string unreachable = 3; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getUnreachable() - { - return $this->unreachable; - } - - /** - * Locations that could not be reached. - * - * Generated from protobuf field repeated string unreachable = 3; - * @param array|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setUnreachable($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); - $this->unreachable = $arr; - - return $this; - } - -} - diff --git a/Tpu/src/V1/NetworkEndpoint.php b/Tpu/src/V1/NetworkEndpoint.php deleted file mode 100644 index b4338bc322b0..000000000000 --- a/Tpu/src/V1/NetworkEndpoint.php +++ /dev/null @@ -1,101 +0,0 @@ -google.cloud.tpu.v1.NetworkEndpoint - */ -class NetworkEndpoint extends \Google\Protobuf\Internal\Message -{ - /** - * The IP address of this network endpoint. - * - * Generated from protobuf field string ip_address = 1; - */ - private $ip_address = ''; - /** - * The port of this network endpoint. - * - * Generated from protobuf field int32 port = 2; - */ - private $port = 0; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $ip_address - * The IP address of this network endpoint. - * @type int $port - * The port of this network endpoint. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Tpu\V1\CloudTpu::initOnce(); - parent::__construct($data); - } - - /** - * The IP address of this network endpoint. - * - * Generated from protobuf field string ip_address = 1; - * @return string - */ - public function getIpAddress() - { - return $this->ip_address; - } - - /** - * The IP address of this network endpoint. - * - * Generated from protobuf field string ip_address = 1; - * @param string $var - * @return $this - */ - public function setIpAddress($var) - { - GPBUtil::checkString($var, True); - $this->ip_address = $var; - - return $this; - } - - /** - * The port of this network endpoint. - * - * Generated from protobuf field int32 port = 2; - * @return int - */ - public function getPort() - { - return $this->port; - } - - /** - * The port of this network endpoint. - * - * Generated from protobuf field int32 port = 2; - * @param int $var - * @return $this - */ - public function setPort($var) - { - GPBUtil::checkInt32($var); - $this->port = $var; - - return $this; - } - -} - diff --git a/Tpu/src/V1/Node.php b/Tpu/src/V1/Node.php deleted file mode 100644 index 71d744a9aee8..000000000000 --- a/Tpu/src/V1/Node.php +++ /dev/null @@ -1,797 +0,0 @@ -google.cloud.tpu.v1.Node - */ -class Node extends \Google\Protobuf\Internal\Message -{ - /** - * Output only. Immutable. The name of the TPU - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = OUTPUT_ONLY]; - */ - private $name = ''; - /** - * The user-supplied description of the TPU. Maximum of 512 characters. - * - * Generated from protobuf field string description = 3; - */ - private $description = ''; - /** - * Required. The type of hardware accelerators associated with this node. - * - * Generated from protobuf field string accelerator_type = 5 [(.google.api.field_behavior) = REQUIRED]; - */ - private $accelerator_type = ''; - /** - * Output only. DEPRECATED! Use network_endpoints instead. - * The network address for the TPU Node as visible to Compute Engine - * instances. - * - * Generated from protobuf field string ip_address = 8 [deprecated = true]; - * @deprecated - */ - protected $ip_address = ''; - /** - * Output only. DEPRECATED! Use network_endpoints instead. - * The network port for the TPU Node as visible to Compute Engine instances. - * - * Generated from protobuf field string port = 14 [deprecated = true]; - * @deprecated - */ - protected $port = ''; - /** - * Output only. The current state for the TPU Node. - * - * Generated from protobuf field .google.cloud.tpu.v1.Node.State state = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; - */ - private $state = 0; - /** - * Output only. If this field is populated, it contains a description of why - * the TPU Node is unhealthy. - * - * Generated from protobuf field string health_description = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; - */ - private $health_description = ''; - /** - * Required. The version of Tensorflow running in the Node. - * - * Generated from protobuf field string tensorflow_version = 11 [(.google.api.field_behavior) = REQUIRED]; - */ - private $tensorflow_version = ''; - /** - * The name of a network they wish to peer the TPU node to. It must be a - * preexisting Compute Engine network inside of the project on which this API - * has been activated. If none is provided, "default" will be used. - * - * Generated from protobuf field string network = 12; - */ - private $network = ''; - /** - * The CIDR block that the TPU node will use when selecting an IP address. - * This CIDR block must be a /29 block; the Compute Engine networks API - * forbids a smaller block, and using a larger block would be wasteful (a - * node can only consume one IP address). Errors will occur if the CIDR block - * has already been used for a currently existing TPU node, the CIDR block - * conflicts with any subnetworks in the user's provided network, or the - * provided network is peered with another network that is using that CIDR - * block. - * - * Generated from protobuf field string cidr_block = 13; - */ - private $cidr_block = ''; - /** - * Output only. The service account used to run the tensor flow services - * within the node. To share resources, including Google Cloud Storage data, - * with the Tensorflow job running in the Node, this account must have - * permissions to that data. - * - * Generated from protobuf field string service_account = 15 [(.google.api.field_behavior) = OUTPUT_ONLY]; - */ - private $service_account = ''; - /** - * Output only. The time when the node was created. - * - * Generated from protobuf field .google.protobuf.Timestamp create_time = 16 [(.google.api.field_behavior) = OUTPUT_ONLY]; - */ - private $create_time = null; - /** - * The scheduling options for this node. - * - * Generated from protobuf field .google.cloud.tpu.v1.SchedulingConfig scheduling_config = 17; - */ - private $scheduling_config = null; - /** - * Output only. The network endpoints where TPU workers can be accessed and - * sent work. It is recommended that Tensorflow clients of the node reach out - * to the 0th entry in this map first. - * - * Generated from protobuf field repeated .google.cloud.tpu.v1.NetworkEndpoint network_endpoints = 21 [(.google.api.field_behavior) = OUTPUT_ONLY]; - */ - private $network_endpoints; - /** - * The health status of the TPU node. - * - * Generated from protobuf field .google.cloud.tpu.v1.Node.Health health = 22; - */ - private $health = 0; - /** - * Resource labels to represent user-provided metadata. - * - * Generated from protobuf field map labels = 24; - */ - private $labels; - /** - * Whether the VPC peering for the node is set up through Service Networking - * API. The VPC Peering should be set up before provisioning the node. - * If this field is set, cidr_block field should not be specified. If the - * network, that you want to peer the TPU Node to, is Shared VPC networks, - * the node must be created with this this field enabled. - * - * Generated from protobuf field bool use_service_networking = 27; - */ - private $use_service_networking = false; - /** - * Output only. The API version that created this Node. - * - * Generated from protobuf field .google.cloud.tpu.v1.Node.ApiVersion api_version = 38 [(.google.api.field_behavior) = OUTPUT_ONLY]; - */ - private $api_version = 0; - /** - * Output only. The Symptoms that have occurred to the TPU Node. - * - * Generated from protobuf field repeated .google.cloud.tpu.v1.Symptom symptoms = 39 [(.google.api.field_behavior) = OUTPUT_ONLY]; - */ - private $symptoms; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $name - * Output only. Immutable. The name of the TPU - * @type string $description - * The user-supplied description of the TPU. Maximum of 512 characters. - * @type string $accelerator_type - * Required. The type of hardware accelerators associated with this node. - * @type string $ip_address - * Output only. DEPRECATED! Use network_endpoints instead. - * The network address for the TPU Node as visible to Compute Engine - * instances. - * @type string $port - * Output only. DEPRECATED! Use network_endpoints instead. - * The network port for the TPU Node as visible to Compute Engine instances. - * @type int $state - * Output only. The current state for the TPU Node. - * @type string $health_description - * Output only. If this field is populated, it contains a description of why - * the TPU Node is unhealthy. - * @type string $tensorflow_version - * Required. The version of Tensorflow running in the Node. - * @type string $network - * The name of a network they wish to peer the TPU node to. It must be a - * preexisting Compute Engine network inside of the project on which this API - * has been activated. If none is provided, "default" will be used. - * @type string $cidr_block - * The CIDR block that the TPU node will use when selecting an IP address. - * This CIDR block must be a /29 block; the Compute Engine networks API - * forbids a smaller block, and using a larger block would be wasteful (a - * node can only consume one IP address). Errors will occur if the CIDR block - * has already been used for a currently existing TPU node, the CIDR block - * conflicts with any subnetworks in the user's provided network, or the - * provided network is peered with another network that is using that CIDR - * block. - * @type string $service_account - * Output only. The service account used to run the tensor flow services - * within the node. To share resources, including Google Cloud Storage data, - * with the Tensorflow job running in the Node, this account must have - * permissions to that data. - * @type \Google\Protobuf\Timestamp $create_time - * Output only. The time when the node was created. - * @type \Google\Cloud\Tpu\V1\SchedulingConfig $scheduling_config - * The scheduling options for this node. - * @type array<\Google\Cloud\Tpu\V1\NetworkEndpoint>|\Google\Protobuf\Internal\RepeatedField $network_endpoints - * Output only. The network endpoints where TPU workers can be accessed and - * sent work. It is recommended that Tensorflow clients of the node reach out - * to the 0th entry in this map first. - * @type int $health - * The health status of the TPU node. - * @type array|\Google\Protobuf\Internal\MapField $labels - * Resource labels to represent user-provided metadata. - * @type bool $use_service_networking - * Whether the VPC peering for the node is set up through Service Networking - * API. The VPC Peering should be set up before provisioning the node. - * If this field is set, cidr_block field should not be specified. If the - * network, that you want to peer the TPU Node to, is Shared VPC networks, - * the node must be created with this this field enabled. - * @type int $api_version - * Output only. The API version that created this Node. - * @type array<\Google\Cloud\Tpu\V1\Symptom>|\Google\Protobuf\Internal\RepeatedField $symptoms - * Output only. The Symptoms that have occurred to the TPU Node. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Tpu\V1\CloudTpu::initOnce(); - parent::__construct($data); - } - - /** - * Output only. Immutable. The name of the TPU - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = OUTPUT_ONLY]; - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * Output only. Immutable. The name of the TPU - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = OUTPUT_ONLY]; - * @param string $var - * @return $this - */ - public function setName($var) - { - GPBUtil::checkString($var, True); - $this->name = $var; - - return $this; - } - - /** - * The user-supplied description of the TPU. Maximum of 512 characters. - * - * Generated from protobuf field string description = 3; - * @return string - */ - public function getDescription() - { - return $this->description; - } - - /** - * The user-supplied description of the TPU. Maximum of 512 characters. - * - * Generated from protobuf field string description = 3; - * @param string $var - * @return $this - */ - public function setDescription($var) - { - GPBUtil::checkString($var, True); - $this->description = $var; - - return $this; - } - - /** - * Required. The type of hardware accelerators associated with this node. - * - * Generated from protobuf field string accelerator_type = 5 [(.google.api.field_behavior) = REQUIRED]; - * @return string - */ - public function getAcceleratorType() - { - return $this->accelerator_type; - } - - /** - * Required. The type of hardware accelerators associated with this node. - * - * Generated from protobuf field string accelerator_type = 5 [(.google.api.field_behavior) = REQUIRED]; - * @param string $var - * @return $this - */ - public function setAcceleratorType($var) - { - GPBUtil::checkString($var, True); - $this->accelerator_type = $var; - - return $this; - } - - /** - * Output only. DEPRECATED! Use network_endpoints instead. - * The network address for the TPU Node as visible to Compute Engine - * instances. - * - * Generated from protobuf field string ip_address = 8 [deprecated = true]; - * @return string - * @deprecated - */ - public function getIpAddress() - { - @trigger_error('ip_address is deprecated.', E_USER_DEPRECATED); - return $this->ip_address; - } - - /** - * Output only. DEPRECATED! Use network_endpoints instead. - * The network address for the TPU Node as visible to Compute Engine - * instances. - * - * Generated from protobuf field string ip_address = 8 [deprecated = true]; - * @param string $var - * @return $this - * @deprecated - */ - public function setIpAddress($var) - { - @trigger_error('ip_address is deprecated.', E_USER_DEPRECATED); - GPBUtil::checkString($var, True); - $this->ip_address = $var; - - return $this; - } - - /** - * Output only. DEPRECATED! Use network_endpoints instead. - * The network port for the TPU Node as visible to Compute Engine instances. - * - * Generated from protobuf field string port = 14 [deprecated = true]; - * @return string - * @deprecated - */ - public function getPort() - { - @trigger_error('port is deprecated.', E_USER_DEPRECATED); - return $this->port; - } - - /** - * Output only. DEPRECATED! Use network_endpoints instead. - * The network port for the TPU Node as visible to Compute Engine instances. - * - * Generated from protobuf field string port = 14 [deprecated = true]; - * @param string $var - * @return $this - * @deprecated - */ - public function setPort($var) - { - @trigger_error('port is deprecated.', E_USER_DEPRECATED); - GPBUtil::checkString($var, True); - $this->port = $var; - - return $this; - } - - /** - * Output only. The current state for the TPU Node. - * - * Generated from protobuf field .google.cloud.tpu.v1.Node.State state = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @return int - */ - public function getState() - { - return $this->state; - } - - /** - * Output only. The current state for the TPU Node. - * - * Generated from protobuf field .google.cloud.tpu.v1.Node.State state = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @param int $var - * @return $this - */ - public function setState($var) - { - GPBUtil::checkEnum($var, \Google\Cloud\Tpu\V1\Node\State::class); - $this->state = $var; - - return $this; - } - - /** - * Output only. If this field is populated, it contains a description of why - * the TPU Node is unhealthy. - * - * Generated from protobuf field string health_description = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @return string - */ - public function getHealthDescription() - { - return $this->health_description; - } - - /** - * Output only. If this field is populated, it contains a description of why - * the TPU Node is unhealthy. - * - * Generated from protobuf field string health_description = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @param string $var - * @return $this - */ - public function setHealthDescription($var) - { - GPBUtil::checkString($var, True); - $this->health_description = $var; - - return $this; - } - - /** - * Required. The version of Tensorflow running in the Node. - * - * Generated from protobuf field string tensorflow_version = 11 [(.google.api.field_behavior) = REQUIRED]; - * @return string - */ - public function getTensorflowVersion() - { - return $this->tensorflow_version; - } - - /** - * Required. The version of Tensorflow running in the Node. - * - * Generated from protobuf field string tensorflow_version = 11 [(.google.api.field_behavior) = REQUIRED]; - * @param string $var - * @return $this - */ - public function setTensorflowVersion($var) - { - GPBUtil::checkString($var, True); - $this->tensorflow_version = $var; - - return $this; - } - - /** - * The name of a network they wish to peer the TPU node to. It must be a - * preexisting Compute Engine network inside of the project on which this API - * has been activated. If none is provided, "default" will be used. - * - * Generated from protobuf field string network = 12; - * @return string - */ - public function getNetwork() - { - return $this->network; - } - - /** - * The name of a network they wish to peer the TPU node to. It must be a - * preexisting Compute Engine network inside of the project on which this API - * has been activated. If none is provided, "default" will be used. - * - * Generated from protobuf field string network = 12; - * @param string $var - * @return $this - */ - public function setNetwork($var) - { - GPBUtil::checkString($var, True); - $this->network = $var; - - return $this; - } - - /** - * The CIDR block that the TPU node will use when selecting an IP address. - * This CIDR block must be a /29 block; the Compute Engine networks API - * forbids a smaller block, and using a larger block would be wasteful (a - * node can only consume one IP address). Errors will occur if the CIDR block - * has already been used for a currently existing TPU node, the CIDR block - * conflicts with any subnetworks in the user's provided network, or the - * provided network is peered with another network that is using that CIDR - * block. - * - * Generated from protobuf field string cidr_block = 13; - * @return string - */ - public function getCidrBlock() - { - return $this->cidr_block; - } - - /** - * The CIDR block that the TPU node will use when selecting an IP address. - * This CIDR block must be a /29 block; the Compute Engine networks API - * forbids a smaller block, and using a larger block would be wasteful (a - * node can only consume one IP address). Errors will occur if the CIDR block - * has already been used for a currently existing TPU node, the CIDR block - * conflicts with any subnetworks in the user's provided network, or the - * provided network is peered with another network that is using that CIDR - * block. - * - * Generated from protobuf field string cidr_block = 13; - * @param string $var - * @return $this - */ - public function setCidrBlock($var) - { - GPBUtil::checkString($var, True); - $this->cidr_block = $var; - - return $this; - } - - /** - * Output only. The service account used to run the tensor flow services - * within the node. To share resources, including Google Cloud Storage data, - * with the Tensorflow job running in the Node, this account must have - * permissions to that data. - * - * Generated from protobuf field string service_account = 15 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @return string - */ - public function getServiceAccount() - { - return $this->service_account; - } - - /** - * Output only. The service account used to run the tensor flow services - * within the node. To share resources, including Google Cloud Storage data, - * with the Tensorflow job running in the Node, this account must have - * permissions to that data. - * - * Generated from protobuf field string service_account = 15 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @param string $var - * @return $this - */ - public function setServiceAccount($var) - { - GPBUtil::checkString($var, True); - $this->service_account = $var; - - return $this; - } - - /** - * Output only. The time when the node was created. - * - * Generated from protobuf field .google.protobuf.Timestamp create_time = 16 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @return \Google\Protobuf\Timestamp|null - */ - public function getCreateTime() - { - return $this->create_time; - } - - public function hasCreateTime() - { - return isset($this->create_time); - } - - public function clearCreateTime() - { - unset($this->create_time); - } - - /** - * Output only. The time when the node was created. - * - * Generated from protobuf field .google.protobuf.Timestamp create_time = 16 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @param \Google\Protobuf\Timestamp $var - * @return $this - */ - public function setCreateTime($var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); - $this->create_time = $var; - - return $this; - } - - /** - * The scheduling options for this node. - * - * Generated from protobuf field .google.cloud.tpu.v1.SchedulingConfig scheduling_config = 17; - * @return \Google\Cloud\Tpu\V1\SchedulingConfig|null - */ - public function getSchedulingConfig() - { - return $this->scheduling_config; - } - - public function hasSchedulingConfig() - { - return isset($this->scheduling_config); - } - - public function clearSchedulingConfig() - { - unset($this->scheduling_config); - } - - /** - * The scheduling options for this node. - * - * Generated from protobuf field .google.cloud.tpu.v1.SchedulingConfig scheduling_config = 17; - * @param \Google\Cloud\Tpu\V1\SchedulingConfig $var - * @return $this - */ - public function setSchedulingConfig($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Tpu\V1\SchedulingConfig::class); - $this->scheduling_config = $var; - - return $this; - } - - /** - * Output only. The network endpoints where TPU workers can be accessed and - * sent work. It is recommended that Tensorflow clients of the node reach out - * to the 0th entry in this map first. - * - * Generated from protobuf field repeated .google.cloud.tpu.v1.NetworkEndpoint network_endpoints = 21 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getNetworkEndpoints() - { - return $this->network_endpoints; - } - - /** - * Output only. The network endpoints where TPU workers can be accessed and - * sent work. It is recommended that Tensorflow clients of the node reach out - * to the 0th entry in this map first. - * - * Generated from protobuf field repeated .google.cloud.tpu.v1.NetworkEndpoint network_endpoints = 21 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @param array<\Google\Cloud\Tpu\V1\NetworkEndpoint>|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setNetworkEndpoints($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Tpu\V1\NetworkEndpoint::class); - $this->network_endpoints = $arr; - - return $this; - } - - /** - * The health status of the TPU node. - * - * Generated from protobuf field .google.cloud.tpu.v1.Node.Health health = 22; - * @return int - */ - public function getHealth() - { - return $this->health; - } - - /** - * The health status of the TPU node. - * - * Generated from protobuf field .google.cloud.tpu.v1.Node.Health health = 22; - * @param int $var - * @return $this - */ - public function setHealth($var) - { - GPBUtil::checkEnum($var, \Google\Cloud\Tpu\V1\Node\Health::class); - $this->health = $var; - - return $this; - } - - /** - * Resource labels to represent user-provided metadata. - * - * Generated from protobuf field map labels = 24; - * @return \Google\Protobuf\Internal\MapField - */ - public function getLabels() - { - return $this->labels; - } - - /** - * Resource labels to represent user-provided metadata. - * - * Generated from protobuf field map labels = 24; - * @param array|\Google\Protobuf\Internal\MapField $var - * @return $this - */ - public function setLabels($var) - { - $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); - $this->labels = $arr; - - return $this; - } - - /** - * Whether the VPC peering for the node is set up through Service Networking - * API. The VPC Peering should be set up before provisioning the node. - * If this field is set, cidr_block field should not be specified. If the - * network, that you want to peer the TPU Node to, is Shared VPC networks, - * the node must be created with this this field enabled. - * - * Generated from protobuf field bool use_service_networking = 27; - * @return bool - */ - public function getUseServiceNetworking() - { - return $this->use_service_networking; - } - - /** - * Whether the VPC peering for the node is set up through Service Networking - * API. The VPC Peering should be set up before provisioning the node. - * If this field is set, cidr_block field should not be specified. If the - * network, that you want to peer the TPU Node to, is Shared VPC networks, - * the node must be created with this this field enabled. - * - * Generated from protobuf field bool use_service_networking = 27; - * @param bool $var - * @return $this - */ - public function setUseServiceNetworking($var) - { - GPBUtil::checkBool($var); - $this->use_service_networking = $var; - - return $this; - } - - /** - * Output only. The API version that created this Node. - * - * Generated from protobuf field .google.cloud.tpu.v1.Node.ApiVersion api_version = 38 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @return int - */ - public function getApiVersion() - { - return $this->api_version; - } - - /** - * Output only. The API version that created this Node. - * - * Generated from protobuf field .google.cloud.tpu.v1.Node.ApiVersion api_version = 38 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @param int $var - * @return $this - */ - public function setApiVersion($var) - { - GPBUtil::checkEnum($var, \Google\Cloud\Tpu\V1\Node\ApiVersion::class); - $this->api_version = $var; - - return $this; - } - - /** - * Output only. The Symptoms that have occurred to the TPU Node. - * - * Generated from protobuf field repeated .google.cloud.tpu.v1.Symptom symptoms = 39 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getSymptoms() - { - return $this->symptoms; - } - - /** - * Output only. The Symptoms that have occurred to the TPU Node. - * - * Generated from protobuf field repeated .google.cloud.tpu.v1.Symptom symptoms = 39 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @param array<\Google\Cloud\Tpu\V1\Symptom>|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setSymptoms($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Tpu\V1\Symptom::class); - $this->symptoms = $arr; - - return $this; - } - -} - diff --git a/Tpu/src/V1/Node/ApiVersion.php b/Tpu/src/V1/Node/ApiVersion.php deleted file mode 100644 index 4194e7599e9c..000000000000 --- a/Tpu/src/V1/Node/ApiVersion.php +++ /dev/null @@ -1,69 +0,0 @@ -google.cloud.tpu.v1.Node.ApiVersion - */ -class ApiVersion -{ - /** - * API version is unknown. - * - * Generated from protobuf enum API_VERSION_UNSPECIFIED = 0; - */ - const API_VERSION_UNSPECIFIED = 0; - /** - * TPU API V1Alpha1 version. - * - * Generated from protobuf enum V1_ALPHA1 = 1; - */ - const V1_ALPHA1 = 1; - /** - * TPU API V1 version. - * - * Generated from protobuf enum V1 = 2; - */ - const V1 = 2; - /** - * TPU API V2Alpha1 version. - * - * Generated from protobuf enum V2_ALPHA1 = 3; - */ - const V2_ALPHA1 = 3; - - private static $valueToName = [ - self::API_VERSION_UNSPECIFIED => 'API_VERSION_UNSPECIFIED', - self::V1_ALPHA1 => 'V1_ALPHA1', - self::V1 => 'V1', - self::V2_ALPHA1 => 'V2_ALPHA1', - ]; - - public static function name($value) - { - if (!isset(self::$valueToName[$value])) { - throw new UnexpectedValueException(sprintf( - 'Enum %s has no name defined for value %s', __CLASS__, $value)); - } - return self::$valueToName[$value]; - } - - - public static function value($name) - { - $const = __CLASS__ . '::' . strtoupper($name); - if (!defined($const)) { - throw new UnexpectedValueException(sprintf( - 'Enum %s has no value defined for name %s', __CLASS__, $name)); - } - return constant($const); - } -} - - diff --git a/Tpu/src/V1/Node/Health.php b/Tpu/src/V1/Node/Health.php deleted file mode 100644 index 3a51cb57897c..000000000000 --- a/Tpu/src/V1/Node/Health.php +++ /dev/null @@ -1,85 +0,0 @@ -google.cloud.tpu.v1.Node.Health - */ -class Health -{ - /** - * Health status is unknown: not initialized or failed to retrieve. - * - * Generated from protobuf enum HEALTH_UNSPECIFIED = 0; - */ - const HEALTH_UNSPECIFIED = 0; - /** - * The resource is healthy. - * - * Generated from protobuf enum HEALTHY = 1; - */ - const HEALTHY = 1; - /** - * The resource is unhealthy. - * - * Generated from protobuf enum DEPRECATED_UNHEALTHY = 2; - */ - const DEPRECATED_UNHEALTHY = 2; - /** - * The resource is unresponsive. - * - * Generated from protobuf enum TIMEOUT = 3; - */ - const TIMEOUT = 3; - /** - * The in-guest ML stack is unhealthy. - * - * Generated from protobuf enum UNHEALTHY_TENSORFLOW = 4; - */ - const UNHEALTHY_TENSORFLOW = 4; - /** - * The node is under maintenance/priority boost caused rescheduling and - * will resume running once rescheduled. - * - * Generated from protobuf enum UNHEALTHY_MAINTENANCE = 5; - */ - const UNHEALTHY_MAINTENANCE = 5; - - private static $valueToName = [ - self::HEALTH_UNSPECIFIED => 'HEALTH_UNSPECIFIED', - self::HEALTHY => 'HEALTHY', - self::DEPRECATED_UNHEALTHY => 'DEPRECATED_UNHEALTHY', - self::TIMEOUT => 'TIMEOUT', - self::UNHEALTHY_TENSORFLOW => 'UNHEALTHY_TENSORFLOW', - self::UNHEALTHY_MAINTENANCE => 'UNHEALTHY_MAINTENANCE', - ]; - - public static function name($value) - { - if (!isset(self::$valueToName[$value])) { - throw new UnexpectedValueException(sprintf( - 'Enum %s has no name defined for value %s', __CLASS__, $value)); - } - return self::$valueToName[$value]; - } - - - public static function value($name) - { - $const = __CLASS__ . '::' . strtoupper($name); - if (!defined($const)) { - throw new UnexpectedValueException(sprintf( - 'Enum %s has no value defined for name %s', __CLASS__, $name)); - } - return constant($const); - } -} - - diff --git a/Tpu/src/V1/Node/State.php b/Tpu/src/V1/Node/State.php deleted file mode 100644 index c345632afaf3..000000000000 --- a/Tpu/src/V1/Node/State.php +++ /dev/null @@ -1,148 +0,0 @@ -google.cloud.tpu.v1.Node.State - */ -class State -{ - /** - * TPU node state is not known/set. - * - * Generated from protobuf enum STATE_UNSPECIFIED = 0; - */ - const STATE_UNSPECIFIED = 0; - /** - * TPU node is being created. - * - * Generated from protobuf enum CREATING = 1; - */ - const CREATING = 1; - /** - * TPU node has been created. - * - * Generated from protobuf enum READY = 2; - */ - const READY = 2; - /** - * TPU node is restarting. - * - * Generated from protobuf enum RESTARTING = 3; - */ - const RESTARTING = 3; - /** - * TPU node is undergoing reimaging. - * - * Generated from protobuf enum REIMAGING = 4; - */ - const REIMAGING = 4; - /** - * TPU node is being deleted. - * - * Generated from protobuf enum DELETING = 5; - */ - const DELETING = 5; - /** - * TPU node is being repaired and may be unusable. Details can be - * found in the `help_description` field. - * - * Generated from protobuf enum REPAIRING = 6; - */ - const REPAIRING = 6; - /** - * TPU node is stopped. - * - * Generated from protobuf enum STOPPED = 8; - */ - const STOPPED = 8; - /** - * TPU node is currently stopping. - * - * Generated from protobuf enum STOPPING = 9; - */ - const STOPPING = 9; - /** - * TPU node is currently starting. - * - * Generated from protobuf enum STARTING = 10; - */ - const STARTING = 10; - /** - * TPU node has been preempted. Only applies to Preemptible TPU Nodes. - * - * Generated from protobuf enum PREEMPTED = 11; - */ - const PREEMPTED = 11; - /** - * TPU node has been terminated due to maintenance or has reached the end of - * its life cycle (for preemptible nodes). - * - * Generated from protobuf enum TERMINATED = 12; - */ - const TERMINATED = 12; - /** - * TPU node is currently hiding. - * - * Generated from protobuf enum HIDING = 13; - */ - const HIDING = 13; - /** - * TPU node has been hidden. - * - * Generated from protobuf enum HIDDEN = 14; - */ - const HIDDEN = 14; - /** - * TPU node is currently unhiding. - * - * Generated from protobuf enum UNHIDING = 15; - */ - const UNHIDING = 15; - - private static $valueToName = [ - self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', - self::CREATING => 'CREATING', - self::READY => 'READY', - self::RESTARTING => 'RESTARTING', - self::REIMAGING => 'REIMAGING', - self::DELETING => 'DELETING', - self::REPAIRING => 'REPAIRING', - self::STOPPED => 'STOPPED', - self::STOPPING => 'STOPPING', - self::STARTING => 'STARTING', - self::PREEMPTED => 'PREEMPTED', - self::TERMINATED => 'TERMINATED', - self::HIDING => 'HIDING', - self::HIDDEN => 'HIDDEN', - self::UNHIDING => 'UNHIDING', - ]; - - public static function name($value) - { - if (!isset(self::$valueToName[$value])) { - throw new UnexpectedValueException(sprintf( - 'Enum %s has no name defined for value %s', __CLASS__, $value)); - } - return self::$valueToName[$value]; - } - - - public static function value($name) - { - $const = __CLASS__ . '::' . strtoupper($name); - if (!defined($const)) { - throw new UnexpectedValueException(sprintf( - 'Enum %s has no value defined for name %s', __CLASS__, $name)); - } - return constant($const); - } -} - - diff --git a/Tpu/src/V1/OperationMetadata.php b/Tpu/src/V1/OperationMetadata.php deleted file mode 100644 index db4da625bf59..000000000000 --- a/Tpu/src/V1/OperationMetadata.php +++ /dev/null @@ -1,295 +0,0 @@ -google.cloud.tpu.v1.OperationMetadata - */ -class OperationMetadata extends \Google\Protobuf\Internal\Message -{ - /** - * The time the operation was created. - * - * Generated from protobuf field .google.protobuf.Timestamp create_time = 1; - */ - private $create_time = null; - /** - * The time the operation finished running. - * - * Generated from protobuf field .google.protobuf.Timestamp end_time = 2; - */ - private $end_time = null; - /** - * Target of the operation - for example - * projects/project-1/connectivityTests/test-1 - * - * Generated from protobuf field string target = 3; - */ - private $target = ''; - /** - * Name of the verb executed by the operation. - * - * Generated from protobuf field string verb = 4; - */ - private $verb = ''; - /** - * Human-readable status of the operation, if any. - * - * Generated from protobuf field string status_detail = 5; - */ - private $status_detail = ''; - /** - * Specifies if cancellation was requested for the operation. - * - * Generated from protobuf field bool cancel_requested = 6; - */ - private $cancel_requested = false; - /** - * API version. - * - * Generated from protobuf field string api_version = 7; - */ - private $api_version = ''; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type \Google\Protobuf\Timestamp $create_time - * The time the operation was created. - * @type \Google\Protobuf\Timestamp $end_time - * The time the operation finished running. - * @type string $target - * Target of the operation - for example - * projects/project-1/connectivityTests/test-1 - * @type string $verb - * Name of the verb executed by the operation. - * @type string $status_detail - * Human-readable status of the operation, if any. - * @type bool $cancel_requested - * Specifies if cancellation was requested for the operation. - * @type string $api_version - * API version. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Tpu\V1\CloudTpu::initOnce(); - parent::__construct($data); - } - - /** - * The time the operation was created. - * - * Generated from protobuf field .google.protobuf.Timestamp create_time = 1; - * @return \Google\Protobuf\Timestamp|null - */ - public function getCreateTime() - { - return $this->create_time; - } - - public function hasCreateTime() - { - return isset($this->create_time); - } - - public function clearCreateTime() - { - unset($this->create_time); - } - - /** - * The time the operation was created. - * - * Generated from protobuf field .google.protobuf.Timestamp create_time = 1; - * @param \Google\Protobuf\Timestamp $var - * @return $this - */ - public function setCreateTime($var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); - $this->create_time = $var; - - return $this; - } - - /** - * The time the operation finished running. - * - * Generated from protobuf field .google.protobuf.Timestamp end_time = 2; - * @return \Google\Protobuf\Timestamp|null - */ - public function getEndTime() - { - return $this->end_time; - } - - public function hasEndTime() - { - return isset($this->end_time); - } - - public function clearEndTime() - { - unset($this->end_time); - } - - /** - * The time the operation finished running. - * - * Generated from protobuf field .google.protobuf.Timestamp end_time = 2; - * @param \Google\Protobuf\Timestamp $var - * @return $this - */ - public function setEndTime($var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); - $this->end_time = $var; - - return $this; - } - - /** - * Target of the operation - for example - * projects/project-1/connectivityTests/test-1 - * - * Generated from protobuf field string target = 3; - * @return string - */ - public function getTarget() - { - return $this->target; - } - - /** - * Target of the operation - for example - * projects/project-1/connectivityTests/test-1 - * - * Generated from protobuf field string target = 3; - * @param string $var - * @return $this - */ - public function setTarget($var) - { - GPBUtil::checkString($var, True); - $this->target = $var; - - return $this; - } - - /** - * Name of the verb executed by the operation. - * - * Generated from protobuf field string verb = 4; - * @return string - */ - public function getVerb() - { - return $this->verb; - } - - /** - * Name of the verb executed by the operation. - * - * Generated from protobuf field string verb = 4; - * @param string $var - * @return $this - */ - public function setVerb($var) - { - GPBUtil::checkString($var, True); - $this->verb = $var; - - return $this; - } - - /** - * Human-readable status of the operation, if any. - * - * Generated from protobuf field string status_detail = 5; - * @return string - */ - public function getStatusDetail() - { - return $this->status_detail; - } - - /** - * Human-readable status of the operation, if any. - * - * Generated from protobuf field string status_detail = 5; - * @param string $var - * @return $this - */ - public function setStatusDetail($var) - { - GPBUtil::checkString($var, True); - $this->status_detail = $var; - - return $this; - } - - /** - * Specifies if cancellation was requested for the operation. - * - * Generated from protobuf field bool cancel_requested = 6; - * @return bool - */ - public function getCancelRequested() - { - return $this->cancel_requested; - } - - /** - * Specifies if cancellation was requested for the operation. - * - * Generated from protobuf field bool cancel_requested = 6; - * @param bool $var - * @return $this - */ - public function setCancelRequested($var) - { - GPBUtil::checkBool($var); - $this->cancel_requested = $var; - - return $this; - } - - /** - * API version. - * - * Generated from protobuf field string api_version = 7; - * @return string - */ - public function getApiVersion() - { - return $this->api_version; - } - - /** - * API version. - * - * Generated from protobuf field string api_version = 7; - * @param string $var - * @return $this - */ - public function setApiVersion($var) - { - GPBUtil::checkString($var, True); - $this->api_version = $var; - - return $this; - } - -} - diff --git a/Tpu/src/V1/ReimageNodeRequest.php b/Tpu/src/V1/ReimageNodeRequest.php deleted file mode 100644 index 0f22c089635a..000000000000 --- a/Tpu/src/V1/ReimageNodeRequest.php +++ /dev/null @@ -1,101 +0,0 @@ -google.cloud.tpu.v1.ReimageNodeRequest - */ -class ReimageNodeRequest extends \Google\Protobuf\Internal\Message -{ - /** - * The resource name. - * - * Generated from protobuf field string name = 1; - */ - private $name = ''; - /** - * The version for reimage to create. - * - * Generated from protobuf field string tensorflow_version = 2; - */ - private $tensorflow_version = ''; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $name - * The resource name. - * @type string $tensorflow_version - * The version for reimage to create. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Tpu\V1\CloudTpu::initOnce(); - parent::__construct($data); - } - - /** - * The resource name. - * - * Generated from protobuf field string name = 1; - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * The resource name. - * - * Generated from protobuf field string name = 1; - * @param string $var - * @return $this - */ - public function setName($var) - { - GPBUtil::checkString($var, True); - $this->name = $var; - - return $this; - } - - /** - * The version for reimage to create. - * - * Generated from protobuf field string tensorflow_version = 2; - * @return string - */ - public function getTensorflowVersion() - { - return $this->tensorflow_version; - } - - /** - * The version for reimage to create. - * - * Generated from protobuf field string tensorflow_version = 2; - * @param string $var - * @return $this - */ - public function setTensorflowVersion($var) - { - GPBUtil::checkString($var, True); - $this->tensorflow_version = $var; - - return $this; - } - -} - diff --git a/Tpu/src/V1/SchedulingConfig.php b/Tpu/src/V1/SchedulingConfig.php deleted file mode 100644 index 51266851c602..000000000000 --- a/Tpu/src/V1/SchedulingConfig.php +++ /dev/null @@ -1,101 +0,0 @@ -google.cloud.tpu.v1.SchedulingConfig - */ -class SchedulingConfig extends \Google\Protobuf\Internal\Message -{ - /** - * Defines whether the node is preemptible. - * - * Generated from protobuf field bool preemptible = 1; - */ - private $preemptible = false; - /** - * Whether the node is created under a reservation. - * - * Generated from protobuf field bool reserved = 2; - */ - private $reserved = false; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type bool $preemptible - * Defines whether the node is preemptible. - * @type bool $reserved - * Whether the node is created under a reservation. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Tpu\V1\CloudTpu::initOnce(); - parent::__construct($data); - } - - /** - * Defines whether the node is preemptible. - * - * Generated from protobuf field bool preemptible = 1; - * @return bool - */ - public function getPreemptible() - { - return $this->preemptible; - } - - /** - * Defines whether the node is preemptible. - * - * Generated from protobuf field bool preemptible = 1; - * @param bool $var - * @return $this - */ - public function setPreemptible($var) - { - GPBUtil::checkBool($var); - $this->preemptible = $var; - - return $this; - } - - /** - * Whether the node is created under a reservation. - * - * Generated from protobuf field bool reserved = 2; - * @return bool - */ - public function getReserved() - { - return $this->reserved; - } - - /** - * Whether the node is created under a reservation. - * - * Generated from protobuf field bool reserved = 2; - * @param bool $var - * @return $this - */ - public function setReserved($var) - { - GPBUtil::checkBool($var); - $this->reserved = $var; - - return $this; - } - -} - diff --git a/Tpu/src/V1/StartNodeRequest.php b/Tpu/src/V1/StartNodeRequest.php deleted file mode 100644 index 2ed219542b12..000000000000 --- a/Tpu/src/V1/StartNodeRequest.php +++ /dev/null @@ -1,67 +0,0 @@ -google.cloud.tpu.v1.StartNodeRequest - */ -class StartNodeRequest extends \Google\Protobuf\Internal\Message -{ - /** - * The resource name. - * - * Generated from protobuf field string name = 1; - */ - private $name = ''; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $name - * The resource name. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Tpu\V1\CloudTpu::initOnce(); - parent::__construct($data); - } - - /** - * The resource name. - * - * Generated from protobuf field string name = 1; - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * The resource name. - * - * Generated from protobuf field string name = 1; - * @param string $var - * @return $this - */ - public function setName($var) - { - GPBUtil::checkString($var, True); - $this->name = $var; - - return $this; - } - -} - diff --git a/Tpu/src/V1/StopNodeRequest.php b/Tpu/src/V1/StopNodeRequest.php deleted file mode 100644 index 2d6ee22a6bb1..000000000000 --- a/Tpu/src/V1/StopNodeRequest.php +++ /dev/null @@ -1,67 +0,0 @@ -google.cloud.tpu.v1.StopNodeRequest - */ -class StopNodeRequest extends \Google\Protobuf\Internal\Message -{ - /** - * The resource name. - * - * Generated from protobuf field string name = 1; - */ - private $name = ''; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $name - * The resource name. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Tpu\V1\CloudTpu::initOnce(); - parent::__construct($data); - } - - /** - * The resource name. - * - * Generated from protobuf field string name = 1; - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * The resource name. - * - * Generated from protobuf field string name = 1; - * @param string $var - * @return $this - */ - public function setName($var) - { - GPBUtil::checkString($var, True); - $this->name = $var; - - return $this; - } - -} - diff --git a/Tpu/src/V1/Symptom.php b/Tpu/src/V1/Symptom.php deleted file mode 100644 index 02716dd61b32..000000000000 --- a/Tpu/src/V1/Symptom.php +++ /dev/null @@ -1,179 +0,0 @@ -google.cloud.tpu.v1.Symptom - */ -class Symptom extends \Google\Protobuf\Internal\Message -{ - /** - * Timestamp when the Symptom is created. - * - * Generated from protobuf field .google.protobuf.Timestamp create_time = 1; - */ - private $create_time = null; - /** - * Type of the Symptom. - * - * Generated from protobuf field .google.cloud.tpu.v1.Symptom.SymptomType symptom_type = 2; - */ - private $symptom_type = 0; - /** - * Detailed information of the current Symptom. - * - * Generated from protobuf field string details = 3; - */ - private $details = ''; - /** - * A string used to uniquely distinguish a worker within a TPU node. - * - * Generated from protobuf field string worker_id = 4; - */ - private $worker_id = ''; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type \Google\Protobuf\Timestamp $create_time - * Timestamp when the Symptom is created. - * @type int $symptom_type - * Type of the Symptom. - * @type string $details - * Detailed information of the current Symptom. - * @type string $worker_id - * A string used to uniquely distinguish a worker within a TPU node. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Tpu\V1\CloudTpu::initOnce(); - parent::__construct($data); - } - - /** - * Timestamp when the Symptom is created. - * - * Generated from protobuf field .google.protobuf.Timestamp create_time = 1; - * @return \Google\Protobuf\Timestamp|null - */ - public function getCreateTime() - { - return $this->create_time; - } - - public function hasCreateTime() - { - return isset($this->create_time); - } - - public function clearCreateTime() - { - unset($this->create_time); - } - - /** - * Timestamp when the Symptom is created. - * - * Generated from protobuf field .google.protobuf.Timestamp create_time = 1; - * @param \Google\Protobuf\Timestamp $var - * @return $this - */ - public function setCreateTime($var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); - $this->create_time = $var; - - return $this; - } - - /** - * Type of the Symptom. - * - * Generated from protobuf field .google.cloud.tpu.v1.Symptom.SymptomType symptom_type = 2; - * @return int - */ - public function getSymptomType() - { - return $this->symptom_type; - } - - /** - * Type of the Symptom. - * - * Generated from protobuf field .google.cloud.tpu.v1.Symptom.SymptomType symptom_type = 2; - * @param int $var - * @return $this - */ - public function setSymptomType($var) - { - GPBUtil::checkEnum($var, \Google\Cloud\Tpu\V1\Symptom\SymptomType::class); - $this->symptom_type = $var; - - return $this; - } - - /** - * Detailed information of the current Symptom. - * - * Generated from protobuf field string details = 3; - * @return string - */ - public function getDetails() - { - return $this->details; - } - - /** - * Detailed information of the current Symptom. - * - * Generated from protobuf field string details = 3; - * @param string $var - * @return $this - */ - public function setDetails($var) - { - GPBUtil::checkString($var, True); - $this->details = $var; - - return $this; - } - - /** - * A string used to uniquely distinguish a worker within a TPU node. - * - * Generated from protobuf field string worker_id = 4; - * @return string - */ - public function getWorkerId() - { - return $this->worker_id; - } - - /** - * A string used to uniquely distinguish a worker within a TPU node. - * - * Generated from protobuf field string worker_id = 4; - * @param string $var - * @return $this - */ - public function setWorkerId($var) - { - GPBUtil::checkString($var, True); - $this->worker_id = $var; - - return $this; - } - -} - diff --git a/Tpu/src/V1/Symptom/SymptomType.php b/Tpu/src/V1/Symptom/SymptomType.php deleted file mode 100644 index b371910e4153..000000000000 --- a/Tpu/src/V1/Symptom/SymptomType.php +++ /dev/null @@ -1,92 +0,0 @@ -google.cloud.tpu.v1.Symptom.SymptomType - */ -class SymptomType -{ - /** - * Unspecified symptom. - * - * Generated from protobuf enum SYMPTOM_TYPE_UNSPECIFIED = 0; - */ - const SYMPTOM_TYPE_UNSPECIFIED = 0; - /** - * TPU VM memory is low. - * - * Generated from protobuf enum LOW_MEMORY = 1; - */ - const LOW_MEMORY = 1; - /** - * TPU runtime is out of memory. - * - * Generated from protobuf enum OUT_OF_MEMORY = 2; - */ - const OUT_OF_MEMORY = 2; - /** - * TPU runtime execution has timed out. - * - * Generated from protobuf enum EXECUTE_TIMED_OUT = 3; - */ - const EXECUTE_TIMED_OUT = 3; - /** - * TPU runtime fails to construct a mesh that recognizes each TPU device's - * neighbors. - * - * Generated from protobuf enum MESH_BUILD_FAIL = 4; - */ - const MESH_BUILD_FAIL = 4; - /** - * TPU HBM is out of memory. - * - * Generated from protobuf enum HBM_OUT_OF_MEMORY = 5; - */ - const HBM_OUT_OF_MEMORY = 5; - /** - * Abusive behaviors have been identified on the current project. - * - * Generated from protobuf enum PROJECT_ABUSE = 6; - */ - const PROJECT_ABUSE = 6; - - private static $valueToName = [ - self::SYMPTOM_TYPE_UNSPECIFIED => 'SYMPTOM_TYPE_UNSPECIFIED', - self::LOW_MEMORY => 'LOW_MEMORY', - self::OUT_OF_MEMORY => 'OUT_OF_MEMORY', - self::EXECUTE_TIMED_OUT => 'EXECUTE_TIMED_OUT', - self::MESH_BUILD_FAIL => 'MESH_BUILD_FAIL', - self::HBM_OUT_OF_MEMORY => 'HBM_OUT_OF_MEMORY', - self::PROJECT_ABUSE => 'PROJECT_ABUSE', - ]; - - public static function name($value) - { - if (!isset(self::$valueToName[$value])) { - throw new UnexpectedValueException(sprintf( - 'Enum %s has no name defined for value %s', __CLASS__, $value)); - } - return self::$valueToName[$value]; - } - - - public static function value($name) - { - $const = __CLASS__ . '::' . strtoupper($name); - if (!defined($const)) { - throw new UnexpectedValueException(sprintf( - 'Enum %s has no value defined for name %s', __CLASS__, $name)); - } - return constant($const); - } -} - - diff --git a/Tpu/src/V1/TensorFlowVersion.php b/Tpu/src/V1/TensorFlowVersion.php deleted file mode 100644 index 8bbc07ba6e01..000000000000 --- a/Tpu/src/V1/TensorFlowVersion.php +++ /dev/null @@ -1,101 +0,0 @@ -google.cloud.tpu.v1.TensorFlowVersion - */ -class TensorFlowVersion extends \Google\Protobuf\Internal\Message -{ - /** - * The resource name. - * - * Generated from protobuf field string name = 1; - */ - private $name = ''; - /** - * the tensorflow version. - * - * Generated from protobuf field string version = 2; - */ - private $version = ''; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $name - * The resource name. - * @type string $version - * the tensorflow version. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Tpu\V1\CloudTpu::initOnce(); - parent::__construct($data); - } - - /** - * The resource name. - * - * Generated from protobuf field string name = 1; - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * The resource name. - * - * Generated from protobuf field string name = 1; - * @param string $var - * @return $this - */ - public function setName($var) - { - GPBUtil::checkString($var, True); - $this->name = $var; - - return $this; - } - - /** - * the tensorflow version. - * - * Generated from protobuf field string version = 2; - * @return string - */ - public function getVersion() - { - return $this->version; - } - - /** - * the tensorflow version. - * - * Generated from protobuf field string version = 2; - * @param string $var - * @return $this - */ - public function setVersion($var) - { - GPBUtil::checkString($var, True); - $this->version = $var; - - return $this; - } - -} - diff --git a/Tpu/src/V1/TpuClient.php b/Tpu/src/V1/TpuClient.php deleted file mode 100644 index 45b966687aa4..000000000000 --- a/Tpu/src/V1/TpuClient.php +++ /dev/null @@ -1,34 +0,0 @@ - [ - 'google.cloud.tpu.v1.Tpu' => [ - 'CreateNode' => [ - 'longRunning' => [ - 'operationReturnType' => '\Google\Cloud\Tpu\V1\Node', - 'metadataReturnType' => '\Google\Cloud\Tpu\V1\OperationMetadata', - 'initialPollDelayMillis' => '500', - 'pollDelayMultiplier' => '1.5', - 'maxPollDelayMillis' => '5000', - 'totalPollTimeoutMillis' => '300000', - ], - ], - 'DeleteNode' => [ - 'longRunning' => [ - 'operationReturnType' => '\Google\Cloud\Tpu\V1\Node', - 'metadataReturnType' => '\Google\Cloud\Tpu\V1\OperationMetadata', - 'initialPollDelayMillis' => '500', - 'pollDelayMultiplier' => '1.5', - 'maxPollDelayMillis' => '5000', - 'totalPollTimeoutMillis' => '300000', - ], - ], - 'ReimageNode' => [ - 'longRunning' => [ - 'operationReturnType' => '\Google\Cloud\Tpu\V1\Node', - 'metadataReturnType' => '\Google\Cloud\Tpu\V1\OperationMetadata', - 'initialPollDelayMillis' => '500', - 'pollDelayMultiplier' => '1.5', - 'maxPollDelayMillis' => '5000', - 'totalPollTimeoutMillis' => '300000', - ], - ], - 'StartNode' => [ - 'longRunning' => [ - 'operationReturnType' => '\Google\Cloud\Tpu\V1\Node', - 'metadataReturnType' => '\Google\Cloud\Tpu\V1\OperationMetadata', - 'initialPollDelayMillis' => '500', - 'pollDelayMultiplier' => '1.5', - 'maxPollDelayMillis' => '5000', - 'totalPollTimeoutMillis' => '300000', - ], - ], - 'StopNode' => [ - 'longRunning' => [ - 'operationReturnType' => '\Google\Cloud\Tpu\V1\Node', - 'metadataReturnType' => '\Google\Cloud\Tpu\V1\OperationMetadata', - 'initialPollDelayMillis' => '500', - 'pollDelayMultiplier' => '1.5', - 'maxPollDelayMillis' => '5000', - 'totalPollTimeoutMillis' => '300000', - ], - ], - 'ListAcceleratorTypes' => [ - 'pageStreaming' => [ - 'requestPageTokenGetMethod' => 'getPageToken', - 'requestPageTokenSetMethod' => 'setPageToken', - 'requestPageSizeGetMethod' => 'getPageSize', - 'requestPageSizeSetMethod' => 'setPageSize', - 'responsePageTokenGetMethod' => 'getNextPageToken', - 'resourcesGetMethod' => 'getAcceleratorTypes', - ], - ], - 'ListNodes' => [ - 'pageStreaming' => [ - 'requestPageTokenGetMethod' => 'getPageToken', - 'requestPageTokenSetMethod' => 'setPageToken', - 'requestPageSizeGetMethod' => 'getPageSize', - 'requestPageSizeSetMethod' => 'setPageSize', - 'responsePageTokenGetMethod' => 'getNextPageToken', - 'resourcesGetMethod' => 'getNodes', - ], - ], - 'ListTensorFlowVersions' => [ - 'pageStreaming' => [ - 'requestPageTokenGetMethod' => 'getPageToken', - 'requestPageTokenSetMethod' => 'setPageToken', - 'requestPageSizeGetMethod' => 'getPageSize', - 'requestPageSizeSetMethod' => 'setPageSize', - 'responsePageTokenGetMethod' => 'getNextPageToken', - 'resourcesGetMethod' => 'getTensorflowVersions', - ], - ], - 'GetLocation' => [ - 'interfaceOverride' => 'google.cloud.location.Locations', - ], - 'ListLocations' => [ - 'pageStreaming' => [ - 'requestPageTokenGetMethod' => 'getPageToken', - 'requestPageTokenSetMethod' => 'setPageToken', - 'requestPageSizeGetMethod' => 'getPageSize', - 'requestPageSizeSetMethod' => 'setPageSize', - 'responsePageTokenGetMethod' => 'getNextPageToken', - 'resourcesGetMethod' => 'getLocations', - ], - 'interfaceOverride' => 'google.cloud.location.Locations', - ], - ], - ], -]; diff --git a/Tpu/src/V1/resources/tpu_rest_client_config.php b/Tpu/src/V1/resources/tpu_rest_client_config.php deleted file mode 100644 index 982ab1004eea..000000000000 --- a/Tpu/src/V1/resources/tpu_rest_client_config.php +++ /dev/null @@ -1,224 +0,0 @@ - [ - 'google.cloud.location.Locations' => [ - 'GetLocation' => [ - 'method' => 'get', - 'uriTemplate' => '/v1/{name=projects/*/locations/*}', - 'placeholders' => [ - 'name' => [ - 'getters' => [ - 'getName', - ], - ], - ], - ], - 'ListLocations' => [ - 'method' => 'get', - 'uriTemplate' => '/v1/{name=projects/*}/locations', - 'placeholders' => [ - 'name' => [ - 'getters' => [ - 'getName', - ], - ], - ], - ], - ], - 'google.cloud.tpu.v1.Tpu' => [ - 'CreateNode' => [ - 'method' => 'post', - 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/nodes', - 'body' => 'node', - 'placeholders' => [ - 'parent' => [ - 'getters' => [ - 'getParent', - ], - ], - ], - ], - 'DeleteNode' => [ - 'method' => 'delete', - 'uriTemplate' => '/v1/{name=projects/*/locations/*/nodes/*}', - 'placeholders' => [ - 'name' => [ - 'getters' => [ - 'getName', - ], - ], - ], - ], - 'GetAcceleratorType' => [ - 'method' => 'get', - 'uriTemplate' => '/v1/{name=projects/*/locations/*/acceleratorTypes/*}', - 'placeholders' => [ - 'name' => [ - 'getters' => [ - 'getName', - ], - ], - ], - ], - 'GetNode' => [ - 'method' => 'get', - 'uriTemplate' => '/v1/{name=projects/*/locations/*/nodes/*}', - 'placeholders' => [ - 'name' => [ - 'getters' => [ - 'getName', - ], - ], - ], - ], - 'GetTensorFlowVersion' => [ - 'method' => 'get', - 'uriTemplate' => '/v1/{name=projects/*/locations/*/tensorflowVersions/*}', - 'placeholders' => [ - 'name' => [ - 'getters' => [ - 'getName', - ], - ], - ], - ], - 'ListAcceleratorTypes' => [ - 'method' => 'get', - 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/acceleratorTypes', - 'placeholders' => [ - 'parent' => [ - 'getters' => [ - 'getParent', - ], - ], - ], - ], - 'ListNodes' => [ - 'method' => 'get', - 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/nodes', - 'placeholders' => [ - 'parent' => [ - 'getters' => [ - 'getParent', - ], - ], - ], - ], - 'ListTensorFlowVersions' => [ - 'method' => 'get', - 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/tensorflowVersions', - 'placeholders' => [ - 'parent' => [ - 'getters' => [ - 'getParent', - ], - ], - ], - ], - 'ReimageNode' => [ - 'method' => 'post', - 'uriTemplate' => '/v1/{name=projects/*/locations/*/nodes/*}:reimage', - 'body' => '*', - 'placeholders' => [ - 'name' => [ - 'getters' => [ - 'getName', - ], - ], - ], - ], - 'StartNode' => [ - 'method' => 'post', - 'uriTemplate' => '/v1/{name=projects/*/locations/*/nodes/*}:start', - 'body' => '*', - 'placeholders' => [ - 'name' => [ - 'getters' => [ - 'getName', - ], - ], - ], - ], - 'StopNode' => [ - 'method' => 'post', - 'uriTemplate' => '/v1/{name=projects/*/locations/*/nodes/*}:stop', - 'body' => '*', - 'placeholders' => [ - 'name' => [ - 'getters' => [ - 'getName', - ], - ], - ], - ], - ], - 'google.longrunning.Operations' => [ - 'CancelOperation' => [ - 'method' => 'post', - 'uriTemplate' => '/v1/{name=projects/*/locations/*/operations/*}:cancel', - 'placeholders' => [ - 'name' => [ - 'getters' => [ - 'getName', - ], - ], - ], - ], - 'DeleteOperation' => [ - 'method' => 'delete', - 'uriTemplate' => '/v1/{name=projects/*/locations/*/operations/*}', - 'placeholders' => [ - 'name' => [ - 'getters' => [ - 'getName', - ], - ], - ], - ], - 'GetOperation' => [ - 'method' => 'get', - 'uriTemplate' => '/v1/{name=projects/*/locations/*/operations/*}', - 'placeholders' => [ - 'name' => [ - 'getters' => [ - 'getName', - ], - ], - ], - ], - 'ListOperations' => [ - 'method' => 'get', - 'uriTemplate' => '/v1/{name=projects/*/locations/*}/operations', - 'placeholders' => [ - 'name' => [ - 'getters' => [ - 'getName', - ], - ], - ], - ], - ], - ], - 'numericEnums' => true, -]; diff --git a/Tpu/src/V2/AcceleratorConfig.php b/Tpu/src/V2/AcceleratorConfig.php index ebadeb2393de..7c50941774db 100644 --- a/Tpu/src/V2/AcceleratorConfig.php +++ b/Tpu/src/V2/AcceleratorConfig.php @@ -20,13 +20,13 @@ class AcceleratorConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.tpu.v2.AcceleratorConfig.Type type = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $type = 0; + protected $type = 0; /** * Required. Topology of TPU in chips. * * Generated from protobuf field string topology = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $topology = ''; + protected $topology = ''; /** * Constructor. diff --git a/Tpu/src/V2/AcceleratorType.php b/Tpu/src/V2/AcceleratorType.php index 89ba22128021..eeb1b245c88d 100644 --- a/Tpu/src/V2/AcceleratorType.php +++ b/Tpu/src/V2/AcceleratorType.php @@ -20,13 +20,13 @@ class AcceleratorType extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1; */ - private $name = ''; + protected $name = ''; /** * The accelerator type. * * Generated from protobuf field string type = 2; */ - private $type = ''; + protected $type = ''; /** * The accelerator config. * diff --git a/Tpu/src/V2/AccessConfig.php b/Tpu/src/V2/AccessConfig.php index 71ff30d616a5..3b041666ea5e 100644 --- a/Tpu/src/V2/AccessConfig.php +++ b/Tpu/src/V2/AccessConfig.php @@ -20,7 +20,7 @@ class AccessConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string external_ip = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $external_ip = ''; + protected $external_ip = ''; /** * Constructor. diff --git a/Tpu/src/V2/AttachedDisk.php b/Tpu/src/V2/AttachedDisk.php index 4f305af34038..246f0f6075c7 100644 --- a/Tpu/src/V2/AttachedDisk.php +++ b/Tpu/src/V2/AttachedDisk.php @@ -22,7 +22,7 @@ class AttachedDisk extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string source_disk = 3; */ - private $source_disk = ''; + protected $source_disk = ''; /** * The mode in which to attach this disk. * If not specified, the default is READ_WRITE mode. @@ -30,7 +30,7 @@ class AttachedDisk extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.tpu.v2.AttachedDisk.DiskMode mode = 4; */ - private $mode = 0; + protected $mode = 0; /** * Constructor. diff --git a/Tpu/src/V2/Client/TpuClient.php b/Tpu/src/V2/Client/TpuClient.php index 572196d7187d..d0be173f6614 100644 --- a/Tpu/src/V2/Client/TpuClient.php +++ b/Tpu/src/V2/Client/TpuClient.php @@ -1,6 +1,6 @@ descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : []; + $options = isset($this->descriptors[$methodName]['longRunning']) + ? $this->descriptors[$methodName]['longRunning'] + : []; $operation = new OperationResponse($operationName, $this->getOperationsClient(), $options); $operation->reload(); return $operation; @@ -276,14 +275,14 @@ public static function runtimeVersionName(string $project, string $location, str * listed, then parseName will check each of the supported templates, and return * the first match. * - * @param string $formattedName The formatted name string - * @param ?string $template Optional name of template to match + * @param string $formattedName The formatted name string + * @param string $template Optional name of template to match * * @return array An associative array from name component IDs to component values. * * @throws ValidationException If $formattedName could not be matched. */ - public static function parseName(string $formattedName, ?string $template = null): array + public static function parseName(string $formattedName, string $template = null): array { return self::parseFormattedName($formattedName, $template); } @@ -338,9 +337,6 @@ public static function parseName(string $formattedName, ?string $template = null * @type callable $clientCertSource * A callable which returns the client cert as a string. This can be used to * provide a certificate and private key to the transport layer for mTLS. - * @type false|LoggerInterface $logger - * A PSR-3 compliant logger. If set to false, logging is disabled, ignoring the - * 'GOOGLE_SDK_PHP_LOGGING' environment flag * } * * @throws ValidationException @@ -436,8 +432,10 @@ public function deleteNode(DeleteNodeRequest $request, array $callOptions = []): * * @throws ApiException Thrown if the API call fails. */ - public function generateServiceIdentity(GenerateServiceIdentityRequest $request, array $callOptions = []): GenerateServiceIdentityResponse - { + public function generateServiceIdentity( + GenerateServiceIdentityRequest $request, + array $callOptions = [] + ): GenerateServiceIdentityResponse { return $this->startApiCall('GenerateServiceIdentity', $request, $callOptions)->wait(); } @@ -488,8 +486,10 @@ public function getAcceleratorType(GetAcceleratorTypeRequest $request, array $ca * * @throws ApiException Thrown if the API call fails. */ - public function getGuestAttributes(GetGuestAttributesRequest $request, array $callOptions = []): GetGuestAttributesResponse - { + public function getGuestAttributes( + GetGuestAttributesRequest $request, + array $callOptions = [] + ): GetGuestAttributesResponse { return $this->startApiCall('GetGuestAttributes', $request, $callOptions)->wait(); } @@ -566,8 +566,10 @@ public function getRuntimeVersion(GetRuntimeVersionRequest $request, array $call * * @throws ApiException Thrown if the API call fails. */ - public function listAcceleratorTypes(ListAcceleratorTypesRequest $request, array $callOptions = []): PagedListResponse - { + public function listAcceleratorTypes( + ListAcceleratorTypesRequest $request, + array $callOptions = [] + ): PagedListResponse { return $this->startApiCall('ListAcceleratorTypes', $request, $callOptions); } diff --git a/Tpu/src/V2/CreateNodeRequest.php b/Tpu/src/V2/CreateNodeRequest.php index 225b9fe34c9a..969d7fa4a370 100644 --- a/Tpu/src/V2/CreateNodeRequest.php +++ b/Tpu/src/V2/CreateNodeRequest.php @@ -20,19 +20,19 @@ class CreateNodeRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * The unqualified resource name. * * Generated from protobuf field string node_id = 2; */ - private $node_id = ''; + protected $node_id = ''; /** * Required. The node. * * Generated from protobuf field .google.cloud.tpu.v2.Node node = 3 [(.google.api.field_behavior) = REQUIRED]; */ - private $node = null; + protected $node = null; /** * @param string $parent Required. The parent resource name. Please see diff --git a/Tpu/src/V2/DeleteNodeRequest.php b/Tpu/src/V2/DeleteNodeRequest.php index d789710009f9..44f643988baa 100644 --- a/Tpu/src/V2/DeleteNodeRequest.php +++ b/Tpu/src/V2/DeleteNodeRequest.php @@ -20,7 +20,7 @@ class DeleteNodeRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * @param string $name Required. The resource name. Please see diff --git a/Tpu/src/V2/GenerateServiceIdentityRequest.php b/Tpu/src/V2/GenerateServiceIdentityRequest.php index 60fdf8b5cd1c..7dd5df7d149d 100644 --- a/Tpu/src/V2/GenerateServiceIdentityRequest.php +++ b/Tpu/src/V2/GenerateServiceIdentityRequest.php @@ -21,7 +21,7 @@ class GenerateServiceIdentityRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * Constructor. diff --git a/Tpu/src/V2/GenerateServiceIdentityResponse.php b/Tpu/src/V2/GenerateServiceIdentityResponse.php index 71b8313b5afc..81731c6854a2 100644 --- a/Tpu/src/V2/GenerateServiceIdentityResponse.php +++ b/Tpu/src/V2/GenerateServiceIdentityResponse.php @@ -21,7 +21,7 @@ class GenerateServiceIdentityResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.tpu.v2.ServiceIdentity identity = 1; */ - private $identity = null; + protected $identity = null; /** * Constructor. diff --git a/Tpu/src/V2/GetAcceleratorTypeRequest.php b/Tpu/src/V2/GetAcceleratorTypeRequest.php index 33f3e1127ddf..55bb38fc7fac 100644 --- a/Tpu/src/V2/GetAcceleratorTypeRequest.php +++ b/Tpu/src/V2/GetAcceleratorTypeRequest.php @@ -20,7 +20,7 @@ class GetAcceleratorTypeRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * @param string $name Required. The resource name. Please see diff --git a/Tpu/src/V2/GetGuestAttributesRequest.php b/Tpu/src/V2/GetGuestAttributesRequest.php index 4905f1d13c5c..74e47599eae5 100644 --- a/Tpu/src/V2/GetGuestAttributesRequest.php +++ b/Tpu/src/V2/GetGuestAttributesRequest.php @@ -20,13 +20,13 @@ class GetGuestAttributesRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * The guest attributes path to be queried. * * Generated from protobuf field string query_path = 2; */ - private $query_path = ''; + protected $query_path = ''; /** * The 0-based worker ID. If it is empty, all workers' GuestAttributes will be * returned. diff --git a/Tpu/src/V2/GetNodeRequest.php b/Tpu/src/V2/GetNodeRequest.php index eac6c377c903..087299e90ca2 100644 --- a/Tpu/src/V2/GetNodeRequest.php +++ b/Tpu/src/V2/GetNodeRequest.php @@ -20,7 +20,7 @@ class GetNodeRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * @param string $name Required. The resource name. Please see diff --git a/Tpu/src/V2/GetRuntimeVersionRequest.php b/Tpu/src/V2/GetRuntimeVersionRequest.php index e2c7df62a96d..dde6c2194dd2 100644 --- a/Tpu/src/V2/GetRuntimeVersionRequest.php +++ b/Tpu/src/V2/GetRuntimeVersionRequest.php @@ -20,7 +20,7 @@ class GetRuntimeVersionRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * @param string $name Required. The resource name. Please see diff --git a/Tpu/src/V2/GuestAttributes.php b/Tpu/src/V2/GuestAttributes.php index 5e657bc5cbac..b87b881016a1 100644 --- a/Tpu/src/V2/GuestAttributes.php +++ b/Tpu/src/V2/GuestAttributes.php @@ -22,13 +22,13 @@ class GuestAttributes extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string query_path = 1; */ - private $query_path = ''; + protected $query_path = ''; /** * The value of the requested queried path. * * Generated from protobuf field .google.cloud.tpu.v2.GuestAttributesValue query_value = 2; */ - private $query_value = null; + protected $query_value = null; /** * Constructor. diff --git a/Tpu/src/V2/GuestAttributesEntry.php b/Tpu/src/V2/GuestAttributesEntry.php index 70da756414f8..e854d48559e5 100644 --- a/Tpu/src/V2/GuestAttributesEntry.php +++ b/Tpu/src/V2/GuestAttributesEntry.php @@ -20,19 +20,19 @@ class GuestAttributesEntry extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string namespace = 1; */ - private $namespace = ''; + protected $namespace = ''; /** * Key for the guest attribute entry. * * Generated from protobuf field string key = 2; */ - private $key = ''; + protected $key = ''; /** * Value for the guest attribute entry. * * Generated from protobuf field string value = 3; */ - private $value = ''; + protected $value = ''; /** * Constructor. diff --git a/Tpu/src/V2/ListAcceleratorTypesRequest.php b/Tpu/src/V2/ListAcceleratorTypesRequest.php index 2bcfdba8cd8b..e9bc2618b215 100644 --- a/Tpu/src/V2/ListAcceleratorTypesRequest.php +++ b/Tpu/src/V2/ListAcceleratorTypesRequest.php @@ -21,31 +21,31 @@ class ListAcceleratorTypesRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * The maximum number of items to return. * * Generated from protobuf field int32 page_size = 2; */ - private $page_size = 0; + protected $page_size = 0; /** * The next_page_token value returned from a previous List request, if any. * * Generated from protobuf field string page_token = 3; */ - private $page_token = ''; + protected $page_token = ''; /** * List filter. * * Generated from protobuf field string filter = 5; */ - private $filter = ''; + protected $filter = ''; /** * Sort results. * * Generated from protobuf field string order_by = 6; */ - private $order_by = ''; + protected $order_by = ''; /** * @param string $parent Required. The parent resource name. Please see diff --git a/Tpu/src/V2/ListAcceleratorTypesResponse.php b/Tpu/src/V2/ListAcceleratorTypesResponse.php index 870af627cb68..da739205691f 100644 --- a/Tpu/src/V2/ListAcceleratorTypesResponse.php +++ b/Tpu/src/V2/ListAcceleratorTypesResponse.php @@ -27,7 +27,7 @@ class ListAcceleratorTypesResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string next_page_token = 2; */ - private $next_page_token = ''; + protected $next_page_token = ''; /** * Locations that could not be reached. * diff --git a/Tpu/src/V2/ListNodesRequest.php b/Tpu/src/V2/ListNodesRequest.php index 95e88747e4e6..5c500f37efd3 100644 --- a/Tpu/src/V2/ListNodesRequest.php +++ b/Tpu/src/V2/ListNodesRequest.php @@ -20,19 +20,19 @@ class ListNodesRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * The maximum number of items to return. * * Generated from protobuf field int32 page_size = 2; */ - private $page_size = 0; + protected $page_size = 0; /** * The next_page_token value returned from a previous List request, if any. * * Generated from protobuf field string page_token = 3; */ - private $page_token = ''; + protected $page_token = ''; /** * @param string $parent Required. The parent resource name. Please see diff --git a/Tpu/src/V2/ListNodesResponse.php b/Tpu/src/V2/ListNodesResponse.php index 07dad56783f0..de31a212e25f 100644 --- a/Tpu/src/V2/ListNodesResponse.php +++ b/Tpu/src/V2/ListNodesResponse.php @@ -26,7 +26,7 @@ class ListNodesResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string next_page_token = 2; */ - private $next_page_token = ''; + protected $next_page_token = ''; /** * Locations that could not be reached. * diff --git a/Tpu/src/V2/ListRuntimeVersionsRequest.php b/Tpu/src/V2/ListRuntimeVersionsRequest.php index 19ab0436f87d..fd9596d6d199 100644 --- a/Tpu/src/V2/ListRuntimeVersionsRequest.php +++ b/Tpu/src/V2/ListRuntimeVersionsRequest.php @@ -21,31 +21,31 @@ class ListRuntimeVersionsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * The maximum number of items to return. * * Generated from protobuf field int32 page_size = 2; */ - private $page_size = 0; + protected $page_size = 0; /** * The next_page_token value returned from a previous List request, if any. * * Generated from protobuf field string page_token = 3; */ - private $page_token = ''; + protected $page_token = ''; /** * List filter. * * Generated from protobuf field string filter = 5; */ - private $filter = ''; + protected $filter = ''; /** * Sort results. * * Generated from protobuf field string order_by = 6; */ - private $order_by = ''; + protected $order_by = ''; /** * @param string $parent Required. The parent resource name. Please see diff --git a/Tpu/src/V2/ListRuntimeVersionsResponse.php b/Tpu/src/V2/ListRuntimeVersionsResponse.php index ea67be38136c..30b41ec3e8a9 100644 --- a/Tpu/src/V2/ListRuntimeVersionsResponse.php +++ b/Tpu/src/V2/ListRuntimeVersionsResponse.php @@ -27,7 +27,7 @@ class ListRuntimeVersionsResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string next_page_token = 2; */ - private $next_page_token = ''; + protected $next_page_token = ''; /** * Locations that could not be reached. * diff --git a/Tpu/src/V2/NetworkConfig.php b/Tpu/src/V2/NetworkConfig.php index f9352b3cdf1a..34fdb30cd9e8 100644 --- a/Tpu/src/V2/NetworkConfig.php +++ b/Tpu/src/V2/NetworkConfig.php @@ -21,7 +21,7 @@ class NetworkConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string network = 1; */ - private $network = ''; + protected $network = ''; /** * The name of the subnetwork for the TPU node. It must be a preexisting * Google Compute Engine subnetwork. If none is provided, "default" will be @@ -29,7 +29,7 @@ class NetworkConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string subnetwork = 2; */ - private $subnetwork = ''; + protected $subnetwork = ''; /** * Indicates that external IP addresses would be associated with the TPU * workers. If set to false, the specified subnetwork or network should have @@ -37,7 +37,7 @@ class NetworkConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field bool enable_external_ips = 3; */ - private $enable_external_ips = false; + protected $enable_external_ips = false; /** * Allows the TPU node to send and receive packets with non-matching * destination or source IPs. This is required if you plan to use the TPU @@ -45,7 +45,7 @@ class NetworkConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field bool can_ip_forward = 4; */ - private $can_ip_forward = false; + protected $can_ip_forward = false; /** * Constructor. diff --git a/Tpu/src/V2/NetworkEndpoint.php b/Tpu/src/V2/NetworkEndpoint.php index b991cc22cc50..96c0447e55ce 100644 --- a/Tpu/src/V2/NetworkEndpoint.php +++ b/Tpu/src/V2/NetworkEndpoint.php @@ -20,19 +20,19 @@ class NetworkEndpoint extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string ip_address = 1; */ - private $ip_address = ''; + protected $ip_address = ''; /** * The port of this network endpoint. * * Generated from protobuf field int32 port = 2; */ - private $port = 0; + protected $port = 0; /** * The access config for the TPU worker. * * Generated from protobuf field .google.cloud.tpu.v2.AccessConfig access_config = 5; */ - private $access_config = null; + protected $access_config = null; /** * Constructor. diff --git a/Tpu/src/V2/Node.php b/Tpu/src/V2/Node.php index df5c34463bd0..d8cb3157b607 100644 --- a/Tpu/src/V2/Node.php +++ b/Tpu/src/V2/Node.php @@ -20,44 +20,44 @@ class Node extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.field_behavior) = IMMUTABLE]; */ - private $name = ''; + protected $name = ''; /** * The user-supplied description of the TPU. Maximum of 512 characters. * * Generated from protobuf field string description = 3; */ - private $description = ''; + protected $description = ''; /** * Optional. The type of hardware accelerators associated with this node. * * Generated from protobuf field string accelerator_type = 5 [(.google.api.field_behavior) = OPTIONAL]; */ - private $accelerator_type = ''; + protected $accelerator_type = ''; /** * Output only. The current state for the TPU Node. * * Generated from protobuf field .google.cloud.tpu.v2.Node.State state = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $state = 0; + protected $state = 0; /** * Output only. If this field is populated, it contains a description of why * the TPU Node is unhealthy. * * Generated from protobuf field string health_description = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $health_description = ''; + protected $health_description = ''; /** * Required. The runtime version running in the Node. * * Generated from protobuf field string runtime_version = 11 [(.google.api.field_behavior) = REQUIRED]; */ - private $runtime_version = ''; + protected $runtime_version = ''; /** * Network configurations for the TPU node. * * Generated from protobuf field .google.cloud.tpu.v2.NetworkConfig network_config = 36; */ - private $network_config = null; + protected $network_config = null; /** * The CIDR block that the TPU node will use when selecting an IP address. * This CIDR block must be a /29 block; the Compute Engine networks API @@ -70,26 +70,26 @@ class Node extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string cidr_block = 13; */ - private $cidr_block = ''; + protected $cidr_block = ''; /** * The Google Cloud Platform Service Account to be used by the TPU node VMs. * If None is specified, the default compute service account will be used. * * Generated from protobuf field .google.cloud.tpu.v2.ServiceAccount service_account = 37; */ - private $service_account = null; + protected $service_account = null; /** * Output only. The time when the node was created. * * Generated from protobuf field .google.protobuf.Timestamp create_time = 16 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $create_time = null; + protected $create_time = null; /** * The scheduling options for this node. * * Generated from protobuf field .google.cloud.tpu.v2.SchedulingConfig scheduling_config = 17; */ - private $scheduling_config = null; + protected $scheduling_config = null; /** * Output only. The network endpoints where TPU workers can be accessed and * sent work. It is recommended that runtime clients of the node reach out @@ -103,7 +103,7 @@ class Node extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.tpu.v2.Node.Health health = 22; */ - private $health = 0; + protected $health = 0; /** * Resource labels to represent user-provided metadata. * @@ -129,7 +129,7 @@ class Node extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int64 id = 33 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $id = 0; + protected $id = 0; /** * The additional data disks for the Node. * @@ -141,7 +141,7 @@ class Node extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.tpu.v2.Node.ApiVersion api_version = 38 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $api_version = 0; + protected $api_version = 0; /** * Output only. The Symptoms that have occurred to the TPU Node. * @@ -153,26 +153,26 @@ class Node extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.tpu.v2.ShieldedInstanceConfig shielded_instance_config = 45; */ - private $shielded_instance_config = null; + protected $shielded_instance_config = null; /** * The AccleratorConfig for the TPU Node. * * Generated from protobuf field .google.cloud.tpu.v2.AcceleratorConfig accelerator_config = 46; */ - private $accelerator_config = null; + protected $accelerator_config = null; /** * Output only. The qualified name of the QueuedResource that requested this * Node. * * Generated from protobuf field string queued_resource = 47 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $queued_resource = ''; + protected $queued_resource = ''; /** * Output only. Whether the Node belongs to a Multislice group. * * Generated from protobuf field bool multislice_node = 48 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $multislice_node = false; + protected $multislice_node = false; /** * Constructor. diff --git a/Tpu/src/V2/OperationMetadata.php b/Tpu/src/V2/OperationMetadata.php index 913ff3635fa7..a379c95e6f14 100644 --- a/Tpu/src/V2/OperationMetadata.php +++ b/Tpu/src/V2/OperationMetadata.php @@ -20,44 +20,44 @@ class OperationMetadata extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Timestamp create_time = 1; */ - private $create_time = null; + protected $create_time = null; /** * The time the operation finished running. * * Generated from protobuf field .google.protobuf.Timestamp end_time = 2; */ - private $end_time = null; + protected $end_time = null; /** * Target of the operation - for example * projects/project-1/connectivityTests/test-1 * * Generated from protobuf field string target = 3; */ - private $target = ''; + protected $target = ''; /** * Name of the verb executed by the operation. * * Generated from protobuf field string verb = 4; */ - private $verb = ''; + protected $verb = ''; /** * Human-readable status of the operation, if any. * * Generated from protobuf field string status_detail = 5; */ - private $status_detail = ''; + protected $status_detail = ''; /** * Specifies if cancellation was requested for the operation. * * Generated from protobuf field bool cancel_requested = 6; */ - private $cancel_requested = false; + protected $cancel_requested = false; /** * API version. * * Generated from protobuf field string api_version = 7; */ - private $api_version = ''; + protected $api_version = ''; /** * Constructor. diff --git a/Tpu/src/V2/RuntimeVersion.php b/Tpu/src/V2/RuntimeVersion.php index a5d50dea3aba..f22ae02ff60d 100644 --- a/Tpu/src/V2/RuntimeVersion.php +++ b/Tpu/src/V2/RuntimeVersion.php @@ -20,13 +20,13 @@ class RuntimeVersion extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1; */ - private $name = ''; + protected $name = ''; /** * The runtime version. * * Generated from protobuf field string version = 2; */ - private $version = ''; + protected $version = ''; /** * Constructor. diff --git a/Tpu/src/V2/SchedulingConfig.php b/Tpu/src/V2/SchedulingConfig.php index 2a6321924447..b4da318b761c 100644 --- a/Tpu/src/V2/SchedulingConfig.php +++ b/Tpu/src/V2/SchedulingConfig.php @@ -20,13 +20,13 @@ class SchedulingConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field bool preemptible = 1; */ - private $preemptible = false; + protected $preemptible = false; /** * Whether the node is created under a reservation. * * Generated from protobuf field bool reserved = 2; */ - private $reserved = false; + protected $reserved = false; /** * Constructor. diff --git a/Tpu/src/V2/ServiceAccount.php b/Tpu/src/V2/ServiceAccount.php index e4ad2d079099..d60a1baef2b7 100644 --- a/Tpu/src/V2/ServiceAccount.php +++ b/Tpu/src/V2/ServiceAccount.php @@ -21,7 +21,7 @@ class ServiceAccount extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string email = 1; */ - private $email = ''; + protected $email = ''; /** * The list of scopes to be made available for this service account. If empty, * access to all Cloud APIs will be allowed. diff --git a/Tpu/src/V2/ServiceIdentity.php b/Tpu/src/V2/ServiceIdentity.php index 605940d6c18f..2e2ead14fdfd 100644 --- a/Tpu/src/V2/ServiceIdentity.php +++ b/Tpu/src/V2/ServiceIdentity.php @@ -20,7 +20,7 @@ class ServiceIdentity extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string email = 1; */ - private $email = ''; + protected $email = ''; /** * Constructor. diff --git a/Tpu/src/V2/ShieldedInstanceConfig.php b/Tpu/src/V2/ShieldedInstanceConfig.php index f72e4ccd259f..26d257130719 100644 --- a/Tpu/src/V2/ShieldedInstanceConfig.php +++ b/Tpu/src/V2/ShieldedInstanceConfig.php @@ -20,7 +20,7 @@ class ShieldedInstanceConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field bool enable_secure_boot = 1; */ - private $enable_secure_boot = false; + protected $enable_secure_boot = false; /** * Constructor. diff --git a/Tpu/src/V2/StartNodeRequest.php b/Tpu/src/V2/StartNodeRequest.php index 4416b38b9390..31f7c5bc5c13 100644 --- a/Tpu/src/V2/StartNodeRequest.php +++ b/Tpu/src/V2/StartNodeRequest.php @@ -20,7 +20,7 @@ class StartNodeRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * Constructor. diff --git a/Tpu/src/V2/StopNodeRequest.php b/Tpu/src/V2/StopNodeRequest.php index 8805acefbe35..ffa5a6bf091f 100644 --- a/Tpu/src/V2/StopNodeRequest.php +++ b/Tpu/src/V2/StopNodeRequest.php @@ -20,7 +20,7 @@ class StopNodeRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * Constructor. diff --git a/Tpu/src/V2/Symptom.php b/Tpu/src/V2/Symptom.php index a59c26c2cdf1..647e1eb91a08 100644 --- a/Tpu/src/V2/Symptom.php +++ b/Tpu/src/V2/Symptom.php @@ -20,25 +20,25 @@ class Symptom extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Timestamp create_time = 1; */ - private $create_time = null; + protected $create_time = null; /** * Type of the Symptom. * * Generated from protobuf field .google.cloud.tpu.v2.Symptom.SymptomType symptom_type = 2; */ - private $symptom_type = 0; + protected $symptom_type = 0; /** * Detailed information of the current Symptom. * * Generated from protobuf field string details = 3; */ - private $details = ''; + protected $details = ''; /** * A string used to uniquely distinguish a worker within a TPU node. * * Generated from protobuf field string worker_id = 4; */ - private $worker_id = ''; + protected $worker_id = ''; /** * Constructor. diff --git a/Tpu/src/V2/UpdateNodeRequest.php b/Tpu/src/V2/UpdateNodeRequest.php index ef4d619bf875..ccf8a1a8a1aa 100644 --- a/Tpu/src/V2/UpdateNodeRequest.php +++ b/Tpu/src/V2/UpdateNodeRequest.php @@ -22,13 +22,13 @@ class UpdateNodeRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $update_mask = null; + protected $update_mask = null; /** * Required. The node. Only fields specified in update_mask are updated. * * Generated from protobuf field .google.cloud.tpu.v2.Node node = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $node = null; + protected $node = null; /** * @param \Google\Cloud\Tpu\V2\Node $node Required. The node. Only fields specified in update_mask are updated. diff --git a/Tpu/tests/Unit/V1/TpuClientTest.php b/Tpu/tests/Unit/V1/TpuClientTest.php deleted file mode 100644 index 2517408f2df0..000000000000 --- a/Tpu/tests/Unit/V1/TpuClientTest.php +++ /dev/null @@ -1,1289 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return TpuClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new TpuClient($options); - } - - /** @test */ - public function createNodeTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/createNodeTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $description = 'description-1724546052'; - $acceleratorType = 'acceleratorType1748643982'; - $ipAddress = 'ipAddress1480014044'; - $port = 'port3446913'; - $healthDescription = 'healthDescription-1057342823'; - $tensorflowVersion = 'tensorflowVersion-1353701984'; - $network = 'network1843485230'; - $cidrBlock = 'cidrBlock313022466'; - $serviceAccount = 'serviceAccount-1948028253'; - $useServiceNetworking = true; - $expectedResponse = new Node(); - $expectedResponse->setName($name); - $expectedResponse->setDescription($description); - $expectedResponse->setAcceleratorType($acceleratorType); - $expectedResponse->setIpAddress($ipAddress); - $expectedResponse->setPort($port); - $expectedResponse->setHealthDescription($healthDescription); - $expectedResponse->setTensorflowVersion($tensorflowVersion); - $expectedResponse->setNetwork($network); - $expectedResponse->setCidrBlock($cidrBlock); - $expectedResponse->setServiceAccount($serviceAccount); - $expectedResponse->setUseServiceNetworking($useServiceNetworking); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/createNodeTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $node = new Node(); - $nodeAcceleratorType = 'nodeAcceleratorType-620315165'; - $node->setAcceleratorType($nodeAcceleratorType); - $nodeTensorflowVersion = 'nodeTensorflowVersion-1950315537'; - $node->setTensorflowVersion($nodeTensorflowVersion); - $response = $gapicClient->createNode($formattedParent, $node); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.tpu.v1.Tpu/CreateNode', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualApiRequestObject->getNode(); - $this->assertProtobufEquals($node, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createNodeTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function createNodeExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/createNodeTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $node = new Node(); - $nodeAcceleratorType = 'nodeAcceleratorType-620315165'; - $node->setAcceleratorType($nodeAcceleratorType); - $nodeTensorflowVersion = 'nodeTensorflowVersion-1950315537'; - $node->setTensorflowVersion($nodeTensorflowVersion); - $response = $gapicClient->createNode($formattedParent, $node); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createNodeTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteNodeTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/deleteNodeTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name2 = 'name2-1052831874'; - $description = 'description-1724546052'; - $acceleratorType = 'acceleratorType1748643982'; - $ipAddress = 'ipAddress1480014044'; - $port = 'port3446913'; - $healthDescription = 'healthDescription-1057342823'; - $tensorflowVersion = 'tensorflowVersion-1353701984'; - $network = 'network1843485230'; - $cidrBlock = 'cidrBlock313022466'; - $serviceAccount = 'serviceAccount-1948028253'; - $useServiceNetworking = true; - $expectedResponse = new Node(); - $expectedResponse->setName($name2); - $expectedResponse->setDescription($description); - $expectedResponse->setAcceleratorType($acceleratorType); - $expectedResponse->setIpAddress($ipAddress); - $expectedResponse->setPort($port); - $expectedResponse->setHealthDescription($healthDescription); - $expectedResponse->setTensorflowVersion($tensorflowVersion); - $expectedResponse->setNetwork($network); - $expectedResponse->setCidrBlock($cidrBlock); - $expectedResponse->setServiceAccount($serviceAccount); - $expectedResponse->setUseServiceNetworking($useServiceNetworking); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/deleteNodeTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedName = $gapicClient->nodeName('[PROJECT]', '[LOCATION]', '[NODE]'); - $response = $gapicClient->deleteNode($formattedName); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.tpu.v1.Tpu/DeleteNode', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteNodeTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteNodeExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/deleteNodeTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->nodeName('[PROJECT]', '[LOCATION]', '[NODE]'); - $response = $gapicClient->deleteNode($formattedName); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteNodeTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function getAcceleratorTypeTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $type = 'type3575610'; - $expectedResponse = new AcceleratorType(); - $expectedResponse->setName($name2); - $expectedResponse->setType($type); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->acceleratorTypeName('[PROJECT]', '[LOCATION]', '[ACCELERATOR_TYPE]'); - $response = $gapicClient->getAcceleratorType($formattedName); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.tpu.v1.Tpu/GetAcceleratorType', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getAcceleratorTypeExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->acceleratorTypeName('[PROJECT]', '[LOCATION]', '[ACCELERATOR_TYPE]'); - try { - $gapicClient->getAcceleratorType($formattedName); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getNodeTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $description = 'description-1724546052'; - $acceleratorType = 'acceleratorType1748643982'; - $ipAddress = 'ipAddress1480014044'; - $port = 'port3446913'; - $healthDescription = 'healthDescription-1057342823'; - $tensorflowVersion = 'tensorflowVersion-1353701984'; - $network = 'network1843485230'; - $cidrBlock = 'cidrBlock313022466'; - $serviceAccount = 'serviceAccount-1948028253'; - $useServiceNetworking = true; - $expectedResponse = new Node(); - $expectedResponse->setName($name2); - $expectedResponse->setDescription($description); - $expectedResponse->setAcceleratorType($acceleratorType); - $expectedResponse->setIpAddress($ipAddress); - $expectedResponse->setPort($port); - $expectedResponse->setHealthDescription($healthDescription); - $expectedResponse->setTensorflowVersion($tensorflowVersion); - $expectedResponse->setNetwork($network); - $expectedResponse->setCidrBlock($cidrBlock); - $expectedResponse->setServiceAccount($serviceAccount); - $expectedResponse->setUseServiceNetworking($useServiceNetworking); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->nodeName('[PROJECT]', '[LOCATION]', '[NODE]'); - $response = $gapicClient->getNode($formattedName); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.tpu.v1.Tpu/GetNode', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getNodeExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->nodeName('[PROJECT]', '[LOCATION]', '[NODE]'); - try { - $gapicClient->getNode($formattedName); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getTensorFlowVersionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $version = 'version351608024'; - $expectedResponse = new TensorFlowVersion(); - $expectedResponse->setName($name2); - $expectedResponse->setVersion($version); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->tensorFlowVersionName('[PROJECT]', '[LOCATION]', '[TENSOR_FLOW_VERSION]'); - $response = $gapicClient->getTensorFlowVersion($formattedName); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.tpu.v1.Tpu/GetTensorFlowVersion', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getTensorFlowVersionExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->tensorFlowVersionName('[PROJECT]', '[LOCATION]', '[TENSOR_FLOW_VERSION]'); - try { - $gapicClient->getTensorFlowVersion($formattedName); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listAcceleratorTypesTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $acceleratorTypesElement = new AcceleratorType(); - $acceleratorTypes = [ - $acceleratorTypesElement, - ]; - $expectedResponse = new ListAcceleratorTypesResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setAcceleratorTypes($acceleratorTypes); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->acceleratorTypeName('[PROJECT]', '[LOCATION]', '[ACCELERATOR_TYPE]'); - $response = $gapicClient->listAcceleratorTypes($formattedParent); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getAcceleratorTypes()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.tpu.v1.Tpu/ListAcceleratorTypes', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listAcceleratorTypesExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->acceleratorTypeName('[PROJECT]', '[LOCATION]', '[ACCELERATOR_TYPE]'); - try { - $gapicClient->listAcceleratorTypes($formattedParent); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listNodesTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $nodesElement = new Node(); - $nodes = [ - $nodesElement, - ]; - $expectedResponse = new ListNodesResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setNodes($nodes); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $response = $gapicClient->listNodes($formattedParent); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getNodes()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.tpu.v1.Tpu/ListNodes', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listNodesExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - try { - $gapicClient->listNodes($formattedParent); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listTensorFlowVersionsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $tensorflowVersionsElement = new TensorFlowVersion(); - $tensorflowVersions = [ - $tensorflowVersionsElement, - ]; - $expectedResponse = new ListTensorFlowVersionsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setTensorflowVersions($tensorflowVersions); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->tensorFlowVersionName('[PROJECT]', '[LOCATION]', '[TENSOR_FLOW_VERSION]'); - $response = $gapicClient->listTensorFlowVersions($formattedParent); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getTensorflowVersions()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.tpu.v1.Tpu/ListTensorFlowVersions', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listTensorFlowVersionsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->tensorFlowVersionName('[PROJECT]', '[LOCATION]', '[TENSOR_FLOW_VERSION]'); - try { - $gapicClient->listTensorFlowVersions($formattedParent); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function reimageNodeTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/reimageNodeTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name2 = 'name2-1052831874'; - $description = 'description-1724546052'; - $acceleratorType = 'acceleratorType1748643982'; - $ipAddress = 'ipAddress1480014044'; - $port = 'port3446913'; - $healthDescription = 'healthDescription-1057342823'; - $tensorflowVersion2 = 'tensorflowVersion2467487059'; - $network = 'network1843485230'; - $cidrBlock = 'cidrBlock313022466'; - $serviceAccount = 'serviceAccount-1948028253'; - $useServiceNetworking = true; - $expectedResponse = new Node(); - $expectedResponse->setName($name2); - $expectedResponse->setDescription($description); - $expectedResponse->setAcceleratorType($acceleratorType); - $expectedResponse->setIpAddress($ipAddress); - $expectedResponse->setPort($port); - $expectedResponse->setHealthDescription($healthDescription); - $expectedResponse->setTensorflowVersion($tensorflowVersion2); - $expectedResponse->setNetwork($network); - $expectedResponse->setCidrBlock($cidrBlock); - $expectedResponse->setServiceAccount($serviceAccount); - $expectedResponse->setUseServiceNetworking($useServiceNetworking); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/reimageNodeTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - $response = $gapicClient->reimageNode(); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.tpu.v1.Tpu/ReimageNode', $actualApiFuncCall); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/reimageNodeTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function reimageNodeExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/reimageNodeTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - $response = $gapicClient->reimageNode(); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/reimageNodeTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function startNodeTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/startNodeTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name2 = 'name2-1052831874'; - $description = 'description-1724546052'; - $acceleratorType = 'acceleratorType1748643982'; - $ipAddress = 'ipAddress1480014044'; - $port = 'port3446913'; - $healthDescription = 'healthDescription-1057342823'; - $tensorflowVersion = 'tensorflowVersion-1353701984'; - $network = 'network1843485230'; - $cidrBlock = 'cidrBlock313022466'; - $serviceAccount = 'serviceAccount-1948028253'; - $useServiceNetworking = true; - $expectedResponse = new Node(); - $expectedResponse->setName($name2); - $expectedResponse->setDescription($description); - $expectedResponse->setAcceleratorType($acceleratorType); - $expectedResponse->setIpAddress($ipAddress); - $expectedResponse->setPort($port); - $expectedResponse->setHealthDescription($healthDescription); - $expectedResponse->setTensorflowVersion($tensorflowVersion); - $expectedResponse->setNetwork($network); - $expectedResponse->setCidrBlock($cidrBlock); - $expectedResponse->setServiceAccount($serviceAccount); - $expectedResponse->setUseServiceNetworking($useServiceNetworking); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/startNodeTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - $response = $gapicClient->startNode(); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.tpu.v1.Tpu/StartNode', $actualApiFuncCall); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/startNodeTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function startNodeExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/startNodeTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - $response = $gapicClient->startNode(); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/startNodeTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function stopNodeTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/stopNodeTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name2 = 'name2-1052831874'; - $description = 'description-1724546052'; - $acceleratorType = 'acceleratorType1748643982'; - $ipAddress = 'ipAddress1480014044'; - $port = 'port3446913'; - $healthDescription = 'healthDescription-1057342823'; - $tensorflowVersion = 'tensorflowVersion-1353701984'; - $network = 'network1843485230'; - $cidrBlock = 'cidrBlock313022466'; - $serviceAccount = 'serviceAccount-1948028253'; - $useServiceNetworking = true; - $expectedResponse = new Node(); - $expectedResponse->setName($name2); - $expectedResponse->setDescription($description); - $expectedResponse->setAcceleratorType($acceleratorType); - $expectedResponse->setIpAddress($ipAddress); - $expectedResponse->setPort($port); - $expectedResponse->setHealthDescription($healthDescription); - $expectedResponse->setTensorflowVersion($tensorflowVersion); - $expectedResponse->setNetwork($network); - $expectedResponse->setCidrBlock($cidrBlock); - $expectedResponse->setServiceAccount($serviceAccount); - $expectedResponse->setUseServiceNetworking($useServiceNetworking); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/stopNodeTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - $response = $gapicClient->stopNode(); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.tpu.v1.Tpu/StopNode', $actualApiFuncCall); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/stopNodeTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function stopNodeExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/stopNodeTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - $response = $gapicClient->stopNode(); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/stopNodeTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function getLocationTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $locationId = 'locationId552319461'; - $displayName = 'displayName1615086568'; - $expectedResponse = new Location(); - $expectedResponse->setName($name2); - $expectedResponse->setLocationId($locationId); - $expectedResponse->setDisplayName($displayName); - $transport->addResponse($expectedResponse); - $response = $gapicClient->getLocation(); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.location.Locations/GetLocation', $actualFuncCall); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getLocationExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - try { - $gapicClient->getLocation(); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listLocationsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $locationsElement = new Location(); - $locations = [ - $locationsElement, - ]; - $expectedResponse = new ListLocationsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setLocations($locations); - $transport->addResponse($expectedResponse); - $response = $gapicClient->listLocations(); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getLocations()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.location.Locations/ListLocations', $actualFuncCall); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listLocationsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - try { - $gapicClient->listLocations(); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } -} diff --git a/Tpu/tests/Unit/V2/Client/TpuClientTest.php b/Tpu/tests/Unit/V2/Client/TpuClientTest.php index 1da8a52b3731..9ed081619b96 100644 --- a/Tpu/tests/Unit/V2/Client/TpuClientTest.php +++ b/Tpu/tests/Unit/V2/Client/TpuClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return TpuClient */ @@ -141,9 +143,7 @@ public function createNodeTest() $node = new Node(); $nodeRuntimeVersion = 'nodeRuntimeVersion-385109886'; $node->setRuntimeVersion($nodeRuntimeVersion); - $request = (new CreateNodeRequest()) - ->setParent($formattedParent) - ->setNode($node); + $request = (new CreateNodeRequest())->setParent($formattedParent)->setNode($node); $response = $gapicClient->createNode($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -201,21 +201,22 @@ public function createNodeExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $operationsTransport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); $node = new Node(); $nodeRuntimeVersion = 'nodeRuntimeVersion-385109886'; $node->setRuntimeVersion($nodeRuntimeVersion); - $request = (new CreateNodeRequest()) - ->setParent($formattedParent) - ->setNode($node); + $request = (new CreateNodeRequest())->setParent($formattedParent)->setNode($node); $response = $gapicClient->createNode($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -269,8 +270,7 @@ public function deleteNodeTest() $operationsTransport->addResponse($completeOperation); // Mock request $formattedName = $gapicClient->nodeName('[PROJECT]', '[LOCATION]', '[NODE]'); - $request = (new DeleteNodeRequest()) - ->setName($formattedName); + $request = (new DeleteNodeRequest())->setName($formattedName); $response = $gapicClient->deleteNode($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -326,17 +326,19 @@ public function deleteNodeExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $operationsTransport->addResponse(null, $status); // Mock request $formattedName = $gapicClient->nodeName('[PROJECT]', '[LOCATION]', '[NODE]'); - $request = (new DeleteNodeRequest()) - ->setName($formattedName); + $request = (new DeleteNodeRequest())->setName($formattedName); $response = $gapicClient->deleteNode($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -372,8 +374,7 @@ public function generateServiceIdentityTest() $transport->addResponse($expectedResponse); // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $request = (new GenerateServiceIdentityRequest()) - ->setParent($formattedParent); + $request = (new GenerateServiceIdentityRequest())->setParent($formattedParent); $response = $gapicClient->generateServiceIdentity($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -397,17 +398,19 @@ public function generateServiceIdentityExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $request = (new GenerateServiceIdentityRequest()) - ->setParent($formattedParent); + $request = (new GenerateServiceIdentityRequest())->setParent($formattedParent); try { $gapicClient->generateServiceIdentity($request); // If the $gapicClient method call did not throw, fail the test @@ -438,8 +441,7 @@ public function getAcceleratorTypeTest() $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->acceleratorTypeName('[PROJECT]', '[LOCATION]', '[ACCELERATOR_TYPE]'); - $request = (new GetAcceleratorTypeRequest()) - ->setName($formattedName); + $request = (new GetAcceleratorTypeRequest())->setName($formattedName); $response = $gapicClient->getAcceleratorType($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -463,17 +465,19 @@ public function getAcceleratorTypeExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedName = $gapicClient->acceleratorTypeName('[PROJECT]', '[LOCATION]', '[ACCELERATOR_TYPE]'); - $request = (new GetAcceleratorTypeRequest()) - ->setName($formattedName); + $request = (new GetAcceleratorTypeRequest())->setName($formattedName); try { $gapicClient->getAcceleratorType($request); // If the $gapicClient method call did not throw, fail the test @@ -500,8 +504,7 @@ public function getGuestAttributesTest() $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->nodeName('[PROJECT]', '[LOCATION]', '[NODE]'); - $request = (new GetGuestAttributesRequest()) - ->setName($formattedName); + $request = (new GetGuestAttributesRequest())->setName($formattedName); $response = $gapicClient->getGuestAttributes($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -525,17 +528,19 @@ public function getGuestAttributesExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedName = $gapicClient->nodeName('[PROJECT]', '[LOCATION]', '[NODE]'); - $request = (new GetGuestAttributesRequest()) - ->setName($formattedName); + $request = (new GetGuestAttributesRequest())->setName($formattedName); try { $gapicClient->getGuestAttributes($request); // If the $gapicClient method call did not throw, fail the test @@ -580,8 +585,7 @@ public function getNodeTest() $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->nodeName('[PROJECT]', '[LOCATION]', '[NODE]'); - $request = (new GetNodeRequest()) - ->setName($formattedName); + $request = (new GetNodeRequest())->setName($formattedName); $response = $gapicClient->getNode($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -605,17 +609,19 @@ public function getNodeExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedName = $gapicClient->nodeName('[PROJECT]', '[LOCATION]', '[NODE]'); - $request = (new GetNodeRequest()) - ->setName($formattedName); + $request = (new GetNodeRequest())->setName($formattedName); try { $gapicClient->getNode($request); // If the $gapicClient method call did not throw, fail the test @@ -646,8 +652,7 @@ public function getRuntimeVersionTest() $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->runtimeVersionName('[PROJECT]', '[LOCATION]', '[RUNTIME_VERSION]'); - $request = (new GetRuntimeVersionRequest()) - ->setName($formattedName); + $request = (new GetRuntimeVersionRequest())->setName($formattedName); $response = $gapicClient->getRuntimeVersion($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -671,17 +676,19 @@ public function getRuntimeVersionExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedName = $gapicClient->runtimeVersionName('[PROJECT]', '[LOCATION]', '[RUNTIME_VERSION]'); - $request = (new GetRuntimeVersionRequest()) - ->setName($formattedName); + $request = (new GetRuntimeVersionRequest())->setName($formattedName); try { $gapicClient->getRuntimeVersion($request); // If the $gapicClient method call did not throw, fail the test @@ -706,17 +713,14 @@ public function listAcceleratorTypesTest() // Mock response $nextPageToken = ''; $acceleratorTypesElement = new AcceleratorType(); - $acceleratorTypes = [ - $acceleratorTypesElement, - ]; + $acceleratorTypes = [$acceleratorTypesElement]; $expectedResponse = new ListAcceleratorTypesResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setAcceleratorTypes($acceleratorTypes); $transport->addResponse($expectedResponse); // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $request = (new ListAcceleratorTypesRequest()) - ->setParent($formattedParent); + $request = (new ListAcceleratorTypesRequest())->setParent($formattedParent); $response = $gapicClient->listAcceleratorTypes($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -743,17 +747,19 @@ public function listAcceleratorTypesExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $request = (new ListAcceleratorTypesRequest()) - ->setParent($formattedParent); + $request = (new ListAcceleratorTypesRequest())->setParent($formattedParent); try { $gapicClient->listAcceleratorTypes($request); // If the $gapicClient method call did not throw, fail the test @@ -778,17 +784,14 @@ public function listNodesTest() // Mock response $nextPageToken = ''; $nodesElement = new Node(); - $nodes = [ - $nodesElement, - ]; + $nodes = [$nodesElement]; $expectedResponse = new ListNodesResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setNodes($nodes); $transport->addResponse($expectedResponse); // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $request = (new ListNodesRequest()) - ->setParent($formattedParent); + $request = (new ListNodesRequest())->setParent($formattedParent); $response = $gapicClient->listNodes($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -815,17 +818,19 @@ public function listNodesExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $request = (new ListNodesRequest()) - ->setParent($formattedParent); + $request = (new ListNodesRequest())->setParent($formattedParent); try { $gapicClient->listNodes($request); // If the $gapicClient method call did not throw, fail the test @@ -850,17 +855,14 @@ public function listRuntimeVersionsTest() // Mock response $nextPageToken = ''; $runtimeVersionsElement = new RuntimeVersion(); - $runtimeVersions = [ - $runtimeVersionsElement, - ]; + $runtimeVersions = [$runtimeVersionsElement]; $expectedResponse = new ListRuntimeVersionsResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setRuntimeVersions($runtimeVersions); $transport->addResponse($expectedResponse); // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $request = (new ListRuntimeVersionsRequest()) - ->setParent($formattedParent); + $request = (new ListRuntimeVersionsRequest())->setParent($formattedParent); $response = $gapicClient->listRuntimeVersions($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -887,17 +889,19 @@ public function listRuntimeVersionsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $request = (new ListRuntimeVersionsRequest()) - ->setParent($formattedParent); + $request = (new ListRuntimeVersionsRequest())->setParent($formattedParent); try { $gapicClient->listRuntimeVersions($request); // If the $gapicClient method call did not throw, fail the test @@ -960,8 +964,7 @@ public function startNodeTest() $operationsTransport->addResponse($completeOperation); // Mock request $formattedName = $gapicClient->nodeName('[PROJECT]', '[LOCATION]', '[NODE]'); - $request = (new StartNodeRequest()) - ->setName($formattedName); + $request = (new StartNodeRequest())->setName($formattedName); $response = $gapicClient->startNode($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -1017,17 +1020,19 @@ public function startNodeExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $operationsTransport->addResponse(null, $status); // Mock request $formattedName = $gapicClient->nodeName('[PROJECT]', '[LOCATION]', '[NODE]'); - $request = (new StartNodeRequest()) - ->setName($formattedName); + $request = (new StartNodeRequest())->setName($formattedName); $response = $gapicClient->startNode($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -1099,8 +1104,7 @@ public function stopNodeTest() $operationsTransport->addResponse($completeOperation); // Mock request $formattedName = $gapicClient->nodeName('[PROJECT]', '[LOCATION]', '[NODE]'); - $request = (new StopNodeRequest()) - ->setName($formattedName); + $request = (new StopNodeRequest())->setName($formattedName); $response = $gapicClient->stopNode($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -1156,17 +1160,19 @@ public function stopNodeExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $operationsTransport->addResponse(null, $status); // Mock request $formattedName = $gapicClient->nodeName('[PROJECT]', '[LOCATION]', '[NODE]'); - $request = (new StopNodeRequest()) - ->setName($formattedName); + $request = (new StopNodeRequest())->setName($formattedName); $response = $gapicClient->stopNode($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -1241,9 +1247,7 @@ public function updateNodeTest() $node = new Node(); $nodeRuntimeVersion = 'nodeRuntimeVersion-385109886'; $node->setRuntimeVersion($nodeRuntimeVersion); - $request = (new UpdateNodeRequest()) - ->setUpdateMask($updateMask) - ->setNode($node); + $request = (new UpdateNodeRequest())->setUpdateMask($updateMask)->setNode($node); $response = $gapicClient->updateNode($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -1301,21 +1305,22 @@ public function updateNodeExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $operationsTransport->addResponse(null, $status); // Mock request $updateMask = new FieldMask(); $node = new Node(); $nodeRuntimeVersion = 'nodeRuntimeVersion-385109886'; $node->setRuntimeVersion($nodeRuntimeVersion); - $request = (new UpdateNodeRequest()) - ->setUpdateMask($updateMask) - ->setNode($node); + $request = (new UpdateNodeRequest())->setUpdateMask($updateMask)->setNode($node); $response = $gapicClient->updateNode($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -1377,12 +1382,15 @@ public function getLocationExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); $request = new GetLocationRequest(); try { @@ -1409,9 +1417,7 @@ public function listLocationsTest() // Mock response $nextPageToken = ''; $locationsElement = new Location(); - $locations = [ - $locationsElement, - ]; + $locations = [$locationsElement]; $expectedResponse = new ListLocationsResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setLocations($locations); @@ -1441,12 +1447,15 @@ public function listLocationsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); $request = new ListLocationsRequest(); try { @@ -1514,9 +1523,7 @@ public function createNodeAsyncTest() $node = new Node(); $nodeRuntimeVersion = 'nodeRuntimeVersion-385109886'; $node->setRuntimeVersion($nodeRuntimeVersion); - $request = (new CreateNodeRequest()) - ->setParent($formattedParent) - ->setNode($node); + $request = (new CreateNodeRequest())->setParent($formattedParent)->setNode($node); $response = $gapicClient->createNodeAsync($request)->wait(); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult());