Google Cloud Container V1 Client - Class ClusterManagerClient (2.2.1)

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 methodcalls that map to API methods.

Many parameters require resource names to be formatted in a particular way. Toassist with these names, this class includes a format method for each type ofname, and additionally a parseName method to extract the individual identifierscontained within formatted names that are returned by the API.

Namespace

Google \ Cloud \ Container \ V1 \ Client

Methods

__construct

Constructor.

Parameters
NameDescription
optionsarray

Optional. Options for configuring the service API wrapper.

↳ apiEndpointstring

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

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

↳ credentialsConfigarray

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

↳ disableRetriesbool

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

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

↳ transportstring|TransportInterface

The transport used for executing network requests. May be either the stringrest orgrpc. Defaults togrpc if gRPC support is detected on the system.Advanced usage: Additionally, it is possible to pass in an already instantiatedGoogle\ApiCore\Transport\TransportInterface object. Note that when this object is provided, any settings in $transportConfig, and any $apiEndpoint setting, will be ignored.

↳ transportConfigarray

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

↳ clientCertSourcecallable

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

Parameters
NameDescription
requestGoogle\Cloud\Container\V1\CancelOperationRequest

A request to house fields associated with the call.

callOptionsarray

Optional.

↳ retrySettingsRetrySettings|array

Retry settings to use for this call. Can be aGoogle\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation onGoogle\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 ofcompatibility issues.

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

Parameters
NameDescription
requestGoogle\Cloud\Container\V1\CheckAutopilotCompatibilityRequest

A request to house fields associated with the call.

callOptionsarray

Optional.

↳ retrySettingsRetrySettings|array

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

Returns
TypeDescription
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

Parameters
NameDescription
requestGoogle\Cloud\Container\V1\CompleteIPRotationRequest

A request to house fields associated with the call.

callOptionsarray

Optional.

↳ retrySettingsRetrySettings|array

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

Returns
TypeDescription
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 tocomplete.

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

Parameters
NameDescription
requestGoogle\Cloud\Container\V1\CompleteNodePoolUpgradeRequest

A request to house fields associated with the call.

callOptionsarray

Optional.

↳ retrySettingsRetrySettings|array

Retry settings to use for this call. Can be aGoogle\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation onGoogle\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 GoogleCompute Engine instances.

By default, the cluster is created in the project'sdefaultnetwork.

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

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

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

Parameters
NameDescription
requestGoogle\Cloud\Container\V1\CreateClusterRequest

A request to house fields associated with the call.

callOptionsarray

Optional.

↳ retrySettingsRetrySettings|array

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

Returns
TypeDescription
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 isGoogle\Cloud\Container\V1\Client\ClusterManagerClient::createNodePoolAsync() .

Parameters
NameDescription
requestGoogle\Cloud\Container\V1\CreateNodePoolRequest

A request to house fields associated with the call.

callOptionsarray

Optional.

↳ retrySettingsRetrySettings|array

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

Returns
TypeDescription
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 workernodes.

Firewalls and routes that were configured during cluster creationare 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 presentwhen the cluster was initially created.

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

Parameters
NameDescription
requestGoogle\Cloud\Container\V1\DeleteClusterRequest

A request to house fields associated with the call.

callOptionsarray

Optional.

↳ retrySettingsRetrySettings|array

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

Returns
TypeDescription
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 isGoogle\Cloud\Container\V1\Client\ClusterManagerClient::deleteNodePoolAsync() .

Parameters
NameDescription
requestGoogle\Cloud\Container\V1\DeleteNodePoolRequest

A request to house fields associated with the call.

callOptionsarray

Optional.

↳ retrySettingsRetrySettings|array

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

Returns
TypeDescription
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 isGoogle\Cloud\Container\V1\Client\ClusterManagerClient::getClusterAsync() .

Parameters
NameDescription
requestGoogle\Cloud\Container\V1\GetClusterRequest

A request to house fields associated with the call.

callOptionsarray

Optional.

↳ retrySettingsRetrySettings|array

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

