Google Cloud Container V1 Client - Class ClusterManagerClient (1.30.3)

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.

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.

Namespace

Google \ Cloud \ Container \ V1 \ Client

Methods

__construct

Constructor.

Parameters
Name Description
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.

The async variant is Google\Cloud\Container\V1\Client\ClusterManagerClient::cancelOperationAsync() .

Parameters
Name Description
request Google\Cloud\Container\V1\CancelOperationRequest

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.

Example
use Google\ApiCore\ApiException;
use Google\Cloud\Container\V1\CancelOperationRequest;
use Google\Cloud\Container\V1\Client\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();

    // Prepare the request message.
    $request = new CancelOperationRequest();

    // Call the API and handle any network failures.
    try {
        $clusterManagerClient->cancelOperation($request);
        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.

The async variant is Google\Cloud\Container\V1\Client\ClusterManagerClient::checkAutopilotCompatibilityAsync() .

Parameters
Name Description
request Google\Cloud\Container\V1\CheckAutopilotCompatibilityRequest

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
Type Description
Google\Cloud\Container\V1\CheckAutopilotCompatibilityResponse
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Container\V1\CheckAutopilotCompatibilityRequest;
use Google\Cloud\Container\V1\CheckAutopilotCompatibilityResponse;
use Google\Cloud\Container\V1\Client\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();

    // Prepare the request message.
    $request = new CheckAutopilotCompatibilityRequest();

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

The async variant is Google\Cloud\Container\V1\Client\ClusterManagerClient::completeIPRotationAsync() .

Parameters
Name Description
request Google\Cloud\Container\V1\CompleteIPRotationRequest

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
Type Description
Google\Cloud\Container\V1\Operation
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Container\V1\Client\ClusterManagerClient;
use Google\Cloud\Container\V1\CompleteIPRotationRequest;
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();

    // Prepare the request message.
    $request = new CompleteIPRotationRequest();

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

The async variant is Google\Cloud\Container\V1\Client\ClusterManagerClient::completeNodePoolUpgradeAsync() .

Parameters
Name Description
request Google\Cloud\Container\V1\CompleteNodePoolUpgradeRequest

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.

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

/**
 * 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();

    // Prepare the request message.
    $request = new CompleteNodePoolUpgradeRequest();

    // Call the API and handle any network failures.
    try {
        $clusterManagerClient->completeNodePoolUpgrade($request);
        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.

The async variant is Google\Cloud\Container\V1\Client\ClusterManagerClient::createClusterAsync() .

Parameters
Name Description
request Google\Cloud\Container\V1\CreateClusterRequest

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
Type Description
Google\Cloud\Container\V1\Operation
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Container\V1\Client\ClusterManagerClient;
use Google\Cloud\Container\V1\Cluster;
use Google\Cloud\Container\V1\CreateClusterRequest;
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 the request message.
    $cluster = new Cluster();
    $request = (new CreateClusterRequest())
        ->setCluster($cluster);

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

The async variant is Google\Cloud\Container\V1\Client\ClusterManagerClient::createNodePoolAsync() .

Parameters
Name Description
request Google\Cloud\Container\V1\CreateNodePoolRequest

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
Type Description
Google\Cloud\Container\V1\Operation
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Container\V1\Client\ClusterManagerClient;
use Google\Cloud\Container\V1\CreateNodePoolRequest;
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 the request message.
    $nodePool = new NodePool();
    $request = (new CreateNodePoolRequest())
        ->setNodePool($nodePool);

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

The async variant is Google\Cloud\Container\V1\Client\ClusterManagerClient::deleteClusterAsync() .

Parameters
Name Description
request Google\Cloud\Container\V1\DeleteClusterRequest

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
Type Description
Google\Cloud\Container\V1\Operation
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Container\V1\Client\ClusterManagerClient;
use Google\Cloud\Container\V1\DeleteClusterRequest;
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();

    // Prepare the request message.
    $request = new DeleteClusterRequest();

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

The async variant is Google\Cloud\Container\V1\Client\ClusterManagerClient::deleteNodePoolAsync() .

Parameters
Name Description
request Google\Cloud\Container\V1\DeleteNodePoolRequest

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
Type Description
Google\Cloud\Container\V1\Operation
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Container\V1\Client\ClusterManagerClient;
use Google\Cloud\Container\V1\DeleteNodePoolRequest;
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();

    // Prepare the request message.
    $request = new DeleteNodePoolRequest();

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

The async variant is Google\Cloud\Container\V1\Client\ClusterManagerClient::getClusterAsync() .

Parameters
Name Description
request Google\Cloud\Container\V1\GetClusterRequest

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

/**
 * 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();

    // Prepare the request message.
    $request = new GetClusterRequest();

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

The async variant is Google\Cloud\Container\V1\Client\ClusterManagerClient::getJSONWebKeysAsync() .

Parameters
Name Description
request Google\Cloud\Container\V1\GetJSONWebKeysRequest

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
Type Description
Google\Cloud\Container\V1\GetJSONWebKeysResponse
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Container\V1\Client\ClusterManagerClient;
use Google\Cloud\Container\V1\GetJSONWebKeysRequest;
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();

    // Prepare the request message.
    $request = new GetJSONWebKeysRequest();

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

The async variant is Google\Cloud\Container\V1\Client\ClusterManagerClient::getNodePoolAsync() .

Parameters
Name Description
request Google\Cloud\Container\V1\GetNodePoolRequest

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
Type Description
Google\Cloud\Container\V1\NodePool
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Container\V1\Client\ClusterManagerClient;
use Google\Cloud\Container\V1\GetNodePoolRequest;
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();

    // Prepare the request message.
    $request = new GetNodePoolRequest();

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

The async variant is Google\Cloud\Container\V1\Client\ClusterManagerClient::getOperationAsync() .

Parameters
Name Description
request Google\Cloud\Container\V1\GetOperationRequest

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
Type Description
Google\Cloud\Container\V1\Operation
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Container\V1\Client\ClusterManagerClient;
use Google\Cloud\Container\V1\GetOperationRequest;
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();

    // Prepare the request message.
    $request = new GetOperationRequest();

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

The async variant is Google\Cloud\Container\V1\Client\ClusterManagerClient::getServerConfigAsync() .

Parameters
Name Description
request Google\Cloud\Container\V1\GetServerConfigRequest

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
Type Description
Google\Cloud\Container\V1\ServerConfig
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Container\V1\Client\ClusterManagerClient;
use Google\Cloud\Container\V1\GetServerConfigRequest;
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();

    // Prepare the request message.
    $request = new GetServerConfigRequest();

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

The async variant is Google\Cloud\Container\V1\Client\ClusterManagerClient::listClustersAsync() .

Parameters
Name Description
request Google\Cloud\Container\V1\ListClustersRequest

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
Type Description
Google\Cloud\Container\V1\ListClustersResponse
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Container\V1\Client\ClusterManagerClient;
use Google\Cloud\Container\V1\ListClustersRequest;
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();

    // Prepare the request message.
    $request = new ListClustersRequest();

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

The async variant is Google\Cloud\Container\V1\Client\ClusterManagerClient::listNodePoolsAsync() .

Parameters
Name Description
request Google\Cloud\Container\V1\ListNodePoolsRequest

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
Type Description
Google\Cloud\Container\V1\ListNodePoolsResponse
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Container\V1\Client\ClusterManagerClient;
use Google\Cloud\Container\V1\ListNodePoolsRequest;
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();

    // Prepare the request message.
    $request = new ListNodePoolsRequest();

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

The async variant is Google\Cloud\Container\V1\Client\ClusterManagerClient::listOperationsAsync() .

Parameters
Name Description
request Google\Cloud\Container\V1\ListOperationsRequest

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
Type Description
Google\Cloud\Container\V1\ListOperationsResponse
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Container\V1\Client\ClusterManagerClient;
use Google\Cloud\Container\V1\ListOperationsRequest;
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();

    // Prepare the request message.
    $request = new ListOperationsRequest();

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

The async variant is Google\Cloud\Container\V1\Client\ClusterManagerClient::listUsableSubnetworksAsync() .

Parameters
Name Description
request Google\Cloud\Container\V1\ListUsableSubnetworksRequest

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
Type Description
Google\ApiCore\PagedListResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\Container\V1\Client\ClusterManagerClient;
use Google\Cloud\Container\V1\ListUsableSubnetworksRequest;
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();

    // Prepare the request message.
    $request = new ListUsableSubnetworksRequest();

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

        /** @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.

The async variant is Google\Cloud\Container\V1\Client\ClusterManagerClient::rollbackNodePoolUpgradeAsync() .

Parameters
Name Description
request Google\Cloud\Container\V1\RollbackNodePoolUpgradeRequest

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

/**
 * 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();

    // Prepare the request message.
    $request = new RollbackNodePoolUpgradeRequest();

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

The async variant is Google\Cloud\Container\V1\Client\ClusterManagerClient::setAddonsConfigAsync() .

Parameters
Name Description
request Google\Cloud\Container\V1\SetAddonsConfigRequest

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

/**
 * 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 the request message.
    $addonsConfig = new AddonsConfig();
    $request = (new SetAddonsConfigRequest())
        ->setAddonsConfig($addonsConfig);

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

The async variant is Google\Cloud\Container\V1\Client\ClusterManagerClient::setLabelsAsync() .

Parameters
Name Description
request Google\Cloud\Container\V1\SetLabelsRequest

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

/**
 * @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 the request message.
    $resourceLabels = [];
    $request = (new SetLabelsRequest())
        ->setResourceLabels($resourceLabels)
        ->setLabelFingerprint($labelFingerprint);

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

    set_labels_sample($labelFingerprint);
}

setLegacyAbac

Enables or disables the ABAC authorization mechanism on a cluster.

The async variant is Google\Cloud\Container\V1\Client\ClusterManagerClient::setLegacyAbacAsync() .

Parameters
Name Description
request Google\Cloud\Container\V1\SetLegacyAbacRequest

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

/**
 * @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();

    // Prepare the request message.
    $request = (new SetLegacyAbacRequest())
        ->setEnabled($enabled);

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

    set_legacy_abac_sample($enabled);
}

setLocations

Sets the locations for a specific cluster.

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

The async variant is Google\Cloud\Container\V1\Client\ClusterManagerClient::setLocationsAsync() .

Parameters
Name Description
request Google\Cloud\Container\V1\SetLocationsRequest

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

/**
 * @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 the request message.
    $locations = [$locationsElement,];
    $request = (new SetLocationsRequest())
        ->setLocations($locations);

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

    set_locations_sample($locationsElement);
}

setLoggingService

Sets the logging service for a specific cluster.

The async variant is Google\Cloud\Container\V1\Client\ClusterManagerClient::setLoggingServiceAsync() .

Parameters
Name Description
request Google\Cloud\Container\V1\SetLoggingServiceRequest

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

/**
 * @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();

    // Prepare the request message.
    $request = (new SetLoggingServiceRequest())
        ->setLoggingService($loggingService);

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

    set_logging_service_sample($loggingService);
}

setMaintenancePolicy

Sets the maintenance policy for a cluster.

The async variant is Google\Cloud\Container\V1\Client\ClusterManagerClient::setMaintenancePolicyAsync() .

Parameters
Name Description
request Google\Cloud\Container\V1\SetMaintenancePolicyRequest

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

/**
 * @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 the request message.
    $maintenancePolicy = new MaintenancePolicy();
    $request = (new SetMaintenancePolicyRequest())
        ->setProjectId($projectId)
        ->setZone($zone)
        ->setClusterId($clusterId)
        ->setMaintenancePolicy($maintenancePolicy);

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

The async variant is Google\Cloud\Container\V1\Client\ClusterManagerClient::setMasterAuthAsync() .

Parameters
Name Description
request Google\Cloud\Container\V1\SetMasterAuthRequest

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
Type Description
Google\Cloud\Container\V1\Operation
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Container\V1\Client\ClusterManagerClient;
use Google\Cloud\Container\V1\MasterAuth;
use Google\Cloud\Container\V1\Operation;
use Google\Cloud\Container\V1\SetMasterAuthRequest;
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 the request message.
    $update = new MasterAuth();
    $request = (new SetMasterAuthRequest())
        ->setAction($action)
        ->setUpdate($update);

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

    set_master_auth_sample($action);
}

setMonitoringService

Sets the monitoring service for a specific cluster.

The async variant is Google\Cloud\Container\V1\Client\ClusterManagerClient::setMonitoringServiceAsync() .

Parameters
Name Description
request Google\Cloud\Container\V1\SetMonitoringServiceRequest

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

/**
 * @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();

    // Prepare the request message.
    $request = (new SetMonitoringServiceRequest())
        ->setMonitoringService($monitoringService);

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

    set_monitoring_service_sample($monitoringService);
}

setNetworkPolicy

Enables or disables Network Policy for a cluster.

The async variant is Google\Cloud\Container\V1\Client\ClusterManagerClient::setNetworkPolicyAsync() .

Parameters
Name Description
request Google\Cloud\Container\V1\SetNetworkPolicyRequest

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

/**
 * 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 the request message.
    $networkPolicy = new NetworkPolicy();
    $request = (new SetNetworkPolicyRequest())
        ->setNetworkPolicy($networkPolicy);

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

The async variant is Google\Cloud\Container\V1\Client\ClusterManagerClient::setNodePoolAutoscalingAsync() .

Parameters
Name Description
request Google\Cloud\Container\V1\SetNodePoolAutoscalingRequest

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

/**
 * 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 the request message.
    $autoscaling = new NodePoolAutoscaling();
    $request = (new SetNodePoolAutoscalingRequest())
        ->setAutoscaling($autoscaling);

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

The async variant is Google\Cloud\Container\V1\Client\ClusterManagerClient::setNodePoolManagementAsync() .

Parameters
Name Description
request Google\Cloud\Container\V1\SetNodePoolManagementRequest

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

/**
 * 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 the request message.
    $management = new NodeManagement();
    $request = (new SetNodePoolManagementRequest())
        ->setManagement($management);

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

The async variant is Google\Cloud\Container\V1\Client\ClusterManagerClient::setNodePoolSizeAsync() .

Parameters
Name Description
request Google\Cloud\Container\V1\SetNodePoolSizeRequest

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

/**
 * @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();

    // Prepare the request message.
    $request = (new SetNodePoolSizeRequest())
        ->setNodeCount($nodeCount);

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

    set_node_pool_size_sample($nodeCount);
}

startIPRotation

Parameters
Name Description
request Google\Cloud\Container\V1\StartIPRotationRequest

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

/**
 * 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();

    // Prepare the request message.
    $request = new StartIPRotationRequest();

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

The async variant is Google\Cloud\Container\V1\Client\ClusterManagerClient::updateClusterAsync() .

Parameters
Name Description
request Google\Cloud\Container\V1\UpdateClusterRequest

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

/**
 * 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 the request message.
    $update = new ClusterUpdate();
    $request = (new UpdateClusterRequest())
        ->setUpdate($update);

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

The async variant is Google\Cloud\Container\V1\Client\ClusterManagerClient::updateMasterAsync() .

Parameters
Name Description
request Google\Cloud\Container\V1\UpdateMasterRequest

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

/**
 * @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();

    // Prepare the request message.
    $request = (new UpdateMasterRequest())
        ->setMasterVersion($masterVersion);

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

    update_master_sample($masterVersion);
}

updateNodePool

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

The async variant is Google\Cloud\Container\V1\Client\ClusterManagerClient::updateNodePoolAsync() .

Parameters
Name Description
request Google\Cloud\Container\V1\UpdateNodePoolRequest

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

/**
 * @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();

    // Prepare the request message.
    $request = (new UpdateNodePoolRequest())
        ->setNodeVersion($nodeVersion)
        ->setImageType($imageType);

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

    update_node_pool_sample($nodeVersion, $imageType);
}

cancelOperationAsync

Parameters
Name Description
request Google\Cloud\Container\V1\CancelOperationRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

checkAutopilotCompatibilityAsync

Parameters
Name Description
request Google\Cloud\Container\V1\CheckAutopilotCompatibilityRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

completeIPRotationAsync

Parameters
Name Description
request Google\Cloud\Container\V1\CompleteIPRotationRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

completeNodePoolUpgradeAsync

Parameters
Name Description
request Google\Cloud\Container\V1\CompleteNodePoolUpgradeRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

createClusterAsync

Parameters
Name Description
request Google\Cloud\Container\V1\CreateClusterRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

createNodePoolAsync

Parameters
Name Description
request Google\Cloud\Container\V1\CreateNodePoolRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

deleteClusterAsync

Parameters
Name Description
request Google\Cloud\Container\V1\DeleteClusterRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

deleteNodePoolAsync

Parameters
Name Description
request Google\Cloud\Container\V1\DeleteNodePoolRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

getClusterAsync

Parameters
Name Description
request Google\Cloud\Container\V1\GetClusterRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

getJSONWebKeysAsync

Parameters
Name Description
request Google\Cloud\Container\V1\GetJSONWebKeysRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

getNodePoolAsync

Parameters
Name Description
request Google\Cloud\Container\V1\GetNodePoolRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

getOperationAsync

Parameters
Name Description
request Google\Cloud\Container\V1\GetOperationRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

getServerConfigAsync

Parameters
Name Description
request Google\Cloud\Container\V1\GetServerConfigRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

listClustersAsync

Parameters
Name Description
request Google\Cloud\Container\V1\ListClustersRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

listNodePoolsAsync

Parameters
Name Description
request Google\Cloud\Container\V1\ListNodePoolsRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

listOperationsAsync

Parameters
Name Description
request Google\Cloud\Container\V1\ListOperationsRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

listUsableSubnetworksAsync

Parameters
Name Description
request Google\Cloud\Container\V1\ListUsableSubnetworksRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

rollbackNodePoolUpgradeAsync

Parameters
Name Description
request Google\Cloud\Container\V1\RollbackNodePoolUpgradeRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

setAddonsConfigAsync

Parameters
Name Description
request Google\Cloud\Container\V1\SetAddonsConfigRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

setLabelsAsync

Parameters
Name Description
request Google\Cloud\Container\V1\SetLabelsRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

setLegacyAbacAsync

Parameters
Name Description
request Google\Cloud\Container\V1\SetLegacyAbacRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

setLocationsAsync

Parameters
Name Description
request Google\Cloud\Container\V1\SetLocationsRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

setLoggingServiceAsync

Parameters
Name Description
request Google\Cloud\Container\V1\SetLoggingServiceRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

setMaintenancePolicyAsync

Parameters
Name Description
request Google\Cloud\Container\V1\SetMaintenancePolicyRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

setMasterAuthAsync

Parameters
Name Description
request Google\Cloud\Container\V1\SetMasterAuthRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

setMonitoringServiceAsync

Parameters
Name Description
request Google\Cloud\Container\V1\SetMonitoringServiceRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

setNetworkPolicyAsync

Parameters
Name Description
request Google\Cloud\Container\V1\SetNetworkPolicyRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

setNodePoolAutoscalingAsync

Parameters
Name Description
request Google\Cloud\Container\V1\SetNodePoolAutoscalingRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

setNodePoolManagementAsync

Parameters
Name Description
request Google\Cloud\Container\V1\SetNodePoolManagementRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

setNodePoolSizeAsync

Parameters
Name Description
request Google\Cloud\Container\V1\SetNodePoolSizeRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

startIPRotationAsync

Parameters
Name Description
request Google\Cloud\Container\V1\StartIPRotationRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

updateClusterAsync

Parameters
Name Description
request Google\Cloud\Container\V1\UpdateClusterRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

updateMasterAsync

Parameters
Name Description
request Google\Cloud\Container\V1\UpdateMasterRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

updateNodePoolAsync

Parameters
Name Description
request Google\Cloud\Container\V1\UpdateNodePoolRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

static::topicName

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

Parameters
Name Description
project string
topic string
Returns
Type Description
string The 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
Name Description
formattedName string

The formatted name string

template string

Optional name of template to match

Returns
Type Description
array An associative array from name component IDs to component values.