Reference documentation and code samples for the Compute V1 Client class InstanceGroupManagersClient.
Service Description: The InstanceGroupManagers API.
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:
$instanceGroupManagersClient = new InstanceGroupManagersClient();
try {
$instanceGroupManager = 'instance_group_manager';
$instanceGroupManagersAbandonInstancesRequestResource = new InstanceGroupManagersAbandonInstancesRequest();
$project = 'project';
$zone = 'zone';
$operationResponse = $instanceGroupManagersClient->abandonInstances($instanceGroupManager, $instanceGroupManagersAbandonInstancesRequestResource, $project, $zone);
$operationResponse->pollUntilComplete();
if ($operationResponse->operationSucceeded()) {
// if creating/modifying, retrieve the target resource
} else {
$error = $operationResponse->getError();
// handleError($error)
}
// Alternatively:
// start the operation, keep the operation name, and resume later
$operationResponse = $instanceGroupManagersClient->abandonInstances($instanceGroupManager, $instanceGroupManagersAbandonInstancesRequestResource, $project, $zone);
$operationName = $operationResponse->getName();
// ... do other work
$newOperationResponse = $instanceGroupManagersClient->resumeOperation($operationName, 'abandonInstances');
while (!$newOperationResponse->isDone()) {
// ... do other work
$newOperationResponse->reload();
}
if ($newOperationResponse->operationSucceeded()) {
// if creating/modifying, retrieve the target resource
} else {
$error = $newOperationResponse->getError();
// handleError($error)
}
} finally {
$instanceGroupManagersClient->close();
}
Methods
getOperationsClient
Return an ZoneOperationsClient object with the same endpoint as $this.
Returns | |
---|---|
Type | Description |
Google\Cloud\Compute\V1\ZoneOperationsClient |
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. At the moment, supports only |
↳ 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 = [ 'rest' => [...], ]; See the {@see} method 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. |
abandonInstances
Flags the specified instances to be removed from the managed instance group. Abandoning an instance does not delete the instance, but it does remove the instance from any target pools that are applied by the managed instance group. This method reduces the targetSize of the managed instance group by the number of instances that you abandon. This operation is marked as DONE when the action is scheduled even if the instances have not yet been removed from the group. You must separately verify the status of the abandoning action with the listmanagedinstances method. If the group is part of a backend service that has enabled connection draining, it can take up to 60 seconds after the connection draining duration has elapsed before the VM instance is removed or deleted. You can specify a maximum of 1000 instances with this method per request.
Sample code:
$instanceGroupManagersClient = new InstanceGroupManagersClient();
try {
$instanceGroupManager = 'instance_group_manager';
$instanceGroupManagersAbandonInstancesRequestResource = new InstanceGroupManagersAbandonInstancesRequest();
$project = 'project';
$zone = 'zone';
$operationResponse = $instanceGroupManagersClient->abandonInstances($instanceGroupManager, $instanceGroupManagersAbandonInstancesRequestResource, $project, $zone);
$operationResponse->pollUntilComplete();
if ($operationResponse->operationSucceeded()) {
// if creating/modifying, retrieve the target resource
} else {
$error = $operationResponse->getError();
// handleError($error)
}
// Alternatively:
// start the operation, keep the operation name, and resume later
$operationResponse = $instanceGroupManagersClient->abandonInstances($instanceGroupManager, $instanceGroupManagersAbandonInstancesRequestResource, $project, $zone);
$operationName = $operationResponse->getName();
// ... do other work
$newOperationResponse = $instanceGroupManagersClient->resumeOperation($operationName, 'abandonInstances');
while (!$newOperationResponse->isDone()) {
// ... do other work
$newOperationResponse->reload();
}
if ($newOperationResponse->operationSucceeded()) {
// if creating/modifying, retrieve the target resource
} else {
$error = $newOperationResponse->getError();
// handleError($error)
}
} finally {
$instanceGroupManagersClient->close();
}
Parameters | |
---|---|
Name | Description |
instanceGroupManager |
string
The name of the managed instance group. |
instanceGroupManagersAbandonInstancesRequestResource |
Google\Cloud\Compute\V1\InstanceGroupManagersAbandonInstancesRequest
The body resource for this request |
project |
string
Project ID for this request. |
zone |
string
The name of the zone where the managed instance group is located. |
optionalArgs |
array
Optional. |
↳ requestId |
string
An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported ( 00000000-0000-0000-0000-000000000000). |
↳ 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 |
aggregatedList
Retrieves the list of managed instance groups and groups them by zone.
Sample code:
$instanceGroupManagersClient = new InstanceGroupManagersClient();
try {
$project = 'project';
// Iterate over pages of elements
$pagedResponse = $instanceGroupManagersClient->aggregatedList($project);
foreach ($pagedResponse->iteratePages() as $page) {
foreach ($page as $key => $element) {
// doSomethingWith($element);
}
}
// Alternatively:
// Iterate through all elements
$pagedResponse = $instanceGroupManagersClient->aggregatedList($project);
foreach ($pagedResponse->iterateAllElements() as $element) {
// doSomethingWith($element);
}
} finally {
$instanceGroupManagersClient->close();
}
Parameters | |
---|---|
Name | Description |
project |
string
Project ID for this request. |
optionalArgs |
array
Optional. |
↳ filter |
string
A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either |
↳ includeAllScopes |
bool
Indicates whether every visible scope for each scope type (zone, region, global) should be included in the response. For new resource types added after this field, the flag has no effect as new resource types will always include every visible scope for each scope type in response. For resource types which predate this field, if this flag is omitted or false, only scopes of the scope types where the resource type is expected to be found will be included. |
↳ maxResults |
int
The maximum number of results per page that should be returned. If the number of available results is larger than |
↳ orderBy |
string
Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using |
↳ 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. |
↳ returnPartialSuccess |
bool
Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. |
↳ 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 |
applyUpdatesToInstances
Applies changes to selected instances on the managed instance group. This method can be used to apply new overrides and/or new versions.
Sample code:
$instanceGroupManagersClient = new InstanceGroupManagersClient();
try {
$instanceGroupManager = 'instance_group_manager';
$instanceGroupManagersApplyUpdatesRequestResource = new InstanceGroupManagersApplyUpdatesRequest();
$project = 'project';
$zone = 'zone';
$operationResponse = $instanceGroupManagersClient->applyUpdatesToInstances($instanceGroupManager, $instanceGroupManagersApplyUpdatesRequestResource, $project, $zone);
$operationResponse->pollUntilComplete();
if ($operationResponse->operationSucceeded()) {
// if creating/modifying, retrieve the target resource
} else {
$error = $operationResponse->getError();
// handleError($error)
}
// Alternatively:
// start the operation, keep the operation name, and resume later
$operationResponse = $instanceGroupManagersClient->applyUpdatesToInstances($instanceGroupManager, $instanceGroupManagersApplyUpdatesRequestResource, $project, $zone);
$operationName = $operationResponse->getName();
// ... do other work
$newOperationResponse = $instanceGroupManagersClient->resumeOperation($operationName, 'applyUpdatesToInstances');
while (!$newOperationResponse->isDone()) {
// ... do other work
$newOperationResponse->reload();
}
if ($newOperationResponse->operationSucceeded()) {
// if creating/modifying, retrieve the target resource
} else {
$error = $newOperationResponse->getError();
// handleError($error)
}
} finally {
$instanceGroupManagersClient->close();
}
Parameters | |
---|---|
Name | Description |
instanceGroupManager |
string
The name of the managed instance group, should conform to RFC1035. |
instanceGroupManagersApplyUpdatesRequestResource |
Google\Cloud\Compute\V1\InstanceGroupManagersApplyUpdatesRequest
The body resource for this request |
project |
string
Project ID for this request. |
zone |
string
The name of the zone where the managed instance group is located. Should conform to RFC1035. |
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\ApiCore\OperationResponse |
createInstances
Creates instances with per-instance configurations in this managed instance group. Instances are created using the current instance template. The create instances operation is marked DONE if the createInstances request is successful. The underlying actions take additional time. You must separately verify the status of the creating or actions with the listmanagedinstances method.
Sample code:
$instanceGroupManagersClient = new InstanceGroupManagersClient();
try {
$instanceGroupManager = 'instance_group_manager';
$instanceGroupManagersCreateInstancesRequestResource = new InstanceGroupManagersCreateInstancesRequest();
$project = 'project';
$zone = 'zone';
$operationResponse = $instanceGroupManagersClient->createInstances($instanceGroupManager, $instanceGroupManagersCreateInstancesRequestResource, $project, $zone);
$operationResponse->pollUntilComplete();
if ($operationResponse->operationSucceeded()) {
// if creating/modifying, retrieve the target resource
} else {
$error = $operationResponse->getError();
// handleError($error)
}
// Alternatively:
// start the operation, keep the operation name, and resume later
$operationResponse = $instanceGroupManagersClient->createInstances($instanceGroupManager, $instanceGroupManagersCreateInstancesRequestResource, $project, $zone);
$operationName = $operationResponse->getName();
// ... do other work
$newOperationResponse = $instanceGroupManagersClient->resumeOperation($operationName, 'createInstances');
while (!$newOperationResponse->isDone()) {
// ... do other work
$newOperationResponse->reload();
}
if ($newOperationResponse->operationSucceeded()) {
// if creating/modifying, retrieve the target resource
} else {
$error = $newOperationResponse->getError();
// handleError($error)
}
} finally {
$instanceGroupManagersClient->close();
}
Parameters | |
---|---|
Name | Description |
instanceGroupManager |
string
The name of the managed instance group. It should conform to RFC1035. |
instanceGroupManagersCreateInstancesRequestResource |
Google\Cloud\Compute\V1\InstanceGroupManagersCreateInstancesRequest
The body resource for this request |
project |
string
Project ID for this request. |
zone |
string
The name of the zone where the managed instance group is located. It should conform to RFC1035. |
optionalArgs |
array
Optional. |
↳ requestId |
string
An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. The request ID must be a valid UUID with the exception that zero UUID is not supported ( 00000000-0000-0000-0000-000000000000). |
↳ 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 |
delete
Deletes the specified managed instance group and all of the instances in that group. Note that the instance group must not belong to a backend service. Read Deleting an instance group for more information.
Sample code:
$instanceGroupManagersClient = new InstanceGroupManagersClient();
try {
$instanceGroupManager = 'instance_group_manager';
$project = 'project';
$zone = 'zone';
$operationResponse = $instanceGroupManagersClient->delete($instanceGroupManager, $project, $zone);
$operationResponse->pollUntilComplete();
if ($operationResponse->operationSucceeded()) {
// if creating/modifying, retrieve the target resource
} else {
$error = $operationResponse->getError();
// handleError($error)
}
// Alternatively:
// start the operation, keep the operation name, and resume later
$operationResponse = $instanceGroupManagersClient->delete($instanceGroupManager, $project, $zone);
$operationName = $operationResponse->getName();
// ... do other work
$newOperationResponse = $instanceGroupManagersClient->resumeOperation($operationName, 'delete');
while (!$newOperationResponse->isDone()) {
// ... do other work
$newOperationResponse->reload();
}
if ($newOperationResponse->operationSucceeded()) {
// if creating/modifying, retrieve the target resource
} else {
$error = $newOperationResponse->getError();
// handleError($error)
}
} finally {
$instanceGroupManagersClient->close();
}
Parameters | |
---|---|
Name | Description |
instanceGroupManager |
string
The name of the managed instance group to delete. |
project |
string
Project ID for this request. |
zone |
string
The name of the zone where the managed instance group is located. |
optionalArgs |
array
Optional. |
↳ requestId |
string
An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported ( 00000000-0000-0000-0000-000000000000). |
↳ 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 |
deleteInstances
Flags the specified instances in the managed instance group for immediate deletion. The instances are also removed from any target pools of which they were a member. This method reduces the targetSize of the managed instance group by the number of instances that you delete. This operation is marked as DONE when the action is scheduled even if the instances are still being deleted. You must separately verify the status of the deleting action with the listmanagedinstances method. If the group is part of a backend service that has enabled connection draining, it can take up to 60 seconds after the connection draining duration has elapsed before the VM instance is removed or deleted. You can specify a maximum of 1000 instances with this method per request.
Sample code:
$instanceGroupManagersClient = new InstanceGroupManagersClient();
try {
$instanceGroupManager = 'instance_group_manager';
$instanceGroupManagersDeleteInstancesRequestResource = new InstanceGroupManagersDeleteInstancesRequest();
$project = 'project';
$zone = 'zone';
$operationResponse = $instanceGroupManagersClient->deleteInstances($instanceGroupManager, $instanceGroupManagersDeleteInstancesRequestResource, $project, $zone);
$operationResponse->pollUntilComplete();
if ($operationResponse->operationSucceeded()) {
// if creating/modifying, retrieve the target resource
} else {
$error = $operationResponse->getError();
// handleError($error)
}
// Alternatively:
// start the operation, keep the operation name, and resume later
$operationResponse = $instanceGroupManagersClient->deleteInstances($instanceGroupManager, $instanceGroupManagersDeleteInstancesRequestResource, $project, $zone);
$operationName = $operationResponse->getName();
// ... do other work
$newOperationResponse = $instanceGroupManagersClient->resumeOperation($operationName, 'deleteInstances');
while (!$newOperationResponse->isDone()) {
// ... do other work
$newOperationResponse->reload();
}
if ($newOperationResponse->operationSucceeded()) {
// if creating/modifying, retrieve the target resource
} else {
$error = $newOperationResponse->getError();
// handleError($error)
}
} finally {
$instanceGroupManagersClient->close();
}
Parameters | |
---|---|
Name | Description |
instanceGroupManager |
string
The name of the managed instance group. |
instanceGroupManagersDeleteInstancesRequestResource |
Google\Cloud\Compute\V1\InstanceGroupManagersDeleteInstancesRequest
The body resource for this request |
project |
string
Project ID for this request. |
zone |
string
The name of the zone where the managed instance group is located. |
optionalArgs |
array
Optional. |
↳ requestId |
string
An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported ( 00000000-0000-0000-0000-000000000000). |
↳ 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 |
deletePerInstanceConfigs
Deletes selected per-instance configurations for the managed instance group.
Sample code:
$instanceGroupManagersClient = new InstanceGroupManagersClient();
try {
$instanceGroupManager = 'instance_group_manager';
$instanceGroupManagersDeletePerInstanceConfigsReqResource = new InstanceGroupManagersDeletePerInstanceConfigsReq();
$project = 'project';
$zone = 'zone';
$operationResponse = $instanceGroupManagersClient->deletePerInstanceConfigs($instanceGroupManager, $instanceGroupManagersDeletePerInstanceConfigsReqResource, $project, $zone);
$operationResponse->pollUntilComplete();
if ($operationResponse->operationSucceeded()) {
// if creating/modifying, retrieve the target resource
} else {
$error = $operationResponse->getError();
// handleError($error)
}
// Alternatively:
// start the operation, keep the operation name, and resume later
$operationResponse = $instanceGroupManagersClient->deletePerInstanceConfigs($instanceGroupManager, $instanceGroupManagersDeletePerInstanceConfigsReqResource, $project, $zone);
$operationName = $operationResponse->getName();
// ... do other work
$newOperationResponse = $instanceGroupManagersClient->resumeOperation($operationName, 'deletePerInstanceConfigs');
while (!$newOperationResponse->isDone()) {
// ... do other work
$newOperationResponse->reload();
}
if ($newOperationResponse->operationSucceeded()) {
// if creating/modifying, retrieve the target resource
} else {
$error = $newOperationResponse->getError();
// handleError($error)
}
} finally {
$instanceGroupManagersClient->close();
}
Parameters | |
---|---|
Name | Description |
instanceGroupManager |
string
The name of the managed instance group. It should conform to RFC1035. |
instanceGroupManagersDeletePerInstanceConfigsReqResource |
Google\Cloud\Compute\V1\InstanceGroupManagersDeletePerInstanceConfigsReq
The body resource for this request |
project |
string
Project ID for this request. |
zone |
string
The name of the zone where the managed instance group is located. It should conform to RFC1035. |
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\ApiCore\OperationResponse |
get
Returns all of the details about the specified managed instance group. Gets a list of available managed instance groups by making a list() request.
Sample code:
$instanceGroupManagersClient = new InstanceGroupManagersClient();
try {
$instanceGroupManager = 'instance_group_manager';
$project = 'project';
$zone = 'zone';
$response = $instanceGroupManagersClient->get($instanceGroupManager, $project, $zone);
} finally {
$instanceGroupManagersClient->close();
}
Parameters | |
---|---|
Name | Description |
instanceGroupManager |
string
The name of the managed instance group. |
project |
string
Project ID for this request. |
zone |
string
The name of the zone where the managed instance group is located. |
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\Compute\V1\InstanceGroupManager |
insert
Creates a managed instance group using the information that you specify in the request. After the group is created, instances in the group are created using the specified instance template. This operation is marked as DONE when the group is created even if the instances in the group have not yet been created. You must separately verify the status of the individual instances with the listmanagedinstances method. A managed instance group can have up to 1000 VM instances per group. Please contact Cloud Support if you need an increase in this limit.
Sample code:
$instanceGroupManagersClient = new InstanceGroupManagersClient();
try {
$instanceGroupManagerResource = new InstanceGroupManager();
$project = 'project';
$zone = 'zone';
$operationResponse = $instanceGroupManagersClient->insert($instanceGroupManagerResource, $project, $zone);
$operationResponse->pollUntilComplete();
if ($operationResponse->operationSucceeded()) {
// if creating/modifying, retrieve the target resource
} else {
$error = $operationResponse->getError();
// handleError($error)
}
// Alternatively:
// start the operation, keep the operation name, and resume later
$operationResponse = $instanceGroupManagersClient->insert($instanceGroupManagerResource, $project, $zone);
$operationName = $operationResponse->getName();
// ... do other work
$newOperationResponse = $instanceGroupManagersClient->resumeOperation($operationName, 'insert');
while (!$newOperationResponse->isDone()) {
// ... do other work
$newOperationResponse->reload();
}
if ($newOperationResponse->operationSucceeded()) {
// if creating/modifying, retrieve the target resource
} else {
$error = $newOperationResponse->getError();
// handleError($error)
}
} finally {
$instanceGroupManagersClient->close();
}
Parameters | |
---|---|
Name | Description |
instanceGroupManagerResource |
Google\Cloud\Compute\V1\InstanceGroupManager
The body resource for this request |
project |
string
Project ID for this request. |
zone |
string
The name of the zone where you want to create the managed instance group. |
optionalArgs |
array
Optional. |
↳ requestId |
string
An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported ( 00000000-0000-0000-0000-000000000000). |
↳ 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 |
list
Retrieves a list of managed instance groups that are contained within the specified project and zone.
Sample code:
$instanceGroupManagersClient = new InstanceGroupManagersClient();
try {
$project = 'project';
$zone = 'zone';
// Iterate over pages of elements
$pagedResponse = $instanceGroupManagersClient->list($project, $zone);
foreach ($pagedResponse->iteratePages() as $page) {
foreach ($page as $element) {
// doSomethingWith($element);
}
}
// Alternatively:
// Iterate through all elements
$pagedResponse = $instanceGroupManagersClient->list($project, $zone);
foreach ($pagedResponse->iterateAllElements() as $element) {
// doSomethingWith($element);
}
} finally {
$instanceGroupManagersClient->close();
}
Parameters | |
---|---|
Name | Description |
project |
string
Project ID for this request. |
zone |
string
The name of the zone where the managed instance group is located. |
optionalArgs |
array
Optional. |
↳ filter |
string
A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either |
↳ maxResults |
int
The maximum number of results per page that should be returned. If the number of available results is larger than |
↳ orderBy |
string
Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using |
↳ 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. |
↳ returnPartialSuccess |
bool
Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. |
↳ 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 |
listErrors
Lists all errors thrown by actions on instances for a given managed instance group. The filter and orderBy query parameters are not supported.
Sample code:
$instanceGroupManagersClient = new InstanceGroupManagersClient();
try {
$instanceGroupManager = 'instance_group_manager';
$project = 'project';
$zone = 'zone';
// Iterate over pages of elements
$pagedResponse = $instanceGroupManagersClient->listErrors($instanceGroupManager, $project, $zone);
foreach ($pagedResponse->iteratePages() as $page) {
foreach ($page as $element) {
// doSomethingWith($element);
}
}
// Alternatively:
// Iterate through all elements
$pagedResponse = $instanceGroupManagersClient->listErrors($instanceGroupManager, $project, $zone);
foreach ($pagedResponse->iterateAllElements() as $element) {
// doSomethingWith($element);
}
} finally {
$instanceGroupManagersClient->close();
}
Parameters | |
---|---|
Name | Description |
instanceGroupManager |
string
The name of the managed instance group. It must be a string that meets the requirements in RFC1035, or an unsigned long integer: must match regexp pattern: (?:a-z?)|1-9{0,19}. |
project |
string
Project ID for this request. |
zone |
string
The name of the zone where the managed instance group is located. It should conform to RFC1035. |
optionalArgs |
array
Optional. |
↳ filter |
string
A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either |
↳ maxResults |
int
The maximum number of results per page that should be returned. If the number of available results is larger than |
↳ orderBy |
string
Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using |
↳ 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. |
↳ returnPartialSuccess |
bool
Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. |
↳ 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 |
listManagedInstances
Lists all of the instances in the managed instance group. Each instance in the list has a currentAction, which indicates the action that the managed instance group is performing on the instance. For example, if the group is still creating an instance, the currentAction is CREATING. If a previous action failed, the list displays the errors for that failed action. The orderBy query parameter is not supported. The pageToken
query parameter is supported only in the alpha and beta API and only if the group's listManagedInstancesResults
field is set to PAGINATED
.
Sample code:
$instanceGroupManagersClient = new InstanceGroupManagersClient();
try {
$instanceGroupManager = 'instance_group_manager';
$project = 'project';
$zone = 'zone';
// Iterate over pages of elements
$pagedResponse = $instanceGroupManagersClient->listManagedInstances($instanceGroupManager, $project, $zone);
foreach ($pagedResponse->iteratePages() as $page) {
foreach ($page as $element) {
// doSomethingWith($element);
}
}
// Alternatively:
// Iterate through all elements
$pagedResponse = $instanceGroupManagersClient->listManagedInstances($instanceGroupManager, $project, $zone);
foreach ($pagedResponse->iterateAllElements() as $element) {
// doSomethingWith($element);
}
} finally {
$instanceGroupManagersClient->close();
}
Parameters | |
---|---|
Name | Description |
instanceGroupManager |
string
The name of the managed instance group. |
project |
string
Project ID for this request. |
zone |
string
The name of the zone where the managed instance group is located. |
optionalArgs |
array
Optional. |
↳ filter |
string
A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either |
↳ maxResults |
int
The maximum number of results per page that should be returned. If the number of available results is larger than |
↳ orderBy |
string
Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using |
↳ 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. |
↳ returnPartialSuccess |
bool
Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. |
↳ 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 |
listPerInstanceConfigs
Lists all of the per-instance configurations defined for the managed instance group. The orderBy query parameter is not supported.
Sample code:
$instanceGroupManagersClient = new InstanceGroupManagersClient();
try {
$instanceGroupManager = 'instance_group_manager';
$project = 'project';
$zone = 'zone';
// Iterate over pages of elements
$pagedResponse = $instanceGroupManagersClient->listPerInstanceConfigs($instanceGroupManager, $project, $zone);
foreach ($pagedResponse->iteratePages() as $page) {
foreach ($page as $element) {
// doSomethingWith($element);
}
}
// Alternatively:
// Iterate through all elements
$pagedResponse = $instanceGroupManagersClient->listPerInstanceConfigs($instanceGroupManager, $project, $zone);
foreach ($pagedResponse->iterateAllElements() as $element) {
// doSomethingWith($element);
}
} finally {
$instanceGroupManagersClient->close();
}
Parameters | |
---|---|
Name | Description |
instanceGroupManager |
string
The name of the managed instance group. It should conform to RFC1035. |
project |
string
Project ID for this request. |
zone |
string
The name of the zone where the managed instance group is located. It should conform to RFC1035. |
optionalArgs |
array
Optional. |
↳ filter |
string
A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either |
↳ maxResults |
int
The maximum number of results per page that should be returned. If the number of available results is larger than |
↳ orderBy |
string
Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using |
↳ 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. |
↳ returnPartialSuccess |
bool
Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. |
↳ 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 |
patch
Updates a managed instance group using the information that you specify in the request. This operation is marked as DONE when the group is patched even if the instances in the group are still in the process of being patched. You must separately verify the status of the individual instances with the listManagedInstances method. This method supports PATCH semantics and uses the JSON merge patch format and processing rules. If you update your group to specify a new template or instance configuration, it's possible that your intended specification for each VM in the group is different from the current state of that VM. To learn how to apply an updated configuration to the VMs in a MIG, see Updating instances in a MIG.
Sample code:
$instanceGroupManagersClient = new InstanceGroupManagersClient();
try {
$instanceGroupManager = 'instance_group_manager';
$instanceGroupManagerResource = new InstanceGroupManager();
$project = 'project';
$zone = 'zone';
$operationResponse = $instanceGroupManagersClient->patch($instanceGroupManager, $instanceGroupManagerResource, $project, $zone);
$operationResponse->pollUntilComplete();
if ($operationResponse->operationSucceeded()) {
// if creating/modifying, retrieve the target resource
} else {
$error = $operationResponse->getError();
// handleError($error)
}
// Alternatively:
// start the operation, keep the operation name, and resume later
$operationResponse = $instanceGroupManagersClient->patch($instanceGroupManager, $instanceGroupManagerResource, $project, $zone);
$operationName = $operationResponse->getName();
// ... do other work
$newOperationResponse = $instanceGroupManagersClient->resumeOperation($operationName, 'patch');
while (!$newOperationResponse->isDone()) {
// ... do other work
$newOperationResponse->reload();
}
if ($newOperationResponse->operationSucceeded()) {
// if creating/modifying, retrieve the target resource
} else {
$error = $newOperationResponse->getError();
// handleError($error)
}
} finally {
$instanceGroupManagersClient->close();
}
Parameters | |
---|---|
Name | Description |
instanceGroupManager |
string
The name of the instance group manager. |
instanceGroupManagerResource |
Google\Cloud\Compute\V1\InstanceGroupManager
The body resource for this request |
project |
string
Project ID for this request. |
zone |
string
The name of the zone where you want to create the managed instance group. |
optionalArgs |
array
Optional. |
↳ requestId |
string
An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported ( 00000000-0000-0000-0000-000000000000). |
↳ 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 |
patchPerInstanceConfigs
Inserts or patches per-instance configurations for the managed instance group. perInstanceConfig.name serves as a key used to distinguish whether to perform insert or patch.
Sample code:
$instanceGroupManagersClient = new InstanceGroupManagersClient();
try {
$instanceGroupManager = 'instance_group_manager';
$instanceGroupManagersPatchPerInstanceConfigsReqResource = new InstanceGroupManagersPatchPerInstanceConfigsReq();
$project = 'project';
$zone = 'zone';
$operationResponse = $instanceGroupManagersClient->patchPerInstanceConfigs($instanceGroupManager, $instanceGroupManagersPatchPerInstanceConfigsReqResource, $project, $zone);
$operationResponse->pollUntilComplete();
if ($operationResponse->operationSucceeded()) {
// if creating/modifying, retrieve the target resource
} else {
$error = $operationResponse->getError();
// handleError($error)
}
// Alternatively:
// start the operation, keep the operation name, and resume later
$operationResponse = $instanceGroupManagersClient->patchPerInstanceConfigs($instanceGroupManager, $instanceGroupManagersPatchPerInstanceConfigsReqResource, $project, $zone);
$operationName = $operationResponse->getName();
// ... do other work
$newOperationResponse = $instanceGroupManagersClient->resumeOperation($operationName, 'patchPerInstanceConfigs');
while (!$newOperationResponse->isDone()) {
// ... do other work
$newOperationResponse->reload();
}
if ($newOperationResponse->operationSucceeded()) {
// if creating/modifying, retrieve the target resource
} else {
$error = $newOperationResponse->getError();
// handleError($error)
}
} finally {
$instanceGroupManagersClient->close();
}
Parameters | |
---|---|
Name | Description |
instanceGroupManager |
string
The name of the managed instance group. It should conform to RFC1035. |
instanceGroupManagersPatchPerInstanceConfigsReqResource |
Google\Cloud\Compute\V1\InstanceGroupManagersPatchPerInstanceConfigsReq
The body resource for this request |
project |
string
Project ID for this request. |
zone |
string
The name of the zone where the managed instance group is located. It should conform to RFC1035. |
optionalArgs |
array
Optional. |
↳ requestId |
string
An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported ( 00000000-0000-0000-0000-000000000000). |
↳ 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 |
recreateInstances
Flags the specified VM instances in the managed instance group to be immediately recreated. Each instance is recreated using the group's current configuration. This operation is marked as DONE when the flag is set even if the instances have not yet been recreated. You must separately verify the status of each instance by checking its currentAction field; for more information, see Checking the status of managed instances. If the group is part of a backend service that has enabled connection draining, it can take up to 60 seconds after the connection draining duration has elapsed before the VM instance is removed or deleted. You can specify a maximum of 1000 instances with this method per request.
Sample code:
$instanceGroupManagersClient = new InstanceGroupManagersClient();
try {
$instanceGroupManager = 'instance_group_manager';
$instanceGroupManagersRecreateInstancesRequestResource = new InstanceGroupManagersRecreateInstancesRequest();
$project = 'project';
$zone = 'zone';
$operationResponse = $instanceGroupManagersClient->recreateInstances($instanceGroupManager, $instanceGroupManagersRecreateInstancesRequestResource, $project, $zone);
$operationResponse->pollUntilComplete();
if ($operationResponse->operationSucceeded()) {
// if creating/modifying, retrieve the target resource
} else {
$error = $operationResponse->getError();
// handleError($error)
}
// Alternatively:
// start the operation, keep the operation name, and resume later
$operationResponse = $instanceGroupManagersClient->recreateInstances($instanceGroupManager, $instanceGroupManagersRecreateInstancesRequestResource, $project, $zone);
$operationName = $operationResponse->getName();
// ... do other work
$newOperationResponse = $instanceGroupManagersClient->resumeOperation($operationName, 'recreateInstances');
while (!$newOperationResponse->isDone()) {
// ... do other work
$newOperationResponse->reload();
}
if ($newOperationResponse->operationSucceeded()) {
// if creating/modifying, retrieve the target resource
} else {
$error = $newOperationResponse->getError();
// handleError($error)
}
} finally {
$instanceGroupManagersClient->close();
}
Parameters | |
---|---|
Name | Description |
instanceGroupManager |
string
The name of the managed instance group. |
instanceGroupManagersRecreateInstancesRequestResource |
Google\Cloud\Compute\V1\InstanceGroupManagersRecreateInstancesRequest
The body resource for this request |
project |
string
Project ID for this request. |
zone |
string
The name of the zone where the managed instance group is located. |
optionalArgs |
array
Optional. |
↳ requestId |
string
An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported ( 00000000-0000-0000-0000-000000000000). |
↳ 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 |
resize
Resizes the managed instance group. If you increase the size, the group creates new instances using the current instance template. If you decrease the size, the group deletes instances. The resize operation is marked DONE when the resize actions are scheduled even if the group has not yet added or deleted any instances. You must separately verify the status of the creating or deleting actions with the listmanagedinstances method. When resizing down, the instance group arbitrarily chooses the order in which VMs are deleted. The group takes into account some VM attributes when making the selection including: + The status of the VM instance. + The health of the VM instance. + The instance template version the VM is based on. + For regional managed instance groups, the location of the VM instance. This list is subject to change. If the group is part of a backend service that has enabled connection draining, it can take up to 60 seconds after the connection draining duration has elapsed before the VM instance is removed or deleted.
Sample code:
$instanceGroupManagersClient = new InstanceGroupManagersClient();
try {
$instanceGroupManager = 'instance_group_manager';
$project = 'project';
$size = 0;
$zone = 'zone';
$operationResponse = $instanceGroupManagersClient->resize($instanceGroupManager, $project, $size, $zone);
$operationResponse->pollUntilComplete();
if ($operationResponse->operationSucceeded()) {
// if creating/modifying, retrieve the target resource
} else {
$error = $operationResponse->getError();
// handleError($error)
}
// Alternatively:
// start the operation, keep the operation name, and resume later
$operationResponse = $instanceGroupManagersClient->resize($instanceGroupManager, $project, $size, $zone);
$operationName = $operationResponse->getName();
// ... do other work
$newOperationResponse = $instanceGroupManagersClient->resumeOperation($operationName, 'resize');
while (!$newOperationResponse->isDone()) {
// ... do other work
$newOperationResponse->reload();
}
if ($newOperationResponse->operationSucceeded()) {
// if creating/modifying, retrieve the target resource
} else {
$error = $newOperationResponse->getError();
// handleError($error)
}
} finally {
$instanceGroupManagersClient->close();
}
Parameters | |
---|---|
Name | Description |
instanceGroupManager |
string
The name of the managed instance group. |
project |
string
Project ID for this request. |
size |
int
The number of running instances that the managed instance group should maintain at any given time. The group automatically adds or removes instances to maintain the number of instances specified by this parameter. |
zone |
string
The name of the zone where the managed instance group is located. |
optionalArgs |
array
Optional. |
↳ requestId |
string
An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported ( 00000000-0000-0000-0000-000000000000). |
↳ 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 |
setInstanceTemplate
Specifies the instance template to use when creating new instances in this group. The templates for existing instances in the group do not change unless you run recreateInstances, run applyUpdatesToInstances, or set the group's updatePolicy.type to PROACTIVE.
Sample code:
$instanceGroupManagersClient = new InstanceGroupManagersClient();
try {
$instanceGroupManager = 'instance_group_manager';
$instanceGroupManagersSetInstanceTemplateRequestResource = new InstanceGroupManagersSetInstanceTemplateRequest();
$project = 'project';
$zone = 'zone';
$operationResponse = $instanceGroupManagersClient->setInstanceTemplate($instanceGroupManager, $instanceGroupManagersSetInstanceTemplateRequestResource, $project, $zone);
$operationResponse->pollUntilComplete();
if ($operationResponse->operationSucceeded()) {
// if creating/modifying, retrieve the target resource
} else {
$error = $operationResponse->getError();
// handleError($error)
}
// Alternatively:
// start the operation, keep the operation name, and resume later
$operationResponse = $instanceGroupManagersClient->setInstanceTemplate($instanceGroupManager, $instanceGroupManagersSetInstanceTemplateRequestResource, $project, $zone);
$operationName = $operationResponse->getName();
// ... do other work
$newOperationResponse = $instanceGroupManagersClient->resumeOperation($operationName, 'setInstanceTemplate');
while (!$newOperationResponse->isDone()) {
// ... do other work
$newOperationResponse->reload();
}
if ($newOperationResponse->operationSucceeded()) {
// if creating/modifying, retrieve the target resource
} else {
$error = $newOperationResponse->getError();
// handleError($error)
}
} finally {
$instanceGroupManagersClient->close();
}
Parameters | |
---|---|
Name | Description |
instanceGroupManager |
string
The name of the managed instance group. |
instanceGroupManagersSetInstanceTemplateRequestResource |
Google\Cloud\Compute\V1\InstanceGroupManagersSetInstanceTemplateRequest
The body resource for this request |
project |
string
Project ID for this request. |
zone |
string
The name of the zone where the managed instance group is located. |
optionalArgs |
array
Optional. |
↳ requestId |
string
An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported ( 00000000-0000-0000-0000-000000000000). |
↳ 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 |
setTargetPools
Modifies the target pools to which all instances in this managed instance group are assigned. The target pools automatically apply to all of the instances in the managed instance group. This operation is marked DONE when you make the request even if the instances have not yet been added to their target pools. The change might take some time to apply to all of the instances in the group depending on the size of the group.
Sample code:
$instanceGroupManagersClient = new InstanceGroupManagersClient();
try {
$instanceGroupManager = 'instance_group_manager';
$instanceGroupManagersSetTargetPoolsRequestResource = new InstanceGroupManagersSetTargetPoolsRequest();
$project = 'project';
$zone = 'zone';
$operationResponse = $instanceGroupManagersClient->setTargetPools($instanceGroupManager, $instanceGroupManagersSetTargetPoolsRequestResource, $project, $zone);
$operationResponse->pollUntilComplete();
if ($operationResponse->operationSucceeded()) {
// if creating/modifying, retrieve the target resource
} else {
$error = $operationResponse->getError();
// handleError($error)
}
// Alternatively:
// start the operation, keep the operation name, and resume later
$operationResponse = $instanceGroupManagersClient->setTargetPools($instanceGroupManager, $instanceGroupManagersSetTargetPoolsRequestResource, $project, $zone);
$operationName = $operationResponse->getName();
// ... do other work
$newOperationResponse = $instanceGroupManagersClient->resumeOperation($operationName, 'setTargetPools');
while (!$newOperationResponse->isDone()) {
// ... do other work
$newOperationResponse->reload();
}
if ($newOperationResponse->operationSucceeded()) {
// if creating/modifying, retrieve the target resource
} else {
$error = $newOperationResponse->getError();
// handleError($error)
}
} finally {
$instanceGroupManagersClient->close();
}
Parameters | |
---|---|
Name | Description |
instanceGroupManager |
string
The name of the managed instance group. |
instanceGroupManagersSetTargetPoolsRequestResource |
Google\Cloud\Compute\V1\InstanceGroupManagersSetTargetPoolsRequest
The body resource for this request |
project |
string
Project ID for this request. |
zone |
string
The name of the zone where the managed instance group is located. |
optionalArgs |
array
Optional. |
↳ requestId |
string
An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported ( 00000000-0000-0000-0000-000000000000). |
↳ 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 |
updatePerInstanceConfigs
Inserts or updates per-instance configurations for the managed instance group. perInstanceConfig.name serves as a key used to distinguish whether to perform insert or patch.
Sample code:
$instanceGroupManagersClient = new InstanceGroupManagersClient();
try {
$instanceGroupManager = 'instance_group_manager';
$instanceGroupManagersUpdatePerInstanceConfigsReqResource = new InstanceGroupManagersUpdatePerInstanceConfigsReq();
$project = 'project';
$zone = 'zone';
$operationResponse = $instanceGroupManagersClient->updatePerInstanceConfigs($instanceGroupManager, $instanceGroupManagersUpdatePerInstanceConfigsReqResource, $project, $zone);
$operationResponse->pollUntilComplete();
if ($operationResponse->operationSucceeded()) {
// if creating/modifying, retrieve the target resource
} else {
$error = $operationResponse->getError();
// handleError($error)
}
// Alternatively:
// start the operation, keep the operation name, and resume later
$operationResponse = $instanceGroupManagersClient->updatePerInstanceConfigs($instanceGroupManager, $instanceGroupManagersUpdatePerInstanceConfigsReqResource, $project, $zone);
$operationName = $operationResponse->getName();
// ... do other work
$newOperationResponse = $instanceGroupManagersClient->resumeOperation($operationName, 'updatePerInstanceConfigs');
while (!$newOperationResponse->isDone()) {
// ... do other work
$newOperationResponse->reload();
}
if ($newOperationResponse->operationSucceeded()) {
// if creating/modifying, retrieve the target resource
} else {
$error = $newOperationResponse->getError();
// handleError($error)
}
} finally {
$instanceGroupManagersClient->close();
}
Parameters | |
---|---|
Name | Description |
instanceGroupManager |
string
The name of the managed instance group. It should conform to RFC1035. |
instanceGroupManagersUpdatePerInstanceConfigsReqResource |
Google\Cloud\Compute\V1\InstanceGroupManagersUpdatePerInstanceConfigsReq
The body resource for this request |
project |
string
Project ID for this request. |
zone |
string
The name of the zone where the managed instance group is located. It should conform to RFC1035. |
optionalArgs |
array
Optional. |
↳ requestId |
string
An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported ( 00000000-0000-0000-0000-000000000000). |
↳ 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 |
Constants
SERVICE_NAME
Value: 'google.cloud.compute.v1.InstanceGroupManagers'
The name of the service.
SERVICE_ADDRESS
Value: 'compute.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.