Returns
TypeDescription
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 inJSON Web Key format.

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

Parameters
NameDescription
requestGoogle\Cloud\Container\V1\GetJSONWebKeysRequest

A request to house fields associated with the call.

callOptionsarray

Optional.

↳ retrySettingsRetrySettings|array

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

Returns
TypeDescription
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 isGoogle\Cloud\Container\V1\Client\ClusterManagerClient::getNodePoolAsync() .

Parameters
NameDescription
requestGoogle\Cloud\Container\V1\GetNodePoolRequest

A request to house fields associated with the call.

callOptionsarray

Optional.

↳ retrySettingsRetrySettings|array

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

Returns
TypeDescription
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 isGoogle\Cloud\Container\V1\Client\ClusterManagerClient::getOperationAsync() .

Parameters
NameDescription
requestGoogle\Cloud\Container\V1\GetOperationRequest

A request to house fields associated with the call.

callOptionsarray

Optional.

↳ retrySettingsRetrySettings|array

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

Returns
TypeDescription
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 isGoogle\Cloud\Container\V1\Client\ClusterManagerClient::getServerConfigAsync() .

Parameters
NameDescription
requestGoogle\Cloud\Container\V1\GetServerConfigRequest

A request to house fields associated with the call.

callOptionsarray

Optional.

↳ retrySettingsRetrySettings|array

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

Returns
TypeDescription
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 allzones.

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

Parameters
NameDescription
requestGoogle\Cloud\Container\V1\ListClustersRequest

A request to house fields associated with the call.

callOptionsarray

Optional.

↳ retrySettingsRetrySettings|array

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

Returns
TypeDescription
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 isGoogle\Cloud\Container\V1\Client\ClusterManagerClient::listNodePoolsAsync() .

Parameters
NameDescription
requestGoogle\Cloud\Container\V1\ListNodePoolsRequest

A request to house fields associated with the call.

callOptionsarray

Optional.

↳ retrySettingsRetrySettings|array

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

Returns
TypeDescription
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 isGoogle\Cloud\Container\V1\Client\ClusterManagerClient::listOperationsAsync() .

Parameters
NameDescription
requestGoogle\Cloud\Container\V1\ListOperationsRequest

A request to house fields associated with the call.

callOptionsarray

Optional.

↳ retrySettingsRetrySettings|array

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

Returns
TypeDescription
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 isGoogle\Cloud\Container\V1\Client\ClusterManagerClient::listUsableSubnetworksAsync() .

Parameters
NameDescription
requestGoogle\Cloud\Container\V1\ListUsableSubnetworksRequest

A request to house fields associated with the call.

callOptionsarray

Optional.

↳ retrySettingsRetrySettings|array

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

Returns
TypeDescription
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 isGoogle\Cloud\Container\V1\Client\ClusterManagerClient::rollbackNodePoolUpgradeAsync().

Parameters
NameDescription
requestGoogle\Cloud\Container\V1\RollbackNodePoolUpgradeRequest

A request to house fields associated with the call.

callOptionsarray

Optional.

↳ retrySettingsRetrySettings|array

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

Returns
TypeDescription
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 isGoogle\Cloud\Container\V1\Client\ClusterManagerClient::setAddonsConfigAsync() .

Parameters
NameDescription
requestGoogle\Cloud\Container\V1\SetAddonsConfigRequest

A request to house fields associated with the call.

callOptionsarray

Optional.

↳ retrySettingsRetrySettings|array

Retry settings to use for this call. Can be aGoogle\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation onGoogle\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\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

Parameters
NameDescription
requestGoogle\Cloud\Container\V1\SetLabelsRequest

A request to house fields associated with the call.

callOptionsarray

Optional.

↳ retrySettingsRetrySettings|array

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

Returns
TypeDescription
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 isGoogle\Cloud\Container\V1\Client\ClusterManagerClient::setLegacyAbacAsync() .

Parameters
NameDescription
requestGoogle\Cloud\Container\V1\SetLegacyAbacRequest

