From 4afaf337b008104d275f88ccbced8b9a6d417707 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Tue, 3 Jan 2023 16:11:27 -0800 Subject: [PATCH] feat: [Dataproc] added node groups API protos (#5698) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: added node groups API protos PiperOrigin-RevId: 494840237 Source-Link: https://github.com/googleapis/googleapis/commit/28449ecb37897d665a5a2c6d916133b1863f0966 Source-Link: https://github.com/googleapis/googleapis-gen/commit/786b1889c07c4ead16093d375c59455a0576ee25 Copy-Tag: eyJwIjoiRGF0YXByb2MvLk93bEJvdC55YW1sIiwiaCI6Ijc4NmIxODg5YzA3YzRlYWQxNjA5M2QzNzVjNTk0NTVhMDU3NmVlMjUifQ== * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --- Dataproc/metadata/V1/Clusters.php | Bin 12830 -> 13472 bytes Dataproc/metadata/V1/Jobs.php | Bin 9828 -> 9988 bytes Dataproc/metadata/V1/NodeGroups.php | 58 ++ Dataproc/metadata/V1/Operations.php | Bin 2093 -> 2730 bytes .../create_cluster.php | 6 +- .../update_cluster.php | 9 +- .../create_node_group.php | 93 +++ .../get_node_group.php | 74 +++ .../resize_node_group.php | 85 +++ Dataproc/src/V1/AuxiliaryNodeGroup.php | 123 ++++ Dataproc/src/V1/Cluster.php | 88 +-- Dataproc/src/V1/ClusterConfig.php | 98 +-- .../src/V1/ClusterControllerGrpcClient.php | 3 +- .../src/V1/ConfidentialInstanceConfig.php | 12 +- Dataproc/src/V1/CreateClusterRequest.php | 28 +- Dataproc/src/V1/CreateNodeGroupRequest.php | 231 +++++++ Dataproc/src/V1/DeleteClusterRequest.php | 16 +- Dataproc/src/V1/DiskConfig.php | 8 +- Dataproc/src/V1/DriverSchedulingConfig.php | 101 +++ .../V1/Gapic/ClusterControllerGapicClient.php | 26 +- .../Gapic/NodeGroupControllerGapicClient.php | 589 ++++++++++++++++++ Dataproc/src/V1/GceClusterConfig.php | 12 +- .../PrivateIpv6GoogleAccess.php | 3 +- Dataproc/src/V1/GetNodeGroupRequest.php | 75 +++ .../V1/InstanceGroupConfig/Preemptibility.php | 12 +- Dataproc/src/V1/Job.php | 60 +- Dataproc/src/V1/JobPlacement.php | 12 +- Dataproc/src/V1/JobReference.php | 16 +- Dataproc/src/V1/JobScheduling.php | 80 ++- Dataproc/src/V1/KerberosConfig.php | 16 +- Dataproc/src/V1/LifecycleConfig.php | 9 +- Dataproc/src/V1/NodeGroup.php | 206 ++++++ Dataproc/src/V1/NodeGroup/Role.php | 57 ++ Dataproc/src/V1/NodeGroupAffinity.php | 2 + Dataproc/src/V1/NodeGroupControllerClient.php | 34 + .../src/V1/NodeGroupControllerGrpcClient.php | 86 +++ .../src/V1/NodeGroupOperationMetadata.php | 315 ++++++++++ .../NodeGroupOperationType.php | 78 +++ ...erationMetadata_NodeGroupOperationType.php | 16 + Dataproc/src/V1/NodeGroup_Role.php | 16 + Dataproc/src/V1/ResizeNodeGroupRequest.php | 271 ++++++++ Dataproc/src/V1/SparkJob.php | 2 +- Dataproc/src/V1/SparkSqlJob.php | 2 +- Dataproc/src/V1/StartClusterRequest.php | 16 +- Dataproc/src/V1/StopClusterRequest.php | 16 +- Dataproc/src/V1/UpdateClusterRequest.php | 16 +- Dataproc/src/V1/VirtualClusterConfig.php | 21 +- Dataproc/src/V1/gapic_metadata.json | 24 + .../node_group_controller_client_config.json | 37 ++ ...ode_group_controller_descriptor_config.php | 28 + ...de_group_controller_rest_client_config.php | 223 +++++++ .../Unit/V1/NodeGroupControllerClientTest.php | 375 +++++++++++ 52 files changed, 3545 insertions(+), 239 deletions(-) create mode 100644 Dataproc/metadata/V1/NodeGroups.php create mode 100644 Dataproc/samples/V1/NodeGroupControllerClient/create_node_group.php create mode 100644 Dataproc/samples/V1/NodeGroupControllerClient/get_node_group.php create mode 100644 Dataproc/samples/V1/NodeGroupControllerClient/resize_node_group.php create mode 100644 Dataproc/src/V1/AuxiliaryNodeGroup.php create mode 100644 Dataproc/src/V1/CreateNodeGroupRequest.php create mode 100644 Dataproc/src/V1/DriverSchedulingConfig.php create mode 100644 Dataproc/src/V1/Gapic/NodeGroupControllerGapicClient.php create mode 100644 Dataproc/src/V1/GetNodeGroupRequest.php create mode 100644 Dataproc/src/V1/NodeGroup.php create mode 100644 Dataproc/src/V1/NodeGroup/Role.php create mode 100644 Dataproc/src/V1/NodeGroupControllerClient.php create mode 100644 Dataproc/src/V1/NodeGroupControllerGrpcClient.php create mode 100644 Dataproc/src/V1/NodeGroupOperationMetadata.php create mode 100644 Dataproc/src/V1/NodeGroupOperationMetadata/NodeGroupOperationType.php create mode 100644 Dataproc/src/V1/NodeGroupOperationMetadata_NodeGroupOperationType.php create mode 100644 Dataproc/src/V1/NodeGroup_Role.php create mode 100644 Dataproc/src/V1/ResizeNodeGroupRequest.php create mode 100644 Dataproc/src/V1/resources/node_group_controller_client_config.json create mode 100644 Dataproc/src/V1/resources/node_group_controller_descriptor_config.php create mode 100644 Dataproc/src/V1/resources/node_group_controller_rest_client_config.php create mode 100644 Dataproc/tests/Unit/V1/NodeGroupControllerClientTest.php diff --git a/Dataproc/metadata/V1/Clusters.php b/Dataproc/metadata/V1/Clusters.php index 86349e1b7f52c6322c917a75a6feea3f68b3b7c3..62ee42198cdd5af28918be307923a4ceed250e52 100644 GIT binary patch delta 468 zcmbQ2vLJKAJ7%UQ37bDK7cw(7b8b#%H)K&13g8k=EUn1Q$xJM&jL*wYNsUi0$}cS_ zmXK6n*5EeMnS4-0S`end4=C>rlHT0UEy1mw$0g*5AthwP#f30Of>D7HXpHh?L2ju~ zxOOMz2aZfaQe3<Uh4Gmw5==m~oFF+yrM=8toN(nrJX|b!iMgp@!#IH!uomU#q!t6! zGi&fo7L=4RfGgDt0?I&)_vI2qGCny!FD)}&f*I@_U66AoYj8*kx^S`OBqpWi6icvx z{i_d>kwO^f1D15nD=Df3J8ZHcyFrQu7YoQ5ArUTtAb%g%_)x##09R*EH&0g=0R|y1 zE;g4S&oI{@0Y<B`SB}M8iYbXDi3LUZ$$IJe`RO^Si3OR(ddc~@`fzK6{D9I~smUe9 e`qfa@<cpdrlC}CEAAmy~D1-1#?dD}-7197E6_B|A delta 33 pcmZ3GIWJ|yJ7%Uw(VIUo7cw(#<k+0dZpgCv8MiR^W=+X*X#nt?3|s&J diff --git a/Dataproc/metadata/V1/Jobs.php b/Dataproc/metadata/V1/Jobs.php index 1348c2b462a1a6d213292a4955fd9b672b54caf9..ea9bc69247c619c1c3bf8eaaed98bf237bd75e27 100644 GIT binary patch delta 172 zcmaFj)8e-wkD2MH+vWmhH({n5oSS!uxv{7Sg>y-y6lIpB7R47QXQZZ-=49rj$0z6K zrDdi|NGmXEa2pv+Hsp|!b^$92hO2P~D{*3e;K(@npOlT8E0-8{B|>6coVlsF`9+oS hxk(a?KqFZ}x|oE7x!B5*^NUi8C79rXn=PfaxdDSBHVXg% delta 32 ocmZqid*ZVpkC|zy>*fMxH({p#9GiEDxv@+Rm$un_OInK?0LwlLfdBvi diff --git a/Dataproc/metadata/V1/NodeGroups.php b/Dataproc/metadata/V1/NodeGroups.php new file mode 100644 index 000000000000..f322c217cbc9 --- /dev/null +++ b/Dataproc/metadata/V1/NodeGroups.php @@ -0,0 +1,58 @@ +<?php +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: google/cloud/dataproc/v1/node_groups.proto + +namespace GPBMetadata\Google\Cloud\Dataproc\V1; + +class NodeGroups +{ + public static $is_initialized = false; + + public static function initOnce() { + $pool = \Google\Protobuf\Internal\DescriptorPool::getGeneratedPool(); + + if (static::$is_initialized == true) { + return; + } + \GPBMetadata\Google\Api\Annotations::initOnce(); + \GPBMetadata\Google\Api\Client::initOnce(); + \GPBMetadata\Google\Api\FieldBehavior::initOnce(); + \GPBMetadata\Google\Api\Resource::initOnce(); + \GPBMetadata\Google\Cloud\Dataproc\V1\Clusters::initOnce(); + \GPBMetadata\Google\Longrunning\Operations::initOnce(); + \GPBMetadata\Google\Protobuf\Duration::initOnce(); + $pool->internalAddGeneratedFile( + ' +� +*google/cloud/dataproc/v1/node_groups.protogoogle.cloud.dataproc.v1google/api/client.protogoogle/api/field_behavior.protogoogle/api/resource.proto\'google/cloud/dataproc/v1/clusters.proto#google/longrunning/operations.protogoogle/protobuf/duration.proto"� +CreateNodeGroupRequest9 +parent ( B)�A�A#!dataproc.googleapis.com/NodeGroup< + +node_group (2#.google.cloud.dataproc.v1.NodeGroupB�A + node_group_id ( B�A + +request_id ( B�A"� +ResizeNodeGroupRequest +name ( B�A +size (B�A + +request_id ( B�AE +graceful_decommission_timeout (2.google.protobuf.DurationB�A"N +GetNodeGroupRequest7 +name ( B)�A�A# +!dataproc.googleapis.com/NodeGroup2� +NodeGroupController� +CreateNodeGroup0.google.cloud.dataproc.v1.CreateNodeGroupRequest.google.longrunning.Operation"����E"7/v1/{parent=projects/*/regions/*/clusters/*}/nodeGroups: +node_group�Aparent,node_group,node_group_id�A@ + NodeGroup3google.cloud.dataproc.v1.NodeGroupOperationMetadata� +ResizeNodeGroup0.google.cloud.dataproc.v1.ResizeNodeGroupRequest.google.longrunning.Operation"����C">/v1/{name=projects/*/regions/*/clusters/*/nodeGroups/*}:resize:*�A name,size�A@ + NodeGroup3google.cloud.dataproc.v1.NodeGroupOperationMetadata� +GetNodeGroup-.google.cloud.dataproc.v1.GetNodeGroupRequest#.google.cloud.dataproc.v1.NodeGroup"F���97/v1/{name=projects/*/regions/*/clusters/*/nodeGroups/*}�AnameK�Adataproc.googleapis.com�A.https://www.googleapis.com/auth/cloud-platformB� +com.google.cloud.dataproc.v1BNodeGroupsProtoPZ@google.golang.org/genproto/googleapis/cloud/dataproc/v1;dataproc�A_ +%dataproc.googleapis.com/ClusterRegion6projects/{project}/regions/{region}/clusters/{cluster}bproto3' + , true); + + static::$is_initialized = true; + } +} + diff --git a/Dataproc/metadata/V1/Operations.php b/Dataproc/metadata/V1/Operations.php index 83a8f2398eb354fd5ab4c3a46ba50e135fe10b1a..a38cf56a02fda1b8d6576cab939bc56705bfa2b7 100644 GIT binary patch delta 367 zcmZ20uu6187!ymc0GH-OZ_UlkOfOiBlzy>rN%`fcq`DX7mlpUJq!uNXWaj7jrj{h8 zB$gx!NpbP!0cGRULDKP=DH4p6@3TsYF)1)=a5^zRaAX#8<zg!?Nh~QXmSCRD&*sO> zqQE>^kj+XmnTszUW?XzpWkIS0D^L@kk@w^W%u=zqt<=Mm3IXaClHlS_Ni9w;$}9jm zP=XENf>18DoW!KmoMH)f1!fIyBL|QToN!|%|7Vt+tiUeB#Q~IsIC`=ki-CGEml#|P z+~Z)YG`Up${9Rn*-Glr?118t7$mw%&u{j61I)=CkFbV<Lp#d%+HWP^L;_BlHWHW=< RL9W4`QLX|kle5_m0RSc}YNP-F delta 36 scmZ1_x>jIA7!%6`ZZ6G<-kO`6nO?B4I~8-uB<JT&F65A$%)zw?0MN+`4FCWD diff --git a/Dataproc/samples/V1/ClusterControllerClient/create_cluster.php b/Dataproc/samples/V1/ClusterControllerClient/create_cluster.php index ce6b675ea88e..ca6d1ff3e6d8 100644 --- a/Dataproc/samples/V1/ClusterControllerClient/create_cluster.php +++ b/Dataproc/samples/V1/ClusterControllerClient/create_cluster.php @@ -38,8 +38,10 @@ * belongs to. * @param string $region The Dataproc region in which to handle the request. * @param string $clusterProjectId The Google Cloud Platform project ID that the cluster belongs to. - * @param string $clusterClusterName The cluster name. Cluster names within a project must be - * unique. Names of deleted clusters can be reused. + * @param string $clusterClusterName The cluster name, which must be unique within a project. + * The name must start with a lowercase letter, and can contain + * up to 51 lowercase letters, numbers, and hyphens. It cannot end + * with a hyphen. The name of a deleted cluster can be reused. */ function create_cluster_sample( string $projectId, diff --git a/Dataproc/samples/V1/ClusterControllerClient/update_cluster.php b/Dataproc/samples/V1/ClusterControllerClient/update_cluster.php index e563369a6cb1..f1df6b7d2ff7 100644 --- a/Dataproc/samples/V1/ClusterControllerClient/update_cluster.php +++ b/Dataproc/samples/V1/ClusterControllerClient/update_cluster.php @@ -34,7 +34,8 @@ * Updates a cluster in a project. The returned * [Operation.metadata][google.longrunning.Operation.metadata] will be * [ClusterOperationMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#clusteroperationmetadata). - * The cluster must be in a [`RUNNING`][google.cloud.dataproc.v1.ClusterStatus.State] state or an error + * The cluster must be in a + * [`RUNNING`][google.cloud.dataproc.v1.ClusterStatus.State] state or an error * is returned. * * @param string $projectId The ID of the Google Cloud Platform project the @@ -42,8 +43,10 @@ * @param string $region The Dataproc region in which to handle the request. * @param string $clusterName The cluster name. * @param string $clusterProjectId The Google Cloud Platform project ID that the cluster belongs to. - * @param string $clusterClusterName The cluster name. Cluster names within a project must be - * unique. Names of deleted clusters can be reused. + * @param string $clusterClusterName The cluster name, which must be unique within a project. + * The name must start with a lowercase letter, and can contain + * up to 51 lowercase letters, numbers, and hyphens. It cannot end + * with a hyphen. The name of a deleted cluster can be reused. */ function update_cluster_sample( string $projectId, diff --git a/Dataproc/samples/V1/NodeGroupControllerClient/create_node_group.php b/Dataproc/samples/V1/NodeGroupControllerClient/create_node_group.php new file mode 100644 index 000000000000..a8f6726d3c68 --- /dev/null +++ b/Dataproc/samples/V1/NodeGroupControllerClient/create_node_group.php @@ -0,0 +1,93 @@ +<?php +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* + * GENERATED CODE WARNING + * This file was automatically generated - do not edit! + */ + +require_once __DIR__ . '/../../../vendor/autoload.php'; + +// [START dataproc_v1_generated_NodeGroupController_CreateNodeGroup_sync] +use Google\ApiCore\ApiException; +use Google\ApiCore\OperationResponse; +use Google\Cloud\Dataproc\V1\NodeGroup; +use Google\Cloud\Dataproc\V1\NodeGroupControllerClient; +use Google\Cloud\Dataproc\V1\NodeGroup\Role; +use Google\Rpc\Status; + +/** + * Creates a node group in a cluster. The returned + * [Operation.metadata][google.longrunning.Operation.metadata] is + * [NodeGroupOperationMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#nodegroupoperationmetadata). + * + * @param string $formattedParent The parent resource where this node group will be created. + * Format: `projects/{project}/regions/{region}/clusters/{cluster}` + * Please see {@see NodeGroupControllerClient::clusterRegionName()} for help formatting this field. + * @param int $nodeGroupRolesElement Node group roles. + */ +function create_node_group_sample(string $formattedParent, int $nodeGroupRolesElement): void +{ + // Create a client. + $nodeGroupControllerClient = new NodeGroupControllerClient(); + + // Prepare any non-scalar elements to be passed along with the request. + $nodeGroupRoles = [$nodeGroupRolesElement,]; + $nodeGroup = (new NodeGroup()) + ->setRoles($nodeGroupRoles); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $nodeGroupControllerClient->createNodeGroup($formattedParent, $nodeGroup); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var NodeGroup $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = NodeGroupControllerClient::clusterRegionName( + '[PROJECT]', + '[REGION]', + '[CLUSTER]' + ); + $nodeGroupRolesElement = Role::ROLE_UNSPECIFIED; + + create_node_group_sample($formattedParent, $nodeGroupRolesElement); +} +// [END dataproc_v1_generated_NodeGroupController_CreateNodeGroup_sync] diff --git a/Dataproc/samples/V1/NodeGroupControllerClient/get_node_group.php b/Dataproc/samples/V1/NodeGroupControllerClient/get_node_group.php new file mode 100644 index 000000000000..b7c881040a71 --- /dev/null +++ b/Dataproc/samples/V1/NodeGroupControllerClient/get_node_group.php @@ -0,0 +1,74 @@ +<?php +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* + * GENERATED CODE WARNING + * This file was automatically generated - do not edit! + */ + +require_once __DIR__ . '/../../../vendor/autoload.php'; + +// [START dataproc_v1_generated_NodeGroupController_GetNodeGroup_sync] +use Google\ApiCore\ApiException; +use Google\Cloud\Dataproc\V1\NodeGroup; +use Google\Cloud\Dataproc\V1\NodeGroupControllerClient; + +/** + * Gets the resource representation for a node group in a + * cluster. + * + * @param string $formattedName The name of the node group to retrieve. + * Format: + * `projects/{project}/regions/{region}/clusters/{cluster}/nodeGroups/{nodeGroup}` + * Please see {@see NodeGroupControllerClient::nodeGroupName()} for help formatting this field. + */ +function get_node_group_sample(string $formattedName): void +{ + // Create a client. + $nodeGroupControllerClient = new NodeGroupControllerClient(); + + // Call the API and handle any network failures. + try { + /** @var NodeGroup $response */ + $response = $nodeGroupControllerClient->getNodeGroup($formattedName); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = NodeGroupControllerClient::nodeGroupName( + '[PROJECT]', + '[REGION]', + '[CLUSTER]', + '[NODE_GROUP]' + ); + + get_node_group_sample($formattedName); +} +// [END dataproc_v1_generated_NodeGroupController_GetNodeGroup_sync] diff --git a/Dataproc/samples/V1/NodeGroupControllerClient/resize_node_group.php b/Dataproc/samples/V1/NodeGroupControllerClient/resize_node_group.php new file mode 100644 index 000000000000..55b65d19d16a --- /dev/null +++ b/Dataproc/samples/V1/NodeGroupControllerClient/resize_node_group.php @@ -0,0 +1,85 @@ +<?php +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* + * GENERATED CODE WARNING + * This file was automatically generated - do not edit! + */ + +require_once __DIR__ . '/../../../vendor/autoload.php'; + +// [START dataproc_v1_generated_NodeGroupController_ResizeNodeGroup_sync] +use Google\ApiCore\ApiException; +use Google\ApiCore\OperationResponse; +use Google\Cloud\Dataproc\V1\NodeGroup; +use Google\Cloud\Dataproc\V1\NodeGroupControllerClient; +use Google\Rpc\Status; + +/** + * Resizes a node group in a cluster. The returned + * [Operation.metadata][google.longrunning.Operation.metadata] is + * [NodeGroupOperationMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#nodegroupoperationmetadata). + * + * @param string $name The name of the node group to resize. + * Format: + * `projects/{project}/regions/{region}/clusters/{cluster}/nodeGroups/{nodeGroup}` + * @param int $size The number of running instances for the node group to maintain. + * The group adds or removes instances to maintain the number of instances + * specified by this parameter. + */ +function resize_node_group_sample(string $name, int $size): void +{ + // Create a client. + $nodeGroupControllerClient = new NodeGroupControllerClient(); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $nodeGroupControllerClient->resizeNodeGroup($name, $size); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var NodeGroup $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $name = '[NAME]'; + $size = 0; + + resize_node_group_sample($name, $size); +} +// [END dataproc_v1_generated_NodeGroupController_ResizeNodeGroup_sync] diff --git a/Dataproc/src/V1/AuxiliaryNodeGroup.php b/Dataproc/src/V1/AuxiliaryNodeGroup.php new file mode 100644 index 000000000000..a64f09df28d9 --- /dev/null +++ b/Dataproc/src/V1/AuxiliaryNodeGroup.php @@ -0,0 +1,123 @@ +<?php +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: google/cloud/dataproc/v1/clusters.proto + +namespace Google\Cloud\Dataproc\V1; + +use Google\Protobuf\Internal\GPBType; +use Google\Protobuf\Internal\RepeatedField; +use Google\Protobuf\Internal\GPBUtil; + +/** + * Node group identification and configuration information. + * + * Generated from protobuf message <code>google.cloud.dataproc.v1.AuxiliaryNodeGroup</code> + */ +class AuxiliaryNodeGroup extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Node group configuration. + * + * Generated from protobuf field <code>.google.cloud.dataproc.v1.NodeGroup node_group = 1 [(.google.api.field_behavior) = REQUIRED];</code> + */ + private $node_group = null; + /** + * Optional. A node group ID. Generated if not specified. + * The ID must contain only letters (a-z, A-Z), numbers (0-9), + * underscores (_), and hyphens (-). Cannot begin or end with underscore + * or hyphen. Must consist of from 3 to 33 characters. + * + * Generated from protobuf field <code>string node_group_id = 2 [(.google.api.field_behavior) = OPTIONAL];</code> + */ + private $node_group_id = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Dataproc\V1\NodeGroup $node_group + * Required. Node group configuration. + * @type string $node_group_id + * Optional. A node group ID. Generated if not specified. + * The ID must contain only letters (a-z, A-Z), numbers (0-9), + * underscores (_), and hyphens (-). Cannot begin or end with underscore + * or hyphen. Must consist of from 3 to 33 characters. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dataproc\V1\Clusters::initOnce(); + parent::__construct($data); + } + + /** + * Required. Node group configuration. + * + * Generated from protobuf field <code>.google.cloud.dataproc.v1.NodeGroup node_group = 1 [(.google.api.field_behavior) = REQUIRED];</code> + * @return \Google\Cloud\Dataproc\V1\NodeGroup|null + */ + public function getNodeGroup() + { + return $this->node_group; + } + + public function hasNodeGroup() + { + return isset($this->node_group); + } + + public function clearNodeGroup() + { + unset($this->node_group); + } + + /** + * Required. Node group configuration. + * + * Generated from protobuf field <code>.google.cloud.dataproc.v1.NodeGroup node_group = 1 [(.google.api.field_behavior) = REQUIRED];</code> + * @param \Google\Cloud\Dataproc\V1\NodeGroup $var + * @return $this + */ + public function setNodeGroup($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dataproc\V1\NodeGroup::class); + $this->node_group = $var; + + return $this; + } + + /** + * Optional. A node group ID. Generated if not specified. + * The ID must contain only letters (a-z, A-Z), numbers (0-9), + * underscores (_), and hyphens (-). Cannot begin or end with underscore + * or hyphen. Must consist of from 3 to 33 characters. + * + * Generated from protobuf field <code>string node_group_id = 2 [(.google.api.field_behavior) = OPTIONAL];</code> + * @return string + */ + public function getNodeGroupId() + { + return $this->node_group_id; + } + + /** + * Optional. A node group ID. Generated if not specified. + * The ID must contain only letters (a-z, A-Z), numbers (0-9), + * underscores (_), and hyphens (-). Cannot begin or end with underscore + * or hyphen. Must consist of from 3 to 33 characters. + * + * Generated from protobuf field <code>string node_group_id = 2 [(.google.api.field_behavior) = OPTIONAL];</code> + * @param string $var + * @return $this + */ + public function setNodeGroupId($var) + { + GPBUtil::checkString($var, True); + $this->node_group_id = $var; + + return $this; + } + +} + diff --git a/Dataproc/src/V1/Cluster.php b/Dataproc/src/V1/Cluster.php index 328136f4b152..c528f6a49607 100644 --- a/Dataproc/src/V1/Cluster.php +++ b/Dataproc/src/V1/Cluster.php @@ -23,8 +23,10 @@ class Cluster extends \Google\Protobuf\Internal\Message */ private $project_id = ''; /** - * Required. The cluster name. Cluster names within a project must be - * unique. Names of deleted clusters can be reused. + * Required. The cluster name, which must be unique within a project. + * The name must start with a lowercase letter, and can contain + * up to 51 lowercase letters, numbers, and hyphens. It cannot end + * with a hyphen. The name of a deleted cluster can be reused. * * Generated from protobuf field <code>string cluster_name = 2 [(.google.api.field_behavior) = REQUIRED];</code> */ @@ -38,13 +40,15 @@ class Cluster extends \Google\Protobuf\Internal\Message */ private $config = null; /** - * Optional. The virtual cluster config, used when creating a Dataproc cluster that - * does not directly control the underlying compute resources, for example, - * when creating a [Dataproc-on-GKE - * cluster](https://cloud.google.com/dataproc/docs/concepts/jobs/dataproc-gke#create-a-dataproc-on-gke-cluster). - * Note that Dataproc may set default values, and values may change when - * clusters are updated. Exactly one of config or virtualClusterConfig must be - * specified. + * Optional. The virtual cluster config is used when creating a Dataproc + * cluster that does not directly control the underlying compute resources, + * for example, when creating a [Dataproc-on-GKE + * cluster](https://cloud.google.com/dataproc/docs/guides/dpgke/dataproc-gke). + * Dataproc may set default values, and values may change when + * clusters are updated. Exactly one of + * [config][google.cloud.dataproc.v1.Cluster.config] or + * [virtual_cluster_config][google.cloud.dataproc.v1.Cluster.virtual_cluster_config] + * must be specified. * * Generated from protobuf field <code>.google.cloud.dataproc.v1.VirtualClusterConfig virtual_cluster_config = 10 [(.google.api.field_behavior) = OPTIONAL];</code> */ @@ -98,20 +102,24 @@ class Cluster extends \Google\Protobuf\Internal\Message * @type string $project_id * Required. The Google Cloud Platform project ID that the cluster belongs to. * @type string $cluster_name - * Required. The cluster name. Cluster names within a project must be - * unique. Names of deleted clusters can be reused. + * Required. The cluster name, which must be unique within a project. + * The name must start with a lowercase letter, and can contain + * up to 51 lowercase letters, numbers, and hyphens. It cannot end + * with a hyphen. The name of a deleted cluster can be reused. * @type \Google\Cloud\Dataproc\V1\ClusterConfig $config * Optional. The cluster config for a cluster of Compute Engine Instances. * Note that Dataproc may set default values, and values may change * when clusters are updated. * @type \Google\Cloud\Dataproc\V1\VirtualClusterConfig $virtual_cluster_config - * Optional. The virtual cluster config, used when creating a Dataproc cluster that - * does not directly control the underlying compute resources, for example, - * when creating a [Dataproc-on-GKE - * cluster](https://cloud.google.com/dataproc/docs/concepts/jobs/dataproc-gke#create-a-dataproc-on-gke-cluster). - * Note that Dataproc may set default values, and values may change when - * clusters are updated. Exactly one of config or virtualClusterConfig must be - * specified. + * Optional. The virtual cluster config is used when creating a Dataproc + * cluster that does not directly control the underlying compute resources, + * for example, when creating a [Dataproc-on-GKE + * cluster](https://cloud.google.com/dataproc/docs/guides/dpgke/dataproc-gke). + * Dataproc may set default values, and values may change when + * clusters are updated. Exactly one of + * [config][google.cloud.dataproc.v1.Cluster.config] or + * [virtual_cluster_config][google.cloud.dataproc.v1.Cluster.virtual_cluster_config] + * must be specified. * @type array|\Google\Protobuf\Internal\MapField $labels * Optional. The labels to associate with this cluster. * Label **keys** must contain 1 to 63 characters, and must conform to @@ -165,8 +173,10 @@ public function setProjectId($var) } /** - * Required. The cluster name. Cluster names within a project must be - * unique. Names of deleted clusters can be reused. + * Required. The cluster name, which must be unique within a project. + * The name must start with a lowercase letter, and can contain + * up to 51 lowercase letters, numbers, and hyphens. It cannot end + * with a hyphen. The name of a deleted cluster can be reused. * * Generated from protobuf field <code>string cluster_name = 2 [(.google.api.field_behavior) = REQUIRED];</code> * @return string @@ -177,8 +187,10 @@ public function getClusterName() } /** - * Required. The cluster name. Cluster names within a project must be - * unique. Names of deleted clusters can be reused. + * Required. The cluster name, which must be unique within a project. + * The name must start with a lowercase letter, and can contain + * up to 51 lowercase letters, numbers, and hyphens. It cannot end + * with a hyphen. The name of a deleted cluster can be reused. * * Generated from protobuf field <code>string cluster_name = 2 [(.google.api.field_behavior) = REQUIRED];</code> * @param string $var @@ -233,13 +245,15 @@ public function setConfig($var) } /** - * Optional. The virtual cluster config, used when creating a Dataproc cluster that - * does not directly control the underlying compute resources, for example, - * when creating a [Dataproc-on-GKE - * cluster](https://cloud.google.com/dataproc/docs/concepts/jobs/dataproc-gke#create-a-dataproc-on-gke-cluster). - * Note that Dataproc may set default values, and values may change when - * clusters are updated. Exactly one of config or virtualClusterConfig must be - * specified. + * Optional. The virtual cluster config is used when creating a Dataproc + * cluster that does not directly control the underlying compute resources, + * for example, when creating a [Dataproc-on-GKE + * cluster](https://cloud.google.com/dataproc/docs/guides/dpgke/dataproc-gke). + * Dataproc may set default values, and values may change when + * clusters are updated. Exactly one of + * [config][google.cloud.dataproc.v1.Cluster.config] or + * [virtual_cluster_config][google.cloud.dataproc.v1.Cluster.virtual_cluster_config] + * must be specified. * * Generated from protobuf field <code>.google.cloud.dataproc.v1.VirtualClusterConfig virtual_cluster_config = 10 [(.google.api.field_behavior) = OPTIONAL];</code> * @return \Google\Cloud\Dataproc\V1\VirtualClusterConfig|null @@ -260,13 +274,15 @@ public function clearVirtualClusterConfig() } /** - * Optional. The virtual cluster config, used when creating a Dataproc cluster that - * does not directly control the underlying compute resources, for example, - * when creating a [Dataproc-on-GKE - * cluster](https://cloud.google.com/dataproc/docs/concepts/jobs/dataproc-gke#create-a-dataproc-on-gke-cluster). - * Note that Dataproc may set default values, and values may change when - * clusters are updated. Exactly one of config or virtualClusterConfig must be - * specified. + * Optional. The virtual cluster config is used when creating a Dataproc + * cluster that does not directly control the underlying compute resources, + * for example, when creating a [Dataproc-on-GKE + * cluster](https://cloud.google.com/dataproc/docs/guides/dpgke/dataproc-gke). + * Dataproc may set default values, and values may change when + * clusters are updated. Exactly one of + * [config][google.cloud.dataproc.v1.Cluster.config] or + * [virtual_cluster_config][google.cloud.dataproc.v1.Cluster.virtual_cluster_config] + * must be specified. * * Generated from protobuf field <code>.google.cloud.dataproc.v1.VirtualClusterConfig virtual_cluster_config = 10 [(.google.api.field_behavior) = OPTIONAL];</code> * @param \Google\Cloud\Dataproc\V1\VirtualClusterConfig $var diff --git a/Dataproc/src/V1/ClusterConfig.php b/Dataproc/src/V1/ClusterConfig.php index 0b41d82fe689..014a125ffcde 100644 --- a/Dataproc/src/V1/ClusterConfig.php +++ b/Dataproc/src/V1/ClusterConfig.php @@ -32,15 +32,13 @@ class ClusterConfig extends \Google\Protobuf\Internal\Message */ private $config_bucket = ''; /** - * Optional. A Cloud Storage bucket used to store ephemeral cluster and jobs data, - * such as Spark and MapReduce history files. - * If you do not specify a temp bucket, - * Dataproc will determine a Cloud Storage location (US, - * ASIA, or EU) for your cluster's temp bucket according to the - * Compute Engine zone where your cluster is deployed, and then create - * and manage this project-level, per-location bucket. The default bucket has - * a TTL of 90 days, but you can use any TTL (or none) if you specify a - * bucket (see + * Optional. A Cloud Storage bucket used to store ephemeral cluster and jobs + * data, such as Spark and MapReduce history files. If you do not specify a + * temp bucket, Dataproc will determine a Cloud Storage location (US, ASIA, or + * EU) for your cluster's temp bucket according to the Compute Engine zone + * where your cluster is deployed, and then create and manage this + * project-level, per-location bucket. The default bucket has a TTL of 90 + * days, but you can use any TTL (or none) if you specify a bucket (see * [Dataproc staging and temp * buckets](https://cloud.google.com/dataproc/docs/concepts/configuring-clusters/staging-bucket)). * **This field requires a Cloud Storage bucket name, not a `gs://...` URI to @@ -143,6 +141,12 @@ class ClusterConfig extends \Google\Protobuf\Internal\Message * Generated from protobuf field <code>.google.cloud.dataproc.v1.DataprocMetricConfig dataproc_metric_config = 23 [(.google.api.field_behavior) = OPTIONAL];</code> */ private $dataproc_metric_config = null; + /** + * Optional. The node group settings. + * + * Generated from protobuf field <code>repeated .google.cloud.dataproc.v1.AuxiliaryNodeGroup auxiliary_node_groups = 25 [(.google.api.field_behavior) = OPTIONAL];</code> + */ + private $auxiliary_node_groups; /** * Constructor. @@ -163,15 +167,13 @@ class ClusterConfig extends \Google\Protobuf\Internal\Message * **This field requires a Cloud Storage bucket name, not a `gs://...` URI to * a Cloud Storage bucket.** * @type string $temp_bucket - * Optional. A Cloud Storage bucket used to store ephemeral cluster and jobs data, - * such as Spark and MapReduce history files. - * If you do not specify a temp bucket, - * Dataproc will determine a Cloud Storage location (US, - * ASIA, or EU) for your cluster's temp bucket according to the - * Compute Engine zone where your cluster is deployed, and then create - * and manage this project-level, per-location bucket. The default bucket has - * a TTL of 90 days, but you can use any TTL (or none) if you specify a - * bucket (see + * Optional. A Cloud Storage bucket used to store ephemeral cluster and jobs + * data, such as Spark and MapReduce history files. If you do not specify a + * temp bucket, Dataproc will determine a Cloud Storage location (US, ASIA, or + * EU) for your cluster's temp bucket according to the Compute Engine zone + * where your cluster is deployed, and then create and manage this + * project-level, per-location bucket. The default bucket has a TTL of 90 + * days, but you can use any TTL (or none) if you specify a bucket (see * [Dataproc staging and temp * buckets](https://cloud.google.com/dataproc/docs/concepts/configuring-clusters/staging-bucket)). * **This field requires a Cloud Storage bucket name, not a `gs://...` URI to @@ -218,6 +220,8 @@ class ClusterConfig extends \Google\Protobuf\Internal\Message * Optional. Metastore configuration. * @type \Google\Cloud\Dataproc\V1\DataprocMetricConfig $dataproc_metric_config * Optional. The config for Dataproc metrics. + * @type array<\Google\Cloud\Dataproc\V1\AuxiliaryNodeGroup>|\Google\Protobuf\Internal\RepeatedField $auxiliary_node_groups + * Optional. The node group settings. * } */ public function __construct($data = NULL) { @@ -272,15 +276,13 @@ public function setConfigBucket($var) } /** - * Optional. A Cloud Storage bucket used to store ephemeral cluster and jobs data, - * such as Spark and MapReduce history files. - * If you do not specify a temp bucket, - * Dataproc will determine a Cloud Storage location (US, - * ASIA, or EU) for your cluster's temp bucket according to the - * Compute Engine zone where your cluster is deployed, and then create - * and manage this project-level, per-location bucket. The default bucket has - * a TTL of 90 days, but you can use any TTL (or none) if you specify a - * bucket (see + * Optional. A Cloud Storage bucket used to store ephemeral cluster and jobs + * data, such as Spark and MapReduce history files. If you do not specify a + * temp bucket, Dataproc will determine a Cloud Storage location (US, ASIA, or + * EU) for your cluster's temp bucket according to the Compute Engine zone + * where your cluster is deployed, and then create and manage this + * project-level, per-location bucket. The default bucket has a TTL of 90 + * days, but you can use any TTL (or none) if you specify a bucket (see * [Dataproc staging and temp * buckets](https://cloud.google.com/dataproc/docs/concepts/configuring-clusters/staging-bucket)). * **This field requires a Cloud Storage bucket name, not a `gs://...` URI to @@ -295,15 +297,13 @@ public function getTempBucket() } /** - * Optional. A Cloud Storage bucket used to store ephemeral cluster and jobs data, - * such as Spark and MapReduce history files. - * If you do not specify a temp bucket, - * Dataproc will determine a Cloud Storage location (US, - * ASIA, or EU) for your cluster's temp bucket according to the - * Compute Engine zone where your cluster is deployed, and then create - * and manage this project-level, per-location bucket. The default bucket has - * a TTL of 90 days, but you can use any TTL (or none) if you specify a - * bucket (see + * Optional. A Cloud Storage bucket used to store ephemeral cluster and jobs + * data, such as Spark and MapReduce history files. If you do not specify a + * temp bucket, Dataproc will determine a Cloud Storage location (US, ASIA, or + * EU) for your cluster's temp bucket according to the Compute Engine zone + * where your cluster is deployed, and then create and manage this + * project-level, per-location bucket. The default bucket has a TTL of 90 + * days, but you can use any TTL (or none) if you specify a bucket (see * [Dataproc staging and temp * buckets](https://cloud.google.com/dataproc/docs/concepts/configuring-clusters/staging-bucket)). * **This field requires a Cloud Storage bucket name, not a `gs://...` URI to @@ -811,5 +811,31 @@ public function setDataprocMetricConfig($var) return $this; } + /** + * Optional. The node group settings. + * + * Generated from protobuf field <code>repeated .google.cloud.dataproc.v1.AuxiliaryNodeGroup auxiliary_node_groups = 25 [(.google.api.field_behavior) = OPTIONAL];</code> + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getAuxiliaryNodeGroups() + { + return $this->auxiliary_node_groups; + } + + /** + * Optional. The node group settings. + * + * Generated from protobuf field <code>repeated .google.cloud.dataproc.v1.AuxiliaryNodeGroup auxiliary_node_groups = 25 [(.google.api.field_behavior) = OPTIONAL];</code> + * @param array<\Google\Cloud\Dataproc\V1\AuxiliaryNodeGroup>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setAuxiliaryNodeGroups($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dataproc\V1\AuxiliaryNodeGroup::class); + $this->auxiliary_node_groups = $arr; + + return $this; + } + } diff --git a/Dataproc/src/V1/ClusterControllerGrpcClient.php b/Dataproc/src/V1/ClusterControllerGrpcClient.php index 75f2d0f28c7a..f911d98d0a71 100644 --- a/Dataproc/src/V1/ClusterControllerGrpcClient.php +++ b/Dataproc/src/V1/ClusterControllerGrpcClient.php @@ -54,7 +54,8 @@ public function CreateCluster(\Google\Cloud\Dataproc\V1\CreateClusterRequest $ar * Updates a cluster in a project. The returned * [Operation.metadata][google.longrunning.Operation.metadata] will be * [ClusterOperationMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#clusteroperationmetadata). - * The cluster must be in a [`RUNNING`][google.cloud.dataproc.v1.ClusterStatus.State] state or an error + * The cluster must be in a + * [`RUNNING`][google.cloud.dataproc.v1.ClusterStatus.State] state or an error * is returned. * @param \Google\Cloud\Dataproc\V1\UpdateClusterRequest $argument input argument * @param array $metadata metadata diff --git a/Dataproc/src/V1/ConfidentialInstanceConfig.php b/Dataproc/src/V1/ConfidentialInstanceConfig.php index 4143a2e7368e..0f442241ddfa 100644 --- a/Dataproc/src/V1/ConfidentialInstanceConfig.php +++ b/Dataproc/src/V1/ConfidentialInstanceConfig.php @@ -17,7 +17,8 @@ class ConfidentialInstanceConfig extends \Google\Protobuf\Internal\Message { /** - * Optional. Defines whether the instance should have confidential compute enabled. + * Optional. Defines whether the instance should have confidential compute + * enabled. * * Generated from protobuf field <code>bool enable_confidential_compute = 1 [(.google.api.field_behavior) = OPTIONAL];</code> */ @@ -30,7 +31,8 @@ class ConfidentialInstanceConfig extends \Google\Protobuf\Internal\Message * Optional. Data for populating the Message object. * * @type bool $enable_confidential_compute - * Optional. Defines whether the instance should have confidential compute enabled. + * Optional. Defines whether the instance should have confidential compute + * enabled. * } */ public function __construct($data = NULL) { @@ -39,7 +41,8 @@ public function __construct($data = NULL) { } /** - * Optional. Defines whether the instance should have confidential compute enabled. + * Optional. Defines whether the instance should have confidential compute + * enabled. * * Generated from protobuf field <code>bool enable_confidential_compute = 1 [(.google.api.field_behavior) = OPTIONAL];</code> * @return bool @@ -50,7 +53,8 @@ public function getEnableConfidentialCompute() } /** - * Optional. Defines whether the instance should have confidential compute enabled. + * Optional. Defines whether the instance should have confidential compute + * enabled. * * Generated from protobuf field <code>bool enable_confidential_compute = 1 [(.google.api.field_behavior) = OPTIONAL];</code> * @param bool $var diff --git a/Dataproc/src/V1/CreateClusterRequest.php b/Dataproc/src/V1/CreateClusterRequest.php index 03bc6c9a6f9b..7278efc446aa 100644 --- a/Dataproc/src/V1/CreateClusterRequest.php +++ b/Dataproc/src/V1/CreateClusterRequest.php @@ -35,11 +35,12 @@ class CreateClusterRequest extends \Google\Protobuf\Internal\Message */ private $cluster = null; /** - * Optional. A unique ID used to identify the request. If the server receives two + * Optional. A unique ID used to identify the request. If the server receives + * two * [CreateClusterRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.CreateClusterRequest)s * with the same id, then the second request will be ignored and the - * first [google.longrunning.Operation][google.longrunning.Operation] created and stored in the backend - * is returned. + * first [google.longrunning.Operation][google.longrunning.Operation] created + * and stored in the backend is returned. * It is recommended to always set this value to a * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier). * The ID must contain only letters (a-z, A-Z), numbers (0-9), @@ -69,11 +70,12 @@ class CreateClusterRequest extends \Google\Protobuf\Internal\Message * @type \Google\Cloud\Dataproc\V1\Cluster $cluster * Required. The cluster to create. * @type string $request_id - * Optional. A unique ID used to identify the request. If the server receives two + * Optional. A unique ID used to identify the request. If the server receives + * two * [CreateClusterRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.CreateClusterRequest)s * with the same id, then the second request will be ignored and the - * first [google.longrunning.Operation][google.longrunning.Operation] created and stored in the backend - * is returned. + * first [google.longrunning.Operation][google.longrunning.Operation] created + * and stored in the backend is returned. * It is recommended to always set this value to a * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier). * The ID must contain only letters (a-z, A-Z), numbers (0-9), @@ -178,11 +180,12 @@ public function setCluster($var) } /** - * Optional. A unique ID used to identify the request. If the server receives two + * Optional. A unique ID used to identify the request. If the server receives + * two * [CreateClusterRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.CreateClusterRequest)s * with the same id, then the second request will be ignored and the - * first [google.longrunning.Operation][google.longrunning.Operation] created and stored in the backend - * is returned. + * first [google.longrunning.Operation][google.longrunning.Operation] created + * and stored in the backend is returned. * It is recommended to always set this value to a * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier). * The ID must contain only letters (a-z, A-Z), numbers (0-9), @@ -197,11 +200,12 @@ public function getRequestId() } /** - * Optional. A unique ID used to identify the request. If the server receives two + * Optional. A unique ID used to identify the request. If the server receives + * two * [CreateClusterRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.CreateClusterRequest)s * with the same id, then the second request will be ignored and the - * first [google.longrunning.Operation][google.longrunning.Operation] created and stored in the backend - * is returned. + * first [google.longrunning.Operation][google.longrunning.Operation] created + * and stored in the backend is returned. * It is recommended to always set this value to a * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier). * The ID must contain only letters (a-z, A-Z), numbers (0-9), diff --git a/Dataproc/src/V1/CreateNodeGroupRequest.php b/Dataproc/src/V1/CreateNodeGroupRequest.php new file mode 100644 index 000000000000..0387479c75c7 --- /dev/null +++ b/Dataproc/src/V1/CreateNodeGroupRequest.php @@ -0,0 +1,231 @@ +<?php +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: google/cloud/dataproc/v1/node_groups.proto + +namespace Google\Cloud\Dataproc\V1; + +use Google\Protobuf\Internal\GPBType; +use Google\Protobuf\Internal\RepeatedField; +use Google\Protobuf\Internal\GPBUtil; + +/** + * A request to create a node group. + * + * Generated from protobuf message <code>google.cloud.dataproc.v1.CreateNodeGroupRequest</code> + */ +class CreateNodeGroupRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The parent resource where this node group will be created. + * Format: `projects/{project}/regions/{region}/clusters/{cluster}` + * + * Generated from protobuf field <code>string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {</code> + */ + private $parent = ''; + /** + * Required. The node group to create. + * + * Generated from protobuf field <code>.google.cloud.dataproc.v1.NodeGroup node_group = 2 [(.google.api.field_behavior) = REQUIRED];</code> + */ + private $node_group = null; + /** + * Optional. An optional node group ID. Generated if not specified. + * The ID must contain only letters (a-z, A-Z), numbers (0-9), + * underscores (_), and hyphens (-). Cannot begin or end with underscore + * or hyphen. Must consist of from 3 to 33 characters. + * + * Generated from protobuf field <code>string node_group_id = 4 [(.google.api.field_behavior) = OPTIONAL];</code> + */ + private $node_group_id = ''; + /** + * Optional. A unique ID used to identify the request. If the server receives + * two + * [CreateNodeGroupRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.CreateNodeGroupRequests) + * with the same ID, the second request is ignored and the + * first [google.longrunning.Operation][google.longrunning.Operation] created + * and stored in the backend is returned. + * Recommendation: Set this value to a + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier). + * The ID must contain only letters (a-z, A-Z), numbers (0-9), + * underscores (_), and hyphens (-). The maximum length is 40 characters. + * + * Generated from protobuf field <code>string request_id = 3 [(.google.api.field_behavior) = OPTIONAL];</code> + */ + private $request_id = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The parent resource where this node group will be created. + * Format: `projects/{project}/regions/{region}/clusters/{cluster}` + * @type \Google\Cloud\Dataproc\V1\NodeGroup $node_group + * Required. The node group to create. + * @type string $node_group_id + * Optional. An optional node group ID. Generated if not specified. + * The ID must contain only letters (a-z, A-Z), numbers (0-9), + * underscores (_), and hyphens (-). Cannot begin or end with underscore + * or hyphen. Must consist of from 3 to 33 characters. + * @type string $request_id + * Optional. A unique ID used to identify the request. If the server receives + * two + * [CreateNodeGroupRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.CreateNodeGroupRequests) + * with the same ID, the second request is ignored and the + * first [google.longrunning.Operation][google.longrunning.Operation] created + * and stored in the backend is returned. + * Recommendation: Set this value to a + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier). + * The ID must contain only letters (a-z, A-Z), numbers (0-9), + * underscores (_), and hyphens (-). The maximum length is 40 characters. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dataproc\V1\NodeGroups::initOnce(); + parent::__construct($data); + } + + /** + * Required. The parent resource where this node group will be created. + * Format: `projects/{project}/regions/{region}/clusters/{cluster}` + * + * Generated from protobuf field <code>string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {</code> + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The parent resource where this node group will be created. + * Format: `projects/{project}/regions/{region}/clusters/{cluster}` + * + * Generated from protobuf field <code>string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {</code> + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Required. The node group to create. + * + * Generated from protobuf field <code>.google.cloud.dataproc.v1.NodeGroup node_group = 2 [(.google.api.field_behavior) = REQUIRED];</code> + * @return \Google\Cloud\Dataproc\V1\NodeGroup|null + */ + public function getNodeGroup() + { + return $this->node_group; + } + + public function hasNodeGroup() + { + return isset($this->node_group); + } + + public function clearNodeGroup() + { + unset($this->node_group); + } + + /** + * Required. The node group to create. + * + * Generated from protobuf field <code>.google.cloud.dataproc.v1.NodeGroup node_group = 2 [(.google.api.field_behavior) = REQUIRED];</code> + * @param \Google\Cloud\Dataproc\V1\NodeGroup $var + * @return $this + */ + public function setNodeGroup($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dataproc\V1\NodeGroup::class); + $this->node_group = $var; + + return $this; + } + + /** + * Optional. An optional node group ID. Generated if not specified. + * The ID must contain only letters (a-z, A-Z), numbers (0-9), + * underscores (_), and hyphens (-). Cannot begin or end with underscore + * or hyphen. Must consist of from 3 to 33 characters. + * + * Generated from protobuf field <code>string node_group_id = 4 [(.google.api.field_behavior) = OPTIONAL];</code> + * @return string + */ + public function getNodeGroupId() + { + return $this->node_group_id; + } + + /** + * Optional. An optional node group ID. Generated if not specified. + * The ID must contain only letters (a-z, A-Z), numbers (0-9), + * underscores (_), and hyphens (-). Cannot begin or end with underscore + * or hyphen. Must consist of from 3 to 33 characters. + * + * Generated from protobuf field <code>string node_group_id = 4 [(.google.api.field_behavior) = OPTIONAL];</code> + * @param string $var + * @return $this + */ + public function setNodeGroupId($var) + { + GPBUtil::checkString($var, True); + $this->node_group_id = $var; + + return $this; + } + + /** + * Optional. A unique ID used to identify the request. If the server receives + * two + * [CreateNodeGroupRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.CreateNodeGroupRequests) + * with the same ID, the second request is ignored and the + * first [google.longrunning.Operation][google.longrunning.Operation] created + * and stored in the backend is returned. + * Recommendation: Set this value to a + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier). + * The ID must contain only letters (a-z, A-Z), numbers (0-9), + * underscores (_), and hyphens (-). The maximum length is 40 characters. + * + * Generated from protobuf field <code>string request_id = 3 [(.google.api.field_behavior) = OPTIONAL];</code> + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. A unique ID used to identify the request. If the server receives + * two + * [CreateNodeGroupRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.CreateNodeGroupRequests) + * with the same ID, the second request is ignored and the + * first [google.longrunning.Operation][google.longrunning.Operation] created + * and stored in the backend is returned. + * Recommendation: Set this value to a + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier). + * The ID must contain only letters (a-z, A-Z), numbers (0-9), + * underscores (_), and hyphens (-). The maximum length is 40 characters. + * + * Generated from protobuf field <code>string request_id = 3 [(.google.api.field_behavior) = OPTIONAL];</code> + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + +} + diff --git a/Dataproc/src/V1/DeleteClusterRequest.php b/Dataproc/src/V1/DeleteClusterRequest.php index 47e552acd07c..071d8ad7fdbb 100644 --- a/Dataproc/src/V1/DeleteClusterRequest.php +++ b/Dataproc/src/V1/DeleteClusterRequest.php @@ -46,8 +46,8 @@ class DeleteClusterRequest extends \Google\Protobuf\Internal\Message * receives two * [DeleteClusterRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.DeleteClusterRequest)s * with the same id, then the second request will be ignored and the - * first [google.longrunning.Operation][google.longrunning.Operation] created and stored in the - * backend is returned. + * first [google.longrunning.Operation][google.longrunning.Operation] created + * and stored in the backend is returned. * It is recommended to always set this value to a * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier). * The ID must contain only letters (a-z, A-Z), numbers (0-9), @@ -78,8 +78,8 @@ class DeleteClusterRequest extends \Google\Protobuf\Internal\Message * receives two * [DeleteClusterRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.DeleteClusterRequest)s * with the same id, then the second request will be ignored and the - * first [google.longrunning.Operation][google.longrunning.Operation] created and stored in the - * backend is returned. + * first [google.longrunning.Operation][google.longrunning.Operation] created + * and stored in the backend is returned. * It is recommended to always set this value to a * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier). * The ID must contain only letters (a-z, A-Z), numbers (0-9), @@ -204,8 +204,8 @@ public function setClusterUuid($var) * receives two * [DeleteClusterRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.DeleteClusterRequest)s * with the same id, then the second request will be ignored and the - * first [google.longrunning.Operation][google.longrunning.Operation] created and stored in the - * backend is returned. + * first [google.longrunning.Operation][google.longrunning.Operation] created + * and stored in the backend is returned. * It is recommended to always set this value to a * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier). * The ID must contain only letters (a-z, A-Z), numbers (0-9), @@ -224,8 +224,8 @@ public function getRequestId() * receives two * [DeleteClusterRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.DeleteClusterRequest)s * with the same id, then the second request will be ignored and the - * first [google.longrunning.Operation][google.longrunning.Operation] created and stored in the - * backend is returned. + * first [google.longrunning.Operation][google.longrunning.Operation] created + * and stored in the backend is returned. * It is recommended to always set this value to a * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier). * The ID must contain only letters (a-z, A-Z), numbers (0-9), diff --git a/Dataproc/src/V1/DiskConfig.php b/Dataproc/src/V1/DiskConfig.php index b3e2333ee340..f731e3be9304 100644 --- a/Dataproc/src/V1/DiskConfig.php +++ b/Dataproc/src/V1/DiskConfig.php @@ -32,7 +32,7 @@ class DiskConfig extends \Google\Protobuf\Internal\Message */ private $boot_disk_size_gb = 0; /** - * Optional. Number of attached SSDs, from 0 to 4 (default is 0). + * Optional. Number of attached SSDs, from 0 to 8 (default is 0). * If SSDs are not attached, the boot disk is used to store runtime logs and * [HDFS](https://hadoop.apache.org/docs/r1.2.1/hdfs_user_guide.html) data. * If one or more SSDs are attached, this runtime bulk @@ -68,7 +68,7 @@ class DiskConfig extends \Google\Protobuf\Internal\Message * @type int $boot_disk_size_gb * Optional. Size in GB of the boot disk (default is 500GB). * @type int $num_local_ssds - * Optional. Number of attached SSDs, from 0 to 4 (default is 0). + * Optional. Number of attached SSDs, from 0 to 8 (default is 0). * If SSDs are not attached, the boot disk is used to store runtime logs and * [HDFS](https://hadoop.apache.org/docs/r1.2.1/hdfs_user_guide.html) data. * If one or more SSDs are attached, this runtime bulk @@ -148,7 +148,7 @@ public function setBootDiskSizeGb($var) } /** - * Optional. Number of attached SSDs, from 0 to 4 (default is 0). + * Optional. Number of attached SSDs, from 0 to 8 (default is 0). * If SSDs are not attached, the boot disk is used to store runtime logs and * [HDFS](https://hadoop.apache.org/docs/r1.2.1/hdfs_user_guide.html) data. * If one or more SSDs are attached, this runtime bulk @@ -164,7 +164,7 @@ public function getNumLocalSsds() } /** - * Optional. Number of attached SSDs, from 0 to 4 (default is 0). + * Optional. Number of attached SSDs, from 0 to 8 (default is 0). * If SSDs are not attached, the boot disk is used to store runtime logs and * [HDFS](https://hadoop.apache.org/docs/r1.2.1/hdfs_user_guide.html) data. * If one or more SSDs are attached, this runtime bulk diff --git a/Dataproc/src/V1/DriverSchedulingConfig.php b/Dataproc/src/V1/DriverSchedulingConfig.php new file mode 100644 index 000000000000..5fd3f2633226 --- /dev/null +++ b/Dataproc/src/V1/DriverSchedulingConfig.php @@ -0,0 +1,101 @@ +<?php +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: google/cloud/dataproc/v1/jobs.proto + +namespace Google\Cloud\Dataproc\V1; + +use Google\Protobuf\Internal\GPBType; +use Google\Protobuf\Internal\RepeatedField; +use Google\Protobuf\Internal\GPBUtil; + +/** + * Driver scheduling configuration. + * + * Generated from protobuf message <code>google.cloud.dataproc.v1.DriverSchedulingConfig</code> + */ +class DriverSchedulingConfig extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The amount of memory in MB the driver is requesting. + * + * Generated from protobuf field <code>int32 memory_mb = 1 [(.google.api.field_behavior) = REQUIRED];</code> + */ + private $memory_mb = 0; + /** + * Required. The number of vCPUs the driver is requesting. + * + * Generated from protobuf field <code>int32 vcores = 2 [(.google.api.field_behavior) = REQUIRED];</code> + */ + private $vcores = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $memory_mb + * Required. The amount of memory in MB the driver is requesting. + * @type int $vcores + * Required. The number of vCPUs the driver is requesting. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dataproc\V1\Jobs::initOnce(); + parent::__construct($data); + } + + /** + * Required. The amount of memory in MB the driver is requesting. + * + * Generated from protobuf field <code>int32 memory_mb = 1 [(.google.api.field_behavior) = REQUIRED];</code> + * @return int + */ + public function getMemoryMb() + { + return $this->memory_mb; + } + + /** + * Required. The amount of memory in MB the driver is requesting. + * + * Generated from protobuf field <code>int32 memory_mb = 1 [(.google.api.field_behavior) = REQUIRED];</code> + * @param int $var + * @return $this + */ + public function setMemoryMb($var) + { + GPBUtil::checkInt32($var); + $this->memory_mb = $var; + + return $this; + } + + /** + * Required. The number of vCPUs the driver is requesting. + * + * Generated from protobuf field <code>int32 vcores = 2 [(.google.api.field_behavior) = REQUIRED];</code> + * @return int + */ + public function getVcores() + { + return $this->vcores; + } + + /** + * Required. The number of vCPUs the driver is requesting. + * + * Generated from protobuf field <code>int32 vcores = 2 [(.google.api.field_behavior) = REQUIRED];</code> + * @param int $var + * @return $this + */ + public function setVcores($var) + { + GPBUtil::checkInt32($var); + $this->vcores = $var; + + return $this; + } + +} + diff --git a/Dataproc/src/V1/Gapic/ClusterControllerGapicClient.php b/Dataproc/src/V1/Gapic/ClusterControllerGapicClient.php index 79106a9ed9a8..49f74b3fd199 100644 --- a/Dataproc/src/V1/Gapic/ClusterControllerGapicClient.php +++ b/Dataproc/src/V1/Gapic/ClusterControllerGapicClient.php @@ -277,11 +277,12 @@ public function __construct(array $options = []) * Optional. * * @type string $requestId - * Optional. A unique ID used to identify the request. If the server receives two + * Optional. A unique ID used to identify the request. If the server receives + * two * [CreateClusterRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.CreateClusterRequest)s * with the same id, then the second request will be ignored and the - * first [google.longrunning.Operation][google.longrunning.Operation] created and stored in the backend - * is returned. + * first [google.longrunning.Operation][google.longrunning.Operation] created + * and stored in the backend is returned. * * It is recommended to always set this value to a * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier). @@ -379,8 +380,8 @@ public function createCluster($projectId, $region, $cluster, array $optionalArgs * receives two * [DeleteClusterRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.DeleteClusterRequest)s * with the same id, then the second request will be ignored and the - * first [google.longrunning.Operation][google.longrunning.Operation] created and stored in the - * backend is returned. + * first [google.longrunning.Operation][google.longrunning.Operation] created + * and stored in the backend is returned. * * It is recommended to always set this value to a * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier). @@ -700,8 +701,8 @@ public function listClusters($projectId, $region, array $optionalArgs = []) * receives two * [StartClusterRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.StartClusterRequest)s * with the same id, then the second request will be ignored and the - * first [google.longrunning.Operation][google.longrunning.Operation] created and stored in the - * backend is returned. + * first [google.longrunning.Operation][google.longrunning.Operation] created + * and stored in the backend is returned. * * Recommendation: Set this value to a * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier). @@ -797,8 +798,8 @@ public function startCluster($projectId, $region, $clusterName, array $optionalA * receives two * [StopClusterRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.StopClusterRequest)s * with the same id, then the second request will be ignored and the - * first [google.longrunning.Operation][google.longrunning.Operation] created and stored in the - * backend is returned. + * first [google.longrunning.Operation][google.longrunning.Operation] created + * and stored in the backend is returned. * * Recommendation: Set this value to a * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier). @@ -842,7 +843,8 @@ public function stopCluster($projectId, $region, $clusterName, array $optionalAr * Updates a cluster in a project. The returned * [Operation.metadata][google.longrunning.Operation.metadata] will be * [ClusterOperationMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#clusteroperationmetadata). - * The cluster must be in a [`RUNNING`][google.cloud.dataproc.v1.ClusterStatus.State] state or an error + * The cluster must be in a + * [`RUNNING`][google.cloud.dataproc.v1.ClusterStatus.State] state or an error * is returned. * * Sample code: @@ -959,8 +961,8 @@ public function stopCluster($projectId, $region, $clusterName, array $optionalAr * receives two * [UpdateClusterRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.UpdateClusterRequest)s * with the same id, then the second request will be ignored and the - * first [google.longrunning.Operation][google.longrunning.Operation] created and stored in the - * backend is returned. + * first [google.longrunning.Operation][google.longrunning.Operation] created + * and stored in the backend is returned. * * It is recommended to always set this value to a * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier). diff --git a/Dataproc/src/V1/Gapic/NodeGroupControllerGapicClient.php b/Dataproc/src/V1/Gapic/NodeGroupControllerGapicClient.php new file mode 100644 index 000000000000..6d1ffe182c90 --- /dev/null +++ b/Dataproc/src/V1/Gapic/NodeGroupControllerGapicClient.php @@ -0,0 +1,589 @@ +<?php +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* + * GENERATED CODE WARNING + * Generated by gapic-generator-php from the file + * https://github.com/googleapis/googleapis/blob/master/google/cloud/dataproc/v1/node_groups.proto + * Updates to the above are reflected here through a refresh process. + */ + +namespace Google\Cloud\Dataproc\V1\Gapic; + +use Google\ApiCore\ApiException; +use Google\ApiCore\CredentialsWrapper; +use Google\ApiCore\GapicClientTrait; +use Google\ApiCore\LongRunning\OperationsClient; +use Google\ApiCore\OperationResponse; +use Google\ApiCore\PathTemplate; +use Google\ApiCore\RequestParamsHeaderDescriptor; +use Google\ApiCore\RetrySettings; +use Google\ApiCore\Transport\TransportInterface; +use Google\ApiCore\ValidationException; +use Google\Auth\FetchAuthTokenInterface; +use Google\Cloud\Dataproc\V1\CreateNodeGroupRequest; +use Google\Cloud\Dataproc\V1\GetNodeGroupRequest; +use Google\Cloud\Dataproc\V1\NodeGroup; +use Google\Cloud\Dataproc\V1\NodeGroupOperationMetadata; +use Google\Cloud\Dataproc\V1\ResizeNodeGroupRequest; +use Google\LongRunning\Operation; +use Google\Protobuf\Duration; + +/** + * Service Description: The `NodeGroupControllerService` provides methods to manage node groups + * of Compute Engine managed instances. + * + * This class provides the ability to make remote calls to the backing service through method + * calls that map to API methods. Sample code to get started: + * + * ``` + * $nodeGroupControllerClient = new NodeGroupControllerClient(); + * try { + * $formattedParent = $nodeGroupControllerClient->clusterRegionName('[PROJECT]', '[REGION]', '[CLUSTER]'); + * $nodeGroup = new NodeGroup(); + * $operationResponse = $nodeGroupControllerClient->createNodeGroup($formattedParent, $nodeGroup); + * $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 = $nodeGroupControllerClient->createNodeGroup($formattedParent, $nodeGroup); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $nodeGroupControllerClient->resumeOperation($operationName, 'createNodeGroup'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $nodeGroupControllerClient->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. + */ +class NodeGroupControllerGapicClient +{ + use GapicClientTrait; + + /** The name of the service. */ + const SERVICE_NAME = 'google.cloud.dataproc.v1.NodeGroupController'; + + /** The default address of the service. */ + const SERVICE_ADDRESS = 'dataproc.googleapis.com'; + + /** 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 $clusterRegionNameTemplate; + + private static $nodeGroupNameTemplate; + + 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/node_group_controller_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/node_group_controller_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/node_group_controller_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/node_group_controller_rest_client_config.php', + ], + ], + ]; + } + + private static function getClusterRegionNameTemplate() + { + if (self::$clusterRegionNameTemplate == null) { + self::$clusterRegionNameTemplate = new PathTemplate('projects/{project}/regions/{region}/clusters/{cluster}'); + } + + return self::$clusterRegionNameTemplate; + } + + private static function getNodeGroupNameTemplate() + { + if (self::$nodeGroupNameTemplate == null) { + self::$nodeGroupNameTemplate = new PathTemplate('projects/{project}/regions/{region}/clusters/{cluster}/nodeGroups/{node_group}'); + } + + return self::$nodeGroupNameTemplate; + } + + private static function getPathTemplateMap() + { + if (self::$pathTemplateMap == null) { + self::$pathTemplateMap = [ + 'clusterRegion' => self::getClusterRegionNameTemplate(), + 'nodeGroup' => self::getNodeGroupNameTemplate(), + ]; + } + + return self::$pathTemplateMap; + } + + /** + * Formats a string containing the fully-qualified path to represent a + * cluster_region resource. + * + * @param string $project + * @param string $region + * @param string $cluster + * + * @return string The formatted cluster_region resource. + */ + public static function clusterRegionName($project, $region, $cluster) + { + return self::getClusterRegionNameTemplate()->render([ + 'project' => $project, + 'region' => $region, + 'cluster' => $cluster, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a node_group + * resource. + * + * @param string $project + * @param string $region + * @param string $cluster + * @param string $nodeGroup + * + * @return string The formatted node_group resource. + */ + public static function nodeGroupName($project, $region, $cluster, $nodeGroup) + { + return self::getNodeGroupNameTemplate()->render([ + 'project' => $project, + 'region' => $region, + 'cluster' => $cluster, + 'node_group' => $nodeGroup, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - clusterRegion: projects/{project}/regions/{region}/clusters/{cluster} + * - nodeGroup: projects/{project}/regions/{region}/clusters/{cluster}/nodeGroups/{node_group} + * + * The optional $template argument can be supplied to specify a particular pattern, + * and must match one of the templates listed above. If no $template argument is + * provided, or if the $template argument does not match one of the templates + * listed, then parseName will check each of the supported templates, and return + * the first match. + * + * @param string $formattedName The formatted name string + * @param string $template Optional name of template to match + * + * @return array An associative array from name component IDs to component values. + * + * @throws ValidationException If $formattedName could not be matched. + */ + public static function parseName($formattedName, $template = null) + { + $templateMap = self::getPathTemplateMap(); + if ($template) { + if (!isset($templateMap[$template])) { + throw new ValidationException("Template name $template does not exist"); + } + + return $templateMap[$template]->match($formattedName); + } + + foreach ($templateMap as $templateName => $pathTemplate) { + try { + return $pathTemplate->match($formattedName); + } catch (ValidationException $ex) { + // Swallow the exception to continue trying other path templates + } + } + + throw new ValidationException("Input did not match any known format. Input: $formattedName"); + } + + /** + * Return an OperationsClient object with the same endpoint as $this. + * + * @return OperationsClient + */ + public function getOperationsClient() + { + return $this->operationsClient; + } + + /** + * Resume an existing long running operation that was previously started by a long + * running API method. If $methodName is not provided, or does not match a long + * running API method, then the operation can still be resumed, but the + * OperationResponse object will not deserialize the final response. + * + * @param string $operationName The name of the long running operation + * @param string $methodName The name of the method used to start the operation + * + * @return OperationResponse + */ + public function resumeOperation($operationName, $methodName = null) + { + $options = isset($this->descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : []; + $operation = new OperationResponse($operationName, $this->getOperationsClient(), $options); + $operation->reload(); + return $operation; + } + + /** + * Constructor. + * + * @param array $options { + * Optional. Options for configuring the service API wrapper. + * + * @type string $apiEndpoint + * The address of the API remote host. May optionally include the port, formatted + * as "<uri>:<port>". Default 'dataproc.googleapis.com:443'. + * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials + * The credentials to be used by the client to authorize API calls. This option + * accepts either a path to a credentials file, or a decoded credentials file as a + * PHP array. + * *Advanced usage*: In addition, this option can also accept a pre-constructed + * {@see \Google\Auth\FetchAuthTokenInterface} object or + * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these + * objects are provided, any settings in $credentialsConfig will be ignored. + * @type array $credentialsConfig + * Options used to configure credentials, including auth token caching, for the + * client. For a full list of supporting configuration options, see + * {@see \Google\ApiCore\CredentialsWrapper::build()} . + * @type bool $disableRetries + * Determines whether or not retries defined by the client configuration should be + * disabled. Defaults to `false`. + * @type string|array $clientConfig + * Client method configuration, including retry settings. This option can be either + * a path to a JSON file, or a PHP array containing the decoded JSON data. By + * default this settings points to the default client config file, which is + * provided in the resources folder. + * @type string|TransportInterface $transport + * The transport used for executing network requests. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *Advanced usage*: Additionally, it is possible to pass in an already + * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note + * that when this object is provided, any settings in $transportConfig, and any + * $apiEndpoint setting, will be ignored. + * @type array $transportConfig + * Configuration options that will be used to construct the transport. Options for + * each supported transport type should be passed in a key for that transport. For + * example: + * $transportConfig = [ + * 'grpc' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the + * supported options. + * @type callable $clientCertSource + * A callable which returns the client cert as a string. This can be used to + * provide a certificate and private key to the transport layer for mTLS. + * } + * + * @throws ValidationException + */ + public function __construct(array $options = []) + { + $clientOptions = $this->buildClientOptions($options); + $this->setClientOptions($clientOptions); + $this->operationsClient = $this->createOperationsClient($clientOptions); + } + + /** + * Creates a node group in a cluster. The returned + * [Operation.metadata][google.longrunning.Operation.metadata] is + * [NodeGroupOperationMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#nodegroupoperationmetadata). + * + * Sample code: + * ``` + * $nodeGroupControllerClient = new NodeGroupControllerClient(); + * try { + * $formattedParent = $nodeGroupControllerClient->clusterRegionName('[PROJECT]', '[REGION]', '[CLUSTER]'); + * $nodeGroup = new NodeGroup(); + * $operationResponse = $nodeGroupControllerClient->createNodeGroup($formattedParent, $nodeGroup); + * $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 = $nodeGroupControllerClient->createNodeGroup($formattedParent, $nodeGroup); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $nodeGroupControllerClient->resumeOperation($operationName, 'createNodeGroup'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $nodeGroupControllerClient->close(); + * } + * ``` + * + * @param string $parent Required. The parent resource where this node group will be created. + * Format: `projects/{project}/regions/{region}/clusters/{cluster}` + * @param NodeGroup $nodeGroup Required. The node group to create. + * @param array $optionalArgs { + * Optional. + * + * @type string $nodeGroupId + * Optional. An optional node group ID. Generated if not specified. + * + * The ID must contain only letters (a-z, A-Z), numbers (0-9), + * underscores (_), and hyphens (-). Cannot begin or end with underscore + * or hyphen. Must consist of from 3 to 33 characters. + * @type string $requestId + * Optional. A unique ID used to identify the request. If the server receives + * two + * [CreateNodeGroupRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.CreateNodeGroupRequests) + * with the same ID, the second request is ignored and the + * first [google.longrunning.Operation][google.longrunning.Operation] created + * and stored in the backend is returned. + * + * Recommendation: Set this value to a + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier). + * + * The ID must contain only letters (a-z, A-Z), numbers (0-9), + * underscores (_), and hyphens (-). The maximum length is 40 characters. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function createNodeGroup($parent, $nodeGroup, array $optionalArgs = []) + { + $request = new CreateNodeGroupRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setNodeGroup($nodeGroup); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['nodeGroupId'])) { + $request->setNodeGroupId($optionalArgs['nodeGroupId']); + } + + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('CreateNodeGroup', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Gets the resource representation for a node group in a + * cluster. + * + * Sample code: + * ``` + * $nodeGroupControllerClient = new NodeGroupControllerClient(); + * try { + * $formattedName = $nodeGroupControllerClient->nodeGroupName('[PROJECT]', '[REGION]', '[CLUSTER]', '[NODE_GROUP]'); + * $response = $nodeGroupControllerClient->getNodeGroup($formattedName); + * } finally { + * $nodeGroupControllerClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the node group to retrieve. + * Format: + * `projects/{project}/regions/{region}/clusters/{cluster}/nodeGroups/{nodeGroup}` + * @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\Dataproc\V1\NodeGroup + * + * @throws ApiException if the remote call fails + */ + public function getNodeGroup($name, array $optionalArgs = []) + { + $request = new GetNodeGroupRequest(); + $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('GetNodeGroup', NodeGroup::class, $optionalArgs, $request)->wait(); + } + + /** + * Resizes a node group in a cluster. The returned + * [Operation.metadata][google.longrunning.Operation.metadata] is + * [NodeGroupOperationMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#nodegroupoperationmetadata). + * + * Sample code: + * ``` + * $nodeGroupControllerClient = new NodeGroupControllerClient(); + * try { + * $name = 'name'; + * $size = 0; + * $operationResponse = $nodeGroupControllerClient->resizeNodeGroup($name, $size); + * $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 = $nodeGroupControllerClient->resizeNodeGroup($name, $size); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $nodeGroupControllerClient->resumeOperation($operationName, 'resizeNodeGroup'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $nodeGroupControllerClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the node group to resize. + * Format: + * `projects/{project}/regions/{region}/clusters/{cluster}/nodeGroups/{nodeGroup}` + * @param int $size Required. The number of running instances for the node group to maintain. + * The group adds or removes instances to maintain the number of instances + * specified by this parameter. + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * Optional. A unique ID used to identify the request. If the server receives + * two + * [ResizeNodeGroupRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.ResizeNodeGroupRequests) + * with the same ID, the second request is ignored and the + * first [google.longrunning.Operation][google.longrunning.Operation] created + * and stored in the backend is returned. + * + * Recommendation: Set this value to a + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier). + * + * The ID must contain only letters (a-z, A-Z), numbers (0-9), + * underscores (_), and hyphens (-). The maximum length is 40 characters. + * @type Duration $gracefulDecommissionTimeout + * Optional. Timeout for graceful YARN decommissioning. [Graceful + * decommissioning] + * (https://cloud.google.com/dataproc/docs/concepts/configuring-clusters/scaling-clusters#graceful_decommissioning) + * allows the removal of nodes from the Compute Engine node group + * without interrupting jobs in progress. This timeout specifies how long to + * wait for jobs in progress to finish before forcefully removing nodes (and + * potentially interrupting jobs). Default timeout is 0 (for forceful + * decommission), and the maximum allowed timeout is 1 day. (see JSON + * representation of + * [Duration](https://developers.google.com/protocol-buffers/docs/proto3#json)). + * + * Only supported on Dataproc image versions 1.2 and higher. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function resizeNodeGroup($name, $size, array $optionalArgs = []) + { + $request = new ResizeNodeGroupRequest(); + $requestParamHeaders = []; + $request->setName($name); + $request->setSize($size); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + if (isset($optionalArgs['gracefulDecommissionTimeout'])) { + $request->setGracefulDecommissionTimeout($optionalArgs['gracefulDecommissionTimeout']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('ResizeNodeGroup', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } +} diff --git a/Dataproc/src/V1/GceClusterConfig.php b/Dataproc/src/V1/GceClusterConfig.php index 3b1792bcf14d..0b4c912f7bd5 100644 --- a/Dataproc/src/V1/GceClusterConfig.php +++ b/Dataproc/src/V1/GceClusterConfig.php @@ -132,7 +132,8 @@ class GceClusterConfig extends \Google\Protobuf\Internal\Message */ private $node_group_affinity = null; /** - * Optional. Shielded Instance Config for clusters using [Compute Engine Shielded + * Optional. Shielded Instance Config for clusters using [Compute Engine + * Shielded * VMs](https://cloud.google.com/security/shielded-cloud/shielded-vm). * * Generated from protobuf field <code>.google.cloud.dataproc.v1.ShieldedInstanceConfig shielded_instance_config = 14 [(.google.api.field_behavior) = OPTIONAL];</code> @@ -224,7 +225,8 @@ class GceClusterConfig extends \Google\Protobuf\Internal\Message * @type \Google\Cloud\Dataproc\V1\NodeGroupAffinity $node_group_affinity * Optional. Node Group Affinity for sole-tenant clusters. * @type \Google\Cloud\Dataproc\V1\ShieldedInstanceConfig $shielded_instance_config - * Optional. Shielded Instance Config for clusters using [Compute Engine Shielded + * Optional. Shielded Instance Config for clusters using [Compute Engine + * Shielded * VMs](https://cloud.google.com/security/shielded-cloud/shielded-vm). * @type \Google\Cloud\Dataproc\V1\ConfidentialInstanceConfig $confidential_instance_config * Optional. Confidential Instance Config for clusters using [Confidential @@ -641,7 +643,8 @@ public function setNodeGroupAffinity($var) } /** - * Optional. Shielded Instance Config for clusters using [Compute Engine Shielded + * Optional. Shielded Instance Config for clusters using [Compute Engine + * Shielded * VMs](https://cloud.google.com/security/shielded-cloud/shielded-vm). * * Generated from protobuf field <code>.google.cloud.dataproc.v1.ShieldedInstanceConfig shielded_instance_config = 14 [(.google.api.field_behavior) = OPTIONAL];</code> @@ -663,7 +666,8 @@ public function clearShieldedInstanceConfig() } /** - * Optional. Shielded Instance Config for clusters using [Compute Engine Shielded + * Optional. Shielded Instance Config for clusters using [Compute Engine + * Shielded * VMs](https://cloud.google.com/security/shielded-cloud/shielded-vm). * * Generated from protobuf field <code>.google.cloud.dataproc.v1.ShieldedInstanceConfig shielded_instance_config = 14 [(.google.api.field_behavior) = OPTIONAL];</code> diff --git a/Dataproc/src/V1/GceClusterConfig/PrivateIpv6GoogleAccess.php b/Dataproc/src/V1/GceClusterConfig/PrivateIpv6GoogleAccess.php index a2b7e7586073..5299b26dbe18 100644 --- a/Dataproc/src/V1/GceClusterConfig/PrivateIpv6GoogleAccess.php +++ b/Dataproc/src/V1/GceClusterConfig/PrivateIpv6GoogleAccess.php @@ -19,7 +19,8 @@ class PrivateIpv6GoogleAccess { /** * If unspecified, Compute Engine default behavior will apply, which - * is the same as [INHERIT_FROM_SUBNETWORK][google.cloud.dataproc.v1.GceClusterConfig.PrivateIpv6GoogleAccess.INHERIT_FROM_SUBNETWORK]. + * is the same as + * [INHERIT_FROM_SUBNETWORK][google.cloud.dataproc.v1.GceClusterConfig.PrivateIpv6GoogleAccess.INHERIT_FROM_SUBNETWORK]. * * Generated from protobuf enum <code>PRIVATE_IPV6_GOOGLE_ACCESS_UNSPECIFIED = 0;</code> */ diff --git a/Dataproc/src/V1/GetNodeGroupRequest.php b/Dataproc/src/V1/GetNodeGroupRequest.php new file mode 100644 index 000000000000..79039483cda0 --- /dev/null +++ b/Dataproc/src/V1/GetNodeGroupRequest.php @@ -0,0 +1,75 @@ +<?php +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: google/cloud/dataproc/v1/node_groups.proto + +namespace Google\Cloud\Dataproc\V1; + +use Google\Protobuf\Internal\GPBType; +use Google\Protobuf\Internal\RepeatedField; +use Google\Protobuf\Internal\GPBUtil; + +/** + * A request to get a node group . + * + * Generated from protobuf message <code>google.cloud.dataproc.v1.GetNodeGroupRequest</code> + */ +class GetNodeGroupRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the node group to retrieve. + * Format: + * `projects/{project}/regions/{region}/clusters/{cluster}/nodeGroups/{nodeGroup}` + * + * Generated from protobuf field <code>string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {</code> + */ + private $name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the node group to retrieve. + * Format: + * `projects/{project}/regions/{region}/clusters/{cluster}/nodeGroups/{nodeGroup}` + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dataproc\V1\NodeGroups::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the node group to retrieve. + * Format: + * `projects/{project}/regions/{region}/clusters/{cluster}/nodeGroups/{nodeGroup}` + * + * Generated from protobuf field <code>string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {</code> + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The name of the node group to retrieve. + * Format: + * `projects/{project}/regions/{region}/clusters/{cluster}/nodeGroups/{nodeGroup}` + * + * Generated from protobuf field <code>string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {</code> + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/Dataproc/src/V1/InstanceGroupConfig/Preemptibility.php b/Dataproc/src/V1/InstanceGroupConfig/Preemptibility.php index 27f17ea057ff..985741aa6e7c 100644 --- a/Dataproc/src/V1/InstanceGroupConfig/Preemptibility.php +++ b/Dataproc/src/V1/InstanceGroupConfig/Preemptibility.php @@ -7,10 +7,7 @@ use UnexpectedValueException; /** - * Controls the use of - * [preemptible instances] - * (https://cloud.google.com/compute/docs/instances/preemptible) - * within the group. + * Controls the use of preemptible instances within the group. * * Protobuf type <code>google.cloud.dataproc.v1.InstanceGroupConfig.Preemptibility</code> */ @@ -32,8 +29,11 @@ class Preemptibility */ const NON_PREEMPTIBLE = 1; /** - * Instances are preemptible. - * This option is allowed only for secondary worker groups. + * Instances are [preemptible] + * (https://cloud.google.com/compute/docs/instances/preemptible). + * This option is allowed only for [secondary worker] + * (https://cloud.google.com/dataproc/docs/concepts/compute/secondary-vms) + * groups. * * Generated from protobuf enum <code>PREEMPTIBLE = 2;</code> */ diff --git a/Dataproc/src/V1/Job.php b/Dataproc/src/V1/Job.php index acb96b9a354d..f75c033914b4 100644 --- a/Dataproc/src/V1/Job.php +++ b/Dataproc/src/V1/Job.php @@ -95,14 +95,20 @@ class Job extends \Google\Protobuf\Internal\Message */ private $job_uuid = ''; /** - * Output only. Indicates whether the job is completed. If the value is `false`, - * the job is still in progress. If `true`, the job is completed, and + * Output only. Indicates whether the job is completed. If the value is + * `false`, the job is still in progress. If `true`, the job is completed, and * `status.state` field will indicate if it was successful, failed, * or cancelled. * * Generated from protobuf field <code>bool done = 24 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> */ private $done = false; + /** + * Optional. Driver scheduling configuration. + * + * Generated from protobuf field <code>.google.cloud.dataproc.v1.DriverSchedulingConfig driver_scheduling_config = 27 [(.google.api.field_behavior) = OPTIONAL];</code> + */ + private $driver_scheduling_config = null; protected $type_job; /** @@ -167,10 +173,12 @@ class Job extends \Google\Protobuf\Internal\Message * over time. This is in contrast to a user-settable reference.job_id that * may be reused over time. * @type bool $done - * Output only. Indicates whether the job is completed. If the value is `false`, - * the job is still in progress. If `true`, the job is completed, and + * Output only. Indicates whether the job is completed. If the value is + * `false`, the job is still in progress. If `true`, the job is completed, and * `status.state` field will indicate if it was successful, failed, * or cancelled. + * @type \Google\Cloud\Dataproc\V1\DriverSchedulingConfig $driver_scheduling_config + * Optional. Driver scheduling configuration. * } */ public function __construct($data = NULL) { @@ -765,8 +773,8 @@ public function setJobUuid($var) } /** - * Output only. Indicates whether the job is completed. If the value is `false`, - * the job is still in progress. If `true`, the job is completed, and + * Output only. Indicates whether the job is completed. If the value is + * `false`, the job is still in progress. If `true`, the job is completed, and * `status.state` field will indicate if it was successful, failed, * or cancelled. * @@ -779,8 +787,8 @@ public function getDone() } /** - * Output only. Indicates whether the job is completed. If the value is `false`, - * the job is still in progress. If `true`, the job is completed, and + * Output only. Indicates whether the job is completed. If the value is + * `false`, the job is still in progress. If `true`, the job is completed, and * `status.state` field will indicate if it was successful, failed, * or cancelled. * @@ -796,6 +804,42 @@ public function setDone($var) return $this; } + /** + * Optional. Driver scheduling configuration. + * + * Generated from protobuf field <code>.google.cloud.dataproc.v1.DriverSchedulingConfig driver_scheduling_config = 27 [(.google.api.field_behavior) = OPTIONAL];</code> + * @return \Google\Cloud\Dataproc\V1\DriverSchedulingConfig|null + */ + public function getDriverSchedulingConfig() + { + return $this->driver_scheduling_config; + } + + public function hasDriverSchedulingConfig() + { + return isset($this->driver_scheduling_config); + } + + public function clearDriverSchedulingConfig() + { + unset($this->driver_scheduling_config); + } + + /** + * Optional. Driver scheduling configuration. + * + * Generated from protobuf field <code>.google.cloud.dataproc.v1.DriverSchedulingConfig driver_scheduling_config = 27 [(.google.api.field_behavior) = OPTIONAL];</code> + * @param \Google\Cloud\Dataproc\V1\DriverSchedulingConfig $var + * @return $this + */ + public function setDriverSchedulingConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dataproc\V1\DriverSchedulingConfig::class); + $this->driver_scheduling_config = $var; + + return $this; + } + /** * @return string */ diff --git a/Dataproc/src/V1/JobPlacement.php b/Dataproc/src/V1/JobPlacement.php index 495aa071bcb5..0a5ccff35886 100644 --- a/Dataproc/src/V1/JobPlacement.php +++ b/Dataproc/src/V1/JobPlacement.php @@ -29,7 +29,8 @@ class JobPlacement extends \Google\Protobuf\Internal\Message */ private $cluster_uuid = ''; /** - * Optional. Cluster labels to identify a cluster where the job will be submitted. + * Optional. Cluster labels to identify a cluster where the job will be + * submitted. * * Generated from protobuf field <code>map<string, string> cluster_labels = 3 [(.google.api.field_behavior) = OPTIONAL];</code> */ @@ -47,7 +48,8 @@ class JobPlacement extends \Google\Protobuf\Internal\Message * Output only. A cluster UUID generated by the Dataproc service when * the job is submitted. * @type array|\Google\Protobuf\Internal\MapField $cluster_labels - * Optional. Cluster labels to identify a cluster where the job will be submitted. + * Optional. Cluster labels to identify a cluster where the job will be + * submitted. * } */ public function __construct($data = NULL) { @@ -110,7 +112,8 @@ public function setClusterUuid($var) } /** - * Optional. Cluster labels to identify a cluster where the job will be submitted. + * Optional. Cluster labels to identify a cluster where the job will be + * submitted. * * Generated from protobuf field <code>map<string, string> cluster_labels = 3 [(.google.api.field_behavior) = OPTIONAL];</code> * @return \Google\Protobuf\Internal\MapField @@ -121,7 +124,8 @@ public function getClusterLabels() } /** - * Optional. Cluster labels to identify a cluster where the job will be submitted. + * Optional. Cluster labels to identify a cluster where the job will be + * submitted. * * Generated from protobuf field <code>map<string, string> cluster_labels = 3 [(.google.api.field_behavior) = OPTIONAL];</code> * @param array|\Google\Protobuf\Internal\MapField $var diff --git a/Dataproc/src/V1/JobReference.php b/Dataproc/src/V1/JobReference.php index 93ed7c80fbf8..0840696143ac 100644 --- a/Dataproc/src/V1/JobReference.php +++ b/Dataproc/src/V1/JobReference.php @@ -16,8 +16,8 @@ class JobReference extends \Google\Protobuf\Internal\Message { /** - * Optional. The ID of the Google Cloud Platform project that the job belongs to. If - * specified, must match the request project ID. + * Optional. The ID of the Google Cloud Platform project that the job belongs + * to. If specified, must match the request project ID. * * Generated from protobuf field <code>string project_id = 1 [(.google.api.field_behavior) = OPTIONAL];</code> */ @@ -39,8 +39,8 @@ class JobReference extends \Google\Protobuf\Internal\Message * Optional. Data for populating the Message object. * * @type string $project_id - * Optional. The ID of the Google Cloud Platform project that the job belongs to. If - * specified, must match the request project ID. + * Optional. The ID of the Google Cloud Platform project that the job belongs + * to. If specified, must match the request project ID. * @type string $job_id * Optional. The job ID, which must be unique within the project. * The ID must contain only letters (a-z, A-Z), numbers (0-9), @@ -54,8 +54,8 @@ public function __construct($data = NULL) { } /** - * Optional. The ID of the Google Cloud Platform project that the job belongs to. If - * specified, must match the request project ID. + * Optional. The ID of the Google Cloud Platform project that the job belongs + * to. If specified, must match the request project ID. * * Generated from protobuf field <code>string project_id = 1 [(.google.api.field_behavior) = OPTIONAL];</code> * @return string @@ -66,8 +66,8 @@ public function getProjectId() } /** - * Optional. The ID of the Google Cloud Platform project that the job belongs to. If - * specified, must match the request project ID. + * Optional. The ID of the Google Cloud Platform project that the job belongs + * to. If specified, must match the request project ID. * * Generated from protobuf field <code>string project_id = 1 [(.google.api.field_behavior) = OPTIONAL];</code> * @param string $var diff --git a/Dataproc/src/V1/JobScheduling.php b/Dataproc/src/V1/JobScheduling.php index 8db7ca87ccbb..a11db612d32f 100644 --- a/Dataproc/src/V1/JobScheduling.php +++ b/Dataproc/src/V1/JobScheduling.php @@ -19,27 +19,25 @@ class JobScheduling extends \Google\Protobuf\Internal\Message * Optional. Maximum number of times per hour a driver may be restarted as * a result of driver exiting with non-zero code before job is * reported failed. - * A job may be reported as thrashing if driver exits with non-zero code - * 4 times within 10 minute window. + * A job may be reported as thrashing if the driver exits with a non-zero code + * four times within a 10-minute window. * Maximum value is 10. - * **Note:** Currently, this restartable job option is - * not supported in Dataproc - * [workflow - * template](https://cloud.google.com/dataproc/docs/concepts/workflows/using-workflows#adding_jobs_to_a_template) - * jobs. + * **Note:** This restartable job option is not supported in Dataproc + * [workflow templates] + * (https://cloud.google.com/dataproc/docs/concepts/workflows/using-workflows#adding_jobs_to_a_template). * * Generated from protobuf field <code>int32 max_failures_per_hour = 1 [(.google.api.field_behavior) = OPTIONAL];</code> */ private $max_failures_per_hour = 0; /** - * Optional. Maximum number of times in total a driver may be restarted as a result of - * driver exiting with non-zero code before job is reported failed. + * Optional. Maximum total number of times a driver may be restarted as a + * result of the driver exiting with a non-zero code. After the maximum number + * is reached, the job will be reported as failed. * Maximum value is 240. * **Note:** Currently, this restartable job option is * not supported in Dataproc * [workflow - * template](https://cloud.google.com/dataproc/docs/concepts/workflows/using-workflows#adding_jobs_to_a_template) - * jobs. + * templates](https://cloud.google.com/dataproc/docs/concepts/workflows/using-workflows#adding_jobs_to_a_template). * * Generated from protobuf field <code>int32 max_failures_total = 2 [(.google.api.field_behavior) = OPTIONAL];</code> */ @@ -55,23 +53,21 @@ class JobScheduling extends \Google\Protobuf\Internal\Message * Optional. Maximum number of times per hour a driver may be restarted as * a result of driver exiting with non-zero code before job is * reported failed. - * A job may be reported as thrashing if driver exits with non-zero code - * 4 times within 10 minute window. + * A job may be reported as thrashing if the driver exits with a non-zero code + * four times within a 10-minute window. * Maximum value is 10. - * **Note:** Currently, this restartable job option is - * not supported in Dataproc - * [workflow - * template](https://cloud.google.com/dataproc/docs/concepts/workflows/using-workflows#adding_jobs_to_a_template) - * jobs. + * **Note:** This restartable job option is not supported in Dataproc + * [workflow templates] + * (https://cloud.google.com/dataproc/docs/concepts/workflows/using-workflows#adding_jobs_to_a_template). * @type int $max_failures_total - * Optional. Maximum number of times in total a driver may be restarted as a result of - * driver exiting with non-zero code before job is reported failed. + * Optional. Maximum total number of times a driver may be restarted as a + * result of the driver exiting with a non-zero code. After the maximum number + * is reached, the job will be reported as failed. * Maximum value is 240. * **Note:** Currently, this restartable job option is * not supported in Dataproc * [workflow - * template](https://cloud.google.com/dataproc/docs/concepts/workflows/using-workflows#adding_jobs_to_a_template) - * jobs. + * templates](https://cloud.google.com/dataproc/docs/concepts/workflows/using-workflows#adding_jobs_to_a_template). * } */ public function __construct($data = NULL) { @@ -83,14 +79,12 @@ public function __construct($data = NULL) { * Optional. Maximum number of times per hour a driver may be restarted as * a result of driver exiting with non-zero code before job is * reported failed. - * A job may be reported as thrashing if driver exits with non-zero code - * 4 times within 10 minute window. + * A job may be reported as thrashing if the driver exits with a non-zero code + * four times within a 10-minute window. * Maximum value is 10. - * **Note:** Currently, this restartable job option is - * not supported in Dataproc - * [workflow - * template](https://cloud.google.com/dataproc/docs/concepts/workflows/using-workflows#adding_jobs_to_a_template) - * jobs. + * **Note:** This restartable job option is not supported in Dataproc + * [workflow templates] + * (https://cloud.google.com/dataproc/docs/concepts/workflows/using-workflows#adding_jobs_to_a_template). * * Generated from protobuf field <code>int32 max_failures_per_hour = 1 [(.google.api.field_behavior) = OPTIONAL];</code> * @return int @@ -104,14 +98,12 @@ public function getMaxFailuresPerHour() * Optional. Maximum number of times per hour a driver may be restarted as * a result of driver exiting with non-zero code before job is * reported failed. - * A job may be reported as thrashing if driver exits with non-zero code - * 4 times within 10 minute window. + * A job may be reported as thrashing if the driver exits with a non-zero code + * four times within a 10-minute window. * Maximum value is 10. - * **Note:** Currently, this restartable job option is - * not supported in Dataproc - * [workflow - * template](https://cloud.google.com/dataproc/docs/concepts/workflows/using-workflows#adding_jobs_to_a_template) - * jobs. + * **Note:** This restartable job option is not supported in Dataproc + * [workflow templates] + * (https://cloud.google.com/dataproc/docs/concepts/workflows/using-workflows#adding_jobs_to_a_template). * * Generated from protobuf field <code>int32 max_failures_per_hour = 1 [(.google.api.field_behavior) = OPTIONAL];</code> * @param int $var @@ -126,14 +118,14 @@ public function setMaxFailuresPerHour($var) } /** - * Optional. Maximum number of times in total a driver may be restarted as a result of - * driver exiting with non-zero code before job is reported failed. + * Optional. Maximum total number of times a driver may be restarted as a + * result of the driver exiting with a non-zero code. After the maximum number + * is reached, the job will be reported as failed. * Maximum value is 240. * **Note:** Currently, this restartable job option is * not supported in Dataproc * [workflow - * template](https://cloud.google.com/dataproc/docs/concepts/workflows/using-workflows#adding_jobs_to_a_template) - * jobs. + * templates](https://cloud.google.com/dataproc/docs/concepts/workflows/using-workflows#adding_jobs_to_a_template). * * Generated from protobuf field <code>int32 max_failures_total = 2 [(.google.api.field_behavior) = OPTIONAL];</code> * @return int @@ -144,14 +136,14 @@ public function getMaxFailuresTotal() } /** - * Optional. Maximum number of times in total a driver may be restarted as a result of - * driver exiting with non-zero code before job is reported failed. + * Optional. Maximum total number of times a driver may be restarted as a + * result of the driver exiting with a non-zero code. After the maximum number + * is reached, the job will be reported as failed. * Maximum value is 240. * **Note:** Currently, this restartable job option is * not supported in Dataproc * [workflow - * template](https://cloud.google.com/dataproc/docs/concepts/workflows/using-workflows#adding_jobs_to_a_template) - * jobs. + * templates](https://cloud.google.com/dataproc/docs/concepts/workflows/using-workflows#adding_jobs_to_a_template). * * Generated from protobuf field <code>int32 max_failures_total = 2 [(.google.api.field_behavior) = OPTIONAL];</code> * @param int $var diff --git a/Dataproc/src/V1/KerberosConfig.php b/Dataproc/src/V1/KerberosConfig.php index c03b567a3cb9..49ccbd79d3e1 100644 --- a/Dataproc/src/V1/KerberosConfig.php +++ b/Dataproc/src/V1/KerberosConfig.php @@ -16,8 +16,8 @@ class KerberosConfig extends \Google\Protobuf\Internal\Message { /** - * Optional. Flag to indicate whether to Kerberize the cluster (default: false). Set - * this field to true to enable Kerberos on a cluster. + * Optional. Flag to indicate whether to Kerberize the cluster (default: + * false). Set this field to true to enable Kerberos on a cluster. * * Generated from protobuf field <code>bool enable_kerberos = 1 [(.google.api.field_behavior) = OPTIONAL];</code> */ @@ -135,8 +135,8 @@ class KerberosConfig extends \Google\Protobuf\Internal\Message * Optional. Data for populating the Message object. * * @type bool $enable_kerberos - * Optional. Flag to indicate whether to Kerberize the cluster (default: false). Set - * this field to true to enable Kerberos on a cluster. + * Optional. Flag to indicate whether to Kerberize the cluster (default: + * false). Set this field to true to enable Kerberos on a cluster. * @type string $root_principal_password_uri * Optional. The Cloud Storage URI of a KMS encrypted file containing the root * principal password. @@ -194,8 +194,8 @@ public function __construct($data = NULL) { } /** - * Optional. Flag to indicate whether to Kerberize the cluster (default: false). Set - * this field to true to enable Kerberos on a cluster. + * Optional. Flag to indicate whether to Kerberize the cluster (default: + * false). Set this field to true to enable Kerberos on a cluster. * * Generated from protobuf field <code>bool enable_kerberos = 1 [(.google.api.field_behavior) = OPTIONAL];</code> * @return bool @@ -206,8 +206,8 @@ public function getEnableKerberos() } /** - * Optional. Flag to indicate whether to Kerberize the cluster (default: false). Set - * this field to true to enable Kerberos on a cluster. + * Optional. Flag to indicate whether to Kerberize the cluster (default: + * false). Set this field to true to enable Kerberos on a cluster. * * Generated from protobuf field <code>bool enable_kerberos = 1 [(.google.api.field_behavior) = OPTIONAL];</code> * @param bool $var diff --git a/Dataproc/src/V1/LifecycleConfig.php b/Dataproc/src/V1/LifecycleConfig.php index 7f1d7cf25ef8..ac926d99e5ea 100644 --- a/Dataproc/src/V1/LifecycleConfig.php +++ b/Dataproc/src/V1/LifecycleConfig.php @@ -49,7 +49,8 @@ class LifecycleConfig extends \Google\Protobuf\Internal\Message * representation of * [Duration](https://developers.google.com/protocol-buffers/docs/proto3#json)). * @type \Google\Protobuf\Timestamp $auto_delete_time - * Optional. The time when cluster will be auto-deleted (see JSON representation of + * Optional. The time when cluster will be auto-deleted (see JSON + * representation of * [Timestamp](https://developers.google.com/protocol-buffers/docs/proto3#json)). * @type \Google\Protobuf\Duration $auto_delete_ttl * Optional. The lifetime duration of cluster. The cluster will be @@ -113,7 +114,8 @@ public function setIdleDeleteTtl($var) } /** - * Optional. The time when cluster will be auto-deleted (see JSON representation of + * Optional. The time when cluster will be auto-deleted (see JSON + * representation of * [Timestamp](https://developers.google.com/protocol-buffers/docs/proto3#json)). * * Generated from protobuf field <code>.google.protobuf.Timestamp auto_delete_time = 2 [(.google.api.field_behavior) = OPTIONAL];</code> @@ -130,7 +132,8 @@ public function hasAutoDeleteTime() } /** - * Optional. The time when cluster will be auto-deleted (see JSON representation of + * Optional. The time when cluster will be auto-deleted (see JSON + * representation of * [Timestamp](https://developers.google.com/protocol-buffers/docs/proto3#json)). * * Generated from protobuf field <code>.google.protobuf.Timestamp auto_delete_time = 2 [(.google.api.field_behavior) = OPTIONAL];</code> diff --git a/Dataproc/src/V1/NodeGroup.php b/Dataproc/src/V1/NodeGroup.php new file mode 100644 index 000000000000..6a1ec5999f83 --- /dev/null +++ b/Dataproc/src/V1/NodeGroup.php @@ -0,0 +1,206 @@ +<?php +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: google/cloud/dataproc/v1/clusters.proto + +namespace Google\Cloud\Dataproc\V1; + +use Google\Protobuf\Internal\GPBType; +use Google\Protobuf\Internal\RepeatedField; +use Google\Protobuf\Internal\GPBUtil; + +/** + * Dataproc Node Group. + * **The Dataproc `NodeGroup` resource is not related to the + * Dataproc [NodeGroupAffinity][google.cloud.dataproc.v1.NodeGroupAffinity] + * resource.** + * + * Generated from protobuf message <code>google.cloud.dataproc.v1.NodeGroup</code> + */ +class NodeGroup extends \Google\Protobuf\Internal\Message +{ + /** + * The Node group [resource name](https://aip.dev/122). + * + * Generated from protobuf field <code>string name = 1;</code> + */ + private $name = ''; + /** + * Required. Node group roles. + * + * Generated from protobuf field <code>repeated .google.cloud.dataproc.v1.NodeGroup.Role roles = 2 [(.google.api.field_behavior) = REQUIRED];</code> + */ + private $roles; + /** + * Optional. The node group instance group configuration. + * + * Generated from protobuf field <code>.google.cloud.dataproc.v1.InstanceGroupConfig node_group_config = 3 [(.google.api.field_behavior) = OPTIONAL];</code> + */ + private $node_group_config = null; + /** + * Optional. Node group labels. + * * Label **keys** must consist of from 1 to 63 characters and conform to + * [RFC 1035](https://www.ietf.org/rfc/rfc1035.txt). + * * Label **values** can be empty. If specified, they must consist of from + * 1 to 63 characters and conform to [RFC 1035] + * (https://www.ietf.org/rfc/rfc1035.txt). + * * The node group must have no more than 32 labels. + * + * Generated from protobuf field <code>map<string, string> labels = 4 [(.google.api.field_behavior) = OPTIONAL];</code> + */ + private $labels; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The Node group [resource name](https://aip.dev/122). + * @type array<int>|\Google\Protobuf\Internal\RepeatedField $roles + * Required. Node group roles. + * @type \Google\Cloud\Dataproc\V1\InstanceGroupConfig $node_group_config + * Optional. The node group instance group configuration. + * @type array|\Google\Protobuf\Internal\MapField $labels + * Optional. Node group labels. + * * Label **keys** must consist of from 1 to 63 characters and conform to + * [RFC 1035](https://www.ietf.org/rfc/rfc1035.txt). + * * Label **values** can be empty. If specified, they must consist of from + * 1 to 63 characters and conform to [RFC 1035] + * (https://www.ietf.org/rfc/rfc1035.txt). + * * The node group must have no more than 32 labels. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dataproc\V1\Clusters::initOnce(); + parent::__construct($data); + } + + /** + * The Node group [resource name](https://aip.dev/122). + * + * Generated from protobuf field <code>string name = 1;</code> + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The Node group [resource name](https://aip.dev/122). + * + * Generated from protobuf field <code>string name = 1;</code> + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Required. Node group roles. + * + * Generated from protobuf field <code>repeated .google.cloud.dataproc.v1.NodeGroup.Role roles = 2 [(.google.api.field_behavior) = REQUIRED];</code> + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getRoles() + { + return $this->roles; + } + + /** + * Required. Node group roles. + * + * Generated from protobuf field <code>repeated .google.cloud.dataproc.v1.NodeGroup.Role roles = 2 [(.google.api.field_behavior) = REQUIRED];</code> + * @param array<int>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setRoles($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::ENUM, \Google\Cloud\Dataproc\V1\NodeGroup\Role::class); + $this->roles = $arr; + + return $this; + } + + /** + * Optional. The node group instance group configuration. + * + * Generated from protobuf field <code>.google.cloud.dataproc.v1.InstanceGroupConfig node_group_config = 3 [(.google.api.field_behavior) = OPTIONAL];</code> + * @return \Google\Cloud\Dataproc\V1\InstanceGroupConfig|null + */ + public function getNodeGroupConfig() + { + return $this->node_group_config; + } + + public function hasNodeGroupConfig() + { + return isset($this->node_group_config); + } + + public function clearNodeGroupConfig() + { + unset($this->node_group_config); + } + + /** + * Optional. The node group instance group configuration. + * + * Generated from protobuf field <code>.google.cloud.dataproc.v1.InstanceGroupConfig node_group_config = 3 [(.google.api.field_behavior) = OPTIONAL];</code> + * @param \Google\Cloud\Dataproc\V1\InstanceGroupConfig $var + * @return $this + */ + public function setNodeGroupConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dataproc\V1\InstanceGroupConfig::class); + $this->node_group_config = $var; + + return $this; + } + + /** + * Optional. Node group labels. + * * Label **keys** must consist of from 1 to 63 characters and conform to + * [RFC 1035](https://www.ietf.org/rfc/rfc1035.txt). + * * Label **values** can be empty. If specified, they must consist of from + * 1 to 63 characters and conform to [RFC 1035] + * (https://www.ietf.org/rfc/rfc1035.txt). + * * The node group must have no more than 32 labels. + * + * Generated from protobuf field <code>map<string, string> labels = 4 [(.google.api.field_behavior) = OPTIONAL];</code> + * @return \Google\Protobuf\Internal\MapField + */ + public function getLabels() + { + return $this->labels; + } + + /** + * Optional. Node group labels. + * * Label **keys** must consist of from 1 to 63 characters and conform to + * [RFC 1035](https://www.ietf.org/rfc/rfc1035.txt). + * * Label **values** can be empty. If specified, they must consist of from + * 1 to 63 characters and conform to [RFC 1035] + * (https://www.ietf.org/rfc/rfc1035.txt). + * * The node group must have no more than 32 labels. + * + * Generated from protobuf field <code>map<string, string> labels = 4 [(.google.api.field_behavior) = OPTIONAL];</code> + * @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/Dataproc/src/V1/NodeGroup/Role.php b/Dataproc/src/V1/NodeGroup/Role.php new file mode 100644 index 000000000000..3c6f3dfd17c5 --- /dev/null +++ b/Dataproc/src/V1/NodeGroup/Role.php @@ -0,0 +1,57 @@ +<?php +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: google/cloud/dataproc/v1/clusters.proto + +namespace Google\Cloud\Dataproc\V1\NodeGroup; + +use UnexpectedValueException; + +/** + * Node group roles. + * + * Protobuf type <code>google.cloud.dataproc.v1.NodeGroup.Role</code> + */ +class Role +{ + /** + * Required unspecified role. + * + * Generated from protobuf enum <code>ROLE_UNSPECIFIED = 0;</code> + */ + const ROLE_UNSPECIFIED = 0; + /** + * Job drivers run on the node group. + * + * Generated from protobuf enum <code>DRIVER = 1;</code> + */ + const DRIVER = 1; + + private static $valueToName = [ + self::ROLE_UNSPECIFIED => 'ROLE_UNSPECIFIED', + self::DRIVER => 'DRIVER', + ]; + + 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); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Role::class, \Google\Cloud\Dataproc\V1\NodeGroup_Role::class); + diff --git a/Dataproc/src/V1/NodeGroupAffinity.php b/Dataproc/src/V1/NodeGroupAffinity.php index 5d5d078c905f..4a3a6b82f62c 100644 --- a/Dataproc/src/V1/NodeGroupAffinity.php +++ b/Dataproc/src/V1/NodeGroupAffinity.php @@ -10,6 +10,8 @@ /** * Node Group Affinity for clusters using sole-tenant node groups. + * **The Dataproc `NodeGroupAffinity` resource is not related to the + * Dataproc [NodeGroup][google.cloud.dataproc.v1.NodeGroup] resource.** * * Generated from protobuf message <code>google.cloud.dataproc.v1.NodeGroupAffinity</code> */ diff --git a/Dataproc/src/V1/NodeGroupControllerClient.php b/Dataproc/src/V1/NodeGroupControllerClient.php new file mode 100644 index 000000000000..b5a857d6efd5 --- /dev/null +++ b/Dataproc/src/V1/NodeGroupControllerClient.php @@ -0,0 +1,34 @@ +<?php +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* + * GENERATED CODE WARNING + * Generated by gapic-generator-php from the file + * https://github.com/googleapis/googleapis/blob/master/google/cloud/dataproc/v1/node_groups.proto + * Updates to the above are reflected here through a refresh process. + */ + +namespace Google\Cloud\Dataproc\V1; + +use Google\Cloud\Dataproc\V1\Gapic\NodeGroupControllerGapicClient; + +/** {@inheritdoc} */ +class NodeGroupControllerClient extends NodeGroupControllerGapicClient +{ + // This class is intentionally empty, and is intended to hold manual additions to + // the generated {@see NodeGroupControllerGapicClient} class. +} diff --git a/Dataproc/src/V1/NodeGroupControllerGrpcClient.php b/Dataproc/src/V1/NodeGroupControllerGrpcClient.php new file mode 100644 index 000000000000..b502435386f9 --- /dev/null +++ b/Dataproc/src/V1/NodeGroupControllerGrpcClient.php @@ -0,0 +1,86 @@ +<?php +// GENERATED CODE -- DO NOT EDIT! + +// Original file comments: +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +namespace Google\Cloud\Dataproc\V1; + +/** + * The `NodeGroupControllerService` provides methods to manage node groups + * of Compute Engine managed instances. + */ +class NodeGroupControllerGrpcClient extends \Grpc\BaseStub { + + /** + * @param string $hostname hostname + * @param array $opts channel options + * @param \Grpc\Channel $channel (optional) re-use channel object + */ + public function __construct($hostname, $opts, $channel = null) { + parent::__construct($hostname, $opts, $channel); + } + + /** + * Creates a node group in a cluster. The returned + * [Operation.metadata][google.longrunning.Operation.metadata] is + * [NodeGroupOperationMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#nodegroupoperationmetadata). + * @param \Google\Cloud\Dataproc\V1\CreateNodeGroupRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function CreateNodeGroup(\Google\Cloud\Dataproc\V1\CreateNodeGroupRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.dataproc.v1.NodeGroupController/CreateNodeGroup', + $argument, + ['\Google\LongRunning\Operation', 'decode'], + $metadata, $options); + } + + /** + * Resizes a node group in a cluster. The returned + * [Operation.metadata][google.longrunning.Operation.metadata] is + * [NodeGroupOperationMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#nodegroupoperationmetadata). + * @param \Google\Cloud\Dataproc\V1\ResizeNodeGroupRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function ResizeNodeGroup(\Google\Cloud\Dataproc\V1\ResizeNodeGroupRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.dataproc.v1.NodeGroupController/ResizeNodeGroup', + $argument, + ['\Google\LongRunning\Operation', 'decode'], + $metadata, $options); + } + + /** + * Gets the resource representation for a node group in a + * cluster. + * @param \Google\Cloud\Dataproc\V1\GetNodeGroupRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function GetNodeGroup(\Google\Cloud\Dataproc\V1\GetNodeGroupRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.dataproc.v1.NodeGroupController/GetNodeGroup', + $argument, + ['\Google\Cloud\Dataproc\V1\NodeGroup', 'decode'], + $metadata, $options); + } + +} diff --git a/Dataproc/src/V1/NodeGroupOperationMetadata.php b/Dataproc/src/V1/NodeGroupOperationMetadata.php new file mode 100644 index 000000000000..7f52039f5bff --- /dev/null +++ b/Dataproc/src/V1/NodeGroupOperationMetadata.php @@ -0,0 +1,315 @@ +<?php +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: google/cloud/dataproc/v1/operations.proto + +namespace Google\Cloud\Dataproc\V1; + +use Google\Protobuf\Internal\GPBType; +use Google\Protobuf\Internal\RepeatedField; +use Google\Protobuf\Internal\GPBUtil; + +/** + * Metadata describing the node group operation. + * + * Generated from protobuf message <code>google.cloud.dataproc.v1.NodeGroupOperationMetadata</code> + */ +class NodeGroupOperationMetadata extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. Node group ID for the operation. + * + * Generated from protobuf field <code>string node_group_id = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> + */ + private $node_group_id = ''; + /** + * Output only. Cluster UUID associated with the node group operation. + * + * Generated from protobuf field <code>string cluster_uuid = 2 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> + */ + private $cluster_uuid = ''; + /** + * Output only. Current operation status. + * + * Generated from protobuf field <code>.google.cloud.dataproc.v1.ClusterOperationStatus status = 3 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> + */ + private $status = null; + /** + * Output only. The previous operation status. + * + * Generated from protobuf field <code>repeated .google.cloud.dataproc.v1.ClusterOperationStatus status_history = 4 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> + */ + private $status_history; + /** + * The operation type. + * + * Generated from protobuf field <code>.google.cloud.dataproc.v1.NodeGroupOperationMetadata.NodeGroupOperationType operation_type = 5;</code> + */ + private $operation_type = 0; + /** + * Output only. Short description of operation. + * + * Generated from protobuf field <code>string description = 6 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> + */ + private $description = ''; + /** + * Output only. Labels associated with the operation. + * + * Generated from protobuf field <code>map<string, string> labels = 7 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> + */ + private $labels; + /** + * Output only. Errors encountered during operation execution. + * + * Generated from protobuf field <code>repeated string warnings = 8 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> + */ + private $warnings; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $node_group_id + * Output only. Node group ID for the operation. + * @type string $cluster_uuid + * Output only. Cluster UUID associated with the node group operation. + * @type \Google\Cloud\Dataproc\V1\ClusterOperationStatus $status + * Output only. Current operation status. + * @type array<\Google\Cloud\Dataproc\V1\ClusterOperationStatus>|\Google\Protobuf\Internal\RepeatedField $status_history + * Output only. The previous operation status. + * @type int $operation_type + * The operation type. + * @type string $description + * Output only. Short description of operation. + * @type array|\Google\Protobuf\Internal\MapField $labels + * Output only. Labels associated with the operation. + * @type array<string>|\Google\Protobuf\Internal\RepeatedField $warnings + * Output only. Errors encountered during operation execution. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dataproc\V1\Operations::initOnce(); + parent::__construct($data); + } + + /** + * Output only. Node group ID for the operation. + * + * Generated from protobuf field <code>string node_group_id = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> + * @return string + */ + public function getNodeGroupId() + { + return $this->node_group_id; + } + + /** + * Output only. Node group ID for the operation. + * + * Generated from protobuf field <code>string node_group_id = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> + * @param string $var + * @return $this + */ + public function setNodeGroupId($var) + { + GPBUtil::checkString($var, True); + $this->node_group_id = $var; + + return $this; + } + + /** + * Output only. Cluster UUID associated with the node group operation. + * + * Generated from protobuf field <code>string cluster_uuid = 2 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> + * @return string + */ + public function getClusterUuid() + { + return $this->cluster_uuid; + } + + /** + * Output only. Cluster UUID associated with the node group operation. + * + * Generated from protobuf field <code>string cluster_uuid = 2 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> + * @param string $var + * @return $this + */ + public function setClusterUuid($var) + { + GPBUtil::checkString($var, True); + $this->cluster_uuid = $var; + + return $this; + } + + /** + * Output only. Current operation status. + * + * Generated from protobuf field <code>.google.cloud.dataproc.v1.ClusterOperationStatus status = 3 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> + * @return \Google\Cloud\Dataproc\V1\ClusterOperationStatus|null + */ + public function getStatus() + { + return $this->status; + } + + public function hasStatus() + { + return isset($this->status); + } + + public function clearStatus() + { + unset($this->status); + } + + /** + * Output only. Current operation status. + * + * Generated from protobuf field <code>.google.cloud.dataproc.v1.ClusterOperationStatus status = 3 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> + * @param \Google\Cloud\Dataproc\V1\ClusterOperationStatus $var + * @return $this + */ + public function setStatus($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dataproc\V1\ClusterOperationStatus::class); + $this->status = $var; + + return $this; + } + + /** + * Output only. The previous operation status. + * + * Generated from protobuf field <code>repeated .google.cloud.dataproc.v1.ClusterOperationStatus status_history = 4 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getStatusHistory() + { + return $this->status_history; + } + + /** + * Output only. The previous operation status. + * + * Generated from protobuf field <code>repeated .google.cloud.dataproc.v1.ClusterOperationStatus status_history = 4 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> + * @param array<\Google\Cloud\Dataproc\V1\ClusterOperationStatus>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setStatusHistory($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dataproc\V1\ClusterOperationStatus::class); + $this->status_history = $arr; + + return $this; + } + + /** + * The operation type. + * + * Generated from protobuf field <code>.google.cloud.dataproc.v1.NodeGroupOperationMetadata.NodeGroupOperationType operation_type = 5;</code> + * @return int + */ + public function getOperationType() + { + return $this->operation_type; + } + + /** + * The operation type. + * + * Generated from protobuf field <code>.google.cloud.dataproc.v1.NodeGroupOperationMetadata.NodeGroupOperationType operation_type = 5;</code> + * @param int $var + * @return $this + */ + public function setOperationType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Dataproc\V1\NodeGroupOperationMetadata\NodeGroupOperationType::class); + $this->operation_type = $var; + + return $this; + } + + /** + * Output only. Short description of operation. + * + * Generated from protobuf field <code>string description = 6 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * Output only. Short description of operation. + * + * Generated from protobuf field <code>string description = 6 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> + * @param string $var + * @return $this + */ + public function setDescription($var) + { + GPBUtil::checkString($var, True); + $this->description = $var; + + return $this; + } + + /** + * Output only. Labels associated with the operation. + * + * Generated from protobuf field <code>map<string, string> labels = 7 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> + * @return \Google\Protobuf\Internal\MapField + */ + public function getLabels() + { + return $this->labels; + } + + /** + * Output only. Labels associated with the operation. + * + * Generated from protobuf field <code>map<string, string> labels = 7 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> + * @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; + } + + /** + * Output only. Errors encountered during operation execution. + * + * Generated from protobuf field <code>repeated string warnings = 8 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getWarnings() + { + return $this->warnings; + } + + /** + * Output only. Errors encountered during operation execution. + * + * Generated from protobuf field <code>repeated string warnings = 8 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> + * @param array<string>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setWarnings($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->warnings = $arr; + + return $this; + } + +} + diff --git a/Dataproc/src/V1/NodeGroupOperationMetadata/NodeGroupOperationType.php b/Dataproc/src/V1/NodeGroupOperationMetadata/NodeGroupOperationType.php new file mode 100644 index 000000000000..4d13ed48a9be --- /dev/null +++ b/Dataproc/src/V1/NodeGroupOperationMetadata/NodeGroupOperationType.php @@ -0,0 +1,78 @@ +<?php +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: google/cloud/dataproc/v1/operations.proto + +namespace Google\Cloud\Dataproc\V1\NodeGroupOperationMetadata; + +use UnexpectedValueException; + +/** + * Operation type for node group resources. + * + * Protobuf type <code>google.cloud.dataproc.v1.NodeGroupOperationMetadata.NodeGroupOperationType</code> + */ +class NodeGroupOperationType +{ + /** + * Node group operation type is unknown. + * + * Generated from protobuf enum <code>NODE_GROUP_OPERATION_TYPE_UNSPECIFIED = 0;</code> + */ + const NODE_GROUP_OPERATION_TYPE_UNSPECIFIED = 0; + /** + * Create node group operation type. + * + * Generated from protobuf enum <code>CREATE = 1;</code> + */ + const CREATE = 1; + /** + * Update node group operation type. + * + * Generated from protobuf enum <code>UPDATE = 2;</code> + */ + const UPDATE = 2; + /** + * Delete node group operation type. + * + * Generated from protobuf enum <code>DELETE = 3;</code> + */ + const DELETE = 3; + /** + * Resize node group operation type. + * + * Generated from protobuf enum <code>RESIZE = 4;</code> + */ + const RESIZE = 4; + + private static $valueToName = [ + self::NODE_GROUP_OPERATION_TYPE_UNSPECIFIED => 'NODE_GROUP_OPERATION_TYPE_UNSPECIFIED', + self::CREATE => 'CREATE', + self::UPDATE => 'UPDATE', + self::DELETE => 'DELETE', + self::RESIZE => 'RESIZE', + ]; + + 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); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(NodeGroupOperationType::class, \Google\Cloud\Dataproc\V1\NodeGroupOperationMetadata_NodeGroupOperationType::class); + diff --git a/Dataproc/src/V1/NodeGroupOperationMetadata_NodeGroupOperationType.php b/Dataproc/src/V1/NodeGroupOperationMetadata_NodeGroupOperationType.php new file mode 100644 index 000000000000..98daf6390e22 --- /dev/null +++ b/Dataproc/src/V1/NodeGroupOperationMetadata_NodeGroupOperationType.php @@ -0,0 +1,16 @@ +<?php +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: google/cloud/dataproc/v1/operations.proto + +namespace Google\Cloud\Dataproc\V1; + +if (false) { + /** + * This class is deprecated. Use Google\Cloud\Dataproc\V1\NodeGroupOperationMetadata\NodeGroupOperationType instead. + * @deprecated + */ + class NodeGroupOperationMetadata_NodeGroupOperationType {} +} +class_exists(NodeGroupOperationMetadata\NodeGroupOperationType::class); +@trigger_error('Google\Cloud\Dataproc\V1\NodeGroupOperationMetadata_NodeGroupOperationType is deprecated and will be removed in the next major release. Use Google\Cloud\Dataproc\V1\NodeGroupOperationMetadata\NodeGroupOperationType instead', E_USER_DEPRECATED); + diff --git a/Dataproc/src/V1/NodeGroup_Role.php b/Dataproc/src/V1/NodeGroup_Role.php new file mode 100644 index 000000000000..0fb07335cd0e --- /dev/null +++ b/Dataproc/src/V1/NodeGroup_Role.php @@ -0,0 +1,16 @@ +<?php +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: google/cloud/dataproc/v1/clusters.proto + +namespace Google\Cloud\Dataproc\V1; + +if (false) { + /** + * This class is deprecated. Use Google\Cloud\Dataproc\V1\NodeGroup\Role instead. + * @deprecated + */ + class NodeGroup_Role {} +} +class_exists(NodeGroup\Role::class); +@trigger_error('Google\Cloud\Dataproc\V1\NodeGroup_Role is deprecated and will be removed in the next major release. Use Google\Cloud\Dataproc\V1\NodeGroup\Role instead', E_USER_DEPRECATED); + diff --git a/Dataproc/src/V1/ResizeNodeGroupRequest.php b/Dataproc/src/V1/ResizeNodeGroupRequest.php new file mode 100644 index 000000000000..e5dfd6e4d2e3 --- /dev/null +++ b/Dataproc/src/V1/ResizeNodeGroupRequest.php @@ -0,0 +1,271 @@ +<?php +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: google/cloud/dataproc/v1/node_groups.proto + +namespace Google\Cloud\Dataproc\V1; + +use Google\Protobuf\Internal\GPBType; +use Google\Protobuf\Internal\RepeatedField; +use Google\Protobuf\Internal\GPBUtil; + +/** + * A request to resize a node group. + * + * Generated from protobuf message <code>google.cloud.dataproc.v1.ResizeNodeGroupRequest</code> + */ +class ResizeNodeGroupRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the node group to resize. + * Format: + * `projects/{project}/regions/{region}/clusters/{cluster}/nodeGroups/{nodeGroup}` + * + * Generated from protobuf field <code>string name = 1 [(.google.api.field_behavior) = REQUIRED];</code> + */ + private $name = ''; + /** + * Required. The number of running instances for the node group to maintain. + * The group adds or removes instances to maintain the number of instances + * specified by this parameter. + * + * Generated from protobuf field <code>int32 size = 2 [(.google.api.field_behavior) = REQUIRED];</code> + */ + private $size = 0; + /** + * Optional. A unique ID used to identify the request. If the server receives + * two + * [ResizeNodeGroupRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.ResizeNodeGroupRequests) + * with the same ID, the second request is ignored and the + * first [google.longrunning.Operation][google.longrunning.Operation] created + * and stored in the backend is returned. + * Recommendation: Set this value to a + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier). + * The ID must contain only letters (a-z, A-Z), numbers (0-9), + * underscores (_), and hyphens (-). The maximum length is 40 characters. + * + * Generated from protobuf field <code>string request_id = 3 [(.google.api.field_behavior) = OPTIONAL];</code> + */ + private $request_id = ''; + /** + * Optional. Timeout for graceful YARN decommissioning. [Graceful + * decommissioning] + * (https://cloud.google.com/dataproc/docs/concepts/configuring-clusters/scaling-clusters#graceful_decommissioning) + * allows the removal of nodes from the Compute Engine node group + * without interrupting jobs in progress. This timeout specifies how long to + * wait for jobs in progress to finish before forcefully removing nodes (and + * potentially interrupting jobs). Default timeout is 0 (for forceful + * decommission), and the maximum allowed timeout is 1 day. (see JSON + * representation of + * [Duration](https://developers.google.com/protocol-buffers/docs/proto3#json)). + * Only supported on Dataproc image versions 1.2 and higher. + * + * Generated from protobuf field <code>.google.protobuf.Duration graceful_decommission_timeout = 4 [(.google.api.field_behavior) = OPTIONAL];</code> + */ + private $graceful_decommission_timeout = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the node group to resize. + * Format: + * `projects/{project}/regions/{region}/clusters/{cluster}/nodeGroups/{nodeGroup}` + * @type int $size + * Required. The number of running instances for the node group to maintain. + * The group adds or removes instances to maintain the number of instances + * specified by this parameter. + * @type string $request_id + * Optional. A unique ID used to identify the request. If the server receives + * two + * [ResizeNodeGroupRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.ResizeNodeGroupRequests) + * with the same ID, the second request is ignored and the + * first [google.longrunning.Operation][google.longrunning.Operation] created + * and stored in the backend is returned. + * Recommendation: Set this value to a + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier). + * The ID must contain only letters (a-z, A-Z), numbers (0-9), + * underscores (_), and hyphens (-). The maximum length is 40 characters. + * @type \Google\Protobuf\Duration $graceful_decommission_timeout + * Optional. Timeout for graceful YARN decommissioning. [Graceful + * decommissioning] + * (https://cloud.google.com/dataproc/docs/concepts/configuring-clusters/scaling-clusters#graceful_decommissioning) + * allows the removal of nodes from the Compute Engine node group + * without interrupting jobs in progress. This timeout specifies how long to + * wait for jobs in progress to finish before forcefully removing nodes (and + * potentially interrupting jobs). Default timeout is 0 (for forceful + * decommission), and the maximum allowed timeout is 1 day. (see JSON + * representation of + * [Duration](https://developers.google.com/protocol-buffers/docs/proto3#json)). + * Only supported on Dataproc image versions 1.2 and higher. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dataproc\V1\NodeGroups::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the node group to resize. + * Format: + * `projects/{project}/regions/{region}/clusters/{cluster}/nodeGroups/{nodeGroup}` + * + * Generated from protobuf field <code>string name = 1 [(.google.api.field_behavior) = REQUIRED];</code> + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The name of the node group to resize. + * Format: + * `projects/{project}/regions/{region}/clusters/{cluster}/nodeGroups/{nodeGroup}` + * + * Generated from protobuf field <code>string name = 1 [(.google.api.field_behavior) = REQUIRED];</code> + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Required. The number of running instances for the node group to maintain. + * The group adds or removes instances to maintain the number of instances + * specified by this parameter. + * + * Generated from protobuf field <code>int32 size = 2 [(.google.api.field_behavior) = REQUIRED];</code> + * @return int + */ + public function getSize() + { + return $this->size; + } + + /** + * Required. The number of running instances for the node group to maintain. + * The group adds or removes instances to maintain the number of instances + * specified by this parameter. + * + * Generated from protobuf field <code>int32 size = 2 [(.google.api.field_behavior) = REQUIRED];</code> + * @param int $var + * @return $this + */ + public function setSize($var) + { + GPBUtil::checkInt32($var); + $this->size = $var; + + return $this; + } + + /** + * Optional. A unique ID used to identify the request. If the server receives + * two + * [ResizeNodeGroupRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.ResizeNodeGroupRequests) + * with the same ID, the second request is ignored and the + * first [google.longrunning.Operation][google.longrunning.Operation] created + * and stored in the backend is returned. + * Recommendation: Set this value to a + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier). + * The ID must contain only letters (a-z, A-Z), numbers (0-9), + * underscores (_), and hyphens (-). The maximum length is 40 characters. + * + * Generated from protobuf field <code>string request_id = 3 [(.google.api.field_behavior) = OPTIONAL];</code> + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. A unique ID used to identify the request. If the server receives + * two + * [ResizeNodeGroupRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.ResizeNodeGroupRequests) + * with the same ID, the second request is ignored and the + * first [google.longrunning.Operation][google.longrunning.Operation] created + * and stored in the backend is returned. + * Recommendation: Set this value to a + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier). + * The ID must contain only letters (a-z, A-Z), numbers (0-9), + * underscores (_), and hyphens (-). The maximum length is 40 characters. + * + * Generated from protobuf field <code>string request_id = 3 [(.google.api.field_behavior) = OPTIONAL];</code> + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + + /** + * Optional. Timeout for graceful YARN decommissioning. [Graceful + * decommissioning] + * (https://cloud.google.com/dataproc/docs/concepts/configuring-clusters/scaling-clusters#graceful_decommissioning) + * allows the removal of nodes from the Compute Engine node group + * without interrupting jobs in progress. This timeout specifies how long to + * wait for jobs in progress to finish before forcefully removing nodes (and + * potentially interrupting jobs). Default timeout is 0 (for forceful + * decommission), and the maximum allowed timeout is 1 day. (see JSON + * representation of + * [Duration](https://developers.google.com/protocol-buffers/docs/proto3#json)). + * Only supported on Dataproc image versions 1.2 and higher. + * + * Generated from protobuf field <code>.google.protobuf.Duration graceful_decommission_timeout = 4 [(.google.api.field_behavior) = OPTIONAL];</code> + * @return \Google\Protobuf\Duration|null + */ + public function getGracefulDecommissionTimeout() + { + return $this->graceful_decommission_timeout; + } + + public function hasGracefulDecommissionTimeout() + { + return isset($this->graceful_decommission_timeout); + } + + public function clearGracefulDecommissionTimeout() + { + unset($this->graceful_decommission_timeout); + } + + /** + * Optional. Timeout for graceful YARN decommissioning. [Graceful + * decommissioning] + * (https://cloud.google.com/dataproc/docs/concepts/configuring-clusters/scaling-clusters#graceful_decommissioning) + * allows the removal of nodes from the Compute Engine node group + * without interrupting jobs in progress. This timeout specifies how long to + * wait for jobs in progress to finish before forcefully removing nodes (and + * potentially interrupting jobs). Default timeout is 0 (for forceful + * decommission), and the maximum allowed timeout is 1 day. (see JSON + * representation of + * [Duration](https://developers.google.com/protocol-buffers/docs/proto3#json)). + * Only supported on Dataproc image versions 1.2 and higher. + * + * Generated from protobuf field <code>.google.protobuf.Duration graceful_decommission_timeout = 4 [(.google.api.field_behavior) = OPTIONAL];</code> + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setGracefulDecommissionTimeout($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->graceful_decommission_timeout = $var; + + return $this; + } + +} + diff --git a/Dataproc/src/V1/SparkJob.php b/Dataproc/src/V1/SparkJob.php index ba573d14aa02..7eb838a10215 100644 --- a/Dataproc/src/V1/SparkJob.php +++ b/Dataproc/src/V1/SparkJob.php @@ -9,7 +9,7 @@ use Google\Protobuf\Internal\GPBUtil; /** - * A Dataproc job for running [Apache Spark](http://spark.apache.org/) + * A Dataproc job for running [Apache Spark](https://spark.apache.org/) * applications on YARN. * * Generated from protobuf message <code>google.cloud.dataproc.v1.SparkJob</code> diff --git a/Dataproc/src/V1/SparkSqlJob.php b/Dataproc/src/V1/SparkSqlJob.php index 94d760deac88..2ed893d94092 100644 --- a/Dataproc/src/V1/SparkSqlJob.php +++ b/Dataproc/src/V1/SparkSqlJob.php @@ -10,7 +10,7 @@ /** * A Dataproc job for running [Apache Spark - * SQL](http://spark.apache.org/sql/) queries. + * SQL](https://spark.apache.org/sql/) queries. * * Generated from protobuf message <code>google.cloud.dataproc.v1.SparkSqlJob</code> */ diff --git a/Dataproc/src/V1/StartClusterRequest.php b/Dataproc/src/V1/StartClusterRequest.php index 25e5844cd57a..9ae57597980c 100644 --- a/Dataproc/src/V1/StartClusterRequest.php +++ b/Dataproc/src/V1/StartClusterRequest.php @@ -46,8 +46,8 @@ class StartClusterRequest extends \Google\Protobuf\Internal\Message * receives two * [StartClusterRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.StartClusterRequest)s * with the same id, then the second request will be ignored and the - * first [google.longrunning.Operation][google.longrunning.Operation] created and stored in the - * backend is returned. + * first [google.longrunning.Operation][google.longrunning.Operation] created + * and stored in the backend is returned. * Recommendation: Set this value to a * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier). * The ID must contain only letters (a-z, A-Z), numbers (0-9), @@ -78,8 +78,8 @@ class StartClusterRequest extends \Google\Protobuf\Internal\Message * receives two * [StartClusterRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.StartClusterRequest)s * with the same id, then the second request will be ignored and the - * first [google.longrunning.Operation][google.longrunning.Operation] created and stored in the - * backend is returned. + * first [google.longrunning.Operation][google.longrunning.Operation] created + * and stored in the backend is returned. * Recommendation: Set this value to a * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier). * The ID must contain only letters (a-z, A-Z), numbers (0-9), @@ -204,8 +204,8 @@ public function setClusterUuid($var) * receives two * [StartClusterRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.StartClusterRequest)s * with the same id, then the second request will be ignored and the - * first [google.longrunning.Operation][google.longrunning.Operation] created and stored in the - * backend is returned. + * first [google.longrunning.Operation][google.longrunning.Operation] created + * and stored in the backend is returned. * Recommendation: Set this value to a * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier). * The ID must contain only letters (a-z, A-Z), numbers (0-9), @@ -224,8 +224,8 @@ public function getRequestId() * receives two * [StartClusterRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.StartClusterRequest)s * with the same id, then the second request will be ignored and the - * first [google.longrunning.Operation][google.longrunning.Operation] created and stored in the - * backend is returned. + * first [google.longrunning.Operation][google.longrunning.Operation] created + * and stored in the backend is returned. * Recommendation: Set this value to a * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier). * The ID must contain only letters (a-z, A-Z), numbers (0-9), diff --git a/Dataproc/src/V1/StopClusterRequest.php b/Dataproc/src/V1/StopClusterRequest.php index 85d52327b78b..fa4d305a2633 100644 --- a/Dataproc/src/V1/StopClusterRequest.php +++ b/Dataproc/src/V1/StopClusterRequest.php @@ -46,8 +46,8 @@ class StopClusterRequest extends \Google\Protobuf\Internal\Message * receives two * [StopClusterRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.StopClusterRequest)s * with the same id, then the second request will be ignored and the - * first [google.longrunning.Operation][google.longrunning.Operation] created and stored in the - * backend is returned. + * first [google.longrunning.Operation][google.longrunning.Operation] created + * and stored in the backend is returned. * Recommendation: Set this value to a * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier). * The ID must contain only letters (a-z, A-Z), numbers (0-9), @@ -78,8 +78,8 @@ class StopClusterRequest extends \Google\Protobuf\Internal\Message * receives two * [StopClusterRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.StopClusterRequest)s * with the same id, then the second request will be ignored and the - * first [google.longrunning.Operation][google.longrunning.Operation] created and stored in the - * backend is returned. + * first [google.longrunning.Operation][google.longrunning.Operation] created + * and stored in the backend is returned. * Recommendation: Set this value to a * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier). * The ID must contain only letters (a-z, A-Z), numbers (0-9), @@ -204,8 +204,8 @@ public function setClusterUuid($var) * receives two * [StopClusterRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.StopClusterRequest)s * with the same id, then the second request will be ignored and the - * first [google.longrunning.Operation][google.longrunning.Operation] created and stored in the - * backend is returned. + * first [google.longrunning.Operation][google.longrunning.Operation] created + * and stored in the backend is returned. * Recommendation: Set this value to a * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier). * The ID must contain only letters (a-z, A-Z), numbers (0-9), @@ -224,8 +224,8 @@ public function getRequestId() * receives two * [StopClusterRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.StopClusterRequest)s * with the same id, then the second request will be ignored and the - * first [google.longrunning.Operation][google.longrunning.Operation] created and stored in the - * backend is returned. + * first [google.longrunning.Operation][google.longrunning.Operation] created + * and stored in the backend is returned. * Recommendation: Set this value to a * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier). * The ID must contain only letters (a-z, A-Z), numbers (0-9), diff --git a/Dataproc/src/V1/UpdateClusterRequest.php b/Dataproc/src/V1/UpdateClusterRequest.php index c461fb3e50a4..dead99971673 100644 --- a/Dataproc/src/V1/UpdateClusterRequest.php +++ b/Dataproc/src/V1/UpdateClusterRequest.php @@ -111,8 +111,8 @@ class UpdateClusterRequest extends \Google\Protobuf\Internal\Message * receives two * [UpdateClusterRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.UpdateClusterRequest)s * with the same id, then the second request will be ignored and the - * first [google.longrunning.Operation][google.longrunning.Operation] created and stored in the - * backend is returned. + * first [google.longrunning.Operation][google.longrunning.Operation] created + * and stored in the backend is returned. * It is recommended to always set this value to a * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier). * The ID must contain only letters (a-z, A-Z), numbers (0-9), @@ -200,8 +200,8 @@ class UpdateClusterRequest extends \Google\Protobuf\Internal\Message * receives two * [UpdateClusterRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.UpdateClusterRequest)s * with the same id, then the second request will be ignored and the - * first [google.longrunning.Operation][google.longrunning.Operation] created and stored in the - * backend is returned. + * first [google.longrunning.Operation][google.longrunning.Operation] created + * and stored in the backend is returned. * It is recommended to always set this value to a * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier). * The ID must contain only letters (a-z, A-Z), numbers (0-9), @@ -514,8 +514,8 @@ public function setUpdateMask($var) * receives two * [UpdateClusterRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.UpdateClusterRequest)s * with the same id, then the second request will be ignored and the - * first [google.longrunning.Operation][google.longrunning.Operation] created and stored in the - * backend is returned. + * first [google.longrunning.Operation][google.longrunning.Operation] created + * and stored in the backend is returned. * It is recommended to always set this value to a * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier). * The ID must contain only letters (a-z, A-Z), numbers (0-9), @@ -534,8 +534,8 @@ public function getRequestId() * receives two * [UpdateClusterRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.UpdateClusterRequest)s * with the same id, then the second request will be ignored and the - * first [google.longrunning.Operation][google.longrunning.Operation] created and stored in the - * backend is returned. + * first [google.longrunning.Operation][google.longrunning.Operation] created + * and stored in the backend is returned. * It is recommended to always set this value to a * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier). * The ID must contain only letters (a-z, A-Z), numbers (0-9), diff --git a/Dataproc/src/V1/VirtualClusterConfig.php b/Dataproc/src/V1/VirtualClusterConfig.php index efe136167966..a30cabffe580 100644 --- a/Dataproc/src/V1/VirtualClusterConfig.php +++ b/Dataproc/src/V1/VirtualClusterConfig.php @@ -9,16 +9,16 @@ use Google\Protobuf\Internal\GPBUtil; /** - * Dataproc cluster config for a cluster that does not directly control the + * The Dataproc cluster config for a cluster that does not directly control the * underlying compute resources, such as a [Dataproc-on-GKE - * cluster](https://cloud.google.com/dataproc/docs/concepts/jobs/dataproc-gke#create-a-dataproc-on-gke-cluster). + * cluster](https://cloud.google.com/dataproc/docs/guides/dpgke/dataproc-gke). * * Generated from protobuf message <code>google.cloud.dataproc.v1.VirtualClusterConfig</code> */ class VirtualClusterConfig extends \Google\Protobuf\Internal\Message { /** - * Optional. A Storage bucket used to stage job + * Optional. A Cloud Storage bucket used to stage job * dependencies, config files, and job driver console output. * If you do not specify a staging bucket, Cloud * Dataproc will determine a Cloud Storage location (US, @@ -48,7 +48,7 @@ class VirtualClusterConfig extends \Google\Protobuf\Internal\Message * Optional. Data for populating the Message object. * * @type string $staging_bucket - * Optional. A Storage bucket used to stage job + * Optional. A Cloud Storage bucket used to stage job * dependencies, config files, and job driver console output. * If you do not specify a staging bucket, Cloud * Dataproc will determine a Cloud Storage location (US, @@ -60,7 +60,8 @@ class VirtualClusterConfig extends \Google\Protobuf\Internal\Message * **This field requires a Cloud Storage bucket name, not a `gs://...` URI to * a Cloud Storage bucket.** * @type \Google\Cloud\Dataproc\V1\KubernetesClusterConfig $kubernetes_cluster_config - * Required. The configuration for running the Dataproc cluster on Kubernetes. + * Required. The configuration for running the Dataproc cluster on + * Kubernetes. * @type \Google\Cloud\Dataproc\V1\AuxiliaryServicesConfig $auxiliary_services_config * Optional. Configuration of auxiliary services used by this cluster. * } @@ -71,7 +72,7 @@ public function __construct($data = NULL) { } /** - * Optional. A Storage bucket used to stage job + * Optional. A Cloud Storage bucket used to stage job * dependencies, config files, and job driver console output. * If you do not specify a staging bucket, Cloud * Dataproc will determine a Cloud Storage location (US, @@ -92,7 +93,7 @@ public function getStagingBucket() } /** - * Optional. A Storage bucket used to stage job + * Optional. A Cloud Storage bucket used to stage job * dependencies, config files, and job driver console output. * If you do not specify a staging bucket, Cloud * Dataproc will determine a Cloud Storage location (US, @@ -117,7 +118,8 @@ public function setStagingBucket($var) } /** - * Required. The configuration for running the Dataproc cluster on Kubernetes. + * Required. The configuration for running the Dataproc cluster on + * Kubernetes. * * Generated from protobuf field <code>.google.cloud.dataproc.v1.KubernetesClusterConfig kubernetes_cluster_config = 6 [(.google.api.field_behavior) = REQUIRED];</code> * @return \Google\Cloud\Dataproc\V1\KubernetesClusterConfig|null @@ -133,7 +135,8 @@ public function hasKubernetesClusterConfig() } /** - * Required. The configuration for running the Dataproc cluster on Kubernetes. + * Required. The configuration for running the Dataproc cluster on + * Kubernetes. * * Generated from protobuf field <code>.google.cloud.dataproc.v1.KubernetesClusterConfig kubernetes_cluster_config = 6 [(.google.api.field_behavior) = REQUIRED];</code> * @param \Google\Cloud\Dataproc\V1\KubernetesClusterConfig $var diff --git a/Dataproc/src/V1/gapic_metadata.json b/Dataproc/src/V1/gapic_metadata.json index 0c58f68a88ea..ae71cfb4a8c8 100644 --- a/Dataproc/src/V1/gapic_metadata.json +++ b/Dataproc/src/V1/gapic_metadata.json @@ -204,6 +204,30 @@ } } } + }, + "NodeGroupController": { + "clients": { + "grpc": { + "libraryClient": "NodeGroupControllerGapicClient", + "rpcs": { + "CreateNodeGroup": { + "methods": [ + "createNodeGroup" + ] + }, + "GetNodeGroup": { + "methods": [ + "getNodeGroup" + ] + }, + "ResizeNodeGroup": { + "methods": [ + "resizeNodeGroup" + ] + } + } + } + } } } } \ No newline at end of file diff --git a/Dataproc/src/V1/resources/node_group_controller_client_config.json b/Dataproc/src/V1/resources/node_group_controller_client_config.json new file mode 100644 index 000000000000..3024a015dd76 --- /dev/null +++ b/Dataproc/src/V1/resources/node_group_controller_client_config.json @@ -0,0 +1,37 @@ +{ + "interfaces": { + "google.cloud.dataproc.v1.NodeGroupController": { + "retry_codes": { + "no_retry_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 + } + }, + "methods": { + "CreateNodeGroup": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "GetNodeGroup": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "ResizeNodeGroup": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + } + } + } + } +} diff --git a/Dataproc/src/V1/resources/node_group_controller_descriptor_config.php b/Dataproc/src/V1/resources/node_group_controller_descriptor_config.php new file mode 100644 index 000000000000..d021bf861c32 --- /dev/null +++ b/Dataproc/src/V1/resources/node_group_controller_descriptor_config.php @@ -0,0 +1,28 @@ +<?php + +return [ + 'interfaces' => [ + 'google.cloud.dataproc.v1.NodeGroupController' => [ + 'CreateNodeGroup' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\Dataproc\V1\NodeGroup', + 'metadataReturnType' => '\Google\Cloud\Dataproc\V1\NodeGroupOperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + 'ResizeNodeGroup' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\Dataproc\V1\NodeGroup', + 'metadataReturnType' => '\Google\Cloud\Dataproc\V1\NodeGroupOperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + ], + ], +]; diff --git a/Dataproc/src/V1/resources/node_group_controller_rest_client_config.php b/Dataproc/src/V1/resources/node_group_controller_rest_client_config.php new file mode 100644 index 000000000000..5d3428dc9178 --- /dev/null +++ b/Dataproc/src/V1/resources/node_group_controller_rest_client_config.php @@ -0,0 +1,223 @@ +<?php + +return [ + 'interfaces' => [ + 'google.cloud.dataproc.v1.NodeGroupController' => [ + 'CreateNodeGroup' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/regions/*/clusters/*}/nodeGroups', + 'body' => 'node_group', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'GetNodeGroup' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/regions/*/clusters/*/nodeGroups/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ResizeNodeGroup' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=projects/*/regions/*/clusters/*/nodeGroups/*}:resize', + 'body' => '*', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + ], + 'google.iam.v1.IAMPolicy' => [ + 'GetIamPolicy' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/regions/*/clusters/*}:getIamPolicy', + 'body' => '*', + 'additionalBindings' => [ + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/regions/*/jobs/*}:getIamPolicy', + 'body' => '*', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/regions/*/operations/*}:getIamPolicy', + 'body' => '*', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/regions/*/workflowTemplates/*}:getIamPolicy', + 'body' => '*', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/locations/*/workflowTemplates/*}:getIamPolicy', + 'body' => '*', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/regions/*/autoscalingPolicies/*}:getIamPolicy', + 'body' => '*', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/locations/*/autoscalingPolicies/*}:getIamPolicy', + 'body' => '*', + ], + ], + 'placeholders' => [ + 'resource' => [ + 'getters' => [ + 'getResource', + ], + ], + ], + ], + 'SetIamPolicy' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/regions/*/clusters/*}:setIamPolicy', + 'body' => '*', + 'additionalBindings' => [ + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/regions/*/jobs/*}:setIamPolicy', + 'body' => '*', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/regions/*/operations/*}:setIamPolicy', + 'body' => '*', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/regions/*/workflowTemplates/*}:setIamPolicy', + 'body' => '*', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/locations/*/workflowTemplates/*}:setIamPolicy', + 'body' => '*', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/regions/*/autoscalingPolicies/*}:setIamPolicy', + 'body' => '*', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/locations/*/autoscalingPolicies/*}:setIamPolicy', + 'body' => '*', + ], + ], + 'placeholders' => [ + 'resource' => [ + 'getters' => [ + 'getResource', + ], + ], + ], + ], + 'TestIamPermissions' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/regions/*/clusters/*}:testIamPermissions', + 'body' => '*', + 'additionalBindings' => [ + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/regions/*/jobs/*}:testIamPermissions', + 'body' => '*', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/regions/*/operations/*}:testIamPermissions', + 'body' => '*', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/regions/*/workflowTemplates/*}:testIamPermissions', + 'body' => '*', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/locations/*/workflowTemplates/*}:testIamPermissions', + 'body' => '*', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/regions/*/autoscalingPolicies/*}:testIamPermissions', + 'body' => '*', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/locations/*/autoscalingPolicies/*}:testIamPermissions', + 'body' => '*', + ], + ], + 'placeholders' => [ + 'resource' => [ + 'getters' => [ + 'getResource', + ], + ], + ], + ], + ], + 'google.longrunning.Operations' => [ + 'CancelOperation' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=projects/*/regions/*/operations/*}:cancel', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'DeleteOperation' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/regions/*/operations/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetOperation' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/regions/*/operations/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListOperations' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/regions/*/operations}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + ], + ], +]; diff --git a/Dataproc/tests/Unit/V1/NodeGroupControllerClientTest.php b/Dataproc/tests/Unit/V1/NodeGroupControllerClientTest.php new file mode 100644 index 000000000000..f0ff56cc237e --- /dev/null +++ b/Dataproc/tests/Unit/V1/NodeGroupControllerClientTest.php @@ -0,0 +1,375 @@ +<?php +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* + * GENERATED CODE WARNING + * This file was automatically generated - do not edit! + */ + +namespace Google\Cloud\Dataproc\Tests\Unit\V1; + +use Google\ApiCore\ApiException; +use Google\ApiCore\CredentialsWrapper; +use Google\ApiCore\LongRunning\OperationsClient; +use Google\ApiCore\Testing\GeneratedTest; +use Google\ApiCore\Testing\MockTransport; +use Google\Cloud\Dataproc\V1\NodeGroup; +use Google\Cloud\Dataproc\V1\NodeGroupControllerClient; +use Google\LongRunning\GetOperationRequest; +use Google\LongRunning\Operation; +use Google\Protobuf\Any; +use Google\Rpc\Code; +use stdClass; + +/** + * @group dataproc + * + * @group gapic + */ +class NodeGroupControllerClientTest extends GeneratedTest +{ + /** @return TransportInterface */ + private function createTransport($deserialize = null) + { + return new MockTransport($deserialize); + } + + /** @return CredentialsWrapper */ + private function createCredentials() + { + return $this->getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return NodeGroupControllerClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new NodeGroupControllerClient($options); + } + + /** @test */ + public function createNodeGroupTest() + { + $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/createNodeGroupTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $expectedResponse = new NodeGroup(); + $expectedResponse->setName($name); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createNodeGroupTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->clusterRegionName('[PROJECT]', '[REGION]', '[CLUSTER]'); + $nodeGroup = new NodeGroup(); + $nodeGroupRoles = []; + $nodeGroup->setRoles($nodeGroupRoles); + $response = $gapicClient->createNodeGroup($formattedParent, $nodeGroup); + $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.dataproc.v1.NodeGroupController/CreateNodeGroup', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getNodeGroup(); + $this->assertProtobufEquals($nodeGroup, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createNodeGroupTest'); + $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 createNodeGroupExceptionTest() + { + $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/createNodeGroupTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $operationsTransport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->clusterRegionName('[PROJECT]', '[REGION]', '[CLUSTER]'); + $nodeGroup = new NodeGroup(); + $nodeGroupRoles = []; + $nodeGroup->setRoles($nodeGroupRoles); + $response = $gapicClient->createNodeGroup($formattedParent, $nodeGroup); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createNodeGroupTest'); + 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 getNodeGroupTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $expectedResponse = new NodeGroup(); + $expectedResponse->setName($name2); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->nodeGroupName('[PROJECT]', '[REGION]', '[CLUSTER]', '[NODE_GROUP]'); + $response = $gapicClient->getNodeGroup($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.dataproc.v1.NodeGroupController/GetNodeGroup', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getNodeGroupExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->nodeGroupName('[PROJECT]', '[REGION]', '[CLUSTER]', '[NODE_GROUP]'); + try { + $gapicClient->getNodeGroup($formattedName); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function resizeNodeGroupTest() + { + $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/resizeNodeGroupTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name2 = 'name2-1052831874'; + $expectedResponse = new NodeGroup(); + $expectedResponse->setName($name2); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/resizeNodeGroupTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $name = 'name3373707'; + $size = 3530753; + $response = $gapicClient->resizeNodeGroup($name, $size); + $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.dataproc.v1.NodeGroupController/ResizeNodeGroup', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($name, $actualValue); + $actualValue = $actualApiRequestObject->getSize(); + $this->assertProtobufEquals($size, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/resizeNodeGroupTest'); + $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 resizeNodeGroupExceptionTest() + { + $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/resizeNodeGroupTest'); + $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'; + $size = 3530753; + $response = $gapicClient->resizeNodeGroup($name, $size); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/resizeNodeGroupTest'); + 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()); + } +}