Google Cloud Container V1 Client - Class ClusterManagerClient (1.16.0)

Reference documentation and code samples for the Google Cloud Container V1 Client class ClusterManagerClient.

Service Description: Google Kubernetes Engine Cluster Manager v1

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:

$clusterManagerClient = new Google\Cloud\Container\V1\ClusterManagerClient();
try {
    $clusterManagerClient->cancelOperation();
} finally {
    $clusterManagerClient->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\Container\V1\Client\ClusterManagerClient to use the new surface.

Namespace

Google \ Cloud \ Container \ 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.

cancelOperation

Cancels the specified operation.

Parameters
NameDescription
optionalArgs array

Optional.

↳ projectId string

Deprecated. The Google Developers Console project ID or project number. This field has been deprecated and replaced by the name field.

↳ zone string

Deprecated. The name of the Google Compute Engine zone in which the operation resides. This field has been deprecated and replaced by the name field.

↳ operationId string

Deprecated. The server-assigned name of the operation. This field has been deprecated and replaced by the name field.

↳ name string

The name (project, location, operation id) of the operation to cancel. Specified in the format projects/*/locations/*/operations/*.

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

Example
use Google\ApiCore\ApiException;
use Google\Cloud\Container\V1\ClusterManagerClient;

/**
 * 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 cancel_operation_sample(): void
{
    // Create a client.
    $clusterManagerClient = new ClusterManagerClient();

    // Call the API and handle any network failures.
    try {
        $clusterManagerClient->cancelOperation();
        printf('Call completed successfully.' . PHP_EOL);
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

checkAutopilotCompatibility

Checks the cluster compatibility with Autopilot mode, and returns a list of compatibility issues.

Parameters
NameDescription
optionalArgs array

Optional.

↳ name string

The name (project, location, cluster) of the cluster to retrieve. Specified in the format projects/*/locations/*/clusters/*.

↳ 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\Container\V1\CheckAutopilotCompatibilityResponse
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Container\V1\CheckAutopilotCompatibilityResponse;
use Google\Cloud\Container\V1\ClusterManagerClient;

/**
 * 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 check_autopilot_compatibility_sample(): void
{
    // Create a client.
    $clusterManagerClient = new ClusterManagerClient();

    // Call the API and handle any network failures.
    try {
        /** @var CheckAutopilotCompatibilityResponse $response */
        $response = $clusterManagerClient->checkAutopilotCompatibility();
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

completeIPRotation

Completes master IP rotation.

Parameters
NameDescription
optionalArgs array

Optional.

↳ projectId string

Deprecated. The Google Developers Console project ID or project number. This field has been deprecated and replaced by the name field.

↳ zone string

Deprecated. The name of the Google Compute Engine zone in which the cluster resides. This field has been deprecated and replaced by the name field.

↳ clusterId string

Deprecated. The name of the cluster. This field has been deprecated and replaced by the name field.

↳ name string

The name (project, location, cluster name) of the cluster to complete IP rotation. Specified in the format projects/*/locations/*/clusters/*.

↳ 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\Container\V1\Operation
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Container\V1\ClusterManagerClient;
use Google\Cloud\Container\V1\Operation;

/**
 * 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 complete_ip_rotation_sample(): void
{
    // Create a client.
    $clusterManagerClient = new ClusterManagerClient();

    // Call the API and handle any network failures.
    try {
        /** @var Operation $response */
        $response = $clusterManagerClient->completeIPRotation();
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

completeNodePoolUpgrade

CompleteNodePoolUpgrade will signal an on-going node pool upgrade to complete.

Parameters
NameDescription
optionalArgs array

Optional.

↳ name string

The name (project, location, cluster, node pool id) of the node pool to complete upgrade. Specified in the format projects/*/locations/*/clusters/*/nodePools/*.

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

Example
use Google\ApiCore\ApiException;
use Google\Cloud\Container\V1\ClusterManagerClient;

/**
 * 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 complete_node_pool_upgrade_sample(): void
{
    // Create a client.
    $clusterManagerClient = new ClusterManagerClient();

    // Call the API and handle any network failures.
    try {
        $clusterManagerClient->completeNodePoolUpgrade();
        printf('Call completed successfully.' . PHP_EOL);
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

createCluster

Creates a cluster, consisting of the specified number and type of Google Compute Engine instances.

By default, the cluster is created in the project's default network.

One firewall is added for the cluster. After cluster creation, the Kubelet creates routes for each node to allow the containers on that node to communicate with all other instances in the cluster.

Finally, an entry is added to the project's global metadata indicating which CIDR range the cluster is using.

Parameters
NameDescription
cluster Google\Cloud\Container\V1\Cluster

Required. A cluster resource

optionalArgs array

Optional.

↳ projectId string

Deprecated. The Google Developers Console project ID or project number. This field has been deprecated and replaced by the parent field.

↳ zone string

Deprecated. The name of the Google Compute Engine zone in which the cluster resides. This field has been deprecated and replaced by the parent field.

↳ parent string

The parent (project and location) where the cluster will be created. Specified in the format projects/*/locations/*.

↳ 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\Container\V1\Operation
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Container\V1\Cluster;
use Google\Cloud\Container\V1\ClusterManagerClient;
use Google\Cloud\Container\V1\Operation;

/**
 * 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 create_cluster_sample(): void
{
    // Create a client.
    $clusterManagerClient = new ClusterManagerClient();

    // Prepare any non-scalar elements to be passed along with the request.
    $cluster = new Cluster();

    // Call the API and handle any network failures.
    try {
        /** @var Operation $response */
        $response = $clusterManagerClient->createCluster($cluster);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

createNodePool

Creates a node pool for a cluster.

Parameters
NameDescription
nodePool Google\Cloud\Container\V1\NodePool

Required. The node pool to create.

optionalArgs array

Optional.

↳ projectId string

Deprecated. The Google Developers Console project ID or project number. This field has been deprecated and replaced by the parent field.

↳ zone string

Deprecated. The name of the Google Compute Engine zone in which the cluster resides. This field has been deprecated and replaced by the parent field.

↳ clusterId string

Deprecated. The name of the cluster. This field has been deprecated and replaced by the parent field.

↳ parent string

The parent (project, location, cluster name) where the node pool will be created. Specified in the format projects/*/locations/*/clusters/*.

↳ 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\Container\V1\Operation
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Container\V1\ClusterManagerClient;
use Google\Cloud\Container\V1\NodePool;
use Google\Cloud\Container\V1\Operation;

/**
 * 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 create_node_pool_sample(): void
{
    // Create a client.
    $clusterManagerClient = new ClusterManagerClient();

    // Prepare any non-scalar elements to be passed along with the request.
    $nodePool = new NodePool();

    // Call the API and handle any network failures.
    try {
        /** @var Operation $response */
        $response = $clusterManagerClient->createNodePool($nodePool);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

deleteCluster

Deletes the cluster, including the Kubernetes endpoint and all worker nodes.

Firewalls and routes that were configured during cluster creation are also deleted.

Other Google Compute Engine resources that might be in use by the cluster, such as load balancer resources, are not deleted if they weren't present when the cluster was initially created.

Parameters
NameDescription
optionalArgs array

Optional.

↳ projectId string

Deprecated. The Google Developers Console project ID or project number. This field has been deprecated and replaced by the name field.

↳ zone string

Deprecated. The name of the Google Compute Engine zone in which the cluster resides. This field has been deprecated and replaced by the name field.

↳ clusterId string

Deprecated. The name of the cluster to delete. This field has been deprecated and replaced by the name field.

↳ name string

The name (project, location, cluster) of the cluster to delete. Specified in the format projects/*/locations/*/clusters/*.

↳ 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\Container\V1\Operation
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Container\V1\ClusterManagerClient;
use Google\Cloud\Container\V1\Operation;

/**
 * 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 delete_cluster_sample(): void
{
    // Create a client.
    $clusterManagerClient = new ClusterManagerClient();

    // Call the API and handle any network failures.
    try {
        /** @var Operation $response */
        $response = $clusterManagerClient->deleteCluster();
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

deleteNodePool

Deletes a node pool from a cluster.

Parameters
NameDescription
optionalArgs array

Optional.

↳ projectId string

Deprecated. The Google Developers Console project ID or project number. This field has been deprecated and replaced by the name field.

↳ zone string

Deprecated. The name of the Google Compute Engine zone in which the cluster resides. This field has been deprecated and replaced by the name field.

↳ clusterId string

Deprecated. The name of the cluster. This field has been deprecated and replaced by the name field.

↳ nodePoolId string

Deprecated. The name of the node pool to delete. This field has been deprecated and replaced by the name field.

↳ name string

The name (project, location, cluster, node pool id) of the node pool to delete. Specified in the format projects/*/locations/*/clusters/*/nodePools/*.

↳ 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\Container\V1\Operation
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Container\V1\ClusterManagerClient;
use Google\Cloud\Container\V1\Operation;

/**
 * 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 delete_node_pool_sample(): void
{
    // Create a client.
    $clusterManagerClient = new ClusterManagerClient();

    // Call the API and handle any network failures.
    try {
        /** @var Operation $response */
        $response = $clusterManagerClient->deleteNodePool();
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

getCluster

Gets the details of a specific cluster.

Parameters
NameDescription
optionalArgs array

Optional.

↳ projectId string

Deprecated. The Google Developers Console project ID or project number. This field has been deprecated and replaced by the name field.

↳ zone string

Deprecated. The name of the Google Compute Engine zone in which the cluster resides. This field has been deprecated and replaced by the name field.

↳ clusterId string

Deprecated. The name of the cluster to retrieve. This field has been deprecated and replaced by the name field.

↳ name string

The name (project, location, cluster) of the cluster to retrieve. Specified in the format projects/*/locations/*/clusters/*.

↳ 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\Container\V1\Cluster
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Container\V1\Cluster;
use Google\Cloud\Container\V1\ClusterManagerClient;

/**
 * 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 get_cluster_sample(): void
{
    // Create a client.
    $clusterManagerClient = new ClusterManagerClient();

    // Call the API and handle any network failures.
    try {
        /** @var Cluster $response */
        $response = $clusterManagerClient->getCluster();
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

getJSONWebKeys

Gets the public component of the cluster signing keys in JSON Web Key format.

This API is not yet intended for general use, and is not available for all clusters.

Parameters
NameDescription
optionalArgs array

Optional.

↳ parent string

The cluster (project, location, cluster name) to get keys for. Specified in the format projects/*/locations/*/clusters/*.

↳ 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\Container\V1\GetJSONWebKeysResponse
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Container\V1\ClusterManagerClient;
use Google\Cloud\Container\V1\GetJSONWebKeysResponse;

/**
 * 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 get_json_web_keys_sample(): void
{
    // Create a client.
    $clusterManagerClient = new ClusterManagerClient();

    // Call the API and handle any network failures.
    try {
        /** @var GetJSONWebKeysResponse $response */
        $response = $clusterManagerClient->getJSONWebKeys();
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

getNodePool

Retrieves the requested node pool.

Parameters
NameDescription
optionalArgs array

Optional.

↳ projectId string

Deprecated. The Google Developers Console project ID or project number. This field has been deprecated and replaced by the name field.

↳ zone string

Deprecated. The name of the Google Compute Engine zone in which the cluster resides. This field has been deprecated and replaced by the name field.

↳ clusterId string

Deprecated. The name of the cluster. This field has been deprecated and replaced by the name field.

↳ nodePoolId string

Deprecated. The name of the node pool. This field has been deprecated and replaced by the name field.

↳ name string

The name (project, location, cluster, node pool id) of the node pool to get. Specified in the format projects/*/locations/*/clusters/*/nodePools/*.

↳ 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\Container\V1\NodePool
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Container\V1\ClusterManagerClient;
use Google\Cloud\Container\V1\NodePool;

/**
 * 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 get_node_pool_sample(): void
{
    // Create a client.
    $clusterManagerClient = new ClusterManagerClient();

    // Call the API and handle any network failures.
    try {
        /** @var NodePool $response */
        $response = $clusterManagerClient->getNodePool();
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

getOperation

Gets the specified operation.

Parameters
NameDescription
optionalArgs array

Optional.

↳ projectId string

Deprecated. The Google Developers Console project ID or project number. This field has been deprecated and replaced by the name field.

↳ zone string

Deprecated. The name of the Google Compute Engine zone in which the cluster resides. This field has been deprecated and replaced by the name field.

↳ operationId string

Deprecated. The server-assigned name of the operation. This field has been deprecated and replaced by the name field.

↳ name string

The name (project, location, operation id) of the operation to get. Specified in the format projects/*/locations/*/operations/*.

↳ 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\Container\V1\Operation
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Container\V1\ClusterManagerClient;
use Google\Cloud\Container\V1\Operation;

/**
 * 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 get_operation_sample(): void
{
    // Create a client.
    $clusterManagerClient = new ClusterManagerClient();

    // Call the API and handle any network failures.
    try {
        /** @var Operation $response */
        $response = $clusterManagerClient->getOperation();
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

getServerConfig

Returns configuration info about the Google Kubernetes Engine service.

Parameters
NameDescription
optionalArgs array

Optional.

↳ projectId string

Deprecated. The Google Developers Console project ID or project number. This field has been deprecated and replaced by the name field.

↳ zone string

Deprecated. The name of the Google Compute Engine zone to return operations for. This field has been deprecated and replaced by the name field.

↳ name string

The name (project and location) of the server config to get, specified in the format projects/*/locations/*.

↳ 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\Container\V1\ServerConfig
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Container\V1\ClusterManagerClient;
use Google\Cloud\Container\V1\ServerConfig;

/**
 * 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 get_server_config_sample(): void
{
    // Create a client.
    $clusterManagerClient = new ClusterManagerClient();

    // Call the API and handle any network failures.
    try {
        /** @var ServerConfig $response */
        $response = $clusterManagerClient->getServerConfig();
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

listClusters

Lists all clusters owned by a project in either the specified zone or all zones.

Parameters
NameDescription
optionalArgs array

Optional.

↳ projectId string

Deprecated. The Google Developers Console project ID or project number. This field has been deprecated and replaced by the parent field.

↳ zone string

Deprecated. The name of the Google Compute Engine zone in which the cluster resides, or "-" for all zones. This field has been deprecated and replaced by the parent field.

↳ parent string

The parent (project and location) where the clusters will be listed. Specified in the format projects/*/locations/*. Location "-" matches all zones and all regions.

↳ 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\Container\V1\ListClustersResponse
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Container\V1\ClusterManagerClient;
use Google\Cloud\Container\V1\ListClustersResponse;

/**
 * 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 list_clusters_sample(): void
{
    // Create a client.
    $clusterManagerClient = new ClusterManagerClient();

    // Call the API and handle any network failures.
    try {
        /** @var ListClustersResponse $response */
        $response = $clusterManagerClient->listClusters();
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

listNodePools

Lists the node pools for a cluster.

Parameters
NameDescription
optionalArgs array

Optional.

↳ projectId string

Deprecated. The Google Developers Console project ID or project number. This field has been deprecated and replaced by the parent field.

↳ zone string

Deprecated. The name of the Google Compute Engine zone in which the cluster resides. This field has been deprecated and replaced by the parent field.

↳ clusterId string

Deprecated. The name of the cluster. This field has been deprecated and replaced by the parent field.

↳ parent string

The parent (project, location, cluster name) where the node pools will be listed. Specified in the format projects/*/locations/*/clusters/*.

↳ 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\Container\V1\ListNodePoolsResponse
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Container\V1\ClusterManagerClient;
use Google\Cloud\Container\V1\ListNodePoolsResponse;

/**
 * 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 list_node_pools_sample(): void
{
    // Create a client.
    $clusterManagerClient = new ClusterManagerClient();

    // Call the API and handle any network failures.
    try {
        /** @var ListNodePoolsResponse $response */
        $response = $clusterManagerClient->listNodePools();
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

listOperations

Lists all operations in a project in a specific zone or all zones.

Parameters
NameDescription
optionalArgs array

Optional.

↳ projectId string

Deprecated. The Google Developers Console project ID or project number. This field has been deprecated and replaced by the parent field.

↳ zone string

Deprecated. The name of the Google Compute Engine zone to return operations for, or - for all zones. This field has been deprecated and replaced by the parent field.

↳ parent string

The parent (project and location) where the operations will be listed. Specified in the format projects/*/locations/*. Location "-" matches all zones and all regions.

↳ 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\Container\V1\ListOperationsResponse
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Container\V1\ClusterManagerClient;
use Google\Cloud\Container\V1\ListOperationsResponse;

/**
 * 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 list_operations_sample(): void
{
    // Create a client.
    $clusterManagerClient = new ClusterManagerClient();

    // Call the API and handle any network failures.
    try {
        /** @var ListOperationsResponse $response */
        $response = $clusterManagerClient->listOperations();
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

listUsableSubnetworks

Lists subnetworks that are usable for creating clusters in a project.

Parameters
NameDescription
optionalArgs array

Optional.

↳ parent string

The parent project where subnetworks are usable. Specified in the format projects/*.

↳ filter string

Filtering currently only supports equality on the networkProjectId and must be in the form: "networkProjectId=[PROJECTID]", where networkProjectId is the project which owns the listed subnetworks. This defaults to the parent project ID.

↳ 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\Container\V1\ClusterManagerClient;
use Google\Cloud\Container\V1\UsableSubnetwork;

/**
 * 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 list_usable_subnetworks_sample(): void
{
    // Create a client.
    $clusterManagerClient = new ClusterManagerClient();

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

        /** @var UsableSubnetwork $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());
    }
}

rollbackNodePoolUpgrade

Rolls back a previously Aborted or Failed NodePool upgrade.

This makes no changes if the last upgrade successfully completed.

Parameters
NameDescription
optionalArgs array

Optional.

↳ projectId string

Deprecated. The Google Developers Console project ID or project number. This field has been deprecated and replaced by the name field.

↳ zone string

Deprecated. The name of the Google Compute Engine zone in which the cluster resides. This field has been deprecated and replaced by the name field.

↳ clusterId string

Deprecated. The name of the cluster to rollback. This field has been deprecated and replaced by the name field.

↳ nodePoolId string

Deprecated. The name of the node pool to rollback. This field has been deprecated and replaced by the name field.

↳ name string

The name (project, location, cluster, node pool id) of the node poll to rollback upgrade. Specified in the format projects/*/locations/*/clusters/*/nodePools/*.

↳ respectPdb bool

Option for rollback to ignore the PodDisruptionBudget. Default value is false.

↳ 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\Container\V1\Operation
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Container\V1\ClusterManagerClient;
use Google\Cloud\Container\V1\Operation;

/**
 * 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 rollback_node_pool_upgrade_sample(): void
{
    // Create a client.
    $clusterManagerClient = new ClusterManagerClient();

    // Call the API and handle any network failures.
    try {
        /** @var Operation $response */
        $response = $clusterManagerClient->rollbackNodePoolUpgrade();
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

setAddonsConfig

Sets the addons for a specific cluster.

Parameters
NameDescription
addonsConfig Google\Cloud\Container\V1\AddonsConfig

Required. The desired configurations for the various addons available to run in the cluster.

optionalArgs array

Optional.

↳ projectId string

Deprecated. The Google Developers Console project ID or project number. This field has been deprecated and replaced by the name field.

↳ zone string

Deprecated. The name of the Google Compute Engine zone in which the cluster resides. This field has been deprecated and replaced by the name field.

↳ clusterId string

Deprecated. The name of the cluster to upgrade. This field has been deprecated and replaced by the name field.

↳ name string

The name (project, location, cluster) of the cluster to set addons. Specified in the format projects/*/locations/*/clusters/*.

↳ 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\Container\V1\Operation
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Container\V1\AddonsConfig;
use Google\Cloud\Container\V1\ClusterManagerClient;
use Google\Cloud\Container\V1\Operation;

/**
 * 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 set_addons_config_sample(): void
{
    // Create a client.
    $clusterManagerClient = new ClusterManagerClient();

    // Prepare any non-scalar elements to be passed along with the request.
    $addonsConfig = new AddonsConfig();

    // Call the API and handle any network failures.
    try {
        /** @var Operation $response */
        $response = $clusterManagerClient->setAddonsConfig($addonsConfig);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

setLabels

Sets labels on a cluster.

Parameters
NameDescription
resourceLabels array

Required. The labels to set for that cluster.

labelFingerprint string

Required. The fingerprint of the previous set of labels for this resource, used to detect conflicts. The fingerprint is initially generated by Kubernetes Engine and changes after every request to modify or update labels. You must always provide an up-to-date fingerprint hash when updating or changing labels. Make a get() request to the resource to get the latest fingerprint.

optionalArgs array

Optional.

↳ projectId string

Deprecated. The Google Developers Console project ID or project number. This field has been deprecated and replaced by the name field.

↳ zone string

Deprecated. The name of the Google Compute Engine zone in which the cluster resides. This field has been deprecated and replaced by the name field.

↳ clusterId string

Deprecated. The name of the cluster. This field has been deprecated and replaced by the name field.

↳ name string

The name (project, location, cluster name) of the cluster to set labels. Specified in the format projects/*/locations/*/clusters/*.

↳ 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\Container\V1\Operation
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Container\V1\ClusterManagerClient;
use Google\Cloud\Container\V1\Operation;

/**
 * @param string $labelFingerprint The fingerprint of the previous set of labels for this resource,
 *                                 used to detect conflicts. The fingerprint is initially generated by
 *                                 Kubernetes Engine and changes after every request to modify or update
 *                                 labels. You must always provide an up-to-date fingerprint hash when
 *                                 updating or changing labels. Make a `get()` request to the
 *                                 resource to get the latest fingerprint.
 */
function set_labels_sample(string $labelFingerprint): void
{
    // Create a client.
    $clusterManagerClient = new ClusterManagerClient();

    // Prepare any non-scalar elements to be passed along with the request.
    $resourceLabels = [];

    // Call the API and handle any network failures.
    try {
        /** @var Operation $response */
        $response = $clusterManagerClient->setLabels($resourceLabels, $labelFingerprint);
        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
{
    $labelFingerprint = '[LABEL_FINGERPRINT]';

    set_labels_sample($labelFingerprint);
}

setLegacyAbac

Enables or disables the ABAC authorization mechanism on a cluster.

Parameters
NameDescription
enabled bool

Required. Whether ABAC authorization will be enabled in the cluster.

optionalArgs array

Optional.

↳ projectId string

Deprecated. The Google Developers Console project ID or project number. This field has been deprecated and replaced by the name field.

↳ zone string

Deprecated. The name of the Google Compute Engine zone in which the cluster resides. This field has been deprecated and replaced by the name field.

↳ clusterId string

Deprecated. The name of the cluster to update. This field has been deprecated and replaced by the name field.

↳ name string

The name (project, location, cluster name) of the cluster to set legacy abac. Specified in the format projects/*/locations/*/clusters/*.

↳ 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\Container\V1\Operation
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Container\V1\ClusterManagerClient;
use Google\Cloud\Container\V1\Operation;

/**
 * @param bool $enabled Whether ABAC authorization will be enabled in the cluster.
 */
function set_legacy_abac_sample(bool $enabled): void
{
    // Create a client.
    $clusterManagerClient = new ClusterManagerClient();

    // Call the API and handle any network failures.
    try {
        /** @var Operation $response */
        $response = $clusterManagerClient->setLegacyAbac($enabled);
        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
{
    $enabled = false;

    set_legacy_abac_sample($enabled);
}

setLocations

Sets the locations for a specific cluster.

Deprecated. Use projects.locations.clusters.update instead.

Parameters
NameDescription
locations string[]

Required. The desired list of Google Compute Engine zones in which the cluster's nodes should be located. Changing the locations a cluster is in will result in nodes being either created or removed from the cluster, depending on whether locations are being added or removed.

This list must always include the cluster's primary zone.

optionalArgs array

Optional.

↳ projectId string

Deprecated. The Google Developers Console project ID or project number. This field has been deprecated and replaced by the name field.

↳ zone string

Deprecated. The name of the Google Compute Engine zone in which the cluster resides. This field has been deprecated and replaced by the name field.

↳ clusterId string

Deprecated. The name of the cluster to upgrade. This field has been deprecated and replaced by the name field.

↳ name string

The name (project, location, cluster) of the cluster to set locations. Specified in the format projects/*/locations/*/clusters/*.

↳ 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\Container\V1\Operation
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Container\V1\ClusterManagerClient;
use Google\Cloud\Container\V1\Operation;

/**
 * @param string $locationsElement The desired list of Google Compute Engine
 *                                 [zones](https://cloud.google.com/compute/docs/zones#available) in which the
 *                                 cluster's nodes should be located. Changing the locations a cluster is in
 *                                 will result in nodes being either created or removed from the cluster,
 *                                 depending on whether locations are being added or removed.
 *
 *                                 This list must always include the cluster's primary zone.
 */
function set_locations_sample(string $locationsElement): void
{
    // Create a client.
    $clusterManagerClient = new ClusterManagerClient();

    // Prepare any non-scalar elements to be passed along with the request.
    $locations = [$locationsElement,];

    // Call the API and handle any network failures.
    try {
        /** @var Operation $response */
        $response = $clusterManagerClient->setLocations($locations);
        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
{
    $locationsElement = '[LOCATIONS]';

    set_locations_sample($locationsElement);
}

setLoggingService

Sets the logging service for a specific cluster.

Parameters
NameDescription
loggingService string

Required. The logging service the cluster should use to write logs. Currently available options:

  • logging.googleapis.com/kubernetes - The Cloud Logging service with a Kubernetes-native resource model
  • logging.googleapis.com - The legacy Cloud Logging service (no longer available as of GKE 1.15).
  • none - no logs will be exported from the cluster.

If left as an empty string,logging.googleapis.com/kubernetes will be used for GKE 1.14+ or logging.googleapis.com for earlier versions.

optionalArgs array

Optional.

↳ projectId string

Deprecated. The Google Developers Console project ID or project number. This field has been deprecated and replaced by the name field.

↳ zone string

Deprecated. The name of the Google Compute Engine zone in which the cluster resides. This field has been deprecated and replaced by the name field.

↳ clusterId string

Deprecated. The name of the cluster to upgrade. This field has been deprecated and replaced by the name field.

↳ name string

The name (project, location, cluster) of the cluster to set logging. Specified in the format projects/*/locations/*/clusters/*.

↳ 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\Container\V1\Operation
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Container\V1\ClusterManagerClient;
use Google\Cloud\Container\V1\Operation;

/**
 * @param string $loggingService The logging service the cluster should use to write logs.
 *                               Currently available options:
 *
 *                               * `logging.googleapis.com/kubernetes` - The Cloud Logging
 *                               service with a Kubernetes-native resource model
 *                               * `logging.googleapis.com` - The legacy Cloud Logging service (no longer
 *                               available as of GKE 1.15).
 *                               * `none` - no logs will be exported from the cluster.
 *
 *                               If left as an empty string,`logging.googleapis.com/kubernetes` will be
 *                               used for GKE 1.14+ or `logging.googleapis.com` for earlier versions.
 */
function set_logging_service_sample(string $loggingService): void
{
    // Create a client.
    $clusterManagerClient = new ClusterManagerClient();

    // Call the API and handle any network failures.
    try {
        /** @var Operation $response */
        $response = $clusterManagerClient->setLoggingService($loggingService);
        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
{
    $loggingService = '[LOGGING_SERVICE]';

    set_logging_service_sample($loggingService);
}

setMaintenancePolicy

Sets the maintenance policy for a cluster.

Parameters
NameDescription
projectId string

Required. The Google Developers Console project ID or project number.

zone string

Required. The name of the Google Compute Engine zone in which the cluster resides.

clusterId string

Required. The name of the cluster to update.

maintenancePolicy Google\Cloud\Container\V1\MaintenancePolicy

Required. The maintenance policy to be set for the cluster. An empty field clears the existing maintenance policy.

optionalArgs array

Optional.

↳ name string

The name (project, location, cluster name) of the cluster to set maintenance policy. Specified in the format projects/*/locations/*/clusters/*.

↳ 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\Container\V1\Operation
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Container\V1\ClusterManagerClient;
use Google\Cloud\Container\V1\MaintenancePolicy;
use Google\Cloud\Container\V1\Operation;

/**
 * @param string $projectId The Google Developers Console [project ID or project
 *                          number](https://cloud.google.com/resource-manager/docs/creating-managing-projects).
 * @param string $zone      The name of the Google Compute Engine
 *                          [zone](https://cloud.google.com/compute/docs/zones#available) in which the
 *                          cluster resides.
 * @param string $clusterId The name of the cluster to update.
 */
function set_maintenance_policy_sample(string $projectId, string $zone, string $clusterId): void
{
    // Create a client.
    $clusterManagerClient = new ClusterManagerClient();

    // Prepare any non-scalar elements to be passed along with the request.
    $maintenancePolicy = new MaintenancePolicy();

    // Call the API and handle any network failures.
    try {
        /** @var Operation $response */
        $response = $clusterManagerClient->setMaintenancePolicy(
            $projectId,
            $zone,
            $clusterId,
            $maintenancePolicy
        );
        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
{
    $projectId = '[PROJECT_ID]';
    $zone = '[ZONE]';
    $clusterId = '[CLUSTER_ID]';

    set_maintenance_policy_sample($projectId, $zone, $clusterId);
}

setMasterAuth

Sets master auth materials. Currently supports changing the admin password or a specific cluster, either via password generation or explicitly setting the password.

Parameters
NameDescription
action int

Required. The exact form of action to be taken on the master auth. For allowed values, use constants defined on Google\Cloud\Container\V1\SetMasterAuthRequest\Action

update Google\Cloud\Container\V1\MasterAuth

Required. A description of the update.

optionalArgs array

Optional.

↳ projectId string

Deprecated. The Google Developers Console project ID or project number. This field has been deprecated and replaced by the name field.

↳ zone string

Deprecated. The name of the Google Compute Engine zone in which the cluster resides. This field has been deprecated and replaced by the name field.

↳ clusterId string

Deprecated. The name of the cluster to upgrade. This field has been deprecated and replaced by the name field.

↳ name string

The name (project, location, cluster) of the cluster to set auth. Specified in the format projects/*/locations/*/clusters/*.

↳ 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\Container\V1\Operation
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Container\V1\ClusterManagerClient;
use Google\Cloud\Container\V1\MasterAuth;
use Google\Cloud\Container\V1\Operation;
use Google\Cloud\Container\V1\SetMasterAuthRequest\Action;

/**
 * @param int $action The exact form of action to be taken on the master auth.
 */
function set_master_auth_sample(int $action): void
{
    // Create a client.
    $clusterManagerClient = new ClusterManagerClient();

    // Prepare any non-scalar elements to be passed along with the request.
    $update = new MasterAuth();

    // Call the API and handle any network failures.
    try {
        /** @var Operation $response */
        $response = $clusterManagerClient->setMasterAuth($action, $update);
        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
{
    $action = Action::UNKNOWN;

    set_master_auth_sample($action);
}

setMonitoringService

Sets the monitoring service for a specific cluster.

Parameters
NameDescription
monitoringService string

Required. The monitoring service the cluster should use to write metrics. Currently available options:

  • "monitoring.googleapis.com/kubernetes" - The Cloud Monitoring service with a Kubernetes-native resource model
  • monitoring.googleapis.com - The legacy Cloud Monitoring service (no longer available as of GKE 1.15).
  • none - No metrics will be exported from the cluster.

If left as an empty string,monitoring.googleapis.com/kubernetes will be used for GKE 1.14+ or monitoring.googleapis.com for earlier versions.

optionalArgs array

Optional.

↳ projectId string

Deprecated. The Google Developers Console project ID or project number. This field has been deprecated and replaced by the name field.

↳ zone string

Deprecated. The name of the Google Compute Engine zone in which the cluster resides. This field has been deprecated and replaced by the name field.

↳ clusterId string

Deprecated. The name of the cluster to upgrade. This field has been deprecated and replaced by the name field.

↳ name string

The name (project, location, cluster) of the cluster to set monitoring. Specified in the format projects/*/locations/*/clusters/*.

↳ 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\Container\V1\Operation
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Container\V1\ClusterManagerClient;
use Google\Cloud\Container\V1\Operation;

/**
 * @param string $monitoringService The monitoring service the cluster should use to write metrics.
 *                                  Currently available options:
 *
 *                                  * "monitoring.googleapis.com/kubernetes" - The Cloud Monitoring
 *                                  service with a Kubernetes-native resource model
 *                                  * `monitoring.googleapis.com` - The legacy Cloud Monitoring service (no
 *                                  longer available as of GKE 1.15).
 *                                  * `none` - No metrics will be exported from the cluster.
 *
 *                                  If left as an empty string,`monitoring.googleapis.com/kubernetes` will be
 *                                  used for GKE 1.14+ or `monitoring.googleapis.com` for earlier versions.
 */
function set_monitoring_service_sample(string $monitoringService): void
{
    // Create a client.
    $clusterManagerClient = new ClusterManagerClient();

    // Call the API and handle any network failures.
    try {
        /** @var Operation $response */
        $response = $clusterManagerClient->setMonitoringService($monitoringService);
        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
{
    $monitoringService = '[MONITORING_SERVICE]';

    set_monitoring_service_sample($monitoringService);
}

setNetworkPolicy

Enables or disables Network Policy for a cluster.

Parameters
NameDescription
networkPolicy Google\Cloud\Container\V1\NetworkPolicy

Required. Configuration options for the NetworkPolicy feature.

optionalArgs array

Optional.

↳ projectId string

Deprecated. The Google Developers Console project ID or project number. This field has been deprecated and replaced by the name field.

↳ zone string

Deprecated. The name of the Google Compute Engine zone in which the cluster resides. This field has been deprecated and replaced by the name field.

↳ clusterId string

Deprecated. The name of the cluster. This field has been deprecated and replaced by the name field.

↳ name string

The name (project, location, cluster name) of the cluster to set networking policy. Specified in the format projects/*/locations/*/clusters/*.

↳ 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\Container\V1\Operation
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Container\V1\ClusterManagerClient;
use Google\Cloud\Container\V1\NetworkPolicy;
use Google\Cloud\Container\V1\Operation;

/**
 * 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 set_network_policy_sample(): void
{
    // Create a client.
    $clusterManagerClient = new ClusterManagerClient();

    // Prepare any non-scalar elements to be passed along with the request.
    $networkPolicy = new NetworkPolicy();

    // Call the API and handle any network failures.
    try {
        /** @var Operation $response */
        $response = $clusterManagerClient->setNetworkPolicy($networkPolicy);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

setNodePoolAutoscaling

Sets the autoscaling settings for the specified node pool.

Parameters
NameDescription
autoscaling Google\Cloud\Container\V1\NodePoolAutoscaling

Required. Autoscaling configuration for the node pool.

optionalArgs array

Optional.

↳ projectId string

Deprecated. The Google Developers Console project ID or project number. This field has been deprecated and replaced by the name field.

↳ zone string

Deprecated. The name of the Google Compute Engine zone in which the cluster resides. This field has been deprecated and replaced by the name field.

↳ clusterId string

Deprecated. The name of the cluster to upgrade. This field has been deprecated and replaced by the name field.

↳ nodePoolId string

Deprecated. The name of the node pool to upgrade. This field has been deprecated and replaced by the name field.

↳ name string

The name (project, location, cluster, node pool) of the node pool to set autoscaler settings. Specified in the format projects/*/locations/*/clusters/*/nodePools/*.

↳ 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\Container\V1\Operation
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Container\V1\ClusterManagerClient;
use Google\Cloud\Container\V1\NodePoolAutoscaling;
use Google\Cloud\Container\V1\Operation;

/**
 * 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 set_node_pool_autoscaling_sample(): void
{
    // Create a client.
    $clusterManagerClient = new ClusterManagerClient();

    // Prepare any non-scalar elements to be passed along with the request.
    $autoscaling = new NodePoolAutoscaling();

    // Call the API and handle any network failures.
    try {
        /** @var Operation $response */
        $response = $clusterManagerClient->setNodePoolAutoscaling($autoscaling);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

setNodePoolManagement

Sets the NodeManagement options for a node pool.

Parameters
NameDescription
management Google\Cloud\Container\V1\NodeManagement

Required. NodeManagement configuration for the node pool.

optionalArgs array

Optional.

↳ projectId string

Deprecated. The Google Developers Console project ID or project number. This field has been deprecated and replaced by the name field.

↳ zone string

Deprecated. The name of the Google Compute Engine zone in which the cluster resides. This field has been deprecated and replaced by the name field.

↳ clusterId string

Deprecated. The name of the cluster to update. This field has been deprecated and replaced by the name field.

↳ nodePoolId string

Deprecated. The name of the node pool to update. This field has been deprecated and replaced by the name field.

↳ name string

The name (project, location, cluster, node pool id) of the node pool to set management properties. Specified in the format projects/*/locations/*/clusters/*/nodePools/*.

↳ 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\Container\V1\Operation
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Container\V1\ClusterManagerClient;
use Google\Cloud\Container\V1\NodeManagement;
use Google\Cloud\Container\V1\Operation;

/**
 * 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 set_node_pool_management_sample(): void
{
    // Create a client.
    $clusterManagerClient = new ClusterManagerClient();

    // Prepare any non-scalar elements to be passed along with the request.
    $management = new NodeManagement();

    // Call the API and handle any network failures.
    try {
        /** @var Operation $response */
        $response = $clusterManagerClient->setNodePoolManagement($management);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

setNodePoolSize

Sets the size for a specific node pool. The new size will be used for all replicas, including future replicas created by modifying NodePool.locations.

Parameters
NameDescription
nodeCount int

Required. The desired node count for the pool.

optionalArgs array

Optional.

↳ projectId string

Deprecated. The Google Developers Console project ID or project number. This field has been deprecated and replaced by the name field.

↳ zone string

Deprecated. The name of the Google Compute Engine zone in which the cluster resides. This field has been deprecated and replaced by the name field.

↳ clusterId string

Deprecated. The name of the cluster to update. This field has been deprecated and replaced by the name field.

↳ nodePoolId string

Deprecated. The name of the node pool to update. This field has been deprecated and replaced by the name field.

↳ name string

The name (project, location, cluster, node pool id) of the node pool to set size. Specified in the format projects/*/locations/*/clusters/*/nodePools/*.

↳ 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\Container\V1\Operation
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Container\V1\ClusterManagerClient;
use Google\Cloud\Container\V1\Operation;

/**
 * @param int $nodeCount The desired node count for the pool.
 */
function set_node_pool_size_sample(int $nodeCount): void
{
    // Create a client.
    $clusterManagerClient = new ClusterManagerClient();

    // Call the API and handle any network failures.
    try {
        /** @var Operation $response */
        $response = $clusterManagerClient->setNodePoolSize($nodeCount);
        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
{
    $nodeCount = 0;

    set_node_pool_size_sample($nodeCount);
}

startIPRotation

Starts master IP rotation.

Parameters
NameDescription
optionalArgs array

Optional.

↳ projectId string

Deprecated. The Google Developers Console project ID or project number. This field has been deprecated and replaced by the name field.

↳ zone string

Deprecated. The name of the Google Compute Engine zone in which the cluster resides. This field has been deprecated and replaced by the name field.

↳ clusterId string

Deprecated. The name of the cluster. This field has been deprecated and replaced by the name field.

↳ name string

The name (project, location, cluster name) of the cluster to start IP rotation. Specified in the format projects/*/locations/*/clusters/*.

↳ rotateCredentials bool

Whether to rotate credentials during IP rotation.

↳ 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\Container\V1\Operation
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Container\V1\ClusterManagerClient;
use Google\Cloud\Container\V1\Operation;

/**
 * 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 start_ip_rotation_sample(): void
{
    // Create a client.
    $clusterManagerClient = new ClusterManagerClient();

    // Call the API and handle any network failures.
    try {
        /** @var Operation $response */
        $response = $clusterManagerClient->startIPRotation();
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

updateCluster

Updates the settings of a specific cluster.

Parameters
NameDescription
update Google\Cloud\Container\V1\ClusterUpdate

Required. A description of the update.

optionalArgs array

Optional.

↳ projectId string

Deprecated. The Google Developers Console project ID or project number. This field has been deprecated and replaced by the name field.

↳ zone string

Deprecated. The name of the Google Compute Engine zone in which the cluster resides. This field has been deprecated and replaced by the name field.

↳ clusterId string

Deprecated. The name of the cluster to upgrade. This field has been deprecated and replaced by the name field.

↳ name string

The name (project, location, cluster) of the cluster to update. Specified in the format projects/*/locations/*/clusters/*.

↳ 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\Container\V1\Operation
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Container\V1\ClusterManagerClient;
use Google\Cloud\Container\V1\ClusterUpdate;
use Google\Cloud\Container\V1\Operation;

/**
 * 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 update_cluster_sample(): void
{
    // Create a client.
    $clusterManagerClient = new ClusterManagerClient();

    // Prepare any non-scalar elements to be passed along with the request.
    $update = new ClusterUpdate();

    // Call the API and handle any network failures.
    try {
        /** @var Operation $response */
        $response = $clusterManagerClient->updateCluster($update);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

updateMaster

Updates the master for a specific cluster.

Parameters
NameDescription
masterVersion string

Required. The Kubernetes version to change the master to.

Users may specify either explicit versions offered by Kubernetes Engine or version aliases, which have the following behavior:

  • "latest": picks the highest valid Kubernetes version
  • "1.X": picks the highest valid patch+gke.N patch in the 1.X version
  • "1.X.Y": picks the highest valid gke.N patch in the 1.X.Y version
  • "1.X.Y-gke.N": picks an explicit Kubernetes version
  • "-": picks the default Kubernetes version
optionalArgs array

Optional.

↳ projectId string

Deprecated. The Google Developers Console project ID or project number. This field has been deprecated and replaced by the name field.

↳ zone string

Deprecated. The name of the Google Compute Engine zone in which the cluster resides. This field has been deprecated and replaced by the name field.

↳ clusterId string

Deprecated. The name of the cluster to upgrade. This field has been deprecated and replaced by the name field.

↳ name string

The name (project, location, cluster) of the cluster to update. Specified in the format projects/*/locations/*/clusters/*.

↳ 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\Container\V1\Operation
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Container\V1\ClusterManagerClient;
use Google\Cloud\Container\V1\Operation;

/**
 * @param string $masterVersion The Kubernetes version to change the master to.
 *
 *                              Users may specify either explicit versions offered by Kubernetes Engine or
 *                              version aliases, which have the following behavior:
 *
 *                              - "latest": picks the highest valid Kubernetes version
 *                              - "1.X": picks the highest valid patch+gke.N patch in the 1.X version
 *                              - "1.X.Y": picks the highest valid gke.N patch in the 1.X.Y version
 *                              - "1.X.Y-gke.N": picks an explicit Kubernetes version
 *                              - "-": picks the default Kubernetes version
 */
function update_master_sample(string $masterVersion): void
{
    // Create a client.
    $clusterManagerClient = new ClusterManagerClient();

    // Call the API and handle any network failures.
    try {
        /** @var Operation $response */
        $response = $clusterManagerClient->updateMaster($masterVersion);
        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
{
    $masterVersion = '[MASTER_VERSION]';

    update_master_sample($masterVersion);
}

updateNodePool

Updates the version and/or image type for the specified node pool.

Parameters
NameDescription
nodeVersion string

Required. The Kubernetes version to change the nodes to (typically an upgrade).

Users may specify either explicit versions offered by Kubernetes Engine or version aliases, which have the following behavior:

  • "latest": picks the highest valid Kubernetes version
  • "1.X": picks the highest valid patch+gke.N patch in the 1.X version
  • "1.X.Y": picks the highest valid gke.N patch in the 1.X.Y version
  • "1.X.Y-gke.N": picks an explicit Kubernetes version
  • "-": picks the Kubernetes master version
imageType string

Required. The desired image type for the node pool. Please see https://cloud.google.com/kubernetes-engine/docs/concepts/node-images for available image types.

optionalArgs array

Optional.

↳ projectId string

Deprecated. The Google Developers Console project ID or project number. This field has been deprecated and replaced by the name field.

↳ zone string

Deprecated. The name of the Google Compute Engine zone in which the cluster resides. This field has been deprecated and replaced by the name field.

↳ clusterId string

Deprecated. The name of the cluster to upgrade. This field has been deprecated and replaced by the name field.

↳ nodePoolId string

Deprecated. The name of the node pool to upgrade. This field has been deprecated and replaced by the name field.

↳ name string

The name (project, location, cluster, node pool) of the node pool to update. Specified in the format projects/*/locations/*/clusters/*/nodePools/*.

↳ locations string[]

The desired list of Google Compute Engine zones in which the node pool's nodes should be located. Changing the locations for a node pool will result in nodes being either created or removed from the node pool, depending on whether locations are being added or removed.

↳ workloadMetadataConfig WorkloadMetadataConfig

The desired workload metadata config for the node pool.

↳ upgradeSettings UpgradeSettings

Upgrade settings control disruption and speed of the upgrade.

↳ tags NetworkTags

The desired network tags to be applied to all nodes in the node pool. If this field is not present, the tags will not be changed. Otherwise, the existing network tags will be replaced with the provided tags.

↳ taints NodeTaints

The desired node taints to be applied to all nodes in the node pool. If this field is not present, the taints will not be changed. Otherwise, the existing node taints will be replaced with the provided taints.

↳ labels NodeLabels

The desired node labels to be applied to all nodes in the node pool. If this field is not present, the labels will not be changed. Otherwise, the existing node labels will be replaced with the provided labels.

↳ linuxNodeConfig LinuxNodeConfig

Parameters that can be configured on Linux nodes.

↳ kubeletConfig NodeKubeletConfig

Node kubelet configs.

↳ nodeNetworkConfig NodeNetworkConfig

Node network config.

↳ gcfsConfig GcfsConfig

GCFS config.

↳ confidentialNodes ConfidentialNodes

Confidential nodes config. All the nodes in the node pool will be Confidential VM once enabled.

↳ gvnic VirtualNIC

Enable or disable gvnic on the node pool.

↳ etag string

The current etag of the node pool. If an etag is provided and does not match the current etag of the node pool, update will be blocked and an ABORTED error will be returned.

↳ fastSocket FastSocket

Enable or disable NCCL fast socket for the node pool.

↳ loggingConfig NodePoolLoggingConfig

Logging configuration.

↳ resourceLabels ResourceLabels

The resource labels for the node pool to use to annotate any related Google Compute Engine resources.

↳ windowsNodeConfig WindowsNodeConfig

Parameters that can be configured on Windows nodes.

↳ 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\Container\V1\Operation
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Container\V1\ClusterManagerClient;
use Google\Cloud\Container\V1\Operation;

/**
 * @param string $nodeVersion The Kubernetes version to change the nodes to (typically an
 *                            upgrade).
 *
 *                            Users may specify either explicit versions offered by Kubernetes Engine or
 *                            version aliases, which have the following behavior:
 *
 *                            - "latest": picks the highest valid Kubernetes version
 *                            - "1.X": picks the highest valid patch+gke.N patch in the 1.X version
 *                            - "1.X.Y": picks the highest valid gke.N patch in the 1.X.Y version
 *                            - "1.X.Y-gke.N": picks an explicit Kubernetes version
 *                            - "-": picks the Kubernetes master version
 * @param string $imageType   The desired image type for the node pool. Please see
 *                            https://cloud.google.com/kubernetes-engine/docs/concepts/node-images for
 *                            available image types.
 */
function update_node_pool_sample(string $nodeVersion, string $imageType): void
{
    // Create a client.
    $clusterManagerClient = new ClusterManagerClient();

    // Call the API and handle any network failures.
    try {
        /** @var Operation $response */
        $response = $clusterManagerClient->updateNodePool($nodeVersion, $imageType);
        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
{
    $nodeVersion = '[NODE_VERSION]';
    $imageType = '[IMAGE_TYPE]';

    update_node_pool_sample($nodeVersion, $imageType);
}

static::topicName

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

Parameters
NameDescription
project string
topic string
Returns
TypeDescription
stringThe formatted topic 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

  • topic: projects/{project}/topics/{topic}

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.container.v1.ClusterManager'

The name of the service.

SERVICE_ADDRESS

Value: 'container.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.