A request to house fields associated with the call.

callOptionsarray

Optional.

↳ retrySettingsRetrySettings|array

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

Returns
TypeDescription
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. Useprojects.locations.clusters.updateinstead.

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

Parameters
NameDescription
requestGoogle\Cloud\Container\V1\SetLocationsRequest

A request to house fields associated with the call.

callOptionsarray

Optional.

↳ retrySettingsRetrySettings|array

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

Returns
TypeDescription
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 isGoogle\Cloud\Container\V1\Client\ClusterManagerClient::setLoggingServiceAsync() .

Parameters
NameDescription
requestGoogle\Cloud\Container\V1\SetLoggingServiceRequest

A request to house fields associated with the call.

callOptionsarray

Optional.

↳ retrySettingsRetrySettings|array

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

Returns
TypeDescription
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 isGoogle\Cloud\Container\V1\Client\ClusterManagerClient::setMaintenancePolicyAsync() .

Parameters
NameDescription
requestGoogle\Cloud\Container\V1\SetMaintenancePolicyRequest

A request to house fields associated with the call.

callOptionsarray

Optional.

↳ retrySettingsRetrySettings|array

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

Returns
TypeDescription
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 passwordor a specific cluster, either via password generation or explicitly settingthe password.

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

Parameters
NameDescription
requestGoogle\Cloud\Container\V1\SetMasterAuthRequest

A request to house fields associated with the call.

callOptionsarray

Optional.

↳ retrySettingsRetrySettings|array

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

Returns
TypeDescription
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 isGoogle\Cloud\Container\V1\Client\ClusterManagerClient::setMonitoringServiceAsync() .

Parameters
NameDescription
requestGoogle\Cloud\Container\V1\SetMonitoringServiceRequest

A request to house fields associated with the call.

callOptionsarray

Optional.

↳ retrySettingsRetrySettings|array

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

Returns
TypeDescription
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 isGoogle\Cloud\Container\V1\Client\ClusterManagerClient::setNetworkPolicyAsync() .

Parameters
NameDescription
requestGoogle\Cloud\Container\V1\SetNetworkPolicyRequest

A request to house fields associated with the call.

callOptionsarray

Optional.

↳ retrySettingsRetrySettings|array

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

Returns
TypeDescription
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 isGoogle\Cloud\Container\V1\Client\ClusterManagerClient::setNodePoolAutoscalingAsync().

Parameters
NameDescription
requestGoogle\Cloud\Container\V1\SetNodePoolAutoscalingRequest

A request to house fields associated with the call.

callOptionsarray

Optional.

↳ retrySettingsRetrySettings|array

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

Returns
TypeDescription
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 isGoogle\Cloud\Container\V1\Client\ClusterManagerClient::setNodePoolManagementAsync() .

Parameters
NameDescription
requestGoogle\Cloud\Container\V1\SetNodePoolManagementRequest

A request to house fields associated with the call.

callOptionsarray

Optional.

↳ retrySettingsRetrySettings|array

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

Returns
TypeDescription
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 allreplicas, including future replicas created by modifyingNodePool.locations.

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

Parameters
NameDescription
requestGoogle\Cloud\Container\V1\SetNodePoolSizeRequest

A request to house fields associated with the call.

callOptionsarray

Optional.

↳ retrySettingsRetrySettings|array

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

Returns
TypeDescription
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
NameDescription
requestGoogle\Cloud\Container\V1\StartIPRotationRequest

A request to house fields associated with the call.

callOptionsarray

Optional.

↳ retrySettingsRetrySettings|array

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

Returns
TypeDescription
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 isGoogle\Cloud\Container\V1\Client\ClusterManagerClient::updateClusterAsync() .

Parameters
NameDescription
requestGoogle\Cloud\Container\V1\UpdateClusterRequest

A request to house fields associated with the call.

callOptionsarray

Optional.

↳ retrySettingsRetrySettings|array

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

Returns
TypeDescription
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 isGoogle\Cloud\Container\V1\Client\ClusterManagerClient::updateMasterAsync() .

