From 56683fcc114c26d958dd34f1fabc990c33b9757b Mon Sep 17 00:00:00 2001 From: Brent Shaffer Date: Tue, 11 Jun 2024 00:09:30 +0000 Subject: [PATCH] remove V1beta1, update owlbot yaml --- Notebooks/.OwlBot.yaml | 2 +- Notebooks/metadata/V1Beta1/Environment.php | Bin 1663 -> 0 bytes Notebooks/metadata/V1Beta1/Instance.php | Bin 3887 -> 0 bytes Notebooks/metadata/V1Beta1/Service.php | 153 - Notebooks/src/V1beta1/ContainerImage.php | 110 - .../src/V1beta1/CreateEnvironmentRequest.php | 157 - .../src/V1beta1/CreateInstanceRequest.php | 149 - .../src/V1beta1/DeleteEnvironmentRequest.php | 71 - .../src/V1beta1/DeleteInstanceRequest.php | 71 - Notebooks/src/V1beta1/Environment.php | 305 -- .../Gapic/NotebookServiceGapicClient.php | 1955 ------------ .../src/V1beta1/GetEnvironmentRequest.php | 71 - Notebooks/src/V1beta1/GetInstanceRequest.php | 71 - Notebooks/src/V1beta1/Instance.php | 1268 -------- .../V1beta1/Instance/AcceleratorConfig.php | 105 - .../src/V1beta1/Instance/AcceleratorType.php | 119 - .../src/V1beta1/Instance/DiskEncryption.php | 62 - Notebooks/src/V1beta1/Instance/DiskType.php | 69 - Notebooks/src/V1beta1/Instance/NicType.php | 63 - Notebooks/src/V1beta1/Instance/State.php | 126 - .../V1beta1/IsInstanceUpgradeableRequest.php | 71 - .../V1beta1/IsInstanceUpgradeableResponse.php | 181 -- .../src/V1beta1/ListEnvironmentsRequest.php | 139 - .../src/V1beta1/ListEnvironmentsResponse.php | 139 - .../src/V1beta1/ListInstancesRequest.php | 143 - .../src/V1beta1/ListInstancesResponse.php | 147 - .../src/V1beta1/NotebookServiceClient.php | 36 - Notebooks/src/V1beta1/OperationMetadata.php | 337 -- .../src/V1beta1/RegisterInstanceRequest.php | 117 - .../src/V1beta1/ReportInstanceInfoRequest.php | 147 - Notebooks/src/V1beta1/ReservationAffinity.php | 135 - .../src/V1beta1/ReservationAffinity/Type.php | 70 - .../src/V1beta1/ResetInstanceRequest.php | 71 - .../V1beta1/SetInstanceAcceleratorRequest.php | 151 - .../src/V1beta1/SetInstanceLabelsRequest.php | 109 - .../V1beta1/SetInstanceMachineTypeRequest.php | 109 - .../src/V1beta1/StartInstanceRequest.php | 71 - Notebooks/src/V1beta1/StopInstanceRequest.php | 71 - .../UpgradeInstanceInternalRequest.php | 109 - .../src/V1beta1/UpgradeInstanceRequest.php | 71 - Notebooks/src/V1beta1/VmImage.php | 150 - Notebooks/src/V1beta1/gapic_metadata.json | 138 - .../notebook_service_client_config.json | 164 - .../notebook_service_descriptor_config.php | 211 -- .../notebook_service_rest_client_config.php | 364 --- .../V1beta1/NotebookServiceClientTest.php | 2785 ----------------- 46 files changed, 1 insertion(+), 11162 deletions(-) delete mode 100644 Notebooks/metadata/V1Beta1/Environment.php delete mode 100644 Notebooks/metadata/V1Beta1/Instance.php delete mode 100644 Notebooks/metadata/V1Beta1/Service.php delete mode 100644 Notebooks/src/V1beta1/ContainerImage.php delete mode 100644 Notebooks/src/V1beta1/CreateEnvironmentRequest.php delete mode 100644 Notebooks/src/V1beta1/CreateInstanceRequest.php delete mode 100644 Notebooks/src/V1beta1/DeleteEnvironmentRequest.php delete mode 100644 Notebooks/src/V1beta1/DeleteInstanceRequest.php delete mode 100644 Notebooks/src/V1beta1/Environment.php delete mode 100644 Notebooks/src/V1beta1/Gapic/NotebookServiceGapicClient.php delete mode 100644 Notebooks/src/V1beta1/GetEnvironmentRequest.php delete mode 100644 Notebooks/src/V1beta1/GetInstanceRequest.php delete mode 100644 Notebooks/src/V1beta1/Instance.php delete mode 100644 Notebooks/src/V1beta1/Instance/AcceleratorConfig.php delete mode 100644 Notebooks/src/V1beta1/Instance/AcceleratorType.php delete mode 100644 Notebooks/src/V1beta1/Instance/DiskEncryption.php delete mode 100644 Notebooks/src/V1beta1/Instance/DiskType.php delete mode 100644 Notebooks/src/V1beta1/Instance/NicType.php delete mode 100644 Notebooks/src/V1beta1/Instance/State.php delete mode 100644 Notebooks/src/V1beta1/IsInstanceUpgradeableRequest.php delete mode 100644 Notebooks/src/V1beta1/IsInstanceUpgradeableResponse.php delete mode 100644 Notebooks/src/V1beta1/ListEnvironmentsRequest.php delete mode 100644 Notebooks/src/V1beta1/ListEnvironmentsResponse.php delete mode 100644 Notebooks/src/V1beta1/ListInstancesRequest.php delete mode 100644 Notebooks/src/V1beta1/ListInstancesResponse.php delete mode 100644 Notebooks/src/V1beta1/NotebookServiceClient.php delete mode 100644 Notebooks/src/V1beta1/OperationMetadata.php delete mode 100644 Notebooks/src/V1beta1/RegisterInstanceRequest.php delete mode 100644 Notebooks/src/V1beta1/ReportInstanceInfoRequest.php delete mode 100644 Notebooks/src/V1beta1/ReservationAffinity.php delete mode 100644 Notebooks/src/V1beta1/ReservationAffinity/Type.php delete mode 100644 Notebooks/src/V1beta1/ResetInstanceRequest.php delete mode 100644 Notebooks/src/V1beta1/SetInstanceAcceleratorRequest.php delete mode 100644 Notebooks/src/V1beta1/SetInstanceLabelsRequest.php delete mode 100644 Notebooks/src/V1beta1/SetInstanceMachineTypeRequest.php delete mode 100644 Notebooks/src/V1beta1/StartInstanceRequest.php delete mode 100644 Notebooks/src/V1beta1/StopInstanceRequest.php delete mode 100644 Notebooks/src/V1beta1/UpgradeInstanceInternalRequest.php delete mode 100644 Notebooks/src/V1beta1/UpgradeInstanceRequest.php delete mode 100644 Notebooks/src/V1beta1/VmImage.php delete mode 100644 Notebooks/src/V1beta1/gapic_metadata.json delete mode 100644 Notebooks/src/V1beta1/resources/notebook_service_client_config.json delete mode 100644 Notebooks/src/V1beta1/resources/notebook_service_descriptor_config.php delete mode 100644 Notebooks/src/V1beta1/resources/notebook_service_rest_client_config.php delete mode 100644 Notebooks/tests/Unit/V1beta1/NotebookServiceClientTest.php diff --git a/Notebooks/.OwlBot.yaml b/Notebooks/.OwlBot.yaml index 2d69b69eeaf2..00c8349f0880 100644 --- a/Notebooks/.OwlBot.yaml +++ b/Notebooks/.OwlBot.yaml @@ -1,4 +1,4 @@ deep-copy-regex: - - source: /google/cloud/notebooks/(v1|v1beta1|v2)/.*-php/(.*) + - source: /google/cloud/notebooks/(v2|v1)/.*-php/(.*) dest: /owl-bot-staging/Notebooks/$1/$2 api-name: Notebooks diff --git a/Notebooks/metadata/V1Beta1/Environment.php b/Notebooks/metadata/V1Beta1/Environment.php deleted file mode 100644 index ea3e0767c410194cfdec03aca56e189908117294..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1663 zcmb7^-EPw`6vx*V=;ls*bO_3jhBqdylUTw4agj2h-AC68whE02p-7dRxSb)1Eyt-; zroI9Xz$5S|JjJf}6gZBP25sY`H;wFb{`UEuK;xDAx;{3RBLi4Z?r2#T zF1ZB-k8u8U2ssuJ4;t#;vA`tzvM=G*WW?Sh*mGO>1dRygmNl(vDsolod#wBU&siCc zBO===kk2kZQDNM8O*FKo>t>Ahk{i0}9dIok;93C|>T|8qS+i8V3+7!CG7pV= zYO5G;RTn_T)dM1DtX5Ks4KO?Md&EaWT)QDxD$ndSGr&8agM(=$?3M%H%<#%FC~G8= zd|BsD`%#puI(*s<3GW`5PecaDC*C+|$o@>L46dv7m6zb=@0hCh0pM6-BJzok^Cwh5 zNuXg(HM(_H04uV<6wehy*t(qq(2c#MTln-g2~Gzt>V6q%{GGwkln_If+TFQYT7GrcRM8$GHKI#I|gQ zj#a$uVIO8+V{iKgdziH6eu!!3UfW41bWn{KoO93loj>>7^XHpy-6I!16YJEbo)OT# z*gF-2BPzO{6F8rfO?|oj9hC-y`m`A8lu|JM7gGD4^Y&1#-2&b;-TXl4r$38 zI^%xHb^_XSoMXRqvfZPBv0bukKQL^Q7CAD2ZH%bz8YUI%&B`le=^KI3t#goWm4S5C z7^K_Tt}u|N0Oru}eNlg|EXNj^Km*O&{6Y*d8Sm$=gAsTp#%48HP%t1}#SW-v8^dmm`le^Of#WriwOl@= z!6cN7viU`%mcdyAaWk~BT)trBGcoYSbXL14dNde&_ET;*12~&}buS5;YQ3*D85Y%)+GJ*t$X! zodzb7xF1RIM}e7D3S#d=hQdDySi_s4-U;TmV@rbpyVFymgJ3$gKORvXjfju+;MAo; zLQHJtcAgaf+mYfWutg2!E2+Pw1j$3{n4Str#99m~YcPLe49C=B)sZx%q2?204OS%e^*Lga2(TW>RnMKI3V#yF z#Lu0qLYmbL?jg4-MV>VPO!`EP&(|EaDaabgGX%OPGsenj&{$B`%D*^9GIZ zh50zRY4QoIu&cF9svD;1jO{>J;BdELX=Ip3XmxnwnHVuiIzW(@VyQN;D(UFmz&aEb zks-TNzRIaM&_!tqfsP^qslXhoT~q*s%3U3w2~?X&u?$L)4Itdx;ZQ$x$9mthPN*kj z5impU!7X#_2hM2bNOz6kNLXUd5fyUSPy)Sg`NyHt%iNIdYx`6~$vD5$sBd+O=VPPL z4|_rmAydrOG}FgA(u}^_|5x7>FV?p))hEK5?ciG;IVV(~a0+*jBNJM504v;iYMb7v z%c_B}!cF@6qe380#6#G1SU4W}I(zJSgyYXDjqiC0%?TT;Zn?rLvx6lhqw-8Q_vvqAG)iUEeO5l52pDn;fRG@`V5j4B=_$ts# ziZHvD1i1q_)37o0`oQtt7+znvkBB@K5@Z*$rbqEz>8xJ}pKx6pv97q86eq2eL8h40 z*u~U}q=aipZ8)%cu^Q|_I{1iIGbsi$NW5(joah{nVwqyajWwIp#v{ni-g!1`M69VT zl4Y3VJt*u;<>ZsZMhTYBU+onFg%!&T0aM727B9#&Lm9vr&uh&Cy|a^_pL{>gFBE=Hz#Om6%-*&pY45l1CCDJTr73D1 zea*vCv(@M*ZS3QWl4M{~RZ}`L`o?)1%_ciZlPoN>HT;EBz#RKg!_aE@V;*mC@t|36 zNj1i}z(5sM(G+Q4`GHX~WCgMj_#;6sZ~RF(0E2@*U*vhup;eCY863K1sQS-bXqIPeYnG+WwqLR-DI=O zd$Udk()CyJOGL)6D*H+np2I>^EZBrIGaKouQsq|Skc9qq6by1hS7i;w7h$g6!Sj5w z+;}JL!-MGz8cuXLdHO|M$V&0EBHf4h=6|GS;FsP;UuTnz3u(OT;&yXZS%&P)6k7Q! z0R=>gE5`?B-pX>UsmV5=X5xqMLe6-?L|YD>nWYacjQ75Y@ow+w%=d4}dv(6+75NrX zRO4N*80~t0#0=eN8=P4OaUbMM<-6pA5Tsn@DCP15rd*DAdh@&-K7Ke^489CEt(nD) T4K|i}$x_BS!`0~w&H(-enV+7Y diff --git a/Notebooks/metadata/V1Beta1/Service.php b/Notebooks/metadata/V1Beta1/Service.php deleted file mode 100644 index 388980ecae6b..000000000000 --- a/Notebooks/metadata/V1Beta1/Service.php +++ /dev/null @@ -1,153 +0,0 @@ -internalAddGeneratedFile( - ' -6 -,google/cloud/notebooks/v1beta1/service.protogoogle.cloud.notebooks.v1beta1google/api/client.protogoogle/api/field_behavior.proto0google/cloud/notebooks/v1beta1/environment.proto-google/cloud/notebooks/v1beta1/instance.proto#google/longrunning/operations.protogoogle/protobuf/timestamp.proto" -OperationMetadata/ - create_time ( 2.google.protobuf.Timestamp, -end_time ( 2.google.protobuf.Timestamp -target (  -verb (  -status_message (  -requested_cancellation ( - api_version (  -endpoint ( "R -ListInstancesRequest -parent ( BA - page_size ( - -page_token ( " -ListInstancesResponse; - instances ( 2(.google.cloud.notebooks.v1beta1.Instance -next_page_token (  - unreachable ( "\' -GetInstanceRequest -name ( BA" -CreateInstanceRequest -parent ( BA - instance_id ( BA? -instance ( 2(.google.cloud.notebooks.v1beta1.InstanceBA"H -RegisterInstanceRequest -parent ( BA - instance_id ( BA" -SetInstanceAcceleratorRequest -name ( BAK -type (28.google.cloud.notebooks.v1beta1.Instance.AcceleratorTypeBA - -core_count (BA"M -SetInstanceMachineTypeRequest -name ( BA - machine_type ( BA" -SetInstanceLabelsRequest -name ( BAT -labels ( 2D.google.cloud.notebooks.v1beta1.SetInstanceLabelsRequest.LabelsEntry- - LabelsEntry -key (  -value ( :8"* -DeleteInstanceRequest -name ( BA") -StartInstanceRequest -name ( BA"( -StopInstanceRequest -name ( BA") -ResetInstanceRequest -name ( BA" -ReportInstanceInfoRequest -name ( BA -vm_id ( BAY -metadata ( 2G.google.cloud.notebooks.v1beta1.ReportInstanceInfoRequest.MetadataEntry/ - MetadataEntry -key (  -value ( :8"> -IsInstanceUpgradeableRequest -notebook_instance ( BA"z -IsInstanceUpgradeableResponse - upgradeable ( -upgrade_version (  - upgrade_info (  - upgrade_image ( "+ -UpgradeInstanceRequest -name ( BA"G -UpgradeInstanceInternalRequest -name ( BA -vm_id ( BA"U -ListEnvironmentsRequest -parent ( BA - page_size ( - -page_token ( " -ListEnvironmentsResponseA - environments ( 2+.google.cloud.notebooks.v1beta1.Environment -next_page_token (  - unreachable ( "* -GetEnvironmentRequest -name ( BA" -CreateEnvironmentRequest -parent ( BA -environment_id ( BAE - environment ( 2+.google.cloud.notebooks.v1beta1.EnvironmentBA"- -DeleteEnvironmentRequest -name ( BA2 -NotebookService - ListInstances4.google.cloud.notebooks.v1beta1.ListInstancesRequest5.google.cloud.notebooks.v1beta1.ListInstancesResponse":42/v1beta1/{parent=projects/*/locations/*}/instances - GetInstance2.google.cloud.notebooks.v1beta1.GetInstanceRequest(.google.cloud.notebooks.v1beta1.Instance":42/v1beta1/{name=projects/*/locations/*/instances/*} -CreateInstance5.google.cloud.notebooks.v1beta1.CreateInstanceRequest.google.longrunning.Operation"dA -InstanceOperationMetadata>"2/v1beta1/{parent=projects/*/locations/*}/instances:instance -RegisterInstance7.google.cloud.notebooks.v1beta1.RegisterInstanceRequest.google.longrunning.Operation"fA -InstanceOperationMetadata@";/v1beta1/{parent=projects/*/locations/*}/instances:register:* -SetInstanceAccelerator=.google.cloud.notebooks.v1beta1.SetInstanceAcceleratorRequest.google.longrunning.Operation"lA -InstanceOperationMetadataF2A/v1beta1/{name=projects/*/locations/*/instances/*}:setAccelerator:* -SetInstanceMachineType=.google.cloud.notebooks.v1beta1.SetInstanceMachineTypeRequest.google.longrunning.Operation"lA -InstanceOperationMetadataF2A/v1beta1/{name=projects/*/locations/*/instances/*}:setMachineType:* -SetInstanceLabels8.google.cloud.notebooks.v1beta1.SetInstanceLabelsRequest.google.longrunning.Operation"gA -InstanceOperationMetadataA2"9/v1beta1/{name=projects/*/locations/*/instances/*}:report:* -IsInstanceUpgradeable<.google.cloud.notebooks.v1beta1.IsInstanceUpgradeableRequest=.google.cloud.notebooks.v1beta1.IsInstanceUpgradeableResponse"XOM/v1beta1/{notebook_instance=projects/*/locations/*/instances/*}:isUpgradeable -UpgradeInstance6.google.cloud.notebooks.v1beta1.UpgradeInstanceRequest.google.longrunning.Operation"hA -InstanceOperationMetadata?":/v1beta1/{name=projects/*/locations/*/instances/*}:upgrade:* -UpgradeInstanceInternal>.google.cloud.notebooks.v1beta1.UpgradeInstanceInternalRequest.google.longrunning.Operation"pA -InstanceOperationMetadataG"B/v1beta1/{name=projects/*/locations/*/instances/*}:upgradeInternal:* -ListEnvironments7.google.cloud.notebooks.v1beta1.ListEnvironmentsRequest8.google.cloud.notebooks.v1beta1.ListEnvironmentsResponse"=75/v1beta1/{parent=projects/*/locations/*}/environments -GetEnvironment5.google.cloud.notebooks.v1beta1.GetEnvironmentRequest+.google.cloud.notebooks.v1beta1.Environment"=75/v1beta1/{name=projects/*/locations/*/environments/*} -CreateEnvironment8.google.cloud.notebooks.v1beta1.CreateEnvironmentRequest.google.longrunning.Operation"mA - EnvironmentOperationMetadataD"5/v1beta1/{parent=projects/*/locations/*}/environments: environment -DeleteEnvironment8.google.cloud.notebooks.v1beta1.DeleteEnvironmentRequest.google.longrunning.Operation"jA* -google.protobuf.EmptyOperationMetadata7*5/v1beta1/{name=projects/*/locations/*/environments/*}LAnotebooks.googleapis.comA.https://www.googleapis.com/auth/cloud-platformB -"com.google.cloud.notebooks.v1beta1BNotebooksProtoPZ@cloud.google.com/go/notebooks/apiv1beta1/notebookspb;notebookspbGoogle.Cloud.Notebooks.V1Beta1Google\\Cloud\\Notebooks\\V1beta1!Google::Cloud::Notebooks::V1beta1bproto3' - , true); - - static::$is_initialized = true; - } -} - diff --git a/Notebooks/src/V1beta1/ContainerImage.php b/Notebooks/src/V1beta1/ContainerImage.php deleted file mode 100644 index 44a04ffefbb6..000000000000 --- a/Notebooks/src/V1beta1/ContainerImage.php +++ /dev/null @@ -1,110 +0,0 @@ -google.cloud.notebooks.v1beta1.ContainerImage - */ -class ContainerImage extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The path to the container image repository. For example: - * `gcr.io/{project_id}/{image_name}` - * - * Generated from protobuf field string repository = 1 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $repository = ''; - /** - * The tag of the container image. If not specified, this defaults - * to the latest tag. - * - * Generated from protobuf field string tag = 2; - */ - protected $tag = ''; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $repository - * Required. The path to the container image repository. For example: - * `gcr.io/{project_id}/{image_name}` - * @type string $tag - * The tag of the container image. If not specified, this defaults - * to the latest tag. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Notebooks\V1Beta1\Environment::initOnce(); - parent::__construct($data); - } - - /** - * Required. The path to the container image repository. For example: - * `gcr.io/{project_id}/{image_name}` - * - * Generated from protobuf field string repository = 1 [(.google.api.field_behavior) = REQUIRED]; - * @return string - */ - public function getRepository() - { - return $this->repository; - } - - /** - * Required. The path to the container image repository. For example: - * `gcr.io/{project_id}/{image_name}` - * - * Generated from protobuf field string repository = 1 [(.google.api.field_behavior) = REQUIRED]; - * @param string $var - * @return $this - */ - public function setRepository($var) - { - GPBUtil::checkString($var, True); - $this->repository = $var; - - return $this; - } - - /** - * The tag of the container image. If not specified, this defaults - * to the latest tag. - * - * Generated from protobuf field string tag = 2; - * @return string - */ - public function getTag() - { - return $this->tag; - } - - /** - * The tag of the container image. If not specified, this defaults - * to the latest tag. - * - * Generated from protobuf field string tag = 2; - * @param string $var - * @return $this - */ - public function setTag($var) - { - GPBUtil::checkString($var, True); - $this->tag = $var; - - return $this; - } - -} - diff --git a/Notebooks/src/V1beta1/CreateEnvironmentRequest.php b/Notebooks/src/V1beta1/CreateEnvironmentRequest.php deleted file mode 100644 index 0e3d8163a87b..000000000000 --- a/Notebooks/src/V1beta1/CreateEnvironmentRequest.php +++ /dev/null @@ -1,157 +0,0 @@ -google.cloud.notebooks.v1beta1.CreateEnvironmentRequest - */ -class CreateEnvironmentRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. Format: `projects/{project_id}/locations/{location}` - * - * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $parent = ''; - /** - * Required. User-defined unique ID of this environment. The `environment_id` must - * be 1 to 63 characters long and contain only lowercase letters, - * numeric characters, and dashes. The first character must be a lowercase - * letter and the last character cannot be a dash. - * - * Generated from protobuf field string environment_id = 2 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $environment_id = ''; - /** - * Required. The environment to be created. - * - * Generated from protobuf field .google.cloud.notebooks.v1beta1.Environment environment = 3 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $environment = null; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $parent - * Required. Format: `projects/{project_id}/locations/{location}` - * @type string $environment_id - * Required. User-defined unique ID of this environment. The `environment_id` must - * be 1 to 63 characters long and contain only lowercase letters, - * numeric characters, and dashes. The first character must be a lowercase - * letter and the last character cannot be a dash. - * @type \Google\Cloud\Notebooks\V1beta1\Environment $environment - * Required. The environment to be created. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Notebooks\V1Beta1\Service::initOnce(); - parent::__construct($data); - } - - /** - * Required. Format: `projects/{project_id}/locations/{location}` - * - * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED]; - * @return string - */ - public function getParent() - { - return $this->parent; - } - - /** - * Required. Format: `projects/{project_id}/locations/{location}` - * - * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED]; - * @param string $var - * @return $this - */ - public function setParent($var) - { - GPBUtil::checkString($var, True); - $this->parent = $var; - - return $this; - } - - /** - * Required. User-defined unique ID of this environment. The `environment_id` must - * be 1 to 63 characters long and contain only lowercase letters, - * numeric characters, and dashes. The first character must be a lowercase - * letter and the last character cannot be a dash. - * - * Generated from protobuf field string environment_id = 2 [(.google.api.field_behavior) = REQUIRED]; - * @return string - */ - public function getEnvironmentId() - { - return $this->environment_id; - } - - /** - * Required. User-defined unique ID of this environment. The `environment_id` must - * be 1 to 63 characters long and contain only lowercase letters, - * numeric characters, and dashes. The first character must be a lowercase - * letter and the last character cannot be a dash. - * - * Generated from protobuf field string environment_id = 2 [(.google.api.field_behavior) = REQUIRED]; - * @param string $var - * @return $this - */ - public function setEnvironmentId($var) - { - GPBUtil::checkString($var, True); - $this->environment_id = $var; - - return $this; - } - - /** - * Required. The environment to be created. - * - * Generated from protobuf field .google.cloud.notebooks.v1beta1.Environment environment = 3 [(.google.api.field_behavior) = REQUIRED]; - * @return \Google\Cloud\Notebooks\V1beta1\Environment|null - */ - public function getEnvironment() - { - return $this->environment; - } - - public function hasEnvironment() - { - return isset($this->environment); - } - - public function clearEnvironment() - { - unset($this->environment); - } - - /** - * Required. The environment to be created. - * - * Generated from protobuf field .google.cloud.notebooks.v1beta1.Environment environment = 3 [(.google.api.field_behavior) = REQUIRED]; - * @param \Google\Cloud\Notebooks\V1beta1\Environment $var - * @return $this - */ - public function setEnvironment($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Notebooks\V1beta1\Environment::class); - $this->environment = $var; - - return $this; - } - -} - diff --git a/Notebooks/src/V1beta1/CreateInstanceRequest.php b/Notebooks/src/V1beta1/CreateInstanceRequest.php deleted file mode 100644 index 9f1b049833c6..000000000000 --- a/Notebooks/src/V1beta1/CreateInstanceRequest.php +++ /dev/null @@ -1,149 +0,0 @@ -google.cloud.notebooks.v1beta1.CreateInstanceRequest - */ -class CreateInstanceRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. Format: - * `parent=projects/{project_id}/locations/{location}` - * - * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $parent = ''; - /** - * Required. User-defined unique ID of this instance. - * - * Generated from protobuf field string instance_id = 2 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $instance_id = ''; - /** - * Required. The instance to be created. - * - * Generated from protobuf field .google.cloud.notebooks.v1beta1.Instance instance = 3 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $instance = null; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $parent - * Required. Format: - * `parent=projects/{project_id}/locations/{location}` - * @type string $instance_id - * Required. User-defined unique ID of this instance. - * @type \Google\Cloud\Notebooks\V1beta1\Instance $instance - * Required. The instance to be created. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Notebooks\V1Beta1\Service::initOnce(); - parent::__construct($data); - } - - /** - * Required. Format: - * `parent=projects/{project_id}/locations/{location}` - * - * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED]; - * @return string - */ - public function getParent() - { - return $this->parent; - } - - /** - * Required. Format: - * `parent=projects/{project_id}/locations/{location}` - * - * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED]; - * @param string $var - * @return $this - */ - public function setParent($var) - { - GPBUtil::checkString($var, True); - $this->parent = $var; - - return $this; - } - - /** - * Required. User-defined unique ID of this instance. - * - * Generated from protobuf field string instance_id = 2 [(.google.api.field_behavior) = REQUIRED]; - * @return string - */ - public function getInstanceId() - { - return $this->instance_id; - } - - /** - * Required. User-defined unique ID of this instance. - * - * Generated from protobuf field string instance_id = 2 [(.google.api.field_behavior) = REQUIRED]; - * @param string $var - * @return $this - */ - public function setInstanceId($var) - { - GPBUtil::checkString($var, True); - $this->instance_id = $var; - - return $this; - } - - /** - * Required. The instance to be created. - * - * Generated from protobuf field .google.cloud.notebooks.v1beta1.Instance instance = 3 [(.google.api.field_behavior) = REQUIRED]; - * @return \Google\Cloud\Notebooks\V1beta1\Instance|null - */ - public function getInstance() - { - return $this->instance; - } - - public function hasInstance() - { - return isset($this->instance); - } - - public function clearInstance() - { - unset($this->instance); - } - - /** - * Required. The instance to be created. - * - * Generated from protobuf field .google.cloud.notebooks.v1beta1.Instance instance = 3 [(.google.api.field_behavior) = REQUIRED]; - * @param \Google\Cloud\Notebooks\V1beta1\Instance $var - * @return $this - */ - public function setInstance($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Notebooks\V1beta1\Instance::class); - $this->instance = $var; - - return $this; - } - -} - diff --git a/Notebooks/src/V1beta1/DeleteEnvironmentRequest.php b/Notebooks/src/V1beta1/DeleteEnvironmentRequest.php deleted file mode 100644 index 0eafa53f9793..000000000000 --- a/Notebooks/src/V1beta1/DeleteEnvironmentRequest.php +++ /dev/null @@ -1,71 +0,0 @@ -google.cloud.notebooks.v1beta1.DeleteEnvironmentRequest - */ -class DeleteEnvironmentRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. Format: - * `projects/{project_id}/locations/{location}/environments/{environment_id}` - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $name = ''; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $name - * Required. Format: - * `projects/{project_id}/locations/{location}/environments/{environment_id}` - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Notebooks\V1Beta1\Service::initOnce(); - parent::__construct($data); - } - - /** - * Required. Format: - * `projects/{project_id}/locations/{location}/environments/{environment_id}` - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * Required. Format: - * `projects/{project_id}/locations/{location}/environments/{environment_id}` - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; - * @param string $var - * @return $this - */ - public function setName($var) - { - GPBUtil::checkString($var, True); - $this->name = $var; - - return $this; - } - -} - diff --git a/Notebooks/src/V1beta1/DeleteInstanceRequest.php b/Notebooks/src/V1beta1/DeleteInstanceRequest.php deleted file mode 100644 index 09c7f2bdd31e..000000000000 --- a/Notebooks/src/V1beta1/DeleteInstanceRequest.php +++ /dev/null @@ -1,71 +0,0 @@ -google.cloud.notebooks.v1beta1.DeleteInstanceRequest - */ -class DeleteInstanceRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. Format: - * `projects/{project_id}/locations/{location}/instances/{instance_id}` - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $name = ''; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $name - * Required. Format: - * `projects/{project_id}/locations/{location}/instances/{instance_id}` - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Notebooks\V1Beta1\Service::initOnce(); - parent::__construct($data); - } - - /** - * Required. Format: - * `projects/{project_id}/locations/{location}/instances/{instance_id}` - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * Required. Format: - * `projects/{project_id}/locations/{location}/instances/{instance_id}` - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; - * @param string $var - * @return $this - */ - public function setName($var) - { - GPBUtil::checkString($var, True); - $this->name = $var; - - return $this; - } - -} - diff --git a/Notebooks/src/V1beta1/Environment.php b/Notebooks/src/V1beta1/Environment.php deleted file mode 100644 index 5af28b14d495..000000000000 --- a/Notebooks/src/V1beta1/Environment.php +++ /dev/null @@ -1,305 +0,0 @@ -google.cloud.notebooks.v1beta1.Environment - */ -class Environment extends \Google\Protobuf\Internal\Message -{ - /** - * Output only. Name of this environment. - * Format: - * `projects/{project_id}/locations/{location}/environments/{environment_id}` - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; - */ - protected $name = ''; - /** - * Display name of this environment for the UI. - * - * Generated from protobuf field string display_name = 2; - */ - protected $display_name = ''; - /** - * A brief description of this environment. - * - * Generated from protobuf field string description = 3; - */ - protected $description = ''; - /** - * Path to a Bash script that automatically runs after a notebook instance - * fully boots up. The path must be a URL or - * Cloud Storage path. Example: `"gs://path-to-file/file-name"` - * - * Generated from protobuf field string post_startup_script = 8; - */ - protected $post_startup_script = ''; - /** - * Output only. The time at which this environment was created. - * - * Generated from protobuf field .google.protobuf.Timestamp create_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; - */ - protected $create_time = null; - protected $image_type; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $name - * Output only. Name of this environment. - * Format: - * `projects/{project_id}/locations/{location}/environments/{environment_id}` - * @type string $display_name - * Display name of this environment for the UI. - * @type string $description - * A brief description of this environment. - * @type \Google\Cloud\Notebooks\V1beta1\VmImage $vm_image - * Use a Compute Engine VM image to start the notebook instance. - * @type \Google\Cloud\Notebooks\V1beta1\ContainerImage $container_image - * Use a container image to start the notebook instance. - * @type string $post_startup_script - * Path to a Bash script that automatically runs after a notebook instance - * fully boots up. The path must be a URL or - * Cloud Storage path. Example: `"gs://path-to-file/file-name"` - * @type \Google\Protobuf\Timestamp $create_time - * Output only. The time at which this environment was created. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Notebooks\V1Beta1\Environment::initOnce(); - parent::__construct($data); - } - - /** - * Output only. Name of this environment. - * Format: - * `projects/{project_id}/locations/{location}/environments/{environment_id}` - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * Output only. Name of this environment. - * Format: - * `projects/{project_id}/locations/{location}/environments/{environment_id}` - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @param string $var - * @return $this - */ - public function setName($var) - { - GPBUtil::checkString($var, True); - $this->name = $var; - - return $this; - } - - /** - * Display name of this environment for the UI. - * - * Generated from protobuf field string display_name = 2; - * @return string - */ - public function getDisplayName() - { - return $this->display_name; - } - - /** - * Display name of this environment for the UI. - * - * Generated from protobuf field string display_name = 2; - * @param string $var - * @return $this - */ - public function setDisplayName($var) - { - GPBUtil::checkString($var, True); - $this->display_name = $var; - - return $this; - } - - /** - * A brief description of this environment. - * - * Generated from protobuf field string description = 3; - * @return string - */ - public function getDescription() - { - return $this->description; - } - - /** - * A brief description of this environment. - * - * 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; - } - - /** - * Use a Compute Engine VM image to start the notebook instance. - * - * Generated from protobuf field .google.cloud.notebooks.v1beta1.VmImage vm_image = 6; - * @return \Google\Cloud\Notebooks\V1beta1\VmImage|null - */ - public function getVmImage() - { - return $this->readOneof(6); - } - - public function hasVmImage() - { - return $this->hasOneof(6); - } - - /** - * Use a Compute Engine VM image to start the notebook instance. - * - * Generated from protobuf field .google.cloud.notebooks.v1beta1.VmImage vm_image = 6; - * @param \Google\Cloud\Notebooks\V1beta1\VmImage $var - * @return $this - */ - public function setVmImage($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Notebooks\V1beta1\VmImage::class); - $this->writeOneof(6, $var); - - return $this; - } - - /** - * Use a container image to start the notebook instance. - * - * Generated from protobuf field .google.cloud.notebooks.v1beta1.ContainerImage container_image = 7; - * @return \Google\Cloud\Notebooks\V1beta1\ContainerImage|null - */ - public function getContainerImage() - { - return $this->readOneof(7); - } - - public function hasContainerImage() - { - return $this->hasOneof(7); - } - - /** - * Use a container image to start the notebook instance. - * - * Generated from protobuf field .google.cloud.notebooks.v1beta1.ContainerImage container_image = 7; - * @param \Google\Cloud\Notebooks\V1beta1\ContainerImage $var - * @return $this - */ - public function setContainerImage($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Notebooks\V1beta1\ContainerImage::class); - $this->writeOneof(7, $var); - - return $this; - } - - /** - * Path to a Bash script that automatically runs after a notebook instance - * fully boots up. The path must be a URL or - * Cloud Storage path. Example: `"gs://path-to-file/file-name"` - * - * Generated from protobuf field string post_startup_script = 8; - * @return string - */ - public function getPostStartupScript() - { - return $this->post_startup_script; - } - - /** - * Path to a Bash script that automatically runs after a notebook instance - * fully boots up. The path must be a URL or - * Cloud Storage path. Example: `"gs://path-to-file/file-name"` - * - * Generated from protobuf field string post_startup_script = 8; - * @param string $var - * @return $this - */ - public function setPostStartupScript($var) - { - GPBUtil::checkString($var, True); - $this->post_startup_script = $var; - - return $this; - } - - /** - * Output only. The time at which this environment was created. - * - * Generated from protobuf field .google.protobuf.Timestamp create_time = 9 [(.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 at which this environment was created. - * - * Generated from protobuf field .google.protobuf.Timestamp create_time = 9 [(.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; - } - - /** - * @return string - */ - public function getImageType() - { - return $this->whichOneof("image_type"); - } - -} - diff --git a/Notebooks/src/V1beta1/Gapic/NotebookServiceGapicClient.php b/Notebooks/src/V1beta1/Gapic/NotebookServiceGapicClient.php deleted file mode 100644 index f9217e6debe6..000000000000 --- a/Notebooks/src/V1beta1/Gapic/NotebookServiceGapicClient.php +++ /dev/null @@ -1,1955 +0,0 @@ -createEnvironment($parent, $environmentId, $environment); - * $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 = $notebookServiceClient->createEnvironment($parent, $environmentId, $environment); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $notebookServiceClient->resumeOperation($operationName, 'createEnvironment'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $notebookServiceClient->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. - * - * @experimental - * - * @deprecated This class will be removed in the next major version update. - */ -class NotebookServiceGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.notebooks.v1beta1.NotebookService'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'notebooks.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'notebooks.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 $environmentNameTemplate; - - private static $instanceNameTemplate; - - 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/notebook_service_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/notebook_service_descriptor_config.php', - 'gcpApiConfigPath' => __DIR__ . '/../resources/notebook_service_grpc_config.json', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/notebook_service_rest_client_config.php', - ], - ], - ]; - } - - private static function getEnvironmentNameTemplate() - { - if (self::$environmentNameTemplate == null) { - self::$environmentNameTemplate = new PathTemplate('projects/{project}/environments/{environment}'); - } - - return self::$environmentNameTemplate; - } - - private static function getInstanceNameTemplate() - { - if (self::$instanceNameTemplate == null) { - self::$instanceNameTemplate = new PathTemplate('projects/{project}/instances/{instance}'); - } - - return self::$instanceNameTemplate; - } - - private static function getPathTemplateMap() - { - if (self::$pathTemplateMap == null) { - self::$pathTemplateMap = [ - 'environment' => self::getEnvironmentNameTemplate(), - 'instance' => self::getInstanceNameTemplate(), - ]; - } - - return self::$pathTemplateMap; - } - - /** - * Formats a string containing the fully-qualified path to represent a environment - * resource. - * - * @param string $project - * @param string $environment - * - * @return string The formatted environment resource. - * - * @experimental - */ - public static function environmentName($project, $environment) - { - return self::getEnvironmentNameTemplate()->render([ - 'project' => $project, - 'environment' => $environment, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a instance - * resource. - * - * @param string $project - * @param string $instance - * - * @return string The formatted instance resource. - * - * @experimental - */ - public static function instanceName($project, $instance) - { - return self::getInstanceNameTemplate()->render([ - 'project' => $project, - 'instance' => $instance, - ]); - } - - /** - * Parses a formatted name string and returns an associative array of the components in the name. - * The following name formats are supported: - * Template: Pattern - * - environment: projects/{project}/environments/{environment} - * - instance: projects/{project}/instances/{instance} - * - * 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. - * - * @experimental - */ - 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 - * - * @experimental - */ - 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 - * - * @experimental - */ - 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 'notebooks.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 - * - * @experimental - */ - public function __construct(array $options = []) - { - $clientOptions = $this->buildClientOptions($options); - $this->setClientOptions($clientOptions); - $this->operationsClient = $this->createOperationsClient($clientOptions); - } - - /** - * Creates a new Environment. - * - * Sample code: - * ``` - * $notebookServiceClient = new NotebookServiceClient(); - * try { - * $parent = 'parent'; - * $environmentId = 'environment_id'; - * $environment = new Environment(); - * $operationResponse = $notebookServiceClient->createEnvironment($parent, $environmentId, $environment); - * $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 = $notebookServiceClient->createEnvironment($parent, $environmentId, $environment); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $notebookServiceClient->resumeOperation($operationName, 'createEnvironment'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $notebookServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. Format: `projects/{project_id}/locations/{location}` - * @param string $environmentId Required. User-defined unique ID of this environment. The `environment_id` must - * be 1 to 63 characters long and contain only lowercase letters, - * numeric characters, and dashes. The first character must be a lowercase - * letter and the last character cannot be a dash. - * @param Environment $environment Required. The environment to be created. - * @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 - * - * @experimental - */ - public function createEnvironment($parent, $environmentId, $environment, array $optionalArgs = []) - { - $request = new CreateEnvironmentRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setEnvironmentId($environmentId); - $request->setEnvironment($environment); - $requestParamHeaders['parent'] = $parent; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startOperationsCall('CreateEnvironment', $optionalArgs, $request, $this->getOperationsClient())->wait(); - } - - /** - * Creates a new Instance in a given project and location. - * - * Sample code: - * ``` - * $notebookServiceClient = new NotebookServiceClient(); - * try { - * $parent = 'parent'; - * $instanceId = 'instance_id'; - * $instance = new Instance(); - * $operationResponse = $notebookServiceClient->createInstance($parent, $instanceId, $instance); - * $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 = $notebookServiceClient->createInstance($parent, $instanceId, $instance); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $notebookServiceClient->resumeOperation($operationName, 'createInstance'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $notebookServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. Format: - * `parent=projects/{project_id}/locations/{location}` - * @param string $instanceId Required. User-defined unique ID of this instance. - * @param Instance $instance Required. The instance to be created. - * @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 - * - * @experimental - */ - public function createInstance($parent, $instanceId, $instance, array $optionalArgs = []) - { - $request = new CreateInstanceRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setInstanceId($instanceId); - $request->setInstance($instance); - $requestParamHeaders['parent'] = $parent; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startOperationsCall('CreateInstance', $optionalArgs, $request, $this->getOperationsClient())->wait(); - } - - /** - * Deletes a single Environment. - * - * Sample code: - * ``` - * $notebookServiceClient = new NotebookServiceClient(); - * try { - * $name = 'name'; - * $operationResponse = $notebookServiceClient->deleteEnvironment($name); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // operation succeeded and returns no value - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $notebookServiceClient->deleteEnvironment($name); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $notebookServiceClient->resumeOperation($operationName, 'deleteEnvironment'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // operation succeeded and returns no value - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $notebookServiceClient->close(); - * } - * ``` - * - * @param string $name Required. Format: - * `projects/{project_id}/locations/{location}/environments/{environment_id}` - * @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 - * - * @experimental - */ - public function deleteEnvironment($name, array $optionalArgs = []) - { - $request = new DeleteEnvironmentRequest(); - $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('DeleteEnvironment', $optionalArgs, $request, $this->getOperationsClient())->wait(); - } - - /** - * Deletes a single Instance. - * - * Sample code: - * ``` - * $notebookServiceClient = new NotebookServiceClient(); - * try { - * $name = 'name'; - * $operationResponse = $notebookServiceClient->deleteInstance($name); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // operation succeeded and returns no value - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $notebookServiceClient->deleteInstance($name); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $notebookServiceClient->resumeOperation($operationName, 'deleteInstance'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // operation succeeded and returns no value - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $notebookServiceClient->close(); - * } - * ``` - * - * @param string $name Required. Format: - * `projects/{project_id}/locations/{location}/instances/{instance_id}` - * @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 - * - * @experimental - */ - public function deleteInstance($name, array $optionalArgs = []) - { - $request = new DeleteInstanceRequest(); - $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('DeleteInstance', $optionalArgs, $request, $this->getOperationsClient())->wait(); - } - - /** - * Gets details of a single Environment. - * - * Sample code: - * ``` - * $notebookServiceClient = new NotebookServiceClient(); - * try { - * $name = 'name'; - * $response = $notebookServiceClient->getEnvironment($name); - * } finally { - * $notebookServiceClient->close(); - * } - * ``` - * - * @param string $name Required. Format: - * `projects/{project_id}/locations/{location}/environments/{environment_id}` - * @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\Notebooks\V1beta1\Environment - * - * @throws ApiException if the remote call fails - * - * @experimental - */ - public function getEnvironment($name, array $optionalArgs = []) - { - $request = new GetEnvironmentRequest(); - $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('GetEnvironment', Environment::class, $optionalArgs, $request)->wait(); - } - - /** - * Gets details of a single Instance. - * - * Sample code: - * ``` - * $notebookServiceClient = new NotebookServiceClient(); - * try { - * $name = 'name'; - * $response = $notebookServiceClient->getInstance($name); - * } finally { - * $notebookServiceClient->close(); - * } - * ``` - * - * @param string $name Required. Format: - * `projects/{project_id}/locations/{location}/instances/{instance_id}` - * @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\Notebooks\V1beta1\Instance - * - * @throws ApiException if the remote call fails - * - * @experimental - */ - public function getInstance($name, array $optionalArgs = []) - { - $request = new GetInstanceRequest(); - $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('GetInstance', Instance::class, $optionalArgs, $request)->wait(); - } - - /** - * Check if a notebook instance is upgradable. - * Deprecated. Please consider using v1. - * - * Sample code: - * ``` - * $notebookServiceClient = new NotebookServiceClient(); - * try { - * $notebookInstance = 'notebook_instance'; - * $response = $notebookServiceClient->isInstanceUpgradeable($notebookInstance); - * } finally { - * $notebookServiceClient->close(); - * } - * ``` - * - * @param string $notebookInstance Required. Format: - * `projects/{project_id}/locations/{location}/instances/{instance_id}` - * @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\Notebooks\V1beta1\IsInstanceUpgradeableResponse - * - * @throws ApiException if the remote call fails - * - * @experimental - * - * @deprecated This method will be removed in the next major version update. - */ - public function isInstanceUpgradeable($notebookInstance, array $optionalArgs = []) - { - $request = new IsInstanceUpgradeableRequest(); - $requestParamHeaders = []; - $request->setNotebookInstance($notebookInstance); - $requestParamHeaders['notebook_instance'] = $notebookInstance; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('IsInstanceUpgradeable', IsInstanceUpgradeableResponse::class, $optionalArgs, $request)->wait(); - } - - /** - * Lists environments in a project. - * - * Sample code: - * ``` - * $notebookServiceClient = new NotebookServiceClient(); - * try { - * $parent = 'parent'; - * // Iterate over pages of elements - * $pagedResponse = $notebookServiceClient->listEnvironments($parent); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $notebookServiceClient->listEnvironments($parent); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $notebookServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. Format: `projects/{project_id}/locations/{location}` - * @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 - * - * @experimental - */ - public function listEnvironments($parent, array $optionalArgs = []) - { - $request = new ListEnvironmentsRequest(); - $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('ListEnvironments', $optionalArgs, ListEnvironmentsResponse::class, $request); - } - - /** - * Lists instances in a given project and location. - * - * Sample code: - * ``` - * $notebookServiceClient = new NotebookServiceClient(); - * try { - * $parent = 'parent'; - * // Iterate over pages of elements - * $pagedResponse = $notebookServiceClient->listInstances($parent); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $notebookServiceClient->listInstances($parent); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $notebookServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. Format: - * `parent=projects/{project_id}/locations/{location}` - * @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 - * - * @experimental - */ - public function listInstances($parent, array $optionalArgs = []) - { - $request = new ListInstancesRequest(); - $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('ListInstances', $optionalArgs, ListInstancesResponse::class, $request); - } - - /** - * Registers an existing legacy notebook instance to the Notebooks API server. - * Legacy instances are instances created with the legacy Compute Engine - * calls. They are not manageable by the Notebooks API out of the box. This - * call makes these instances manageable by the Notebooks API. - * - * Sample code: - * ``` - * $notebookServiceClient = new NotebookServiceClient(); - * try { - * $parent = 'parent'; - * $instanceId = 'instance_id'; - * $operationResponse = $notebookServiceClient->registerInstance($parent, $instanceId); - * $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 = $notebookServiceClient->registerInstance($parent, $instanceId); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $notebookServiceClient->resumeOperation($operationName, 'registerInstance'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $notebookServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. Format: - * `parent=projects/{project_id}/locations/{location}` - * @param string $instanceId Required. User defined unique ID of this instance. The `instance_id` must - * be 1 to 63 characters long and contain only lowercase letters, - * numeric characters, and dashes. The first character must be a lowercase - * letter and the last character cannot be a dash. - * @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 - * - * @experimental - */ - public function registerInstance($parent, $instanceId, array $optionalArgs = []) - { - $request = new RegisterInstanceRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setInstanceId($instanceId); - $requestParamHeaders['parent'] = $parent; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startOperationsCall('RegisterInstance', $optionalArgs, $request, $this->getOperationsClient())->wait(); - } - - /** - * Allows notebook instances to - * report their latest instance information to the Notebooks - * API server. The server will merge the reported information to - * the instance metadata store. Do not use this method directly. - * - * Sample code: - * ``` - * $notebookServiceClient = new NotebookServiceClient(); - * try { - * $name = 'name'; - * $vmId = 'vm_id'; - * $operationResponse = $notebookServiceClient->reportInstanceInfo($name, $vmId); - * $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 = $notebookServiceClient->reportInstanceInfo($name, $vmId); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $notebookServiceClient->resumeOperation($operationName, 'reportInstanceInfo'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $notebookServiceClient->close(); - * } - * ``` - * - * @param string $name Required. Format: - * `projects/{project_id}/locations/{location}/instances/{instance_id}` - * @param string $vmId Required. The VM hardware token for authenticating the VM. - * https://cloud.google.com/compute/docs/instances/verifying-instance-identity - * @param array $optionalArgs { - * Optional. - * - * @type array $metadata - * The metadata reported to Notebooks API. This will be merged to the instance - * metadata store - * @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 - * - * @experimental - */ - public function reportInstanceInfo($name, $vmId, array $optionalArgs = []) - { - $request = new ReportInstanceInfoRequest(); - $requestParamHeaders = []; - $request->setName($name); - $request->setVmId($vmId); - $requestParamHeaders['name'] = $name; - if (isset($optionalArgs['metadata'])) { - $request->setMetadata($optionalArgs['metadata']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startOperationsCall('ReportInstanceInfo', $optionalArgs, $request, $this->getOperationsClient())->wait(); - } - - /** - * Resets a notebook instance. - * - * Sample code: - * ``` - * $notebookServiceClient = new NotebookServiceClient(); - * try { - * $name = 'name'; - * $operationResponse = $notebookServiceClient->resetInstance($name); - * $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 = $notebookServiceClient->resetInstance($name); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $notebookServiceClient->resumeOperation($operationName, 'resetInstance'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $notebookServiceClient->close(); - * } - * ``` - * - * @param string $name Required. Format: - * `projects/{project_id}/locations/{location}/instances/{instance_id}` - * @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 - * - * @experimental - */ - public function resetInstance($name, array $optionalArgs = []) - { - $request = new ResetInstanceRequest(); - $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('ResetInstance', $optionalArgs, $request, $this->getOperationsClient())->wait(); - } - - /** - * Updates the guest accelerators of a single Instance. - * - * Sample code: - * ``` - * $notebookServiceClient = new NotebookServiceClient(); - * try { - * $name = 'name'; - * $type = AcceleratorType::ACCELERATOR_TYPE_UNSPECIFIED; - * $coreCount = 0; - * $operationResponse = $notebookServiceClient->setInstanceAccelerator($name, $type, $coreCount); - * $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 = $notebookServiceClient->setInstanceAccelerator($name, $type, $coreCount); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $notebookServiceClient->resumeOperation($operationName, 'setInstanceAccelerator'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $notebookServiceClient->close(); - * } - * ``` - * - * @param string $name Required. Format: - * `projects/{project_id}/locations/{location}/instances/{instance_id}` - * @param int $type Required. Type of this accelerator. - * For allowed values, use constants defined on {@see \Google\Cloud\Notebooks\V1beta1\Instance\AcceleratorType} - * @param int $coreCount Required. Count of cores of this accelerator. Note that not all combinations - * of `type` and `core_count` are valid. Check [GPUs on - * Compute Engine](https://cloud.google.com/compute/docs/gpus/#gpus-list) to - * find a valid combination. TPUs are not supported. - * @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 - * - * @experimental - */ - public function setInstanceAccelerator($name, $type, $coreCount, array $optionalArgs = []) - { - $request = new SetInstanceAcceleratorRequest(); - $requestParamHeaders = []; - $request->setName($name); - $request->setType($type); - $request->setCoreCount($coreCount); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startOperationsCall('SetInstanceAccelerator', $optionalArgs, $request, $this->getOperationsClient())->wait(); - } - - /** - * Updates the labels of an Instance. - * - * Sample code: - * ``` - * $notebookServiceClient = new NotebookServiceClient(); - * try { - * $name = 'name'; - * $operationResponse = $notebookServiceClient->setInstanceLabels($name); - * $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 = $notebookServiceClient->setInstanceLabels($name); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $notebookServiceClient->resumeOperation($operationName, 'setInstanceLabels'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $notebookServiceClient->close(); - * } - * ``` - * - * @param string $name Required. Format: - * `projects/{project_id}/locations/{location}/instances/{instance_id}` - * @param array $optionalArgs { - * Optional. - * - * @type array $labels - * Labels to apply to this instance. - * These can be later modified by the setLabels method - * @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 - * - * @experimental - */ - public function setInstanceLabels($name, array $optionalArgs = []) - { - $request = new SetInstanceLabelsRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - if (isset($optionalArgs['labels'])) { - $request->setLabels($optionalArgs['labels']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startOperationsCall('SetInstanceLabels', $optionalArgs, $request, $this->getOperationsClient())->wait(); - } - - /** - * Updates the machine type of a single Instance. - * - * Sample code: - * ``` - * $notebookServiceClient = new NotebookServiceClient(); - * try { - * $name = 'name'; - * $machineType = 'machine_type'; - * $operationResponse = $notebookServiceClient->setInstanceMachineType($name, $machineType); - * $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 = $notebookServiceClient->setInstanceMachineType($name, $machineType); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $notebookServiceClient->resumeOperation($operationName, 'setInstanceMachineType'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $notebookServiceClient->close(); - * } - * ``` - * - * @param string $name Required. Format: - * `projects/{project_id}/locations/{location}/instances/{instance_id}` - * @param string $machineType Required. The [Compute Engine machine - * type](https://cloud.google.com/compute/docs/machine-types). - * @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 - * - * @experimental - */ - public function setInstanceMachineType($name, $machineType, array $optionalArgs = []) - { - $request = new SetInstanceMachineTypeRequest(); - $requestParamHeaders = []; - $request->setName($name); - $request->setMachineType($machineType); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startOperationsCall('SetInstanceMachineType', $optionalArgs, $request, $this->getOperationsClient())->wait(); - } - - /** - * Starts a notebook instance. - * - * Sample code: - * ``` - * $notebookServiceClient = new NotebookServiceClient(); - * try { - * $name = 'name'; - * $operationResponse = $notebookServiceClient->startInstance($name); - * $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 = $notebookServiceClient->startInstance($name); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $notebookServiceClient->resumeOperation($operationName, 'startInstance'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $notebookServiceClient->close(); - * } - * ``` - * - * @param string $name Required. Format: - * `projects/{project_id}/locations/{location}/instances/{instance_id}` - * @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 - * - * @experimental - */ - public function startInstance($name, array $optionalArgs = []) - { - $request = new StartInstanceRequest(); - $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('StartInstance', $optionalArgs, $request, $this->getOperationsClient())->wait(); - } - - /** - * Stops a notebook instance. - * - * Sample code: - * ``` - * $notebookServiceClient = new NotebookServiceClient(); - * try { - * $name = 'name'; - * $operationResponse = $notebookServiceClient->stopInstance($name); - * $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 = $notebookServiceClient->stopInstance($name); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $notebookServiceClient->resumeOperation($operationName, 'stopInstance'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $notebookServiceClient->close(); - * } - * ``` - * - * @param string $name Required. Format: - * `projects/{project_id}/locations/{location}/instances/{instance_id}` - * @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 - * - * @experimental - */ - public function stopInstance($name, array $optionalArgs = []) - { - $request = new StopInstanceRequest(); - $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('StopInstance', $optionalArgs, $request, $this->getOperationsClient())->wait(); - } - - /** - * Upgrades a notebook instance to the latest version. - * Deprecated. Please consider using v1. - * - * Sample code: - * ``` - * $notebookServiceClient = new NotebookServiceClient(); - * try { - * $name = 'name'; - * $operationResponse = $notebookServiceClient->upgradeInstance($name); - * $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 = $notebookServiceClient->upgradeInstance($name); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $notebookServiceClient->resumeOperation($operationName, 'upgradeInstance'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $notebookServiceClient->close(); - * } - * ``` - * - * @param string $name Required. Format: - * `projects/{project_id}/locations/{location}/instances/{instance_id}` - * @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 - * - * @experimental - * - * @deprecated This method will be removed in the next major version update. - */ - public function upgradeInstance($name, array $optionalArgs = []) - { - $request = new UpgradeInstanceRequest(); - $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('UpgradeInstance', $optionalArgs, $request, $this->getOperationsClient())->wait(); - } - - /** - * Allows notebook instances to - * call this endpoint to upgrade themselves. Do not use this method directly. - * Deprecated. Please consider using v1. - * - * Sample code: - * ``` - * $notebookServiceClient = new NotebookServiceClient(); - * try { - * $name = 'name'; - * $vmId = 'vm_id'; - * $operationResponse = $notebookServiceClient->upgradeInstanceInternal($name, $vmId); - * $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 = $notebookServiceClient->upgradeInstanceInternal($name, $vmId); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $notebookServiceClient->resumeOperation($operationName, 'upgradeInstanceInternal'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $notebookServiceClient->close(); - * } - * ``` - * - * @param string $name Required. Format: - * `projects/{project_id}/locations/{location}/instances/{instance_id}` - * @param string $vmId Required. The VM hardware token for authenticating the VM. - * https://cloud.google.com/compute/docs/instances/verifying-instance-identity - * @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 - * - * @experimental - * - * @deprecated This method will be removed in the next major version update. - */ - public function upgradeInstanceInternal($name, $vmId, array $optionalArgs = []) - { - $request = new UpgradeInstanceInternalRequest(); - $requestParamHeaders = []; - $request->setName($name); - $request->setVmId($vmId); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startOperationsCall('UpgradeInstanceInternal', $optionalArgs, $request, $this->getOperationsClient())->wait(); - } - - /** - * Gets information about a location. - * - * Sample code: - * ``` - * $notebookServiceClient = new NotebookServiceClient(); - * try { - * $response = $notebookServiceClient->getLocation(); - * } finally { - * $notebookServiceClient->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 - * - * @experimental - */ - 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: - * ``` - * $notebookServiceClient = new NotebookServiceClient(); - * try { - * // Iterate over pages of elements - * $pagedResponse = $notebookServiceClient->listLocations(); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $notebookServiceClient->listLocations(); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $notebookServiceClient->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 - * - * @experimental - */ - 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'); - } - - /** - * Gets the access control policy for a resource. Returns an empty policy - if the resource exists and does not have a policy set. - * - * Sample code: - * ``` - * $notebookServiceClient = new NotebookServiceClient(); - * try { - * $resource = 'resource'; - * $response = $notebookServiceClient->getIamPolicy($resource); - * } finally { - * $notebookServiceClient->close(); - * } - * ``` - * - * @param string $resource REQUIRED: The resource for which the policy is being requested. - * See the operation documentation for the appropriate value for this field. - * @param array $optionalArgs { - * Optional. - * - * @type GetPolicyOptions $options - * OPTIONAL: A `GetPolicyOptions` object for specifying options to - * `GetIamPolicy`. - * @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\Iam\V1\Policy - * - * @throws ApiException if the remote call fails - * - * @experimental - */ - public function getIamPolicy($resource, array $optionalArgs = []) - { - $request = new GetIamPolicyRequest(); - $requestParamHeaders = []; - $request->setResource($resource); - $requestParamHeaders['resource'] = $resource; - if (isset($optionalArgs['options'])) { - $request->setOptions($optionalArgs['options']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('GetIamPolicy', Policy::class, $optionalArgs, $request, Call::UNARY_CALL, 'google.iam.v1.IAMPolicy')->wait(); - } - - /** - * Sets the access control policy on the specified resource. Replaces - any existing policy. - - Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` - errors. - * - * Sample code: - * ``` - * $notebookServiceClient = new NotebookServiceClient(); - * try { - * $resource = 'resource'; - * $policy = new Policy(); - * $response = $notebookServiceClient->setIamPolicy($resource, $policy); - * } finally { - * $notebookServiceClient->close(); - * } - * ``` - * - * @param string $resource REQUIRED: The resource for which the policy is being specified. - * See the operation documentation for the appropriate value for this field. - * @param Policy $policy REQUIRED: The complete policy to be applied to the `resource`. The size of - * the policy is limited to a few 10s of KB. An empty policy is a - * valid policy but certain Cloud Platform services (such as Projects) - * might reject them. - * @param array $optionalArgs { - * Optional. - * - * @type FieldMask $updateMask - * OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only - * the fields in the mask will be modified. If no mask is provided, the - * following default mask is used: - * - * `paths: "bindings, etag"` - * @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\Iam\V1\Policy - * - * @throws ApiException if the remote call fails - * - * @experimental - */ - public function setIamPolicy($resource, $policy, array $optionalArgs = []) - { - $request = new SetIamPolicyRequest(); - $requestParamHeaders = []; - $request->setResource($resource); - $request->setPolicy($policy); - $requestParamHeaders['resource'] = $resource; - if (isset($optionalArgs['updateMask'])) { - $request->setUpdateMask($optionalArgs['updateMask']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('SetIamPolicy', Policy::class, $optionalArgs, $request, Call::UNARY_CALL, 'google.iam.v1.IAMPolicy')->wait(); - } - - /** - * Returns permissions that a caller has on the specified resource. If the - resource does not exist, this will return an empty set of - permissions, not a `NOT_FOUND` error. - - Note: This operation is designed to be used for building - permission-aware UIs and command-line tools, not for authorization - checking. This operation may "fail open" without warning. - * - * Sample code: - * ``` - * $notebookServiceClient = new NotebookServiceClient(); - * try { - * $resource = 'resource'; - * $permissions = []; - * $response = $notebookServiceClient->testIamPermissions($resource, $permissions); - * } finally { - * $notebookServiceClient->close(); - * } - * ``` - * - * @param string $resource REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param string[] $permissions The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see - * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). - * @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\Iam\V1\TestIamPermissionsResponse - * - * @throws ApiException if the remote call fails - * - * @experimental - */ - public function testIamPermissions($resource, $permissions, array $optionalArgs = []) - { - $request = new TestIamPermissionsRequest(); - $requestParamHeaders = []; - $request->setResource($resource); - $request->setPermissions($permissions); - $requestParamHeaders['resource'] = $resource; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('TestIamPermissions', TestIamPermissionsResponse::class, $optionalArgs, $request, Call::UNARY_CALL, 'google.iam.v1.IAMPolicy')->wait(); - } -} diff --git a/Notebooks/src/V1beta1/GetEnvironmentRequest.php b/Notebooks/src/V1beta1/GetEnvironmentRequest.php deleted file mode 100644 index 99a76054d80d..000000000000 --- a/Notebooks/src/V1beta1/GetEnvironmentRequest.php +++ /dev/null @@ -1,71 +0,0 @@ -google.cloud.notebooks.v1beta1.GetEnvironmentRequest - */ -class GetEnvironmentRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. Format: - * `projects/{project_id}/locations/{location}/environments/{environment_id}` - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $name = ''; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $name - * Required. Format: - * `projects/{project_id}/locations/{location}/environments/{environment_id}` - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Notebooks\V1Beta1\Service::initOnce(); - parent::__construct($data); - } - - /** - * Required. Format: - * `projects/{project_id}/locations/{location}/environments/{environment_id}` - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * Required. Format: - * `projects/{project_id}/locations/{location}/environments/{environment_id}` - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; - * @param string $var - * @return $this - */ - public function setName($var) - { - GPBUtil::checkString($var, True); - $this->name = $var; - - return $this; - } - -} - diff --git a/Notebooks/src/V1beta1/GetInstanceRequest.php b/Notebooks/src/V1beta1/GetInstanceRequest.php deleted file mode 100644 index 3d47989ff0ad..000000000000 --- a/Notebooks/src/V1beta1/GetInstanceRequest.php +++ /dev/null @@ -1,71 +0,0 @@ -google.cloud.notebooks.v1beta1.GetInstanceRequest - */ -class GetInstanceRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. Format: - * `projects/{project_id}/locations/{location}/instances/{instance_id}` - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $name = ''; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $name - * Required. Format: - * `projects/{project_id}/locations/{location}/instances/{instance_id}` - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Notebooks\V1Beta1\Service::initOnce(); - parent::__construct($data); - } - - /** - * Required. Format: - * `projects/{project_id}/locations/{location}/instances/{instance_id}` - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * Required. Format: - * `projects/{project_id}/locations/{location}/instances/{instance_id}` - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; - * @param string $var - * @return $this - */ - public function setName($var) - { - GPBUtil::checkString($var, True); - $this->name = $var; - - return $this; - } - -} - diff --git a/Notebooks/src/V1beta1/Instance.php b/Notebooks/src/V1beta1/Instance.php deleted file mode 100644 index 35ea4671bcd0..000000000000 --- a/Notebooks/src/V1beta1/Instance.php +++ /dev/null @@ -1,1268 +0,0 @@ -google.cloud.notebooks.v1beta1.Instance - */ -class Instance extends \Google\Protobuf\Internal\Message -{ - /** - * Output only. The name of this notebook instance. Format: - * `projects/{project_id}/locations/{location}/instances/{instance_id}` - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; - */ - protected $name = ''; - /** - * Path to a Bash script that automatically runs after a notebook instance - * fully boots up. The path must be a URL or - * Cloud Storage path (`gs://path-to-file/file-name`). - * - * Generated from protobuf field string post_startup_script = 4; - */ - protected $post_startup_script = ''; - /** - * Output only. The proxy endpoint that is used to access the Jupyter notebook. - * - * Generated from protobuf field string proxy_uri = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; - */ - protected $proxy_uri = ''; - /** - * Input only. The owner of this instance after creation. Format: `alias@example.com` - * Currently supports one owner only. If not specified, all of the service - * account users of your VM instance's service account can use - * the instance. - * - * Generated from protobuf field repeated string instance_owners = 6 [(.google.api.field_behavior) = INPUT_ONLY]; - */ - private $instance_owners; - /** - * The service account on this instance, giving access to other Google - * Cloud services. - * You can use any service account within the same project, but you - * must have the service account user permission to use the instance. - * If not specified, the [Compute Engine default service - * account](https://cloud.google.com/compute/docs/access/service-accounts#default_service_account) - * is used. - * - * Generated from protobuf field string service_account = 7; - */ - protected $service_account = ''; - /** - * Required. The [Compute Engine machine - * type](https://cloud.google.com/compute/docs/machine-types) of this - * instance. - * - * Generated from protobuf field string machine_type = 8 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $machine_type = ''; - /** - * The hardware accelerator used on this instance. If you use - * accelerators, make sure that your configuration has - * [enough vCPUs and memory to support the `machine_type` you have - * selected](https://cloud.google.com/compute/docs/gpus/#gpus-list). - * - * Generated from protobuf field .google.cloud.notebooks.v1beta1.Instance.AcceleratorConfig accelerator_config = 9; - */ - protected $accelerator_config = null; - /** - * Output only. The state of this instance. - * - * Generated from protobuf field .google.cloud.notebooks.v1beta1.Instance.State state = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; - */ - protected $state = 0; - /** - * Whether the end user authorizes Google Cloud to install GPU driver - * on this instance. - * If this field is empty or set to false, the GPU driver won't be installed. - * Only applicable to instances with GPUs. - * - * Generated from protobuf field bool install_gpu_driver = 11; - */ - protected $install_gpu_driver = false; - /** - * Specify a custom Cloud Storage path where the GPU driver is stored. - * If not specified, we'll automatically choose from official GPU drivers. - * - * Generated from protobuf field string custom_gpu_driver_path = 12; - */ - protected $custom_gpu_driver_path = ''; - /** - * Input only. The type of the boot disk attached to this instance, defaults to - * standard persistent disk (`PD_STANDARD`). - * - * Generated from protobuf field .google.cloud.notebooks.v1beta1.Instance.DiskType boot_disk_type = 13 [(.google.api.field_behavior) = INPUT_ONLY]; - */ - protected $boot_disk_type = 0; - /** - * Input only. The size of the boot disk in GB attached to this instance, up to a maximum - * of 64000 GB (64 TB). The minimum recommended value is 100 GB. If not - * specified, this defaults to 100. - * - * Generated from protobuf field int64 boot_disk_size_gb = 14 [(.google.api.field_behavior) = INPUT_ONLY]; - */ - protected $boot_disk_size_gb = 0; - /** - * Input only. The type of the data disk attached to this instance, defaults to - * standard persistent disk (`PD_STANDARD`). - * - * Generated from protobuf field .google.cloud.notebooks.v1beta1.Instance.DiskType data_disk_type = 25 [(.google.api.field_behavior) = INPUT_ONLY]; - */ - protected $data_disk_type = 0; - /** - * Input only. The size of the data disk in GB attached to this instance, up to a maximum - * of 64000 GB (64 TB). You can choose the size of the data disk based on how - * big your notebooks and data are. If not specified, this defaults to 100. - * - * Generated from protobuf field int64 data_disk_size_gb = 26 [(.google.api.field_behavior) = INPUT_ONLY]; - */ - protected $data_disk_size_gb = 0; - /** - * Input only. If true, the data disk will not be auto deleted when deleting the instance. - * - * Generated from protobuf field bool no_remove_data_disk = 27 [(.google.api.field_behavior) = INPUT_ONLY]; - */ - protected $no_remove_data_disk = false; - /** - * Input only. Disk encryption method used on the boot and data disks, defaults to GMEK. - * - * Generated from protobuf field .google.cloud.notebooks.v1beta1.Instance.DiskEncryption disk_encryption = 15 [(.google.api.field_behavior) = INPUT_ONLY]; - */ - protected $disk_encryption = 0; - /** - * Input only. The KMS key used to encrypt the disks, only applicable if disk_encryption - * is CMEK. - * Format: - * `projects/{project_id}/locations/{location}/keyRings/{key_ring_id}/cryptoKeys/{key_id}` - * Learn more about [using your own encryption - * keys](https://cloud.google.com/kms/docs/quickstart). - * - * Generated from protobuf field string kms_key = 16 [(.google.api.field_behavior) = INPUT_ONLY]; - */ - protected $kms_key = ''; - /** - * If true, no public IP will be assigned to this instance. - * - * Generated from protobuf field bool no_public_ip = 17; - */ - protected $no_public_ip = false; - /** - * If true, the notebook instance will not register with the proxy. - * - * Generated from protobuf field bool no_proxy_access = 18; - */ - protected $no_proxy_access = false; - /** - * The name of the VPC that this instance is in. - * Format: - * `projects/{project_id}/global/networks/{network_id}` - * - * Generated from protobuf field string network = 19; - */ - protected $network = ''; - /** - * The name of the subnet that this instance is in. - * Format: - * `projects/{project_id}/regions/{region}/subnetworks/{subnetwork_id}` - * - * Generated from protobuf field string subnet = 20; - */ - protected $subnet = ''; - /** - * Labels to apply to this instance. - * These can be later modified by the setLabels method. - * - * Generated from protobuf field map labels = 21; - */ - private $labels; - /** - * Custom metadata to apply to this instance. - * - * Generated from protobuf field map metadata = 22; - */ - private $metadata; - /** - * Optional. The type of vNIC to be used on this interface. This may be gVNIC or - * VirtioNet. - * - * Generated from protobuf field .google.cloud.notebooks.v1beta1.Instance.NicType nic_type = 28 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $nic_type = 0; - /** - * Optional. The optional reservation affinity. Setting this field will apply - * the specified [Zonal Compute - * Reservation](https://cloud.google.com/compute/docs/instances/reserving-zonal-resources) - * to this notebook instance. - * - * Generated from protobuf field .google.cloud.notebooks.v1beta1.ReservationAffinity reservation_affinity = 29 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $reservation_affinity = null; - /** - * Optional. Flag to enable ip forwarding or not, default false/off. - * https://cloud.google.com/vpc/docs/using-routes#canipforward - * - * Generated from protobuf field bool can_ip_forward = 31 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $can_ip_forward = false; - /** - * Output only. Instance creation time. - * - * Generated from protobuf field .google.protobuf.Timestamp create_time = 23 [(.google.api.field_behavior) = OUTPUT_ONLY]; - */ - protected $create_time = null; - /** - * Output only. Instance update time. - * - * Generated from protobuf field .google.protobuf.Timestamp update_time = 24 [(.google.api.field_behavior) = OUTPUT_ONLY]; - */ - protected $update_time = null; - protected $environment; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $name - * Output only. The name of this notebook instance. Format: - * `projects/{project_id}/locations/{location}/instances/{instance_id}` - * @type \Google\Cloud\Notebooks\V1beta1\VmImage $vm_image - * Use a Compute Engine VM image to start the notebook instance. - * @type \Google\Cloud\Notebooks\V1beta1\ContainerImage $container_image - * Use a container image to start the notebook instance. - * @type string $post_startup_script - * Path to a Bash script that automatically runs after a notebook instance - * fully boots up. The path must be a URL or - * Cloud Storage path (`gs://path-to-file/file-name`). - * @type string $proxy_uri - * Output only. The proxy endpoint that is used to access the Jupyter notebook. - * @type array|\Google\Protobuf\Internal\RepeatedField $instance_owners - * Input only. The owner of this instance after creation. Format: `alias@example.com` - * Currently supports one owner only. If not specified, all of the service - * account users of your VM instance's service account can use - * the instance. - * @type string $service_account - * The service account on this instance, giving access to other Google - * Cloud services. - * You can use any service account within the same project, but you - * must have the service account user permission to use the instance. - * If not specified, the [Compute Engine default service - * account](https://cloud.google.com/compute/docs/access/service-accounts#default_service_account) - * is used. - * @type string $machine_type - * Required. The [Compute Engine machine - * type](https://cloud.google.com/compute/docs/machine-types) of this - * instance. - * @type \Google\Cloud\Notebooks\V1beta1\Instance\AcceleratorConfig $accelerator_config - * The hardware accelerator used on this instance. If you use - * accelerators, make sure that your configuration has - * [enough vCPUs and memory to support the `machine_type` you have - * selected](https://cloud.google.com/compute/docs/gpus/#gpus-list). - * @type int $state - * Output only. The state of this instance. - * @type bool $install_gpu_driver - * Whether the end user authorizes Google Cloud to install GPU driver - * on this instance. - * If this field is empty or set to false, the GPU driver won't be installed. - * Only applicable to instances with GPUs. - * @type string $custom_gpu_driver_path - * Specify a custom Cloud Storage path where the GPU driver is stored. - * If not specified, we'll automatically choose from official GPU drivers. - * @type int $boot_disk_type - * Input only. The type of the boot disk attached to this instance, defaults to - * standard persistent disk (`PD_STANDARD`). - * @type int|string $boot_disk_size_gb - * Input only. The size of the boot disk in GB attached to this instance, up to a maximum - * of 64000 GB (64 TB). The minimum recommended value is 100 GB. If not - * specified, this defaults to 100. - * @type int $data_disk_type - * Input only. The type of the data disk attached to this instance, defaults to - * standard persistent disk (`PD_STANDARD`). - * @type int|string $data_disk_size_gb - * Input only. The size of the data disk in GB attached to this instance, up to a maximum - * of 64000 GB (64 TB). You can choose the size of the data disk based on how - * big your notebooks and data are. If not specified, this defaults to 100. - * @type bool $no_remove_data_disk - * Input only. If true, the data disk will not be auto deleted when deleting the instance. - * @type int $disk_encryption - * Input only. Disk encryption method used on the boot and data disks, defaults to GMEK. - * @type string $kms_key - * Input only. The KMS key used to encrypt the disks, only applicable if disk_encryption - * is CMEK. - * Format: - * `projects/{project_id}/locations/{location}/keyRings/{key_ring_id}/cryptoKeys/{key_id}` - * Learn more about [using your own encryption - * keys](https://cloud.google.com/kms/docs/quickstart). - * @type bool $no_public_ip - * If true, no public IP will be assigned to this instance. - * @type bool $no_proxy_access - * If true, the notebook instance will not register with the proxy. - * @type string $network - * The name of the VPC that this instance is in. - * Format: - * `projects/{project_id}/global/networks/{network_id}` - * @type string $subnet - * The name of the subnet that this instance is in. - * Format: - * `projects/{project_id}/regions/{region}/subnetworks/{subnetwork_id}` - * @type array|\Google\Protobuf\Internal\MapField $labels - * Labels to apply to this instance. - * These can be later modified by the setLabels method. - * @type array|\Google\Protobuf\Internal\MapField $metadata - * Custom metadata to apply to this instance. - * @type int $nic_type - * Optional. The type of vNIC to be used on this interface. This may be gVNIC or - * VirtioNet. - * @type \Google\Cloud\Notebooks\V1beta1\ReservationAffinity $reservation_affinity - * Optional. The optional reservation affinity. Setting this field will apply - * the specified [Zonal Compute - * Reservation](https://cloud.google.com/compute/docs/instances/reserving-zonal-resources) - * to this notebook instance. - * @type bool $can_ip_forward - * Optional. Flag to enable ip forwarding or not, default false/off. - * https://cloud.google.com/vpc/docs/using-routes#canipforward - * @type \Google\Protobuf\Timestamp $create_time - * Output only. Instance creation time. - * @type \Google\Protobuf\Timestamp $update_time - * Output only. Instance update time. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Notebooks\V1Beta1\Instance::initOnce(); - parent::__construct($data); - } - - /** - * Output only. The name of this notebook instance. Format: - * `projects/{project_id}/locations/{location}/instances/{instance_id}` - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * Output only. The name of this notebook instance. Format: - * `projects/{project_id}/locations/{location}/instances/{instance_id}` - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @param string $var - * @return $this - */ - public function setName($var) - { - GPBUtil::checkString($var, True); - $this->name = $var; - - return $this; - } - - /** - * Use a Compute Engine VM image to start the notebook instance. - * - * Generated from protobuf field .google.cloud.notebooks.v1beta1.VmImage vm_image = 2; - * @return \Google\Cloud\Notebooks\V1beta1\VmImage|null - */ - public function getVmImage() - { - return $this->readOneof(2); - } - - public function hasVmImage() - { - return $this->hasOneof(2); - } - - /** - * Use a Compute Engine VM image to start the notebook instance. - * - * Generated from protobuf field .google.cloud.notebooks.v1beta1.VmImage vm_image = 2; - * @param \Google\Cloud\Notebooks\V1beta1\VmImage $var - * @return $this - */ - public function setVmImage($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Notebooks\V1beta1\VmImage::class); - $this->writeOneof(2, $var); - - return $this; - } - - /** - * Use a container image to start the notebook instance. - * - * Generated from protobuf field .google.cloud.notebooks.v1beta1.ContainerImage container_image = 3; - * @return \Google\Cloud\Notebooks\V1beta1\ContainerImage|null - */ - public function getContainerImage() - { - return $this->readOneof(3); - } - - public function hasContainerImage() - { - return $this->hasOneof(3); - } - - /** - * Use a container image to start the notebook instance. - * - * Generated from protobuf field .google.cloud.notebooks.v1beta1.ContainerImage container_image = 3; - * @param \Google\Cloud\Notebooks\V1beta1\ContainerImage $var - * @return $this - */ - public function setContainerImage($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Notebooks\V1beta1\ContainerImage::class); - $this->writeOneof(3, $var); - - return $this; - } - - /** - * Path to a Bash script that automatically runs after a notebook instance - * fully boots up. The path must be a URL or - * Cloud Storage path (`gs://path-to-file/file-name`). - * - * Generated from protobuf field string post_startup_script = 4; - * @return string - */ - public function getPostStartupScript() - { - return $this->post_startup_script; - } - - /** - * Path to a Bash script that automatically runs after a notebook instance - * fully boots up. The path must be a URL or - * Cloud Storage path (`gs://path-to-file/file-name`). - * - * Generated from protobuf field string post_startup_script = 4; - * @param string $var - * @return $this - */ - public function setPostStartupScript($var) - { - GPBUtil::checkString($var, True); - $this->post_startup_script = $var; - - return $this; - } - - /** - * Output only. The proxy endpoint that is used to access the Jupyter notebook. - * - * Generated from protobuf field string proxy_uri = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @return string - */ - public function getProxyUri() - { - return $this->proxy_uri; - } - - /** - * Output only. The proxy endpoint that is used to access the Jupyter notebook. - * - * Generated from protobuf field string proxy_uri = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @param string $var - * @return $this - */ - public function setProxyUri($var) - { - GPBUtil::checkString($var, True); - $this->proxy_uri = $var; - - return $this; - } - - /** - * Input only. The owner of this instance after creation. Format: `alias@example.com` - * Currently supports one owner only. If not specified, all of the service - * account users of your VM instance's service account can use - * the instance. - * - * Generated from protobuf field repeated string instance_owners = 6 [(.google.api.field_behavior) = INPUT_ONLY]; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getInstanceOwners() - { - return $this->instance_owners; - } - - /** - * Input only. The owner of this instance after creation. Format: `alias@example.com` - * Currently supports one owner only. If not specified, all of the service - * account users of your VM instance's service account can use - * the instance. - * - * Generated from protobuf field repeated string instance_owners = 6 [(.google.api.field_behavior) = INPUT_ONLY]; - * @param array|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setInstanceOwners($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); - $this->instance_owners = $arr; - - return $this; - } - - /** - * The service account on this instance, giving access to other Google - * Cloud services. - * You can use any service account within the same project, but you - * must have the service account user permission to use the instance. - * If not specified, the [Compute Engine default service - * account](https://cloud.google.com/compute/docs/access/service-accounts#default_service_account) - * is used. - * - * Generated from protobuf field string service_account = 7; - * @return string - */ - public function getServiceAccount() - { - return $this->service_account; - } - - /** - * The service account on this instance, giving access to other Google - * Cloud services. - * You can use any service account within the same project, but you - * must have the service account user permission to use the instance. - * If not specified, the [Compute Engine default service - * account](https://cloud.google.com/compute/docs/access/service-accounts#default_service_account) - * is used. - * - * Generated from protobuf field string service_account = 7; - * @param string $var - * @return $this - */ - public function setServiceAccount($var) - { - GPBUtil::checkString($var, True); - $this->service_account = $var; - - return $this; - } - - /** - * Required. The [Compute Engine machine - * type](https://cloud.google.com/compute/docs/machine-types) of this - * instance. - * - * Generated from protobuf field string machine_type = 8 [(.google.api.field_behavior) = REQUIRED]; - * @return string - */ - public function getMachineType() - { - return $this->machine_type; - } - - /** - * Required. The [Compute Engine machine - * type](https://cloud.google.com/compute/docs/machine-types) of this - * instance. - * - * Generated from protobuf field string machine_type = 8 [(.google.api.field_behavior) = REQUIRED]; - * @param string $var - * @return $this - */ - public function setMachineType($var) - { - GPBUtil::checkString($var, True); - $this->machine_type = $var; - - return $this; - } - - /** - * The hardware accelerator used on this instance. If you use - * accelerators, make sure that your configuration has - * [enough vCPUs and memory to support the `machine_type` you have - * selected](https://cloud.google.com/compute/docs/gpus/#gpus-list). - * - * Generated from protobuf field .google.cloud.notebooks.v1beta1.Instance.AcceleratorConfig accelerator_config = 9; - * @return \Google\Cloud\Notebooks\V1beta1\Instance\AcceleratorConfig|null - */ - public function getAcceleratorConfig() - { - return $this->accelerator_config; - } - - public function hasAcceleratorConfig() - { - return isset($this->accelerator_config); - } - - public function clearAcceleratorConfig() - { - unset($this->accelerator_config); - } - - /** - * The hardware accelerator used on this instance. If you use - * accelerators, make sure that your configuration has - * [enough vCPUs and memory to support the `machine_type` you have - * selected](https://cloud.google.com/compute/docs/gpus/#gpus-list). - * - * Generated from protobuf field .google.cloud.notebooks.v1beta1.Instance.AcceleratorConfig accelerator_config = 9; - * @param \Google\Cloud\Notebooks\V1beta1\Instance\AcceleratorConfig $var - * @return $this - */ - public function setAcceleratorConfig($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Notebooks\V1beta1\Instance\AcceleratorConfig::class); - $this->accelerator_config = $var; - - return $this; - } - - /** - * Output only. The state of this instance. - * - * Generated from protobuf field .google.cloud.notebooks.v1beta1.Instance.State state = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @return int - */ - public function getState() - { - return $this->state; - } - - /** - * Output only. The state of this instance. - * - * Generated from protobuf field .google.cloud.notebooks.v1beta1.Instance.State state = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @param int $var - * @return $this - */ - public function setState($var) - { - GPBUtil::checkEnum($var, \Google\Cloud\Notebooks\V1beta1\Instance\State::class); - $this->state = $var; - - return $this; - } - - /** - * Whether the end user authorizes Google Cloud to install GPU driver - * on this instance. - * If this field is empty or set to false, the GPU driver won't be installed. - * Only applicable to instances with GPUs. - * - * Generated from protobuf field bool install_gpu_driver = 11; - * @return bool - */ - public function getInstallGpuDriver() - { - return $this->install_gpu_driver; - } - - /** - * Whether the end user authorizes Google Cloud to install GPU driver - * on this instance. - * If this field is empty or set to false, the GPU driver won't be installed. - * Only applicable to instances with GPUs. - * - * Generated from protobuf field bool install_gpu_driver = 11; - * @param bool $var - * @return $this - */ - public function setInstallGpuDriver($var) - { - GPBUtil::checkBool($var); - $this->install_gpu_driver = $var; - - return $this; - } - - /** - * Specify a custom Cloud Storage path where the GPU driver is stored. - * If not specified, we'll automatically choose from official GPU drivers. - * - * Generated from protobuf field string custom_gpu_driver_path = 12; - * @return string - */ - public function getCustomGpuDriverPath() - { - return $this->custom_gpu_driver_path; - } - - /** - * Specify a custom Cloud Storage path where the GPU driver is stored. - * If not specified, we'll automatically choose from official GPU drivers. - * - * Generated from protobuf field string custom_gpu_driver_path = 12; - * @param string $var - * @return $this - */ - public function setCustomGpuDriverPath($var) - { - GPBUtil::checkString($var, True); - $this->custom_gpu_driver_path = $var; - - return $this; - } - - /** - * Input only. The type of the boot disk attached to this instance, defaults to - * standard persistent disk (`PD_STANDARD`). - * - * Generated from protobuf field .google.cloud.notebooks.v1beta1.Instance.DiskType boot_disk_type = 13 [(.google.api.field_behavior) = INPUT_ONLY]; - * @return int - */ - public function getBootDiskType() - { - return $this->boot_disk_type; - } - - /** - * Input only. The type of the boot disk attached to this instance, defaults to - * standard persistent disk (`PD_STANDARD`). - * - * Generated from protobuf field .google.cloud.notebooks.v1beta1.Instance.DiskType boot_disk_type = 13 [(.google.api.field_behavior) = INPUT_ONLY]; - * @param int $var - * @return $this - */ - public function setBootDiskType($var) - { - GPBUtil::checkEnum($var, \Google\Cloud\Notebooks\V1beta1\Instance\DiskType::class); - $this->boot_disk_type = $var; - - return $this; - } - - /** - * Input only. The size of the boot disk in GB attached to this instance, up to a maximum - * of 64000 GB (64 TB). The minimum recommended value is 100 GB. If not - * specified, this defaults to 100. - * - * Generated from protobuf field int64 boot_disk_size_gb = 14 [(.google.api.field_behavior) = INPUT_ONLY]; - * @return int|string - */ - public function getBootDiskSizeGb() - { - return $this->boot_disk_size_gb; - } - - /** - * Input only. The size of the boot disk in GB attached to this instance, up to a maximum - * of 64000 GB (64 TB). The minimum recommended value is 100 GB. If not - * specified, this defaults to 100. - * - * Generated from protobuf field int64 boot_disk_size_gb = 14 [(.google.api.field_behavior) = INPUT_ONLY]; - * @param int|string $var - * @return $this - */ - public function setBootDiskSizeGb($var) - { - GPBUtil::checkInt64($var); - $this->boot_disk_size_gb = $var; - - return $this; - } - - /** - * Input only. The type of the data disk attached to this instance, defaults to - * standard persistent disk (`PD_STANDARD`). - * - * Generated from protobuf field .google.cloud.notebooks.v1beta1.Instance.DiskType data_disk_type = 25 [(.google.api.field_behavior) = INPUT_ONLY]; - * @return int - */ - public function getDataDiskType() - { - return $this->data_disk_type; - } - - /** - * Input only. The type of the data disk attached to this instance, defaults to - * standard persistent disk (`PD_STANDARD`). - * - * Generated from protobuf field .google.cloud.notebooks.v1beta1.Instance.DiskType data_disk_type = 25 [(.google.api.field_behavior) = INPUT_ONLY]; - * @param int $var - * @return $this - */ - public function setDataDiskType($var) - { - GPBUtil::checkEnum($var, \Google\Cloud\Notebooks\V1beta1\Instance\DiskType::class); - $this->data_disk_type = $var; - - return $this; - } - - /** - * Input only. The size of the data disk in GB attached to this instance, up to a maximum - * of 64000 GB (64 TB). You can choose the size of the data disk based on how - * big your notebooks and data are. If not specified, this defaults to 100. - * - * Generated from protobuf field int64 data_disk_size_gb = 26 [(.google.api.field_behavior) = INPUT_ONLY]; - * @return int|string - */ - public function getDataDiskSizeGb() - { - return $this->data_disk_size_gb; - } - - /** - * Input only. The size of the data disk in GB attached to this instance, up to a maximum - * of 64000 GB (64 TB). You can choose the size of the data disk based on how - * big your notebooks and data are. If not specified, this defaults to 100. - * - * Generated from protobuf field int64 data_disk_size_gb = 26 [(.google.api.field_behavior) = INPUT_ONLY]; - * @param int|string $var - * @return $this - */ - public function setDataDiskSizeGb($var) - { - GPBUtil::checkInt64($var); - $this->data_disk_size_gb = $var; - - return $this; - } - - /** - * Input only. If true, the data disk will not be auto deleted when deleting the instance. - * - * Generated from protobuf field bool no_remove_data_disk = 27 [(.google.api.field_behavior) = INPUT_ONLY]; - * @return bool - */ - public function getNoRemoveDataDisk() - { - return $this->no_remove_data_disk; - } - - /** - * Input only. If true, the data disk will not be auto deleted when deleting the instance. - * - * Generated from protobuf field bool no_remove_data_disk = 27 [(.google.api.field_behavior) = INPUT_ONLY]; - * @param bool $var - * @return $this - */ - public function setNoRemoveDataDisk($var) - { - GPBUtil::checkBool($var); - $this->no_remove_data_disk = $var; - - return $this; - } - - /** - * Input only. Disk encryption method used on the boot and data disks, defaults to GMEK. - * - * Generated from protobuf field .google.cloud.notebooks.v1beta1.Instance.DiskEncryption disk_encryption = 15 [(.google.api.field_behavior) = INPUT_ONLY]; - * @return int - */ - public function getDiskEncryption() - { - return $this->disk_encryption; - } - - /** - * Input only. Disk encryption method used on the boot and data disks, defaults to GMEK. - * - * Generated from protobuf field .google.cloud.notebooks.v1beta1.Instance.DiskEncryption disk_encryption = 15 [(.google.api.field_behavior) = INPUT_ONLY]; - * @param int $var - * @return $this - */ - public function setDiskEncryption($var) - { - GPBUtil::checkEnum($var, \Google\Cloud\Notebooks\V1beta1\Instance\DiskEncryption::class); - $this->disk_encryption = $var; - - return $this; - } - - /** - * Input only. The KMS key used to encrypt the disks, only applicable if disk_encryption - * is CMEK. - * Format: - * `projects/{project_id}/locations/{location}/keyRings/{key_ring_id}/cryptoKeys/{key_id}` - * Learn more about [using your own encryption - * keys](https://cloud.google.com/kms/docs/quickstart). - * - * Generated from protobuf field string kms_key = 16 [(.google.api.field_behavior) = INPUT_ONLY]; - * @return string - */ - public function getKmsKey() - { - return $this->kms_key; - } - - /** - * Input only. The KMS key used to encrypt the disks, only applicable if disk_encryption - * is CMEK. - * Format: - * `projects/{project_id}/locations/{location}/keyRings/{key_ring_id}/cryptoKeys/{key_id}` - * Learn more about [using your own encryption - * keys](https://cloud.google.com/kms/docs/quickstart). - * - * Generated from protobuf field string kms_key = 16 [(.google.api.field_behavior) = INPUT_ONLY]; - * @param string $var - * @return $this - */ - public function setKmsKey($var) - { - GPBUtil::checkString($var, True); - $this->kms_key = $var; - - return $this; - } - - /** - * If true, no public IP will be assigned to this instance. - * - * Generated from protobuf field bool no_public_ip = 17; - * @return bool - */ - public function getNoPublicIp() - { - return $this->no_public_ip; - } - - /** - * If true, no public IP will be assigned to this instance. - * - * Generated from protobuf field bool no_public_ip = 17; - * @param bool $var - * @return $this - */ - public function setNoPublicIp($var) - { - GPBUtil::checkBool($var); - $this->no_public_ip = $var; - - return $this; - } - - /** - * If true, the notebook instance will not register with the proxy. - * - * Generated from protobuf field bool no_proxy_access = 18; - * @return bool - */ - public function getNoProxyAccess() - { - return $this->no_proxy_access; - } - - /** - * If true, the notebook instance will not register with the proxy. - * - * Generated from protobuf field bool no_proxy_access = 18; - * @param bool $var - * @return $this - */ - public function setNoProxyAccess($var) - { - GPBUtil::checkBool($var); - $this->no_proxy_access = $var; - - return $this; - } - - /** - * The name of the VPC that this instance is in. - * Format: - * `projects/{project_id}/global/networks/{network_id}` - * - * Generated from protobuf field string network = 19; - * @return string - */ - public function getNetwork() - { - return $this->network; - } - - /** - * The name of the VPC that this instance is in. - * Format: - * `projects/{project_id}/global/networks/{network_id}` - * - * Generated from protobuf field string network = 19; - * @param string $var - * @return $this - */ - public function setNetwork($var) - { - GPBUtil::checkString($var, True); - $this->network = $var; - - return $this; - } - - /** - * The name of the subnet that this instance is in. - * Format: - * `projects/{project_id}/regions/{region}/subnetworks/{subnetwork_id}` - * - * Generated from protobuf field string subnet = 20; - * @return string - */ - public function getSubnet() - { - return $this->subnet; - } - - /** - * The name of the subnet that this instance is in. - * Format: - * `projects/{project_id}/regions/{region}/subnetworks/{subnetwork_id}` - * - * Generated from protobuf field string subnet = 20; - * @param string $var - * @return $this - */ - public function setSubnet($var) - { - GPBUtil::checkString($var, True); - $this->subnet = $var; - - return $this; - } - - /** - * Labels to apply to this instance. - * These can be later modified by the setLabels method. - * - * Generated from protobuf field map labels = 21; - * @return \Google\Protobuf\Internal\MapField - */ - public function getLabels() - { - return $this->labels; - } - - /** - * Labels to apply to this instance. - * These can be later modified by the setLabels method. - * - * Generated from protobuf field map labels = 21; - * @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; - } - - /** - * Custom metadata to apply to this instance. - * - * Generated from protobuf field map metadata = 22; - * @return \Google\Protobuf\Internal\MapField - */ - public function getMetadata() - { - return $this->metadata; - } - - /** - * Custom metadata to apply to this instance. - * - * Generated from protobuf field map metadata = 22; - * @param array|\Google\Protobuf\Internal\MapField $var - * @return $this - */ - public function setMetadata($var) - { - $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); - $this->metadata = $arr; - - return $this; - } - - /** - * Optional. The type of vNIC to be used on this interface. This may be gVNIC or - * VirtioNet. - * - * Generated from protobuf field .google.cloud.notebooks.v1beta1.Instance.NicType nic_type = 28 [(.google.api.field_behavior) = OPTIONAL]; - * @return int - */ - public function getNicType() - { - return $this->nic_type; - } - - /** - * Optional. The type of vNIC to be used on this interface. This may be gVNIC or - * VirtioNet. - * - * Generated from protobuf field .google.cloud.notebooks.v1beta1.Instance.NicType nic_type = 28 [(.google.api.field_behavior) = OPTIONAL]; - * @param int $var - * @return $this - */ - public function setNicType($var) - { - GPBUtil::checkEnum($var, \Google\Cloud\Notebooks\V1beta1\Instance\NicType::class); - $this->nic_type = $var; - - return $this; - } - - /** - * Optional. The optional reservation affinity. Setting this field will apply - * the specified [Zonal Compute - * Reservation](https://cloud.google.com/compute/docs/instances/reserving-zonal-resources) - * to this notebook instance. - * - * Generated from protobuf field .google.cloud.notebooks.v1beta1.ReservationAffinity reservation_affinity = 29 [(.google.api.field_behavior) = OPTIONAL]; - * @return \Google\Cloud\Notebooks\V1beta1\ReservationAffinity|null - */ - public function getReservationAffinity() - { - return $this->reservation_affinity; - } - - public function hasReservationAffinity() - { - return isset($this->reservation_affinity); - } - - public function clearReservationAffinity() - { - unset($this->reservation_affinity); - } - - /** - * Optional. The optional reservation affinity. Setting this field will apply - * the specified [Zonal Compute - * Reservation](https://cloud.google.com/compute/docs/instances/reserving-zonal-resources) - * to this notebook instance. - * - * Generated from protobuf field .google.cloud.notebooks.v1beta1.ReservationAffinity reservation_affinity = 29 [(.google.api.field_behavior) = OPTIONAL]; - * @param \Google\Cloud\Notebooks\V1beta1\ReservationAffinity $var - * @return $this - */ - public function setReservationAffinity($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Notebooks\V1beta1\ReservationAffinity::class); - $this->reservation_affinity = $var; - - return $this; - } - - /** - * Optional. Flag to enable ip forwarding or not, default false/off. - * https://cloud.google.com/vpc/docs/using-routes#canipforward - * - * Generated from protobuf field bool can_ip_forward = 31 [(.google.api.field_behavior) = OPTIONAL]; - * @return bool - */ - public function getCanIpForward() - { - return $this->can_ip_forward; - } - - /** - * Optional. Flag to enable ip forwarding or not, default false/off. - * https://cloud.google.com/vpc/docs/using-routes#canipforward - * - * Generated from protobuf field bool can_ip_forward = 31 [(.google.api.field_behavior) = OPTIONAL]; - * @param bool $var - * @return $this - */ - public function setCanIpForward($var) - { - GPBUtil::checkBool($var); - $this->can_ip_forward = $var; - - return $this; - } - - /** - * Output only. Instance creation time. - * - * Generated from protobuf field .google.protobuf.Timestamp create_time = 23 [(.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. Instance creation time. - * - * Generated from protobuf field .google.protobuf.Timestamp create_time = 23 [(.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; - } - - /** - * Output only. Instance update time. - * - * Generated from protobuf field .google.protobuf.Timestamp update_time = 24 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @return \Google\Protobuf\Timestamp|null - */ - public function getUpdateTime() - { - return $this->update_time; - } - - public function hasUpdateTime() - { - return isset($this->update_time); - } - - public function clearUpdateTime() - { - unset($this->update_time); - } - - /** - * Output only. Instance update time. - * - * Generated from protobuf field .google.protobuf.Timestamp update_time = 24 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @param \Google\Protobuf\Timestamp $var - * @return $this - */ - public function setUpdateTime($var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); - $this->update_time = $var; - - return $this; - } - - /** - * @return string - */ - public function getEnvironment() - { - return $this->whichOneof("environment"); - } - -} - diff --git a/Notebooks/src/V1beta1/Instance/AcceleratorConfig.php b/Notebooks/src/V1beta1/Instance/AcceleratorConfig.php deleted file mode 100644 index df3c2896eddf..000000000000 --- a/Notebooks/src/V1beta1/Instance/AcceleratorConfig.php +++ /dev/null @@ -1,105 +0,0 @@ -google.cloud.notebooks.v1beta1.Instance.AcceleratorConfig - */ -class AcceleratorConfig extends \Google\Protobuf\Internal\Message -{ - /** - * Type of this accelerator. - * - * Generated from protobuf field .google.cloud.notebooks.v1beta1.Instance.AcceleratorType type = 1; - */ - protected $type = 0; - /** - * Count of cores of this accelerator. - * - * Generated from protobuf field int64 core_count = 2; - */ - protected $core_count = 0; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type int $type - * Type of this accelerator. - * @type int|string $core_count - * Count of cores of this accelerator. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Notebooks\V1Beta1\Instance::initOnce(); - parent::__construct($data); - } - - /** - * Type of this accelerator. - * - * Generated from protobuf field .google.cloud.notebooks.v1beta1.Instance.AcceleratorType type = 1; - * @return int - */ - public function getType() - { - return $this->type; - } - - /** - * Type of this accelerator. - * - * Generated from protobuf field .google.cloud.notebooks.v1beta1.Instance.AcceleratorType type = 1; - * @param int $var - * @return $this - */ - public function setType($var) - { - GPBUtil::checkEnum($var, \Google\Cloud\Notebooks\V1beta1\Instance\AcceleratorType::class); - $this->type = $var; - - return $this; - } - - /** - * Count of cores of this accelerator. - * - * Generated from protobuf field int64 core_count = 2; - * @return int|string - */ - public function getCoreCount() - { - return $this->core_count; - } - - /** - * Count of cores of this accelerator. - * - * Generated from protobuf field int64 core_count = 2; - * @param int|string $var - * @return $this - */ - public function setCoreCount($var) - { - GPBUtil::checkInt64($var); - $this->core_count = $var; - - return $this; - } - -} - - diff --git a/Notebooks/src/V1beta1/Instance/AcceleratorType.php b/Notebooks/src/V1beta1/Instance/AcceleratorType.php deleted file mode 100644 index 8dce4c993506..000000000000 --- a/Notebooks/src/V1beta1/Instance/AcceleratorType.php +++ /dev/null @@ -1,119 +0,0 @@ -google.cloud.notebooks.v1beta1.Instance.AcceleratorType - */ -class AcceleratorType -{ - /** - * Accelerator type is not specified. - * - * Generated from protobuf enum ACCELERATOR_TYPE_UNSPECIFIED = 0; - */ - const ACCELERATOR_TYPE_UNSPECIFIED = 0; - /** - * Accelerator type is Nvidia Tesla K80. - * - * Generated from protobuf enum NVIDIA_TESLA_K80 = 1; - */ - const NVIDIA_TESLA_K80 = 1; - /** - * Accelerator type is Nvidia Tesla P100. - * - * Generated from protobuf enum NVIDIA_TESLA_P100 = 2; - */ - const NVIDIA_TESLA_P100 = 2; - /** - * Accelerator type is Nvidia Tesla V100. - * - * Generated from protobuf enum NVIDIA_TESLA_V100 = 3; - */ - const NVIDIA_TESLA_V100 = 3; - /** - * Accelerator type is Nvidia Tesla P4. - * - * Generated from protobuf enum NVIDIA_TESLA_P4 = 4; - */ - const NVIDIA_TESLA_P4 = 4; - /** - * Accelerator type is Nvidia Tesla T4. - * - * Generated from protobuf enum NVIDIA_TESLA_T4 = 5; - */ - const NVIDIA_TESLA_T4 = 5; - /** - * Accelerator type is NVIDIA Tesla T4 Virtual Workstations. - * - * Generated from protobuf enum NVIDIA_TESLA_T4_VWS = 8; - */ - const NVIDIA_TESLA_T4_VWS = 8; - /** - * Accelerator type is NVIDIA Tesla P100 Virtual Workstations. - * - * Generated from protobuf enum NVIDIA_TESLA_P100_VWS = 9; - */ - const NVIDIA_TESLA_P100_VWS = 9; - /** - * Accelerator type is NVIDIA Tesla P4 Virtual Workstations. - * - * Generated from protobuf enum NVIDIA_TESLA_P4_VWS = 10; - */ - const NVIDIA_TESLA_P4_VWS = 10; - /** - * (Coming soon) Accelerator type is TPU V2. - * - * Generated from protobuf enum TPU_V2 = 6; - */ - const TPU_V2 = 6; - /** - * (Coming soon) Accelerator type is TPU V3. - * - * Generated from protobuf enum TPU_V3 = 7; - */ - const TPU_V3 = 7; - - private static $valueToName = [ - self::ACCELERATOR_TYPE_UNSPECIFIED => 'ACCELERATOR_TYPE_UNSPECIFIED', - self::NVIDIA_TESLA_K80 => 'NVIDIA_TESLA_K80', - self::NVIDIA_TESLA_P100 => 'NVIDIA_TESLA_P100', - self::NVIDIA_TESLA_V100 => 'NVIDIA_TESLA_V100', - self::NVIDIA_TESLA_P4 => 'NVIDIA_TESLA_P4', - self::NVIDIA_TESLA_T4 => 'NVIDIA_TESLA_T4', - self::NVIDIA_TESLA_T4_VWS => 'NVIDIA_TESLA_T4_VWS', - self::NVIDIA_TESLA_P100_VWS => 'NVIDIA_TESLA_P100_VWS', - self::NVIDIA_TESLA_P4_VWS => 'NVIDIA_TESLA_P4_VWS', - self::TPU_V2 => 'TPU_V2', - self::TPU_V3 => 'TPU_V3', - ]; - - 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/Notebooks/src/V1beta1/Instance/DiskEncryption.php b/Notebooks/src/V1beta1/Instance/DiskEncryption.php deleted file mode 100644 index 04ddcca09cf8..000000000000 --- a/Notebooks/src/V1beta1/Instance/DiskEncryption.php +++ /dev/null @@ -1,62 +0,0 @@ -google.cloud.notebooks.v1beta1.Instance.DiskEncryption - */ -class DiskEncryption -{ - /** - * Disk encryption is not specified. - * - * Generated from protobuf enum DISK_ENCRYPTION_UNSPECIFIED = 0; - */ - const DISK_ENCRYPTION_UNSPECIFIED = 0; - /** - * Use Google managed encryption keys to encrypt the boot disk. - * - * Generated from protobuf enum GMEK = 1; - */ - const GMEK = 1; - /** - * Use customer managed encryption keys to encrypt the boot disk. - * - * Generated from protobuf enum CMEK = 2; - */ - const CMEK = 2; - - private static $valueToName = [ - self::DISK_ENCRYPTION_UNSPECIFIED => 'DISK_ENCRYPTION_UNSPECIFIED', - self::GMEK => 'GMEK', - self::CMEK => 'CMEK', - ]; - - 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/Notebooks/src/V1beta1/Instance/DiskType.php b/Notebooks/src/V1beta1/Instance/DiskType.php deleted file mode 100644 index 0ef9379ca49b..000000000000 --- a/Notebooks/src/V1beta1/Instance/DiskType.php +++ /dev/null @@ -1,69 +0,0 @@ -google.cloud.notebooks.v1beta1.Instance.DiskType - */ -class DiskType -{ - /** - * Disk type not set. - * - * Generated from protobuf enum DISK_TYPE_UNSPECIFIED = 0; - */ - const DISK_TYPE_UNSPECIFIED = 0; - /** - * Standard persistent disk type. - * - * Generated from protobuf enum PD_STANDARD = 1; - */ - const PD_STANDARD = 1; - /** - * SSD persistent disk type. - * - * Generated from protobuf enum PD_SSD = 2; - */ - const PD_SSD = 2; - /** - * Balanced persistent disk type. - * - * Generated from protobuf enum PD_BALANCED = 3; - */ - const PD_BALANCED = 3; - - private static $valueToName = [ - self::DISK_TYPE_UNSPECIFIED => 'DISK_TYPE_UNSPECIFIED', - self::PD_STANDARD => 'PD_STANDARD', - self::PD_SSD => 'PD_SSD', - self::PD_BALANCED => 'PD_BALANCED', - ]; - - 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/Notebooks/src/V1beta1/Instance/NicType.php b/Notebooks/src/V1beta1/Instance/NicType.php deleted file mode 100644 index 6cf58b7bf6ed..000000000000 --- a/Notebooks/src/V1beta1/Instance/NicType.php +++ /dev/null @@ -1,63 +0,0 @@ -google.cloud.notebooks.v1beta1.Instance.NicType - */ -class NicType -{ - /** - * No type specified. Default should be UNSPECIFIED_NIC_TYPE. - * - * Generated from protobuf enum UNSPECIFIED_NIC_TYPE = 0; - */ - const UNSPECIFIED_NIC_TYPE = 0; - /** - * VIRTIO. Default in Notebooks DLVM. - * - * Generated from protobuf enum VIRTIO_NET = 1; - */ - const VIRTIO_NET = 1; - /** - * GVNIC. Alternative to VIRTIO. - * https://github.com/GoogleCloudPlatform/compute-virtual-ethernet-linux - * - * Generated from protobuf enum GVNIC = 2; - */ - const GVNIC = 2; - - private static $valueToName = [ - self::UNSPECIFIED_NIC_TYPE => 'UNSPECIFIED_NIC_TYPE', - self::VIRTIO_NET => 'VIRTIO_NET', - self::GVNIC => 'GVNIC', - ]; - - 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/Notebooks/src/V1beta1/Instance/State.php b/Notebooks/src/V1beta1/Instance/State.php deleted file mode 100644 index d45d189e34aa..000000000000 --- a/Notebooks/src/V1beta1/Instance/State.php +++ /dev/null @@ -1,126 +0,0 @@ -google.cloud.notebooks.v1beta1.Instance.State - */ -class State -{ - /** - * State is not specified. - * - * Generated from protobuf enum STATE_UNSPECIFIED = 0; - */ - const STATE_UNSPECIFIED = 0; - /** - * The control logic is starting the instance. - * - * Generated from protobuf enum STARTING = 1; - */ - const STARTING = 1; - /** - * The control logic is installing required frameworks and registering the - * instance with notebook proxy - * - * Generated from protobuf enum PROVISIONING = 2; - */ - const PROVISIONING = 2; - /** - * The instance is running. - * - * Generated from protobuf enum ACTIVE = 3; - */ - const ACTIVE = 3; - /** - * The control logic is stopping the instance. - * - * Generated from protobuf enum STOPPING = 4; - */ - const STOPPING = 4; - /** - * The instance is stopped. - * - * Generated from protobuf enum STOPPED = 5; - */ - const STOPPED = 5; - /** - * The instance is deleted. - * - * Generated from protobuf enum DELETED = 6; - */ - const DELETED = 6; - /** - * The instance is upgrading. - * - * Generated from protobuf enum UPGRADING = 7; - */ - const UPGRADING = 7; - /** - * The instance is being created. - * - * Generated from protobuf enum INITIALIZING = 8; - */ - const INITIALIZING = 8; - /** - * The instance is getting registered. - * - * Generated from protobuf enum REGISTERING = 9; - */ - const REGISTERING = 9; - /** - * The instance is suspending. - * - * Generated from protobuf enum SUSPENDING = 10; - */ - const SUSPENDING = 10; - /** - * The instance is suspended. - * - * Generated from protobuf enum SUSPENDED = 11; - */ - const SUSPENDED = 11; - - private static $valueToName = [ - self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', - self::STARTING => 'STARTING', - self::PROVISIONING => 'PROVISIONING', - self::ACTIVE => 'ACTIVE', - self::STOPPING => 'STOPPING', - self::STOPPED => 'STOPPED', - self::DELETED => 'DELETED', - self::UPGRADING => 'UPGRADING', - self::INITIALIZING => 'INITIALIZING', - self::REGISTERING => 'REGISTERING', - self::SUSPENDING => 'SUSPENDING', - self::SUSPENDED => 'SUSPENDED', - ]; - - 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/Notebooks/src/V1beta1/IsInstanceUpgradeableRequest.php b/Notebooks/src/V1beta1/IsInstanceUpgradeableRequest.php deleted file mode 100644 index 33919eefdb3e..000000000000 --- a/Notebooks/src/V1beta1/IsInstanceUpgradeableRequest.php +++ /dev/null @@ -1,71 +0,0 @@ -google.cloud.notebooks.v1beta1.IsInstanceUpgradeableRequest - */ -class IsInstanceUpgradeableRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. Format: - * `projects/{project_id}/locations/{location}/instances/{instance_id}` - * - * Generated from protobuf field string notebook_instance = 1 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $notebook_instance = ''; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $notebook_instance - * Required. Format: - * `projects/{project_id}/locations/{location}/instances/{instance_id}` - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Notebooks\V1Beta1\Service::initOnce(); - parent::__construct($data); - } - - /** - * Required. Format: - * `projects/{project_id}/locations/{location}/instances/{instance_id}` - * - * Generated from protobuf field string notebook_instance = 1 [(.google.api.field_behavior) = REQUIRED]; - * @return string - */ - public function getNotebookInstance() - { - return $this->notebook_instance; - } - - /** - * Required. Format: - * `projects/{project_id}/locations/{location}/instances/{instance_id}` - * - * Generated from protobuf field string notebook_instance = 1 [(.google.api.field_behavior) = REQUIRED]; - * @param string $var - * @return $this - */ - public function setNotebookInstance($var) - { - GPBUtil::checkString($var, True); - $this->notebook_instance = $var; - - return $this; - } - -} - diff --git a/Notebooks/src/V1beta1/IsInstanceUpgradeableResponse.php b/Notebooks/src/V1beta1/IsInstanceUpgradeableResponse.php deleted file mode 100644 index d8440c11cfc4..000000000000 --- a/Notebooks/src/V1beta1/IsInstanceUpgradeableResponse.php +++ /dev/null @@ -1,181 +0,0 @@ -google.cloud.notebooks.v1beta1.IsInstanceUpgradeableResponse - */ -class IsInstanceUpgradeableResponse extends \Google\Protobuf\Internal\Message -{ - /** - * If an instance is upgradeable. - * - * Generated from protobuf field bool upgradeable = 1; - */ - protected $upgradeable = false; - /** - * The version this instance will be upgraded to if calling the upgrade - * endpoint. This field will only be populated if field upgradeable is true. - * - * Generated from protobuf field string upgrade_version = 2; - */ - protected $upgrade_version = ''; - /** - * Additional information about upgrade. - * - * Generated from protobuf field string upgrade_info = 3; - */ - protected $upgrade_info = ''; - /** - * The new image self link this instance will be upgraded to if calling the - * upgrade endpoint. This field will only be populated if field upgradeable - * is true. - * - * Generated from protobuf field string upgrade_image = 4; - */ - protected $upgrade_image = ''; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type bool $upgradeable - * If an instance is upgradeable. - * @type string $upgrade_version - * The version this instance will be upgraded to if calling the upgrade - * endpoint. This field will only be populated if field upgradeable is true. - * @type string $upgrade_info - * Additional information about upgrade. - * @type string $upgrade_image - * The new image self link this instance will be upgraded to if calling the - * upgrade endpoint. This field will only be populated if field upgradeable - * is true. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Notebooks\V1Beta1\Service::initOnce(); - parent::__construct($data); - } - - /** - * If an instance is upgradeable. - * - * Generated from protobuf field bool upgradeable = 1; - * @return bool - */ - public function getUpgradeable() - { - return $this->upgradeable; - } - - /** - * If an instance is upgradeable. - * - * Generated from protobuf field bool upgradeable = 1; - * @param bool $var - * @return $this - */ - public function setUpgradeable($var) - { - GPBUtil::checkBool($var); - $this->upgradeable = $var; - - return $this; - } - - /** - * The version this instance will be upgraded to if calling the upgrade - * endpoint. This field will only be populated if field upgradeable is true. - * - * Generated from protobuf field string upgrade_version = 2; - * @return string - */ - public function getUpgradeVersion() - { - return $this->upgrade_version; - } - - /** - * The version this instance will be upgraded to if calling the upgrade - * endpoint. This field will only be populated if field upgradeable is true. - * - * Generated from protobuf field string upgrade_version = 2; - * @param string $var - * @return $this - */ - public function setUpgradeVersion($var) - { - GPBUtil::checkString($var, True); - $this->upgrade_version = $var; - - return $this; - } - - /** - * Additional information about upgrade. - * - * Generated from protobuf field string upgrade_info = 3; - * @return string - */ - public function getUpgradeInfo() - { - return $this->upgrade_info; - } - - /** - * Additional information about upgrade. - * - * Generated from protobuf field string upgrade_info = 3; - * @param string $var - * @return $this - */ - public function setUpgradeInfo($var) - { - GPBUtil::checkString($var, True); - $this->upgrade_info = $var; - - return $this; - } - - /** - * The new image self link this instance will be upgraded to if calling the - * upgrade endpoint. This field will only be populated if field upgradeable - * is true. - * - * Generated from protobuf field string upgrade_image = 4; - * @return string - */ - public function getUpgradeImage() - { - return $this->upgrade_image; - } - - /** - * The new image self link this instance will be upgraded to if calling the - * upgrade endpoint. This field will only be populated if field upgradeable - * is true. - * - * Generated from protobuf field string upgrade_image = 4; - * @param string $var - * @return $this - */ - public function setUpgradeImage($var) - { - GPBUtil::checkString($var, True); - $this->upgrade_image = $var; - - return $this; - } - -} - diff --git a/Notebooks/src/V1beta1/ListEnvironmentsRequest.php b/Notebooks/src/V1beta1/ListEnvironmentsRequest.php deleted file mode 100644 index 9ef66d694c80..000000000000 --- a/Notebooks/src/V1beta1/ListEnvironmentsRequest.php +++ /dev/null @@ -1,139 +0,0 @@ -google.cloud.notebooks.v1beta1.ListEnvironmentsRequest - */ -class ListEnvironmentsRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. Format: `projects/{project_id}/locations/{location}` - * - * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $parent = ''; - /** - * Maximum return size of the list call. - * - * Generated from protobuf field int32 page_size = 2; - */ - protected $page_size = 0; - /** - * A previous returned page token that can be used to continue listing from - * the last result. - * - * Generated from protobuf field string page_token = 3; - */ - protected $page_token = ''; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $parent - * Required. Format: `projects/{project_id}/locations/{location}` - * @type int $page_size - * Maximum return size of the list call. - * @type string $page_token - * A previous returned page token that can be used to continue listing from - * the last result. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Notebooks\V1Beta1\Service::initOnce(); - parent::__construct($data); - } - - /** - * Required. Format: `projects/{project_id}/locations/{location}` - * - * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED]; - * @return string - */ - public function getParent() - { - return $this->parent; - } - - /** - * Required. Format: `projects/{project_id}/locations/{location}` - * - * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED]; - * @param string $var - * @return $this - */ - public function setParent($var) - { - GPBUtil::checkString($var, True); - $this->parent = $var; - - return $this; - } - - /** - * Maximum return size of the list call. - * - * Generated from protobuf field int32 page_size = 2; - * @return int - */ - public function getPageSize() - { - return $this->page_size; - } - - /** - * Maximum return size of the list call. - * - * 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; - } - - /** - * A previous returned page token that can be used to continue listing from - * the last result. - * - * Generated from protobuf field string page_token = 3; - * @return string - */ - public function getPageToken() - { - return $this->page_token; - } - - /** - * A previous returned page token that can be used to continue listing from - * the last result. - * - * 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/Notebooks/src/V1beta1/ListEnvironmentsResponse.php b/Notebooks/src/V1beta1/ListEnvironmentsResponse.php deleted file mode 100644 index 3c63a0c16e2b..000000000000 --- a/Notebooks/src/V1beta1/ListEnvironmentsResponse.php +++ /dev/null @@ -1,139 +0,0 @@ -google.cloud.notebooks.v1beta1.ListEnvironmentsResponse - */ -class ListEnvironmentsResponse extends \Google\Protobuf\Internal\Message -{ - /** - * A list of returned environments. - * - * Generated from protobuf field repeated .google.cloud.notebooks.v1beta1.Environment environments = 1; - */ - private $environments; - /** - * A page token that can be used to continue listing from the last result - * in the next list call. - * - * Generated from protobuf field string next_page_token = 2; - */ - protected $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\Notebooks\V1beta1\Environment>|\Google\Protobuf\Internal\RepeatedField $environments - * A list of returned environments. - * @type string $next_page_token - * A page token that can be used to continue listing from the last result - * in the next list call. - * @type array|\Google\Protobuf\Internal\RepeatedField $unreachable - * Locations that could not be reached. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Notebooks\V1Beta1\Service::initOnce(); - parent::__construct($data); - } - - /** - * A list of returned environments. - * - * Generated from protobuf field repeated .google.cloud.notebooks.v1beta1.Environment environments = 1; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getEnvironments() - { - return $this->environments; - } - - /** - * A list of returned environments. - * - * Generated from protobuf field repeated .google.cloud.notebooks.v1beta1.Environment environments = 1; - * @param array<\Google\Cloud\Notebooks\V1beta1\Environment>|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setEnvironments($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Notebooks\V1beta1\Environment::class); - $this->environments = $arr; - - return $this; - } - - /** - * A page token that can be used to continue listing from the last result - * in the next list call. - * - * Generated from protobuf field string next_page_token = 2; - * @return string - */ - public function getNextPageToken() - { - return $this->next_page_token; - } - - /** - * A page token that can be used to continue listing from the last result - * in the next list call. - * - * 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/Notebooks/src/V1beta1/ListInstancesRequest.php b/Notebooks/src/V1beta1/ListInstancesRequest.php deleted file mode 100644 index 9f91828f1e15..000000000000 --- a/Notebooks/src/V1beta1/ListInstancesRequest.php +++ /dev/null @@ -1,143 +0,0 @@ -google.cloud.notebooks.v1beta1.ListInstancesRequest - */ -class ListInstancesRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. Format: - * `parent=projects/{project_id}/locations/{location}` - * - * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $parent = ''; - /** - * Maximum return size of the list call. - * - * Generated from protobuf field int32 page_size = 2; - */ - protected $page_size = 0; - /** - * A previous returned page token that can be used to continue listing - * from the last result. - * - * Generated from protobuf field string page_token = 3; - */ - protected $page_token = ''; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $parent - * Required. Format: - * `parent=projects/{project_id}/locations/{location}` - * @type int $page_size - * Maximum return size of the list call. - * @type string $page_token - * A previous returned page token that can be used to continue listing - * from the last result. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Notebooks\V1Beta1\Service::initOnce(); - parent::__construct($data); - } - - /** - * Required. Format: - * `parent=projects/{project_id}/locations/{location}` - * - * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED]; - * @return string - */ - public function getParent() - { - return $this->parent; - } - - /** - * Required. Format: - * `parent=projects/{project_id}/locations/{location}` - * - * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED]; - * @param string $var - * @return $this - */ - public function setParent($var) - { - GPBUtil::checkString($var, True); - $this->parent = $var; - - return $this; - } - - /** - * Maximum return size of the list call. - * - * Generated from protobuf field int32 page_size = 2; - * @return int - */ - public function getPageSize() - { - return $this->page_size; - } - - /** - * Maximum return size of the list call. - * - * 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; - } - - /** - * A previous returned page token that can be used to continue listing - * from the last result. - * - * Generated from protobuf field string page_token = 3; - * @return string - */ - public function getPageToken() - { - return $this->page_token; - } - - /** - * A previous returned page token that can be used to continue listing - * from the last result. - * - * 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/Notebooks/src/V1beta1/ListInstancesResponse.php b/Notebooks/src/V1beta1/ListInstancesResponse.php deleted file mode 100644 index 73e1257e173e..000000000000 --- a/Notebooks/src/V1beta1/ListInstancesResponse.php +++ /dev/null @@ -1,147 +0,0 @@ -google.cloud.notebooks.v1beta1.ListInstancesResponse - */ -class ListInstancesResponse extends \Google\Protobuf\Internal\Message -{ - /** - * A list of returned instances. - * - * Generated from protobuf field repeated .google.cloud.notebooks.v1beta1.Instance instances = 1; - */ - private $instances; - /** - * Page token that can be used to continue listing from the last result in the - * next list call. - * - * Generated from protobuf field string next_page_token = 2; - */ - protected $next_page_token = ''; - /** - * Locations that could not be reached. For example, - * `['us-west1-a', 'us-central1-b']`. - * A ListInstancesResponse will only contain either instances or unreachables, - * - * 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\Notebooks\V1beta1\Instance>|\Google\Protobuf\Internal\RepeatedField $instances - * A list of returned instances. - * @type string $next_page_token - * Page token that can be used to continue listing from the last result in the - * next list call. - * @type array|\Google\Protobuf\Internal\RepeatedField $unreachable - * Locations that could not be reached. For example, - * `['us-west1-a', 'us-central1-b']`. - * A ListInstancesResponse will only contain either instances or unreachables, - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Notebooks\V1Beta1\Service::initOnce(); - parent::__construct($data); - } - - /** - * A list of returned instances. - * - * Generated from protobuf field repeated .google.cloud.notebooks.v1beta1.Instance instances = 1; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getInstances() - { - return $this->instances; - } - - /** - * A list of returned instances. - * - * Generated from protobuf field repeated .google.cloud.notebooks.v1beta1.Instance instances = 1; - * @param array<\Google\Cloud\Notebooks\V1beta1\Instance>|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setInstances($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Notebooks\V1beta1\Instance::class); - $this->instances = $arr; - - return $this; - } - - /** - * Page token that can be used to continue listing from the last result in the - * next list call. - * - * Generated from protobuf field string next_page_token = 2; - * @return string - */ - public function getNextPageToken() - { - return $this->next_page_token; - } - - /** - * Page token that can be used to continue listing from the last result in the - * next list call. - * - * 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. For example, - * `['us-west1-a', 'us-central1-b']`. - * A ListInstancesResponse will only contain either instances or unreachables, - * - * 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. For example, - * `['us-west1-a', 'us-central1-b']`. - * A ListInstancesResponse will only contain either instances or unreachables, - * - * 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/Notebooks/src/V1beta1/NotebookServiceClient.php b/Notebooks/src/V1beta1/NotebookServiceClient.php deleted file mode 100644 index 2df27dd910bb..000000000000 --- a/Notebooks/src/V1beta1/NotebookServiceClient.php +++ /dev/null @@ -1,36 +0,0 @@ -google.cloud.notebooks.v1beta1.OperationMetadata - */ -class OperationMetadata extends \Google\Protobuf\Internal\Message -{ - /** - * The time the operation was created. - * - * Generated from protobuf field .google.protobuf.Timestamp create_time = 1; - */ - protected $create_time = null; - /** - * The time the operation finished running. - * - * Generated from protobuf field .google.protobuf.Timestamp end_time = 2; - */ - protected $end_time = null; - /** - * Server-defined resource path for the target of the operation. - * - * Generated from protobuf field string target = 3; - */ - protected $target = ''; - /** - * Name of the verb executed by the operation. - * - * Generated from protobuf field string verb = 4; - */ - protected $verb = ''; - /** - * Human-readable status of the operation, if any. - * - * Generated from protobuf field string status_message = 5; - */ - protected $status_message = ''; - /** - * Identifies whether the user has requested cancellation - * of the operation. Operations that have successfully been cancelled - * have [Operation.error][] value with a - * [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to `Code.CANCELLED`. - * - * Generated from protobuf field bool requested_cancellation = 6; - */ - protected $requested_cancellation = false; - /** - * API version used to start the operation. - * - * Generated from protobuf field string api_version = 7; - */ - protected $api_version = ''; - /** - * API endpoint name of this operation. - * - * Generated from protobuf field string endpoint = 8; - */ - protected $endpoint = ''; - - /** - * 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 - * Server-defined resource path for the target of the operation. - * @type string $verb - * Name of the verb executed by the operation. - * @type string $status_message - * Human-readable status of the operation, if any. - * @type bool $requested_cancellation - * Identifies whether the user has requested cancellation - * of the operation. Operations that have successfully been cancelled - * have [Operation.error][] value with a - * [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to `Code.CANCELLED`. - * @type string $api_version - * API version used to start the operation. - * @type string $endpoint - * API endpoint name of this operation. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Notebooks\V1Beta1\Service::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; - } - - /** - * Server-defined resource path for the target of the operation. - * - * Generated from protobuf field string target = 3; - * @return string - */ - public function getTarget() - { - return $this->target; - } - - /** - * Server-defined resource path for the target of the operation. - * - * 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_message = 5; - * @return string - */ - public function getStatusMessage() - { - return $this->status_message; - } - - /** - * Human-readable status of the operation, if any. - * - * Generated from protobuf field string status_message = 5; - * @param string $var - * @return $this - */ - public function setStatusMessage($var) - { - GPBUtil::checkString($var, True); - $this->status_message = $var; - - return $this; - } - - /** - * Identifies whether the user has requested cancellation - * of the operation. Operations that have successfully been cancelled - * have [Operation.error][] value with a - * [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to `Code.CANCELLED`. - * - * Generated from protobuf field bool requested_cancellation = 6; - * @return bool - */ - public function getRequestedCancellation() - { - return $this->requested_cancellation; - } - - /** - * Identifies whether the user has requested cancellation - * of the operation. Operations that have successfully been cancelled - * have [Operation.error][] value with a - * [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to `Code.CANCELLED`. - * - * Generated from protobuf field bool requested_cancellation = 6; - * @param bool $var - * @return $this - */ - public function setRequestedCancellation($var) - { - GPBUtil::checkBool($var); - $this->requested_cancellation = $var; - - return $this; - } - - /** - * API version used to start the operation. - * - * Generated from protobuf field string api_version = 7; - * @return string - */ - public function getApiVersion() - { - return $this->api_version; - } - - /** - * API version used to start the operation. - * - * 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; - } - - /** - * API endpoint name of this operation. - * - * Generated from protobuf field string endpoint = 8; - * @return string - */ - public function getEndpoint() - { - return $this->endpoint; - } - - /** - * API endpoint name of this operation. - * - * Generated from protobuf field string endpoint = 8; - * @param string $var - * @return $this - */ - public function setEndpoint($var) - { - GPBUtil::checkString($var, True); - $this->endpoint = $var; - - return $this; - } - -} - diff --git a/Notebooks/src/V1beta1/RegisterInstanceRequest.php b/Notebooks/src/V1beta1/RegisterInstanceRequest.php deleted file mode 100644 index a454dc72ee8e..000000000000 --- a/Notebooks/src/V1beta1/RegisterInstanceRequest.php +++ /dev/null @@ -1,117 +0,0 @@ -google.cloud.notebooks.v1beta1.RegisterInstanceRequest - */ -class RegisterInstanceRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. Format: - * `parent=projects/{project_id}/locations/{location}` - * - * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $parent = ''; - /** - * Required. User defined unique ID of this instance. The `instance_id` must - * be 1 to 63 characters long and contain only lowercase letters, - * numeric characters, and dashes. The first character must be a lowercase - * letter and the last character cannot be a dash. - * - * Generated from protobuf field string instance_id = 2 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $instance_id = ''; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $parent - * Required. Format: - * `parent=projects/{project_id}/locations/{location}` - * @type string $instance_id - * Required. User defined unique ID of this instance. The `instance_id` must - * be 1 to 63 characters long and contain only lowercase letters, - * numeric characters, and dashes. The first character must be a lowercase - * letter and the last character cannot be a dash. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Notebooks\V1Beta1\Service::initOnce(); - parent::__construct($data); - } - - /** - * Required. Format: - * `parent=projects/{project_id}/locations/{location}` - * - * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED]; - * @return string - */ - public function getParent() - { - return $this->parent; - } - - /** - * Required. Format: - * `parent=projects/{project_id}/locations/{location}` - * - * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED]; - * @param string $var - * @return $this - */ - public function setParent($var) - { - GPBUtil::checkString($var, True); - $this->parent = $var; - - return $this; - } - - /** - * Required. User defined unique ID of this instance. The `instance_id` must - * be 1 to 63 characters long and contain only lowercase letters, - * numeric characters, and dashes. The first character must be a lowercase - * letter and the last character cannot be a dash. - * - * Generated from protobuf field string instance_id = 2 [(.google.api.field_behavior) = REQUIRED]; - * @return string - */ - public function getInstanceId() - { - return $this->instance_id; - } - - /** - * Required. User defined unique ID of this instance. The `instance_id` must - * be 1 to 63 characters long and contain only lowercase letters, - * numeric characters, and dashes. The first character must be a lowercase - * letter and the last character cannot be a dash. - * - * Generated from protobuf field string instance_id = 2 [(.google.api.field_behavior) = REQUIRED]; - * @param string $var - * @return $this - */ - public function setInstanceId($var) - { - GPBUtil::checkString($var, True); - $this->instance_id = $var; - - return $this; - } - -} - diff --git a/Notebooks/src/V1beta1/ReportInstanceInfoRequest.php b/Notebooks/src/V1beta1/ReportInstanceInfoRequest.php deleted file mode 100644 index 4f4c61acc8e8..000000000000 --- a/Notebooks/src/V1beta1/ReportInstanceInfoRequest.php +++ /dev/null @@ -1,147 +0,0 @@ -google.cloud.notebooks.v1beta1.ReportInstanceInfoRequest - */ -class ReportInstanceInfoRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. Format: - * `projects/{project_id}/locations/{location}/instances/{instance_id}` - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $name = ''; - /** - * Required. The VM hardware token for authenticating the VM. - * https://cloud.google.com/compute/docs/instances/verifying-instance-identity - * - * Generated from protobuf field string vm_id = 2 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $vm_id = ''; - /** - * The metadata reported to Notebooks API. This will be merged to the instance - * metadata store - * - * Generated from protobuf field map metadata = 3; - */ - private $metadata; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $name - * Required. Format: - * `projects/{project_id}/locations/{location}/instances/{instance_id}` - * @type string $vm_id - * Required. The VM hardware token for authenticating the VM. - * https://cloud.google.com/compute/docs/instances/verifying-instance-identity - * @type array|\Google\Protobuf\Internal\MapField $metadata - * The metadata reported to Notebooks API. This will be merged to the instance - * metadata store - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Notebooks\V1Beta1\Service::initOnce(); - parent::__construct($data); - } - - /** - * Required. Format: - * `projects/{project_id}/locations/{location}/instances/{instance_id}` - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * Required. Format: - * `projects/{project_id}/locations/{location}/instances/{instance_id}` - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; - * @param string $var - * @return $this - */ - public function setName($var) - { - GPBUtil::checkString($var, True); - $this->name = $var; - - return $this; - } - - /** - * Required. The VM hardware token for authenticating the VM. - * https://cloud.google.com/compute/docs/instances/verifying-instance-identity - * - * Generated from protobuf field string vm_id = 2 [(.google.api.field_behavior) = REQUIRED]; - * @return string - */ - public function getVmId() - { - return $this->vm_id; - } - - /** - * Required. The VM hardware token for authenticating the VM. - * https://cloud.google.com/compute/docs/instances/verifying-instance-identity - * - * Generated from protobuf field string vm_id = 2 [(.google.api.field_behavior) = REQUIRED]; - * @param string $var - * @return $this - */ - public function setVmId($var) - { - GPBUtil::checkString($var, True); - $this->vm_id = $var; - - return $this; - } - - /** - * The metadata reported to Notebooks API. This will be merged to the instance - * metadata store - * - * Generated from protobuf field map metadata = 3; - * @return \Google\Protobuf\Internal\MapField - */ - public function getMetadata() - { - return $this->metadata; - } - - /** - * The metadata reported to Notebooks API. This will be merged to the instance - * metadata store - * - * Generated from protobuf field map metadata = 3; - * @param array|\Google\Protobuf\Internal\MapField $var - * @return $this - */ - public function setMetadata($var) - { - $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); - $this->metadata = $arr; - - return $this; - } - -} - diff --git a/Notebooks/src/V1beta1/ReservationAffinity.php b/Notebooks/src/V1beta1/ReservationAffinity.php deleted file mode 100644 index cfd732cacd89..000000000000 --- a/Notebooks/src/V1beta1/ReservationAffinity.php +++ /dev/null @@ -1,135 +0,0 @@ -google.cloud.notebooks.v1beta1.ReservationAffinity - */ -class ReservationAffinity extends \Google\Protobuf\Internal\Message -{ - /** - * Optional. Type of reservation to consume - * - * Generated from protobuf field .google.cloud.notebooks.v1beta1.ReservationAffinity.Type consume_reservation_type = 1 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $consume_reservation_type = 0; - /** - * Optional. Corresponds to the label key of reservation resource. - * - * Generated from protobuf field string key = 2 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $key = ''; - /** - * Optional. Corresponds to the label values of reservation resource. - * - * Generated from protobuf field repeated string values = 3 [(.google.api.field_behavior) = OPTIONAL]; - */ - private $values; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type int $consume_reservation_type - * Optional. Type of reservation to consume - * @type string $key - * Optional. Corresponds to the label key of reservation resource. - * @type array|\Google\Protobuf\Internal\RepeatedField $values - * Optional. Corresponds to the label values of reservation resource. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Notebooks\V1Beta1\Instance::initOnce(); - parent::__construct($data); - } - - /** - * Optional. Type of reservation to consume - * - * Generated from protobuf field .google.cloud.notebooks.v1beta1.ReservationAffinity.Type consume_reservation_type = 1 [(.google.api.field_behavior) = OPTIONAL]; - * @return int - */ - public function getConsumeReservationType() - { - return $this->consume_reservation_type; - } - - /** - * Optional. Type of reservation to consume - * - * Generated from protobuf field .google.cloud.notebooks.v1beta1.ReservationAffinity.Type consume_reservation_type = 1 [(.google.api.field_behavior) = OPTIONAL]; - * @param int $var - * @return $this - */ - public function setConsumeReservationType($var) - { - GPBUtil::checkEnum($var, \Google\Cloud\Notebooks\V1beta1\ReservationAffinity\Type::class); - $this->consume_reservation_type = $var; - - return $this; - } - - /** - * Optional. Corresponds to the label key of reservation resource. - * - * Generated from protobuf field string key = 2 [(.google.api.field_behavior) = OPTIONAL]; - * @return string - */ - public function getKey() - { - return $this->key; - } - - /** - * Optional. Corresponds to the label key of reservation resource. - * - * Generated from protobuf field string key = 2 [(.google.api.field_behavior) = OPTIONAL]; - * @param string $var - * @return $this - */ - public function setKey($var) - { - GPBUtil::checkString($var, True); - $this->key = $var; - - return $this; - } - - /** - * Optional. Corresponds to the label values of reservation resource. - * - * Generated from protobuf field repeated string values = 3 [(.google.api.field_behavior) = OPTIONAL]; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getValues() - { - return $this->values; - } - - /** - * Optional. Corresponds to the label values of reservation resource. - * - * Generated from protobuf field repeated string values = 3 [(.google.api.field_behavior) = OPTIONAL]; - * @param array|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setValues($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); - $this->values = $arr; - - return $this; - } - -} - diff --git a/Notebooks/src/V1beta1/ReservationAffinity/Type.php b/Notebooks/src/V1beta1/ReservationAffinity/Type.php deleted file mode 100644 index 32f08b68affc..000000000000 --- a/Notebooks/src/V1beta1/ReservationAffinity/Type.php +++ /dev/null @@ -1,70 +0,0 @@ -google.cloud.notebooks.v1beta1.ReservationAffinity.Type - */ -class Type -{ - /** - * Default type. - * - * Generated from protobuf enum TYPE_UNSPECIFIED = 0; - */ - const TYPE_UNSPECIFIED = 0; - /** - * Do not consume from any allocated capacity. - * - * Generated from protobuf enum NO_RESERVATION = 1; - */ - const NO_RESERVATION = 1; - /** - * Consume any reservation available. - * - * Generated from protobuf enum ANY_RESERVATION = 2; - */ - const ANY_RESERVATION = 2; - /** - * Must consume from a specific reservation. Must specify key value fields - * for specifying the reservations. - * - * Generated from protobuf enum SPECIFIC_RESERVATION = 3; - */ - const SPECIFIC_RESERVATION = 3; - - private static $valueToName = [ - self::TYPE_UNSPECIFIED => 'TYPE_UNSPECIFIED', - self::NO_RESERVATION => 'NO_RESERVATION', - self::ANY_RESERVATION => 'ANY_RESERVATION', - self::SPECIFIC_RESERVATION => 'SPECIFIC_RESERVATION', - ]; - - 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/Notebooks/src/V1beta1/ResetInstanceRequest.php b/Notebooks/src/V1beta1/ResetInstanceRequest.php deleted file mode 100644 index 6d64e2aa505e..000000000000 --- a/Notebooks/src/V1beta1/ResetInstanceRequest.php +++ /dev/null @@ -1,71 +0,0 @@ -google.cloud.notebooks.v1beta1.ResetInstanceRequest - */ -class ResetInstanceRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. Format: - * `projects/{project_id}/locations/{location}/instances/{instance_id}` - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $name = ''; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $name - * Required. Format: - * `projects/{project_id}/locations/{location}/instances/{instance_id}` - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Notebooks\V1Beta1\Service::initOnce(); - parent::__construct($data); - } - - /** - * Required. Format: - * `projects/{project_id}/locations/{location}/instances/{instance_id}` - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * Required. Format: - * `projects/{project_id}/locations/{location}/instances/{instance_id}` - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; - * @param string $var - * @return $this - */ - public function setName($var) - { - GPBUtil::checkString($var, True); - $this->name = $var; - - return $this; - } - -} - diff --git a/Notebooks/src/V1beta1/SetInstanceAcceleratorRequest.php b/Notebooks/src/V1beta1/SetInstanceAcceleratorRequest.php deleted file mode 100644 index 101e2085ef98..000000000000 --- a/Notebooks/src/V1beta1/SetInstanceAcceleratorRequest.php +++ /dev/null @@ -1,151 +0,0 @@ -google.cloud.notebooks.v1beta1.SetInstanceAcceleratorRequest - */ -class SetInstanceAcceleratorRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. Format: - * `projects/{project_id}/locations/{location}/instances/{instance_id}` - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $name = ''; - /** - * Required. Type of this accelerator. - * - * Generated from protobuf field .google.cloud.notebooks.v1beta1.Instance.AcceleratorType type = 2 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $type = 0; - /** - * Required. Count of cores of this accelerator. Note that not all combinations - * of `type` and `core_count` are valid. Check [GPUs on - * Compute Engine](https://cloud.google.com/compute/docs/gpus/#gpus-list) to - * find a valid combination. TPUs are not supported. - * - * Generated from protobuf field int64 core_count = 3 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $core_count = 0; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $name - * Required. Format: - * `projects/{project_id}/locations/{location}/instances/{instance_id}` - * @type int $type - * Required. Type of this accelerator. - * @type int|string $core_count - * Required. Count of cores of this accelerator. Note that not all combinations - * of `type` and `core_count` are valid. Check [GPUs on - * Compute Engine](https://cloud.google.com/compute/docs/gpus/#gpus-list) to - * find a valid combination. TPUs are not supported. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Notebooks\V1Beta1\Service::initOnce(); - parent::__construct($data); - } - - /** - * Required. Format: - * `projects/{project_id}/locations/{location}/instances/{instance_id}` - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * Required. Format: - * `projects/{project_id}/locations/{location}/instances/{instance_id}` - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; - * @param string $var - * @return $this - */ - public function setName($var) - { - GPBUtil::checkString($var, True); - $this->name = $var; - - return $this; - } - - /** - * Required. Type of this accelerator. - * - * Generated from protobuf field .google.cloud.notebooks.v1beta1.Instance.AcceleratorType type = 2 [(.google.api.field_behavior) = REQUIRED]; - * @return int - */ - public function getType() - { - return $this->type; - } - - /** - * Required. Type of this accelerator. - * - * Generated from protobuf field .google.cloud.notebooks.v1beta1.Instance.AcceleratorType type = 2 [(.google.api.field_behavior) = REQUIRED]; - * @param int $var - * @return $this - */ - public function setType($var) - { - GPBUtil::checkEnum($var, \Google\Cloud\Notebooks\V1beta1\Instance\AcceleratorType::class); - $this->type = $var; - - return $this; - } - - /** - * Required. Count of cores of this accelerator. Note that not all combinations - * of `type` and `core_count` are valid. Check [GPUs on - * Compute Engine](https://cloud.google.com/compute/docs/gpus/#gpus-list) to - * find a valid combination. TPUs are not supported. - * - * Generated from protobuf field int64 core_count = 3 [(.google.api.field_behavior) = REQUIRED]; - * @return int|string - */ - public function getCoreCount() - { - return $this->core_count; - } - - /** - * Required. Count of cores of this accelerator. Note that not all combinations - * of `type` and `core_count` are valid. Check [GPUs on - * Compute Engine](https://cloud.google.com/compute/docs/gpus/#gpus-list) to - * find a valid combination. TPUs are not supported. - * - * Generated from protobuf field int64 core_count = 3 [(.google.api.field_behavior) = REQUIRED]; - * @param int|string $var - * @return $this - */ - public function setCoreCount($var) - { - GPBUtil::checkInt64($var); - $this->core_count = $var; - - return $this; - } - -} - diff --git a/Notebooks/src/V1beta1/SetInstanceLabelsRequest.php b/Notebooks/src/V1beta1/SetInstanceLabelsRequest.php deleted file mode 100644 index a403babf5c38..000000000000 --- a/Notebooks/src/V1beta1/SetInstanceLabelsRequest.php +++ /dev/null @@ -1,109 +0,0 @@ -google.cloud.notebooks.v1beta1.SetInstanceLabelsRequest - */ -class SetInstanceLabelsRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. Format: - * `projects/{project_id}/locations/{location}/instances/{instance_id}` - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $name = ''; - /** - * Labels to apply to this instance. - * These can be later modified by the setLabels method - * - * Generated from protobuf field map labels = 2; - */ - private $labels; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $name - * Required. Format: - * `projects/{project_id}/locations/{location}/instances/{instance_id}` - * @type array|\Google\Protobuf\Internal\MapField $labels - * Labels to apply to this instance. - * These can be later modified by the setLabels method - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Notebooks\V1Beta1\Service::initOnce(); - parent::__construct($data); - } - - /** - * Required. Format: - * `projects/{project_id}/locations/{location}/instances/{instance_id}` - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * Required. Format: - * `projects/{project_id}/locations/{location}/instances/{instance_id}` - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; - * @param string $var - * @return $this - */ - public function setName($var) - { - GPBUtil::checkString($var, True); - $this->name = $var; - - return $this; - } - - /** - * Labels to apply to this instance. - * These can be later modified by the setLabels method - * - * Generated from protobuf field map labels = 2; - * @return \Google\Protobuf\Internal\MapField - */ - public function getLabels() - { - return $this->labels; - } - - /** - * Labels to apply to this instance. - * These can be later modified by the setLabels method - * - * Generated from protobuf field map labels = 2; - * @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; - } - -} - diff --git a/Notebooks/src/V1beta1/SetInstanceMachineTypeRequest.php b/Notebooks/src/V1beta1/SetInstanceMachineTypeRequest.php deleted file mode 100644 index 6a1d0e9bbabb..000000000000 --- a/Notebooks/src/V1beta1/SetInstanceMachineTypeRequest.php +++ /dev/null @@ -1,109 +0,0 @@ -google.cloud.notebooks.v1beta1.SetInstanceMachineTypeRequest - */ -class SetInstanceMachineTypeRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. Format: - * `projects/{project_id}/locations/{location}/instances/{instance_id}` - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $name = ''; - /** - * Required. The [Compute Engine machine - * type](https://cloud.google.com/compute/docs/machine-types). - * - * Generated from protobuf field string machine_type = 2 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $machine_type = ''; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $name - * Required. Format: - * `projects/{project_id}/locations/{location}/instances/{instance_id}` - * @type string $machine_type - * Required. The [Compute Engine machine - * type](https://cloud.google.com/compute/docs/machine-types). - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Notebooks\V1Beta1\Service::initOnce(); - parent::__construct($data); - } - - /** - * Required. Format: - * `projects/{project_id}/locations/{location}/instances/{instance_id}` - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * Required. Format: - * `projects/{project_id}/locations/{location}/instances/{instance_id}` - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; - * @param string $var - * @return $this - */ - public function setName($var) - { - GPBUtil::checkString($var, True); - $this->name = $var; - - return $this; - } - - /** - * Required. The [Compute Engine machine - * type](https://cloud.google.com/compute/docs/machine-types). - * - * Generated from protobuf field string machine_type = 2 [(.google.api.field_behavior) = REQUIRED]; - * @return string - */ - public function getMachineType() - { - return $this->machine_type; - } - - /** - * Required. The [Compute Engine machine - * type](https://cloud.google.com/compute/docs/machine-types). - * - * Generated from protobuf field string machine_type = 2 [(.google.api.field_behavior) = REQUIRED]; - * @param string $var - * @return $this - */ - public function setMachineType($var) - { - GPBUtil::checkString($var, True); - $this->machine_type = $var; - - return $this; - } - -} - diff --git a/Notebooks/src/V1beta1/StartInstanceRequest.php b/Notebooks/src/V1beta1/StartInstanceRequest.php deleted file mode 100644 index fa27bf26014a..000000000000 --- a/Notebooks/src/V1beta1/StartInstanceRequest.php +++ /dev/null @@ -1,71 +0,0 @@ -google.cloud.notebooks.v1beta1.StartInstanceRequest - */ -class StartInstanceRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. Format: - * `projects/{project_id}/locations/{location}/instances/{instance_id}` - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $name = ''; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $name - * Required. Format: - * `projects/{project_id}/locations/{location}/instances/{instance_id}` - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Notebooks\V1Beta1\Service::initOnce(); - parent::__construct($data); - } - - /** - * Required. Format: - * `projects/{project_id}/locations/{location}/instances/{instance_id}` - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * Required. Format: - * `projects/{project_id}/locations/{location}/instances/{instance_id}` - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; - * @param string $var - * @return $this - */ - public function setName($var) - { - GPBUtil::checkString($var, True); - $this->name = $var; - - return $this; - } - -} - diff --git a/Notebooks/src/V1beta1/StopInstanceRequest.php b/Notebooks/src/V1beta1/StopInstanceRequest.php deleted file mode 100644 index f96d2fe215ca..000000000000 --- a/Notebooks/src/V1beta1/StopInstanceRequest.php +++ /dev/null @@ -1,71 +0,0 @@ -google.cloud.notebooks.v1beta1.StopInstanceRequest - */ -class StopInstanceRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. Format: - * `projects/{project_id}/locations/{location}/instances/{instance_id}` - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $name = ''; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $name - * Required. Format: - * `projects/{project_id}/locations/{location}/instances/{instance_id}` - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Notebooks\V1Beta1\Service::initOnce(); - parent::__construct($data); - } - - /** - * Required. Format: - * `projects/{project_id}/locations/{location}/instances/{instance_id}` - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * Required. Format: - * `projects/{project_id}/locations/{location}/instances/{instance_id}` - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; - * @param string $var - * @return $this - */ - public function setName($var) - { - GPBUtil::checkString($var, True); - $this->name = $var; - - return $this; - } - -} - diff --git a/Notebooks/src/V1beta1/UpgradeInstanceInternalRequest.php b/Notebooks/src/V1beta1/UpgradeInstanceInternalRequest.php deleted file mode 100644 index 9d9019b2ab44..000000000000 --- a/Notebooks/src/V1beta1/UpgradeInstanceInternalRequest.php +++ /dev/null @@ -1,109 +0,0 @@ -google.cloud.notebooks.v1beta1.UpgradeInstanceInternalRequest - */ -class UpgradeInstanceInternalRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. Format: - * `projects/{project_id}/locations/{location}/instances/{instance_id}` - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $name = ''; - /** - * Required. The VM hardware token for authenticating the VM. - * https://cloud.google.com/compute/docs/instances/verifying-instance-identity - * - * Generated from protobuf field string vm_id = 2 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $vm_id = ''; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $name - * Required. Format: - * `projects/{project_id}/locations/{location}/instances/{instance_id}` - * @type string $vm_id - * Required. The VM hardware token for authenticating the VM. - * https://cloud.google.com/compute/docs/instances/verifying-instance-identity - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Notebooks\V1Beta1\Service::initOnce(); - parent::__construct($data); - } - - /** - * Required. Format: - * `projects/{project_id}/locations/{location}/instances/{instance_id}` - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * Required. Format: - * `projects/{project_id}/locations/{location}/instances/{instance_id}` - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; - * @param string $var - * @return $this - */ - public function setName($var) - { - GPBUtil::checkString($var, True); - $this->name = $var; - - return $this; - } - - /** - * Required. The VM hardware token for authenticating the VM. - * https://cloud.google.com/compute/docs/instances/verifying-instance-identity - * - * Generated from protobuf field string vm_id = 2 [(.google.api.field_behavior) = REQUIRED]; - * @return string - */ - public function getVmId() - { - return $this->vm_id; - } - - /** - * Required. The VM hardware token for authenticating the VM. - * https://cloud.google.com/compute/docs/instances/verifying-instance-identity - * - * Generated from protobuf field string vm_id = 2 [(.google.api.field_behavior) = REQUIRED]; - * @param string $var - * @return $this - */ - public function setVmId($var) - { - GPBUtil::checkString($var, True); - $this->vm_id = $var; - - return $this; - } - -} - diff --git a/Notebooks/src/V1beta1/UpgradeInstanceRequest.php b/Notebooks/src/V1beta1/UpgradeInstanceRequest.php deleted file mode 100644 index 84ebc57768c3..000000000000 --- a/Notebooks/src/V1beta1/UpgradeInstanceRequest.php +++ /dev/null @@ -1,71 +0,0 @@ -google.cloud.notebooks.v1beta1.UpgradeInstanceRequest - */ -class UpgradeInstanceRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. Format: - * `projects/{project_id}/locations/{location}/instances/{instance_id}` - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $name = ''; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $name - * Required. Format: - * `projects/{project_id}/locations/{location}/instances/{instance_id}` - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Notebooks\V1Beta1\Service::initOnce(); - parent::__construct($data); - } - - /** - * Required. Format: - * `projects/{project_id}/locations/{location}/instances/{instance_id}` - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * Required. Format: - * `projects/{project_id}/locations/{location}/instances/{instance_id}` - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; - * @param string $var - * @return $this - */ - public function setName($var) - { - GPBUtil::checkString($var, True); - $this->name = $var; - - return $this; - } - -} - diff --git a/Notebooks/src/V1beta1/VmImage.php b/Notebooks/src/V1beta1/VmImage.php deleted file mode 100644 index 9ed82c98b117..000000000000 --- a/Notebooks/src/V1beta1/VmImage.php +++ /dev/null @@ -1,150 +0,0 @@ -google.cloud.notebooks.v1beta1.VmImage - */ -class VmImage extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The name of the Google Cloud project that this VM image belongs to. - * Format: `projects/{project_id}` - * - * Generated from protobuf field string project = 1 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $project = ''; - protected $image; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $project - * Required. The name of the Google Cloud project that this VM image belongs to. - * Format: `projects/{project_id}` - * @type string $image_name - * Use VM image name to find the image. - * @type string $image_family - * Use this VM image family to find the image; the newest image in this - * family will be used. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Notebooks\V1Beta1\Environment::initOnce(); - parent::__construct($data); - } - - /** - * Required. The name of the Google Cloud project that this VM image belongs to. - * Format: `projects/{project_id}` - * - * Generated from protobuf field string project = 1 [(.google.api.field_behavior) = REQUIRED]; - * @return string - */ - public function getProject() - { - return $this->project; - } - - /** - * Required. The name of the Google Cloud project that this VM image belongs to. - * Format: `projects/{project_id}` - * - * Generated from protobuf field string project = 1 [(.google.api.field_behavior) = REQUIRED]; - * @param string $var - * @return $this - */ - public function setProject($var) - { - GPBUtil::checkString($var, True); - $this->project = $var; - - return $this; - } - - /** - * Use VM image name to find the image. - * - * Generated from protobuf field string image_name = 2; - * @return string - */ - public function getImageName() - { - return $this->readOneof(2); - } - - public function hasImageName() - { - return $this->hasOneof(2); - } - - /** - * Use VM image name to find the image. - * - * Generated from protobuf field string image_name = 2; - * @param string $var - * @return $this - */ - public function setImageName($var) - { - GPBUtil::checkString($var, True); - $this->writeOneof(2, $var); - - return $this; - } - - /** - * Use this VM image family to find the image; the newest image in this - * family will be used. - * - * Generated from protobuf field string image_family = 3; - * @return string - */ - public function getImageFamily() - { - return $this->readOneof(3); - } - - public function hasImageFamily() - { - return $this->hasOneof(3); - } - - /** - * Use this VM image family to find the image; the newest image in this - * family will be used. - * - * Generated from protobuf field string image_family = 3; - * @param string $var - * @return $this - */ - public function setImageFamily($var) - { - GPBUtil::checkString($var, True); - $this->writeOneof(3, $var); - - return $this; - } - - /** - * @return string - */ - public function getImage() - { - return $this->whichOneof("image"); - } - -} - diff --git a/Notebooks/src/V1beta1/gapic_metadata.json b/Notebooks/src/V1beta1/gapic_metadata.json deleted file mode 100644 index 48cfb690c3d7..000000000000 --- a/Notebooks/src/V1beta1/gapic_metadata.json +++ /dev/null @@ -1,138 +0,0 @@ -{ - "schema": "1.0", - "comment": "This file maps proto services\/RPCs to the corresponding library clients\/methods", - "language": "php", - "protoPackage": "google.cloud.notebooks.v1beta1", - "libraryPackage": "Google\\Cloud\\Notebooks\\V1beta1", - "services": { - "NotebookService": { - "clients": { - "grpc": { - "libraryClient": "NotebookServiceGapicClient", - "rpcs": { - "CreateEnvironment": { - "methods": [ - "createEnvironment" - ] - }, - "CreateInstance": { - "methods": [ - "createInstance" - ] - }, - "DeleteEnvironment": { - "methods": [ - "deleteEnvironment" - ] - }, - "DeleteInstance": { - "methods": [ - "deleteInstance" - ] - }, - "GetEnvironment": { - "methods": [ - "getEnvironment" - ] - }, - "GetInstance": { - "methods": [ - "getInstance" - ] - }, - "IsInstanceUpgradeable": { - "methods": [ - "isInstanceUpgradeable" - ] - }, - "ListEnvironments": { - "methods": [ - "listEnvironments" - ] - }, - "ListInstances": { - "methods": [ - "listInstances" - ] - }, - "RegisterInstance": { - "methods": [ - "registerInstance" - ] - }, - "ReportInstanceInfo": { - "methods": [ - "reportInstanceInfo" - ] - }, - "ResetInstance": { - "methods": [ - "resetInstance" - ] - }, - "SetInstanceAccelerator": { - "methods": [ - "setInstanceAccelerator" - ] - }, - "SetInstanceLabels": { - "methods": [ - "setInstanceLabels" - ] - }, - "SetInstanceMachineType": { - "methods": [ - "setInstanceMachineType" - ] - }, - "StartInstance": { - "methods": [ - "startInstance" - ] - }, - "StopInstance": { - "methods": [ - "stopInstance" - ] - }, - "UpgradeInstance": { - "methods": [ - "upgradeInstance" - ] - }, - "UpgradeInstanceInternal": { - "methods": [ - "upgradeInstanceInternal" - ] - }, - "GetLocation": { - "methods": [ - "getLocation" - ] - }, - "ListLocations": { - "methods": [ - "listLocations" - ] - }, - "GetIamPolicy": { - "methods": [ - "getIamPolicy" - ] - }, - "SetIamPolicy": { - "methods": [ - "setIamPolicy" - ] - }, - "TestIamPermissions": { - "methods": [ - "testIamPermissions" - ] - } - } - } - } - } - } -} \ No newline at end of file diff --git a/Notebooks/src/V1beta1/resources/notebook_service_client_config.json b/Notebooks/src/V1beta1/resources/notebook_service_client_config.json deleted file mode 100644 index 052fa58c29b6..000000000000 --- a/Notebooks/src/V1beta1/resources/notebook_service_client_config.json +++ /dev/null @@ -1,164 +0,0 @@ -{ - "interfaces": { - "google.cloud.notebooks.v1beta1.NotebookService": { - "retry_codes": { - "no_retry_codes": [], - "retry_policy_1_codes": [ - "UNAVAILABLE" - ], - "no_retry_1_codes": [] - }, - "retry_params": { - "no_retry_params": { - "initial_retry_delay_millis": 0, - "retry_delay_multiplier": 0.0, - "max_retry_delay_millis": 0, - "initial_rpc_timeout_millis": 0, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 0, - "total_timeout_millis": 0 - }, - "retry_policy_1_params": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 60000 - }, - "no_retry_1_params": { - "initial_retry_delay_millis": 0, - "retry_delay_multiplier": 0.0, - "max_retry_delay_millis": 0, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 60000 - } - }, - "methods": { - "CreateEnvironment": { - "timeout_millis": 60000, - "retry_codes_name": "no_retry_1_codes", - "retry_params_name": "no_retry_1_params" - }, - "CreateInstance": { - "timeout_millis": 60000, - "retry_codes_name": "no_retry_1_codes", - "retry_params_name": "no_retry_1_params" - }, - "DeleteEnvironment": { - "timeout_millis": 60000, - "retry_codes_name": "no_retry_1_codes", - "retry_params_name": "no_retry_1_params" - }, - "DeleteInstance": { - "timeout_millis": 60000, - "retry_codes_name": "no_retry_1_codes", - "retry_params_name": "no_retry_1_params" - }, - "GetEnvironment": { - "timeout_millis": 60000, - "retry_codes_name": "no_retry_1_codes", - "retry_params_name": "no_retry_1_params" - }, - "GetInstance": { - "timeout_millis": 60000, - "retry_codes_name": "no_retry_1_codes", - "retry_params_name": "no_retry_1_params" - }, - "IsInstanceUpgradeable": { - "timeout_millis": 60000, - "retry_codes_name": "no_retry_1_codes", - "retry_params_name": "no_retry_1_params" - }, - "ListEnvironments": { - "timeout_millis": 60000, - "retry_codes_name": "no_retry_1_codes", - "retry_params_name": "no_retry_1_params" - }, - "ListInstances": { - "timeout_millis": 60000, - "retry_codes_name": "no_retry_1_codes", - "retry_params_name": "no_retry_1_params" - }, - "RegisterInstance": { - "timeout_millis": 60000, - "retry_codes_name": "no_retry_1_codes", - "retry_params_name": "no_retry_1_params" - }, - "ReportInstanceInfo": { - "timeout_millis": 60000, - "retry_codes_name": "no_retry_1_codes", - "retry_params_name": "no_retry_1_params" - }, - "ResetInstance": { - "timeout_millis": 60000, - "retry_codes_name": "no_retry_1_codes", - "retry_params_name": "no_retry_1_params" - }, - "SetInstanceAccelerator": { - "timeout_millis": 60000, - "retry_codes_name": "no_retry_1_codes", - "retry_params_name": "no_retry_1_params" - }, - "SetInstanceLabels": { - "timeout_millis": 60000, - "retry_codes_name": "no_retry_1_codes", - "retry_params_name": "no_retry_1_params" - }, - "SetInstanceMachineType": { - "timeout_millis": 60000, - "retry_codes_name": "no_retry_1_codes", - "retry_params_name": "no_retry_1_params" - }, - "StartInstance": { - "timeout_millis": 60000, - "retry_codes_name": "no_retry_1_codes", - "retry_params_name": "no_retry_1_params" - }, - "StopInstance": { - "timeout_millis": 60000, - "retry_codes_name": "no_retry_1_codes", - "retry_params_name": "no_retry_1_params" - }, - "UpgradeInstance": { - "timeout_millis": 60000, - "retry_codes_name": "no_retry_1_codes", - "retry_params_name": "no_retry_1_params" - }, - "UpgradeInstanceInternal": { - "timeout_millis": 60000, - "retry_codes_name": "no_retry_1_codes", - "retry_params_name": "no_retry_1_params" - }, - "GetLocation": { - "timeout_millis": 60000, - "retry_codes_name": "retry_policy_1_codes", - "retry_params_name": "retry_policy_1_params" - }, - "ListLocations": { - "timeout_millis": 60000, - "retry_codes_name": "retry_policy_1_codes", - "retry_params_name": "retry_policy_1_params" - }, - "GetIamPolicy": { - "timeout_millis": 60000, - "retry_codes_name": "retry_policy_1_codes", - "retry_params_name": "retry_policy_1_params" - }, - "SetIamPolicy": { - "timeout_millis": 60000, - "retry_codes_name": "retry_policy_1_codes", - "retry_params_name": "retry_policy_1_params" - }, - "TestIamPermissions": { - "timeout_millis": 60000, - "retry_codes_name": "retry_policy_1_codes", - "retry_params_name": "retry_policy_1_params" - } - } - } - } -} diff --git a/Notebooks/src/V1beta1/resources/notebook_service_descriptor_config.php b/Notebooks/src/V1beta1/resources/notebook_service_descriptor_config.php deleted file mode 100644 index 33ecc9d79fec..000000000000 --- a/Notebooks/src/V1beta1/resources/notebook_service_descriptor_config.php +++ /dev/null @@ -1,211 +0,0 @@ - [ - 'google.cloud.notebooks.v1beta1.NotebookService' => [ - 'CreateEnvironment' => [ - 'longRunning' => [ - 'operationReturnType' => '\Google\Cloud\Notebooks\V1beta1\Environment', - 'metadataReturnType' => '\Google\Cloud\Notebooks\V1beta1\OperationMetadata', - 'initialPollDelayMillis' => '500', - 'pollDelayMultiplier' => '1.5', - 'maxPollDelayMillis' => '5000', - 'totalPollTimeoutMillis' => '300000', - ], - ], - 'CreateInstance' => [ - 'longRunning' => [ - 'operationReturnType' => '\Google\Cloud\Notebooks\V1beta1\Instance', - 'metadataReturnType' => '\Google\Cloud\Notebooks\V1beta1\OperationMetadata', - 'initialPollDelayMillis' => '500', - 'pollDelayMultiplier' => '1.5', - 'maxPollDelayMillis' => '5000', - 'totalPollTimeoutMillis' => '300000', - ], - ], - 'DeleteEnvironment' => [ - 'longRunning' => [ - 'operationReturnType' => '\Google\Protobuf\GPBEmpty', - 'metadataReturnType' => '\Google\Cloud\Notebooks\V1beta1\OperationMetadata', - 'initialPollDelayMillis' => '500', - 'pollDelayMultiplier' => '1.5', - 'maxPollDelayMillis' => '5000', - 'totalPollTimeoutMillis' => '300000', - ], - ], - 'DeleteInstance' => [ - 'longRunning' => [ - 'operationReturnType' => '\Google\Protobuf\GPBEmpty', - 'metadataReturnType' => '\Google\Cloud\Notebooks\V1beta1\OperationMetadata', - 'initialPollDelayMillis' => '500', - 'pollDelayMultiplier' => '1.5', - 'maxPollDelayMillis' => '5000', - 'totalPollTimeoutMillis' => '300000', - ], - ], - 'RegisterInstance' => [ - 'longRunning' => [ - 'operationReturnType' => '\Google\Cloud\Notebooks\V1beta1\Instance', - 'metadataReturnType' => '\Google\Cloud\Notebooks\V1beta1\OperationMetadata', - 'initialPollDelayMillis' => '500', - 'pollDelayMultiplier' => '1.5', - 'maxPollDelayMillis' => '5000', - 'totalPollTimeoutMillis' => '300000', - ], - ], - 'ReportInstanceInfo' => [ - 'longRunning' => [ - 'operationReturnType' => '\Google\Cloud\Notebooks\V1beta1\Instance', - 'metadataReturnType' => '\Google\Cloud\Notebooks\V1beta1\OperationMetadata', - 'initialPollDelayMillis' => '500', - 'pollDelayMultiplier' => '1.5', - 'maxPollDelayMillis' => '5000', - 'totalPollTimeoutMillis' => '300000', - ], - ], - 'ResetInstance' => [ - 'longRunning' => [ - 'operationReturnType' => '\Google\Cloud\Notebooks\V1beta1\Instance', - 'metadataReturnType' => '\Google\Cloud\Notebooks\V1beta1\OperationMetadata', - 'initialPollDelayMillis' => '500', - 'pollDelayMultiplier' => '1.5', - 'maxPollDelayMillis' => '5000', - 'totalPollTimeoutMillis' => '300000', - ], - ], - 'SetInstanceAccelerator' => [ - 'longRunning' => [ - 'operationReturnType' => '\Google\Cloud\Notebooks\V1beta1\Instance', - 'metadataReturnType' => '\Google\Cloud\Notebooks\V1beta1\OperationMetadata', - 'initialPollDelayMillis' => '500', - 'pollDelayMultiplier' => '1.5', - 'maxPollDelayMillis' => '5000', - 'totalPollTimeoutMillis' => '300000', - ], - ], - 'SetInstanceLabels' => [ - 'longRunning' => [ - 'operationReturnType' => '\Google\Cloud\Notebooks\V1beta1\Instance', - 'metadataReturnType' => '\Google\Cloud\Notebooks\V1beta1\OperationMetadata', - 'initialPollDelayMillis' => '500', - 'pollDelayMultiplier' => '1.5', - 'maxPollDelayMillis' => '5000', - 'totalPollTimeoutMillis' => '300000', - ], - ], - 'SetInstanceMachineType' => [ - 'longRunning' => [ - 'operationReturnType' => '\Google\Cloud\Notebooks\V1beta1\Instance', - 'metadataReturnType' => '\Google\Cloud\Notebooks\V1beta1\OperationMetadata', - 'initialPollDelayMillis' => '500', - 'pollDelayMultiplier' => '1.5', - 'maxPollDelayMillis' => '5000', - 'totalPollTimeoutMillis' => '300000', - ], - ], - 'StartInstance' => [ - 'longRunning' => [ - 'operationReturnType' => '\Google\Cloud\Notebooks\V1beta1\Instance', - 'metadataReturnType' => '\Google\Cloud\Notebooks\V1beta1\OperationMetadata', - 'initialPollDelayMillis' => '500', - 'pollDelayMultiplier' => '1.5', - 'maxPollDelayMillis' => '5000', - 'totalPollTimeoutMillis' => '300000', - ], - ], - 'StopInstance' => [ - 'longRunning' => [ - 'operationReturnType' => '\Google\Cloud\Notebooks\V1beta1\Instance', - 'metadataReturnType' => '\Google\Cloud\Notebooks\V1beta1\OperationMetadata', - 'initialPollDelayMillis' => '500', - 'pollDelayMultiplier' => '1.5', - 'maxPollDelayMillis' => '5000', - 'totalPollTimeoutMillis' => '300000', - ], - ], - 'UpgradeInstance' => [ - 'longRunning' => [ - 'operationReturnType' => '\Google\Cloud\Notebooks\V1beta1\Instance', - 'metadataReturnType' => '\Google\Cloud\Notebooks\V1beta1\OperationMetadata', - 'initialPollDelayMillis' => '500', - 'pollDelayMultiplier' => '1.5', - 'maxPollDelayMillis' => '5000', - 'totalPollTimeoutMillis' => '300000', - ], - ], - 'UpgradeInstanceInternal' => [ - 'longRunning' => [ - 'operationReturnType' => '\Google\Cloud\Notebooks\V1beta1\Instance', - 'metadataReturnType' => '\Google\Cloud\Notebooks\V1beta1\OperationMetadata', - 'initialPollDelayMillis' => '500', - 'pollDelayMultiplier' => '1.5', - 'maxPollDelayMillis' => '5000', - 'totalPollTimeoutMillis' => '300000', - ], - ], - 'ListEnvironments' => [ - 'pageStreaming' => [ - 'requestPageTokenGetMethod' => 'getPageToken', - 'requestPageTokenSetMethod' => 'setPageToken', - 'requestPageSizeGetMethod' => 'getPageSize', - 'requestPageSizeSetMethod' => 'setPageSize', - 'responsePageTokenGetMethod' => 'getNextPageToken', - 'resourcesGetMethod' => 'getEnvironments', - ], - ], - 'ListInstances' => [ - 'pageStreaming' => [ - 'requestPageTokenGetMethod' => 'getPageToken', - 'requestPageTokenSetMethod' => 'setPageToken', - 'requestPageSizeGetMethod' => 'getPageSize', - 'requestPageSizeSetMethod' => 'setPageSize', - 'responsePageTokenGetMethod' => 'getNextPageToken', - 'resourcesGetMethod' => 'getInstances', - ], - ], - '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', - ], - 'GetIamPolicy' => [ - 'interfaceOverride' => 'google.iam.v1.IAMPolicy', - ], - 'SetIamPolicy' => [ - 'interfaceOverride' => 'google.iam.v1.IAMPolicy', - ], - 'TestIamPermissions' => [ - 'interfaceOverride' => 'google.iam.v1.IAMPolicy', - ], - ], - ], -]; diff --git a/Notebooks/src/V1beta1/resources/notebook_service_rest_client_config.php b/Notebooks/src/V1beta1/resources/notebook_service_rest_client_config.php deleted file mode 100644 index 8cfe9f1fc5ab..000000000000 --- a/Notebooks/src/V1beta1/resources/notebook_service_rest_client_config.php +++ /dev/null @@ -1,364 +0,0 @@ - [ - 'google.cloud.location.Locations' => [ - 'GetLocation' => [ - 'method' => 'get', - 'uriTemplate' => '/v1beta1/{name=projects/*/locations/*}', - 'placeholders' => [ - 'name' => [ - 'getters' => [ - 'getName', - ], - ], - ], - ], - 'ListLocations' => [ - 'method' => 'get', - 'uriTemplate' => '/v1beta1/{name=projects/*}/locations', - 'placeholders' => [ - 'name' => [ - 'getters' => [ - 'getName', - ], - ], - ], - ], - ], - 'google.cloud.notebooks.v1beta1.NotebookService' => [ - 'CreateEnvironment' => [ - 'method' => 'post', - 'uriTemplate' => '/v1beta1/{parent=projects/*/locations/*}/environments', - 'body' => 'environment', - 'placeholders' => [ - 'parent' => [ - 'getters' => [ - 'getParent', - ], - ], - ], - 'queryParams' => [ - 'environment_id', - ], - ], - 'CreateInstance' => [ - 'method' => 'post', - 'uriTemplate' => '/v1beta1/{parent=projects/*/locations/*}/instances', - 'body' => 'instance', - 'placeholders' => [ - 'parent' => [ - 'getters' => [ - 'getParent', - ], - ], - ], - 'queryParams' => [ - 'instance_id', - ], - ], - 'DeleteEnvironment' => [ - 'method' => 'delete', - 'uriTemplate' => '/v1beta1/{name=projects/*/locations/*/environments/*}', - 'placeholders' => [ - 'name' => [ - 'getters' => [ - 'getName', - ], - ], - ], - ], - 'DeleteInstance' => [ - 'method' => 'delete', - 'uriTemplate' => '/v1beta1/{name=projects/*/locations/*/instances/*}', - 'placeholders' => [ - 'name' => [ - 'getters' => [ - 'getName', - ], - ], - ], - ], - 'GetEnvironment' => [ - 'method' => 'get', - 'uriTemplate' => '/v1beta1/{name=projects/*/locations/*/environments/*}', - 'placeholders' => [ - 'name' => [ - 'getters' => [ - 'getName', - ], - ], - ], - ], - 'GetInstance' => [ - 'method' => 'get', - 'uriTemplate' => '/v1beta1/{name=projects/*/locations/*/instances/*}', - 'placeholders' => [ - 'name' => [ - 'getters' => [ - 'getName', - ], - ], - ], - ], - 'IsInstanceUpgradeable' => [ - 'method' => 'get', - 'uriTemplate' => '/v1beta1/{notebook_instance=projects/*/locations/*/instances/*}:isUpgradeable', - 'placeholders' => [ - 'notebook_instance' => [ - 'getters' => [ - 'getNotebookInstance', - ], - ], - ], - ], - 'ListEnvironments' => [ - 'method' => 'get', - 'uriTemplate' => '/v1beta1/{parent=projects/*/locations/*}/environments', - 'placeholders' => [ - 'parent' => [ - 'getters' => [ - 'getParent', - ], - ], - ], - ], - 'ListInstances' => [ - 'method' => 'get', - 'uriTemplate' => '/v1beta1/{parent=projects/*/locations/*}/instances', - 'placeholders' => [ - 'parent' => [ - 'getters' => [ - 'getParent', - ], - ], - ], - ], - 'RegisterInstance' => [ - 'method' => 'post', - 'uriTemplate' => '/v1beta1/{parent=projects/*/locations/*}/instances:register', - 'body' => '*', - 'placeholders' => [ - 'parent' => [ - 'getters' => [ - 'getParent', - ], - ], - ], - ], - 'ReportInstanceInfo' => [ - 'method' => 'post', - 'uriTemplate' => '/v1beta1/{name=projects/*/locations/*/instances/*}:report', - 'body' => '*', - 'placeholders' => [ - 'name' => [ - 'getters' => [ - 'getName', - ], - ], - ], - ], - 'ResetInstance' => [ - 'method' => 'post', - 'uriTemplate' => '/v1beta1/{name=projects/*/locations/*/instances/*}:reset', - 'body' => '*', - 'placeholders' => [ - 'name' => [ - 'getters' => [ - 'getName', - ], - ], - ], - ], - 'SetInstanceAccelerator' => [ - 'method' => 'patch', - 'uriTemplate' => '/v1beta1/{name=projects/*/locations/*/instances/*}:setAccelerator', - 'body' => '*', - 'placeholders' => [ - 'name' => [ - 'getters' => [ - 'getName', - ], - ], - ], - ], - 'SetInstanceLabels' => [ - 'method' => 'patch', - 'uriTemplate' => '/v1beta1/{name=projects/*/locations/*/instances/*}:setLabels', - 'body' => '*', - 'placeholders' => [ - 'name' => [ - 'getters' => [ - 'getName', - ], - ], - ], - ], - 'SetInstanceMachineType' => [ - 'method' => 'patch', - 'uriTemplate' => '/v1beta1/{name=projects/*/locations/*/instances/*}:setMachineType', - 'body' => '*', - 'placeholders' => [ - 'name' => [ - 'getters' => [ - 'getName', - ], - ], - ], - ], - 'StartInstance' => [ - 'method' => 'post', - 'uriTemplate' => '/v1beta1/{name=projects/*/locations/*/instances/*}:start', - 'body' => '*', - 'placeholders' => [ - 'name' => [ - 'getters' => [ - 'getName', - ], - ], - ], - ], - 'StopInstance' => [ - 'method' => 'post', - 'uriTemplate' => '/v1beta1/{name=projects/*/locations/*/instances/*}:stop', - 'body' => '*', - 'placeholders' => [ - 'name' => [ - 'getters' => [ - 'getName', - ], - ], - ], - ], - 'UpgradeInstance' => [ - 'method' => 'post', - 'uriTemplate' => '/v1beta1/{name=projects/*/locations/*/instances/*}:upgrade', - 'body' => '*', - 'placeholders' => [ - 'name' => [ - 'getters' => [ - 'getName', - ], - ], - ], - ], - 'UpgradeInstanceInternal' => [ - 'method' => 'post', - 'uriTemplate' => '/v1beta1/{name=projects/*/locations/*/instances/*}:upgradeInternal', - 'body' => '*', - 'placeholders' => [ - 'name' => [ - 'getters' => [ - 'getName', - ], - ], - ], - ], - ], - 'google.iam.v1.IAMPolicy' => [ - 'GetIamPolicy' => [ - 'method' => 'get', - 'uriTemplate' => '/v1beta1/{resource=projects/*/locations/*/instances/*}:getIamPolicy', - 'placeholders' => [ - 'resource' => [ - 'getters' => [ - 'getResource', - ], - ], - ], - ], - 'SetIamPolicy' => [ - 'method' => 'post', - 'uriTemplate' => '/v1beta1/{resource=projects/*/locations/*/instances/*}:setIamPolicy', - 'body' => '*', - 'placeholders' => [ - 'resource' => [ - 'getters' => [ - 'getResource', - ], - ], - ], - ], - 'TestIamPermissions' => [ - 'method' => 'post', - 'uriTemplate' => '/v1beta1/{resource=projects/*/locations/*/instances/*}:testIamPermissions', - 'body' => '*', - 'placeholders' => [ - 'resource' => [ - 'getters' => [ - 'getResource', - ], - ], - ], - ], - ], - 'google.longrunning.Operations' => [ - 'CancelOperation' => [ - 'method' => 'post', - 'uriTemplate' => '/v1beta1/{name=projects/*/locations/*/operations/*}:cancel', - 'body' => '*', - 'placeholders' => [ - 'name' => [ - 'getters' => [ - 'getName', - ], - ], - ], - ], - 'DeleteOperation' => [ - 'method' => 'delete', - 'uriTemplate' => '/v1beta1/{name=projects/*/locations/*/operations/*}', - 'placeholders' => [ - 'name' => [ - 'getters' => [ - 'getName', - ], - ], - ], - ], - 'GetOperation' => [ - 'method' => 'get', - 'uriTemplate' => '/v1beta1/{name=projects/*/locations/*/operations/*}', - 'placeholders' => [ - 'name' => [ - 'getters' => [ - 'getName', - ], - ], - ], - ], - 'ListOperations' => [ - 'method' => 'get', - 'uriTemplate' => '/v1beta1/{name=projects/*/locations/*}/operations', - 'placeholders' => [ - 'name' => [ - 'getters' => [ - 'getName', - ], - ], - ], - ], - ], - ], - 'numericEnums' => true, -]; diff --git a/Notebooks/tests/Unit/V1beta1/NotebookServiceClientTest.php b/Notebooks/tests/Unit/V1beta1/NotebookServiceClientTest.php deleted file mode 100644 index 5212a0263bc0..000000000000 --- a/Notebooks/tests/Unit/V1beta1/NotebookServiceClientTest.php +++ /dev/null @@ -1,2785 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return NotebookServiceClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new NotebookServiceClient($options); - } - - /** @test */ - public function createEnvironmentTest() - { - $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/createEnvironmentTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $displayName = 'displayName1615086568'; - $description = 'description-1724546052'; - $postStartupScript = 'postStartupScript355382860'; - $expectedResponse = new Environment(); - $expectedResponse->setName($name); - $expectedResponse->setDisplayName($displayName); - $expectedResponse->setDescription($description); - $expectedResponse->setPostStartupScript($postStartupScript); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/createEnvironmentTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $parent = 'parent-995424086'; - $environmentId = 'environmentId608412359'; - $environment = new Environment(); - $response = $gapicClient->createEnvironment($parent, $environmentId, $environment); - $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.notebooks.v1beta1.NotebookService/CreateEnvironment', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getParent(); - $this->assertProtobufEquals($parent, $actualValue); - $actualValue = $actualApiRequestObject->getEnvironmentId(); - $this->assertProtobufEquals($environmentId, $actualValue); - $actualValue = $actualApiRequestObject->getEnvironment(); - $this->assertProtobufEquals($environment, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createEnvironmentTest'); - $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 createEnvironmentExceptionTest() - { - $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/createEnvironmentTest'); - $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 - $parent = 'parent-995424086'; - $environmentId = 'environmentId608412359'; - $environment = new Environment(); - $response = $gapicClient->createEnvironment($parent, $environmentId, $environment); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createEnvironmentTest'); - 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 createInstanceTest() - { - $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/createInstanceTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $postStartupScript = 'postStartupScript355382860'; - $proxyUri = 'proxyUri-475670501'; - $serviceAccount = 'serviceAccount-1948028253'; - $machineType = 'machineType1838323762'; - $installGpuDriver = false; - $customGpuDriverPath = 'customGpuDriverPath1863223803'; - $bootDiskSizeGb = 1398920548; - $dataDiskSizeGb = 1668379732; - $noRemoveDataDisk = false; - $kmsKey = 'kmsKey-591635343'; - $noPublicIp = false; - $noProxyAccess = false; - $network = 'network1843485230'; - $subnet = 'subnet-891534499'; - $canIpForward = true; - $expectedResponse = new Instance(); - $expectedResponse->setName($name); - $expectedResponse->setPostStartupScript($postStartupScript); - $expectedResponse->setProxyUri($proxyUri); - $expectedResponse->setServiceAccount($serviceAccount); - $expectedResponse->setMachineType($machineType); - $expectedResponse->setInstallGpuDriver($installGpuDriver); - $expectedResponse->setCustomGpuDriverPath($customGpuDriverPath); - $expectedResponse->setBootDiskSizeGb($bootDiskSizeGb); - $expectedResponse->setDataDiskSizeGb($dataDiskSizeGb); - $expectedResponse->setNoRemoveDataDisk($noRemoveDataDisk); - $expectedResponse->setKmsKey($kmsKey); - $expectedResponse->setNoPublicIp($noPublicIp); - $expectedResponse->setNoProxyAccess($noProxyAccess); - $expectedResponse->setNetwork($network); - $expectedResponse->setSubnet($subnet); - $expectedResponse->setCanIpForward($canIpForward); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/createInstanceTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $parent = 'parent-995424086'; - $instanceId = 'instanceId-2101995259'; - $instance = new Instance(); - $instanceMachineType = 'instanceMachineType-107765684'; - $instance->setMachineType($instanceMachineType); - $response = $gapicClient->createInstance($parent, $instanceId, $instance); - $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.notebooks.v1beta1.NotebookService/CreateInstance', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getParent(); - $this->assertProtobufEquals($parent, $actualValue); - $actualValue = $actualApiRequestObject->getInstanceId(); - $this->assertProtobufEquals($instanceId, $actualValue); - $actualValue = $actualApiRequestObject->getInstance(); - $this->assertProtobufEquals($instance, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createInstanceTest'); - $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 createInstanceExceptionTest() - { - $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/createInstanceTest'); - $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 - $parent = 'parent-995424086'; - $instanceId = 'instanceId-2101995259'; - $instance = new Instance(); - $instanceMachineType = 'instanceMachineType-107765684'; - $instance->setMachineType($instanceMachineType); - $response = $gapicClient->createInstance($parent, $instanceId, $instance); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createInstanceTest'); - 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 deleteEnvironmentTest() - { - $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/deleteEnvironmentTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $expectedResponse = new GPBEmpty(); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/deleteEnvironmentTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $name = 'name3373707'; - $response = $gapicClient->deleteEnvironment($name); - $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.notebooks.v1beta1.NotebookService/DeleteEnvironment', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getName(); - $this->assertProtobufEquals($name, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteEnvironmentTest'); - $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 deleteEnvironmentExceptionTest() - { - $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/deleteEnvironmentTest'); - $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 - $name = 'name3373707'; - $response = $gapicClient->deleteEnvironment($name); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteEnvironmentTest'); - 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 deleteInstanceTest() - { - $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/deleteInstanceTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $expectedResponse = new GPBEmpty(); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/deleteInstanceTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $name = 'name3373707'; - $response = $gapicClient->deleteInstance($name); - $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.notebooks.v1beta1.NotebookService/DeleteInstance', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getName(); - $this->assertProtobufEquals($name, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteInstanceTest'); - $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 deleteInstanceExceptionTest() - { - $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/deleteInstanceTest'); - $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 - $name = 'name3373707'; - $response = $gapicClient->deleteInstance($name); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteInstanceTest'); - 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 getEnvironmentTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $displayName = 'displayName1615086568'; - $description = 'description-1724546052'; - $postStartupScript = 'postStartupScript355382860'; - $expectedResponse = new Environment(); - $expectedResponse->setName($name2); - $expectedResponse->setDisplayName($displayName); - $expectedResponse->setDescription($description); - $expectedResponse->setPostStartupScript($postStartupScript); - $transport->addResponse($expectedResponse); - // Mock request - $name = 'name3373707'; - $response = $gapicClient->getEnvironment($name); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.notebooks.v1beta1.NotebookService/GetEnvironment', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($name, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getEnvironmentExceptionTest() - { - $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 - $name = 'name3373707'; - try { - $gapicClient->getEnvironment($name); - // 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 getInstanceTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $postStartupScript = 'postStartupScript355382860'; - $proxyUri = 'proxyUri-475670501'; - $serviceAccount = 'serviceAccount-1948028253'; - $machineType = 'machineType1838323762'; - $installGpuDriver = false; - $customGpuDriverPath = 'customGpuDriverPath1863223803'; - $bootDiskSizeGb = 1398920548; - $dataDiskSizeGb = 1668379732; - $noRemoveDataDisk = false; - $kmsKey = 'kmsKey-591635343'; - $noPublicIp = false; - $noProxyAccess = false; - $network = 'network1843485230'; - $subnet = 'subnet-891534499'; - $canIpForward = true; - $expectedResponse = new Instance(); - $expectedResponse->setName($name2); - $expectedResponse->setPostStartupScript($postStartupScript); - $expectedResponse->setProxyUri($proxyUri); - $expectedResponse->setServiceAccount($serviceAccount); - $expectedResponse->setMachineType($machineType); - $expectedResponse->setInstallGpuDriver($installGpuDriver); - $expectedResponse->setCustomGpuDriverPath($customGpuDriverPath); - $expectedResponse->setBootDiskSizeGb($bootDiskSizeGb); - $expectedResponse->setDataDiskSizeGb($dataDiskSizeGb); - $expectedResponse->setNoRemoveDataDisk($noRemoveDataDisk); - $expectedResponse->setKmsKey($kmsKey); - $expectedResponse->setNoPublicIp($noPublicIp); - $expectedResponse->setNoProxyAccess($noProxyAccess); - $expectedResponse->setNetwork($network); - $expectedResponse->setSubnet($subnet); - $expectedResponse->setCanIpForward($canIpForward); - $transport->addResponse($expectedResponse); - // Mock request - $name = 'name3373707'; - $response = $gapicClient->getInstance($name); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.notebooks.v1beta1.NotebookService/GetInstance', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($name, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getInstanceExceptionTest() - { - $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 - $name = 'name3373707'; - try { - $gapicClient->getInstance($name); - // 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 isInstanceUpgradeableTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $upgradeable = true; - $upgradeVersion = 'upgradeVersion1040155061'; - $upgradeInfo = 'upgradeInfo-1337232143'; - $upgradeImage = 'upgradeImage1495441784'; - $expectedResponse = new IsInstanceUpgradeableResponse(); - $expectedResponse->setUpgradeable($upgradeable); - $expectedResponse->setUpgradeVersion($upgradeVersion); - $expectedResponse->setUpgradeInfo($upgradeInfo); - $expectedResponse->setUpgradeImage($upgradeImage); - $transport->addResponse($expectedResponse); - // Mock request - $notebookInstance = 'notebookInstance-1078982023'; - $response = $gapicClient->isInstanceUpgradeable($notebookInstance); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.notebooks.v1beta1.NotebookService/IsInstanceUpgradeable', $actualFuncCall); - $actualValue = $actualRequestObject->getNotebookInstance(); - $this->assertProtobufEquals($notebookInstance, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function isInstanceUpgradeableExceptionTest() - { - $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 - $notebookInstance = 'notebookInstance-1078982023'; - try { - $gapicClient->isInstanceUpgradeable($notebookInstance); - // 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 listEnvironmentsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $environmentsElement = new Environment(); - $environments = [ - $environmentsElement, - ]; - $expectedResponse = new ListEnvironmentsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setEnvironments($environments); - $transport->addResponse($expectedResponse); - // Mock request - $parent = 'parent-995424086'; - $response = $gapicClient->listEnvironments($parent); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getEnvironments()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.notebooks.v1beta1.NotebookService/ListEnvironments', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($parent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listEnvironmentsExceptionTest() - { - $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 - $parent = 'parent-995424086'; - try { - $gapicClient->listEnvironments($parent); - // 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 listInstancesTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $instancesElement = new Instance(); - $instances = [ - $instancesElement, - ]; - $expectedResponse = new ListInstancesResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setInstances($instances); - $transport->addResponse($expectedResponse); - // Mock request - $parent = 'parent-995424086'; - $response = $gapicClient->listInstances($parent); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getInstances()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.notebooks.v1beta1.NotebookService/ListInstances', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($parent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listInstancesExceptionTest() - { - $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 - $parent = 'parent-995424086'; - try { - $gapicClient->listInstances($parent); - // 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 registerInstanceTest() - { - $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/registerInstanceTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $postStartupScript = 'postStartupScript355382860'; - $proxyUri = 'proxyUri-475670501'; - $serviceAccount = 'serviceAccount-1948028253'; - $machineType = 'machineType1838323762'; - $installGpuDriver = false; - $customGpuDriverPath = 'customGpuDriverPath1863223803'; - $bootDiskSizeGb = 1398920548; - $dataDiskSizeGb = 1668379732; - $noRemoveDataDisk = false; - $kmsKey = 'kmsKey-591635343'; - $noPublicIp = false; - $noProxyAccess = false; - $network = 'network1843485230'; - $subnet = 'subnet-891534499'; - $canIpForward = true; - $expectedResponse = new Instance(); - $expectedResponse->setName($name); - $expectedResponse->setPostStartupScript($postStartupScript); - $expectedResponse->setProxyUri($proxyUri); - $expectedResponse->setServiceAccount($serviceAccount); - $expectedResponse->setMachineType($machineType); - $expectedResponse->setInstallGpuDriver($installGpuDriver); - $expectedResponse->setCustomGpuDriverPath($customGpuDriverPath); - $expectedResponse->setBootDiskSizeGb($bootDiskSizeGb); - $expectedResponse->setDataDiskSizeGb($dataDiskSizeGb); - $expectedResponse->setNoRemoveDataDisk($noRemoveDataDisk); - $expectedResponse->setKmsKey($kmsKey); - $expectedResponse->setNoPublicIp($noPublicIp); - $expectedResponse->setNoProxyAccess($noProxyAccess); - $expectedResponse->setNetwork($network); - $expectedResponse->setSubnet($subnet); - $expectedResponse->setCanIpForward($canIpForward); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/registerInstanceTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $parent = 'parent-995424086'; - $instanceId = 'instanceId-2101995259'; - $response = $gapicClient->registerInstance($parent, $instanceId); - $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.notebooks.v1beta1.NotebookService/RegisterInstance', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getParent(); - $this->assertProtobufEquals($parent, $actualValue); - $actualValue = $actualApiRequestObject->getInstanceId(); - $this->assertProtobufEquals($instanceId, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/registerInstanceTest'); - $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 registerInstanceExceptionTest() - { - $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/registerInstanceTest'); - $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 - $parent = 'parent-995424086'; - $instanceId = 'instanceId-2101995259'; - $response = $gapicClient->registerInstance($parent, $instanceId); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/registerInstanceTest'); - 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 reportInstanceInfoTest() - { - $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/reportInstanceInfoTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name2 = 'name2-1052831874'; - $postStartupScript = 'postStartupScript355382860'; - $proxyUri = 'proxyUri-475670501'; - $serviceAccount = 'serviceAccount-1948028253'; - $machineType = 'machineType1838323762'; - $installGpuDriver = false; - $customGpuDriverPath = 'customGpuDriverPath1863223803'; - $bootDiskSizeGb = 1398920548; - $dataDiskSizeGb = 1668379732; - $noRemoveDataDisk = false; - $kmsKey = 'kmsKey-591635343'; - $noPublicIp = false; - $noProxyAccess = false; - $network = 'network1843485230'; - $subnet = 'subnet-891534499'; - $canIpForward = true; - $expectedResponse = new Instance(); - $expectedResponse->setName($name2); - $expectedResponse->setPostStartupScript($postStartupScript); - $expectedResponse->setProxyUri($proxyUri); - $expectedResponse->setServiceAccount($serviceAccount); - $expectedResponse->setMachineType($machineType); - $expectedResponse->setInstallGpuDriver($installGpuDriver); - $expectedResponse->setCustomGpuDriverPath($customGpuDriverPath); - $expectedResponse->setBootDiskSizeGb($bootDiskSizeGb); - $expectedResponse->setDataDiskSizeGb($dataDiskSizeGb); - $expectedResponse->setNoRemoveDataDisk($noRemoveDataDisk); - $expectedResponse->setKmsKey($kmsKey); - $expectedResponse->setNoPublicIp($noPublicIp); - $expectedResponse->setNoProxyAccess($noProxyAccess); - $expectedResponse->setNetwork($network); - $expectedResponse->setSubnet($subnet); - $expectedResponse->setCanIpForward($canIpForward); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/reportInstanceInfoTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $name = 'name3373707'; - $vmId = 'vmId112317347'; - $response = $gapicClient->reportInstanceInfo($name, $vmId); - $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.notebooks.v1beta1.NotebookService/ReportInstanceInfo', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getName(); - $this->assertProtobufEquals($name, $actualValue); - $actualValue = $actualApiRequestObject->getVmId(); - $this->assertProtobufEquals($vmId, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/reportInstanceInfoTest'); - $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 reportInstanceInfoExceptionTest() - { - $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/reportInstanceInfoTest'); - $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 - $name = 'name3373707'; - $vmId = 'vmId112317347'; - $response = $gapicClient->reportInstanceInfo($name, $vmId); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/reportInstanceInfoTest'); - 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 resetInstanceTest() - { - $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/resetInstanceTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name2 = 'name2-1052831874'; - $postStartupScript = 'postStartupScript355382860'; - $proxyUri = 'proxyUri-475670501'; - $serviceAccount = 'serviceAccount-1948028253'; - $machineType = 'machineType1838323762'; - $installGpuDriver = false; - $customGpuDriverPath = 'customGpuDriverPath1863223803'; - $bootDiskSizeGb = 1398920548; - $dataDiskSizeGb = 1668379732; - $noRemoveDataDisk = false; - $kmsKey = 'kmsKey-591635343'; - $noPublicIp = false; - $noProxyAccess = false; - $network = 'network1843485230'; - $subnet = 'subnet-891534499'; - $canIpForward = true; - $expectedResponse = new Instance(); - $expectedResponse->setName($name2); - $expectedResponse->setPostStartupScript($postStartupScript); - $expectedResponse->setProxyUri($proxyUri); - $expectedResponse->setServiceAccount($serviceAccount); - $expectedResponse->setMachineType($machineType); - $expectedResponse->setInstallGpuDriver($installGpuDriver); - $expectedResponse->setCustomGpuDriverPath($customGpuDriverPath); - $expectedResponse->setBootDiskSizeGb($bootDiskSizeGb); - $expectedResponse->setDataDiskSizeGb($dataDiskSizeGb); - $expectedResponse->setNoRemoveDataDisk($noRemoveDataDisk); - $expectedResponse->setKmsKey($kmsKey); - $expectedResponse->setNoPublicIp($noPublicIp); - $expectedResponse->setNoProxyAccess($noProxyAccess); - $expectedResponse->setNetwork($network); - $expectedResponse->setSubnet($subnet); - $expectedResponse->setCanIpForward($canIpForward); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/resetInstanceTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $name = 'name3373707'; - $response = $gapicClient->resetInstance($name); - $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.notebooks.v1beta1.NotebookService/ResetInstance', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getName(); - $this->assertProtobufEquals($name, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/resetInstanceTest'); - $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 resetInstanceExceptionTest() - { - $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/resetInstanceTest'); - $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 - $name = 'name3373707'; - $response = $gapicClient->resetInstance($name); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/resetInstanceTest'); - 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 setInstanceAcceleratorTest() - { - $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/setInstanceAcceleratorTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name2 = 'name2-1052831874'; - $postStartupScript = 'postStartupScript355382860'; - $proxyUri = 'proxyUri-475670501'; - $serviceAccount = 'serviceAccount-1948028253'; - $machineType = 'machineType1838323762'; - $installGpuDriver = false; - $customGpuDriverPath = 'customGpuDriverPath1863223803'; - $bootDiskSizeGb = 1398920548; - $dataDiskSizeGb = 1668379732; - $noRemoveDataDisk = false; - $kmsKey = 'kmsKey-591635343'; - $noPublicIp = false; - $noProxyAccess = false; - $network = 'network1843485230'; - $subnet = 'subnet-891534499'; - $canIpForward = true; - $expectedResponse = new Instance(); - $expectedResponse->setName($name2); - $expectedResponse->setPostStartupScript($postStartupScript); - $expectedResponse->setProxyUri($proxyUri); - $expectedResponse->setServiceAccount($serviceAccount); - $expectedResponse->setMachineType($machineType); - $expectedResponse->setInstallGpuDriver($installGpuDriver); - $expectedResponse->setCustomGpuDriverPath($customGpuDriverPath); - $expectedResponse->setBootDiskSizeGb($bootDiskSizeGb); - $expectedResponse->setDataDiskSizeGb($dataDiskSizeGb); - $expectedResponse->setNoRemoveDataDisk($noRemoveDataDisk); - $expectedResponse->setKmsKey($kmsKey); - $expectedResponse->setNoPublicIp($noPublicIp); - $expectedResponse->setNoProxyAccess($noProxyAccess); - $expectedResponse->setNetwork($network); - $expectedResponse->setSubnet($subnet); - $expectedResponse->setCanIpForward($canIpForward); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/setInstanceAcceleratorTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $name = 'name3373707'; - $type = AcceleratorType::ACCELERATOR_TYPE_UNSPECIFIED; - $coreCount = 1963855761; - $response = $gapicClient->setInstanceAccelerator($name, $type, $coreCount); - $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.notebooks.v1beta1.NotebookService/SetInstanceAccelerator', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getName(); - $this->assertProtobufEquals($name, $actualValue); - $actualValue = $actualApiRequestObject->getType(); - $this->assertProtobufEquals($type, $actualValue); - $actualValue = $actualApiRequestObject->getCoreCount(); - $this->assertProtobufEquals($coreCount, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/setInstanceAcceleratorTest'); - $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 setInstanceAcceleratorExceptionTest() - { - $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/setInstanceAcceleratorTest'); - $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 - $name = 'name3373707'; - $type = AcceleratorType::ACCELERATOR_TYPE_UNSPECIFIED; - $coreCount = 1963855761; - $response = $gapicClient->setInstanceAccelerator($name, $type, $coreCount); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/setInstanceAcceleratorTest'); - 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 setInstanceLabelsTest() - { - $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/setInstanceLabelsTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name2 = 'name2-1052831874'; - $postStartupScript = 'postStartupScript355382860'; - $proxyUri = 'proxyUri-475670501'; - $serviceAccount = 'serviceAccount-1948028253'; - $machineType = 'machineType1838323762'; - $installGpuDriver = false; - $customGpuDriverPath = 'customGpuDriverPath1863223803'; - $bootDiskSizeGb = 1398920548; - $dataDiskSizeGb = 1668379732; - $noRemoveDataDisk = false; - $kmsKey = 'kmsKey-591635343'; - $noPublicIp = false; - $noProxyAccess = false; - $network = 'network1843485230'; - $subnet = 'subnet-891534499'; - $canIpForward = true; - $expectedResponse = new Instance(); - $expectedResponse->setName($name2); - $expectedResponse->setPostStartupScript($postStartupScript); - $expectedResponse->setProxyUri($proxyUri); - $expectedResponse->setServiceAccount($serviceAccount); - $expectedResponse->setMachineType($machineType); - $expectedResponse->setInstallGpuDriver($installGpuDriver); - $expectedResponse->setCustomGpuDriverPath($customGpuDriverPath); - $expectedResponse->setBootDiskSizeGb($bootDiskSizeGb); - $expectedResponse->setDataDiskSizeGb($dataDiskSizeGb); - $expectedResponse->setNoRemoveDataDisk($noRemoveDataDisk); - $expectedResponse->setKmsKey($kmsKey); - $expectedResponse->setNoPublicIp($noPublicIp); - $expectedResponse->setNoProxyAccess($noProxyAccess); - $expectedResponse->setNetwork($network); - $expectedResponse->setSubnet($subnet); - $expectedResponse->setCanIpForward($canIpForward); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/setInstanceLabelsTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $name = 'name3373707'; - $response = $gapicClient->setInstanceLabels($name); - $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.notebooks.v1beta1.NotebookService/SetInstanceLabels', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getName(); - $this->assertProtobufEquals($name, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/setInstanceLabelsTest'); - $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 setInstanceLabelsExceptionTest() - { - $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/setInstanceLabelsTest'); - $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 - $name = 'name3373707'; - $response = $gapicClient->setInstanceLabels($name); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/setInstanceLabelsTest'); - 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 setInstanceMachineTypeTest() - { - $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/setInstanceMachineTypeTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name2 = 'name2-1052831874'; - $postStartupScript = 'postStartupScript355382860'; - $proxyUri = 'proxyUri-475670501'; - $serviceAccount = 'serviceAccount-1948028253'; - $machineType2 = 'machineType21397579621'; - $installGpuDriver = false; - $customGpuDriverPath = 'customGpuDriverPath1863223803'; - $bootDiskSizeGb = 1398920548; - $dataDiskSizeGb = 1668379732; - $noRemoveDataDisk = false; - $kmsKey = 'kmsKey-591635343'; - $noPublicIp = false; - $noProxyAccess = false; - $network = 'network1843485230'; - $subnet = 'subnet-891534499'; - $canIpForward = true; - $expectedResponse = new Instance(); - $expectedResponse->setName($name2); - $expectedResponse->setPostStartupScript($postStartupScript); - $expectedResponse->setProxyUri($proxyUri); - $expectedResponse->setServiceAccount($serviceAccount); - $expectedResponse->setMachineType($machineType2); - $expectedResponse->setInstallGpuDriver($installGpuDriver); - $expectedResponse->setCustomGpuDriverPath($customGpuDriverPath); - $expectedResponse->setBootDiskSizeGb($bootDiskSizeGb); - $expectedResponse->setDataDiskSizeGb($dataDiskSizeGb); - $expectedResponse->setNoRemoveDataDisk($noRemoveDataDisk); - $expectedResponse->setKmsKey($kmsKey); - $expectedResponse->setNoPublicIp($noPublicIp); - $expectedResponse->setNoProxyAccess($noProxyAccess); - $expectedResponse->setNetwork($network); - $expectedResponse->setSubnet($subnet); - $expectedResponse->setCanIpForward($canIpForward); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/setInstanceMachineTypeTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $name = 'name3373707'; - $machineType = 'machineType1838323762'; - $response = $gapicClient->setInstanceMachineType($name, $machineType); - $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.notebooks.v1beta1.NotebookService/SetInstanceMachineType', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getName(); - $this->assertProtobufEquals($name, $actualValue); - $actualValue = $actualApiRequestObject->getMachineType(); - $this->assertProtobufEquals($machineType, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/setInstanceMachineTypeTest'); - $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 setInstanceMachineTypeExceptionTest() - { - $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/setInstanceMachineTypeTest'); - $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 - $name = 'name3373707'; - $machineType = 'machineType1838323762'; - $response = $gapicClient->setInstanceMachineType($name, $machineType); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/setInstanceMachineTypeTest'); - 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 startInstanceTest() - { - $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/startInstanceTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name2 = 'name2-1052831874'; - $postStartupScript = 'postStartupScript355382860'; - $proxyUri = 'proxyUri-475670501'; - $serviceAccount = 'serviceAccount-1948028253'; - $machineType = 'machineType1838323762'; - $installGpuDriver = false; - $customGpuDriverPath = 'customGpuDriverPath1863223803'; - $bootDiskSizeGb = 1398920548; - $dataDiskSizeGb = 1668379732; - $noRemoveDataDisk = false; - $kmsKey = 'kmsKey-591635343'; - $noPublicIp = false; - $noProxyAccess = false; - $network = 'network1843485230'; - $subnet = 'subnet-891534499'; - $canIpForward = true; - $expectedResponse = new Instance(); - $expectedResponse->setName($name2); - $expectedResponse->setPostStartupScript($postStartupScript); - $expectedResponse->setProxyUri($proxyUri); - $expectedResponse->setServiceAccount($serviceAccount); - $expectedResponse->setMachineType($machineType); - $expectedResponse->setInstallGpuDriver($installGpuDriver); - $expectedResponse->setCustomGpuDriverPath($customGpuDriverPath); - $expectedResponse->setBootDiskSizeGb($bootDiskSizeGb); - $expectedResponse->setDataDiskSizeGb($dataDiskSizeGb); - $expectedResponse->setNoRemoveDataDisk($noRemoveDataDisk); - $expectedResponse->setKmsKey($kmsKey); - $expectedResponse->setNoPublicIp($noPublicIp); - $expectedResponse->setNoProxyAccess($noProxyAccess); - $expectedResponse->setNetwork($network); - $expectedResponse->setSubnet($subnet); - $expectedResponse->setCanIpForward($canIpForward); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/startInstanceTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $name = 'name3373707'; - $response = $gapicClient->startInstance($name); - $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.notebooks.v1beta1.NotebookService/StartInstance', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getName(); - $this->assertProtobufEquals($name, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/startInstanceTest'); - $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 startInstanceExceptionTest() - { - $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/startInstanceTest'); - $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 - $name = 'name3373707'; - $response = $gapicClient->startInstance($name); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/startInstanceTest'); - 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 stopInstanceTest() - { - $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/stopInstanceTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name2 = 'name2-1052831874'; - $postStartupScript = 'postStartupScript355382860'; - $proxyUri = 'proxyUri-475670501'; - $serviceAccount = 'serviceAccount-1948028253'; - $machineType = 'machineType1838323762'; - $installGpuDriver = false; - $customGpuDriverPath = 'customGpuDriverPath1863223803'; - $bootDiskSizeGb = 1398920548; - $dataDiskSizeGb = 1668379732; - $noRemoveDataDisk = false; - $kmsKey = 'kmsKey-591635343'; - $noPublicIp = false; - $noProxyAccess = false; - $network = 'network1843485230'; - $subnet = 'subnet-891534499'; - $canIpForward = true; - $expectedResponse = new Instance(); - $expectedResponse->setName($name2); - $expectedResponse->setPostStartupScript($postStartupScript); - $expectedResponse->setProxyUri($proxyUri); - $expectedResponse->setServiceAccount($serviceAccount); - $expectedResponse->setMachineType($machineType); - $expectedResponse->setInstallGpuDriver($installGpuDriver); - $expectedResponse->setCustomGpuDriverPath($customGpuDriverPath); - $expectedResponse->setBootDiskSizeGb($bootDiskSizeGb); - $expectedResponse->setDataDiskSizeGb($dataDiskSizeGb); - $expectedResponse->setNoRemoveDataDisk($noRemoveDataDisk); - $expectedResponse->setKmsKey($kmsKey); - $expectedResponse->setNoPublicIp($noPublicIp); - $expectedResponse->setNoProxyAccess($noProxyAccess); - $expectedResponse->setNetwork($network); - $expectedResponse->setSubnet($subnet); - $expectedResponse->setCanIpForward($canIpForward); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/stopInstanceTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $name = 'name3373707'; - $response = $gapicClient->stopInstance($name); - $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.notebooks.v1beta1.NotebookService/StopInstance', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getName(); - $this->assertProtobufEquals($name, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/stopInstanceTest'); - $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 stopInstanceExceptionTest() - { - $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/stopInstanceTest'); - $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 - $name = 'name3373707'; - $response = $gapicClient->stopInstance($name); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/stopInstanceTest'); - 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 upgradeInstanceTest() - { - $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/upgradeInstanceTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name2 = 'name2-1052831874'; - $postStartupScript = 'postStartupScript355382860'; - $proxyUri = 'proxyUri-475670501'; - $serviceAccount = 'serviceAccount-1948028253'; - $machineType = 'machineType1838323762'; - $installGpuDriver = false; - $customGpuDriverPath = 'customGpuDriverPath1863223803'; - $bootDiskSizeGb = 1398920548; - $dataDiskSizeGb = 1668379732; - $noRemoveDataDisk = false; - $kmsKey = 'kmsKey-591635343'; - $noPublicIp = false; - $noProxyAccess = false; - $network = 'network1843485230'; - $subnet = 'subnet-891534499'; - $canIpForward = true; - $expectedResponse = new Instance(); - $expectedResponse->setName($name2); - $expectedResponse->setPostStartupScript($postStartupScript); - $expectedResponse->setProxyUri($proxyUri); - $expectedResponse->setServiceAccount($serviceAccount); - $expectedResponse->setMachineType($machineType); - $expectedResponse->setInstallGpuDriver($installGpuDriver); - $expectedResponse->setCustomGpuDriverPath($customGpuDriverPath); - $expectedResponse->setBootDiskSizeGb($bootDiskSizeGb); - $expectedResponse->setDataDiskSizeGb($dataDiskSizeGb); - $expectedResponse->setNoRemoveDataDisk($noRemoveDataDisk); - $expectedResponse->setKmsKey($kmsKey); - $expectedResponse->setNoPublicIp($noPublicIp); - $expectedResponse->setNoProxyAccess($noProxyAccess); - $expectedResponse->setNetwork($network); - $expectedResponse->setSubnet($subnet); - $expectedResponse->setCanIpForward($canIpForward); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/upgradeInstanceTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $name = 'name3373707'; - $response = $gapicClient->upgradeInstance($name); - $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.notebooks.v1beta1.NotebookService/UpgradeInstance', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getName(); - $this->assertProtobufEquals($name, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/upgradeInstanceTest'); - $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 upgradeInstanceExceptionTest() - { - $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/upgradeInstanceTest'); - $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 - $name = 'name3373707'; - $response = $gapicClient->upgradeInstance($name); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/upgradeInstanceTest'); - 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 upgradeInstanceInternalTest() - { - $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/upgradeInstanceInternalTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name2 = 'name2-1052831874'; - $postStartupScript = 'postStartupScript355382860'; - $proxyUri = 'proxyUri-475670501'; - $serviceAccount = 'serviceAccount-1948028253'; - $machineType = 'machineType1838323762'; - $installGpuDriver = false; - $customGpuDriverPath = 'customGpuDriverPath1863223803'; - $bootDiskSizeGb = 1398920548; - $dataDiskSizeGb = 1668379732; - $noRemoveDataDisk = false; - $kmsKey = 'kmsKey-591635343'; - $noPublicIp = false; - $noProxyAccess = false; - $network = 'network1843485230'; - $subnet = 'subnet-891534499'; - $canIpForward = true; - $expectedResponse = new Instance(); - $expectedResponse->setName($name2); - $expectedResponse->setPostStartupScript($postStartupScript); - $expectedResponse->setProxyUri($proxyUri); - $expectedResponse->setServiceAccount($serviceAccount); - $expectedResponse->setMachineType($machineType); - $expectedResponse->setInstallGpuDriver($installGpuDriver); - $expectedResponse->setCustomGpuDriverPath($customGpuDriverPath); - $expectedResponse->setBootDiskSizeGb($bootDiskSizeGb); - $expectedResponse->setDataDiskSizeGb($dataDiskSizeGb); - $expectedResponse->setNoRemoveDataDisk($noRemoveDataDisk); - $expectedResponse->setKmsKey($kmsKey); - $expectedResponse->setNoPublicIp($noPublicIp); - $expectedResponse->setNoProxyAccess($noProxyAccess); - $expectedResponse->setNetwork($network); - $expectedResponse->setSubnet($subnet); - $expectedResponse->setCanIpForward($canIpForward); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/upgradeInstanceInternalTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $name = 'name3373707'; - $vmId = 'vmId112317347'; - $response = $gapicClient->upgradeInstanceInternal($name, $vmId); - $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.notebooks.v1beta1.NotebookService/UpgradeInstanceInternal', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getName(); - $this->assertProtobufEquals($name, $actualValue); - $actualValue = $actualApiRequestObject->getVmId(); - $this->assertProtobufEquals($vmId, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/upgradeInstanceInternalTest'); - $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 upgradeInstanceInternalExceptionTest() - { - $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/upgradeInstanceInternalTest'); - $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 - $name = 'name3373707'; - $vmId = 'vmId112317347'; - $response = $gapicClient->upgradeInstanceInternal($name, $vmId); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/upgradeInstanceInternalTest'); - 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()); - } - - /** @test */ - public function getIamPolicyTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $version = 351608024; - $etag = '21'; - $expectedResponse = new Policy(); - $expectedResponse->setVersion($version); - $expectedResponse->setEtag($etag); - $transport->addResponse($expectedResponse); - // Mock request - $resource = 'resource-341064690'; - $response = $gapicClient->getIamPolicy($resource); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.iam.v1.IAMPolicy/GetIamPolicy', $actualFuncCall); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getIamPolicyExceptionTest() - { - $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 - $resource = 'resource-341064690'; - try { - $gapicClient->getIamPolicy($resource); - // 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 setIamPolicyTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $version = 351608024; - $etag = '21'; - $expectedResponse = new Policy(); - $expectedResponse->setVersion($version); - $expectedResponse->setEtag($etag); - $transport->addResponse($expectedResponse); - // Mock request - $resource = 'resource-341064690'; - $policy = new Policy(); - $response = $gapicClient->setIamPolicy($resource, $policy); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.iam.v1.IAMPolicy/SetIamPolicy', $actualFuncCall); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $actualValue = $actualRequestObject->getPolicy(); - $this->assertProtobufEquals($policy, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function setIamPolicyExceptionTest() - { - $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 - $resource = 'resource-341064690'; - $policy = new Policy(); - try { - $gapicClient->setIamPolicy($resource, $policy); - // 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 testIamPermissionsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new TestIamPermissionsResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $resource = 'resource-341064690'; - $permissions = []; - $response = $gapicClient->testIamPermissions($resource, $permissions); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.iam.v1.IAMPolicy/TestIamPermissions', $actualFuncCall); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $actualValue = $actualRequestObject->getPermissions(); - $this->assertProtobufEquals($permissions, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function testIamPermissionsExceptionTest() - { - $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 - $resource = 'resource-341064690'; - $permissions = []; - try { - $gapicClient->testIamPermissions($resource, $permissions); - // 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()); - } -}