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.

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 class is currently experimental and may be subject to changes. See Google\Cloud\GkeMultiCloud\V1\AwsClustersClient for the stable implementation

Namespace

Google \ Cloud \ GkeMultiCloud \ V1 \ Client

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.

The async variant is Google\Cloud\GkeMultiCloud\V1\Client\AwsClustersClient::createAwsClusterAsync() .

Parameters
NameDescription
request Google\Cloud\GkeMultiCloud\V1\CreateAwsClusterRequest

A request to house fields associated with the call.

callOptions 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\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.

The async variant is Google\Cloud\GkeMultiCloud\V1\Client\AwsClustersClient::createAwsNodePoolAsync() .

Parameters
NameDescription
request Google\Cloud\GkeMultiCloud\V1\CreateAwsNodePoolRequest

A request to house fields associated with the call.

callOptions 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\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.

The async variant is Google\Cloud\GkeMultiCloud\V1\Client\AwsClustersClient::deleteAwsClusterAsync() .

Parameters
NameDescription
request Google\Cloud\GkeMultiCloud\V1\DeleteAwsClusterRequest

A request to house fields associated with the call.

callOptions 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\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.

The async variant is Google\Cloud\GkeMultiCloud\V1\Client\AwsClustersClient::deleteAwsNodePoolAsync() .

Parameters
NameDescription
request Google\Cloud\GkeMultiCloud\V1\DeleteAwsNodePoolRequest

A request to house fields associated with the call.

callOptions 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\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.

The async variant is Google\Cloud\GkeMultiCloud\V1\Client\AwsClustersClient::generateAwsAccessTokenAsync() .

Parameters
NameDescription
request Google\Cloud\GkeMultiCloud\V1\GenerateAwsAccessTokenRequest

A request to house fields associated with the call.

callOptions 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

Parameters
NameDescription
request Google\Cloud\GkeMultiCloud\V1\GetAwsClusterRequest

A request to house fields associated with the call.

callOptions 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

Parameters
NameDescription
request Google\Cloud\GkeMultiCloud\V1\GetAwsNodePoolRequest

A request to house fields associated with the call.

callOptions 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.

The async variant is Google\Cloud\GkeMultiCloud\V1\Client\AwsClustersClient::getAwsServerConfigAsync() .

Parameters
NameDescription
request Google\Cloud\GkeMultiCloud\V1\GetAwsServerConfigRequest

A request to house fields associated with the call.

callOptions 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.

The async variant is Google\Cloud\GkeMultiCloud\V1\Client\AwsClustersClient::listAwsClustersAsync() .

Parameters
NameDescription
request Google\Cloud\GkeMultiCloud\V1\ListAwsClustersRequest

A request to house fields associated with the call.

callOptions 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\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

Parameters
NameDescription
request Google\Cloud\GkeMultiCloud\V1\ListAwsNodePoolsRequest

A request to house fields associated with the call.

callOptions 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\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

Parameters
NameDescription
request Google\Cloud\GkeMultiCloud\V1\UpdateAwsClusterRequest

A request to house fields associated with the call.

callOptions 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\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

Parameters
NameDescription
request Google\Cloud\GkeMultiCloud\V1\UpdateAwsNodePoolRequest

A request to house fields associated with the call.

callOptions 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\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
    );
}

createAwsClusterAsync

Parameters
NameDescription
request Google\Cloud\GkeMultiCloud\V1\CreateAwsClusterRequest
optionalArgs = [] array
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface

createAwsNodePoolAsync

Parameters
NameDescription
request Google\Cloud\GkeMultiCloud\V1\CreateAwsNodePoolRequest
optionalArgs = [] array
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface

deleteAwsClusterAsync

Parameters
NameDescription
request Google\Cloud\GkeMultiCloud\V1\DeleteAwsClusterRequest
optionalArgs = [] array
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface

deleteAwsNodePoolAsync

Parameters
NameDescription
request Google\Cloud\GkeMultiCloud\V1\DeleteAwsNodePoolRequest
optionalArgs = [] array
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface

generateAwsAccessTokenAsync

Parameters
NameDescription
request Google\Cloud\GkeMultiCloud\V1\GenerateAwsAccessTokenRequest
optionalArgs = [] array
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface

getAwsClusterAsync

Parameters
NameDescription
request Google\Cloud\GkeMultiCloud\V1\GetAwsClusterRequest
optionalArgs = [] array
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface

getAwsNodePoolAsync

Parameters
NameDescription
request Google\Cloud\GkeMultiCloud\V1\GetAwsNodePoolRequest
optionalArgs = [] array
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface

getAwsServerConfigAsync

Parameters
NameDescription
request Google\Cloud\GkeMultiCloud\V1\GetAwsServerConfigRequest
optionalArgs = [] array
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface

listAwsClustersAsync

Parameters
NameDescription
request Google\Cloud\GkeMultiCloud\V1\ListAwsClustersRequest
optionalArgs = [] array
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface

listAwsNodePoolsAsync

Parameters
NameDescription
request Google\Cloud\GkeMultiCloud\V1\ListAwsNodePoolsRequest
optionalArgs = [] array
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface

updateAwsClusterAsync

Parameters
NameDescription
request Google\Cloud\GkeMultiCloud\V1\UpdateAwsClusterRequest
optionalArgs = [] array
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface

updateAwsNodePoolAsync

Parameters
NameDescription
request Google\Cloud\GkeMultiCloud\V1\UpdateAwsNodePoolRequest
optionalArgs = [] array
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface

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.