Parameters
NameDescription
requestGoogle\Cloud\Container\V1\UpdateMasterRequest

A request to house fields associated with the call.

callOptionsarray

Optional.

↳ retrySettingsRetrySettings|array

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

Returns
TypeDescription
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 isGoogle\Cloud\Container\V1\Client\ClusterManagerClient::updateNodePoolAsync() .

Parameters
NameDescription
requestGoogle\Cloud\Container\V1\UpdateNodePoolRequest

A request to house fields associated with the call.

callOptionsarray

Optional.

↳ retrySettingsRetrySettings|array

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

Returns
TypeDescription
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
NameDescription
requestGoogle\Cloud\Container\V1\CancelOperationRequest
optionalArgsarray
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface<void>

checkAutopilotCompatibilityAsync

Parameters
NameDescription
requestGoogle\Cloud\Container\V1\CheckAutopilotCompatibilityRequest
optionalArgsarray
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Container\V1\CheckAutopilotCompatibilityResponse>

completeIPRotationAsync

Parameters
NameDescription
requestGoogle\Cloud\Container\V1\CompleteIPRotationRequest
optionalArgsarray
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Container\V1\Operation>

completeNodePoolUpgradeAsync

Parameters
NameDescription
requestGoogle\Cloud\Container\V1\CompleteNodePoolUpgradeRequest
optionalArgsarray
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface<void>

createClusterAsync

Parameters
NameDescription
requestGoogle\Cloud\Container\V1\CreateClusterRequest
optionalArgsarray
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Container\V1\Operation>

createNodePoolAsync

Parameters
NameDescription
requestGoogle\Cloud\Container\V1\CreateNodePoolRequest
optionalArgsarray
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Container\V1\Operation>

deleteClusterAsync

Parameters
NameDescription
requestGoogle\Cloud\Container\V1\DeleteClusterRequest
optionalArgsarray
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Container\V1\Operation>

deleteNodePoolAsync

Parameters
NameDescription
requestGoogle\Cloud\Container\V1\DeleteNodePoolRequest
optionalArgsarray
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Container\V1\Operation>

getClusterAsync

Parameters
NameDescription
requestGoogle\Cloud\Container\V1\GetClusterRequest
optionalArgsarray
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Container\V1\Cluster>

getJSONWebKeysAsync

Parameters
NameDescription
requestGoogle\Cloud\Container\V1\GetJSONWebKeysRequest
optionalArgsarray
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Container\V1\GetJSONWebKeysResponse>

getNodePoolAsync

Parameters
NameDescription
requestGoogle\Cloud\Container\V1\GetNodePoolRequest
optionalArgsarray
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Container\V1\NodePool>

getOperationAsync

Parameters
NameDescription
requestGoogle\Cloud\Container\V1\GetOperationRequest
optionalArgsarray
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Container\V1\Operation>

getServerConfigAsync

Parameters
NameDescription
requestGoogle\Cloud\Container\V1\GetServerConfigRequest
optionalArgsarray
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Container\V1\ServerConfig>

listClustersAsync

Parameters
NameDescription
requestGoogle\Cloud\Container\V1\ListClustersRequest
optionalArgsarray
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Container\V1\ListClustersResponse>

listNodePoolsAsync

Parameters
NameDescription
requestGoogle\Cloud\Container\V1\ListNodePoolsRequest
optionalArgsarray
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Container\V1\ListNodePoolsResponse>

listOperationsAsync

Parameters
NameDescription
requestGoogle\Cloud\Container\V1\ListOperationsRequest
optionalArgsarray
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Container\V1\ListOperationsResponse>

listUsableSubnetworksAsync

Parameters
NameDescription
requestGoogle\Cloud\Container\V1\ListUsableSubnetworksRequest
optionalArgsarray
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\PagedListResponse>

rollbackNodePoolUpgradeAsync

Parameters
NameDescription
requestGoogle\Cloud\Container\V1\RollbackNodePoolUpgradeRequest
optionalArgsarray
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Container\V1\Operation>

