Instances¶
- class google.cloud.compute_v1.services.instances.InstancesClient(*, credentials: typing.Optional[google.auth.credentials.Credentials] = None, transport: typing.Optional[typing.Union[str, google.cloud.compute_v1.services.instances.transports.base.InstancesTransport, typing.Callable[[...], google.cloud.compute_v1.services.instances.transports.base.InstancesTransport]]] = None, client_options: typing.Optional[typing.Union[google.api_core.client_options.ClientOptions, dict]] = None, client_info: google.api_core.gapic_v1.client_info.ClientInfo = <google.api_core.gapic_v1.client_info.ClientInfo object>)[source]¶
The Instances API.
Instantiates the instances client.
- Parameters
credentials (Optional[google.auth.credentials.Credentials]) – The authorization credentials to attach to requests. These credentials identify the application to the service; if none are specified, the client will attempt to ascertain the credentials from the environment.
transport (Optional[Union[str,InstancesTransport,Callable[..., InstancesTransport]]]) – The transport to use, or a Callable that constructs and returns a new transport. If a Callable is given, it will be called with the same set of initialization arguments as used in the InstancesTransport constructor. If set to None, a transport is chosen automatically. NOTE: “rest” transport functionality is currently in a beta state (preview). We welcome your feedback via an issue in this library’s source repository.
client_options (Optional[Union[google.api_core.client_options.ClientOptions, dict]]) –
Custom options for the client.
1. The
api_endpoint
property can be used to override the default endpoint provided by the client whentransport
is not explicitly provided. Only if this property is not set andtransport
was not explicitly provided, the endpoint is determined by the GOOGLE_API_USE_MTLS_ENDPOINT environment variable, which have one of the following values: “always” (always use the default mTLS endpoint), “never” (always use the default regular endpoint) and “auto” (auto-switch to the default mTLS endpoint if client certificate is present; this is the default value).2. If the GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable is “true”, then the
client_cert_source
property can be used to provide a client certificate for mTLS transport. If not provided, the default SSL client certificate will be used if present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is “false” or not set, no client certificate will be used.3. The
universe_domain
property can be used to override the default “googleapis.com” universe. Note that theapi_endpoint
property still takes precedence; anduniverse_domain
is currently not supported for mTLS.client_info (google.api_core.gapic_v1.client_info.ClientInfo) – The client info used to send a user-agent string along with API requests. If
None
, then default info will be used. Generally, you only need to set this if you’re developing your own client library.
- Raises
google.auth.exceptions.MutualTLSChannelError – If mutual TLS transport creation failed for any reason.
- __exit__(type, value, traceback)[source]¶
Releases underlying transport’s resources.
Warning
ONLY use as a context manager if the transport is NOT shared with other clients! Exiting the with block will CLOSE the transport and may cause errors in other clients!
- add_access_config(request: Optional[Union[google.cloud.compute_v1.types.compute.AddAccessConfigInstanceRequest, dict]] = None, *, project: Optional[str] = None, zone: Optional[str] = None, instance: Optional[str] = None, network_interface: Optional[str] = None, access_config_resource: Optional[google.cloud.compute_v1.types.compute.AccessConfig] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.api_core.extended_operation.ExtendedOperation [source]¶
Adds an access config to an instance’s network interface.
# This snippet 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 as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import compute_v1 def sample_add_access_config(): # Create a client client = compute_v1.InstancesClient() # Initialize request argument(s) request = compute_v1.AddAccessConfigInstanceRequest( instance="instance_value", network_interface="network_interface_value", project="project_value", zone="zone_value", ) # Make the request response = client.add_access_config(request=request) # Handle the response print(response)
- Parameters
request (Union[google.cloud.compute_v1.types.AddAccessConfigInstanceRequest, dict]) – The request object. A request message for Instances.AddAccessConfig. See the method description for details.
project (str) – Project ID for this request. This corresponds to the
project
field on therequest
instance; ifrequest
is provided, this should not be set.zone (str) –
The name of the zone for this request.
This corresponds to the
zone
field on therequest
instance; ifrequest
is provided, this should not be set.instance (str) – The instance name for this request. This corresponds to the
instance
field on therequest
instance; ifrequest
is provided, this should not be set.network_interface (str) –
The name of the network interface to add to this instance.
This corresponds to the
network_interface
field on therequest
instance; ifrequest
is provided, this should not be set.access_config_resource (google.cloud.compute_v1.types.AccessConfig) – The body resource for this request This corresponds to the
access_config_resource
field on therequest
instance; ifrequest
is provided, this should not be set.retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.
timeout (float) – The timeout for this request.
metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.
- Returns
An object representing a extended long-running operation.
- Return type
google.api_core.extended_operation.ExtendedOperation
- add_access_config_unary(request: Optional[Union[google.cloud.compute_v1.types.compute.AddAccessConfigInstanceRequest, dict]] = None, *, project: Optional[str] = None, zone: Optional[str] = None, instance: Optional[str] = None, network_interface: Optional[str] = None, access_config_resource: Optional[google.cloud.compute_v1.types.compute.AccessConfig] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.cloud.compute_v1.types.compute.Operation [source]¶
Adds an access config to an instance’s network interface.
# This snippet 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 as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import compute_v1 def sample_add_access_config(): # Create a client client = compute_v1.InstancesClient() # Initialize request argument(s) request = compute_v1.AddAccessConfigInstanceRequest( instance="instance_value", network_interface="network_interface_value", project="project_value", zone="zone_value", ) # Make the request response = client.add_access_config(request=request) # Handle the response print(response)
- Parameters
request (Union[google.cloud.compute_v1.types.AddAccessConfigInstanceRequest, dict]) – The request object. A request message for Instances.AddAccessConfig. See the method description for details.
project (str) – Project ID for this request. This corresponds to the
project
field on therequest
instance; ifrequest
is provided, this should not be set.zone (str) –
The name of the zone for this request.
This corresponds to the
zone
field on therequest
instance; ifrequest
is provided, this should not be set.instance (str) – The instance name for this request. This corresponds to the
instance
field on therequest
instance; ifrequest
is provided, this should not be set.network_interface (str) –
The name of the network interface to add to this instance.
This corresponds to the
network_interface
field on therequest
instance; ifrequest
is provided, this should not be set.access_config_resource (google.cloud.compute_v1.types.AccessConfig) – The body resource for this request This corresponds to the
access_config_resource
field on therequest
instance; ifrequest
is provided, this should not be set.retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.
timeout (float) – The timeout for this request.
metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.
- Returns
An object representing a extended long-running operation.
- Return type
google.api_core.extended_operation.ExtendedOperation
- add_resource_policies(request: Optional[Union[google.cloud.compute_v1.types.compute.AddResourcePoliciesInstanceRequest, dict]] = None, *, project: Optional[str] = None, zone: Optional[str] = None, instance: Optional[str] = None, instances_add_resource_policies_request_resource: Optional[google.cloud.compute_v1.types.compute.InstancesAddResourcePoliciesRequest] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.api_core.extended_operation.ExtendedOperation [source]¶
Adds existing resource policies to an instance. You can only add one policy right now which will be applied to this instance for scheduling live migrations.
# This snippet 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 as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import compute_v1 def sample_add_resource_policies(): # Create a client client = compute_v1.InstancesClient() # Initialize request argument(s) request = compute_v1.AddResourcePoliciesInstanceRequest( instance="instance_value", project="project_value", zone="zone_value", ) # Make the request response = client.add_resource_policies(request=request) # Handle the response print(response)
- Parameters
request (Union[google.cloud.compute_v1.types.AddResourcePoliciesInstanceRequest, dict]) – The request object. A request message for Instances.AddResourcePolicies. See the method description for details.
project (str) – Project ID for this request. This corresponds to the
project
field on therequest
instance; ifrequest
is provided, this should not be set.zone (str) –
The name of the zone for this request.
This corresponds to the
zone
field on therequest
instance; ifrequest
is provided, this should not be set.instance (str) – The instance name for this request. This corresponds to the
instance
field on therequest
instance; ifrequest
is provided, this should not be set.instances_add_resource_policies_request_resource (google.cloud.compute_v1.types.InstancesAddResourcePoliciesRequest) – The body resource for this request This corresponds to the
instances_add_resource_policies_request_resource
field on therequest
instance; ifrequest
is provided, this should not be set.retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.
timeout (float) – The timeout for this request.
metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.
- Returns
An object representing a extended long-running operation.
- Return type
google.api_core.extended_operation.ExtendedOperation
- add_resource_policies_unary(request: Optional[Union[google.cloud.compute_v1.types.compute.AddResourcePoliciesInstanceRequest, dict]] = None, *, project: Optional[str] = None, zone: Optional[str] = None, instance: Optional[str] = None, instances_add_resource_policies_request_resource: Optional[google.cloud.compute_v1.types.compute.InstancesAddResourcePoliciesRequest] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.cloud.compute_v1.types.compute.Operation [source]¶
Adds existing resource policies to an instance. You can only add one policy right now which will be applied to this instance for scheduling live migrations.
# This snippet 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 as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import compute_v1 def sample_add_resource_policies(): # Create a client client = compute_v1.InstancesClient() # Initialize request argument(s) request = compute_v1.AddResourcePoliciesInstanceRequest( instance="instance_value", project="project_value", zone="zone_value", ) # Make the request response = client.add_resource_policies(request=request) # Handle the response print(response)
- Parameters
request (Union[google.cloud.compute_v1.types.AddResourcePoliciesInstanceRequest, dict]) – The request object. A request message for Instances.AddResourcePolicies. See the method description for details.
project (str) – Project ID for this request. This corresponds to the
project
field on therequest
instance; ifrequest
is provided, this should not be set.zone (str) –
The name of the zone for this request.
This corresponds to the
zone
field on therequest
instance; ifrequest
is provided, this should not be set.instance (str) – The instance name for this request. This corresponds to the
instance
field on therequest
instance; ifrequest
is provided, this should not be set.instances_add_resource_policies_request_resource (google.cloud.compute_v1.types.InstancesAddResourcePoliciesRequest) – The body resource for this request This corresponds to the
instances_add_resource_policies_request_resource
field on therequest
instance; ifrequest
is provided, this should not be set.retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.
timeout (float) – The timeout for this request.
metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.
- Returns
An object representing a extended long-running operation.
- Return type
google.api_core.extended_operation.ExtendedOperation
- aggregated_list(request: Optional[Union[google.cloud.compute_v1.types.compute.AggregatedListInstancesRequest, dict]] = None, *, project: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.cloud.compute_v1.services.instances.pagers.AggregatedListPager [source]¶
Retrieves an aggregated list of all of the instances in your project across all regions and zones. The performance of this method degrades when a filter is specified on a project that has a very large number of instances. To prevent failure, Google recommends that you set the
returnPartialSuccess
parameter totrue
.# This snippet 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 as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import compute_v1 def sample_aggregated_list(): # Create a client client = compute_v1.InstancesClient() # Initialize request argument(s) request = compute_v1.AggregatedListInstancesRequest( project="project_value", ) # Make the request page_result = client.aggregated_list(request=request) # Handle the response for response in page_result: print(response)
- Parameters
request (Union[google.cloud.compute_v1.types.AggregatedListInstancesRequest, dict]) – The request object. A request message for Instances.AggregatedList. See the method description for details.
project (str) – Project ID for this request. This corresponds to the
project
field on therequest
instance; ifrequest
is provided, this should not be set.retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.
timeout (float) – The timeout for this request.
metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.
- Returns
Iterating over this object will yield results and resolve additional pages automatically.
- Return type
google.cloud.compute_v1.services.instances.pagers.AggregatedListPager
- property api_endpoint¶
Return the API endpoint used by the client instance.
- Returns
The API endpoint used by the client instance.
- Return type
- attach_disk(request: Optional[Union[google.cloud.compute_v1.types.compute.AttachDiskInstanceRequest, dict]] = None, *, project: Optional[str] = None, zone: Optional[str] = None, instance: Optional[str] = None, attached_disk_resource: Optional[google.cloud.compute_v1.types.compute.AttachedDisk] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.api_core.extended_operation.ExtendedOperation [source]¶
Attaches an existing Disk resource to an instance. You must first create the disk before you can attach it. It is not possible to create and attach a disk at the same time. For more information, read Adding a persistent disk to your instance.
# This snippet 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 as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import compute_v1 def sample_attach_disk(): # Create a client client = compute_v1.InstancesClient() # Initialize request argument(s) request = compute_v1.AttachDiskInstanceRequest( instance="instance_value", project="project_value", zone="zone_value", ) # Make the request response = client.attach_disk(request=request) # Handle the response print(response)
- Parameters
request (Union[google.cloud.compute_v1.types.AttachDiskInstanceRequest, dict]) – The request object. A request message for Instances.AttachDisk. See the method description for details.
project (str) – Project ID for this request. This corresponds to the
project
field on therequest
instance; ifrequest
is provided, this should not be set.zone (str) –
The name of the zone for this request.
This corresponds to the
zone
field on therequest
instance; ifrequest
is provided, this should not be set.instance (str) – The instance name for this request. This corresponds to the
instance
field on therequest
instance; ifrequest
is provided, this should not be set.attached_disk_resource (google.cloud.compute_v1.types.AttachedDisk) – The body resource for this request This corresponds to the
attached_disk_resource
field on therequest
instance; ifrequest
is provided, this should not be set.retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.
timeout (float) – The timeout for this request.
metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.
- Returns
An object representing a extended long-running operation.
- Return type
google.api_core.extended_operation.ExtendedOperation
- attach_disk_unary(request: Optional[Union[google.cloud.compute_v1.types.compute.AttachDiskInstanceRequest, dict]] = None, *, project: Optional[str] = None, zone: Optional[str] = None, instance: Optional[str] = None, attached_disk_resource: Optional[google.cloud.compute_v1.types.compute.AttachedDisk] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.cloud.compute_v1.types.compute.Operation [source]¶
Attaches an existing Disk resource to an instance. You must first create the disk before you can attach it. It is not possible to create and attach a disk at the same time. For more information, read Adding a persistent disk to your instance.
# This snippet 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 as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import compute_v1 def sample_attach_disk(): # Create a client client = compute_v1.InstancesClient() # Initialize request argument(s) request = compute_v1.AttachDiskInstanceRequest( instance="instance_value", project="project_value", zone="zone_value", ) # Make the request response = client.attach_disk(request=request) # Handle the response print(response)
- Parameters
request (Union[google.cloud.compute_v1.types.AttachDiskInstanceRequest, dict]) – The request object. A request message for Instances.AttachDisk. See the method description for details.
project (str) – Project ID for this request. This corresponds to the
project
field on therequest
instance; ifrequest
is provided, this should not be set.zone (str) –
The name of the zone for this request.
This corresponds to the
zone
field on therequest
instance; ifrequest
is provided, this should not be set.instance (str) – The instance name for this request. This corresponds to the
instance
field on therequest
instance; ifrequest
is provided, this should not be set.attached_disk_resource (google.cloud.compute_v1.types.AttachedDisk) – The body resource for this request This corresponds to the
attached_disk_resource
field on therequest
instance; ifrequest
is provided, this should not be set.retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.
timeout (float) – The timeout for this request.
metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.
- Returns
An object representing a extended long-running operation.
- Return type
google.api_core.extended_operation.ExtendedOperation
- bulk_insert(request: Optional[Union[google.cloud.compute_v1.types.compute.BulkInsertInstanceRequest, dict]] = None, *, project: Optional[str] = None, zone: Optional[str] = None, bulk_insert_instance_resource_resource: Optional[google.cloud.compute_v1.types.compute.BulkInsertInstanceResource] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.api_core.extended_operation.ExtendedOperation [source]¶
Creates multiple instances. Count specifies the number of instances to create. For more information, see About bulk creation of VMs.
# This snippet 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 as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import compute_v1 def sample_bulk_insert(): # Create a client client = compute_v1.InstancesClient() # Initialize request argument(s) request = compute_v1.BulkInsertInstanceRequest( project="project_value", zone="zone_value", ) # Make the request response = client.bulk_insert(request=request) # Handle the response print(response)
- Parameters
request (Union[google.cloud.compute_v1.types.BulkInsertInstanceRequest, dict]) – The request object. A request message for Instances.BulkInsert. See the method description for details.
project (str) – Project ID for this request. This corresponds to the
project
field on therequest
instance; ifrequest
is provided, this should not be set.zone (str) –
The name of the zone for this request.
This corresponds to the
zone
field on therequest
instance; ifrequest
is provided, this should not be set.bulk_insert_instance_resource_resource (google.cloud.compute_v1.types.BulkInsertInstanceResource) – The body resource for this request This corresponds to the
bulk_insert_instance_resource_resource
field on therequest
instance; ifrequest
is provided, this should not be set.retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.
timeout (float) – The timeout for this request.
metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.
- Returns
An object representing a extended long-running operation.
- Return type
google.api_core.extended_operation.ExtendedOperation
- bulk_insert_unary(request: Optional[Union[google.cloud.compute_v1.types.compute.BulkInsertInstanceRequest, dict]] = None, *, project: Optional[str] = None, zone: Optional[str] = None, bulk_insert_instance_resource_resource: Optional[google.cloud.compute_v1.types.compute.BulkInsertInstanceResource] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.cloud.compute_v1.types.compute.Operation [source]¶
Creates multiple instances. Count specifies the number of instances to create. For more information, see About bulk creation of VMs.
# This snippet 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 as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import compute_v1 def sample_bulk_insert(): # Create a client client = compute_v1.InstancesClient() # Initialize request argument(s) request = compute_v1.BulkInsertInstanceRequest( project="project_value", zone="zone_value", ) # Make the request response = client.bulk_insert(request=request) # Handle the response print(response)
- Parameters
request (Union[google.cloud.compute_v1.types.BulkInsertInstanceRequest, dict]) – The request object. A request message for Instances.BulkInsert. See the method description for details.
project (str) – Project ID for this request. This corresponds to the
project
field on therequest
instance; ifrequest
is provided, this should not be set.zone (str) –
The name of the zone for this request.
This corresponds to the
zone
field on therequest
instance; ifrequest
is provided, this should not be set.bulk_insert_instance_resource_resource (google.cloud.compute_v1.types.BulkInsertInstanceResource) – The body resource for this request This corresponds to the
bulk_insert_instance_resource_resource
field on therequest
instance; ifrequest
is provided, this should not be set.retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.
timeout (float) – The timeout for this request.
metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.
- Returns
An object representing a extended long-running operation.
- Return type
google.api_core.extended_operation.ExtendedOperation
- static common_billing_account_path(billing_account: str) str [source]¶
Returns a fully-qualified billing_account string.
- static common_location_path(project: str, location: str) str [source]¶
Returns a fully-qualified location string.
- static common_organization_path(organization: str) str [source]¶
Returns a fully-qualified organization string.
- delete(request: Optional[Union[google.cloud.compute_v1.types.compute.DeleteInstanceRequest, dict]] = None, *, project: Optional[str] = None, zone: Optional[str] = None, instance: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.api_core.extended_operation.ExtendedOperation [source]¶
Deletes the specified Instance resource. For more information, see Deleting an instance.
# This snippet 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 as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import compute_v1 def sample_delete(): # Create a client client = compute_v1.InstancesClient() # Initialize request argument(s) request = compute_v1.DeleteInstanceRequest( instance="instance_value", project="project_value", zone="zone_value", ) # Make the request response = client.delete(request=request) # Handle the response print(response)
- Parameters
request (Union[google.cloud.compute_v1.types.DeleteInstanceRequest, dict]) – The request object. A request message for Instances.Delete. See the method description for details.
project (str) – Project ID for this request. This corresponds to the
project
field on therequest
instance; ifrequest
is provided, this should not be set.zone (str) –
The name of the zone for this request.
This corresponds to the
zone
field on therequest
instance; ifrequest
is provided, this should not be set.instance (str) –
Name of the instance resource to delete.
This corresponds to the
instance
field on therequest
instance; ifrequest
is provided, this should not be set.retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.
timeout (float) – The timeout for this request.
metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.
- Returns
An object representing a extended long-running operation.
- Return type
google.api_core.extended_operation.ExtendedOperation
- delete_access_config(request: Optional[Union[google.cloud.compute_v1.types.compute.DeleteAccessConfigInstanceRequest, dict]] = None, *, project: Optional[str] = None, zone: Optional[str] = None, instance: Optional[str] = None, access_config: Optional[str] = None, network_interface: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.api_core.extended_operation.ExtendedOperation [source]¶
Deletes an access config from an instance’s network interface.
# This snippet 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 as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import compute_v1 def sample_delete_access_config(): # Create a client client = compute_v1.InstancesClient() # Initialize request argument(s) request = compute_v1.DeleteAccessConfigInstanceRequest( access_config="access_config_value", instance="instance_value", network_interface="network_interface_value", project="project_value", zone="zone_value", ) # Make the request response = client.delete_access_config(request=request) # Handle the response print(response)
- Parameters
request (Union[google.cloud.compute_v1.types.DeleteAccessConfigInstanceRequest, dict]) – The request object. A request message for Instances.DeleteAccessConfig. See the method description for details.
project (str) – Project ID for this request. This corresponds to the
project
field on therequest
instance; ifrequest
is provided, this should not be set.zone (str) –
The name of the zone for this request.
This corresponds to the
zone
field on therequest
instance; ifrequest
is provided, this should not be set.instance (str) – The instance name for this request. This corresponds to the
instance
field on therequest
instance; ifrequest
is provided, this should not be set.access_config (str) –
The name of the access config to delete.
This corresponds to the
access_config
field on therequest
instance; ifrequest
is provided, this should not be set.network_interface (str) – The name of the network interface. This corresponds to the
network_interface
field on therequest
instance; ifrequest
is provided, this should not be set.retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.
timeout (float) – The timeout for this request.
metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.
- Returns
An object representing a extended long-running operation.
- Return type
google.api_core.extended_operation.ExtendedOperation
- delete_access_config_unary(request: Optional[Union[google.cloud.compute_v1.types.compute.DeleteAccessConfigInstanceRequest, dict]] = None, *, project: Optional[str] = None, zone: Optional[str] = None, instance: Optional[str] = None, access_config: Optional[str] = None, network_interface: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.cloud.compute_v1.types.compute.Operation [source]¶
Deletes an access config from an instance’s network interface.
# This snippet 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 as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import compute_v1 def sample_delete_access_config(): # Create a client client = compute_v1.InstancesClient() # Initialize request argument(s) request = compute_v1.DeleteAccessConfigInstanceRequest( access_config="access_config_value", instance="instance_value", network_interface="network_interface_value", project="project_value", zone="zone_value", ) # Make the request response = client.delete_access_config(request=request) # Handle the response print(response)
- Parameters
request (Union[google.cloud.compute_v1.types.DeleteAccessConfigInstanceRequest, dict]) – The request object. A request message for Instances.DeleteAccessConfig. See the method description for details.
project (str) – Project ID for this request. This corresponds to the
project
field on therequest
instance; ifrequest
is provided, this should not be set.zone (str) –
The name of the zone for this request.
This corresponds to the
zone
field on therequest
instance; ifrequest
is provided, this should not be set.instance (str) – The instance name for this request. This corresponds to the
instance
field on therequest
instance; ifrequest
is provided, this should not be set.access_config (str) –
The name of the access config to delete.
This corresponds to the
access_config
field on therequest
instance; ifrequest
is provided, this should not be set.network_interface (str) – The name of the network interface. This corresponds to the
network_interface
field on therequest
instance; ifrequest
is provided, this should not be set.retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.
timeout (float) – The timeout for this request.
metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.
- Returns
An object representing a extended long-running operation.
- Return type
google.api_core.extended_operation.ExtendedOperation
- delete_unary(request: Optional[Union[google.cloud.compute_v1.types.compute.DeleteInstanceRequest, dict]] = None, *, project: Optional[str] = None, zone: Optional[str] = None, instance: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.cloud.compute_v1.types.compute.Operation [source]¶
Deletes the specified Instance resource. For more information, see Deleting an instance.
# This snippet 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 as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import compute_v1 def sample_delete(): # Create a client client = compute_v1.InstancesClient() # Initialize request argument(s) request = compute_v1.DeleteInstanceRequest( instance="instance_value", project="project_value", zone="zone_value", ) # Make the request response = client.delete(request=request) # Handle the response print(response)
- Parameters
request (Union[google.cloud.compute_v1.types.DeleteInstanceRequest, dict]) – The request object. A request message for Instances.Delete. See the method description for details.
project (str) – Project ID for this request. This corresponds to the
project
field on therequest
instance; ifrequest
is provided, this should not be set.zone (str) –
The name of the zone for this request.
This corresponds to the
zone
field on therequest
instance; ifrequest
is provided, this should not be set.instance (str) –
Name of the instance resource to delete.
This corresponds to the
instance
field on therequest
instance; ifrequest
is provided, this should not be set.retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.
timeout (float) – The timeout for this request.
metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.
- Returns
An object representing a extended long-running operation.
- Return type
google.api_core.extended_operation.ExtendedOperation
- detach_disk(request: Optional[Union[google.cloud.compute_v1.types.compute.DetachDiskInstanceRequest, dict]] = None, *, project: Optional[str] = None, zone: Optional[str] = None, instance: Optional[str] = None, device_name: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.api_core.extended_operation.ExtendedOperation [source]¶
Detaches a disk from an instance.
# This snippet 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 as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import compute_v1 def sample_detach_disk(): # Create a client client = compute_v1.InstancesClient() # Initialize request argument(s) request = compute_v1.DetachDiskInstanceRequest( device_name="device_name_value", instance="instance_value", project="project_value", zone="zone_value", ) # Make the request response = client.detach_disk(request=request) # Handle the response print(response)
- Parameters
request (Union[google.cloud.compute_v1.types.DetachDiskInstanceRequest, dict]) – The request object. A request message for Instances.DetachDisk. See the method description for details.
project (str) – Project ID for this request. This corresponds to the
project
field on therequest
instance; ifrequest
is provided, this should not be set.zone (str) –
The name of the zone for this request.
This corresponds to the
zone
field on therequest
instance; ifrequest
is provided, this should not be set.instance (str) – Instance name for this request. This corresponds to the
instance
field on therequest
instance; ifrequest
is provided, this should not be set.device_name (str) –
The device name of the disk to detach. Make a get() request on the instance to view currently attached disks and device names.
This corresponds to the
device_name
field on therequest
instance; ifrequest
is provided, this should not be set.retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.
timeout (float) – The timeout for this request.
metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.
- Returns
An object representing a extended long-running operation.
- Return type
google.api_core.extended_operation.ExtendedOperation
- detach_disk_unary(request: Optional[Union[google.cloud.compute_v1.types.compute.DetachDiskInstanceRequest, dict]] = None, *, project: Optional[str] = None, zone: Optional[str] = None, instance: Optional[str] = None, device_name: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.cloud.compute_v1.types.compute.Operation [source]¶
Detaches a disk from an instance.
# This snippet 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 as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import compute_v1 def sample_detach_disk(): # Create a client client = compute_v1.InstancesClient() # Initialize request argument(s) request = compute_v1.DetachDiskInstanceRequest( device_name="device_name_value", instance="instance_value", project="project_value", zone="zone_value", ) # Make the request response = client.detach_disk(request=request) # Handle the response print(response)
- Parameters
request (Union[google.cloud.compute_v1.types.DetachDiskInstanceRequest, dict]) – The request object. A request message for Instances.DetachDisk. See the method description for details.
project (str) – Project ID for this request. This corresponds to the
project
field on therequest
instance; ifrequest
is provided, this should not be set.zone (str) –
The name of the zone for this request.
This corresponds to the
zone
field on therequest
instance; ifrequest
is provided, this should not be set.instance (str) – Instance name for this request. This corresponds to the
instance
field on therequest
instance; ifrequest
is provided, this should not be set.device_name (str) –
The device name of the disk to detach. Make a get() request on the instance to view currently attached disks and device names.
This corresponds to the
device_name
field on therequest
instance; ifrequest
is provided, this should not be set.retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.
timeout (float) – The timeout for this request.
metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.
- Returns
An object representing a extended long-running operation.
- Return type
google.api_core.extended_operation.ExtendedOperation
- classmethod from_service_account_file(filename: str, *args, **kwargs)[source]¶
- Creates an instance of this client using the provided credentials
file.
- Parameters
filename (str) – The path to the service account private key json file.
args – Additional arguments to pass to the constructor.
kwargs – Additional arguments to pass to the constructor.
- Returns
The constructed client.
- Return type
- classmethod from_service_account_info(info: dict, *args, **kwargs)[source]¶
- Creates an instance of this client using the provided credentials
info.
- Parameters
info (dict) – The service account private key info.
args – Additional arguments to pass to the constructor.
kwargs – Additional arguments to pass to the constructor.
- Returns
The constructed client.
- Return type
- classmethod from_service_account_json(filename: str, *args, **kwargs)¶
- Creates an instance of this client using the provided credentials
file.
- Parameters
filename (str) – The path to the service account private key json file.
args – Additional arguments to pass to the constructor.
kwargs – Additional arguments to pass to the constructor.
- Returns
The constructed client.
- Return type
- get(request: Optional[Union[google.cloud.compute_v1.types.compute.GetInstanceRequest, dict]] = None, *, project: Optional[str] = None, zone: Optional[str] = None, instance: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.cloud.compute_v1.types.compute.Instance [source]¶
Returns the specified Instance resource.
# This snippet 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 as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import compute_v1 def sample_get(): # Create a client client = compute_v1.InstancesClient() # Initialize request argument(s) request = compute_v1.GetInstanceRequest( instance="instance_value", project="project_value", zone="zone_value", ) # Make the request response = client.get(request=request) # Handle the response print(response)
- Parameters
request (Union[google.cloud.compute_v1.types.GetInstanceRequest, dict]) – The request object. A request message for Instances.Get. See the method description for details.
project (str) – Project ID for this request. This corresponds to the
project
field on therequest
instance; ifrequest
is provided, this should not be set.zone (str) –
The name of the zone for this request.
This corresponds to the
zone
field on therequest
instance; ifrequest
is provided, this should not be set.instance (str) –
Name of the instance resource to return.
This corresponds to the
instance
field on therequest
instance; ifrequest
is provided, this should not be set.retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.
timeout (float) – The timeout for this request.
metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.
- Returns
Represents an Instance resource. An instance is a virtual machine that is hosted on Google Cloud Platform. For more information, read Virtual Machine Instances.
- Return type
- get_effective_firewalls(request: Optional[Union[google.cloud.compute_v1.types.compute.GetEffectiveFirewallsInstanceRequest, dict]] = None, *, project: Optional[str] = None, zone: Optional[str] = None, instance: Optional[str] = None, network_interface: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.cloud.compute_v1.types.compute.InstancesGetEffectiveFirewallsResponse [source]¶
Returns effective firewalls applied to an interface of the instance.
# This snippet 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 as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import compute_v1 def sample_get_effective_firewalls(): # Create a client client = compute_v1.InstancesClient() # Initialize request argument(s) request = compute_v1.GetEffectiveFirewallsInstanceRequest( instance="instance_value", network_interface="network_interface_value", project="project_value", zone="zone_value", ) # Make the request response = client.get_effective_firewalls(request=request) # Handle the response print(response)
- Parameters
request (Union[google.cloud.compute_v1.types.GetEffectiveFirewallsInstanceRequest, dict]) – The request object. A request message for Instances.GetEffectiveFirewalls. See the method description for details.
project (str) – Project ID for this request. This corresponds to the
project
field on therequest
instance; ifrequest
is provided, this should not be set.zone (str) –
The name of the zone for this request.
This corresponds to the
zone
field on therequest
instance; ifrequest
is provided, this should not be set.instance (str) –
Name of the instance scoping this request.
This corresponds to the
instance
field on therequest
instance; ifrequest
is provided, this should not be set.network_interface (str) –
The name of the network interface to get the effective firewalls.
This corresponds to the
network_interface
field on therequest
instance; ifrequest
is provided, this should not be set.retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.
timeout (float) – The timeout for this request.
metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.
- Return type
google.cloud.compute_v1.types.InstancesGetEffectiveFirewallsResponse
- get_guest_attributes(request: Optional[Union[google.cloud.compute_v1.types.compute.GetGuestAttributesInstanceRequest, dict]] = None, *, project: Optional[str] = None, zone: Optional[str] = None, instance: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.cloud.compute_v1.types.compute.GuestAttributes [source]¶
Returns the specified guest attributes entry.
# This snippet 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 as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import compute_v1 def sample_get_guest_attributes(): # Create a client client = compute_v1.InstancesClient() # Initialize request argument(s) request = compute_v1.GetGuestAttributesInstanceRequest( instance="instance_value", project="project_value", zone="zone_value", ) # Make the request response = client.get_guest_attributes(request=request) # Handle the response print(response)
- Parameters
request (Union[google.cloud.compute_v1.types.GetGuestAttributesInstanceRequest, dict]) – The request object. A request message for Instances.GetGuestAttributes. See the method description for details.
project (str) – Project ID for this request. This corresponds to the
project
field on therequest
instance; ifrequest
is provided, this should not be set.zone (str) –
The name of the zone for this request.
This corresponds to the
zone
field on therequest
instance; ifrequest
is provided, this should not be set.instance (str) –
Name of the instance scoping this request.
This corresponds to the
instance
field on therequest
instance; ifrequest
is provided, this should not be set.retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.
timeout (float) – The timeout for this request.
metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.
- Returns
A guest attributes entry.
- Return type
- get_iam_policy(request: Optional[Union[google.cloud.compute_v1.types.compute.GetIamPolicyInstanceRequest, dict]] = None, *, project: Optional[str] = None, zone: Optional[str] = None, resource: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.cloud.compute_v1.types.compute.Policy [source]¶
Gets the access control policy for a resource. May be empty if no such policy or resource exists.
# This snippet 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 as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import compute_v1 def sample_get_iam_policy(): # Create a client client = compute_v1.InstancesClient() # Initialize request argument(s) request = compute_v1.GetIamPolicyInstanceRequest( project="project_value", resource="resource_value", zone="zone_value", ) # Make the request response = client.get_iam_policy(request=request) # Handle the response print(response)
- Parameters
request (Union[google.cloud.compute_v1.types.GetIamPolicyInstanceRequest, dict]) – The request object. A request message for Instances.GetIamPolicy. See the method description for details.
project (str) – Project ID for this request. This corresponds to the
project
field on therequest
instance; ifrequest
is provided, this should not be set.zone (str) –
The name of the zone for this request.
This corresponds to the
zone
field on therequest
instance; ifrequest
is provided, this should not be set.resource (str) –
Name or id of the resource for this request.
This corresponds to the
resource
field on therequest
instance; ifrequest
is provided, this should not be set.retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.
timeout (float) – The timeout for this request.
metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.
- Returns
An Identity and Access Management (IAM) policy, which specifies access controls for Google Cloud resources. A Policy is a collection of bindings. A binding binds one or more members, or principals, to a single role. Principals can be user accounts, service accounts, Google groups, and domains (such as G Suite). A role is a named list of permissions; each role can be an IAM predefined role or a user-created custom role. For some types of Google Cloud resources, a binding can also specify a condition, which is a logical expression that allows access to a resource only if the expression evaluates to true. A condition can add constraints based on attributes of the request, the resource, or both. To learn which resources support conditions in their IAM policies, see the [IAM documentation](https://cloud.google.com/iam/help/conditions/resource-policies). JSON example:
` { "bindings": [ { "role": "roles/resourcemanager.organizationAdmin", "members": [ "user:mike@example.com", "group:admins@example.com", "domain:google.com", "serviceAccount:my-project-id@appspot.gserviceaccount.com" ] }, { "role": "roles/resourcemanager.organizationViewer", "members": [ "user:eve@example.com" ], "condition": { "title": "expirable access", "description": "Does not grant access after Sep 2020", "expression": "request.time < timestamp('2020-10-01T00:00:00.000Z')", } } ], "etag": "BwWWja0YfJA=", "version": 3 }
` YAML example:` bindings: - members: - user:mike@example.com - group:admins@example.com - domain:google.com - serviceAccount:my-project-id@appspot.gserviceaccount.com role: roles/resourcemanager.organizationAdmin - members: - user:eve@example.com role: roles/resourcemanager.organizationViewer condition: title: expirable access description: Does not grant access after Sep 2020 expression: request.time < timestamp('2020-10-01T00:00:00.000Z') etag: BwWWja0YfJA= version: 3
` For a description of IAM and its features, see the [IAM documentation](https://cloud.google.com/iam/docs/).- Return type
- classmethod get_mtls_endpoint_and_cert_source(client_options: Optional[google.api_core.client_options.ClientOptions] = None)[source]¶
Deprecated. Return the API endpoint and client cert source for mutual TLS.
The client cert source is determined in the following order: (1) if GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable is not “true”, the client cert source is None. (2) if client_options.client_cert_source is provided, use the provided one; if the default client cert source exists, use the default one; otherwise the client cert source is None.
The API endpoint is determined in the following order: (1) if client_options.api_endpoint if provided, use the provided one. (2) if GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable is “always”, use the default mTLS endpoint; if the environment variable is “never”, use the default API endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise use the default API endpoint.
More details can be found at https://google.aip.dev/auth/4114.
- Parameters
client_options (google.api_core.client_options.ClientOptions) – Custom options for the client. Only the api_endpoint and client_cert_source properties may be used in this method.
- Returns
- returns the API endpoint and the
client cert source to use.
- Return type
- Raises
google.auth.exceptions.MutualTLSChannelError – If any errors happen.
- get_screenshot(request: Optional[Union[google.cloud.compute_v1.types.compute.GetScreenshotInstanceRequest, dict]] = None, *, project: Optional[str] = None, zone: Optional[str] = None, instance: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.cloud.compute_v1.types.compute.Screenshot [source]¶
Returns the screenshot from the specified instance.
# This snippet 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 as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import compute_v1 def sample_get_screenshot(): # Create a client client = compute_v1.InstancesClient() # Initialize request argument(s) request = compute_v1.GetScreenshotInstanceRequest( instance="instance_value", project="project_value", zone="zone_value", ) # Make the request response = client.get_screenshot(request=request) # Handle the response print(response)
- Parameters
request (Union[google.cloud.compute_v1.types.GetScreenshotInstanceRequest, dict]) – The request object. A request message for Instances.GetScreenshot. See the method description for details.
project (str) – Project ID for this request. This corresponds to the
project
field on therequest
instance; ifrequest
is provided, this should not be set.zone (str) –
The name of the zone for this request.
This corresponds to the
zone
field on therequest
instance; ifrequest
is provided, this should not be set.instance (str) –
Name of the instance scoping this request.
This corresponds to the
instance
field on therequest
instance; ifrequest
is provided, this should not be set.retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.
timeout (float) – The timeout for this request.
metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.
- Returns
An instance’s screenshot.
- Return type
- get_serial_port_output(request: Optional[Union[google.cloud.compute_v1.types.compute.GetSerialPortOutputInstanceRequest, dict]] = None, *, project: Optional[str] = None, zone: Optional[str] = None, instance: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.cloud.compute_v1.types.compute.SerialPortOutput [source]¶
Returns the last 1 MB of serial port output from the specified instance.
# This snippet 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 as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import compute_v1 def sample_get_serial_port_output(): # Create a client client = compute_v1.InstancesClient() # Initialize request argument(s) request = compute_v1.GetSerialPortOutputInstanceRequest( instance="instance_value", project="project_value", zone="zone_value", ) # Make the request response = client.get_serial_port_output(request=request) # Handle the response print(response)
- Parameters
request (Union[google.cloud.compute_v1.types.GetSerialPortOutputInstanceRequest, dict]) – The request object. A request message for Instances.GetSerialPortOutput. See the method description for details.
project (str) – Project ID for this request. This corresponds to the
project
field on therequest
instance; ifrequest
is provided, this should not be set.zone (str) –
The name of the zone for this request.
This corresponds to the
zone
field on therequest
instance; ifrequest
is provided, this should not be set.instance (str) –
Name of the instance for this request.
This corresponds to the
instance
field on therequest
instance; ifrequest
is provided, this should not be set.retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.
timeout (float) – The timeout for this request.
metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.
- Returns
An instance serial console output.
- Return type
- get_shielded_instance_identity(request: Optional[Union[google.cloud.compute_v1.types.compute.GetShieldedInstanceIdentityInstanceRequest, dict]] = None, *, project: Optional[str] = None, zone: Optional[str] = None, instance: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.cloud.compute_v1.types.compute.ShieldedInstanceIdentity [source]¶
Returns the Shielded Instance Identity of an instance
# This snippet 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 as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import compute_v1 def sample_get_shielded_instance_identity(): # Create a client client = compute_v1.InstancesClient() # Initialize request argument(s) request = compute_v1.GetShieldedInstanceIdentityInstanceRequest( instance="instance_value", project="project_value", zone="zone_value", ) # Make the request response = client.get_shielded_instance_identity(request=request) # Handle the response print(response)
- Parameters
request (Union[google.cloud.compute_v1.types.GetShieldedInstanceIdentityInstanceRequest, dict]) – The request object. A request message for Instances.GetShieldedInstanceIdentity. See the method description for details.
project (str) – Project ID for this request. This corresponds to the
project
field on therequest
instance; ifrequest
is provided, this should not be set.zone (str) –
The name of the zone for this request.
This corresponds to the
zone
field on therequest
instance; ifrequest
is provided, this should not be set.instance (str) –
Name or id of the instance scoping this request.
This corresponds to the
instance
field on therequest
instance; ifrequest
is provided, this should not be set.retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.
timeout (float) – The timeout for this request.
metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.
- Returns
A Shielded Instance Identity.
- Return type
- insert(request: Optional[Union[google.cloud.compute_v1.types.compute.InsertInstanceRequest, dict]] = None, *, project: Optional[str] = None, zone: Optional[str] = None, instance_resource: Optional[google.cloud.compute_v1.types.compute.Instance] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.api_core.extended_operation.ExtendedOperation [source]¶
Creates an instance resource in the specified project using the data included in the request.
# This snippet 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 as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import compute_v1 def sample_insert(): # Create a client client = compute_v1.InstancesClient() # Initialize request argument(s) request = compute_v1.InsertInstanceRequest( project="project_value", zone="zone_value", ) # Make the request response = client.insert(request=request) # Handle the response print(response)
- Parameters
request (Union[google.cloud.compute_v1.types.InsertInstanceRequest, dict]) – The request object. A request message for Instances.Insert. See the method description for details.
project (str) – Project ID for this request. This corresponds to the
project
field on therequest
instance; ifrequest
is provided, this should not be set.zone (str) –
The name of the zone for this request.
This corresponds to the
zone
field on therequest
instance; ifrequest
is provided, this should not be set.instance_resource (google.cloud.compute_v1.types.Instance) – The body resource for this request This corresponds to the
instance_resource
field on therequest
instance; ifrequest
is provided, this should not be set.retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.
timeout (float) – The timeout for this request.
metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.
- Returns
An object representing a extended long-running operation.
- Return type
google.api_core.extended_operation.ExtendedOperation
- insert_unary(request: Optional[Union[google.cloud.compute_v1.types.compute.InsertInstanceRequest, dict]] = None, *, project: Optional[str] = None, zone: Optional[str] = None, instance_resource: Optional[google.cloud.compute_v1.types.compute.Instance] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.cloud.compute_v1.types.compute.Operation [source]¶
Creates an instance resource in the specified project using the data included in the request.
# This snippet 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 as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import compute_v1 def sample_insert(): # Create a client client = compute_v1.InstancesClient() # Initialize request argument(s) request = compute_v1.InsertInstanceRequest( project="project_value", zone="zone_value", ) # Make the request response = client.insert(request=request) # Handle the response print(response)
- Parameters
request (Union[google.cloud.compute_v1.types.InsertInstanceRequest, dict]) – The request object. A request message for Instances.Insert. See the method description for details.
project (str) – Project ID for this request. This corresponds to the
project
field on therequest
instance; ifrequest
is provided, this should not be set.zone (str) –
The name of the zone for this request.
This corresponds to the
zone
field on therequest
instance; ifrequest
is provided, this should not be set.instance_resource (google.cloud.compute_v1.types.Instance) – The body resource for this request This corresponds to the
instance_resource
field on therequest
instance; ifrequest
is provided, this should not be set.retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.
timeout (float) – The timeout for this request.
metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.
- Returns
An object representing a extended long-running operation.
- Return type
google.api_core.extended_operation.ExtendedOperation
- list(request: Optional[Union[google.cloud.compute_v1.types.compute.ListInstancesRequest, dict]] = None, *, project: Optional[str] = None, zone: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.cloud.compute_v1.services.instances.pagers.ListPager [source]¶
Retrieves the list of instances contained within the specified zone.
# This snippet 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 as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import compute_v1 def sample_list(): # Create a client client = compute_v1.InstancesClient() # Initialize request argument(s) request = compute_v1.ListInstancesRequest( project="project_value", zone="zone_value", ) # Make the request page_result = client.list(request=request) # Handle the response for response in page_result: print(response)
- Parameters
request (Union[google.cloud.compute_v1.types.ListInstancesRequest, dict]) – The request object. A request message for Instances.List. See the method description for details.
project (str) – Project ID for this request. This corresponds to the
project
field on therequest
instance; ifrequest
is provided, this should not be set.zone (str) –
The name of the zone for this request.
This corresponds to the
zone
field on therequest
instance; ifrequest
is provided, this should not be set.retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.
timeout (float) – The timeout for this request.
metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.
- Returns
Contains a list of instances.
Iterating over this object will yield results and resolve additional pages automatically.
- Return type
- list_referrers(request: Optional[Union[google.cloud.compute_v1.types.compute.ListReferrersInstancesRequest, dict]] = None, *, project: Optional[str] = None, zone: Optional[str] = None, instance: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.cloud.compute_v1.services.instances.pagers.ListReferrersPager [source]¶
Retrieves a list of resources that refer to the VM instance specified in the request. For example, if the VM instance is part of a managed or unmanaged instance group, the referrers list includes the instance group. For more information, read Viewing referrers to VM instances.
# This snippet 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 as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import compute_v1 def sample_list_referrers(): # Create a client client = compute_v1.InstancesClient() # Initialize request argument(s) request = compute_v1.ListReferrersInstancesRequest( instance="instance_value", project="project_value", zone="zone_value", ) # Make the request page_result = client.list_referrers(request=request) # Handle the response for response in page_result: print(response)
- Parameters
request (Union[google.cloud.compute_v1.types.ListReferrersInstancesRequest, dict]) – The request object. A request message for Instances.ListReferrers. See the method description for details.
project (str) – Project ID for this request. This corresponds to the
project
field on therequest
instance; ifrequest
is provided, this should not be set.zone (str) –
The name of the zone for this request.
This corresponds to the
zone
field on therequest
instance; ifrequest
is provided, this should not be set.instance (str) –
Name of the target instance scoping this request, or ‘-’ if the request should span over all instances in the container.
This corresponds to the
instance
field on therequest
instance; ifrequest
is provided, this should not be set.retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.
timeout (float) – The timeout for this request.
metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.
- Returns
Contains a list of instance referrers. Iterating over this object will yield results and resolve additional pages automatically.
- Return type
google.cloud.compute_v1.services.instances.pagers.ListReferrersPager
- static parse_common_billing_account_path(path: str) Dict[str, str] [source]¶
Parse a billing_account path into its component segments.
- static parse_common_folder_path(path: str) Dict[str, str] [source]¶
Parse a folder path into its component segments.
- static parse_common_location_path(path: str) Dict[str, str] [source]¶
Parse a location path into its component segments.
- static parse_common_organization_path(path: str) Dict[str, str] [source]¶
Parse a organization path into its component segments.
- static parse_common_project_path(path: str) Dict[str, str] [source]¶
Parse a project path into its component segments.
- perform_maintenance(request: Optional[Union[google.cloud.compute_v1.types.compute.PerformMaintenanceInstanceRequest, dict]] = None, *, project: Optional[str] = None, zone: Optional[str] = None, instance: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.api_core.extended_operation.ExtendedOperation [source]¶
Perform a manual maintenance on the instance.
# This snippet 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 as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import compute_v1 def sample_perform_maintenance(): # Create a client client = compute_v1.InstancesClient() # Initialize request argument(s) request = compute_v1.PerformMaintenanceInstanceRequest( instance="instance_value", project="project_value", zone="zone_value", ) # Make the request response = client.perform_maintenance(request=request) # Handle the response print(response)
- Parameters
request (Union[google.cloud.compute_v1.types.PerformMaintenanceInstanceRequest, dict]) – The request object. A request message for Instances.PerformMaintenance. See the method description for details.
project (str) – Project ID for this request. This corresponds to the
project
field on therequest
instance; ifrequest
is provided, this should not be set.zone (str) –
The name of the zone for this request.
This corresponds to the
zone
field on therequest
instance; ifrequest
is provided, this should not be set.instance (str) –
Name of the instance scoping this request.
This corresponds to the
instance
field on therequest
instance; ifrequest
is provided, this should not be set.retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.
timeout (float) – The timeout for this request.
metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.
- Returns
An object representing a extended long-running operation.
- Return type
google.api_core.extended_operation.ExtendedOperation
- perform_maintenance_unary(request: Optional[Union[google.cloud.compute_v1.types.compute.PerformMaintenanceInstanceRequest, dict]] = None, *, project: Optional[str] = None, zone: Optional[str] = None, instance: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.cloud.compute_v1.types.compute.Operation [source]¶
Perform a manual maintenance on the instance.
# This snippet 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 as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import compute_v1 def sample_perform_maintenance(): # Create a client client = compute_v1.InstancesClient() # Initialize request argument(s) request = compute_v1.PerformMaintenanceInstanceRequest( instance="instance_value", project="project_value", zone="zone_value", ) # Make the request response = client.perform_maintenance(request=request) # Handle the response print(response)
- Parameters
request (Union[google.cloud.compute_v1.types.PerformMaintenanceInstanceRequest, dict]) – The request object. A request message for Instances.PerformMaintenance. See the method description for details.
project (str) – Project ID for this request. This corresponds to the
project
field on therequest
instance; ifrequest
is provided, this should not be set.zone (str) –
The name of the zone for this request.
This corresponds to the
zone
field on therequest
instance; ifrequest
is provided, this should not be set.instance (str) –
Name of the instance scoping this request.
This corresponds to the
instance
field on therequest
instance; ifrequest
is provided, this should not be set.retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.
timeout (float) – The timeout for this request.
metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.
- Returns
An object representing a extended long-running operation.
- Return type
google.api_core.extended_operation.ExtendedOperation
- remove_resource_policies(request: Optional[Union[google.cloud.compute_v1.types.compute.RemoveResourcePoliciesInstanceRequest, dict]] = None, *, project: Optional[str] = None, zone: Optional[str] = None, instance: Optional[str] = None, instances_remove_resource_policies_request_resource: Optional[google.cloud.compute_v1.types.compute.InstancesRemoveResourcePoliciesRequest] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.api_core.extended_operation.ExtendedOperation [source]¶
Removes resource policies from an instance.
# This snippet 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 as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import compute_v1 def sample_remove_resource_policies(): # Create a client client = compute_v1.InstancesClient() # Initialize request argument(s) request = compute_v1.RemoveResourcePoliciesInstanceRequest( instance="instance_value", project="project_value", zone="zone_value", ) # Make the request response = client.remove_resource_policies(request=request) # Handle the response print(response)
- Parameters
request (Union[google.cloud.compute_v1.types.RemoveResourcePoliciesInstanceRequest, dict]) – The request object. A request message for Instances.RemoveResourcePolicies. See the method description for details.
project (str) – Project ID for this request. This corresponds to the
project
field on therequest
instance; ifrequest
is provided, this should not be set.zone (str) –
The name of the zone for this request.
This corresponds to the
zone
field on therequest
instance; ifrequest
is provided, this should not be set.instance (str) – The instance name for this request. This corresponds to the
instance
field on therequest
instance; ifrequest
is provided, this should not be set.instances_remove_resource_policies_request_resource (google.cloud.compute_v1.types.InstancesRemoveResourcePoliciesRequest) – The body resource for this request This corresponds to the
instances_remove_resource_policies_request_resource
field on therequest
instance; ifrequest
is provided, this should not be set.retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.
timeout (float) – The timeout for this request.
metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.
- Returns
An object representing a extended long-running operation.
- Return type
google.api_core.extended_operation.ExtendedOperation
- remove_resource_policies_unary(request: Optional[Union[google.cloud.compute_v1.types.compute.RemoveResourcePoliciesInstanceRequest, dict]] = None, *, project: Optional[str] = None, zone: Optional[str] = None, instance: Optional[str] = None, instances_remove_resource_policies_request_resource: Optional[google.cloud.compute_v1.types.compute.InstancesRemoveResourcePoliciesRequest] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.cloud.compute_v1.types.compute.Operation [source]¶
Removes resource policies from an instance.
# This snippet 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 as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import compute_v1 def sample_remove_resource_policies(): # Create a client client = compute_v1.InstancesClient() # Initialize request argument(s) request = compute_v1.RemoveResourcePoliciesInstanceRequest( instance="instance_value", project="project_value", zone="zone_value", ) # Make the request response = client.remove_resource_policies(request=request) # Handle the response print(response)
- Parameters
request (Union[google.cloud.compute_v1.types.RemoveResourcePoliciesInstanceRequest, dict]) – The request object. A request message for Instances.RemoveResourcePolicies. See the method description for details.
project (str) – Project ID for this request. This corresponds to the
project
field on therequest
instance; ifrequest
is provided, this should not be set.zone (str) –
The name of the zone for this request.
This corresponds to the
zone
field on therequest
instance; ifrequest
is provided, this should not be set.instance (str) – The instance name for this request. This corresponds to the
instance
field on therequest
instance; ifrequest
is provided, this should not be set.instances_remove_resource_policies_request_resource (google.cloud.compute_v1.types.InstancesRemoveResourcePoliciesRequest) – The body resource for this request This corresponds to the
instances_remove_resource_policies_request_resource
field on therequest
instance; ifrequest
is provided, this should not be set.retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.
timeout (float) – The timeout for this request.
metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.
- Returns
An object representing a extended long-running operation.
- Return type
google.api_core.extended_operation.ExtendedOperation
- reset(request: Optional[Union[google.cloud.compute_v1.types.compute.ResetInstanceRequest, dict]] = None, *, project: Optional[str] = None, zone: Optional[str] = None, instance: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.api_core.extended_operation.ExtendedOperation [source]¶
Performs a reset on the instance. This is a hard reset. The VM does not do a graceful shutdown. For more information, see Resetting an instance.
# This snippet 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 as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import compute_v1 def sample_reset(): # Create a client client = compute_v1.InstancesClient() # Initialize request argument(s) request = compute_v1.ResetInstanceRequest( instance="instance_value", project="project_value", zone="zone_value", ) # Make the request response = client.reset(request=request) # Handle the response print(response)
- Parameters
request (Union[google.cloud.compute_v1.types.ResetInstanceRequest, dict]) – The request object. A request message for Instances.Reset. See the method description for details.
project (str) – Project ID for this request. This corresponds to the
project
field on therequest
instance; ifrequest
is provided, this should not be set.zone (str) –
The name of the zone for this request.
This corresponds to the
zone
field on therequest
instance; ifrequest
is provided, this should not be set.instance (str) –
Name of the instance scoping this request.
This corresponds to the
instance
field on therequest
instance; ifrequest
is provided, this should not be set.retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.
timeout (float) – The timeout for this request.
metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.
- Returns
An object representing a extended long-running operation.
- Return type
google.api_core.extended_operation.ExtendedOperation
- reset_unary(request: Optional[Union[google.cloud.compute_v1.types.compute.ResetInstanceRequest, dict]] = None, *, project: Optional[str] = None, zone: Optional[str] = None, instance: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.cloud.compute_v1.types.compute.Operation [source]¶
Performs a reset on the instance. This is a hard reset. The VM does not do a graceful shutdown. For more information, see Resetting an instance.
# This snippet 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 as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import compute_v1 def sample_reset(): # Create a client client = compute_v1.InstancesClient() # Initialize request argument(s) request = compute_v1.ResetInstanceRequest( instance="instance_value", project="project_value", zone="zone_value", ) # Make the request response = client.reset(request=request) # Handle the response print(response)
- Parameters
request (Union[google.cloud.compute_v1.types.ResetInstanceRequest, dict]) – The request object. A request message for Instances.Reset. See the method description for details.
project (str) – Project ID for this request. This corresponds to the
project
field on therequest
instance; ifrequest
is provided, this should not be set.zone (str) –
The name of the zone for this request.
This corresponds to the
zone
field on therequest
instance; ifrequest
is provided, this should not be set.instance (str) –
Name of the instance scoping this request.
This corresponds to the
instance
field on therequest
instance; ifrequest
is provided, this should not be set.retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.
timeout (float) – The timeout for this request.
metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.
- Returns
An object representing a extended long-running operation.
- Return type
google.api_core.extended_operation.ExtendedOperation
- resume(request: Optional[Union[google.cloud.compute_v1.types.compute.ResumeInstanceRequest, dict]] = None, *, project: Optional[str] = None, zone: Optional[str] = None, instance: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.api_core.extended_operation.ExtendedOperation [source]¶
Resumes an instance that was suspended using the instances().suspend method.
# This snippet 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 as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import compute_v1 def sample_resume(): # Create a client client = compute_v1.InstancesClient() # Initialize request argument(s) request = compute_v1.ResumeInstanceRequest( instance="instance_value", project="project_value", zone="zone_value", ) # Make the request response = client.resume(request=request) # Handle the response print(response)
- Parameters
request (Union[google.cloud.compute_v1.types.ResumeInstanceRequest, dict]) – The request object. A request message for Instances.Resume. See the method description for details.
project (str) – Project ID for this request. This corresponds to the
project
field on therequest
instance; ifrequest
is provided, this should not be set.zone (str) –
The name of the zone for this request.
This corresponds to the
zone
field on therequest
instance; ifrequest
is provided, this should not be set.instance (str) –
Name of the instance resource to resume.
This corresponds to the
instance
field on therequest
instance; ifrequest
is provided, this should not be set.retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.
timeout (float) – The timeout for this request.
metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.
- Returns
An object representing a extended long-running operation.
- Return type
google.api_core.extended_operation.ExtendedOperation
- resume_unary(request: Optional[Union[google.cloud.compute_v1.types.compute.ResumeInstanceRequest, dict]] = None, *, project: Optional[str] = None, zone: Optional[str] = None, instance: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.cloud.compute_v1.types.compute.Operation [source]¶
Resumes an instance that was suspended using the instances().suspend method.
# This snippet 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 as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import compute_v1 def sample_resume(): # Create a client client = compute_v1.InstancesClient() # Initialize request argument(s) request = compute_v1.ResumeInstanceRequest( instance="instance_value", project="project_value", zone="zone_value", ) # Make the request response = client.resume(request=request) # Handle the response print(response)
- Parameters
request (Union[google.cloud.compute_v1.types.ResumeInstanceRequest, dict]) – The request object. A request message for Instances.Resume. See the method description for details.
project (str) – Project ID for this request. This corresponds to the
project
field on therequest
instance; ifrequest
is provided, this should not be set.zone (str) –
The name of the zone for this request.
This corresponds to the
zone
field on therequest
instance; ifrequest
is provided, this should not be set.instance (str) –
Name of the instance resource to resume.
This corresponds to the
instance
field on therequest
instance; ifrequest
is provided, this should not be set.retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.
timeout (float) – The timeout for this request.
metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.
- Returns
An object representing a extended long-running operation.
- Return type
google.api_core.extended_operation.ExtendedOperation
- send_diagnostic_interrupt(request: Optional[Union[google.cloud.compute_v1.types.compute.SendDiagnosticInterruptInstanceRequest, dict]] = None, *, project: Optional[str] = None, zone: Optional[str] = None, instance: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.cloud.compute_v1.types.compute.SendDiagnosticInterruptInstanceResponse [source]¶
Sends diagnostic interrupt to the instance.
# This snippet 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 as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import compute_v1 def sample_send_diagnostic_interrupt(): # Create a client client = compute_v1.InstancesClient() # Initialize request argument(s) request = compute_v1.SendDiagnosticInterruptInstanceRequest( instance="instance_value", project="project_value", zone="zone_value", ) # Make the request response = client.send_diagnostic_interrupt(request=request) # Handle the response print(response)
- Parameters
request (Union[google.cloud.compute_v1.types.SendDiagnosticInterruptInstanceRequest, dict]) – The request object. A request message for Instances.SendDiagnosticInterrupt. See the method description for details.
project (str) – Project ID for this request. This corresponds to the
project
field on therequest
instance; ifrequest
is provided, this should not be set.zone (str) –
The name of the zone for this request.
This corresponds to the
zone
field on therequest
instance; ifrequest
is provided, this should not be set.instance (str) –
Name of the instance scoping this request.
This corresponds to the
instance
field on therequest
instance; ifrequest
is provided, this should not be set.retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.
timeout (float) – The timeout for this request.
metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.
- Returns
A response message for Instances.SendDiagnosticInterrupt. See the method description for details.
- Return type
google.cloud.compute_v1.types.SendDiagnosticInterruptInstanceResponse
- set_deletion_protection(request: Optional[Union[google.cloud.compute_v1.types.compute.SetDeletionProtectionInstanceRequest, dict]] = None, *, project: Optional[str] = None, zone: Optional[str] = None, resource: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.api_core.extended_operation.ExtendedOperation [source]¶
Sets deletion protection on the instance.
# This snippet 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 as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import compute_v1 def sample_set_deletion_protection(): # Create a client client = compute_v1.InstancesClient() # Initialize request argument(s) request = compute_v1.SetDeletionProtectionInstanceRequest( project="project_value", resource="resource_value", zone="zone_value", ) # Make the request response = client.set_deletion_protection(request=request) # Handle the response print(response)
- Parameters
request (Union[google.cloud.compute_v1.types.SetDeletionProtectionInstanceRequest, dict]) – The request object. A request message for Instances.SetDeletionProtection. See the method description for details.
project (str) – Project ID for this request. This corresponds to the
project
field on therequest
instance; ifrequest
is provided, this should not be set.zone (str) –
The name of the zone for this request.
This corresponds to the
zone
field on therequest
instance; ifrequest
is provided, this should not be set.resource (str) –
Name or id of the resource for this request.
This corresponds to the
resource
field on therequest
instance; ifrequest
is provided, this should not be set.retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.
timeout (float) – The timeout for this request.
metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.
- Returns
An object representing a extended long-running operation.
- Return type
google.api_core.extended_operation.ExtendedOperation
- set_deletion_protection_unary(request: Optional[Union[google.cloud.compute_v1.types.compute.SetDeletionProtectionInstanceRequest, dict]] = None, *, project: Optional[str] = None, zone: Optional[str] = None, resource: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.cloud.compute_v1.types.compute.Operation [source]¶
Sets deletion protection on the instance.
# This snippet 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 as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import compute_v1 def sample_set_deletion_protection(): # Create a client client = compute_v1.InstancesClient() # Initialize request argument(s) request = compute_v1.SetDeletionProtectionInstanceRequest( project="project_value", resource="resource_value", zone="zone_value", ) # Make the request response = client.set_deletion_protection(request=request) # Handle the response print(response)
- Parameters
request (Union[google.cloud.compute_v1.types.SetDeletionProtectionInstanceRequest, dict]) – The request object. A request message for Instances.SetDeletionProtection. See the method description for details.
project (str) – Project ID for this request. This corresponds to the
project
field on therequest
instance; ifrequest
is provided, this should not be set.zone (str) –
The name of the zone for this request.
This corresponds to the
zone
field on therequest
instance; ifrequest
is provided, this should not be set.resource (str) –
Name or id of the resource for this request.
This corresponds to the
resource
field on therequest
instance; ifrequest
is provided, this should not be set.retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.
timeout (float) – The timeout for this request.
metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.
- Returns
An object representing a extended long-running operation.
- Return type
google.api_core.extended_operation.ExtendedOperation
- set_disk_auto_delete(request: Optional[Union[google.cloud.compute_v1.types.compute.SetDiskAutoDeleteInstanceRequest, dict]] = None, *, project: Optional[str] = None, zone: Optional[str] = None, instance: Optional[str] = None, auto_delete: Optional[bool] = None, device_name: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.api_core.extended_operation.ExtendedOperation [source]¶
Sets the auto-delete flag for a disk attached to an instance.
# This snippet 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 as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import compute_v1 def sample_set_disk_auto_delete(): # Create a client client = compute_v1.InstancesClient() # Initialize request argument(s) request = compute_v1.SetDiskAutoDeleteInstanceRequest( auto_delete=True, device_name="device_name_value", instance="instance_value", project="project_value", zone="zone_value", ) # Make the request response = client.set_disk_auto_delete(request=request) # Handle the response print(response)
- Parameters
request (Union[google.cloud.compute_v1.types.SetDiskAutoDeleteInstanceRequest, dict]) – The request object. A request message for Instances.SetDiskAutoDelete. See the method description for details.
project (str) – Project ID for this request. This corresponds to the
project
field on therequest
instance; ifrequest
is provided, this should not be set.zone (str) –
The name of the zone for this request.
This corresponds to the
zone
field on therequest
instance; ifrequest
is provided, this should not be set.instance (str) – The instance name for this request. This corresponds to the
instance
field on therequest
instance; ifrequest
is provided, this should not be set.auto_delete (bool) –
Whether to auto-delete the disk when the instance is deleted.
This corresponds to the
auto_delete
field on therequest
instance; ifrequest
is provided, this should not be set.device_name (str) –
The device name of the disk to modify. Make a get() request on the instance to view currently attached disks and device names.
This corresponds to the
device_name
field on therequest
instance; ifrequest
is provided, this should not be set.retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.
timeout (float) – The timeout for this request.
metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.
- Returns
An object representing a extended long-running operation.
- Return type
google.api_core.extended_operation.ExtendedOperation
- set_disk_auto_delete_unary(request: Optional[Union[google.cloud.compute_v1.types.compute.SetDiskAutoDeleteInstanceRequest, dict]] = None, *, project: Optional[str] = None, zone: Optional[str] = None, instance: Optional[str] = None, auto_delete: Optional[bool] = None, device_name: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.cloud.compute_v1.types.compute.Operation [source]¶
Sets the auto-delete flag for a disk attached to an instance.
# This snippet 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 as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import compute_v1 def sample_set_disk_auto_delete(): # Create a client client = compute_v1.InstancesClient() # Initialize request argument(s) request = compute_v1.SetDiskAutoDeleteInstanceRequest( auto_delete=True, device_name="device_name_value", instance="instance_value", project="project_value", zone="zone_value", ) # Make the request response = client.set_disk_auto_delete(request=request) # Handle the response print(response)
- Parameters
request (Union[google.cloud.compute_v1.types.SetDiskAutoDeleteInstanceRequest, dict]) – The request object. A request message for Instances.SetDiskAutoDelete. See the method description for details.
project (str) – Project ID for this request. This corresponds to the
project
field on therequest
instance; ifrequest
is provided, this should not be set.zone (str) –
The name of the zone for this request.
This corresponds to the
zone
field on therequest
instance; ifrequest
is provided, this should not be set.instance (str) – The instance name for this request. This corresponds to the
instance
field on therequest
instance; ifrequest
is provided, this should not be set.auto_delete (bool) –
Whether to auto-delete the disk when the instance is deleted.
This corresponds to the
auto_delete
field on therequest
instance; ifrequest
is provided, this should not be set.device_name (str) –
The device name of the disk to modify. Make a get() request on the instance to view currently attached disks and device names.
This corresponds to the
device_name
field on therequest
instance; ifrequest
is provided, this should not be set.retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.
timeout (float) – The timeout for this request.
metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.
- Returns
An object representing a extended long-running operation.
- Return type
google.api_core.extended_operation.ExtendedOperation
- set_iam_policy(request: Optional[Union[google.cloud.compute_v1.types.compute.SetIamPolicyInstanceRequest, dict]] = None, *, project: Optional[str] = None, zone: Optional[str] = None, resource: Optional[str] = None, zone_set_policy_request_resource: Optional[google.cloud.compute_v1.types.compute.ZoneSetPolicyRequest] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.cloud.compute_v1.types.compute.Policy [source]¶
Sets the access control policy on the specified resource. Replaces any existing policy.
# This snippet 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 as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import compute_v1 def sample_set_iam_policy(): # Create a client client = compute_v1.InstancesClient() # Initialize request argument(s) request = compute_v1.SetIamPolicyInstanceRequest( project="project_value", resource="resource_value", zone="zone_value", ) # Make the request response = client.set_iam_policy(request=request) # Handle the response print(response)
- Parameters
request (Union[google.cloud.compute_v1.types.SetIamPolicyInstanceRequest, dict]) – The request object. A request message for Instances.SetIamPolicy. See the method description for details.
project (str) – Project ID for this request. This corresponds to the
project
field on therequest
instance; ifrequest
is provided, this should not be set.zone (str) –
The name of the zone for this request.
This corresponds to the
zone
field on therequest
instance; ifrequest
is provided, this should not be set.resource (str) –
Name or id of the resource for this request.
This corresponds to the
resource
field on therequest
instance; ifrequest
is provided, this should not be set.zone_set_policy_request_resource (google.cloud.compute_v1.types.ZoneSetPolicyRequest) – The body resource for this request This corresponds to the
zone_set_policy_request_resource
field on therequest
instance; ifrequest
is provided, this should not be set.retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.
timeout (float) – The timeout for this request.
metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.
- Returns
An Identity and Access Management (IAM) policy, which specifies access controls for Google Cloud resources. A Policy is a collection of bindings. A binding binds one or more members, or principals, to a single role. Principals can be user accounts, service accounts, Google groups, and domains (such as G Suite). A role is a named list of permissions; each role can be an IAM predefined role or a user-created custom role. For some types of Google Cloud resources, a binding can also specify a condition, which is a logical expression that allows access to a resource only if the expression evaluates to true. A condition can add constraints based on attributes of the request, the resource, or both. To learn which resources support conditions in their IAM policies, see the [IAM documentation](https://cloud.google.com/iam/help/conditions/resource-policies). JSON example:
` { "bindings": [ { "role": "roles/resourcemanager.organizationAdmin", "members": [ "user:mike@example.com", "group:admins@example.com", "domain:google.com", "serviceAccount:my-project-id@appspot.gserviceaccount.com" ] }, { "role": "roles/resourcemanager.organizationViewer", "members": [ "user:eve@example.com" ], "condition": { "title": "expirable access", "description": "Does not grant access after Sep 2020", "expression": "request.time < timestamp('2020-10-01T00:00:00.000Z')", } } ], "etag": "BwWWja0YfJA=", "version": 3 }
` YAML example:` bindings: - members: - user:mike@example.com - group:admins@example.com - domain:google.com - serviceAccount:my-project-id@appspot.gserviceaccount.com role: roles/resourcemanager.organizationAdmin - members: - user:eve@example.com role: roles/resourcemanager.organizationViewer condition: title: expirable access description: Does not grant access after Sep 2020 expression: request.time < timestamp('2020-10-01T00:00:00.000Z') etag: BwWWja0YfJA= version: 3
` For a description of IAM and its features, see the [IAM documentation](https://cloud.google.com/iam/docs/).- Return type
- set_labels(request: Optional[Union[google.cloud.compute_v1.types.compute.SetLabelsInstanceRequest, dict]] = None, *, project: Optional[str] = None, zone: Optional[str] = None, instance: Optional[str] = None, instances_set_labels_request_resource: Optional[google.cloud.compute_v1.types.compute.InstancesSetLabelsRequest] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.api_core.extended_operation.ExtendedOperation [source]¶
Sets labels on an instance. To learn more about labels, read the Labeling Resources documentation.
# This snippet 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 as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import compute_v1 def sample_set_labels(): # Create a client client = compute_v1.InstancesClient() # Initialize request argument(s) request = compute_v1.SetLabelsInstanceRequest( instance="instance_value", project="project_value", zone="zone_value", ) # Make the request response = client.set_labels(request=request) # Handle the response print(response)
- Parameters
request (Union[google.cloud.compute_v1.types.SetLabelsInstanceRequest, dict]) – The request object. A request message for Instances.SetLabels. See the method description for details.
project (str) – Project ID for this request. This corresponds to the
project
field on therequest
instance; ifrequest
is provided, this should not be set.zone (str) –
The name of the zone for this request.
This corresponds to the
zone
field on therequest
instance; ifrequest
is provided, this should not be set.instance (str) –
Name of the instance scoping this request.
This corresponds to the
instance
field on therequest
instance; ifrequest
is provided, this should not be set.instances_set_labels_request_resource (google.cloud.compute_v1.types.InstancesSetLabelsRequest) – The body resource for this request This corresponds to the
instances_set_labels_request_resource
field on therequest
instance; ifrequest
is provided, this should not be set.retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.
timeout (float) – The timeout for this request.
metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.
- Returns
An object representing a extended long-running operation.
- Return type
google.api_core.extended_operation.ExtendedOperation
- set_labels_unary(request: Optional[Union[google.cloud.compute_v1.types.compute.SetLabelsInstanceRequest, dict]] = None, *, project: Optional[str] = None, zone: Optional[str] = None, instance: Optional[str] = None, instances_set_labels_request_resource: Optional[google.cloud.compute_v1.types.compute.InstancesSetLabelsRequest] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.cloud.compute_v1.types.compute.Operation [source]¶
Sets labels on an instance. To learn more about labels, read the Labeling Resources documentation.
# This snippet 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 as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import compute_v1 def sample_set_labels(): # Create a client client = compute_v1.InstancesClient() # Initialize request argument(s) request = compute_v1.SetLabelsInstanceRequest( instance="instance_value", project="project_value", zone="zone_value", ) # Make the request response = client.set_labels(request=request) # Handle the response print(response)
- Parameters
request (Union[google.cloud.compute_v1.types.SetLabelsInstanceRequest, dict]) – The request object. A request message for Instances.SetLabels. See the method description for details.
project (str) – Project ID for this request. This corresponds to the
project
field on therequest
instance; ifrequest
is provided, this should not be set.zone (str) –
The name of the zone for this request.
This corresponds to the
zone
field on therequest
instance; ifrequest
is provided, this should not be set.instance (str) –
Name of the instance scoping this request.
This corresponds to the
instance
field on therequest
instance; ifrequest
is provided, this should not be set.instances_set_labels_request_resource (google.cloud.compute_v1.types.InstancesSetLabelsRequest) – The body resource for this request This corresponds to the
instances_set_labels_request_resource
field on therequest
instance; ifrequest
is provided, this should not be set.retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.
timeout (float) – The timeout for this request.
metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.
- Returns
An object representing a extended long-running operation.
- Return type
google.api_core.extended_operation.ExtendedOperation
- set_machine_resources(request: Optional[Union[google.cloud.compute_v1.types.compute.SetMachineResourcesInstanceRequest, dict]] = None, *, project: Optional[str] = None, zone: Optional[str] = None, instance: Optional[str] = None, instances_set_machine_resources_request_resource: Optional[google.cloud.compute_v1.types.compute.InstancesSetMachineResourcesRequest] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.api_core.extended_operation.ExtendedOperation [source]¶
Changes the number and/or type of accelerator for a stopped instance to the values specified in the request.
# This snippet 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 as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import compute_v1 def sample_set_machine_resources(): # Create a client client = compute_v1.InstancesClient() # Initialize request argument(s) request = compute_v1.SetMachineResourcesInstanceRequest( instance="instance_value", project="project_value", zone="zone_value", ) # Make the request response = client.set_machine_resources(request=request) # Handle the response print(response)
- Parameters
request (Union[google.cloud.compute_v1.types.SetMachineResourcesInstanceRequest, dict]) – The request object. A request message for Instances.SetMachineResources. See the method description for details.
project (str) – Project ID for this request. This corresponds to the
project
field on therequest
instance; ifrequest
is provided, this should not be set.zone (str) –
The name of the zone for this request.
This corresponds to the
zone
field on therequest
instance; ifrequest
is provided, this should not be set.instance (str) –
Name of the instance scoping this request.
This corresponds to the
instance
field on therequest
instance; ifrequest
is provided, this should not be set.instances_set_machine_resources_request_resource (google.cloud.compute_v1.types.InstancesSetMachineResourcesRequest) – The body resource for this request This corresponds to the
instances_set_machine_resources_request_resource
field on therequest
instance; ifrequest
is provided, this should not be set.retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.
timeout (float) – The timeout for this request.
metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.
- Returns
An object representing a extended long-running operation.
- Return type
google.api_core.extended_operation.ExtendedOperation
- set_machine_resources_unary(request: Optional[Union[google.cloud.compute_v1.types.compute.SetMachineResourcesInstanceRequest, dict]] = None, *, project: Optional[str] = None, zone: Optional[str] = None, instance: Optional[str] = None, instances_set_machine_resources_request_resource: Optional[google.cloud.compute_v1.types.compute.InstancesSetMachineResourcesRequest] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.cloud.compute_v1.types.compute.Operation [source]¶
Changes the number and/or type of accelerator for a stopped instance to the values specified in the request.
# This snippet 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 as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import compute_v1 def sample_set_machine_resources(): # Create a client client = compute_v1.InstancesClient() # Initialize request argument(s) request = compute_v1.SetMachineResourcesInstanceRequest( instance="instance_value", project="project_value", zone="zone_value", ) # Make the request response = client.set_machine_resources(request=request) # Handle the response print(response)
- Parameters
request (Union[google.cloud.compute_v1.types.SetMachineResourcesInstanceRequest, dict]) – The request object. A request message for Instances.SetMachineResources. See the method description for details.
project (str) – Project ID for this request. This corresponds to the
project
field on therequest
instance; ifrequest
is provided, this should not be set.zone (str) –
The name of the zone for this request.
This corresponds to the
zone
field on therequest
instance; ifrequest
is provided, this should not be set.instance (str) –
Name of the instance scoping this request.
This corresponds to the
instance
field on therequest
instance; ifrequest
is provided, this should not be set.instances_set_machine_resources_request_resource (google.cloud.compute_v1.types.InstancesSetMachineResourcesRequest) – The body resource for this request This corresponds to the
instances_set_machine_resources_request_resource
field on therequest
instance; ifrequest
is provided, this should not be set.retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.
timeout (float) – The timeout for this request.
metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.
- Returns
An object representing a extended long-running operation.
- Return type
google.api_core.extended_operation.ExtendedOperation
- set_machine_type(request: Optional[Union[google.cloud.compute_v1.types.compute.SetMachineTypeInstanceRequest, dict]] = None, *, project: Optional[str] = None, zone: Optional[str] = None, instance: Optional[str] = None, instances_set_machine_type_request_resource: Optional[google.cloud.compute_v1.types.compute.InstancesSetMachineTypeRequest] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.api_core.extended_operation.ExtendedOperation [source]¶
Changes the machine type for a stopped instance to the machine type specified in the request.
# This snippet 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 as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import compute_v1 def sample_set_machine_type(): # Create a client client = compute_v1.InstancesClient() # Initialize request argument(s) request = compute_v1.SetMachineTypeInstanceRequest( instance="instance_value", project="project_value", zone="zone_value", ) # Make the request response = client.set_machine_type(request=request) # Handle the response print(response)
- Parameters
request (Union[google.cloud.compute_v1.types.SetMachineTypeInstanceRequest, dict]) – The request object. A request message for Instances.SetMachineType. See the method description for details.
project (str) – Project ID for this request. This corresponds to the
project
field on therequest
instance; ifrequest
is provided, this should not be set.zone (str) –
The name of the zone for this request.
This corresponds to the
zone
field on therequest
instance; ifrequest
is provided, this should not be set.instance (str) –
Name of the instance scoping this request.
This corresponds to the
instance
field on therequest
instance; ifrequest
is provided, this should not be set.instances_set_machine_type_request_resource (google.cloud.compute_v1.types.InstancesSetMachineTypeRequest) – The body resource for this request This corresponds to the
instances_set_machine_type_request_resource
field on therequest
instance; ifrequest
is provided, this should not be set.retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.
timeout (float) – The timeout for this request.
metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.
- Returns
An object representing a extended long-running operation.
- Return type
google.api_core.extended_operation.ExtendedOperation
- set_machine_type_unary(request: Optional[Union[google.cloud.compute_v1.types.compute.SetMachineTypeInstanceRequest, dict]] = None, *, project: Optional[str] = None, zone: Optional[str] = None, instance: Optional[str] = None, instances_set_machine_type_request_resource: Optional[google.cloud.compute_v1.types.compute.InstancesSetMachineTypeRequest] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.cloud.compute_v1.types.compute.Operation [source]¶
Changes the machine type for a stopped instance to the machine type specified in the request.
# This snippet 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 as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import compute_v1 def sample_set_machine_type(): # Create a client client = compute_v1.InstancesClient() # Initialize request argument(s) request = compute_v1.SetMachineTypeInstanceRequest( instance="instance_value", project="project_value", zone="zone_value", ) # Make the request response = client.set_machine_type(request=request) # Handle the response print(response)
- Parameters
request (Union[google.cloud.compute_v1.types.SetMachineTypeInstanceRequest, dict]) – The request object. A request message for Instances.SetMachineType. See the method description for details.
project (str) – Project ID for this request. This corresponds to the
project
field on therequest
instance; ifrequest
is provided, this should not be set.zone (str) –
The name of the zone for this request.
This corresponds to the
zone
field on therequest
instance; ifrequest
is provided, this should not be set.instance (str) –
Name of the instance scoping this request.
This corresponds to the
instance
field on therequest
instance; ifrequest
is provided, this should not be set.instances_set_machine_type_request_resource (google.cloud.compute_v1.types.InstancesSetMachineTypeRequest) – The body resource for this request This corresponds to the
instances_set_machine_type_request_resource
field on therequest
instance; ifrequest
is provided, this should not be set.retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.
timeout (float) – The timeout for this request.
metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.
- Returns
An object representing a extended long-running operation.
- Return type
google.api_core.extended_operation.ExtendedOperation
- set_metadata(request: Optional[Union[google.cloud.compute_v1.types.compute.SetMetadataInstanceRequest, dict]] = None, *, project: Optional[str] = None, zone: Optional[str] = None, instance: Optional[str] = None, metadata_resource: Optional[google.cloud.compute_v1.types.compute.Metadata] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.api_core.extended_operation.ExtendedOperation [source]¶
Sets metadata for the specified instance to the data included in the request.
# This snippet 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 as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import compute_v1 def sample_set_metadata(): # Create a client client = compute_v1.InstancesClient() # Initialize request argument(s) request = compute_v1.SetMetadataInstanceRequest( instance="instance_value", project="project_value", zone="zone_value", ) # Make the request response = client.set_metadata(request=request) # Handle the response print(response)
- Parameters
request (Union[google.cloud.compute_v1.types.SetMetadataInstanceRequest, dict]) – The request object. A request message for Instances.SetMetadata. See the method description for details.
project (str) – Project ID for this request. This corresponds to the
project
field on therequest
instance; ifrequest
is provided, this should not be set.zone (str) –
The name of the zone for this request.
This corresponds to the
zone
field on therequest
instance; ifrequest
is provided, this should not be set.instance (str) –
Name of the instance scoping this request.
This corresponds to the
instance
field on therequest
instance; ifrequest
is provided, this should not be set.metadata_resource (google.cloud.compute_v1.types.Metadata) – The body resource for this request This corresponds to the
metadata_resource
field on therequest
instance; ifrequest
is provided, this should not be set.retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.
timeout (float) – The timeout for this request.
metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.
- Returns
An object representing a extended long-running operation.
- Return type
google.api_core.extended_operation.ExtendedOperation
- set_metadata_unary(request: Optional[Union[google.cloud.compute_v1.types.compute.SetMetadataInstanceRequest, dict]] = None, *, project: Optional[str] = None, zone: Optional[str] = None, instance: Optional[str] = None, metadata_resource: Optional[google.cloud.compute_v1.types.compute.Metadata] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.cloud.compute_v1.types.compute.Operation [source]¶
Sets metadata for the specified instance to the data included in the request.
# This snippet 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 as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import compute_v1 def sample_set_metadata(): # Create a client client = compute_v1.InstancesClient() # Initialize request argument(s) request = compute_v1.SetMetadataInstanceRequest( instance="instance_value", project="project_value", zone="zone_value", ) # Make the request response = client.set_metadata(request=request) # Handle the response print(response)
- Parameters
request (Union[google.cloud.compute_v1.types.SetMetadataInstanceRequest, dict]) – The request object. A request message for Instances.SetMetadata. See the method description for details.
project (str) – Project ID for this request. This corresponds to the
project
field on therequest
instance; ifrequest
is provided, this should not be set.zone (str) –
The name of the zone for this request.
This corresponds to the
zone
field on therequest
instance; ifrequest
is provided, this should not be set.instance (str) –
Name of the instance scoping this request.
This corresponds to the
instance
field on therequest
instance; ifrequest
is provided, this should not be set.metadata_resource (google.cloud.compute_v1.types.Metadata) – The body resource for this request This corresponds to the
metadata_resource
field on therequest
instance; ifrequest
is provided, this should not be set.retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.
timeout (float) – The timeout for this request.
metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.
- Returns
An object representing a extended long-running operation.
- Return type
google.api_core.extended_operation.ExtendedOperation
- set_min_cpu_platform(request: Optional[Union[google.cloud.compute_v1.types.compute.SetMinCpuPlatformInstanceRequest, dict]] = None, *, project: Optional[str] = None, zone: Optional[str] = None, instance: Optional[str] = None, instances_set_min_cpu_platform_request_resource: Optional[google.cloud.compute_v1.types.compute.InstancesSetMinCpuPlatformRequest] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.api_core.extended_operation.ExtendedOperation [source]¶
Changes the minimum CPU platform that this instance should use. This method can only be called on a stopped instance. For more information, read Specifying a Minimum CPU Platform.
# This snippet 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 as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import compute_v1 def sample_set_min_cpu_platform(): # Create a client client = compute_v1.InstancesClient() # Initialize request argument(s) request = compute_v1.SetMinCpuPlatformInstanceRequest( instance="instance_value", project="project_value", zone="zone_value", ) # Make the request response = client.set_min_cpu_platform(request=request) # Handle the response print(response)
- Parameters
request (Union[google.cloud.compute_v1.types.SetMinCpuPlatformInstanceRequest, dict]) – The request object. A request message for Instances.SetMinCpuPlatform. See the method description for details.
project (str) – Project ID for this request. This corresponds to the
project
field on therequest
instance; ifrequest
is provided, this should not be set.zone (str) –
The name of the zone for this request.
This corresponds to the
zone
field on therequest
instance; ifrequest
is provided, this should not be set.instance (str) –
Name of the instance scoping this request.
This corresponds to the
instance
field on therequest
instance; ifrequest
is provided, this should not be set.instances_set_min_cpu_platform_request_resource (google.cloud.compute_v1.types.InstancesSetMinCpuPlatformRequest) – The body resource for this request This corresponds to the
instances_set_min_cpu_platform_request_resource
field on therequest
instance; ifrequest
is provided, this should not be set.retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.
timeout (float) – The timeout for this request.
metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.
- Returns
An object representing a extended long-running operation.
- Return type
google.api_core.extended_operation.ExtendedOperation
- set_min_cpu_platform_unary(request: Optional[Union[google.cloud.compute_v1.types.compute.SetMinCpuPlatformInstanceRequest, dict]] = None, *, project: Optional[str] = None, zone: Optional[str] = None, instance: Optional[str] = None, instances_set_min_cpu_platform_request_resource: Optional[google.cloud.compute_v1.types.compute.InstancesSetMinCpuPlatformRequest] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.cloud.compute_v1.types.compute.Operation [source]¶
Changes the minimum CPU platform that this instance should use. This method can only be called on a stopped instance. For more information, read Specifying a Minimum CPU Platform.
# This snippet 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 as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import compute_v1 def sample_set_min_cpu_platform(): # Create a client client = compute_v1.InstancesClient() # Initialize request argument(s) request = compute_v1.SetMinCpuPlatformInstanceRequest( instance="instance_value", project="project_value", zone="zone_value", ) # Make the request response = client.set_min_cpu_platform(request=request) # Handle the response print(response)
- Parameters
request (Union[google.cloud.compute_v1.types.SetMinCpuPlatformInstanceRequest, dict]) – The request object. A request message for Instances.SetMinCpuPlatform. See the method description for details.
project (str) – Project ID for this request. This corresponds to the
project
field on therequest
instance; ifrequest
is provided, this should not be set.zone (str) –
The name of the zone for this request.
This corresponds to the
zone
field on therequest
instance; ifrequest
is provided, this should not be set.instance (str) –
Name of the instance scoping this request.
This corresponds to the
instance
field on therequest
instance; ifrequest
is provided, this should not be set.instances_set_min_cpu_platform_request_resource (google.cloud.compute_v1.types.InstancesSetMinCpuPlatformRequest) – The body resource for this request This corresponds to the
instances_set_min_cpu_platform_request_resource
field on therequest
instance; ifrequest
is provided, this should not be set.retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.
timeout (float) – The timeout for this request.
metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.
- Returns
An object representing a extended long-running operation.
- Return type
google.api_core.extended_operation.ExtendedOperation
- set_name(request: Optional[Union[google.cloud.compute_v1.types.compute.SetNameInstanceRequest, dict]] = None, *, project: Optional[str] = None, zone: Optional[str] = None, instance: Optional[str] = None, instances_set_name_request_resource: Optional[google.cloud.compute_v1.types.compute.InstancesSetNameRequest] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.api_core.extended_operation.ExtendedOperation [source]¶
Sets name of an instance.
# This snippet 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 as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import compute_v1 def sample_set_name(): # Create a client client = compute_v1.InstancesClient() # Initialize request argument(s) request = compute_v1.SetNameInstanceRequest( instance="instance_value", project="project_value", zone="zone_value", ) # Make the request response = client.set_name(request=request) # Handle the response print(response)
- Parameters
request (Union[google.cloud.compute_v1.types.SetNameInstanceRequest, dict]) – The request object. A request message for Instances.SetName. See the method description for details.
project (str) – Project ID for this request. This corresponds to the
project
field on therequest
instance; ifrequest
is provided, this should not be set.zone (str) –
The name of the zone for this request.
This corresponds to the
zone
field on therequest
instance; ifrequest
is provided, this should not be set.instance (str) – The instance name for this request. This corresponds to the
instance
field on therequest
instance; ifrequest
is provided, this should not be set.instances_set_name_request_resource (google.cloud.compute_v1.types.InstancesSetNameRequest) – The body resource for this request This corresponds to the
instances_set_name_request_resource
field on therequest
instance; ifrequest
is provided, this should not be set.retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.
timeout (float) – The timeout for this request.
metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.
- Returns
An object representing a extended long-running operation.
- Return type
google.api_core.extended_operation.ExtendedOperation
- set_name_unary(request: Optional[Union[google.cloud.compute_v1.types.compute.SetNameInstanceRequest, dict]] = None, *, project: Optional[str] = None, zone: Optional[str] = None, instance: Optional[str] = None, instances_set_name_request_resource: Optional[google.cloud.compute_v1.types.compute.InstancesSetNameRequest] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.cloud.compute_v1.types.compute.Operation [source]¶
Sets name of an instance.
# This snippet 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 as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import compute_v1 def sample_set_name(): # Create a client client = compute_v1.InstancesClient() # Initialize request argument(s) request = compute_v1.SetNameInstanceRequest( instance="instance_value", project="project_value", zone="zone_value", ) # Make the request response = client.set_name(request=request) # Handle the response print(response)
- Parameters
request (Union[google.cloud.compute_v1.types.SetNameInstanceRequest, dict]) – The request object. A request message for Instances.SetName. See the method description for details.
project (str) – Project ID for this request. This corresponds to the
project
field on therequest
instance; ifrequest
is provided, this should not be set.zone (str) –
The name of the zone for this request.
This corresponds to the
zone
field on therequest
instance; ifrequest
is provided, this should not be set.instance (str) – The instance name for this request. This corresponds to the
instance
field on therequest
instance; ifrequest
is provided, this should not be set.instances_set_name_request_resource (google.cloud.compute_v1.types.InstancesSetNameRequest) – The body resource for this request This corresponds to the
instances_set_name_request_resource
field on therequest
instance; ifrequest
is provided, this should not be set.retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.
timeout (float) – The timeout for this request.
metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.
- Returns
An object representing a extended long-running operation.
- Return type
google.api_core.extended_operation.ExtendedOperation
- set_scheduling(request: Optional[Union[google.cloud.compute_v1.types.compute.SetSchedulingInstanceRequest, dict]] = None, *, project: Optional[str] = None, zone: Optional[str] = None, instance: Optional[str] = None, scheduling_resource: Optional[google.cloud.compute_v1.types.compute.Scheduling] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.api_core.extended_operation.ExtendedOperation [source]¶
Sets an instance’s scheduling options. You can only call this method on a stopped instance, that is, a VM instance that is in a
TERMINATED
state. See Instance Life Cycle for more information on the possible instance states. For more information about setting scheduling options for a VM, see Set VM host maintenance policy.# This snippet 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 as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import compute_v1 def sample_set_scheduling(): # Create a client client = compute_v1.InstancesClient() # Initialize request argument(s) request = compute_v1.SetSchedulingInstanceRequest( instance="instance_value", project="project_value", zone="zone_value", ) # Make the request response = client.set_scheduling(request=request) # Handle the response print(response)
- Parameters
request (Union[google.cloud.compute_v1.types.SetSchedulingInstanceRequest, dict]) – The request object. A request message for Instances.SetScheduling. See the method description for details.
project (str) – Project ID for this request. This corresponds to the
project
field on therequest
instance; ifrequest
is provided, this should not be set.zone (str) –
The name of the zone for this request.
This corresponds to the
zone
field on therequest
instance; ifrequest
is provided, this should not be set.instance (str) – Instance name for this request. This corresponds to the
instance
field on therequest
instance; ifrequest
is provided, this should not be set.scheduling_resource (google.cloud.compute_v1.types.Scheduling) – The body resource for this request This corresponds to the
scheduling_resource
field on therequest
instance; ifrequest
is provided, this should not be set.retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.
timeout (float) – The timeout for this request.
metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.
- Returns
An object representing a extended long-running operation.
- Return type
google.api_core.extended_operation.ExtendedOperation
- set_scheduling_unary(request: Optional[Union[google.cloud.compute_v1.types.compute.SetSchedulingInstanceRequest, dict]] = None, *, project: Optional[str] = None, zone: Optional[str] = None, instance: Optional[str] = None, scheduling_resource: Optional[google.cloud.compute_v1.types.compute.Scheduling] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.cloud.compute_v1.types.compute.Operation [source]¶
Sets an instance’s scheduling options. You can only call this method on a stopped instance, that is, a VM instance that is in a
TERMINATED
state. See Instance Life Cycle for more information on the possible instance states. For more information about setting scheduling options for a VM, see Set VM host maintenance policy.# This snippet 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 as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import compute_v1 def sample_set_scheduling(): # Create a client client = compute_v1.InstancesClient() # Initialize request argument(s) request = compute_v1.SetSchedulingInstanceRequest( instance="instance_value", project="project_value", zone="zone_value", ) # Make the request response = client.set_scheduling(request=request) # Handle the response print(response)
- Parameters
request (Union[google.cloud.compute_v1.types.SetSchedulingInstanceRequest, dict]) – The request object. A request message for Instances.SetScheduling. See the method description for details.
project (str) – Project ID for this request. This corresponds to the
project
field on therequest
instance; ifrequest
is provided, this should not be set.zone (str) –
The name of the zone for this request.
This corresponds to the
zone
field on therequest
instance; ifrequest
is provided, this should not be set.instance (str) – Instance name for this request. This corresponds to the
instance
field on therequest
instance; ifrequest
is provided, this should not be set.scheduling_resource (google.cloud.compute_v1.types.Scheduling) – The body resource for this request This corresponds to the
scheduling_resource
field on therequest
instance; ifrequest
is provided, this should not be set.retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.
timeout (float) – The timeout for this request.
metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.
- Returns
An object representing a extended long-running operation.
- Return type
google.api_core.extended_operation.ExtendedOperation
- set_security_policy(request: Optional[Union[google.cloud.compute_v1.types.compute.SetSecurityPolicyInstanceRequest, dict]] = None, *, project: Optional[str] = None, zone: Optional[str] = None, instance: Optional[str] = None, instances_set_security_policy_request_resource: Optional[google.cloud.compute_v1.types.compute.InstancesSetSecurityPolicyRequest] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.api_core.extended_operation.ExtendedOperation [source]¶
Sets the Google Cloud Armor security policy for the specified instance. For more information, see Google Cloud Armor Overview
# This snippet 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 as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import compute_v1 def sample_set_security_policy(): # Create a client client = compute_v1.InstancesClient() # Initialize request argument(s) request = compute_v1.SetSecurityPolicyInstanceRequest( instance="instance_value", project="project_value", zone="zone_value", ) # Make the request response = client.set_security_policy(request=request) # Handle the response print(response)
- Parameters
request (Union[google.cloud.compute_v1.types.SetSecurityPolicyInstanceRequest, dict]) – The request object. A request message for Instances.SetSecurityPolicy. See the method description for details.
project (str) – Project ID for this request. This corresponds to the
project
field on therequest
instance; ifrequest
is provided, this should not be set.zone (str) –
Name of the zone scoping this request.
This corresponds to the
zone
field on therequest
instance; ifrequest
is provided, this should not be set.instance (str) –
Name of the Instance resource to which the security policy should be set. The name should conform to RFC1035.
This corresponds to the
instance
field on therequest
instance; ifrequest
is provided, this should not be set.instances_set_security_policy_request_resource (google.cloud.compute_v1.types.InstancesSetSecurityPolicyRequest) – The body resource for this request This corresponds to the
instances_set_security_policy_request_resource
field on therequest
instance; ifrequest
is provided, this should not be set.retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.
timeout (float) – The timeout for this request.
metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.
- Returns
An object representing a extended long-running operation.
- Return type
google.api_core.extended_operation.ExtendedOperation
- set_security_policy_unary(request: Optional[Union[google.cloud.compute_v1.types.compute.SetSecurityPolicyInstanceRequest, dict]] = None, *, project: Optional[str] = None, zone: Optional[str] = None, instance: Optional[str] = None, instances_set_security_policy_request_resource: Optional[google.cloud.compute_v1.types.compute.InstancesSetSecurityPolicyRequest] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.cloud.compute_v1.types.compute.Operation [source]¶
Sets the Google Cloud Armor security policy for the specified instance. For more information, see Google Cloud Armor Overview
# This snippet 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 as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import compute_v1 def sample_set_security_policy(): # Create a client client = compute_v1.InstancesClient() # Initialize request argument(s) request = compute_v1.SetSecurityPolicyInstanceRequest( instance="instance_value", project="project_value", zone="zone_value", ) # Make the request response = client.set_security_policy(request=request) # Handle the response print(response)
- Parameters
request (Union[google.cloud.compute_v1.types.SetSecurityPolicyInstanceRequest, dict]) – The request object. A request message for Instances.SetSecurityPolicy. See the method description for details.
project (str) – Project ID for this request. This corresponds to the
project
field on therequest
instance; ifrequest
is provided, this should not be set.zone (str) –
Name of the zone scoping this request.
This corresponds to the
zone
field on therequest
instance; ifrequest
is provided, this should not be set.instance (str) –
Name of the Instance resource to which the security policy should be set. The name should conform to RFC1035.
This corresponds to the
instance
field on therequest
instance; ifrequest
is provided, this should not be set.instances_set_security_policy_request_resource (google.cloud.compute_v1.types.InstancesSetSecurityPolicyRequest) – The body resource for this request This corresponds to the
instances_set_security_policy_request_resource
field on therequest
instance; ifrequest
is provided, this should not be set.retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.
timeout (float) – The timeout for this request.
metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.
- Returns
An object representing a extended long-running operation.
- Return type
google.api_core.extended_operation.ExtendedOperation
- set_service_account(request: Optional[Union[google.cloud.compute_v1.types.compute.SetServiceAccountInstanceRequest, dict]] = None, *, project: Optional[str] = None, zone: Optional[str] = None, instance: Optional[str] = None, instances_set_service_account_request_resource: Optional[google.cloud.compute_v1.types.compute.InstancesSetServiceAccountRequest] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.api_core.extended_operation.ExtendedOperation [source]¶
Sets the service account on the instance. For more information, read Changing the service account and access scopes for an instance.
# This snippet 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 as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import compute_v1 def sample_set_service_account(): # Create a client client = compute_v1.InstancesClient() # Initialize request argument(s) request = compute_v1.SetServiceAccountInstanceRequest( instance="instance_value", project="project_value", zone="zone_value", ) # Make the request response = client.set_service_account(request=request) # Handle the response print(response)
- Parameters
request (Union[google.cloud.compute_v1.types.SetServiceAccountInstanceRequest, dict]) – The request object. A request message for Instances.SetServiceAccount. See the method description for details.
project (str) – Project ID for this request. This corresponds to the
project
field on therequest
instance; ifrequest
is provided, this should not be set.zone (str) –
The name of the zone for this request.
This corresponds to the
zone
field on therequest
instance; ifrequest
is provided, this should not be set.instance (str) –
Name of the instance resource to start.
This corresponds to the
instance
field on therequest
instance; ifrequest
is provided, this should not be set.instances_set_service_account_request_resource (google.cloud.compute_v1.types.InstancesSetServiceAccountRequest) – The body resource for this request This corresponds to the
instances_set_service_account_request_resource
field on therequest
instance; ifrequest
is provided, this should not be set.retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.
timeout (float) – The timeout for this request.
metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.
- Returns
An object representing a extended long-running operation.
- Return type
google.api_core.extended_operation.ExtendedOperation
- set_service_account_unary(request: Optional[Union[google.cloud.compute_v1.types.compute.SetServiceAccountInstanceRequest, dict]] = None, *, project: Optional[str] = None, zone: Optional[str] = None, instance: Optional[str] = None, instances_set_service_account_request_resource: Optional[google.cloud.compute_v1.types.compute.InstancesSetServiceAccountRequest] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.cloud.compute_v1.types.compute.Operation [source]¶
Sets the service account on the instance. For more information, read Changing the service account and access scopes for an instance.
# This snippet 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 as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import compute_v1 def sample_set_service_account(): # Create a client client = compute_v1.InstancesClient() # Initialize request argument(s) request = compute_v1.SetServiceAccountInstanceRequest( instance="instance_value", project="project_value", zone="zone_value", ) # Make the request response = client.set_service_account(request=request) # Handle the response print(response)
- Parameters
request (Union[google.cloud.compute_v1.types.SetServiceAccountInstanceRequest, dict]) – The request object. A request message for Instances.SetServiceAccount. See the method description for details.
project (str) – Project ID for this request. This corresponds to the
project
field on therequest
instance; ifrequest
is provided, this should not be set.zone (str) –
The name of the zone for this request.
This corresponds to the
zone
field on therequest
instance; ifrequest
is provided, this should not be set.instance (str) –
Name of the instance resource to start.
This corresponds to the
instance
field on therequest
instance; ifrequest
is provided, this should not be set.instances_set_service_account_request_resource (google.cloud.compute_v1.types.InstancesSetServiceAccountRequest) – The body resource for this request This corresponds to the
instances_set_service_account_request_resource
field on therequest
instance; ifrequest
is provided, this should not be set.retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.
timeout (float) – The timeout for this request.
metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.
- Returns
An object representing a extended long-running operation.
- Return type
google.api_core.extended_operation.ExtendedOperation
- set_shielded_instance_integrity_policy(request: Optional[Union[google.cloud.compute_v1.types.compute.SetShieldedInstanceIntegrityPolicyInstanceRequest, dict]] = None, *, project: Optional[str] = None, zone: Optional[str] = None, instance: Optional[str] = None, shielded_instance_integrity_policy_resource: Optional[google.cloud.compute_v1.types.compute.ShieldedInstanceIntegrityPolicy] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.api_core.extended_operation.ExtendedOperation [source]¶
Sets the Shielded Instance integrity policy for an instance. You can only use this method on a running instance. This method supports PATCH semantics and uses the JSON merge patch format and processing rules.
# This snippet 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 as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import compute_v1 def sample_set_shielded_instance_integrity_policy(): # Create a client client = compute_v1.InstancesClient() # Initialize request argument(s) request = compute_v1.SetShieldedInstanceIntegrityPolicyInstanceRequest( instance="instance_value", project="project_value", zone="zone_value", ) # Make the request response = client.set_shielded_instance_integrity_policy(request=request) # Handle the response print(response)
- Parameters
request (Union[google.cloud.compute_v1.types.SetShieldedInstanceIntegrityPolicyInstanceRequest, dict]) – The request object. A request message for Instances.SetShieldedInstanceIntegrityPolicy. See the method description for details.
project (str) – Project ID for this request. This corresponds to the
project
field on therequest
instance; ifrequest
is provided, this should not be set.zone (str) –
The name of the zone for this request.
This corresponds to the
zone
field on therequest
instance; ifrequest
is provided, this should not be set.instance (str) –
Name or id of the instance scoping this request.
This corresponds to the
instance
field on therequest
instance; ifrequest
is provided, this should not be set.shielded_instance_integrity_policy_resource (google.cloud.compute_v1.types.ShieldedInstanceIntegrityPolicy) – The body resource for this request This corresponds to the
shielded_instance_integrity_policy_resource
field on therequest
instance; ifrequest
is provided, this should not be set.retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.
timeout (float) – The timeout for this request.
metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.
- Returns
An object representing a extended long-running operation.
- Return type
google.api_core.extended_operation.ExtendedOperation
- set_shielded_instance_integrity_policy_unary(request: Optional[Union[google.cloud.compute_v1.types.compute.SetShieldedInstanceIntegrityPolicyInstanceRequest, dict]] = None, *, project: Optional[str] = None, zone: Optional[str] = None, instance: Optional[str] = None, shielded_instance_integrity_policy_resource: Optional[google.cloud.compute_v1.types.compute.ShieldedInstanceIntegrityPolicy] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.cloud.compute_v1.types.compute.Operation [source]¶
Sets the Shielded Instance integrity policy for an instance. You can only use this method on a running instance. This method supports PATCH semantics and uses the JSON merge patch format and processing rules.
# This snippet 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 as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import compute_v1 def sample_set_shielded_instance_integrity_policy(): # Create a client client = compute_v1.InstancesClient() # Initialize request argument(s) request = compute_v1.SetShieldedInstanceIntegrityPolicyInstanceRequest( instance="instance_value", project="project_value", zone="zone_value", ) # Make the request response = client.set_shielded_instance_integrity_policy(request=request) # Handle the response print(response)
- Parameters
request (Union[google.cloud.compute_v1.types.SetShieldedInstanceIntegrityPolicyInstanceRequest, dict]) – The request object. A request message for Instances.SetShieldedInstanceIntegrityPolicy. See the method description for details.
project (str) – Project ID for this request. This corresponds to the
project
field on therequest
instance; ifrequest
is provided, this should not be set.zone (str) –
The name of the zone for this request.
This corresponds to the
zone
field on therequest
instance; ifrequest
is provided, this should not be set.instance (str) –
Name or id of the instance scoping this request.
This corresponds to the
instance
field on therequest
instance; ifrequest
is provided, this should not be set.shielded_instance_integrity_policy_resource (google.cloud.compute_v1.types.ShieldedInstanceIntegrityPolicy) – The body resource for this request This corresponds to the
shielded_instance_integrity_policy_resource
field on therequest
instance; ifrequest
is provided, this should not be set.retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.
timeout (float) – The timeout for this request.
metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.
- Returns
An object representing a extended long-running operation.
- Return type
google.api_core.extended_operation.ExtendedOperation
- set_tags(request: Optional[Union[google.cloud.compute_v1.types.compute.SetTagsInstanceRequest, dict]] = None, *, project: Optional[str] = None, zone: Optional[str] = None, instance: Optional[str] = None, tags_resource: Optional[google.cloud.compute_v1.types.compute.Tags] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.api_core.extended_operation.ExtendedOperation [source]¶
Sets network tags for the specified instance to the data included in the request.
# This snippet 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 as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import compute_v1 def sample_set_tags(): # Create a client client = compute_v1.InstancesClient() # Initialize request argument(s) request = compute_v1.SetTagsInstanceRequest( instance="instance_value", project="project_value", zone="zone_value", ) # Make the request response = client.set_tags(request=request) # Handle the response print(response)
- Parameters
request (Union[google.cloud.compute_v1.types.SetTagsInstanceRequest, dict]) – The request object. A request message for Instances.SetTags. See the method description for details.
project (str) – Project ID for this request. This corresponds to the
project
field on therequest
instance; ifrequest
is provided, this should not be set.zone (str) –
The name of the zone for this request.
This corresponds to the
zone
field on therequest
instance; ifrequest
is provided, this should not be set.instance (str) –
Name of the instance scoping this request.
This corresponds to the
instance
field on therequest
instance; ifrequest
is provided, this should not be set.tags_resource (google.cloud.compute_v1.types.Tags) – The body resource for this request This corresponds to the
tags_resource
field on therequest
instance; ifrequest
is provided, this should not be set.retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.
timeout (float) – The timeout for this request.
metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.
- Returns
An object representing a extended long-running operation.
- Return type
google.api_core.extended_operation.ExtendedOperation
- set_tags_unary(request: Optional[Union[google.cloud.compute_v1.types.compute.SetTagsInstanceRequest, dict]] = None, *, project: Optional[str] = None, zone: Optional[str] = None, instance: Optional[str] = None, tags_resource: Optional[google.cloud.compute_v1.types.compute.Tags] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.cloud.compute_v1.types.compute.Operation [source]¶
Sets network tags for the specified instance to the data included in the request.
# This snippet 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 as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import compute_v1 def sample_set_tags(): # Create a client client = compute_v1.InstancesClient() # Initialize request argument(s) request = compute_v1.SetTagsInstanceRequest( instance="instance_value", project="project_value", zone="zone_value", ) # Make the request response = client.set_tags(request=request) # Handle the response print(response)
- Parameters
request (Union[google.cloud.compute_v1.types.SetTagsInstanceRequest, dict]) – The request object. A request message for Instances.SetTags. See the method description for details.
project (str) – Project ID for this request. This corresponds to the
project
field on therequest
instance; ifrequest
is provided, this should not be set.zone (str) –
The name of the zone for this request.
This corresponds to the
zone
field on therequest
instance; ifrequest
is provided, this should not be set.instance (str) –
Name of the instance scoping this request.
This corresponds to the
instance
field on therequest
instance; ifrequest
is provided, this should not be set.tags_resource (google.cloud.compute_v1.types.Tags) – The body resource for this request This corresponds to the
tags_resource
field on therequest
instance; ifrequest
is provided, this should not be set.retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.
timeout (float) – The timeout for this request.
metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.
- Returns
An object representing a extended long-running operation.
- Return type
google.api_core.extended_operation.ExtendedOperation
- simulate_maintenance_event(request: Optional[Union[google.cloud.compute_v1.types.compute.SimulateMaintenanceEventInstanceRequest, dict]] = None, *, project: Optional[str] = None, zone: Optional[str] = None, instance: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.api_core.extended_operation.ExtendedOperation [source]¶
Simulates a host maintenance event on a VM. For more information, see Simulate a host maintenance event.
# This snippet 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 as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import compute_v1 def sample_simulate_maintenance_event(): # Create a client client = compute_v1.InstancesClient() # Initialize request argument(s) request = compute_v1.SimulateMaintenanceEventInstanceRequest( instance="instance_value", project="project_value", zone="zone_value", ) # Make the request response = client.simulate_maintenance_event(request=request) # Handle the response print(response)
- Parameters
request (Union[google.cloud.compute_v1.types.SimulateMaintenanceEventInstanceRequest, dict]) – The request object. A request message for Instances.SimulateMaintenanceEvent. See the method description for details.
project (str) – Project ID for this request. This corresponds to the
project
field on therequest
instance; ifrequest
is provided, this should not be set.zone (str) –
The name of the zone for this request.
This corresponds to the
zone
field on therequest
instance; ifrequest
is provided, this should not be set.instance (str) –
Name of the instance scoping this request.
This corresponds to the
instance
field on therequest
instance; ifrequest
is provided, this should not be set.retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.
timeout (float) – The timeout for this request.
metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.
- Returns
An object representing a extended long-running operation.
- Return type
google.api_core.extended_operation.ExtendedOperation
- simulate_maintenance_event_unary(request: Optional[Union[google.cloud.compute_v1.types.compute.SimulateMaintenanceEventInstanceRequest, dict]] = None, *, project: Optional[str] = None, zone: Optional[str] = None, instance: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.cloud.compute_v1.types.compute.Operation [source]¶
Simulates a host maintenance event on a VM. For more information, see Simulate a host maintenance event.
# This snippet 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 as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import compute_v1 def sample_simulate_maintenance_event(): # Create a client client = compute_v1.InstancesClient() # Initialize request argument(s) request = compute_v1.SimulateMaintenanceEventInstanceRequest( instance="instance_value", project="project_value", zone="zone_value", ) # Make the request response = client.simulate_maintenance_event(request=request) # Handle the response print(response)
- Parameters
request (Union[google.cloud.compute_v1.types.SimulateMaintenanceEventInstanceRequest, dict]) – The request object. A request message for Instances.SimulateMaintenanceEvent. See the method description for details.
project (str) – Project ID for this request. This corresponds to the
project
field on therequest
instance; ifrequest
is provided, this should not be set.zone (str) –
The name of the zone for this request.
This corresponds to the
zone
field on therequest
instance; ifrequest
is provided, this should not be set.instance (str) –
Name of the instance scoping this request.
This corresponds to the
instance
field on therequest
instance; ifrequest
is provided, this should not be set.retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.
timeout (float) – The timeout for this request.
metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.
- Returns
An object representing a extended long-running operation.
- Return type
google.api_core.extended_operation.ExtendedOperation
- start(request: Optional[Union[google.cloud.compute_v1.types.compute.StartInstanceRequest, dict]] = None, *, project: Optional[str] = None, zone: Optional[str] = None, instance: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.api_core.extended_operation.ExtendedOperation [source]¶
Starts an instance that was stopped using the instances().stop method. For more information, see Restart an instance.
# This snippet 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 as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import compute_v1 def sample_start(): # Create a client client = compute_v1.InstancesClient() # Initialize request argument(s) request = compute_v1.StartInstanceRequest( instance="instance_value", project="project_value", zone="zone_value", ) # Make the request response = client.start(request=request) # Handle the response print(response)
- Parameters
request (Union[google.cloud.compute_v1.types.StartInstanceRequest, dict]) – The request object. A request message for Instances.Start. See the method description for details.
project (str) – Project ID for this request. This corresponds to the
project
field on therequest
instance; ifrequest
is provided, this should not be set.zone (str) –
The name of the zone for this request.
This corresponds to the
zone
field on therequest
instance; ifrequest
is provided, this should not be set.instance (str) –
Name of the instance resource to start.
This corresponds to the
instance
field on therequest
instance; ifrequest
is provided, this should not be set.retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.
timeout (float) – The timeout for this request.
metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.
- Returns
An object representing a extended long-running operation.
- Return type
google.api_core.extended_operation.ExtendedOperation
- start_unary(request: Optional[Union[google.cloud.compute_v1.types.compute.StartInstanceRequest, dict]] = None, *, project: Optional[str] = None, zone: Optional[str] = None, instance: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.cloud.compute_v1.types.compute.Operation [source]¶
Starts an instance that was stopped using the instances().stop method. For more information, see Restart an instance.
# This snippet 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 as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import compute_v1 def sample_start(): # Create a client client = compute_v1.InstancesClient() # Initialize request argument(s) request = compute_v1.StartInstanceRequest( instance="instance_value", project="project_value", zone="zone_value", ) # Make the request response = client.start(request=request) # Handle the response print(response)
- Parameters
request (Union[google.cloud.compute_v1.types.StartInstanceRequest, dict]) – The request object. A request message for Instances.Start. See the method description for details.
project (str) – Project ID for this request. This corresponds to the
project
field on therequest
instance; ifrequest
is provided, this should not be set.zone (str) –
The name of the zone for this request.
This corresponds to the
zone
field on therequest
instance; ifrequest
is provided, this should not be set.instance (str) –
Name of the instance resource to start.
This corresponds to the
instance
field on therequest
instance; ifrequest
is provided, this should not be set.retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.
timeout (float) – The timeout for this request.
metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.
- Returns
An object representing a extended long-running operation.
- Return type
google.api_core.extended_operation.ExtendedOperation
- start_with_encryption_key(request: Optional[Union[google.cloud.compute_v1.types.compute.StartWithEncryptionKeyInstanceRequest, dict]] = None, *, project: Optional[str] = None, zone: Optional[str] = None, instance: Optional[str] = None, instances_start_with_encryption_key_request_resource: Optional[google.cloud.compute_v1.types.compute.InstancesStartWithEncryptionKeyRequest] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.api_core.extended_operation.ExtendedOperation [source]¶
Starts an instance that was stopped using the instances().stop method. For more information, see Restart an instance.
# This snippet 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 as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import compute_v1 def sample_start_with_encryption_key(): # Create a client client = compute_v1.InstancesClient() # Initialize request argument(s) request = compute_v1.StartWithEncryptionKeyInstanceRequest( instance="instance_value", project="project_value", zone="zone_value", ) # Make the request response = client.start_with_encryption_key(request=request) # Handle the response print(response)
- Parameters
request (Union[google.cloud.compute_v1.types.StartWithEncryptionKeyInstanceRequest, dict]) – The request object. A request message for Instances.StartWithEncryptionKey. See the method description for details.
project (str) – Project ID for this request. This corresponds to the
project
field on therequest
instance; ifrequest
is provided, this should not be set.zone (str) –
The name of the zone for this request.
This corresponds to the
zone
field on therequest
instance; ifrequest
is provided, this should not be set.instance (str) –
Name of the instance resource to start.
This corresponds to the
instance
field on therequest
instance; ifrequest
is provided, this should not be set.instances_start_with_encryption_key_request_resource (google.cloud.compute_v1.types.InstancesStartWithEncryptionKeyRequest) – The body resource for this request This corresponds to the
instances_start_with_encryption_key_request_resource
field on therequest
instance; ifrequest
is provided, this should not be set.retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.
timeout (float) – The timeout for this request.
metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.
- Returns
An object representing a extended long-running operation.
- Return type
google.api_core.extended_operation.ExtendedOperation
- start_with_encryption_key_unary(request: Optional[Union[google.cloud.compute_v1.types.compute.StartWithEncryptionKeyInstanceRequest, dict]] = None, *, project: Optional[str] = None, zone: Optional[str] = None, instance: Optional[str] = None, instances_start_with_encryption_key_request_resource: Optional[google.cloud.compute_v1.types.compute.InstancesStartWithEncryptionKeyRequest] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.cloud.compute_v1.types.compute.Operation [source]¶
Starts an instance that was stopped using the instances().stop method. For more information, see Restart an instance.
# This snippet 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 as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import compute_v1 def sample_start_with_encryption_key(): # Create a client client = compute_v1.InstancesClient() # Initialize request argument(s) request = compute_v1.StartWithEncryptionKeyInstanceRequest( instance="instance_value", project="project_value", zone="zone_value", ) # Make the request response = client.start_with_encryption_key(request=request) # Handle the response print(response)
- Parameters
request (Union[google.cloud.compute_v1.types.StartWithEncryptionKeyInstanceRequest, dict]) – The request object. A request message for Instances.StartWithEncryptionKey. See the method description for details.
project (str) – Project ID for this request. This corresponds to the
project
field on therequest
instance; ifrequest
is provided, this should not be set.zone (str) –
The name of the zone for this request.
This corresponds to the
zone
field on therequest
instance; ifrequest
is provided, this should not be set.instance (str) –
Name of the instance resource to start.
This corresponds to the
instance
field on therequest
instance; ifrequest
is provided, this should not be set.instances_start_with_encryption_key_request_resource (google.cloud.compute_v1.types.InstancesStartWithEncryptionKeyRequest) – The body resource for this request This corresponds to the
instances_start_with_encryption_key_request_resource
field on therequest
instance; ifrequest
is provided, this should not be set.retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.
timeout (float) – The timeout for this request.
metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.
- Returns
An object representing a extended long-running operation.
- Return type
google.api_core.extended_operation.ExtendedOperation
- stop(request: Optional[Union[google.cloud.compute_v1.types.compute.StopInstanceRequest, dict]] = None, *, project: Optional[str] = None, zone: Optional[str] = None, instance: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.api_core.extended_operation.ExtendedOperation [source]¶
Stops a running instance, shutting it down cleanly, and allows you to restart the instance at a later time. Stopped instances do not incur VM usage charges while they are stopped. However, resources that the VM is using, such as persistent disks and static IP addresses, will continue to be charged until they are deleted. For more information, see Stopping an instance.
# This snippet 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 as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import compute_v1 def sample_stop(): # Create a client client = compute_v1.InstancesClient() # Initialize request argument(s) request = compute_v1.StopInstanceRequest( instance="instance_value", project="project_value", zone="zone_value", ) # Make the request response = client.stop(request=request) # Handle the response print(response)
- Parameters
request (Union[google.cloud.compute_v1.types.StopInstanceRequest, dict]) – The request object. A request message for Instances.Stop. See the method description for details.
project (str) – Project ID for this request. This corresponds to the
project
field on therequest
instance; ifrequest
is provided, this should not be set.zone (str) –
The name of the zone for this request.
This corresponds to the
zone
field on therequest
instance; ifrequest
is provided, this should not be set.instance (str) –
Name of the instance resource to stop.
This corresponds to the
instance
field on therequest
instance; ifrequest
is provided, this should not be set.retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.
timeout (float) – The timeout for this request.
metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.
- Returns
An object representing a extended long-running operation.
- Return type
google.api_core.extended_operation.ExtendedOperation
- stop_unary(request: Optional[Union[google.cloud.compute_v1.types.compute.StopInstanceRequest, dict]] = None, *, project: Optional[str] = None, zone: Optional[str] = None, instance: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.cloud.compute_v1.types.compute.Operation [source]¶
Stops a running instance, shutting it down cleanly, and allows you to restart the instance at a later time. Stopped instances do not incur VM usage charges while they are stopped. However, resources that the VM is using, such as persistent disks and static IP addresses, will continue to be charged until they are deleted. For more information, see Stopping an instance.
# This snippet 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 as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import compute_v1 def sample_stop(): # Create a client client = compute_v1.InstancesClient() # Initialize request argument(s) request = compute_v1.StopInstanceRequest( instance="instance_value", project="project_value", zone="zone_value", ) # Make the request response = client.stop(request=request) # Handle the response print(response)
- Parameters
request (Union[google.cloud.compute_v1.types.StopInstanceRequest, dict]) – The request object. A request message for Instances.Stop. See the method description for details.
project (str) – Project ID for this request. This corresponds to the
project
field on therequest
instance; ifrequest
is provided, this should not be set.zone (str) –
The name of the zone for this request.
This corresponds to the
zone
field on therequest
instance; ifrequest
is provided, this should not be set.instance (str) –
Name of the instance resource to stop.
This corresponds to the
instance
field on therequest
instance; ifrequest
is provided, this should not be set.retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.
timeout (float) – The timeout for this request.
metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.
- Returns
An object representing a extended long-running operation.
- Return type
google.api_core.extended_operation.ExtendedOperation
- suspend(request: Optional[Union[google.cloud.compute_v1.types.compute.SuspendInstanceRequest, dict]] = None, *, project: Optional[str] = None, zone: Optional[str] = None, instance: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.api_core.extended_operation.ExtendedOperation [source]¶
This method suspends a running instance, saving its state to persistent storage, and allows you to resume the instance at a later time. Suspended instances have no compute costs (cores or RAM), and incur only storage charges for the saved VM memory and localSSD data. Any charged resources the virtual machine was using, such as persistent disks and static IP addresses, will continue to be charged while the instance is suspended. For more information, see Suspending and resuming an instance.
# This snippet 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 as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import compute_v1 def sample_suspend(): # Create a client client = compute_v1.InstancesClient() # Initialize request argument(s) request = compute_v1.SuspendInstanceRequest( instance="instance_value", project="project_value", zone="zone_value", ) # Make the request response = client.suspend(request=request) # Handle the response print(response)
- Parameters
request (Union[google.cloud.compute_v1.types.SuspendInstanceRequest, dict]) – The request object. A request message for Instances.Suspend. See the method description for details.
project (str) – Project ID for this request. This corresponds to the
project
field on therequest
instance; ifrequest
is provided, this should not be set.zone (str) –
The name of the zone for this request.
This corresponds to the
zone
field on therequest
instance; ifrequest
is provided, this should not be set.instance (str) –
Name of the instance resource to suspend.
This corresponds to the
instance
field on therequest
instance; ifrequest
is provided, this should not be set.retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.
timeout (float) – The timeout for this request.
metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.
- Returns
An object representing a extended long-running operation.
- Return type
google.api_core.extended_operation.ExtendedOperation
- suspend_unary(request: Optional[Union[google.cloud.compute_v1.types.compute.SuspendInstanceRequest, dict]] = None, *, project: Optional[str] = None, zone: Optional[str] = None, instance: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.cloud.compute_v1.types.compute.Operation [source]¶
This method suspends a running instance, saving its state to persistent storage, and allows you to resume the instance at a later time. Suspended instances have no compute costs (cores or RAM), and incur only storage charges for the saved VM memory and localSSD data. Any charged resources the virtual machine was using, such as persistent disks and static IP addresses, will continue to be charged while the instance is suspended. For more information, see Suspending and resuming an instance.
# This snippet 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 as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import compute_v1 def sample_suspend(): # Create a client client = compute_v1.InstancesClient() # Initialize request argument(s) request = compute_v1.SuspendInstanceRequest( instance="instance_value", project="project_value", zone="zone_value", ) # Make the request response = client.suspend(request=request) # Handle the response print(response)
- Parameters
request (Union[google.cloud.compute_v1.types.SuspendInstanceRequest, dict]) – The request object. A request message for Instances.Suspend. See the method description for details.
project (str) – Project ID for this request. This corresponds to the
project
field on therequest
instance; ifrequest
is provided, this should not be set.zone (str) –
The name of the zone for this request.
This corresponds to the
zone
field on therequest
instance; ifrequest
is provided, this should not be set.instance (str) –
Name of the instance resource to suspend.
This corresponds to the
instance
field on therequest
instance; ifrequest
is provided, this should not be set.retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.
timeout (float) – The timeout for this request.
metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.
- Returns
An object representing a extended long-running operation.
- Return type
google.api_core.extended_operation.ExtendedOperation
- test_iam_permissions(request: Optional[Union[google.cloud.compute_v1.types.compute.TestIamPermissionsInstanceRequest, dict]] = None, *, project: Optional[str] = None, zone: Optional[str] = None, resource: Optional[str] = None, test_permissions_request_resource: Optional[google.cloud.compute_v1.types.compute.TestPermissionsRequest] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.cloud.compute_v1.types.compute.TestPermissionsResponse [source]¶
Returns permissions that a caller has on the specified resource.
# This snippet 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 as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import compute_v1 def sample_test_iam_permissions(): # Create a client client = compute_v1.InstancesClient() # Initialize request argument(s) request = compute_v1.TestIamPermissionsInstanceRequest( project="project_value", resource="resource_value", zone="zone_value", ) # Make the request response = client.test_iam_permissions(request=request) # Handle the response print(response)
- Parameters
request (Union[google.cloud.compute_v1.types.TestIamPermissionsInstanceRequest, dict]) – The request object. A request message for Instances.TestIamPermissions. See the method description for details.
project (str) – Project ID for this request. This corresponds to the
project
field on therequest
instance; ifrequest
is provided, this should not be set.zone (str) –
The name of the zone for this request.
This corresponds to the
zone
field on therequest
instance; ifrequest
is provided, this should not be set.resource (str) –
Name or id of the resource for this request.
This corresponds to the
resource
field on therequest
instance; ifrequest
is provided, this should not be set.test_permissions_request_resource (google.cloud.compute_v1.types.TestPermissionsRequest) – The body resource for this request This corresponds to the
test_permissions_request_resource
field on therequest
instance; ifrequest
is provided, this should not be set.retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.
timeout (float) – The timeout for this request.
metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.
- Return type
- property transport: google.cloud.compute_v1.services.instances.transports.base.InstancesTransport¶
Returns the transport used by the client instance.
- Returns
- The transport used by the client
instance.
- Return type
InstancesTransport
- property universe_domain: str¶
Return the universe domain used by the client instance.
- Returns
The universe domain used by the client instance.
- Return type
- update(request: Optional[Union[google.cloud.compute_v1.types.compute.UpdateInstanceRequest, dict]] = None, *, project: Optional[str] = None, zone: Optional[str] = None, instance: Optional[str] = None, instance_resource: Optional[google.cloud.compute_v1.types.compute.Instance] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.api_core.extended_operation.ExtendedOperation [source]¶
Updates an instance only if the necessary resources are available. This method can update only a specific set of instance properties. See Updating a running instance for a list of updatable instance properties.
# This snippet 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 as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import compute_v1 def sample_update(): # Create a client client = compute_v1.InstancesClient() # Initialize request argument(s) request = compute_v1.UpdateInstanceRequest( instance="instance_value", project="project_value", zone="zone_value", ) # Make the request response = client.update(request=request) # Handle the response print(response)
- Parameters
request (Union[google.cloud.compute_v1.types.UpdateInstanceRequest, dict]) – The request object. A request message for Instances.Update. See the method description for details.
project (str) – Project ID for this request. This corresponds to the
project
field on therequest
instance; ifrequest
is provided, this should not be set.zone (str) –
The name of the zone for this request.
This corresponds to the
zone
field on therequest
instance; ifrequest
is provided, this should not be set.instance (str) –
Name of the instance resource to update.
This corresponds to the
instance
field on therequest
instance; ifrequest
is provided, this should not be set.instance_resource (google.cloud.compute_v1.types.Instance) – The body resource for this request This corresponds to the
instance_resource
field on therequest
instance; ifrequest
is provided, this should not be set.retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.
timeout (float) – The timeout for this request.
metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.
- Returns
An object representing a extended long-running operation.
- Return type
google.api_core.extended_operation.ExtendedOperation
- update_access_config(request: Optional[Union[google.cloud.compute_v1.types.compute.UpdateAccessConfigInstanceRequest, dict]] = None, *, project: Optional[str] = None, zone: Optional[str] = None, instance: Optional[str] = None, network_interface: Optional[str] = None, access_config_resource: Optional[google.cloud.compute_v1.types.compute.AccessConfig] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.api_core.extended_operation.ExtendedOperation [source]¶
Updates the specified access config from an instance’s network interface with the data included in the request. This method supports PATCH semantics and uses the JSON merge patch format and processing rules.
# This snippet 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 as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import compute_v1 def sample_update_access_config(): # Create a client client = compute_v1.InstancesClient() # Initialize request argument(s) request = compute_v1.UpdateAccessConfigInstanceRequest( instance="instance_value", network_interface="network_interface_value", project="project_value", zone="zone_value", ) # Make the request response = client.update_access_config(request=request) # Handle the response print(response)
- Parameters
request (Union[google.cloud.compute_v1.types.UpdateAccessConfigInstanceRequest, dict]) – The request object. A request message for Instances.UpdateAccessConfig. See the method description for details.
project (str) – Project ID for this request. This corresponds to the
project
field on therequest
instance; ifrequest
is provided, this should not be set.zone (str) –
The name of the zone for this request.
This corresponds to the
zone
field on therequest
instance; ifrequest
is provided, this should not be set.instance (str) – The instance name for this request. This corresponds to the
instance
field on therequest
instance; ifrequest
is provided, this should not be set.network_interface (str) –
The name of the network interface where the access config is attached.
This corresponds to the
network_interface
field on therequest
instance; ifrequest
is provided, this should not be set.access_config_resource (google.cloud.compute_v1.types.AccessConfig) – The body resource for this request This corresponds to the
access_config_resource
field on therequest
instance; ifrequest
is provided, this should not be set.retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.
timeout (float) – The timeout for this request.
metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.
- Returns
An object representing a extended long-running operation.
- Return type
google.api_core.extended_operation.ExtendedOperation
- update_access_config_unary(request: Optional[Union[google.cloud.compute_v1.types.compute.UpdateAccessConfigInstanceRequest, dict]] = None, *, project: Optional[str] = None, zone: Optional[str] = None, instance: Optional[str] = None, network_interface: Optional[str] = None, access_config_resource: Optional[google.cloud.compute_v1.types.compute.AccessConfig] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.cloud.compute_v1.types.compute.Operation [source]¶
Updates the specified access config from an instance’s network interface with the data included in the request. This method supports PATCH semantics and uses the JSON merge patch format and processing rules.
# This snippet 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 as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import compute_v1 def sample_update_access_config(): # Create a client client = compute_v1.InstancesClient() # Initialize request argument(s) request = compute_v1.UpdateAccessConfigInstanceRequest( instance="instance_value", network_interface="network_interface_value", project="project_value", zone="zone_value", ) # Make the request response = client.update_access_config(request=request) # Handle the response print(response)
- Parameters
request (Union[google.cloud.compute_v1.types.UpdateAccessConfigInstanceRequest, dict]) – The request object. A request message for Instances.UpdateAccessConfig. See the method description for details.
project (str) – Project ID for this request. This corresponds to the
project
field on therequest
instance; ifrequest
is provided, this should not be set.zone (str) –
The name of the zone for this request.
This corresponds to the
zone
field on therequest
instance; ifrequest
is provided, this should not be set.instance (str) – The instance name for this request. This corresponds to the
instance
field on therequest
instance; ifrequest
is provided, this should not be set.network_interface (str) –
The name of the network interface where the access config is attached.
This corresponds to the
network_interface
field on therequest
instance; ifrequest
is provided, this should not be set.access_config_resource (google.cloud.compute_v1.types.AccessConfig) – The body resource for this request This corresponds to the
access_config_resource
field on therequest
instance; ifrequest
is provided, this should not be set.retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.
timeout (float) – The timeout for this request.
metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.
- Returns
An object representing a extended long-running operation.
- Return type
google.api_core.extended_operation.ExtendedOperation
- update_display_device(request: Optional[Union[google.cloud.compute_v1.types.compute.UpdateDisplayDeviceInstanceRequest, dict]] = None, *, project: Optional[str] = None, zone: Optional[str] = None, instance: Optional[str] = None, display_device_resource: Optional[google.cloud.compute_v1.types.compute.DisplayDevice] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.api_core.extended_operation.ExtendedOperation [source]¶
Updates the Display config for a VM instance. You can only use this method on a stopped VM instance. This method supports PATCH semantics and uses the JSON merge patch format and processing rules.
# This snippet 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 as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import compute_v1 def sample_update_display_device(): # Create a client client = compute_v1.InstancesClient() # Initialize request argument(s) request = compute_v1.UpdateDisplayDeviceInstanceRequest( instance="instance_value", project="project_value", zone="zone_value", ) # Make the request response = client.update_display_device(request=request) # Handle the response print(response)
- Parameters
request (Union[google.cloud.compute_v1.types.UpdateDisplayDeviceInstanceRequest, dict]) – The request object. A request message for Instances.UpdateDisplayDevice. See the method description for details.
project (str) – Project ID for this request. This corresponds to the
project
field on therequest
instance; ifrequest
is provided, this should not be set.zone (str) –
The name of the zone for this request.
This corresponds to the
zone
field on therequest
instance; ifrequest
is provided, this should not be set.instance (str) –
Name of the instance scoping this request.
This corresponds to the
instance
field on therequest
instance; ifrequest
is provided, this should not be set.display_device_resource (google.cloud.compute_v1.types.DisplayDevice) – The body resource for this request This corresponds to the
display_device_resource
field on therequest
instance; ifrequest
is provided, this should not be set.retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.
timeout (float) – The timeout for this request.
metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.
- Returns
An object representing a extended long-running operation.
- Return type
google.api_core.extended_operation.ExtendedOperation
- update_display_device_unary(request: Optional[Union[google.cloud.compute_v1.types.compute.UpdateDisplayDeviceInstanceRequest, dict]] = None, *, project: Optional[str] = None, zone: Optional[str] = None, instance: Optional[str] = None, display_device_resource: Optional[google.cloud.compute_v1.types.compute.DisplayDevice] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.cloud.compute_v1.types.compute.Operation [source]¶
Updates the Display config for a VM instance. You can only use this method on a stopped VM instance. This method supports PATCH semantics and uses the JSON merge patch format and processing rules.
# This snippet 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 as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import compute_v1 def sample_update_display_device(): # Create a client client = compute_v1.InstancesClient() # Initialize request argument(s) request = compute_v1.UpdateDisplayDeviceInstanceRequest( instance="instance_value", project="project_value", zone="zone_value", ) # Make the request response = client.update_display_device(request=request) # Handle the response print(response)
- Parameters
request (Union[google.cloud.compute_v1.types.UpdateDisplayDeviceInstanceRequest, dict]) – The request object. A request message for Instances.UpdateDisplayDevice. See the method description for details.
project (str) – Project ID for this request. This corresponds to the
project
field on therequest
instance; ifrequest
is provided, this should not be set.zone (str) –
The name of the zone for this request.
This corresponds to the
zone
field on therequest
instance; ifrequest
is provided, this should not be set.instance (str) –
Name of the instance scoping this request.
This corresponds to the
instance
field on therequest
instance; ifrequest
is provided, this should not be set.display_device_resource (google.cloud.compute_v1.types.DisplayDevice) – The body resource for this request This corresponds to the
display_device_resource
field on therequest
instance; ifrequest
is provided, this should not be set.retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.
timeout (float) – The timeout for this request.
metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.
- Returns
An object representing a extended long-running operation.
- Return type
google.api_core.extended_operation.ExtendedOperation
- update_network_interface(request: Optional[Union[google.cloud.compute_v1.types.compute.UpdateNetworkInterfaceInstanceRequest, dict]] = None, *, project: Optional[str] = None, zone: Optional[str] = None, instance: Optional[str] = None, network_interface: Optional[str] = None, network_interface_resource: Optional[google.cloud.compute_v1.types.compute.NetworkInterface] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.api_core.extended_operation.ExtendedOperation [source]¶
Updates an instance’s network interface. This method can only update an interface’s alias IP range and attached network. See Modifying alias IP ranges for an existing instance for instructions on changing alias IP ranges. See Migrating a VM between networks for instructions on migrating an interface. This method follows PATCH semantics.
# This snippet 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 as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import compute_v1 def sample_update_network_interface(): # Create a client client = compute_v1.InstancesClient() # Initialize request argument(s) request = compute_v1.UpdateNetworkInterfaceInstanceRequest( instance="instance_value", network_interface="network_interface_value", project="project_value", zone="zone_value", ) # Make the request response = client.update_network_interface(request=request) # Handle the response print(response)
- Parameters
request (Union[google.cloud.compute_v1.types.UpdateNetworkInterfaceInstanceRequest, dict]) – The request object. A request message for Instances.UpdateNetworkInterface. See the method description for details.
project (str) – Project ID for this request. This corresponds to the
project
field on therequest
instance; ifrequest
is provided, this should not be set.zone (str) –
The name of the zone for this request.
This corresponds to the
zone
field on therequest
instance; ifrequest
is provided, this should not be set.instance (str) – The instance name for this request. This corresponds to the
instance
field on therequest
instance; ifrequest
is provided, this should not be set.network_interface (str) –
The name of the network interface to update.
This corresponds to the
network_interface
field on therequest
instance; ifrequest
is provided, this should not be set.network_interface_resource (google.cloud.compute_v1.types.NetworkInterface) – The body resource for this request This corresponds to the
network_interface_resource
field on therequest
instance; ifrequest
is provided, this should not be set.retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.
timeout (float) – The timeout for this request.
metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.
- Returns
An object representing a extended long-running operation.
- Return type
google.api_core.extended_operation.ExtendedOperation
- update_network_interface_unary(request: Optional[Union[google.cloud.compute_v1.types.compute.UpdateNetworkInterfaceInstanceRequest, dict]] = None, *, project: Optional[str] = None, zone: Optional[str] = None, instance: Optional[str] = None, network_interface: Optional[str] = None, network_interface_resource: Optional[google.cloud.compute_v1.types.compute.NetworkInterface] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.cloud.compute_v1.types.compute.Operation [source]¶
Updates an instance’s network interface. This method can only update an interface’s alias IP range and attached network. See Modifying alias IP ranges for an existing instance for instructions on changing alias IP ranges. See Migrating a VM between networks for instructions on migrating an interface. This method follows PATCH semantics.
# This snippet 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 as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import compute_v1 def sample_update_network_interface(): # Create a client client = compute_v1.InstancesClient() # Initialize request argument(s) request = compute_v1.UpdateNetworkInterfaceInstanceRequest( instance="instance_value", network_interface="network_interface_value", project="project_value", zone="zone_value", ) # Make the request response = client.update_network_interface(request=request) # Handle the response print(response)
- Parameters
request (Union[google.cloud.compute_v1.types.UpdateNetworkInterfaceInstanceRequest, dict]) – The request object. A request message for Instances.UpdateNetworkInterface. See the method description for details.
project (str) – Project ID for this request. This corresponds to the
project
field on therequest
instance; ifrequest
is provided, this should not be set.zone (str) –
The name of the zone for this request.
This corresponds to the
zone
field on therequest
instance; ifrequest
is provided, this should not be set.instance (str) – The instance name for this request. This corresponds to the
instance
field on therequest
instance; ifrequest
is provided, this should not be set.network_interface (str) –
The name of the network interface to update.
This corresponds to the
network_interface
field on therequest
instance; ifrequest
is provided, this should not be set.network_interface_resource (google.cloud.compute_v1.types.NetworkInterface) – The body resource for this request This corresponds to the
network_interface_resource
field on therequest
instance; ifrequest
is provided, this should not be set.retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.
timeout (float) – The timeout for this request.
metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.
- Returns
An object representing a extended long-running operation.
- Return type
google.api_core.extended_operation.ExtendedOperation
- update_shielded_instance_config(request: Optional[Union[google.cloud.compute_v1.types.compute.UpdateShieldedInstanceConfigInstanceRequest, dict]] = None, *, project: Optional[str] = None, zone: Optional[str] = None, instance: Optional[str] = None, shielded_instance_config_resource: Optional[google.cloud.compute_v1.types.compute.ShieldedInstanceConfig] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.api_core.extended_operation.ExtendedOperation [source]¶
Updates the Shielded Instance config for an instance. You can only use this method on a stopped instance. This method supports PATCH semantics and uses the JSON merge patch format and processing rules.
# This snippet 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 as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import compute_v1 def sample_update_shielded_instance_config(): # Create a client client = compute_v1.InstancesClient() # Initialize request argument(s) request = compute_v1.UpdateShieldedInstanceConfigInstanceRequest( instance="instance_value", project="project_value", zone="zone_value", ) # Make the request response = client.update_shielded_instance_config(request=request) # Handle the response print(response)
- Parameters
request (Union[google.cloud.compute_v1.types.UpdateShieldedInstanceConfigInstanceRequest, dict]) – The request object. A request message for Instances.UpdateShieldedInstanceConfig. See the method description for details.
project (str) – Project ID for this request. This corresponds to the
project
field on therequest
instance; ifrequest
is provided, this should not be set.zone (str) –
The name of the zone for this request.
This corresponds to the
zone
field on therequest
instance; ifrequest
is provided, this should not be set.instance (str) –
Name or id of the instance scoping this request.
This corresponds to the
instance
field on therequest
instance; ifrequest
is provided, this should not be set.shielded_instance_config_resource (google.cloud.compute_v1.types.ShieldedInstanceConfig) – The body resource for this request This corresponds to the
shielded_instance_config_resource
field on therequest
instance; ifrequest
is provided, this should not be set.retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.
timeout (float) – The timeout for this request.
metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.
- Returns
An object representing a extended long-running operation.
- Return type
google.api_core.extended_operation.ExtendedOperation
- update_shielded_instance_config_unary(request: Optional[Union[google.cloud.compute_v1.types.compute.UpdateShieldedInstanceConfigInstanceRequest, dict]] = None, *, project: Optional[str] = None, zone: Optional[str] = None, instance: Optional[str] = None, shielded_instance_config_resource: Optional[google.cloud.compute_v1.types.compute.ShieldedInstanceConfig] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.cloud.compute_v1.types.compute.Operation [source]¶
Updates the Shielded Instance config for an instance. You can only use this method on a stopped instance. This method supports PATCH semantics and uses the JSON merge patch format and processing rules.
# This snippet 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 as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import compute_v1 def sample_update_shielded_instance_config(): # Create a client client = compute_v1.InstancesClient() # Initialize request argument(s) request = compute_v1.UpdateShieldedInstanceConfigInstanceRequest( instance="instance_value", project="project_value", zone="zone_value", ) # Make the request response = client.update_shielded_instance_config(request=request) # Handle the response print(response)
- Parameters
request (Union[google.cloud.compute_v1.types.UpdateShieldedInstanceConfigInstanceRequest, dict]) – The request object. A request message for Instances.UpdateShieldedInstanceConfig. See the method description for details.
project (str) – Project ID for this request. This corresponds to the
project
field on therequest
instance; ifrequest
is provided, this should not be set.zone (str) –
The name of the zone for this request.
This corresponds to the
zone
field on therequest
instance; ifrequest
is provided, this should not be set.instance (str) –
Name or id of the instance scoping this request.
This corresponds to the
instance
field on therequest
instance; ifrequest
is provided, this should not be set.shielded_instance_config_resource (google.cloud.compute_v1.types.ShieldedInstanceConfig) – The body resource for this request This corresponds to the
shielded_instance_config_resource
field on therequest
instance; ifrequest
is provided, this should not be set.retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.
timeout (float) – The timeout for this request.
metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.
- Returns
An object representing a extended long-running operation.
- Return type
google.api_core.extended_operation.ExtendedOperation
- update_unary(request: Optional[Union[google.cloud.compute_v1.types.compute.UpdateInstanceRequest, dict]] = None, *, project: Optional[str] = None, zone: Optional[str] = None, instance: Optional[str] = None, instance_resource: Optional[google.cloud.compute_v1.types.compute.Instance] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.cloud.compute_v1.types.compute.Operation [source]¶
Updates an instance only if the necessary resources are available. This method can update only a specific set of instance properties. See Updating a running instance for a list of updatable instance properties.
# This snippet 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 as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import compute_v1 def sample_update(): # Create a client client = compute_v1.InstancesClient() # Initialize request argument(s) request = compute_v1.UpdateInstanceRequest( instance="instance_value", project="project_value", zone="zone_value", ) # Make the request response = client.update(request=request) # Handle the response print(response)
- Parameters
request (Union[google.cloud.compute_v1.types.UpdateInstanceRequest, dict]) – The request object. A request message for Instances.Update. See the method description for details.
project (str) – Project ID for this request. This corresponds to the
project
field on therequest
instance; ifrequest
is provided, this should not be set.zone (str) –
The name of the zone for this request.
This corresponds to the
zone
field on therequest
instance; ifrequest
is provided, this should not be set.instance (str) –
Name of the instance resource to update.
This corresponds to the
instance
field on therequest
instance; ifrequest
is provided, this should not be set.instance_resource (google.cloud.compute_v1.types.Instance) – The body resource for this request This corresponds to the
instance_resource
field on therequest
instance; ifrequest
is provided, this should not be set.retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.
timeout (float) – The timeout for this request.
metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.
- Returns
An object representing a extended long-running operation.
- Return type
google.api_core.extended_operation.ExtendedOperation
- class google.cloud.compute_v1.services.instances.pagers.AggregatedListPager(method: Callable[[...], google.cloud.compute_v1.types.compute.InstanceAggregatedList], request: google.cloud.compute_v1.types.compute.AggregatedListInstancesRequest, response: google.cloud.compute_v1.types.compute.InstanceAggregatedList, *, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ())[source]¶
A pager for iterating through
aggregated_list
requests.This class thinly wraps an initial
google.cloud.compute_v1.types.InstanceAggregatedList
object, and provides an__iter__
method to iterate through itsitems
field.If there are more pages, the
__iter__
method will make additionalAggregatedList
requests and continue to iterate through theitems
field on the corresponding responses.All the usual
google.cloud.compute_v1.types.InstanceAggregatedList
attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup.Instantiate the pager.
- Parameters
method (Callable) – The method that was originally called, and which instantiated this pager.
request (google.cloud.compute_v1.types.AggregatedListInstancesRequest) – The initial request object.
response (google.cloud.compute_v1.types.InstanceAggregatedList) – The initial response object.
retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.
timeout (float) – The timeout for this request.
metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.
- class google.cloud.compute_v1.services.instances.pagers.ListPager(method: Callable[[...], google.cloud.compute_v1.types.compute.InstanceList], request: google.cloud.compute_v1.types.compute.ListInstancesRequest, response: google.cloud.compute_v1.types.compute.InstanceList, *, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ())[source]¶
A pager for iterating through
list
requests.This class thinly wraps an initial
google.cloud.compute_v1.types.InstanceList
object, and provides an__iter__
method to iterate through itsitems
field.If there are more pages, the
__iter__
method will make additionalList
requests and continue to iterate through theitems
field on the corresponding responses.All the usual
google.cloud.compute_v1.types.InstanceList
attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup.Instantiate the pager.
- Parameters
method (Callable) – The method that was originally called, and which instantiated this pager.
request (google.cloud.compute_v1.types.ListInstancesRequest) – The initial request object.
response (google.cloud.compute_v1.types.InstanceList) – The initial response object.
retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.
timeout (float) – The timeout for this request.
metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.
- class google.cloud.compute_v1.services.instances.pagers.ListReferrersPager(method: Callable[[...], google.cloud.compute_v1.types.compute.InstanceListReferrers], request: google.cloud.compute_v1.types.compute.ListReferrersInstancesRequest, response: google.cloud.compute_v1.types.compute.InstanceListReferrers, *, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ())[source]¶
A pager for iterating through
list_referrers
requests.This class thinly wraps an initial
google.cloud.compute_v1.types.InstanceListReferrers
object, and provides an__iter__
method to iterate through itsitems
field.If there are more pages, the
__iter__
method will make additionalListReferrers
requests and continue to iterate through theitems
field on the corresponding responses.All the usual
google.cloud.compute_v1.types.InstanceListReferrers
attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup.Instantiate the pager.
- Parameters
method (Callable) – The method that was originally called, and which instantiated this pager.
request (google.cloud.compute_v1.types.ListReferrersInstancesRequest) – The initial request object.
response (google.cloud.compute_v1.types.InstanceListReferrers) – The initial response object.
retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.
timeout (float) – The timeout for this request.
metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.