Google Anthos Multi Cloud V1 Client - Class AwsClustersClient (0.4.4)

Reference documentation and code samples for the Google Anthos Multi Cloud V1 Client class AwsClustersClient.

Service Description: The AwsClusters API provides a single centrally managed service to create and manage Anthos clusters that run on AWS infrastructure.

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:

$awsClustersClient = new AwsClustersClient();
try {
    $formattedParent = $awsClustersClient->locationName('[PROJECT]', '[LOCATION]');
    $awsCluster = new AwsCluster();
    $awsClusterId = 'aws_cluster_id';
    $operationResponse = $awsClustersClient->createAwsCluster($formattedParent, $awsCluster, $awsClusterId);
    $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 = $awsClustersClient->createAwsCluster($formattedParent, $awsCluster, $awsClusterId);
    $operationName = $operationResponse->getName();
    // ... do other work
    $newOperationResponse = $awsClustersClient->resumeOperation($operationName, 'createAwsCluster');
    while (!$newOperationResponse->isDone()) {
        // ... do other work
        $newOperationResponse->reload();
    }
    if ($newOperationResponse->operationSucceeded()) {
        $result = $newOperationResponse->getResult();
    // doSomethingWith($result)
    } else {
        $error = $newOperationResponse->getError();
        // handleError($error)
    }
} finally {
    $awsClustersClient->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.

This service has a new (beta) implementation. See Google\Cloud\GkeMultiCloud\V1\Client\AwsClustersClient to use the new surface.

Namespace

Google \ Cloud \ GkeMultiCloud \ V1

Methods

__construct

Constructor.

Parameters
NameDescription
options array

Optional. Options for configuring the service API wrapper.

↳ apiEndpoint string

The address of the API remote host. May optionally include the port, formatted as "

↳ credentials string|array|FetchAuthTokenInterface|CredentialsWrapper

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 Google\Auth\FetchAuthTokenInterface object or Google\ApiCore\CredentialsWrapper object. Note that when one of these objects are provided, any settings in $credentialsConfig will be ignored.

↳ credentialsConfig array

Options used to configure credentials, including auth token caching, for the client. For a full list of supporting configuration options, see Google\ApiCore\CredentialsWrapper::build() .

↳ disableRetries bool

Determines whether or not retries defined by the client configuration should be disabled. Defaults to false.

↳ clientConfig string|array

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.

↳ transport string|TransportInterface

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 Google\ApiCore\Transport\TransportInterface object. Note that when this object is provided, any settings in $transportConfig, and any $apiEndpoint setting, will be ignored.

↳ transportConfig array

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 Google\ApiCore\Transport\GrpcTransport::build() and Google\ApiCore\Transport\RestTransport::build() methods for the supported options.

↳ clientCertSource callable

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.

createAwsCluster

Creates a new AwsCluster resource on a given Google Cloud Platform project and region.

If successful, the response contains a newly created Operation resource that can be described to track the status of the operation.

Parameters
NameDescription
parent string

Required. The parent location where this AwsCluster resource will be created.

Location names are formatted as projects/<project-id>/locations/<region>.

See Resource Names for more details on Google Cloud resource names.

awsCluster Google\Cloud\GkeMultiCloud\V1\AwsCluster

Required. The specification of the AwsCluster to create.

awsClusterId string

Required. A client provided ID the resource. Must be unique within the parent resource.

The provided ID will be part of the AwsCluster resource name formatted as projects/<project-id>/locations/<region>/awsClusters/<cluster-id>.

Valid characters are /[a-z][0-9]-/. Cannot be longer than 63 characters.

optionalArgs array

Optional.

↳ validateOnly bool

If set, only validate the request, but do not actually create the cluster.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
TypeDescription
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\GkeMultiCloud\V1\AwsAuthorization;
use Google\Cloud\GkeMultiCloud\V1\AwsCluster;
use Google\Cloud\GkeMultiCloud\V1\AwsClusterNetworking;
use Google\Cloud\GkeMultiCloud\V1\AwsClusterUser;
use Google\Cloud\GkeMultiCloud\V1\AwsConfigEncryption;
use Google\Cloud\GkeMultiCloud\V1\AwsControlPlane;
use Google\Cloud\GkeMultiCloud\V1\AwsDatabaseEncryption;
use Google\Cloud\GkeMultiCloud\V1\AwsServicesAuthentication;
use Google\Cloud\GkeMultiCloud\V1\Client\AwsClustersClient;
use Google\Cloud\GkeMultiCloud\V1\CreateAwsClusterRequest;
use Google\Cloud\GkeMultiCloud\V1\Fleet;
use Google\Rpc\Status;

/**
 * @param string $formattedParent                                        The parent location where this
 *                                                                       [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] resource will be
 *                                                                       created.
 *
 *                                                                       Location names are formatted as `projects/<project-id>/locations/<region>`.
 *
 *                                                                       See [Resource Names](https://cloud.google.com/apis/design/resource_names)
 *                                                                       for more details on Google Cloud resource names. Please see
 *                                                                       {@see AwsClustersClient::locationName()} for help formatting this field.
 * @param string $awsClusterNetworkingVpcId                              The VPC associated with the cluster. All component clusters
 *                                                                       (i.e. control plane and node pools) run on a single VPC.
 *
 *                                                                       This field cannot be changed after creation.
 * @param string $awsClusterNetworkingPodAddressCidrBlocksElement        All pods in the cluster are assigned an IPv4 address from these
 *                                                                       ranges. Only a single range is supported. This field cannot be changed
 *                                                                       after creation.
 * @param string $awsClusterNetworkingServiceAddressCidrBlocksElement    All services in the cluster are assigned an IPv4 address from
 *                                                                       these ranges. Only a single range is supported. This field cannot be
 *                                                                       changed after creation.
 * @param string $awsClusterAwsRegion                                    The AWS region where the cluster runs.
 *
 *                                                                       Each Google Cloud region supports a subset of nearby AWS regions.
 *                                                                       You can call
 *                                                                       [GetAwsServerConfig][google.cloud.gkemulticloud.v1.AwsClusters.GetAwsServerConfig]
 *                                                                       to list all supported AWS regions within a given Google Cloud region.
 * @param string $awsClusterControlPlaneVersion                          The Kubernetes version to run on control plane replicas
 *                                                                       (e.g. `1.19.10-gke.1000`).
 *
 *                                                                       You can list all supported versions on a given Google Cloud region by
 *                                                                       calling
 *                                                                       [GetAwsServerConfig][google.cloud.gkemulticloud.v1.AwsClusters.GetAwsServerConfig].
 * @param string $awsClusterControlPlaneSubnetIdsElement                 The list of subnets where control plane replicas will run.
 *                                                                       A replica will be provisioned on each subnet and up to three values
 *                                                                       can be provided.
 *                                                                       Each subnet must be in a different AWS Availability Zone (AZ).
 * @param string $awsClusterControlPlaneIamInstanceProfile               The name or ARN of the AWS IAM instance profile to assign to each
 *                                                                       control plane replica.
 * @param string $awsClusterControlPlaneDatabaseEncryptionKmsKeyArn      The ARN of the AWS KMS key used to encrypt cluster secrets.
 * @param string $awsClusterControlPlaneAwsServicesAuthenticationRoleArn The Amazon Resource Name (ARN) of the role that the Anthos
 *                                                                       Multi-Cloud API will assume when managing AWS resources on your account.
 * @param string $awsClusterControlPlaneConfigEncryptionKmsKeyArn        The ARN of the AWS KMS key used to encrypt user data.
 * @param string $awsClusterAuthorizationAdminUsersUsername              The name of the user, e.g. `my-gcp-id&#64;gmail.com`.
 * @param string $awsClusterFleetProject                                 The name of the Fleet host project where this cluster will be
 *                                                                       registered.
 *
 *                                                                       Project names are formatted as
 *                                                                       `projects/<project-number>`.
 * @param string $awsClusterId                                           A client provided ID the resource. Must be unique within the
 *                                                                       parent resource.
 *
 *                                                                       The provided ID will be part of the
 *                                                                       [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] resource name
 *                                                                       formatted as
 *                                                                       `projects/<project-id>/locations/<region>/awsClusters/<cluster-id>`.
 *
 *                                                                       Valid characters are `/[a-z][0-9]-/`. Cannot be longer than 63 characters.
 */
function create_aws_cluster_sample(
    string $formattedParent,
    string $awsClusterNetworkingVpcId,
    string $awsClusterNetworkingPodAddressCidrBlocksElement,
    string $awsClusterNetworkingServiceAddressCidrBlocksElement,
    string $awsClusterAwsRegion,
    string $awsClusterControlPlaneVersion,
    string $awsClusterControlPlaneSubnetIdsElement,
    string $awsClusterControlPlaneIamInstanceProfile,
    string $awsClusterControlPlaneDatabaseEncryptionKmsKeyArn,
    string $awsClusterControlPlaneAwsServicesAuthenticationRoleArn,
    string $awsClusterControlPlaneConfigEncryptionKmsKeyArn,
    string $awsClusterAuthorizationAdminUsersUsername,
    string $awsClusterFleetProject,
    string $awsClusterId
): void {
    // Create a client.
    $awsClustersClient = new AwsClustersClient();

    // Prepare the request message.
    $awsClusterNetworkingPodAddressCidrBlocks = [$awsClusterNetworkingPodAddressCidrBlocksElement,];
    $awsClusterNetworkingServiceAddressCidrBlocks = [
        $awsClusterNetworkingServiceAddressCidrBlocksElement,
    ];
    $awsClusterNetworking = (new AwsClusterNetworking())
        ->setVpcId($awsClusterNetworkingVpcId)
        ->setPodAddressCidrBlocks($awsClusterNetworkingPodAddressCidrBlocks)
        ->setServiceAddressCidrBlocks($awsClusterNetworkingServiceAddressCidrBlocks);
    $awsClusterControlPlaneSubnetIds = [$awsClusterControlPlaneSubnetIdsElement,];
    $awsClusterControlPlaneDatabaseEncryption = (new AwsDatabaseEncryption())
        ->setKmsKeyArn($awsClusterControlPlaneDatabaseEncryptionKmsKeyArn);
    $awsClusterControlPlaneAwsServicesAuthentication = (new AwsServicesAuthentication())
        ->setRoleArn($awsClusterControlPlaneAwsServicesAuthenticationRoleArn);
    $awsClusterControlPlaneConfigEncryption = (new AwsConfigEncryption())
        ->setKmsKeyArn($awsClusterControlPlaneConfigEncryptionKmsKeyArn);
    $awsClusterControlPlane = (new AwsControlPlane())
        ->setVersion($awsClusterControlPlaneVersion)
        ->setSubnetIds($awsClusterControlPlaneSubnetIds)
        ->setIamInstanceProfile($awsClusterControlPlaneIamInstanceProfile)
        ->setDatabaseEncryption($awsClusterControlPlaneDatabaseEncryption)
        ->setAwsServicesAuthentication($awsClusterControlPlaneAwsServicesAuthentication)
        ->setConfigEncryption($awsClusterControlPlaneConfigEncryption);
    $awsClusterUser = (new AwsClusterUser())
        ->setUsername($awsClusterAuthorizationAdminUsersUsername);
    $awsClusterAuthorizationAdminUsers = [$awsClusterUser,];
    $awsClusterAuthorization = (new AwsAuthorization())
        ->setAdminUsers($awsClusterAuthorizationAdminUsers);
    $awsClusterFleet = (new Fleet())
        ->setProject($awsClusterFleetProject);
    $awsCluster = (new AwsCluster())
        ->setNetworking($awsClusterNetworking)
        ->setAwsRegion($awsClusterAwsRegion)
        ->setControlPlane($awsClusterControlPlane)
        ->setAuthorization($awsClusterAuthorization)
        ->setFleet($awsClusterFleet);
    $request = (new CreateAwsClusterRequest())
        ->setParent($formattedParent)
        ->setAwsCluster($awsCluster)
        ->setAwsClusterId($awsClusterId);

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $awsClustersClient->createAwsCluster($request);
        $response->pollUntilComplete();

        if ($response->operationSucceeded()) {
            /** @var AwsCluster $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 = AwsClustersClient::locationName('[PROJECT]', '[LOCATION]');
    $awsClusterNetworkingVpcId = '[VPC_ID]';
    $awsClusterNetworkingPodAddressCidrBlocksElement = '[POD_ADDRESS_CIDR_BLOCKS]';
    $awsClusterNetworkingServiceAddressCidrBlocksElement = '[SERVICE_ADDRESS_CIDR_BLOCKS]';
    $awsClusterAwsRegion = '[AWS_REGION]';
    $awsClusterControlPlaneVersion = '[VERSION]';
    $awsClusterControlPlaneSubnetIdsElement = '[SUBNET_IDS]';
    $awsClusterControlPlaneIamInstanceProfile = '[IAM_INSTANCE_PROFILE]';
    $awsClusterControlPlaneDatabaseEncryptionKmsKeyArn = '[KMS_KEY_ARN]';
    $awsClusterControlPlaneAwsServicesAuthenticationRoleArn = '[ROLE_ARN]';
    $awsClusterControlPlaneConfigEncryptionKmsKeyArn = '[KMS_KEY_ARN]';
    $awsClusterAuthorizationAdminUsersUsername = '[USERNAME]';
    $awsClusterFleetProject = '[PROJECT]';
    $awsClusterId = '[AWS_CLUSTER_ID]';

    create_aws_cluster_sample(
        $formattedParent,
        $awsClusterNetworkingVpcId,
        $awsClusterNetworkingPodAddressCidrBlocksElement,
        $awsClusterNetworkingServiceAddressCidrBlocksElement,
        $awsClusterAwsRegion,
        $awsClusterControlPlaneVersion,
        $awsClusterControlPlaneSubnetIdsElement,
        $awsClusterControlPlaneIamInstanceProfile,
        $awsClusterControlPlaneDatabaseEncryptionKmsKeyArn,
        $awsClusterControlPlaneAwsServicesAuthenticationRoleArn,
        $awsClusterControlPlaneConfigEncryptionKmsKeyArn,
        $awsClusterAuthorizationAdminUsersUsername,
        $awsClusterFleetProject,
        $awsClusterId
    );
}

createAwsNodePool

Creates a new AwsNodePool, attached to a given AwsCluster.

If successful, the response contains a newly created Operation resource that can be described to track the status of the operation.

Parameters
NameDescription
parent string

Required. The AwsCluster resource where this node pool will be created.

AwsCluster names are formatted as projects/<project-id>/locations/<region>/awsClusters/<cluster-id>.

See Resource Names for more details on Google Cloud resource names.

awsNodePool Google\Cloud\GkeMultiCloud\V1\AwsNodePool

Required. The specification of the AwsNodePool to create.

awsNodePoolId string

Required. A client provided ID the resource. Must be unique within the parent resource.

The provided ID will be part of the AwsNodePool resource name formatted as projects/<project-id>/locations/<region>/awsClusters/<cluster-id>/awsNodePools/<node-pool-id>.

Valid characters are /[a-z][0-9]-/. Cannot be longer than 63 characters.

optionalArgs array

Optional.

↳ validateOnly bool

If set, only validate the request, but do not actually create the node pool.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
TypeDescription
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\GkeMultiCloud\V1\AwsConfigEncryption;
use Google\Cloud\GkeMultiCloud\V1\AwsNodeConfig;
use Google\Cloud\GkeMultiCloud\V1\AwsNodePool;
use Google\Cloud\GkeMultiCloud\V1\AwsNodePoolAutoscaling;
use Google\Cloud\GkeMultiCloud\V1\Client\AwsClustersClient;
use Google\Cloud\GkeMultiCloud\V1\CreateAwsNodePoolRequest;
use Google\Cloud\GkeMultiCloud\V1\MaxPodsConstraint;
use Google\Rpc\Status;

/**
 * @param string $formattedParent                            The [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster]
 *                                                           resource where this node pool will be created.
 *
 *                                                           `AwsCluster` names are formatted as
 *                                                           `projects/<project-id>/locations/<region>/awsClusters/<cluster-id>`.
 *
 *                                                           See [Resource Names](https://cloud.google.com/apis/design/resource_names)
 *                                                           for more details on Google Cloud resource names. Please see
 *                                                           {@see AwsClustersClient::awsClusterName()} for help formatting this field.
 * @param string $awsNodePoolVersion                         The Kubernetes version to run on this node pool (e.g.
 *                                                           `1.19.10-gke.1000`).
 *
 *                                                           You can list all supported versions on a given Google Cloud region by
 *                                                           calling
 *                                                           [GetAwsServerConfig][google.cloud.gkemulticloud.v1.AwsClusters.GetAwsServerConfig].
 * @param string $awsNodePoolConfigIamInstanceProfile        The name or ARN of the AWS IAM role assigned to nodes in the
 *                                                           pool.
 * @param string $awsNodePoolConfigConfigEncryptionKmsKeyArn The ARN of the AWS KMS key used to encrypt user data.
 * @param int    $awsNodePoolAutoscalingMinNodeCount         Minimum number of nodes in the node pool. Must be greater than or
 *                                                           equal to 1 and less than or equal to max_node_count.
 * @param int    $awsNodePoolAutoscalingMaxNodeCount         Maximum number of nodes in the node pool. Must be greater than or
 *                                                           equal to min_node_count and less than or equal to 50.
 * @param string $awsNodePoolSubnetId                        The subnet where the node pool node run.
 * @param int    $awsNodePoolMaxPodsConstraintMaxPodsPerNode The maximum number of pods to schedule on a single node.
 * @param string $awsNodePoolId                              A client provided ID the resource. Must be unique within the
 *                                                           parent resource.
 *
 *                                                           The provided ID will be part of the
 *                                                           [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool] resource name
 *                                                           formatted as
 *                                                           `projects/<project-id>/locations/<region>/awsClusters/<cluster-id>/awsNodePools/<node-pool-id>`.
 *
 *                                                           Valid characters are `/[a-z][0-9]-/`. Cannot be longer than 63 characters.
 */
function create_aws_node_pool_sample(
    string $formattedParent,
    string $awsNodePoolVersion,
    string $awsNodePoolConfigIamInstanceProfile,
    string $awsNodePoolConfigConfigEncryptionKmsKeyArn,
    int $awsNodePoolAutoscalingMinNodeCount,
    int $awsNodePoolAutoscalingMaxNodeCount,
    string $awsNodePoolSubnetId,
    int $awsNodePoolMaxPodsConstraintMaxPodsPerNode,
    string $awsNodePoolId
): void {
    // Create a client.
    $awsClustersClient = new AwsClustersClient();

    // Prepare the request message.
    $awsNodePoolConfigConfigEncryption = (new AwsConfigEncryption())
        ->setKmsKeyArn($awsNodePoolConfigConfigEncryptionKmsKeyArn);
    $awsNodePoolConfig = (new AwsNodeConfig())
        ->setIamInstanceProfile($awsNodePoolConfigIamInstanceProfile)
        ->setConfigEncryption($awsNodePoolConfigConfigEncryption);
    $awsNodePoolAutoscaling = (new AwsNodePoolAutoscaling())
        ->setMinNodeCount($awsNodePoolAutoscalingMinNodeCount)
        ->setMaxNodeCount($awsNodePoolAutoscalingMaxNodeCount);
    $awsNodePoolMaxPodsConstraint = (new MaxPodsConstraint())
        ->setMaxPodsPerNode($awsNodePoolMaxPodsConstraintMaxPodsPerNode);
    $awsNodePool = (new AwsNodePool())
        ->setVersion($awsNodePoolVersion)
        ->setConfig($awsNodePoolConfig)
        ->setAutoscaling($awsNodePoolAutoscaling)
        ->setSubnetId($awsNodePoolSubnetId)
        ->setMaxPodsConstraint($awsNodePoolMaxPodsConstraint);
    $request = (new CreateAwsNodePoolRequest())
        ->setParent($formattedParent)
        ->setAwsNodePool($awsNodePool)
        ->setAwsNodePoolId($awsNodePoolId);

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $awsClustersClient->createAwsNodePool($request);
        $response->pollUntilComplete();

        if ($response->operationSucceeded()) {
            /** @var AwsNodePool $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 = AwsClustersClient::awsClusterName('[PROJECT]', '[LOCATION]', '[AWS_CLUSTER]');
    $awsNodePoolVersion = '[VERSION]';
    $awsNodePoolConfigIamInstanceProfile = '[IAM_INSTANCE_PROFILE]';
    $awsNodePoolConfigConfigEncryptionKmsKeyArn = '[KMS_KEY_ARN]';
    $awsNodePoolAutoscalingMinNodeCount = 0;
    $awsNodePoolAutoscalingMaxNodeCount = 0;
    $awsNodePoolSubnetId = '[SUBNET_ID]';
    $awsNodePoolMaxPodsConstraintMaxPodsPerNode = 0;
    $awsNodePoolId = '[AWS_NODE_POOL_ID]';

    create_aws_node_pool_sample(
        $formattedParent,
        $awsNodePoolVersion,
        $awsNodePoolConfigIamInstanceProfile,
        $awsNodePoolConfigConfigEncryptionKmsKeyArn,
        $awsNodePoolAutoscalingMinNodeCount,
        $awsNodePoolAutoscalingMaxNodeCount,
        $awsNodePoolSubnetId,
        $awsNodePoolMaxPodsConstraintMaxPodsPerNode,
        $awsNodePoolId
    );
}

deleteAwsCluster

Deletes a specific AwsCluster resource.

Fails if the cluster has one or more associated AwsNodePool resources.

If successful, the response contains a newly created Operation resource that can be described to track the status of the operation.

Parameters
NameDescription
name string

Required. The resource name the AwsCluster to delete.

AwsCluster names are formatted as projects/<project-id>/locations/<region>/awsClusters/<cluster-id>.

See Resource Names for more details on Google Cloud Platform resource names.

optionalArgs array

Optional.

↳ validateOnly bool

If set, only validate the request, but do not actually delete the resource.

↳ allowMissing bool

If set to true, and the AwsCluster resource is not found, the request will succeed but no action will be taken on the server and a completed Operation will be returned. Useful for idempotent deletion.

↳ etag string

The current etag of the AwsCluster. Allows clients to perform deletions through optimistic concurrency control. If the provided etag does not match the current etag of the cluster, the request will fail and an ABORTED error will be returned.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
TypeDescription
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\GkeMultiCloud\V1\Client\AwsClustersClient;
use Google\Cloud\GkeMultiCloud\V1\DeleteAwsClusterRequest;
use Google\Rpc\Status;

/**
 * @param string $formattedName The resource name the
 *                              [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] to delete.
 *
 *                              `AwsCluster` names are formatted as
 *                              `projects/<project-id>/locations/<region>/awsClusters/<cluster-id>`.
 *
 *                              See [Resource Names](https://cloud.google.com/apis/design/resource_names)
 *                              for more details on Google Cloud Platform resource names. Please see
 *                              {@see AwsClustersClient::awsClusterName()} for help formatting this field.
 */
function delete_aws_cluster_sample(string $formattedName): void
{
    // Create a client.
    $awsClustersClient = new AwsClustersClient();

    // Prepare the request message.
    $request = (new DeleteAwsClusterRequest())
        ->setName($formattedName);

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $awsClustersClient->deleteAwsCluster($request);
        $response->pollUntilComplete();

        if ($response->operationSucceeded()) {
            printf('Operation completed successfully.' . PHP_EOL);
        } 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
{
    $formattedName = AwsClustersClient::awsClusterName('[PROJECT]', '[LOCATION]', '[AWS_CLUSTER]');

    delete_aws_cluster_sample($formattedName);
}

deleteAwsNodePool

Deletes a specific AwsNodePool resource.

If successful, the response contains a newly created Operation resource that can be described to track the status of the operation.

Parameters
NameDescription
name string

Required. The resource name the AwsNodePool to delete.

AwsNodePool names are formatted as projects/<project-id>/locations/<region>/awsClusters/<cluster-id>/awsNodePools/<node-pool-id>.

See Resource Names for more details on Google Cloud resource names.

optionalArgs array

Optional.

↳ validateOnly bool

If set, only validate the request, but do not actually delete the node pool.

↳ allowMissing bool

If set to true, and the AwsNodePool resource is not found, the request will succeed but no action will be taken on the server and a completed Operation will be returned. Useful for idempotent deletion.

↳ etag string

The current ETag of the AwsNodePool. Allows clients to perform deletions through optimistic concurrency control. If the provided ETag does not match the current etag of the node pool, the request will fail and an ABORTED error will be returned.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
TypeDescription
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\GkeMultiCloud\V1\Client\AwsClustersClient;
use Google\Cloud\GkeMultiCloud\V1\DeleteAwsNodePoolRequest;
use Google\Rpc\Status;

/**
 * @param string $formattedName The resource name the
 *                              [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool] to delete.
 *
 *                              `AwsNodePool` names are formatted as
 *                              `projects/<project-id>/locations/<region>/awsClusters/<cluster-id>/awsNodePools/<node-pool-id>`.
 *
 *                              See [Resource Names](https://cloud.google.com/apis/design/resource_names)
 *                              for more details on Google Cloud resource names. Please see
 *                              {@see AwsClustersClient::awsNodePoolName()} for help formatting this field.
 */
function delete_aws_node_pool_sample(string $formattedName): void
{
    // Create a client.
    $awsClustersClient = new AwsClustersClient();

    // Prepare the request message.
    $request = (new DeleteAwsNodePoolRequest())
        ->setName($formattedName);

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $awsClustersClient->deleteAwsNodePool($request);
        $response->pollUntilComplete();

        if ($response->operationSucceeded()) {
            printf('Operation completed successfully.' . PHP_EOL);
        } 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
{
    $formattedName = AwsClustersClient::awsNodePoolName(
        '[PROJECT]',
        '[LOCATION]',
        '[AWS_CLUSTER]',
        '[AWS_NODE_POOL]'
    );

    delete_aws_node_pool_sample($formattedName);
}

generateAwsAccessToken

Generates a short-lived access token to authenticate to a given AwsCluster resource.

Parameters
NameDescription
awsCluster string

Required. The name of the AwsCluster resource to authenticate to.

AwsCluster names are formatted as projects/<project-id>/locations/<region>/awsClusters/<cluster-id>.

See Resource Names for more details on Google Cloud resource names.

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
TypeDescription
Google\Cloud\GkeMultiCloud\V1\GenerateAwsAccessTokenResponse
Example
use Google\ApiCore\ApiException;
use Google\Cloud\GkeMultiCloud\V1\Client\AwsClustersClient;
use Google\Cloud\GkeMultiCloud\V1\GenerateAwsAccessTokenRequest;
use Google\Cloud\GkeMultiCloud\V1\GenerateAwsAccessTokenResponse;

/**
 * @param string $formattedAwsCluster The name of the
 *                                    [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] resource to
 *                                    authenticate to.
 *
 *                                    `AwsCluster` names are formatted as
 *                                    `projects/<project-id>/locations/<region>/awsClusters/<cluster-id>`.
 *
 *                                    See [Resource Names](https://cloud.google.com/apis/design/resource_names)
 *                                    for more details on Google Cloud resource names. Please see
 *                                    {@see AwsClustersClient::awsClusterName()} for help formatting this field.
 */
function generate_aws_access_token_sample(string $formattedAwsCluster): void
{
    // Create a client.
    $awsClustersClient = new AwsClustersClient();

    // Prepare the request message.
    $request = (new GenerateAwsAccessTokenRequest())
        ->setAwsCluster($formattedAwsCluster);

    // Call the API and handle any network failures.
    try {
        /** @var GenerateAwsAccessTokenResponse $response */
        $response = $awsClustersClient->generateAwsAccessToken($request);
        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
{
    $formattedAwsCluster = AwsClustersClient::awsClusterName(
        '[PROJECT]',
        '[LOCATION]',
        '[AWS_CLUSTER]'
    );

    generate_aws_access_token_sample($formattedAwsCluster);
}

getAwsCluster

Describes a specific AwsCluster resource.

Parameters
NameDescription
name string

Required. The name of the AwsCluster resource to describe.

AwsCluster names are formatted as projects/<project-id>/locations/<region>/awsClusters/<cluster-id>.

See Resource Names for more details on Google Cloud Platform resource names.

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
TypeDescription
Google\Cloud\GkeMultiCloud\V1\AwsCluster
Example
use Google\ApiCore\ApiException;
use Google\Cloud\GkeMultiCloud\V1\AwsCluster;
use Google\Cloud\GkeMultiCloud\V1\Client\AwsClustersClient;
use Google\Cloud\GkeMultiCloud\V1\GetAwsClusterRequest;

/**
 * @param string $formattedName The name of the
 *                              [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] resource to
 *                              describe.
 *
 *                              `AwsCluster` names are formatted as
 *                              `projects/<project-id>/locations/<region>/awsClusters/<cluster-id>`.
 *
 *                              See [Resource Names](https://cloud.google.com/apis/design/resource_names)
 *                              for more details on Google Cloud Platform resource names. Please see
 *                              {@see AwsClustersClient::awsClusterName()} for help formatting this field.
 */
function get_aws_cluster_sample(string $formattedName): void
{
    // Create a client.
    $awsClustersClient = new AwsClustersClient();

    // Prepare the request message.
    $request = (new GetAwsClusterRequest())
        ->setName($formattedName);

    // Call the API and handle any network failures.
    try {
        /** @var AwsCluster $response */
        $response = $awsClustersClient->getAwsCluster($request);
        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 = AwsClustersClient::awsClusterName('[PROJECT]', '[LOCATION]', '[AWS_CLUSTER]');

    get_aws_cluster_sample($formattedName);
}

getAwsNodePool

Describes a specific AwsNodePool resource.

Parameters
NameDescription
name string

Required. The name of the AwsNodePool resource to describe.

AwsNodePool names are formatted as projects/<project-id>/locations/<region>/awsClusters/<cluster-id>/awsNodePools/<node-pool-id>.

See Resource Names for more details on Google Cloud resource names.

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
TypeDescription
Google\Cloud\GkeMultiCloud\V1\AwsNodePool
Example
use Google\ApiCore\ApiException;
use Google\Cloud\GkeMultiCloud\V1\AwsNodePool;
use Google\Cloud\GkeMultiCloud\V1\Client\AwsClustersClient;
use Google\Cloud\GkeMultiCloud\V1\GetAwsNodePoolRequest;

/**
 * @param string $formattedName The name of the
 *                              [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool] resource to
 *                              describe.
 *
 *                              `AwsNodePool` names are formatted as
 *                              `projects/<project-id>/locations/<region>/awsClusters/<cluster-id>/awsNodePools/<node-pool-id>`.
 *
 *                              See [Resource Names](https://cloud.google.com/apis/design/resource_names)
 *                              for more details on Google Cloud resource names. Please see
 *                              {@see AwsClustersClient::awsNodePoolName()} for help formatting this field.
 */
function get_aws_node_pool_sample(string $formattedName): void
{
    // Create a client.
    $awsClustersClient = new AwsClustersClient();

    // Prepare the request message.
    $request = (new GetAwsNodePoolRequest())
        ->setName($formattedName);

    // Call the API and handle any network failures.
    try {
        /** @var AwsNodePool $response */
        $response = $awsClustersClient->getAwsNodePool($request);
        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 = AwsClustersClient::awsNodePoolName(
        '[PROJECT]',
        '[LOCATION]',
        '[AWS_CLUSTER]',
        '[AWS_NODE_POOL]'
    );

    get_aws_node_pool_sample($formattedName);
}

getAwsServerConfig

Returns information, such as supported AWS regions and Kubernetes versions, on a given Google Cloud location.

Parameters
NameDescription
name string

Required. The name of the AwsServerConfig resource to describe.

AwsServerConfig names are formatted as projects/<project-id>/locations/<region>/awsServerConfig.

See Resource Names for more details on Google Cloud resource names.

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
TypeDescription
Google\Cloud\GkeMultiCloud\V1\AwsServerConfig
Example
use Google\ApiCore\ApiException;
use Google\Cloud\GkeMultiCloud\V1\AwsServerConfig;
use Google\Cloud\GkeMultiCloud\V1\Client\AwsClustersClient;
use Google\Cloud\GkeMultiCloud\V1\GetAwsServerConfigRequest;

/**
 * @param string $formattedName The name of the
 *                              [AwsServerConfig][google.cloud.gkemulticloud.v1.AwsServerConfig] resource
 *                              to describe.
 *
 *                              `AwsServerConfig` names are formatted as
 *                              `projects/<project-id>/locations/<region>/awsServerConfig`.
 *
 *                              See [Resource Names](https://cloud.google.com/apis/design/resource_names)
 *                              for more details on Google Cloud resource names. Please see
 *                              {@see AwsClustersClient::awsServerConfigName()} for help formatting this field.
 */
function get_aws_server_config_sample(string $formattedName): void
{
    // Create a client.
    $awsClustersClient = new AwsClustersClient();

    // Prepare the request message.
    $request = (new GetAwsServerConfigRequest())
        ->setName($formattedName);

    // Call the API and handle any network failures.
    try {
        /** @var AwsServerConfig $response */
        $response = $awsClustersClient->getAwsServerConfig($request);
        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 = AwsClustersClient::awsServerConfigName('[PROJECT]', '[LOCATION]');

    get_aws_server_config_sample($formattedName);
}

listAwsClusters

Lists all AwsCluster resources on a given Google Cloud project and region.

Parameters
NameDescription
parent string

Required. The parent location which owns this collection of AwsCluster resources.

Location names are formatted as projects/<project-id>/locations/<region>.

See Resource Names for more details on Google Cloud Platform resource names.

optionalArgs array

Optional.

↳ pageSize int

The maximum number of resources contained in the underlying API response. The API may return fewer values in a page, even if there are additional values to be retrieved.

↳ pageToken string

A page token is used to specify a page of values to be returned. If no page token is specified (the default), the first page of values will be returned. Any page token used here must have been generated by a previous call to the API.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
TypeDescription
Google\ApiCore\PagedListResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\GkeMultiCloud\V1\AwsCluster;
use Google\Cloud\GkeMultiCloud\V1\Client\AwsClustersClient;
use Google\Cloud\GkeMultiCloud\V1\ListAwsClustersRequest;

/**
 * @param string $formattedParent The parent location which owns this collection of
 *                                [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] resources.
 *
 *                                Location names are formatted as `projects/<project-id>/locations/<region>`.
 *
 *                                See [Resource Names](https://cloud.google.com/apis/design/resource_names)
 *                                for more details on Google Cloud Platform resource names. Please see
 *                                {@see AwsClustersClient::locationName()} for help formatting this field.
 */
function list_aws_clusters_sample(string $formattedParent): void
{
    // Create a client.
    $awsClustersClient = new AwsClustersClient();

    // Prepare the request message.
    $request = (new ListAwsClustersRequest())
        ->setParent($formattedParent);

    // Call the API and handle any network failures.
    try {
        /** @var PagedListResponse $response */
        $response = $awsClustersClient->listAwsClusters($request);

        /** @var AwsCluster $element */
        foreach ($response as $element) {
            printf('Element data: %s' . PHP_EOL, $element->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 = AwsClustersClient::locationName('[PROJECT]', '[LOCATION]');

    list_aws_clusters_sample($formattedParent);
}

listAwsNodePools

Lists all AwsNodePool resources on a given AwsCluster.

Parameters
NameDescription
parent string

Required. The parent AwsCluster which owns this collection of AwsNodePool resources.

AwsCluster names are formatted as projects/<project-id>/locations/<region>/awsClusters/<cluster-id>.

See Resource Names for more details on Google Cloud resource names.

optionalArgs array

Optional.

↳ pageSize int

The maximum number of resources contained in the underlying API response. The API may return fewer values in a page, even if there are additional values to be retrieved.

↳ pageToken string

A page token is used to specify a page of values to be returned. If no page token is specified (the default), the first page of values will be returned. Any page token used here must have been generated by a previous call to the API.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
TypeDescription
Google\ApiCore\PagedListResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\GkeMultiCloud\V1\AwsNodePool;
use Google\Cloud\GkeMultiCloud\V1\Client\AwsClustersClient;
use Google\Cloud\GkeMultiCloud\V1\ListAwsNodePoolsRequest;

/**
 * @param string $formattedParent The parent `AwsCluster` which owns this collection of
 *                                [AwsNodePool][google.cloud.gkemulticloud.v1.AwsNodePool] resources.
 *
 *                                `AwsCluster` names are formatted as
 *                                `projects/<project-id>/locations/<region>/awsClusters/<cluster-id>`.
 *
 *                                See [Resource Names](https://cloud.google.com/apis/design/resource_names)
 *                                for more details on Google Cloud resource names. Please see
 *                                {@see AwsClustersClient::awsClusterName()} for help formatting this field.
 */
function list_aws_node_pools_sample(string $formattedParent): void
{
    // Create a client.
    $awsClustersClient = new AwsClustersClient();

    // Prepare the request message.
    $request = (new ListAwsNodePoolsRequest())
        ->setParent($formattedParent);

    // Call the API and handle any network failures.
    try {
        /** @var PagedListResponse $response */
        $response = $awsClustersClient->listAwsNodePools($request);

        /** @var AwsNodePool $element */
        foreach ($response as $element) {
            printf('Element data: %s' . PHP_EOL, $element->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 = AwsClustersClient::awsClusterName('[PROJECT]', '[LOCATION]', '[AWS_CLUSTER]');

    list_aws_node_pools_sample($formattedParent);
}

updateAwsCluster

Updates an AwsCluster.

Parameters
NameDescription
awsCluster Google\Cloud\GkeMultiCloud\V1\AwsCluster

Required. The AwsCluster resource to update.

updateMask Google\Protobuf\FieldMask

Required. Mask of fields to update. At least one path must be supplied in this field. The elements of the repeated paths field can only include these fields from AwsCluster:

  • description.
  • annotations.
  • control_plane.version.
  • authorization.admin_users.
  • control_plane.aws_services_authentication.role_arn.
  • control_plane.aws_services_authentication.role_session_name.
  • control_plane.config_encryption.kms_key_arn.
  • control_plane.instance_type.
  • control_plane.security_group_ids.
  • control_plane.proxy_config.
  • control_plane.proxy_config.secret_arn.
  • control_plane.proxy_config.secret_version.
  • control_plane.root_volume.size_gib.
  • control_plane.root_volume.volume_type.
  • control_plane.root_volume.iops.
  • control_plane.root_volume.kms_key_arn.
  • control_plane.ssh_config.
  • control_plane.ssh_config.ec2_key_pair.
  • control_plane.instance_placement.tenancy.
  • control_plane.iam_instance_profile.
  • logging_config.component_config.enable_components.
  • control_plane.tags.
  • monitoring_config.managed_prometheus_config.enabled.
optionalArgs array

Optional.

↳ validateOnly bool

If set, only validate the request, but do not actually update the cluster.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
TypeDescription
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\GkeMultiCloud\V1\AwsAuthorization;
use Google\Cloud\GkeMultiCloud\V1\AwsCluster;
use Google\Cloud\GkeMultiCloud\V1\AwsClusterNetworking;
use Google\Cloud\GkeMultiCloud\V1\AwsClusterUser;
use Google\Cloud\GkeMultiCloud\V1\AwsConfigEncryption;
use Google\Cloud\GkeMultiCloud\V1\AwsControlPlane;
use Google\Cloud\GkeMultiCloud\V1\AwsDatabaseEncryption;
use Google\Cloud\GkeMultiCloud\V1\AwsServicesAuthentication;
use Google\Cloud\GkeMultiCloud\V1\Client\AwsClustersClient;
use Google\Cloud\GkeMultiCloud\V1\Fleet;
use Google\Cloud\GkeMultiCloud\V1\UpdateAwsClusterRequest;
use Google\Protobuf\FieldMask;
use Google\Rpc\Status;

/**
 * @param string $awsClusterNetworkingVpcId                              The VPC associated with the cluster. All component clusters
 *                                                                       (i.e. control plane and node pools) run on a single VPC.
 *
 *                                                                       This field cannot be changed after creation.
 * @param string $awsClusterNetworkingPodAddressCidrBlocksElement        All pods in the cluster are assigned an IPv4 address from these
 *                                                                       ranges. Only a single range is supported. This field cannot be changed
 *                                                                       after creation.
 * @param string $awsClusterNetworkingServiceAddressCidrBlocksElement    All services in the cluster are assigned an IPv4 address from
 *                                                                       these ranges. Only a single range is supported. This field cannot be
 *                                                                       changed after creation.
 * @param string $awsClusterAwsRegion                                    The AWS region where the cluster runs.
 *
 *                                                                       Each Google Cloud region supports a subset of nearby AWS regions.
 *                                                                       You can call
 *                                                                       [GetAwsServerConfig][google.cloud.gkemulticloud.v1.AwsClusters.GetAwsServerConfig]
 *                                                                       to list all supported AWS regions within a given Google Cloud region.
 * @param string $awsClusterControlPlaneVersion                          The Kubernetes version to run on control plane replicas
 *                                                                       (e.g. `1.19.10-gke.1000`).
 *
 *                                                                       You can list all supported versions on a given Google Cloud region by
 *                                                                       calling
 *                                                                       [GetAwsServerConfig][google.cloud.gkemulticloud.v1.AwsClusters.GetAwsServerConfig].
 * @param string $awsClusterControlPlaneSubnetIdsElement                 The list of subnets where control plane replicas will run.
 *                                                                       A replica will be provisioned on each subnet and up to three values
 *                                                                       can be provided.
 *                                                                       Each subnet must be in a different AWS Availability Zone (AZ).
 * @param string $awsClusterControlPlaneIamInstanceProfile               The name or ARN of the AWS IAM instance profile to assign to each
 *                                                                       control plane replica.
 * @param string $awsClusterControlPlaneDatabaseEncryptionKmsKeyArn      The ARN of the AWS KMS key used to encrypt cluster secrets.
 * @param string $awsClusterControlPlaneAwsServicesAuthenticationRoleArn The Amazon Resource Name (ARN) of the role that the Anthos
 *                                                                       Multi-Cloud API will assume when managing AWS resources on your account.
 * @param string $awsClusterControlPlaneConfigEncryptionKmsKeyArn        The ARN of the AWS KMS key used to encrypt user data.
 * @param string $awsClusterAuthorizationAdminUsersUsername              The name of the user, e.g. `my-gcp-id&#64;gmail.com`.
 * @param string $awsClusterFleetProject                                 The name of the Fleet host project where this cluster will be
 *                                                                       registered.
 *
 *                                                                       Project names are formatted as
 *                                                                       `projects/<project-number>`.
 */
function update_aws_cluster_sample(
    string $awsClusterNetworkingVpcId,
    string $awsClusterNetworkingPodAddressCidrBlocksElement,
    string $awsClusterNetworkingServiceAddressCidrBlocksElement,
    string $awsClusterAwsRegion,
    string $awsClusterControlPlaneVersion,
    string $awsClusterControlPlaneSubnetIdsElement,
    string $awsClusterControlPlaneIamInstanceProfile,
    string $awsClusterControlPlaneDatabaseEncryptionKmsKeyArn,
    string $awsClusterControlPlaneAwsServicesAuthenticationRoleArn,
    string $awsClusterControlPlaneConfigEncryptionKmsKeyArn,
    string $awsClusterAuthorizationAdminUsersUsername,
    string $awsClusterFleetProject
): void {
    // Create a client.
    $awsClustersClient = new AwsClustersClient();

    // Prepare the request message.
    $awsClusterNetworkingPodAddressCidrBlocks = [$awsClusterNetworkingPodAddressCidrBlocksElement,];
    $awsClusterNetworkingServiceAddressCidrBlocks = [
        $awsClusterNetworkingServiceAddressCidrBlocksElement,
    ];
    $awsClusterNetworking = (new AwsClusterNetworking())
        ->setVpcId($awsClusterNetworkingVpcId)
        ->setPodAddressCidrBlocks($awsClusterNetworkingPodAddressCidrBlocks)
        ->setServiceAddressCidrBlocks($awsClusterNetworkingServiceAddressCidrBlocks);
    $awsClusterControlPlaneSubnetIds = [$awsClusterControlPlaneSubnetIdsElement,];
    $awsClusterControlPlaneDatabaseEncryption = (new AwsDatabaseEncryption())
        ->setKmsKeyArn($awsClusterControlPlaneDatabaseEncryptionKmsKeyArn);
    $awsClusterControlPlaneAwsServicesAuthentication = (new AwsServicesAuthentication())
        ->setRoleArn($awsClusterControlPlaneAwsServicesAuthenticationRoleArn);
    $awsClusterControlPlaneConfigEncryption = (new AwsConfigEncryption())
        ->setKmsKeyArn($awsClusterControlPlaneConfigEncryptionKmsKeyArn);
    $awsClusterControlPlane = (new AwsControlPlane())
        ->setVersion($awsClusterControlPlaneVersion)
        ->setSubnetIds($awsClusterControlPlaneSubnetIds)
        ->setIamInstanceProfile($awsClusterControlPlaneIamInstanceProfile)
        ->setDatabaseEncryption($awsClusterControlPlaneDatabaseEncryption)
        ->setAwsServicesAuthentication($awsClusterControlPlaneAwsServicesAuthentication)
        ->setConfigEncryption($awsClusterControlPlaneConfigEncryption);
    $awsClusterUser = (new AwsClusterUser())
        ->setUsername($awsClusterAuthorizationAdminUsersUsername);
    $awsClusterAuthorizationAdminUsers = [$awsClusterUser,];
    $awsClusterAuthorization = (new AwsAuthorization())
        ->setAdminUsers($awsClusterAuthorizationAdminUsers);
    $awsClusterFleet = (new Fleet())
        ->setProject($awsClusterFleetProject);
    $awsCluster = (new AwsCluster())
        ->setNetworking($awsClusterNetworking)
        ->setAwsRegion($awsClusterAwsRegion)
        ->setControlPlane($awsClusterControlPlane)
        ->setAuthorization($awsClusterAuthorization)
        ->setFleet($awsClusterFleet);
    $updateMask = new FieldMask();
    $request = (new UpdateAwsClusterRequest())
        ->setAwsCluster($awsCluster)
        ->setUpdateMask($updateMask);

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $awsClustersClient->updateAwsCluster($request);
        $response->pollUntilComplete();

        if ($response->operationSucceeded()) {
            /** @var AwsCluster $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
{
    $awsClusterNetworkingVpcId = '[VPC_ID]';
    $awsClusterNetworkingPodAddressCidrBlocksElement = '[POD_ADDRESS_CIDR_BLOCKS]';
    $awsClusterNetworkingServiceAddressCidrBlocksElement = '[SERVICE_ADDRESS_CIDR_BLOCKS]';
    $awsClusterAwsRegion = '[AWS_REGION]';
    $awsClusterControlPlaneVersion = '[VERSION]';
    $awsClusterControlPlaneSubnetIdsElement = '[SUBNET_IDS]';
    $awsClusterControlPlaneIamInstanceProfile = '[IAM_INSTANCE_PROFILE]';
    $awsClusterControlPlaneDatabaseEncryptionKmsKeyArn = '[KMS_KEY_ARN]';
    $awsClusterControlPlaneAwsServicesAuthenticationRoleArn = '[ROLE_ARN]';
    $awsClusterControlPlaneConfigEncryptionKmsKeyArn = '[KMS_KEY_ARN]';
    $awsClusterAuthorizationAdminUsersUsername = '[USERNAME]';
    $awsClusterFleetProject = '[PROJECT]';

    update_aws_cluster_sample(
        $awsClusterNetworkingVpcId,
        $awsClusterNetworkingPodAddressCidrBlocksElement,
        $awsClusterNetworkingServiceAddressCidrBlocksElement,
        $awsClusterAwsRegion,
        $awsClusterControlPlaneVersion,
        $awsClusterControlPlaneSubnetIdsElement,
        $awsClusterControlPlaneIamInstanceProfile,
        $awsClusterControlPlaneDatabaseEncryptionKmsKeyArn,
        $awsClusterControlPlaneAwsServicesAuthenticationRoleArn,
        $awsClusterControlPlaneConfigEncryptionKmsKeyArn,
        $awsClusterAuthorizationAdminUsersUsername,
        $awsClusterFleetProject
    );
}

updateAwsNodePool

Updates an AwsNodePool.

Parameters
NameDescription
awsNodePool Google\Cloud\GkeMultiCloud\V1\AwsNodePool

Required. The AwsNodePool resource to update.

updateMask Google\Protobuf\FieldMask

Required. Mask of fields to update. At least one path must be supplied in this field. The elements of the repeated paths field can only include these fields from AwsNodePool:

  • annotations.
  • version.
  • autoscaling.min_node_count.
  • autoscaling.max_node_count.
  • config.config_encryption.kms_key_arn.
  • config.security_group_ids.
  • config.root_volume.iops.
  • config.root_volume.kms_key_arn.
  • config.root_volume.volume_type.
  • config.root_volume.size_gib.
  • config.proxy_config.
  • config.proxy_config.secret_arn.
  • config.proxy_config.secret_version.
  • config.ssh_config.
  • config.ssh_config.ec2_key_pair.
  • config.instance_placement.tenancy.
  • config.iam_instance_profile.
  • config.labels.
  • config.tags.
  • config.autoscaling_metrics_collection.
  • config.autoscaling_metrics_collection.granularity.
  • config.autoscaling_metrics_collection.metrics.
optionalArgs array

Optional.

↳ validateOnly bool

If set, only validate the request, but don't actually update the node pool.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
TypeDescription
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\GkeMultiCloud\V1\AwsConfigEncryption;
use Google\Cloud\GkeMultiCloud\V1\AwsNodeConfig;
use Google\Cloud\GkeMultiCloud\V1\AwsNodePool;
use Google\Cloud\GkeMultiCloud\V1\AwsNodePoolAutoscaling;
use Google\Cloud\GkeMultiCloud\V1\Client\AwsClustersClient;
use Google\Cloud\GkeMultiCloud\V1\MaxPodsConstraint;
use Google\Cloud\GkeMultiCloud\V1\UpdateAwsNodePoolRequest;
use Google\Protobuf\FieldMask;
use Google\Rpc\Status;

/**
 * @param string $awsNodePoolVersion                         The Kubernetes version to run on this node pool (e.g.
 *                                                           `1.19.10-gke.1000`).
 *
 *                                                           You can list all supported versions on a given Google Cloud region by
 *                                                           calling
 *                                                           [GetAwsServerConfig][google.cloud.gkemulticloud.v1.AwsClusters.GetAwsServerConfig].
 * @param string $awsNodePoolConfigIamInstanceProfile        The name or ARN of the AWS IAM role assigned to nodes in the
 *                                                           pool.
 * @param string $awsNodePoolConfigConfigEncryptionKmsKeyArn The ARN of the AWS KMS key used to encrypt user data.
 * @param int    $awsNodePoolAutoscalingMinNodeCount         Minimum number of nodes in the node pool. Must be greater than or
 *                                                           equal to 1 and less than or equal to max_node_count.
 * @param int    $awsNodePoolAutoscalingMaxNodeCount         Maximum number of nodes in the node pool. Must be greater than or
 *                                                           equal to min_node_count and less than or equal to 50.
 * @param string $awsNodePoolSubnetId                        The subnet where the node pool node run.
 * @param int    $awsNodePoolMaxPodsConstraintMaxPodsPerNode The maximum number of pods to schedule on a single node.
 */
function update_aws_node_pool_sample(
    string $awsNodePoolVersion,
    string $awsNodePoolConfigIamInstanceProfile,
    string $awsNodePoolConfigConfigEncryptionKmsKeyArn,
    int $awsNodePoolAutoscalingMinNodeCount,
    int $awsNodePoolAutoscalingMaxNodeCount,
    string $awsNodePoolSubnetId,
    int $awsNodePoolMaxPodsConstraintMaxPodsPerNode
): void {
    // Create a client.
    $awsClustersClient = new AwsClustersClient();

    // Prepare the request message.
    $awsNodePoolConfigConfigEncryption = (new AwsConfigEncryption())
        ->setKmsKeyArn($awsNodePoolConfigConfigEncryptionKmsKeyArn);
    $awsNodePoolConfig = (new AwsNodeConfig())
        ->setIamInstanceProfile($awsNodePoolConfigIamInstanceProfile)
        ->setConfigEncryption($awsNodePoolConfigConfigEncryption);
    $awsNodePoolAutoscaling = (new AwsNodePoolAutoscaling())
        ->setMinNodeCount($awsNodePoolAutoscalingMinNodeCount)
        ->setMaxNodeCount($awsNodePoolAutoscalingMaxNodeCount);
    $awsNodePoolMaxPodsConstraint = (new MaxPodsConstraint())
        ->setMaxPodsPerNode($awsNodePoolMaxPodsConstraintMaxPodsPerNode);
    $awsNodePool = (new AwsNodePool())
        ->setVersion($awsNodePoolVersion)
        ->setConfig($awsNodePoolConfig)
        ->setAutoscaling($awsNodePoolAutoscaling)
        ->setSubnetId($awsNodePoolSubnetId)
        ->setMaxPodsConstraint($awsNodePoolMaxPodsConstraint);
    $updateMask = new FieldMask();
    $request = (new UpdateAwsNodePoolRequest())
        ->setAwsNodePool($awsNodePool)
        ->setUpdateMask($updateMask);

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $awsClustersClient->updateAwsNodePool($request);
        $response->pollUntilComplete();

        if ($response->operationSucceeded()) {
            /** @var AwsNodePool $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
{
    $awsNodePoolVersion = '[VERSION]';
    $awsNodePoolConfigIamInstanceProfile = '[IAM_INSTANCE_PROFILE]';
    $awsNodePoolConfigConfigEncryptionKmsKeyArn = '[KMS_KEY_ARN]';
    $awsNodePoolAutoscalingMinNodeCount = 0;
    $awsNodePoolAutoscalingMaxNodeCount = 0;
    $awsNodePoolSubnetId = '[SUBNET_ID]';
    $awsNodePoolMaxPodsConstraintMaxPodsPerNode = 0;

    update_aws_node_pool_sample(
        $awsNodePoolVersion,
        $awsNodePoolConfigIamInstanceProfile,
        $awsNodePoolConfigConfigEncryptionKmsKeyArn,
        $awsNodePoolAutoscalingMinNodeCount,
        $awsNodePoolAutoscalingMaxNodeCount,
        $awsNodePoolSubnetId,
        $awsNodePoolMaxPodsConstraintMaxPodsPerNode
    );
}

getOperationsClient

Return an OperationsClient object with the same endpoint as $this.

Returns
TypeDescription
Google\ApiCore\LongRunning\OperationsClient

resumeOperation

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.

Parameters
NameDescription
operationName string

The name of the long running operation

methodName string

The name of the method used to start the operation

Returns
TypeDescription
Google\ApiCore\OperationResponse

static::awsClusterName

Formats a string containing the fully-qualified path to represent a aws_cluster resource.

Parameters
NameDescription
project string
location string
awsCluster string
Returns
TypeDescription
stringThe formatted aws_cluster resource.

static::awsNodePoolName

Formats a string containing the fully-qualified path to represent a aws_node_pool resource.

Parameters
NameDescription
project string
location string
awsCluster string
awsNodePool string
Returns
TypeDescription
stringThe formatted aws_node_pool resource.

static::awsServerConfigName

Formats a string containing the fully-qualified path to represent a aws_server_config resource.

Parameters
NameDescription
project string
location string
Returns
TypeDescription
stringThe formatted aws_server_config resource.

static::locationName

Formats a string containing the fully-qualified path to represent a location resource.

Parameters
NameDescription
project string
location string
Returns
TypeDescription
stringThe formatted location resource.

static::parseName

Parses a formatted name string and returns an associative array of the components in the name.

The following name formats are supported: Template: Pattern

  • awsCluster: projects/{project}/locations/{location}/awsClusters/{aws_cluster}
  • awsNodePool: projects/{project}/locations/{location}/awsClusters/{aws_cluster}/awsNodePools/{aws_node_pool}
  • awsServerConfig: projects/{project}/locations/{location}/awsServerConfig
  • location: projects/{project}/locations/{location}

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.

Parameters
NameDescription
formattedName string

The formatted name string

template string

Optional name of template to match

Returns
TypeDescription
arrayAn associative array from name component IDs to component values.

Constants

SERVICE_NAME

Value: 'google.cloud.gkemulticloud.v1.AwsClusters'

The name of the service.

SERVICE_ADDRESS

Value: 'gkemulticloud.googleapis.com'

The default address of the service.

DEFAULT_SERVICE_PORT

Value: 443

The default port of the service.

CODEGEN_NAME

Value: 'gapic'

The name of the code generator, to be included in the agent header.