setAddonsConfigAsync

Parameters
NameDescription
requestGoogle\Cloud\Container\V1\SetAddonsConfigRequest
optionalArgsarray
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Container\V1\Operation>

setLabelsAsync

Parameters
NameDescription
requestGoogle\Cloud\Container\V1\SetLabelsRequest
optionalArgsarray
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Container\V1\Operation>

setLegacyAbacAsync

Parameters
NameDescription
requestGoogle\Cloud\Container\V1\SetLegacyAbacRequest
optionalArgsarray
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Container\V1\Operation>

setLocationsAsync

Parameters
NameDescription
requestGoogle\Cloud\Container\V1\SetLocationsRequest
optionalArgsarray
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Container\V1\Operation>

setLoggingServiceAsync

Parameters
NameDescription
requestGoogle\Cloud\Container\V1\SetLoggingServiceRequest
optionalArgsarray
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Container\V1\Operation>

setMaintenancePolicyAsync

Parameters
NameDescription
requestGoogle\Cloud\Container\V1\SetMaintenancePolicyRequest
optionalArgsarray
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Container\V1\Operation>

setMasterAuthAsync

Parameters
NameDescription
requestGoogle\Cloud\Container\V1\SetMasterAuthRequest
optionalArgsarray
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Container\V1\Operation>

setMonitoringServiceAsync

Parameters
NameDescription
requestGoogle\Cloud\Container\V1\SetMonitoringServiceRequest
optionalArgsarray
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Container\V1\Operation>

setNetworkPolicyAsync

Parameters
NameDescription
requestGoogle\Cloud\Container\V1\SetNetworkPolicyRequest
optionalArgsarray
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Container\V1\Operation>

setNodePoolAutoscalingAsync

Parameters
NameDescription
requestGoogle\Cloud\Container\V1\SetNodePoolAutoscalingRequest
optionalArgsarray
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Container\V1\Operation>

setNodePoolManagementAsync

Parameters
NameDescription
requestGoogle\Cloud\Container\V1\SetNodePoolManagementRequest
optionalArgsarray
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Container\V1\Operation>

setNodePoolSizeAsync

Parameters
NameDescription
requestGoogle\Cloud\Container\V1\SetNodePoolSizeRequest
optionalArgsarray
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Container\V1\Operation>

startIPRotationAsync

Parameters
NameDescription
requestGoogle\Cloud\Container\V1\StartIPRotationRequest
optionalArgsarray
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Container\V1\Operation>

updateClusterAsync

Parameters
NameDescription
requestGoogle\Cloud\Container\V1\UpdateClusterRequest
optionalArgsarray
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Container\V1\Operation>

updateMasterAsync

Parameters
NameDescription
requestGoogle\Cloud\Container\V1\UpdateMasterRequest
optionalArgsarray
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Container\V1\Operation>

updateNodePoolAsync

Parameters
NameDescription
requestGoogle\Cloud\Container\V1\UpdateNodePoolRequest
optionalArgsarray
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Container\V1\Operation>

static::caPoolName

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

Parameters
NameDescription
projectstring
locationstring
caPoolstring
Returns
TypeDescription
stringThe formatted ca_pool resource.

static::cryptoKeyVersionName

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

Parameters
NameDescription
projectstring
locationstring
keyRingstring
cryptoKeystring
cryptoKeyVersionstring
Returns
TypeDescription
stringThe formatted crypto_key_version resource.

static::topicName

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

Parameters
NameDescription
projectstring
topicstring
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

  • caPool: projects/{project}/locations/{location}/caPools/{ca_pool}
  • cryptoKeyVersion: projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/cryptoKeyVersions/{crypto_key_version}
  • 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 isprovided, or if the $template argument does not match one of the templateslisted, then parseName will check each of the supported templates, and returnthe first match.

Parameters
NameDescription
formattedNamestring

The formatted name string

templatestring

Optional name of template to match

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

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2026-01-24 UTC.