Reference documentation and code samples for the Google Anthos Multi Cloud V1 Client class AzureClustersClient.
Service Description: The AzureClusters API provides a single centrally managed service to create and manage Anthos clusters that run on Azure infrastructure.
This class provides the ability to make remote calls to the backing service through method calls that map to API methods. Sample code to get started:
$azureClustersClient = new AzureClustersClient();
try {
$formattedParent = $azureClustersClient->locationName('[PROJECT]', '[LOCATION]');
$azureClient = new AzureClient();
$azureClientId = 'azure_client_id';
$operationResponse = $azureClustersClient->createAzureClient($formattedParent, $azureClient, $azureClientId);
$operationResponse->pollUntilComplete();
if ($operationResponse->operationSucceeded()) {
$result = $operationResponse->getResult();
// doSomethingWith($result)
} else {
$error = $operationResponse->getError();
// handleError($error)
}
// Alternatively:
// start the operation, keep the operation name, and resume later
$operationResponse = $azureClustersClient->createAzureClient($formattedParent, $azureClient, $azureClientId);
$operationName = $operationResponse->getName();
// ... do other work
$newOperationResponse = $azureClustersClient->resumeOperation($operationName, 'createAzureClient');
while (!$newOperationResponse->isDone()) {
// ... do other work
$newOperationResponse->reload();
}
if ($newOperationResponse->operationSucceeded()) {
$result = $newOperationResponse->getResult();
// doSomethingWith($result)
} else {
$error = $newOperationResponse->getError();
// handleError($error)
}
} finally {
$azureClustersClient->close();
}
Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parseName method to extract the individual identifiers contained within formatted names that are returned by the API.
Methods
azureClientName
Formats a string containing the fully-qualified path to represent a azure_client resource.
project
string
location
string
azureClient
string
string
azureClusterName
Formats a string containing the fully-qualified path to represent a azure_cluster resource.
project
string
location
string
azureCluster
string
string
azureNodePoolName
Formats a string containing the fully-qualified path to represent a azure_node_pool resource.
project
string
location
string
azureCluster
string
azureNodePool
string
string
azureServerConfigName
Formats a string containing the fully-qualified path to represent a azure_server_config resource.
project
string
location
string
string
locationName
Formats a string containing the fully-qualified path to represent a location resource.
project
string
location
string
string
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
- azureClient: projects/{project}/locations/{location}/azureClients/{azure_client}
- azureCluster: projects/{project}/locations/{location}/azureClusters/{azure_cluster}
- azureNodePool: projects/{project}/locations/{location}/azureClusters/{azure_cluster}/azureNodePools/{azure_node_pool}
- azureServerConfig: projects/{project}/locations/{location}/azureServerConfig
- location: projects/{project}/locations/{location}
The optional $template argument can be supplied to specify a particular pattern, and must match one of the templates listed above. If no $template argument is provided, or if the $template argument does not match one of the templates listed, then parseName will check each of the supported templates, and return the first match.
formattedName
string
The formatted name string
template
string
Optional name of template to match
array
getOperationsClient
Return an OperationsClient object with the same endpoint as $this.
resumeOperation
Resume an existing long running operation that was previously started by a long running API method. If $methodName is not provided, or does not match a long running API method, then the operation can still be resumed, but the OperationResponse object will not deserialize the final response.
operationName
string
The name of the long running operation
methodName
string
The name of the method used to start the operation
__construct
Constructor.
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.
createAzureClient
Creates a new AzureClient resource on a given Google Cloud project and region.
AzureClient
resources hold client authentication
information needed by the Anthos Multicloud API to manage Azure resources
on your Azure subscription on your behalf.
If successful, the response contains a newly created Operation resource that can be described to track the status of the operation.
parent
string
Required. The parent location where this AzureClient resource will be created.
Location names are formatted as projects/<project-id>/locations/<region>
.
See Resource Names for more details on Google Cloud resource names.
azureClient
azureClientId
string
Required. A client provided ID the resource. Must be unique within the parent resource.
The provided ID will be part of the AzureClient
resource name
formatted as projects/<project-id>/locations/<region>/azureClients/<client-id>
.
Valid characters are /[a-z][0-9]-/
. Cannot be longer than 63 characters.
optionalArgs
array
Optional.
↳ validateOnly
bool
If set, only validate the request, but do not actually create the client.
↳ 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.
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\GkeMultiCloud\V1\AzureClient;
use Google\Cloud\GkeMultiCloud\V1\Client\AzureClustersClient;
use Google\Cloud\GkeMultiCloud\V1\CreateAzureClientRequest;
use Google\Rpc\Status;
/**
* @param string $formattedParent The parent location where this
* [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] resource will be
* created.
*
* Location names are formatted as `projects/<project-id>/locations/<region>`.
*
* See [Resource Names](https://cloud.google.com/apis/design/resource_names)
* for more details on Google Cloud resource names. Please see
* {@see AzureClustersClient::locationName()} for help formatting this field.
* @param string $azureClientTenantId The Azure Active Directory Tenant ID.
* @param string $azureClientApplicationId The Azure Active Directory Application ID.
* @param string $azureClientId A client provided ID the resource. Must be unique within the
* parent resource.
*
* The provided ID will be part of the
* [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] resource name
* formatted as
* `projects/<project-id>/locations/<region>/azureClients/<client-id>`.
*
* Valid characters are `/[a-z][0-9]-/`. Cannot be longer than 63 characters.
*/
function create_azure_client_sample(
string $formattedParent,
string $azureClientTenantId,
string $azureClientApplicationId,
string $azureClientId
): void {
// Create a client.
$azureClustersClient = new AzureClustersClient();
// Prepare the request message.
$azureClient = (new AzureClient())
->setTenantId($azureClientTenantId)
->setApplicationId($azureClientApplicationId);
$request = (new CreateAzureClientRequest())
->setParent($formattedParent)
->setAzureClient($azureClient)
->setAzureClientId($azureClientId);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $azureClustersClient->createAzureClient($request);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
/** @var AzureClient $result */
$result = $response->getResult();
printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
} else {
/** @var Status $error */
$error = $response->getError();
printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
}
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedParent = AzureClustersClient::locationName('[PROJECT]', '[LOCATION]');
$azureClientTenantId = '[TENANT_ID]';
$azureClientApplicationId = '[APPLICATION_ID]';
$azureClientId = '[AZURE_CLIENT_ID]';
create_azure_client_sample(
$formattedParent,
$azureClientTenantId,
$azureClientApplicationId,
$azureClientId
);
}
createAzureCluster
Creates a new AzureCluster resource on a given Google Cloud Platform project and region.
If successful, the response contains a newly created Operation resource that can be described to track the status of the operation.
parent
string
Required. The parent location where this AzureCluster resource will be created.
Location names are formatted as projects/<project-id>/locations/<region>
.
See Resource Names for more details on Google Cloud resource names.
azureCluster
Google\Cloud\GkeMultiCloud\V1\AzureCluster
Required. The specification of the AzureCluster to create.
azureClusterId
string
Required. A client provided ID the resource. Must be unique within the parent resource.
The provided ID will be part of the AzureCluster
resource name
formatted as projects/<project-id>/locations/<region>/azureClusters/<cluster-id>
.
Valid characters are /[a-z][0-9]-/
. Cannot be longer than 63 characters.
optionalArgs
array
Optional.
↳ validateOnly
bool
If set, only validate the request, but do not actually create the cluster.
↳ retrySettings
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\GkeMultiCloud\V1\AzureAuthorization;
use Google\Cloud\GkeMultiCloud\V1\AzureCluster;
use Google\Cloud\GkeMultiCloud\V1\AzureClusterNetworking;
use Google\Cloud\GkeMultiCloud\V1\AzureClusterUser;
use Google\Cloud\GkeMultiCloud\V1\AzureControlPlane;
use Google\Cloud\GkeMultiCloud\V1\AzureSshConfig;
use Google\Cloud\GkeMultiCloud\V1\Client\AzureClustersClient;
use Google\Cloud\GkeMultiCloud\V1\CreateAzureClusterRequest;
use Google\Cloud\GkeMultiCloud\V1\Fleet;
use Google\Rpc\Status;
/**
* @param string $formattedParent The parent location where this
* [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] resource will be
* created.
*
* Location names are formatted as `projects/<project-id>/locations/<region>`.
*
* See [Resource Names](https://cloud.google.com/apis/design/resource_names)
* for more details on Google Cloud resource names. Please see
* {@see AzureClustersClient::locationName()} for help formatting this field.
* @param string $azureClusterAzureRegion The Azure region where the cluster runs.
*
* Each Google Cloud region supports a subset of nearby Azure regions.
* You can call
* [GetAzureServerConfig][google.cloud.gkemulticloud.v1.AzureClusters.GetAzureServerConfig]
* to list all supported Azure regions within a given Google Cloud region.
* @param string $azureClusterResourceGroupId The ARM ID of the resource group where the cluster resources are
* deployed. For example:
* `/subscriptions/<subscription-id>/resourceGroups/<resource-group-name>`
* @param string $azureClusterNetworkingVirtualNetworkId The Azure Resource Manager (ARM) ID of the VNet associated with
* your cluster.
*
* All components in the cluster (i.e. control plane and node pools) run on a
* single VNet.
*
* Example:
* `/subscriptions/<subscription-id>/resourceGroups/<resource-group-id>/providers/Microsoft.Network/virtualNetworks/<vnet-id>`
*
* This field cannot be changed after creation.
* @param string $azureClusterNetworkingPodAddressCidrBlocksElement The IP address range of the pods in this cluster, in CIDR
* notation (e.g. `10.96.0.0/14`).
*
* All pods in the cluster get assigned a unique IPv4 address from these
* ranges. Only a single range is supported.
*
* This field cannot be changed after creation.
* @param string $azureClusterNetworkingServiceAddressCidrBlocksElement The IP address range for services in this cluster, in CIDR
* notation (e.g. `10.96.0.0/14`).
*
* All services in the cluster get assigned a unique IPv4 address from these
* ranges. Only a single range is supported.
*
* This field cannot be changed after creating a cluster.
* @param string $azureClusterControlPlaneVersion The Kubernetes version to run on control plane replicas
* (e.g. `1.19.10-gke.1000`).
*
* You can list all supported versions on a given Google Cloud region by
* calling
* [GetAzureServerConfig][google.cloud.gkemulticloud.v1.AzureClusters.GetAzureServerConfig].
* @param string $azureClusterControlPlaneSshConfigAuthorizedKey The SSH public key data for VMs managed by Anthos. This accepts
* the authorized_keys file format used in OpenSSH according to the sshd(8)
* manual page.
* @param string $azureClusterAuthorizationAdminUsersUsername The name of the user, e.g. `my-gcp-id@gmail.com`.
* @param string $azureClusterFleetProject The name of the Fleet host project where this cluster will be
* registered.
*
* Project names are formatted as
* `projects/<project-number>`.
* @param string $azureClusterId A client provided ID the resource. Must be unique within the
* parent resource.
*
* The provided ID will be part of the
* [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] resource name
* formatted as
* `projects/<project-id>/locations/<region>/azureClusters/<cluster-id>`.
*
* Valid characters are `/[a-z][0-9]-/`. Cannot be longer than 63 characters.
*/
function create_azure_cluster_sample(
string $formattedParent,
string $azureClusterAzureRegion,
string $azureClusterResourceGroupId,
string $azureClusterNetworkingVirtualNetworkId,
string $azureClusterNetworkingPodAddressCidrBlocksElement,
string $azureClusterNetworkingServiceAddressCidrBlocksElement,
string $azureClusterControlPlaneVersion,
string $azureClusterControlPlaneSshConfigAuthorizedKey,
string $azureClusterAuthorizationAdminUsersUsername,
string $azureClusterFleetProject,
string $azureClusterId
): void {
// Create a client.
$azureClustersClient = new AzureClustersClient();
// Prepare the request message.
$azureClusterNetworkingPodAddressCidrBlocks = [
$azureClusterNetworkingPodAddressCidrBlocksElement,
];
$azureClusterNetworkingServiceAddressCidrBlocks = [
$azureClusterNetworkingServiceAddressCidrBlocksElement,
];
$azureClusterNetworking = (new AzureClusterNetworking())
->setVirtualNetworkId($azureClusterNetworkingVirtualNetworkId)
->setPodAddressCidrBlocks($azureClusterNetworkingPodAddressCidrBlocks)
->setServiceAddressCidrBlocks($azureClusterNetworkingServiceAddressCidrBlocks);
$azureClusterControlPlaneSshConfig = (new AzureSshConfig())
->setAuthorizedKey($azureClusterControlPlaneSshConfigAuthorizedKey);
$azureClusterControlPlane = (new AzureControlPlane())
->setVersion($azureClusterControlPlaneVersion)
->setSshConfig($azureClusterControlPlaneSshConfig);
$azureClusterUser = (new AzureClusterUser())
->setUsername($azureClusterAuthorizationAdminUsersUsername);
$azureClusterAuthorizationAdminUsers = [$azureClusterUser,];
$azureClusterAuthorization = (new AzureAuthorization())
->setAdminUsers($azureClusterAuthorizationAdminUsers);
$azureClusterFleet = (new Fleet())
->setProject($azureClusterFleetProject);
$azureCluster = (new AzureCluster())
->setAzureRegion($azureClusterAzureRegion)
->setResourceGroupId($azureClusterResourceGroupId)
->setNetworking($azureClusterNetworking)
->setControlPlane($azureClusterControlPlane)
->setAuthorization($azureClusterAuthorization)
->setFleet($azureClusterFleet);
$request = (new CreateAzureClusterRequest())
->setParent($formattedParent)
->setAzureCluster($azureCluster)
->setAzureClusterId($azureClusterId);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $azureClustersClient->createAzureCluster($request);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
/** @var AzureCluster $result */
$result = $response->getResult();
printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
} else {
/** @var Status $error */
$error = $response->getError();
printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
}
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedParent = AzureClustersClient::locationName('[PROJECT]', '[LOCATION]');
$azureClusterAzureRegion = '[AZURE_REGION]';
$azureClusterResourceGroupId = '[RESOURCE_GROUP_ID]';
$azureClusterNetworkingVirtualNetworkId = '[VIRTUAL_NETWORK_ID]';
$azureClusterNetworkingPodAddressCidrBlocksElement = '[POD_ADDRESS_CIDR_BLOCKS]';
$azureClusterNetworkingServiceAddressCidrBlocksElement = '[SERVICE_ADDRESS_CIDR_BLOCKS]';
$azureClusterControlPlaneVersion = '[VERSION]';
$azureClusterControlPlaneSshConfigAuthorizedKey = '[AUTHORIZED_KEY]';
$azureClusterAuthorizationAdminUsersUsername = '[USERNAME]';
$azureClusterFleetProject = '[PROJECT]';
$azureClusterId = '[AZURE_CLUSTER_ID]';
create_azure_cluster_sample(
$formattedParent,
$azureClusterAzureRegion,
$azureClusterResourceGroupId,
$azureClusterNetworkingVirtualNetworkId,
$azureClusterNetworkingPodAddressCidrBlocksElement,
$azureClusterNetworkingServiceAddressCidrBlocksElement,
$azureClusterControlPlaneVersion,
$azureClusterControlPlaneSshConfigAuthorizedKey,
$azureClusterAuthorizationAdminUsersUsername,
$azureClusterFleetProject,
$azureClusterId
);
}
createAzureNodePool
Creates a new AzureNodePool , attached to a given AzureCluster .
If successful, the response contains a newly created Operation resource that can be described to track the status of the operation.
parent
string
Required. The AzureCluster resource where this node pool will be created.
Location names are formatted as projects/<project-id>/locations/<region>
.
See Resource Names for more details on Google Cloud resource names.
azureNodePool
Google\Cloud\GkeMultiCloud\V1\AzureNodePool
Required. The specification of the AzureNodePool to create.
azureNodePoolId
string
Required. A client provided ID the resource. Must be unique within the parent resource.
The provided ID will be part of the AzureNodePool
resource name
formatted as projects/<project-id>/locations/<region>/azureClusters/<cluster-id>/azureNodePools/<node-pool-id>
.
Valid characters are /[a-z][0-9]-/
. Cannot be longer than 63 characters.
optionalArgs
array
Optional.
↳ validateOnly
bool
If set, only validate the request, but do not actually create the node pool.
↳ retrySettings
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\GkeMultiCloud\V1\AzureNodeConfig;
use Google\Cloud\GkeMultiCloud\V1\AzureNodePool;
use Google\Cloud\GkeMultiCloud\V1\AzureNodePoolAutoscaling;
use Google\Cloud\GkeMultiCloud\V1\AzureSshConfig;
use Google\Cloud\GkeMultiCloud\V1\Client\AzureClustersClient;
use Google\Cloud\GkeMultiCloud\V1\CreateAzureNodePoolRequest;
use Google\Cloud\GkeMultiCloud\V1\MaxPodsConstraint;
use Google\Rpc\Status;
/**
* @param string $formattedParent The [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster]
* resource where this node pool will be created.
*
* Location names are formatted as `projects/<project-id>/locations/<region>`.
*
* See [Resource Names](https://cloud.google.com/apis/design/resource_names)
* for more details on Google Cloud resource names. Please see
* {@see AzureClustersClient::azureClusterName()} for help formatting this field.
* @param string $azureNodePoolVersion The Kubernetes version (e.g. `1.19.10-gke.1000`) running on this
* node pool.
* @param string $azureNodePoolConfigSshConfigAuthorizedKey The SSH public key data for VMs managed by Anthos. This accepts
* the authorized_keys file format used in OpenSSH according to the sshd(8)
* manual page.
* @param string $azureNodePoolSubnetId The ARM ID of the subnet where the node pool VMs run. Make sure
* it's a subnet under the virtual network in the cluster configuration.
* @param int $azureNodePoolAutoscalingMinNodeCount Minimum number of nodes in the node pool. Must be greater than or
* equal to 1 and less than or equal to max_node_count.
* @param int $azureNodePoolAutoscalingMaxNodeCount Maximum number of nodes in the node pool. Must be greater than or
* equal to min_node_count and less than or equal to 50.
* @param int $azureNodePoolMaxPodsConstraintMaxPodsPerNode The maximum number of pods to schedule on a single node.
* @param string $azureNodePoolId A client provided ID the resource. Must be unique within the
* parent resource.
*
* The provided ID will be part of the
* [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool] resource name
* formatted as
* `projects/<project-id>/locations/<region>/azureClusters/<cluster-id>/azureNodePools/<node-pool-id>`.
*
* Valid characters are `/[a-z][0-9]-/`. Cannot be longer than 63 characters.
*/
function create_azure_node_pool_sample(
string $formattedParent,
string $azureNodePoolVersion,
string $azureNodePoolConfigSshConfigAuthorizedKey,
string $azureNodePoolSubnetId,
int $azureNodePoolAutoscalingMinNodeCount,
int $azureNodePoolAutoscalingMaxNodeCount,
int $azureNodePoolMaxPodsConstraintMaxPodsPerNode,
string $azureNodePoolId
): void {
// Create a client.
$azureClustersClient = new AzureClustersClient();
// Prepare the request message.
$azureNodePoolConfigSshConfig = (new AzureSshConfig())
->setAuthorizedKey($azureNodePoolConfigSshConfigAuthorizedKey);
$azureNodePoolConfig = (new AzureNodeConfig())
->setSshConfig($azureNodePoolConfigSshConfig);
$azureNodePoolAutoscaling = (new AzureNodePoolAutoscaling())
->setMinNodeCount($azureNodePoolAutoscalingMinNodeCount)
->setMaxNodeCount($azureNodePoolAutoscalingMaxNodeCount);
$azureNodePoolMaxPodsConstraint = (new MaxPodsConstraint())
->setMaxPodsPerNode($azureNodePoolMaxPodsConstraintMaxPodsPerNode);
$azureNodePool = (new AzureNodePool())
->setVersion($azureNodePoolVersion)
->setConfig($azureNodePoolConfig)
->setSubnetId($azureNodePoolSubnetId)
->setAutoscaling($azureNodePoolAutoscaling)
->setMaxPodsConstraint($azureNodePoolMaxPodsConstraint);
$request = (new CreateAzureNodePoolRequest())
->setParent($formattedParent)
->setAzureNodePool($azureNodePool)
->setAzureNodePoolId($azureNodePoolId);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $azureClustersClient->createAzureNodePool($request);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
/** @var AzureNodePool $result */
$result = $response->getResult();
printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
} else {
/** @var Status $error */
$error = $response->getError();
printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
}
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedParent = AzureClustersClient::azureClusterName(
'[PROJECT]',
'[LOCATION]',
'[AZURE_CLUSTER]'
);
$azureNodePoolVersion = '[VERSION]';
$azureNodePoolConfigSshConfigAuthorizedKey = '[AUTHORIZED_KEY]';
$azureNodePoolSubnetId = '[SUBNET_ID]';
$azureNodePoolAutoscalingMinNodeCount = 0;
$azureNodePoolAutoscalingMaxNodeCount = 0;
$azureNodePoolMaxPodsConstraintMaxPodsPerNode = 0;
$azureNodePoolId = '[AZURE_NODE_POOL_ID]';
create_azure_node_pool_sample(
$formattedParent,
$azureNodePoolVersion,
$azureNodePoolConfigSshConfigAuthorizedKey,
$azureNodePoolSubnetId,
$azureNodePoolAutoscalingMinNodeCount,
$azureNodePoolAutoscalingMaxNodeCount,
$azureNodePoolMaxPodsConstraintMaxPodsPerNode,
$azureNodePoolId
);
}
deleteAzureClient
Deletes a specific AzureClient resource.
If the client is used by one or more clusters, deletion will
fail and a FAILED_PRECONDITION
error will be returned.
If successful, the response contains a newly created Operation resource that can be described to track the status of the operation.
name
string
Required. The resource name the AzureClient to delete.
AzureClient
names are
formatted as projects/<project-id>/locations/<region>/azureClients/<client-id>
.
See Resource Names for more details on Google Cloud resource names.
optionalArgs
array
Optional.
↳ allowMissing
bool
If set to true, and the AzureClient resource is not found, the request will succeed but no action will be taken on the server and a completed Operation will be returned. Useful for idempotent deletion.
↳ validateOnly
bool
If set, only validate the request, but do not actually delete the resource.
↳ 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.
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\GkeMultiCloud\V1\Client\AzureClustersClient;
use Google\Cloud\GkeMultiCloud\V1\DeleteAzureClientRequest;
use Google\Rpc\Status;
/**
* @param string $formattedName The resource name the
* [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] to delete.
*
* [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] names are
* formatted as
* `projects/<project-id>/locations/<region>/azureClients/<client-id>`.
*
* See [Resource Names](https://cloud.google.com/apis/design/resource_names)
* for more details on Google Cloud resource names. Please see
* {@see AzureClustersClient::azureClientName()} for help formatting this field.
*/
function delete_azure_client_sample(string $formattedName): void
{
// Create a client.
$azureClustersClient = new AzureClustersClient();
// Prepare the request message.
$request = (new DeleteAzureClientRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $azureClustersClient->deleteAzureClient($request);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
printf('Operation completed successfully.' . PHP_EOL);
} else {
/** @var Status $error */
$error = $response->getError();
printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
}
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedName = AzureClustersClient::azureClientName('[PROJECT]', '[LOCATION]', '[AZURE_CLIENT]');
delete_azure_client_sample($formattedName);
}
deleteAzureCluster
Deletes a specific AzureCluster resource.
Fails if the cluster has one or more associated AzureNodePool resources.
If successful, the response contains a newly created Operation resource that can be described to track the status of the operation.
name
string
Required. The resource name the AzureCluster to delete.
AzureCluster
names are formatted as projects/<project-id>/locations/<region>/azureClusters/<cluster-id>
.
See Resource Names for more details on Google Cloud Platform resource names.
optionalArgs
array
Optional.
↳ allowMissing
bool
If set to true, and the AzureCluster resource is not found, the request will succeed but no action will be taken on the server and a completed Operation will be returned. Useful for idempotent deletion.
↳ validateOnly
bool
If set, only validate the request, but do not actually delete the resource.
↳ etag
string
The current etag of the AzureCluster . Allows clients to perform deletions through optimistic concurrency control. If the provided etag does not match the current etag of the cluster, the request will fail and an ABORTED error will be returned.
↳ retrySettings
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\GkeMultiCloud\V1\Client\AzureClustersClient;
use Google\Cloud\GkeMultiCloud\V1\DeleteAzureClusterRequest;
use Google\Rpc\Status;
/**
* @param string $formattedName The resource name the
* [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] to delete.
*
* `AzureCluster` names are formatted as
* `projects/<project-id>/locations/<region>/azureClusters/<cluster-id>`.
*
* See [Resource Names](https://cloud.google.com/apis/design/resource_names)
* for more details on Google Cloud Platform resource names. Please see
* {@see AzureClustersClient::azureClusterName()} for help formatting this field.
*/
function delete_azure_cluster_sample(string $formattedName): void
{
// Create a client.
$azureClustersClient = new AzureClustersClient();
// Prepare the request message.
$request = (new DeleteAzureClusterRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $azureClustersClient->deleteAzureCluster($request);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
printf('Operation completed successfully.' . PHP_EOL);
} else {
/** @var Status $error */
$error = $response->getError();
printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
}
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedName = AzureClustersClient::azureClusterName(
'[PROJECT]',
'[LOCATION]',
'[AZURE_CLUSTER]'
);
delete_azure_cluster_sample($formattedName);
}
deleteAzureNodePool
Deletes a specific AzureNodePool resource.
If successful, the response contains a newly created Operation resource that can be described to track the status of the operation.
name
string
Required. The resource name the AzureNodePool to delete.
AzureNodePool
names are formatted as projects/<project-id>/locations/<region>/azureClusters/<cluster-id>/azureNodePools/<node-pool-id>
.
See Resource Names for more details on Google Cloud resource names.
optionalArgs
array
Optional.
↳ validateOnly
bool
If set, only validate the request, but do not actually delete the node pool.
↳ allowMissing
bool
If set to true, and the AzureNodePool resource is not found, the request will succeed but no action will be taken on the server and a completed Operation will be returned. Useful for idempotent deletion.
↳ etag
string
The current ETag of the AzureNodePool . Allows clients to perform deletions through optimistic concurrency control. If the provided ETag does not match the current etag of the node pool, the request will fail and an ABORTED error will be returned.
↳ retrySettings
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\GkeMultiCloud\V1\Client\AzureClustersClient;
use Google\Cloud\GkeMultiCloud\V1\DeleteAzureNodePoolRequest;
use Google\Rpc\Status;
/**
* @param string $formattedName The resource name the
* [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool] to delete.
*
* `AzureNodePool` names are formatted as
* `projects/<project-id>/locations/<region>/azureClusters/<cluster-id>/azureNodePools/<node-pool-id>`.
*
* See [Resource Names](https://cloud.google.com/apis/design/resource_names)
* for more details on Google Cloud resource names. Please see
* {@see AzureClustersClient::azureNodePoolName()} for help formatting this field.
*/
function delete_azure_node_pool_sample(string $formattedName): void
{
// Create a client.
$azureClustersClient = new AzureClustersClient();
// Prepare the request message.
$request = (new DeleteAzureNodePoolRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $azureClustersClient->deleteAzureNodePool($request);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
printf('Operation completed successfully.' . PHP_EOL);
} else {
/** @var Status $error */
$error = $response->getError();
printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
}
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedName = AzureClustersClient::azureNodePoolName(
'[PROJECT]',
'[LOCATION]',
'[AZURE_CLUSTER]',
'[AZURE_NODE_POOL]'
);
delete_azure_node_pool_sample($formattedName);
}
generateAzureAccessToken
Generates a short-lived access token to authenticate to a given AzureCluster resource.
azureCluster
string
Required. The name of the AzureCluster resource to authenticate to.
AzureCluster
names are formatted as projects/<project-id>/locations/<region>/AzureClusters/<cluster-id>
.
See Resource Names for more details on Google Cloud resource names.
optionalArgs
array
Optional.
↳ retrySettings
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
use Google\ApiCore\ApiException;
use Google\Cloud\GkeMultiCloud\V1\Client\AzureClustersClient;
use Google\Cloud\GkeMultiCloud\V1\GenerateAzureAccessTokenRequest;
use Google\Cloud\GkeMultiCloud\V1\GenerateAzureAccessTokenResponse;
/**
* @param string $formattedAzureCluster The name of the
* [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] resource to
* authenticate to.
*
* `AzureCluster` names are formatted as
* `projects/<project-id>/locations/<region>/AzureClusters/<cluster-id>`.
*
* See [Resource Names](https://cloud.google.com/apis/design/resource_names)
* for more details on Google Cloud resource names. Please see
* {@see AzureClustersClient::azureClusterName()} for help formatting this field.
*/
function generate_azure_access_token_sample(string $formattedAzureCluster): void
{
// Create a client.
$azureClustersClient = new AzureClustersClient();
// Prepare the request message.
$request = (new GenerateAzureAccessTokenRequest())
->setAzureCluster($formattedAzureCluster);
// Call the API and handle any network failures.
try {
/** @var GenerateAzureAccessTokenResponse $response */
$response = $azureClustersClient->generateAzureAccessToken($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* 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
{
$formattedAzureCluster = AzureClustersClient::azureClusterName(
'[PROJECT]',
'[LOCATION]',
'[AZURE_CLUSTER]'
);
generate_azure_access_token_sample($formattedAzureCluster);
}
getAzureClient
Describes a specific AzureClient resource.
name
string
Required. The name of the AzureClient resource to describe.
AzureClient
names are
formatted as projects/<project-id>/locations/<region>/azureClients/<client-id>
.
See Resource Names for more details on Google Cloud resource names.
optionalArgs
array
Optional.
↳ retrySettings
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
use Google\ApiCore\ApiException;
use Google\Cloud\GkeMultiCloud\V1\AzureClient;
use Google\Cloud\GkeMultiCloud\V1\Client\AzureClustersClient;
use Google\Cloud\GkeMultiCloud\V1\GetAzureClientRequest;
/**
* @param string $formattedName The name of the
* [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] resource to
* describe.
*
* [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] names are
* formatted as
* `projects/<project-id>/locations/<region>/azureClients/<client-id>`.
*
* See [Resource Names](https://cloud.google.com/apis/design/resource_names)
* for more details on Google Cloud resource names. Please see
* {@see AzureClustersClient::azureClientName()} for help formatting this field.
*/
function get_azure_client_sample(string $formattedName): void
{
// Create a client.
$azureClustersClient = new AzureClustersClient();
// Prepare the request message.
$request = (new GetAzureClientRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
/** @var AzureClient $response */
$response = $azureClustersClient->getAzureClient($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedName = AzureClustersClient::azureClientName('[PROJECT]', '[LOCATION]', '[AZURE_CLIENT]');
get_azure_client_sample($formattedName);
}
getAzureCluster
Describes a specific AzureCluster resource.
name
string
Required. The name of the AzureCluster resource to describe.
AzureCluster
names are formatted as projects/<project-id>/locations/<region>/azureClusters/<cluster-id>
.
See Resource Names for more details on Google Cloud Platform resource names.
optionalArgs
array
Optional.
↳ retrySettings
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
use Google\ApiCore\ApiException;
use Google\Cloud\GkeMultiCloud\V1\AzureCluster;
use Google\Cloud\GkeMultiCloud\V1\Client\AzureClustersClient;
use Google\Cloud\GkeMultiCloud\V1\GetAzureClusterRequest;
/**
* @param string $formattedName The name of the
* [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] resource to
* describe.
*
* `AzureCluster` names are formatted as
* `projects/<project-id>/locations/<region>/azureClusters/<cluster-id>`.
*
* See [Resource Names](https://cloud.google.com/apis/design/resource_names)
* for more details on Google Cloud Platform resource names. Please see
* {@see AzureClustersClient::azureClusterName()} for help formatting this field.
*/
function get_azure_cluster_sample(string $formattedName): void
{
// Create a client.
$azureClustersClient = new AzureClustersClient();
// Prepare the request message.
$request = (new GetAzureClusterRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
/** @var AzureCluster $response */
$response = $azureClustersClient->getAzureCluster($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedName = AzureClustersClient::azureClusterName(
'[PROJECT]',
'[LOCATION]',
'[AZURE_CLUSTER]'
);
get_azure_cluster_sample($formattedName);
}
getAzureNodePool
Describes a specific AzureNodePool resource.
name
string
Required. The name of the AzureNodePool resource to describe.
AzureNodePool
names are formatted as projects/<project-id>/locations/<region>/azureClusters/<cluster-id>/azureNodePools/<node-pool-id>
.
See Resource Names for more details on Google Cloud resource names.
optionalArgs
array
Optional.
↳ retrySettings
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
use Google\ApiCore\ApiException;
use Google\Cloud\GkeMultiCloud\V1\AzureNodePool;
use Google\Cloud\GkeMultiCloud\V1\Client\AzureClustersClient;
use Google\Cloud\GkeMultiCloud\V1\GetAzureNodePoolRequest;
/**
* @param string $formattedName The name of the
* [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool] resource to
* describe.
*
* `AzureNodePool` names are formatted as
* `projects/<project-id>/locations/<region>/azureClusters/<cluster-id>/azureNodePools/<node-pool-id>`.
*
* See [Resource Names](https://cloud.google.com/apis/design/resource_names)
* for more details on Google Cloud resource names. Please see
* {@see AzureClustersClient::azureNodePoolName()} for help formatting this field.
*/
function get_azure_node_pool_sample(string $formattedName): void
{
// Create a client.
$azureClustersClient = new AzureClustersClient();
// Prepare the request message.
$request = (new GetAzureNodePoolRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
/** @var AzureNodePool $response */
$response = $azureClustersClient->getAzureNodePool($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedName = AzureClustersClient::azureNodePoolName(
'[PROJECT]',
'[LOCATION]',
'[AZURE_CLUSTER]',
'[AZURE_NODE_POOL]'
);
get_azure_node_pool_sample($formattedName);
}
getAzureServerConfig
Returns information, such as supported Azure regions and Kubernetes versions, on a given Google Cloud location.
name
string
Required. The name of the AzureServerConfig resource to describe.
AzureServerConfig
names are formatted as projects/<project-id>/locations/<region>/azureServerConfig
.
See Resource Names for more details on Google Cloud resource names.
optionalArgs
array
Optional.
↳ retrySettings
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
use Google\ApiCore\ApiException;
use Google\Cloud\GkeMultiCloud\V1\AzureServerConfig;
use Google\Cloud\GkeMultiCloud\V1\Client\AzureClustersClient;
use Google\Cloud\GkeMultiCloud\V1\GetAzureServerConfigRequest;
/**
* @param string $formattedName The name of the
* [AzureServerConfig][google.cloud.gkemulticloud.v1.AzureServerConfig]
* resource to describe.
*
* `AzureServerConfig` names are formatted as
* `projects/<project-id>/locations/<region>/azureServerConfig`.
*
* See [Resource Names](https://cloud.google.com/apis/design/resource_names)
* for more details on Google Cloud resource names. Please see
* {@see AzureClustersClient::azureServerConfigName()} for help formatting this field.
*/
function get_azure_server_config_sample(string $formattedName): void
{
// Create a client.
$azureClustersClient = new AzureClustersClient();
// Prepare the request message.
$request = (new GetAzureServerConfigRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
/** @var AzureServerConfig $response */
$response = $azureClustersClient->getAzureServerConfig($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedName = AzureClustersClient::azureServerConfigName('[PROJECT]', '[LOCATION]');
get_azure_server_config_sample($formattedName);
}
listAzureClients
Lists all AzureClient resources on a given Google Cloud project and region.
parent
string
Required. The parent location which owns this collection of AzureClient resources.
Location names are formatted as projects/<project-id>/locations/<region>
.
See Resource Names for more details on Google Cloud Platform resource names.
optionalArgs
array
Optional.
↳ pageSize
int
The maximum number of resources contained in the underlying API response. The API may return fewer values in a page, even if there are additional values to be retrieved.
↳ pageToken
string
A page token is used to specify a page of values to be returned. If no page token is specified (the default), the first page of values will be returned. Any page token used here must have been generated by a previous call to the API.
↳ retrySettings
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\GkeMultiCloud\V1\AzureClient;
use Google\Cloud\GkeMultiCloud\V1\Client\AzureClustersClient;
use Google\Cloud\GkeMultiCloud\V1\ListAzureClientsRequest;
/**
* @param string $formattedParent The parent location which owns this collection of
* [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] resources.
*
* Location names are formatted as `projects/<project-id>/locations/<region>`.
*
* See [Resource Names](https://cloud.google.com/apis/design/resource_names)
* for more details on Google Cloud Platform resource names. Please see
* {@see AzureClustersClient::locationName()} for help formatting this field.
*/
function list_azure_clients_sample(string $formattedParent): void
{
// Create a client.
$azureClustersClient = new AzureClustersClient();
// Prepare the request message.
$request = (new ListAzureClientsRequest())
->setParent($formattedParent);
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $azureClustersClient->listAzureClients($request);
/** @var AzureClient $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());
}
}
/**
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedParent = AzureClustersClient::locationName('[PROJECT]', '[LOCATION]');
list_azure_clients_sample($formattedParent);
}
listAzureClusters
Lists all AzureCluster resources on a given Google Cloud project and region.
parent
string
Required. The parent location which owns this collection of AzureCluster resources.
Location names are formatted as projects/<project-id>/locations/<region>
.
See Resource Names for more details on Google Cloud Platform resource names.
optionalArgs
array
Optional.
↳ pageSize
int
The maximum number of resources contained in the underlying API response. The API may return fewer values in a page, even if there are additional values to be retrieved.
↳ pageToken
string
A page token is used to specify a page of values to be returned. If no page token is specified (the default), the first page of values will be returned. Any page token used here must have been generated by a previous call to the API.
↳ retrySettings
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\GkeMultiCloud\V1\AzureCluster;
use Google\Cloud\GkeMultiCloud\V1\Client\AzureClustersClient;
use Google\Cloud\GkeMultiCloud\V1\ListAzureClustersRequest;
/**
* @param string $formattedParent The parent location which owns this collection of
* [AzureCluster][google.cloud.gkemulticloud.v1.AzureCluster] resources.
*
* Location names are formatted as `projects/<project-id>/locations/<region>`.
*
* See [Resource Names](https://cloud.google.com/apis/design/resource_names)
* for more details on Google Cloud Platform resource names. Please see
* {@see AzureClustersClient::locationName()} for help formatting this field.
*/
function list_azure_clusters_sample(string $formattedParent): void
{
// Create a client.
$azureClustersClient = new AzureClustersClient();
// Prepare the request message.
$request = (new ListAzureClustersRequest())
->setParent($formattedParent);
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $azureClustersClient->listAzureClusters($request);
/** @var AzureCluster $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());
}
}
/**
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedParent = AzureClustersClient::locationName('[PROJECT]', '[LOCATION]');
list_azure_clusters_sample($formattedParent);
}
listAzureNodePools
Lists all AzureNodePool resources on a given AzureCluster .
parent
string
Required. The parent AzureCluster
which owns this collection of AzureNodePool
resources.
AzureCluster
names are formatted as projects/<project-id>/locations/<region>/azureClusters/<cluster-id>
.
See Resource Names for more details on Google Cloud resource names.
optionalArgs
array
Optional.
↳ pageSize
int
The maximum number of resources contained in the underlying API response. The API may return fewer values in a page, even if there are additional values to be retrieved.
↳ pageToken
string
A page token is used to specify a page of values to be returned. If no page token is specified (the default), the first page of values will be returned. Any page token used here must have been generated by a previous call to the API.
↳ retrySettings
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\GkeMultiCloud\V1\AzureNodePool;
use Google\Cloud\GkeMultiCloud\V1\Client\AzureClustersClient;
use Google\Cloud\GkeMultiCloud\V1\ListAzureNodePoolsRequest;
/**
* @param string $formattedParent The parent `AzureCluster` which owns this collection of
* [AzureNodePool][google.cloud.gkemulticloud.v1.AzureNodePool] resources.
*
* `AzureCluster` names are formatted as
* `projects/<project-id>/locations/<region>/azureClusters/<cluster-id>`.
*
* See [Resource Names](https://cloud.google.com/apis/design/resource_names)
* for more details on Google Cloud resource names. Please see
* {@see AzureClustersClient::azureClusterName()} for help formatting this field.
*/
function list_azure_node_pools_sample(string $formattedParent): void
{
// Create a client.
$azureClustersClient = new AzureClustersClient();
// Prepare the request message.
$request = (new ListAzureNodePoolsRequest())
->setParent($formattedParent);
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $azureClustersClient->listAzureNodePools($request);
/** @var AzureNodePool $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());
}
}
/**
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedParent = AzureClustersClient::azureClusterName(
'[PROJECT]',
'[LOCATION]',
'[AZURE_CLUSTER]'
);
list_azure_node_pools_sample($formattedParent);
}
updateAzureCluster
Updates an AzureCluster .
azureCluster
updateMask
Google\Protobuf\FieldMask
Required. Mask of fields to update. At least one path must be supplied in this field. The elements of the repeated paths field can only include these fields from AzureCluster :
-
description
. -
azureClient
. -
control_plane.version
. -
control_plane.vm_size
. -
annotations
. -
authorization.admin_users
. -
control_plane.root_volume.size_gib
. -
azure_services_authentication
. -
azure_services_authentication.tenant_id
. -
azure_services_authentication.application_id
. -
control_plane.proxy_config
. -
control_plane.proxy_config.resource_group_id
. -
control_plane.proxy_config.secret_id
. -
control_plane.ssh_config.authorized_key
. -
logging_config.component_config.enable_components
-
monitoring_config.managed_prometheus_config.enabled
.
optionalArgs
array
Optional.
↳ validateOnly
bool
If set, only validate the request, but do not actually update the cluster.
↳ retrySettings
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\GkeMultiCloud\V1\AzureAuthorization;
use Google\Cloud\GkeMultiCloud\V1\AzureCluster;
use Google\Cloud\GkeMultiCloud\V1\AzureClusterNetworking;
use Google\Cloud\GkeMultiCloud\V1\AzureClusterUser;
use Google\Cloud\GkeMultiCloud\V1\AzureControlPlane;
use Google\Cloud\GkeMultiCloud\V1\AzureSshConfig;
use Google\Cloud\GkeMultiCloud\V1\Client\AzureClustersClient;
use Google\Cloud\GkeMultiCloud\V1\Fleet;
use Google\Cloud\GkeMultiCloud\V1\UpdateAzureClusterRequest;
use Google\Protobuf\FieldMask;
use Google\Rpc\Status;
/**
* @param string $azureClusterAzureRegion The Azure region where the cluster runs.
*
* Each Google Cloud region supports a subset of nearby Azure regions.
* You can call
* [GetAzureServerConfig][google.cloud.gkemulticloud.v1.AzureClusters.GetAzureServerConfig]
* to list all supported Azure regions within a given Google Cloud region.
* @param string $azureClusterResourceGroupId The ARM ID of the resource group where the cluster resources are
* deployed. For example:
* `/subscriptions/<subscription-id>/resourceGroups/<resource-group-name>`
* @param string $azureClusterNetworkingVirtualNetworkId The Azure Resource Manager (ARM) ID of the VNet associated with
* your cluster.
*
* All components in the cluster (i.e. control plane and node pools) run on a
* single VNet.
*
* Example:
* `/subscriptions/<subscription-id>/resourceGroups/<resource-group-id>/providers/Microsoft.Network/virtualNetworks/<vnet-id>`
*
* This field cannot be changed after creation.
* @param string $azureClusterNetworkingPodAddressCidrBlocksElement The IP address range of the pods in this cluster, in CIDR
* notation (e.g. `10.96.0.0/14`).
*
* All pods in the cluster get assigned a unique IPv4 address from these
* ranges. Only a single range is supported.
*
* This field cannot be changed after creation.
* @param string $azureClusterNetworkingServiceAddressCidrBlocksElement The IP address range for services in this cluster, in CIDR
* notation (e.g. `10.96.0.0/14`).
*
* All services in the cluster get assigned a unique IPv4 address from these
* ranges. Only a single range is supported.
*
* This field cannot be changed after creating a cluster.
* @param string $azureClusterControlPlaneVersion The Kubernetes version to run on control plane replicas
* (e.g. `1.19.10-gke.1000`).
*
* You can list all supported versions on a given Google Cloud region by
* calling
* [GetAzureServerConfig][google.cloud.gkemulticloud.v1.AzureClusters.GetAzureServerConfig].
* @param string $azureClusterControlPlaneSshConfigAuthorizedKey The SSH public key data for VMs managed by Anthos. This accepts
* the authorized_keys file format used in OpenSSH according to the sshd(8)
* manual page.
* @param string $azureClusterAuthorizationAdminUsersUsername The name of the user, e.g. `my-gcp-id@gmail.com`.
* @param string $azureClusterFleetProject The name of the Fleet host project where this cluster will be
* registered.
*
* Project names are formatted as
* `projects/<project-number>`.
*/
function update_azure_cluster_sample(
string $azureClusterAzureRegion,
string $azureClusterResourceGroupId,
string $azureClusterNetworkingVirtualNetworkId,
string $azureClusterNetworkingPodAddressCidrBlocksElement,
string $azureClusterNetworkingServiceAddressCidrBlocksElement,
string $azureClusterControlPlaneVersion,
string $azureClusterControlPlaneSshConfigAuthorizedKey,
string $azureClusterAuthorizationAdminUsersUsername,
string $azureClusterFleetProject
): void {
// Create a client.
$azureClustersClient = new AzureClustersClient();
// Prepare the request message.
$azureClusterNetworkingPodAddressCidrBlocks = [
$azureClusterNetworkingPodAddressCidrBlocksElement,
];
$azureClusterNetworkingServiceAddressCidrBlocks = [
$azureClusterNetworkingServiceAddressCidrBlocksElement,
];
$azureClusterNetworking = (new AzureClusterNetworking())
->setVirtualNetworkId($azureClusterNetworkingVirtualNetworkId)
->setPodAddressCidrBlocks($azureClusterNetworkingPodAddressCidrBlocks)
->setServiceAddressCidrBlocks($azureClusterNetworkingServiceAddressCidrBlocks);
$azureClusterControlPlaneSshConfig = (new AzureSshConfig())
->setAuthorizedKey($azureClusterControlPlaneSshConfigAuthorizedKey);
$azureClusterControlPlane = (new AzureControlPlane())
->setVersion($azureClusterControlPlaneVersion)
->setSshConfig($azureClusterControlPlaneSshConfig);
$azureClusterUser = (new AzureClusterUser())
->setUsername($azureClusterAuthorizationAdminUsersUsername);
$azureClusterAuthorizationAdminUsers = [$azureClusterUser,];
$azureClusterAuthorization = (new AzureAuthorization())
->setAdminUsers($azureClusterAuthorizationAdminUsers);
$azureClusterFleet = (new Fleet())
->setProject($azureClusterFleetProject);
$azureCluster = (new AzureCluster())
->setAzureRegion($azureClusterAzureRegion)
->setResourceGroupId($azureClusterResourceGroupId)
->setNetworking($azureClusterNetworking)
->setControlPlane($azureClusterControlPlane)
->setAuthorization($azureClusterAuthorization)
->setFleet($azureClusterFleet);
$updateMask = new FieldMask();
$request = (new UpdateAzureClusterRequest())
->setAzureCluster($azureCluster)
->setUpdateMask($updateMask);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $azureClustersClient->updateAzureCluster($request);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
/** @var AzureCluster $result */
$result = $response->getResult();
printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
} else {
/** @var Status $error */
$error = $response->getError();
printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
}
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* 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
{
$azureClusterAzureRegion = '[AZURE_REGION]';
$azureClusterResourceGroupId = '[RESOURCE_GROUP_ID]';
$azureClusterNetworkingVirtualNetworkId = '[VIRTUAL_NETWORK_ID]';
$azureClusterNetworkingPodAddressCidrBlocksElement = '[POD_ADDRESS_CIDR_BLOCKS]';
$azureClusterNetworkingServiceAddressCidrBlocksElement = '[SERVICE_ADDRESS_CIDR_BLOCKS]';
$azureClusterControlPlaneVersion = '[VERSION]';
$azureClusterControlPlaneSshConfigAuthorizedKey = '[AUTHORIZED_KEY]';
$azureClusterAuthorizationAdminUsersUsername = '[USERNAME]';
$azureClusterFleetProject = '[PROJECT]';
update_azure_cluster_sample(
$azureClusterAzureRegion,
$azureClusterResourceGroupId,
$azureClusterNetworkingVirtualNetworkId,
$azureClusterNetworkingPodAddressCidrBlocksElement,
$azureClusterNetworkingServiceAddressCidrBlocksElement,
$azureClusterControlPlaneVersion,
$azureClusterControlPlaneSshConfigAuthorizedKey,
$azureClusterAuthorizationAdminUsersUsername,
$azureClusterFleetProject
);
}
updateAzureNodePool
Updates an AzureNodePool .
azureNodePool
updateMask
Google\Protobuf\FieldMask
Required. Mask of fields to update. At least one path must be supplied in this field. The elements of the repeated paths field can only include these fields from AzureNodePool :
*. annotations
.
-
version
. -
autoscaling.min_node_count
. -
autoscaling.max_node_count
. -
config.ssh_config.authorized_key
.
optionalArgs
array
Optional.
↳ validateOnly
bool
If set, only validate the request, but don't actually update the node pool.
↳ retrySettings
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\GkeMultiCloud\V1\AzureNodeConfig;
use Google\Cloud\GkeMultiCloud\V1\AzureNodePool;
use Google\Cloud\GkeMultiCloud\V1\AzureNodePoolAutoscaling;
use Google\Cloud\GkeMultiCloud\V1\AzureSshConfig;
use Google\Cloud\GkeMultiCloud\V1\Client\AzureClustersClient;
use Google\Cloud\GkeMultiCloud\V1\MaxPodsConstraint;
use Google\Cloud\GkeMultiCloud\V1\UpdateAzureNodePoolRequest;
use Google\Protobuf\FieldMask;
use Google\Rpc\Status;
/**
* @param string $azureNodePoolVersion The Kubernetes version (e.g. `1.19.10-gke.1000`) running on this
* node pool.
* @param string $azureNodePoolConfigSshConfigAuthorizedKey The SSH public key data for VMs managed by Anthos. This accepts
* the authorized_keys file format used in OpenSSH according to the sshd(8)
* manual page.
* @param string $azureNodePoolSubnetId The ARM ID of the subnet where the node pool VMs run. Make sure
* it's a subnet under the virtual network in the cluster configuration.
* @param int $azureNodePoolAutoscalingMinNodeCount Minimum number of nodes in the node pool. Must be greater than or
* equal to 1 and less than or equal to max_node_count.
* @param int $azureNodePoolAutoscalingMaxNodeCount Maximum number of nodes in the node pool. Must be greater than or
* equal to min_node_count and less than or equal to 50.
* @param int $azureNodePoolMaxPodsConstraintMaxPodsPerNode The maximum number of pods to schedule on a single node.
*/
function update_azure_node_pool_sample(
string $azureNodePoolVersion,
string $azureNodePoolConfigSshConfigAuthorizedKey,
string $azureNodePoolSubnetId,
int $azureNodePoolAutoscalingMinNodeCount,
int $azureNodePoolAutoscalingMaxNodeCount,
int $azureNodePoolMaxPodsConstraintMaxPodsPerNode
): void {
// Create a client.
$azureClustersClient = new AzureClustersClient();
// Prepare the request message.
$azureNodePoolConfigSshConfig = (new AzureSshConfig())
->setAuthorizedKey($azureNodePoolConfigSshConfigAuthorizedKey);
$azureNodePoolConfig = (new AzureNodeConfig())
->setSshConfig($azureNodePoolConfigSshConfig);
$azureNodePoolAutoscaling = (new AzureNodePoolAutoscaling())
->setMinNodeCount($azureNodePoolAutoscalingMinNodeCount)
->setMaxNodeCount($azureNodePoolAutoscalingMaxNodeCount);
$azureNodePoolMaxPodsConstraint = (new MaxPodsConstraint())
->setMaxPodsPerNode($azureNodePoolMaxPodsConstraintMaxPodsPerNode);
$azureNodePool = (new AzureNodePool())
->setVersion($azureNodePoolVersion)
->setConfig($azureNodePoolConfig)
->setSubnetId($azureNodePoolSubnetId)
->setAutoscaling($azureNodePoolAutoscaling)
->setMaxPodsConstraint($azureNodePoolMaxPodsConstraint);
$updateMask = new FieldMask();
$request = (new UpdateAzureNodePoolRequest())
->setAzureNodePool($azureNodePool)
->setUpdateMask($updateMask);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $azureClustersClient->updateAzureNodePool($request);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
/** @var AzureNodePool $result */
$result = $response->getResult();
printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
} else {
/** @var Status $error */
$error = $response->getError();
printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
}
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* 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
{
$azureNodePoolVersion = '[VERSION]';
$azureNodePoolConfigSshConfigAuthorizedKey = '[AUTHORIZED_KEY]';
$azureNodePoolSubnetId = '[SUBNET_ID]';
$azureNodePoolAutoscalingMinNodeCount = 0;
$azureNodePoolAutoscalingMaxNodeCount = 0;
$azureNodePoolMaxPodsConstraintMaxPodsPerNode = 0;
update_azure_node_pool_sample(
$azureNodePoolVersion,
$azureNodePoolConfigSshConfigAuthorizedKey,
$azureNodePoolSubnetId,
$azureNodePoolAutoscalingMinNodeCount,
$azureNodePoolAutoscalingMaxNodeCount,
$azureNodePoolMaxPodsConstraintMaxPodsPerNode
);
}
Constants
SERVICE_NAME
Value: 'google.cloud.gkemulticloud.v1.AzureClusters'
The name of the service.
SERVICE_ADDRESS
Value: 'gkemulticloud.googleapis.com'
The default address of the service.
DEFAULT_SERVICE_PORT
Value: 443
The default port of the service.
CODEGEN_NAME
Value: 'gapic'
The name of the code generator, to be included in the agent header.