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.
Parameters | |
---|---|
Name | Description |
project |
string
|
location |
string
|
azureClient |
string
|
Returns | |
---|---|
Type | Description |
string | The formatted azure_client resource. |
azureClusterName
Formats a string containing the fully-qualified path to represent a azure_cluster resource.
Parameters | |
---|---|
Name | Description |
project |
string
|
location |
string
|
azureCluster |
string
|
Returns | |
---|---|
Type | Description |
string | The formatted azure_cluster resource. |
azureNodePoolName
Formats a string containing the fully-qualified path to represent a azure_node_pool resource.
Parameters | |
---|---|
Name | Description |
project |
string
|
location |
string
|
azureCluster |
string
|
azureNodePool |
string
|
Returns | |
---|---|
Type | Description |
string | The formatted azure_node_pool resource. |
azureServerConfigName
Formats a string containing the fully-qualified path to represent a azure_server_config resource.
Parameters | |
---|---|
Name | Description |
project |
string
|
location |
string
|
Returns | |
---|---|
Type | Description |
string | The formatted azure_server_config resource. |
locationName
Formats a string containing the fully-qualified path to represent a location resource.
Parameters | |
---|---|
Name | Description |
project |
string
|
location |
string
|
Returns | |
---|---|
Type | Description |
string | The formatted location resource. |
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.
Parameters | |
---|---|
Name | Description |
formattedName |
string
The formatted name string |
template |
string
Optional name of template to match |
Returns | |
---|---|
Type | Description |
array | An associative array from name component IDs to component values. |
getOperationsClient
Return an OperationsClient object with the same endpoint as $this.
Returns | |
---|---|
Type | Description |
Google\ApiCore\LongRunning\OperationsClient |
resumeOperation
Resume an existing long running operation that was previously started by a long running API method. If $methodName is not provided, or does not match a long running API method, then the operation can still be resumed, but the OperationResponse object will not deserialize the final response.
Parameters | |
---|---|
Name | Description |
operationName |
string
The name of the long running operation |
methodName |
string
The name of the method used to start the operation |
Returns | |
---|---|
Type | Description |
Google\ApiCore\OperationResponse |
__construct
Constructor.
Parameters | |
---|---|
Name | Description |
options |
array
Optional. Options for configuring the service API wrapper. |
↳ apiEndpoint |
string
The address of the API remote host. May optionally include the port, formatted as "
|
↳ credentials |
string|array|FetchAuthTokenInterface|CredentialsWrapper
The credentials to be used by the client to authorize API calls. This option accepts either a path to a credentials file, or a decoded credentials file as a PHP array. Advanced usage: In addition, this option can also accept a pre-constructed {@see} object or {@see} 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 {@see} . |
↳ disableRetries |
bool
Determines whether or not retries defined by the client configuration should be disabled. Defaults to |
↳ 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 |
↳ 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 {@see} and {@see} 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.
Parameters | |
---|---|
Name | Description |
parent |
string
Required. The parent location where this AzureClient resource will be created. Location names are formatted as |
azureClient |
Google\Cloud\GkeMultiCloud\V1\AzureClient
Required. The specification of the AzureClient to create. |
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 |
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 {@see} object, or an associative array of retry settings parameters. See the documentation on {@see} for example usage. |
Returns | |
---|---|
Type | Description |
Google\ApiCore\OperationResponse |
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\GkeMultiCloud\V1\AzureClient;
use Google\Cloud\GkeMultiCloud\V1\AzureClustersClient;
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 40 characters.
*/
function create_azure_client_sample(
string $formattedParent,
string $azureClientTenantId,
string $azureClientApplicationId,
string $azureClientId
): void {
// Create a client.
$azureClustersClient = new AzureClustersClient();
// Prepare any non-scalar elements to be passed along with the request.
$azureClient = (new AzureClient())
->setTenantId($azureClientTenantId)
->setApplicationId($azureClientApplicationId);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $azureClustersClient->createAzureClient($formattedParent, $azureClient, $azureClientId);
$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 GCP project and region.
If successful, the response contains a newly created Operation resource that can be described to track the status of the operation.
Parameters | |
---|---|
Name | Description |
parent |
string
Required. The parent location where this AzureCluster resource will be created. Location names are formatted as |
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 |
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 {@see} object, or an associative array of retry settings parameters. See the documentation on {@see} for example usage. |
Returns | |
---|---|
Type | Description |
Google\ApiCore\OperationResponse |
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\AzureClustersClient;
use Google\Cloud\GkeMultiCloud\V1\AzureControlPlane;
use Google\Cloud\GkeMultiCloud\V1\AzureSshConfig;
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 $azureClusterAzureClient Name of the [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] that contains authentication configuration for
* how the Anthos Multi-Cloud API connects to Azure APIs.
*
* The `AzureClient` resource must reside on the same GCP project and region
* as the `AzureCluster`.
*
* `AzureClient` names are formatted as
* `projects/<project-number>/locations/<region>/azureClients/<client-id>`.
*
* See [Resource Names](https://cloud.google.com/apis/design/resource_names)
* for more details on Google Cloud resource names.
* @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 $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 40 characters.
*/
function create_azure_cluster_sample(
string $formattedParent,
string $azureClusterAzureRegion,
string $azureClusterResourceGroupId,
string $azureClusterAzureClient,
string $azureClusterNetworkingVirtualNetworkId,
string $azureClusterNetworkingPodAddressCidrBlocksElement,
string $azureClusterNetworkingServiceAddressCidrBlocksElement,
string $azureClusterControlPlaneVersion,
string $azureClusterControlPlaneSshConfigAuthorizedKey,
string $azureClusterAuthorizationAdminUsersUsername,
string $azureClusterId
): void {
// Create a client.
$azureClustersClient = new AzureClustersClient();
// Prepare any non-scalar elements to be passed along with the request.
$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);
$azureCluster = (new AzureCluster())
->setAzureRegion($azureClusterAzureRegion)
->setResourceGroupId($azureClusterResourceGroupId)
->setAzureClient($azureClusterAzureClient)
->setNetworking($azureClusterNetworking)
->setControlPlane($azureClusterControlPlane)
->setAuthorization($azureClusterAuthorization);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $azureClustersClient->createAzureCluster(
$formattedParent,
$azureCluster,
$azureClusterId
);
$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]';
$azureClusterAzureClient = '[AZURE_CLIENT]';
$azureClusterNetworkingVirtualNetworkId = '[VIRTUAL_NETWORK_ID]';
$azureClusterNetworkingPodAddressCidrBlocksElement = '[POD_ADDRESS_CIDR_BLOCKS]';
$azureClusterNetworkingServiceAddressCidrBlocksElement = '[SERVICE_ADDRESS_CIDR_BLOCKS]';
$azureClusterControlPlaneVersion = '[VERSION]';
$azureClusterControlPlaneSshConfigAuthorizedKey = '[AUTHORIZED_KEY]';
$azureClusterAuthorizationAdminUsersUsername = '[USERNAME]';
$azureClusterId = '[AZURE_CLUSTER_ID]';
create_azure_cluster_sample(
$formattedParent,
$azureClusterAzureRegion,
$azureClusterResourceGroupId,
$azureClusterAzureClient,
$azureClusterNetworkingVirtualNetworkId,
$azureClusterNetworkingPodAddressCidrBlocksElement,
$azureClusterNetworkingServiceAddressCidrBlocksElement,
$azureClusterControlPlaneVersion,
$azureClusterControlPlaneSshConfigAuthorizedKey,
$azureClusterAuthorizationAdminUsersUsername,
$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.
Parameters | |
---|---|
Name | Description |
parent |
string
Required. The AzureCluster resource where this node pool will be created. Location names are formatted as |
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 |
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 {@see} object, or an associative array of retry settings parameters. See the documentation on {@see} for example usage. |
Returns | |
---|---|
Type | Description |
Google\ApiCore\OperationResponse |
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\GkeMultiCloud\V1\AzureClustersClient;
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\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 40 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 any non-scalar elements to be passed along with the request.
$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);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $azureClustersClient->createAzureNodePool(
$formattedParent,
$azureNodePool,
$azureNodePoolId
);
$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.
Parameters | |
---|---|
Name | Description |
name |
string
Required. The resource name the AzureClient to delete. AzureClient names are formatted as |
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 {@see} object, or an associative array of retry settings parameters. See the documentation on {@see} for example usage. |
Returns | |
---|---|
Type | Description |
Google\ApiCore\OperationResponse |
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\GkeMultiCloud\V1\AzureClustersClient;
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();
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $azureClustersClient->deleteAzureClient($formattedName);
$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.
Parameters | |
---|---|
Name | Description |
name |
string
Required. The resource name the AzureCluster to delete. |
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 {@see} object, or an associative array of retry settings parameters. See the documentation on {@see} for example usage. |
Returns | |
---|---|
Type | Description |
Google\ApiCore\OperationResponse |
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\GkeMultiCloud\V1\AzureClustersClient;
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 GCP 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();
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $azureClustersClient->deleteAzureCluster($formattedName);
$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.
Parameters | |
---|---|
Name | Description |
name |
string
Required. The resource name the AzureNodePool to delete. |
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 {@see} object, or an associative array of retry settings parameters. See the documentation on {@see} for example usage. |
Returns | |
---|---|
Type | Description |
Google\ApiCore\OperationResponse |
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\GkeMultiCloud\V1\AzureClustersClient;
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();
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $azureClustersClient->deleteAzureNodePool($formattedName);
$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.
Parameters | |
---|---|
Name | Description |
azureCluster |
string
Required. The name of the AzureCluster resource to authenticate to. |
optionalArgs |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a {@see} object, or an associative array of retry settings parameters. See the documentation on {@see} for example usage. |
Returns | |
---|---|
Type | Description |
Google\Cloud\GkeMultiCloud\V1\GenerateAzureAccessTokenResponse |
use Google\ApiCore\ApiException;
use Google\Cloud\GkeMultiCloud\V1\AzureClustersClient;
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();
// Call the API and handle any network failures.
try {
/** @var GenerateAzureAccessTokenResponse $response */
$response = $azureClustersClient->generateAzureAccessToken($formattedAzureCluster);
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.
Parameters | |
---|---|
Name | Description |
name |
string
Required. The name of the AzureClient resource to describe. AzureClient names are formatted as |
optionalArgs |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a {@see} object, or an associative array of retry settings parameters. See the documentation on {@see} for example usage. |
Returns | |
---|---|
Type | Description |
Google\Cloud\GkeMultiCloud\V1\AzureClient |
use Google\ApiCore\ApiException;
use Google\Cloud\GkeMultiCloud\V1\AzureClient;
use Google\Cloud\GkeMultiCloud\V1\AzureClustersClient;
/**
* @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();
// Call the API and handle any network failures.
try {
/** @var AzureClient $response */
$response = $azureClustersClient->getAzureClient($formattedName);
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.
Parameters | |
---|---|
Name | Description |
name |
string
Required. The name of the AzureCluster resource to describe. |
optionalArgs |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a {@see} object, or an associative array of retry settings parameters. See the documentation on {@see} for example usage. |
Returns | |
---|---|
Type | Description |
Google\Cloud\GkeMultiCloud\V1\AzureCluster |
use Google\ApiCore\ApiException;
use Google\Cloud\GkeMultiCloud\V1\AzureCluster;
use Google\Cloud\GkeMultiCloud\V1\AzureClustersClient;
/**
* @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 GCP 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();
// Call the API and handle any network failures.
try {
/** @var AzureCluster $response */
$response = $azureClustersClient->getAzureCluster($formattedName);
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.
Parameters | |
---|---|
Name | Description |
name |
string
Required. The name of the AzureNodePool resource to describe. |
optionalArgs |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a {@see} object, or an associative array of retry settings parameters. See the documentation on {@see} for example usage. |
Returns | |
---|---|
Type | Description |
Google\Cloud\GkeMultiCloud\V1\AzureNodePool |
use Google\ApiCore\ApiException;
use Google\Cloud\GkeMultiCloud\V1\AzureClustersClient;
use Google\Cloud\GkeMultiCloud\V1\AzureNodePool;
/**
* @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();
// Call the API and handle any network failures.
try {
/** @var AzureNodePool $response */
$response = $azureClustersClient->getAzureNodePool($formattedName);
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.
Parameters | |
---|---|
Name | Description |
name |
string
Required. The name of the AzureServerConfig resource to describe. |
optionalArgs |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a {@see} object, or an associative array of retry settings parameters. See the documentation on {@see} for example usage. |
Returns | |
---|---|
Type | Description |
Google\Cloud\GkeMultiCloud\V1\AzureServerConfig |
use Google\ApiCore\ApiException;
use Google\Cloud\GkeMultiCloud\V1\AzureClustersClient;
use Google\Cloud\GkeMultiCloud\V1\AzureServerConfig;
/**
* @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();
// Call the API and handle any network failures.
try {
/** @var AzureServerConfig $response */
$response = $azureClustersClient->getAzureServerConfig($formattedName);
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.
Parameters | |
---|---|
Name | Description |
parent |
string
Required. The parent location which owns this collection of AzureClient resources. Location names are formatted as |
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 {@see} object, or an associative array of retry settings parameters. See the documentation on {@see} for example usage. |
Returns | |
---|---|
Type | Description |
Google\ApiCore\PagedListResponse |
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\GkeMultiCloud\V1\AzureClient;
use Google\Cloud\GkeMultiCloud\V1\AzureClustersClient;
/**
* @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 GCP 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();
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $azureClustersClient->listAzureClients($formattedParent);
/** @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.
Parameters | |
---|---|
Name | Description |
parent |
string
Required. The parent location which owns this collection of AzureCluster resources. Location names are formatted as |
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 {@see} object, or an associative array of retry settings parameters. See the documentation on {@see} for example usage. |
Returns | |
---|---|
Type | Description |
Google\ApiCore\PagedListResponse |
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\GkeMultiCloud\V1\AzureCluster;
use Google\Cloud\GkeMultiCloud\V1\AzureClustersClient;
/**
* @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 GCP 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();
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $azureClustersClient->listAzureClusters($formattedParent);
/** @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.
Parameters | |
---|---|
Name | Description |
parent |
string
Required. The parent |
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 {@see} object, or an associative array of retry settings parameters. See the documentation on {@see} for example usage. |
Returns | |
---|---|
Type | Description |
Google\ApiCore\PagedListResponse |
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\GkeMultiCloud\V1\AzureClustersClient;
use Google\Cloud\GkeMultiCloud\V1\AzureNodePool;
/**
* @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();
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $azureClustersClient->listAzureNodePools($formattedParent);
/** @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.
Parameters | |
---|---|
Name | Description |
azureCluster |
Google\Cloud\GkeMultiCloud\V1\AzureCluster
Required. The AzureCluster resource to update. |
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: * |
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 {@see} object, or an associative array of retry settings parameters. See the documentation on {@see} for example usage. |
Returns | |
---|---|
Type | Description |
Google\ApiCore\OperationResponse |
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\AzureClustersClient;
use Google\Cloud\GkeMultiCloud\V1\AzureControlPlane;
use Google\Cloud\GkeMultiCloud\V1\AzureSshConfig;
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 $azureClusterAzureClient Name of the [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] that contains authentication configuration for
* how the Anthos Multi-Cloud API connects to Azure APIs.
*
* The `AzureClient` resource must reside on the same GCP project and region
* as the `AzureCluster`.
*
* `AzureClient` names are formatted as
* `projects/<project-number>/locations/<region>/azureClients/<client-id>`.
*
* See [Resource Names](https://cloud.google.com/apis/design/resource_names)
* for more details on Google Cloud resource names.
* @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`.
*/
function update_azure_cluster_sample(
string $azureClusterAzureRegion,
string $azureClusterResourceGroupId,
string $azureClusterAzureClient,
string $azureClusterNetworkingVirtualNetworkId,
string $azureClusterNetworkingPodAddressCidrBlocksElement,
string $azureClusterNetworkingServiceAddressCidrBlocksElement,
string $azureClusterControlPlaneVersion,
string $azureClusterControlPlaneSshConfigAuthorizedKey,
string $azureClusterAuthorizationAdminUsersUsername
): void {
// Create a client.
$azureClustersClient = new AzureClustersClient();
// Prepare any non-scalar elements to be passed along with the request.
$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);
$azureCluster = (new AzureCluster())
->setAzureRegion($azureClusterAzureRegion)
->setResourceGroupId($azureClusterResourceGroupId)
->setAzureClient($azureClusterAzureClient)
->setNetworking($azureClusterNetworking)
->setControlPlane($azureClusterControlPlane)
->setAuthorization($azureClusterAuthorization);
$updateMask = new FieldMask();
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $azureClustersClient->updateAzureCluster($azureCluster, $updateMask);
$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]';
$azureClusterAzureClient = '[AZURE_CLIENT]';
$azureClusterNetworkingVirtualNetworkId = '[VIRTUAL_NETWORK_ID]';
$azureClusterNetworkingPodAddressCidrBlocksElement = '[POD_ADDRESS_CIDR_BLOCKS]';
$azureClusterNetworkingServiceAddressCidrBlocksElement = '[SERVICE_ADDRESS_CIDR_BLOCKS]';
$azureClusterControlPlaneVersion = '[VERSION]';
$azureClusterControlPlaneSshConfigAuthorizedKey = '[AUTHORIZED_KEY]';
$azureClusterAuthorizationAdminUsersUsername = '[USERNAME]';
update_azure_cluster_sample(
$azureClusterAzureRegion,
$azureClusterResourceGroupId,
$azureClusterAzureClient,
$azureClusterNetworkingVirtualNetworkId,
$azureClusterNetworkingPodAddressCidrBlocksElement,
$azureClusterNetworkingServiceAddressCidrBlocksElement,
$azureClusterControlPlaneVersion,
$azureClusterControlPlaneSshConfigAuthorizedKey,
$azureClusterAuthorizationAdminUsersUsername
);
}
updateAzureNodePool
Updates an AzureNodePool.
Parameters | |
---|---|
Name | Description |
azureNodePool |
Google\Cloud\GkeMultiCloud\V1\AzureNodePool
Required. The AzureNodePool resource to update. |
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: *. |
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 {@see} object, or an associative array of retry settings parameters. See the documentation on {@see} for example usage. |
Returns | |
---|---|
Type | Description |
Google\ApiCore\OperationResponse |
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\GkeMultiCloud\V1\AzureClustersClient;
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\MaxPodsConstraint;
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 any non-scalar elements to be passed along with the request.
$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();
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $azureClustersClient->updateAzureNodePool($azureNodePool, $updateMask);
$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.