Class InstancesClient (1.1.0)

InstancesClient(*, credentials: Optional[google.auth.credentials.Credentials] = None, transport: Optional[Union[str, google.cloud.compute_v1.services.instances.transports.base.InstancesTransport]] = None, client_options: Optional[google.api_core.client_options.ClientOptions] = None, client_info: google.api_core.gapic_v1.client_info.ClientInfo = <google.api_core.gapic_v1.client_info.ClientInfo object>)

The Instances API.

Properties

transport

Returns the transport used by the client instance.

Returns
TypeDescription
InstancesTransportThe transport used by the client instance.

Methods

InstancesClient

InstancesClient(*, credentials: Optional[google.auth.credentials.Credentials] = None, transport: Optional[Union[str, google.cloud.compute_v1.services.instances.transports.base.InstancesTransport]] = None, client_options: Optional[google.api_core.client_options.ClientOptions] = None, client_info: google.api_core.gapic_v1.client_info.ClientInfo = <google.api_core.gapic_v1.client_info.ClientInfo object>)

Instantiates the instances client.

Parameters
NameDescription
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 Union[str, InstancesTransport]

The transport to use. If set to None, a transport is chosen automatically.

client_options google.api_core.client_options.ClientOptions

Custom options for the client. It won't take effect if a transport instance is provided. (1) The api_endpoint property can be used to override the default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT environment variable can also be used to override the endpoint: "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). However, the api_endpoint property takes precedence if provided. (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable is "true", then the client_cert_source property can be used to provide client certificate for mutual TLS 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.

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.

Exceptions
TypeDescription
google.auth.exceptions.MutualTLSChannelErrorIf mutual TLS transport creation failed for any reason.

__exit__

__exit__(type, value, traceback)

Releases underlying transport's resources.

add_access_config_unary

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: Union[google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault] = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())

Adds an access config to an instance's network interface.

Parameters
NameDescription
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 the request instance; if request is provided, this should not be set.

zone str

The name of the zone for this request. This corresponds to the zone field on the request instance; if request is provided, this should not be set.

instance str

The instance name for this request. This corresponds to the instance field on the request instance; if request 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 the request instance; if request 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 the request instance; if request 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
TypeDescription
google.cloud.compute_v1.types.OperationRepresents an Operation resource. Google Compute Engine has three Operation resources: \* [Global](/compute/docs/reference/rest/v1/globalOperations) \* [Regional](/compute/docs/reference/rest/v1/regionOperations) \* [Zonal](/compute/docs/reference/rest/v1/zoneOperations) You can use an operation resource to manage asynchronous API requests. For more information, read Handling API responses. Operations can be global, regional or zonal. - For global operations, use the globalOperations resource. - For regional operations, use the regionOperations resource. - For zonal operations, use the zonalOperations resource. For more information, read Global, Regional, and Zonal Resources.

add_resource_policies_unary

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: Union[google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault] = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())

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.

Parameters
NameDescription
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 the request instance; if request is provided, this should not be set.

zone str

The name of the zone for this request. This corresponds to the zone field on the request instance; if request is provided, this should not be set.

instance str

The instance name for this request. This corresponds to the instance field on the request instance; if request 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 the request instance; if request 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
TypeDescription
google.cloud.compute_v1.types.OperationRepresents an Operation resource. Google Compute Engine has three Operation resources: \* [Global](/compute/docs/reference/rest/v1/globalOperations) \* [Regional](/compute/docs/reference/rest/v1/regionOperations) \* [Zonal](/compute/docs/reference/rest/v1/zoneOperations) You can use an operation resource to manage asynchronous API requests. For more information, read Handling API responses. Operations can be global, regional or zonal. - For global operations, use the globalOperations resource. - For regional operations, use the regionOperations resource. - For zonal operations, use the zonalOperations resource. For more information, read Global, Regional, and Zonal Resources.

aggregated_list

aggregated_list(request: Optional[Union[google.cloud.compute_v1.types.compute.AggregatedListInstancesRequest, dict]] = None, *, project: Optional[str] = None, retry: Union[google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault] = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())

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.

Parameters
NameDescription
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 the request instance; if request 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
TypeDescription
google.cloud.compute_v1.services.instances.pagers.AggregatedListPagerIterating over this object will yield results and resolve additional pages automatically.

attach_disk_unary

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: Union[google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault] = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())

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.

Parameters
NameDescription
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 the request instance; if request is provided, this should not be set.

zone str

The name of the zone for this request. This corresponds to the zone field on the request instance; if request is provided, this should not be set.

instance str

The instance name for this request. This corresponds to the instance field on the request instance; if request 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 the request instance; if request 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
TypeDescription
google.cloud.compute_v1.types.OperationRepresents an Operation resource. Google Compute Engine has three Operation resources: \* [Global](/compute/docs/reference/rest/v1/globalOperations) \* [Regional](/compute/docs/reference/rest/v1/regionOperations) \* [Zonal](/compute/docs/reference/rest/v1/zoneOperations) You can use an operation resource to manage asynchronous API requests. For more information, read Handling API responses. Operations can be global, regional or zonal. - For global operations, use the globalOperations resource. - For regional operations, use the regionOperations resource. - For zonal operations, use the zonalOperations resource. For more information, read Global, Regional, and Zonal Resources.

bulk_insert_unary

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: Union[google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault] = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())

Creates multiple instances. Count specifies the number of instances to create.

Parameters
NameDescription
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 the request instance; if request is provided, this should not be set.

zone str

The name of the zone for this request. This corresponds to the zone field on the request instance; if request 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 the request instance; if request 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
TypeDescription
google.cloud.compute_v1.types.OperationRepresents an Operation resource. Google Compute Engine has three Operation resources: \* [Global](/compute/docs/reference/rest/v1/globalOperations) \* [Regional](/compute/docs/reference/rest/v1/regionOperations) \* [Zonal](/compute/docs/reference/rest/v1/zoneOperations) You can use an operation resource to manage asynchronous API requests. For more information, read Handling API responses. Operations can be global, regional or zonal. - For global operations, use the globalOperations resource. - For regional operations, use the regionOperations resource. - For zonal operations, use the zonalOperations resource. For more information, read Global, Regional, and Zonal Resources.

common_billing_account_path

common_billing_account_path(billing_account: str)

Returns a fully-qualified billing_account string.

common_folder_path

common_folder_path(folder: str)

Returns a fully-qualified folder string.

common_location_path

common_location_path(project: str, location: str)

Returns a fully-qualified location string.

common_organization_path

common_organization_path(organization: str)

Returns a fully-qualified organization string.

common_project_path

common_project_path(project: str)

Returns a fully-qualified project string.

delete_access_config_unary

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: Union[google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault] = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())

Deletes an access config from an instance's network interface.

Parameters
NameDescription
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 the request instance; if request is provided, this should not be set.

zone str

The name of the zone for this request. This corresponds to the zone field on the request instance; if request is provided, this should not be set.

instance str

The instance name for this request. This corresponds to the instance field on the request instance; if request 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 the request instance; if request is provided, this should not be set.

network_interface str

The name of the network interface. This corresponds to the network_interface field on the request instance; if request 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
TypeDescription
google.cloud.compute_v1.types.OperationRepresents an Operation resource. Google Compute Engine has three Operation resources: \* [Global](/compute/docs/reference/rest/v1/globalOperations) \* [Regional](/compute/docs/reference/rest/v1/regionOperations) \* [Zonal](/compute/docs/reference/rest/v1/zoneOperations) You can use an operation resource to manage asynchronous API requests. For more information, read Handling API responses. Operations can be global, regional or zonal. - For global operations, use the globalOperations resource. - For regional operations, use the regionOperations resource. - For zonal operations, use the zonalOperations resource. For more information, read Global, Regional, and Zonal Resources.

delete_unary

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: Union[google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault] = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())

Deletes the specified Instance resource. For more information, see Deleting an instance.

Parameters
NameDescription
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 the request instance; if request is provided, this should not be set.

zone str

The name of the zone for this request. This corresponds to the zone field on the request instance; if request is provided, this should not be set.

instance str

Name of the instance resource to delete. This corresponds to the instance field on the request instance; if request 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
TypeDescription
google.cloud.compute_v1.types.OperationRepresents an Operation resource. Google Compute Engine has three Operation resources: \* [Global](/compute/docs/reference/rest/v1/globalOperations) \* [Regional](/compute/docs/reference/rest/v1/regionOperations) \* [Zonal](/compute/docs/reference/rest/v1/zoneOperations) You can use an operation resource to manage asynchronous API requests. For more information, read Handling API responses. Operations can be global, regional or zonal. - For global operations, use the globalOperations resource. - For regional operations, use the regionOperations resource. - For zonal operations, use the zonalOperations resource. For more information, read Global, Regional, and Zonal Resources.

detach_disk_unary

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: Union[google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault] = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())

Detaches a disk from an instance.

Parameters
NameDescription
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 the request instance; if request is provided, this should not be set.

zone str

The name of the zone for this request. This corresponds to the zone field on the request instance; if request is provided, this should not be set.

instance str

Instance name for this request. This corresponds to the instance field on the request instance; if request 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 the request instance; if request 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
TypeDescription
google.cloud.compute_v1.types.OperationRepresents an Operation resource. Google Compute Engine has three Operation resources: \* [Global](/compute/docs/reference/rest/v1/globalOperations) \* [Regional](/compute/docs/reference/rest/v1/regionOperations) \* [Zonal](/compute/docs/reference/rest/v1/zoneOperations) You can use an operation resource to manage asynchronous API requests. For more information, read Handling API responses. Operations can be global, regional or zonal. - For global operations, use the globalOperations resource. - For regional operations, use the regionOperations resource. - For zonal operations, use the zonalOperations resource. For more information, read Global, Regional, and Zonal Resources.

from_service_account_file

from_service_account_file(filename: str, *args, **kwargs)

Creates an instance of this client using the provided credentials file.

Parameter
NameDescription
filename str

The path to the service account private key json file.

Returns
TypeDescription
InstancesClientThe constructed client.

from_service_account_info

from_service_account_info(info: dict, *args, **kwargs)

Creates an instance of this client using the provided credentials info.

Parameter
NameDescription
info dict

The service account private key info.

Returns
TypeDescription
InstancesClientThe constructed client.

from_service_account_json

from_service_account_json(filename: str, *args, **kwargs)

Creates an instance of this client using the provided credentials file.

Parameter
NameDescription
filename str

The path to the service account private key json file.

Returns
TypeDescription
InstancesClientThe constructed client.

get

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: Union[google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault] = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())

Returns the specified Instance resource. Gets a list of available instances by making a list() request.

Parameters
NameDescription
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 the request instance; if request is provided, this should not be set.

zone str

The name of the zone for this request. This corresponds to the zone field on the request instance; if request is provided, this should not be set.

instance str

Name of the instance resource to return. This corresponds to the instance field on the request instance; if request 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
TypeDescription
google.cloud.compute_v1.types.InstanceRepresents an Instance resource. An instance is a virtual machine that is hosted on Google Cloud Platform. For more information, read Virtual Machine Instances.

get_effective_firewalls

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: Union[google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault] = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())

Returns effective firewalls applied to an interface of the instance.

Parameters
NameDescription
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 the request instance; if request is provided, this should not be set.

zone str

The name of the zone for this request. This corresponds to the zone field on the request instance; if request is provided, this should not be set.

instance str

Name of the instance scoping this request. This corresponds to the instance field on the request instance; if request 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 the request instance; if request 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.

get_guest_attributes

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: Union[google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault] = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())

Returns the specified guest attributes entry.

Parameters
NameDescription
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 the request instance; if request is provided, this should not be set.

zone str

The name of the zone for this request. This corresponds to the zone field on the request instance; if request is provided, this should not be set.

instance str

Name of the instance scoping this request. This corresponds to the instance field on the request instance; if request 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
TypeDescription
google.cloud.compute_v1.types.GuestAttributesA guest attributes entry.

get_iam_policy

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: Union[google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault] = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())

Gets the access control policy for a resource. May be empty if no such policy or resource exists.

Parameters
NameDescription
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 the request instance; if request is provided, this should not be set.

zone str

The name of the zone for this request. This corresponds to the zone field on the request instance; if request 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 the request instance; if request 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
TypeDescription
google.cloud.compute_v1.types.PolicyAn 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](\="">

get_mtls_endpoint_and_cert_source

get_mtls_endpoint_and_cert_source(
    client_options: Optional[google.api_core.client_options.ClientOptions] = None,
)

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 variabel 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.

Parameter
NameDescription
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.

Exceptions
TypeDescription
google.auth.exceptions.MutualTLSChannelErrorIf any errors happen.
Returns
TypeDescription
Tuple[str, Callable[[], Tuple[bytes, bytes]]]returns the API endpoint and the client cert source to use.

get_screenshot

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: Union[google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault] = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())

Returns the screenshot from the specified instance.

Parameters
NameDescription
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 the request instance; if request is provided, this should not be set.

zone str

The name of the zone for this request. This corresponds to the zone field on the request instance; if request is provided, this should not be set.

instance str

Name of the instance scoping this request. This corresponds to the instance field on the request instance; if request 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
TypeDescription
google.cloud.compute_v1.types.ScreenshotAn instance's screenshot.

get_serial_port_output

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: Union[google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault] = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())

Returns the last 1 MB of serial port output from the specified instance.

Parameters
NameDescription
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 the request instance; if request is provided, this should not be set.

zone str

The name of the zone for this request. This corresponds to the zone field on the request instance; if request is provided, this should not be set.

instance str

Name of the instance for this request. This corresponds to the instance field on the request instance; if request 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
TypeDescription
google.cloud.compute_v1.types.SerialPortOutputAn instance serial console output.

get_shielded_instance_identity

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: Union[google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault] = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())

Returns the Shielded Instance Identity of an instance

Parameters
NameDescription
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 the request instance; if request is provided, this should not be set.

zone str

The name of the zone for this request. This corresponds to the zone field on the request instance; if request 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 the request instance; if request 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
TypeDescription
google.cloud.compute_v1.types.ShieldedInstanceIdentityA Shielded Instance Identity.

insert_unary

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: Union[google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault] = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())

Creates an instance resource in the specified project using the data included in the request.

Parameters
NameDescription
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 the request instance; if request is provided, this should not be set.

zone str

The name of the zone for this request. This corresponds to the zone field on the request instance; if request 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 the request instance; if request 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
TypeDescription
google.cloud.compute_v1.types.OperationRepresents an Operation resource. Google Compute Engine has three Operation resources: \* [Global](/compute/docs/reference/rest/v1/globalOperations) \* [Regional](/compute/docs/reference/rest/v1/regionOperations) \* [Zonal](/compute/docs/reference/rest/v1/zoneOperations) You can use an operation resource to manage asynchronous API requests. For more information, read Handling API responses. Operations can be global, regional or zonal. - For global operations, use the globalOperations resource. - For regional operations, use the regionOperations resource. - For zonal operations, use the zonalOperations resource. For more information, read Global, Regional, and Zonal Resources.

list

list(request: Optional[Union[google.cloud.compute_v1.types.compute.ListInstancesRequest, dict]] = None, *, project: Optional[str] = None, zone: Optional[str] = None, retry: Union[google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault] = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())

Retrieves the list of instances contained within the specified zone.

Parameters
NameDescription
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 the request instance; if request is provided, this should not be set.

zone str

The name of the zone for this request. This corresponds to the zone field on the request instance; if request 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
TypeDescription
google.cloud.compute_v1.services.instances.pagers.ListPagerContains a list of instances. Iterating over this object will yield results and resolve additional pages automatically.

list_referrers

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: Union[google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault] = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())

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.

Parameters
NameDescription
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 the request instance; if request is provided, this should not be set.

zone str

The name of the zone for this request. This corresponds to the zone field on the request instance; if request 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 the request instance; if request 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
TypeDescription
google.cloud.compute_v1.services.instances.pagers.ListReferrersPagerContains a list of instance referrers. Iterating over this object will yield results and resolve additional pages automatically.

parse_common_billing_account_path

parse_common_billing_account_path(path: str)

Parse a billing_account path into its component segments.

parse_common_folder_path

parse_common_folder_path(path: str)

Parse a folder path into its component segments.

parse_common_location_path

parse_common_location_path(path: str)

Parse a location path into its component segments.

parse_common_organization_path

parse_common_organization_path(path: str)

Parse a organization path into its component segments.

parse_common_project_path

parse_common_project_path(path: str)

Parse a project path into its component segments.

remove_resource_policies_unary

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: Union[google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault] = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())

Removes resource policies from an instance.

Parameters
NameDescription
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 the request instance; if request is provided, this should not be set.

zone str

The name of the zone for this request. This corresponds to the zone field on the request instance; if request is provided, this should not be set.

instance str

The instance name for this request. This corresponds to the instance field on the request instance; if request 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 the request instance; if request 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
TypeDescription
google.cloud.compute_v1.types.OperationRepresents an Operation resource. Google Compute Engine has three Operation resources: \* [Global](/compute/docs/reference/rest/v1/globalOperations) \* [Regional](/compute/docs/reference/rest/v1/regionOperations) \* [Zonal](/compute/docs/reference/rest/v1/zoneOperations) You can use an operation resource to manage asynchronous API requests. For more information, read Handling API responses. Operations can be global, regional or zonal. - For global operations, use the globalOperations resource. - For regional operations, use the regionOperations resource. - For zonal operations, use the zonalOperations resource. For more information, read Global, Regional, and Zonal Resources.

reset_unary

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: Union[google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault] = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())

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.

Parameters
NameDescription
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 the request instance; if request is provided, this should not be set.

zone str

The name of the zone for this request. This corresponds to the zone field on the request instance; if request is provided, this should not be set.

instance str

Name of the instance scoping this request. This corresponds to the instance field on the request instance; if request 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
TypeDescription
google.cloud.compute_v1.types.OperationRepresents an Operation resource. Google Compute Engine has three Operation resources: \* [Global](/compute/docs/reference/rest/v1/globalOperations) \* [Regional](/compute/docs/reference/rest/v1/regionOperations) \* [Zonal](/compute/docs/reference/rest/v1/zoneOperations) You can use an operation resource to manage asynchronous API requests. For more information, read Handling API responses. Operations can be global, regional or zonal. - For global operations, use the globalOperations resource. - For regional operations, use the regionOperations resource. - For zonal operations, use the zonalOperations resource. For more information, read Global, Regional, and Zonal Resources.

resume_unary

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: Union[google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault] = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())

Resumes an instance that was suspended using the instances().suspend method.

Parameters
NameDescription
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 the request instance; if request is provided, this should not be set.

zone str

The name of the zone for this request. This corresponds to the zone field on the request instance; if request is provided, this should not be set.

instance str

Name of the instance resource to resume. This corresponds to the instance field on the request instance; if request 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
TypeDescription
google.cloud.compute_v1.types.OperationRepresents an Operation resource. Google Compute Engine has three Operation resources: \* [Global](/compute/docs/reference/rest/v1/globalOperations) \* [Regional](/compute/docs/reference/rest/v1/regionOperations) \* [Zonal](/compute/docs/reference/rest/v1/zoneOperations) You can use an operation resource to manage asynchronous API requests. For more information, read Handling API responses. Operations can be global, regional or zonal. - For global operations, use the globalOperations resource. - For regional operations, use the regionOperations resource. - For zonal operations, use the zonalOperations resource. For more information, read Global, Regional, and Zonal Resources.

send_diagnostic_interrupt

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: Union[google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault] = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())

Sends diagnostic interrupt to the instance.

Parameters
NameDescription
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 the request instance; if request is provided, this should not be set.

zone str

The name of the zone for this request. This corresponds to the zone field on the request instance; if request is provided, this should not be set.

instance str

Name of the instance scoping this request. This corresponds to the instance field on the request instance; if request 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
TypeDescription
google.cloud.compute_v1.types.SendDiagnosticInterruptInstanceResponseA response message for Instances.SendDiagnosticInterrupt. See the method description for details.

set_deletion_protection_unary

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: Union[google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault] = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())

Sets deletion protection on the instance.

Parameters
NameDescription
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 the request instance; if request is provided, this should not be set.

zone str

The name of the zone for this request. This corresponds to the zone field on the request instance; if request 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 the request instance; if request 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
TypeDescription
google.cloud.compute_v1.types.OperationRepresents an Operation resource. Google Compute Engine has three Operation resources: \* [Global](/compute/docs/reference/rest/v1/globalOperations) \* [Regional](/compute/docs/reference/rest/v1/regionOperations) \* [Zonal](/compute/docs/reference/rest/v1/zoneOperations) You can use an operation resource to manage asynchronous API requests. For more information, read Handling API responses. Operations can be global, regional or zonal. - For global operations, use the globalOperations resource. - For regional operations, use the regionOperations resource. - For zonal operations, use the zonalOperations resource. For more information, read Global, Regional, and Zonal Resources.

set_disk_auto_delete_unary

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: Union[google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault] = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())

Sets the auto-delete flag for a disk attached to an instance.

Parameters
NameDescription
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 the request instance; if request is provided, this should not be set.

zone str

The name of the zone for this request. This corresponds to the zone field on the request instance; if request is provided, this should not be set.

instance str

The instance name for this request. This corresponds to the instance field on the request instance; if request 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 the request instance; if request 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 the request instance; if request 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
TypeDescription
google.cloud.compute_v1.types.OperationRepresents an Operation resource. Google Compute Engine has three Operation resources: \* [Global](/compute/docs/reference/rest/v1/globalOperations) \* [Regional](/compute/docs/reference/rest/v1/regionOperations) \* [Zonal](/compute/docs/reference/rest/v1/zoneOperations) You can use an operation resource to manage asynchronous API requests. For more information, read Handling API responses. Operations can be global, regional or zonal. - For global operations, use the globalOperations resource. - For regional operations, use the regionOperations resource. - For zonal operations, use the zonalOperations resource. For more information, read Global, Regional, and Zonal Resources.

set_iam_policy

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: Union[google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault] = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())

Sets the access control policy on the specified resource. Replaces any existing policy.

Parameters
NameDescription
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 the request instance; if request is provided, this should not be set.

zone str

The name of the zone for this request. This corresponds to the zone field on the request instance; if request 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 the request instance; if request 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 the request instance; if request 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
TypeDescription
google.cloud.compute_v1.types.PolicyAn 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](\="">

set_labels_unary

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: Union[google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault] = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())

Sets labels on an instance. To learn more about labels, read the Labeling Resources documentation.

Parameters
NameDescription
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 the request instance; if request is provided, this should not be set.

zone str

The name of the zone for this request. This corresponds to the zone field on the request instance; if request is provided, this should not be set.

instance str

Name of the instance scoping this request. This corresponds to the instance field on the request instance; if request 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 the request instance; if request 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
TypeDescription
google.cloud.compute_v1.types.OperationRepresents an Operation resource. Google Compute Engine has three Operation resources: \* [Global](/compute/docs/reference/rest/v1/globalOperations) \* [Regional](/compute/docs/reference/rest/v1/regionOperations) \* [Zonal](/compute/docs/reference/rest/v1/zoneOperations) You can use an operation resource to manage asynchronous API requests. For more information, read Handling API responses. Operations can be global, regional or zonal. - For global operations, use the globalOperations resource. - For regional operations, use the regionOperations resource. - For zonal operations, use the zonalOperations resource. For more information, read Global, Regional, and Zonal Resources.

set_machine_resources_unary

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: Union[google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault] = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())

Changes the number and/or type of accelerator for a stopped instance to the values specified in the request.

Parameters
NameDescription
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 the request instance; if request is provided, this should not be set.

zone str

The name of the zone for this request. This corresponds to the zone field on the request instance; if request is provided, this should not be set.

instance str

Name of the instance scoping this request. This corresponds to the instance field on the request instance; if request 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 the request instance; if request 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
TypeDescription
google.cloud.compute_v1.types.OperationRepresents an Operation resource. Google Compute Engine has three Operation resources: \* [Global](/compute/docs/reference/rest/v1/globalOperations) \* [Regional](/compute/docs/reference/rest/v1/regionOperations) \* [Zonal](/compute/docs/reference/rest/v1/zoneOperations) You can use an operation resource to manage asynchronous API requests. For more information, read Handling API responses. Operations can be global, regional or zonal. - For global operations, use the globalOperations resource. - For regional operations, use the regionOperations resource. - For zonal operations, use the zonalOperations resource. For more information, read Global, Regional, and Zonal Resources.

set_machine_type_unary

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: Union[google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault] = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())

Changes the machine type for a stopped instance to the machine type specified in the request.

Parameters
NameDescription
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 the request instance; if request is provided, this should not be set.

zone str

The name of the zone for this request. This corresponds to the zone field on the request instance; if request is provided, this should not be set.

instance str

Name of the instance scoping this request. This corresponds to the instance field on the request instance; if request 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 the request instance; if request 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
TypeDescription
google.cloud.compute_v1.types.OperationRepresents an Operation resource. Google Compute Engine has three Operation resources: \* [Global](/compute/docs/reference/rest/v1/globalOperations) \* [Regional](/compute/docs/reference/rest/v1/regionOperations) \* [Zonal](/compute/docs/reference/rest/v1/zoneOperations) You can use an operation resource to manage asynchronous API requests. For more information, read Handling API responses. Operations can be global, regional or zonal. - For global operations, use the globalOperations resource. - For regional operations, use the regionOperations resource. - For zonal operations, use the zonalOperations resource. For more information, read Global, Regional, and Zonal Resources.

set_metadata_unary

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: Union[google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault] = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())

Sets metadata for the specified instance to the data included in the request.

Parameters
NameDescription
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 the request instance; if request is provided, this should not be set.

zone str

The name of the zone for this request. This corresponds to the zone field on the request instance; if request is provided, this should not be set.

instance str

Name of the instance scoping this request. This corresponds to the instance field on the request instance; if request 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 the request instance; if request 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
TypeDescription
google.cloud.compute_v1.types.OperationRepresents an Operation resource. Google Compute Engine has three Operation resources: \* [Global](/compute/docs/reference/rest/v1/globalOperations) \* [Regional](/compute/docs/reference/rest/v1/regionOperations) \* [Zonal](/compute/docs/reference/rest/v1/zoneOperations) You can use an operation resource to manage asynchronous API requests. For more information, read Handling API responses. Operations can be global, regional or zonal. - For global operations, use the globalOperations resource. - For regional operations, use the regionOperations resource. - For zonal operations, use the zonalOperations resource. For more information, read Global, Regional, and Zonal Resources.

set_min_cpu_platform_unary

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: Union[google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault] = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())

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.

Parameters
NameDescription
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 the request instance; if request is provided, this should not be set.

zone str

The name of the zone for this request. This corresponds to the zone field on the request instance; if request is provided, this should not be set.

instance str

Name of the instance scoping this request. This corresponds to the instance field on the request instance; if request 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 the request instance; if request 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
TypeDescription
google.cloud.compute_v1.types.OperationRepresents an Operation resource. Google Compute Engine has three Operation resources: \* [Global](/compute/docs/reference/rest/v1/globalOperations) \* [Regional](/compute/docs/reference/rest/v1/regionOperations) \* [Zonal](/compute/docs/reference/rest/v1/zoneOperations) You can use an operation resource to manage asynchronous API requests. For more information, read Handling API responses. Operations can be global, regional or zonal. - For global operations, use the globalOperations resource. - For regional operations, use the regionOperations resource. - For zonal operations, use the zonalOperations resource. For more information, read Global, Regional, and Zonal Resources.

set_scheduling_unary

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: Union[google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault] = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())

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 availability policies.

Parameters
NameDescription
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 the request instance; if request is provided, this should not be set.

zone str

The name of the zone for this request. This corresponds to the zone field on the request instance; if request is provided, this should not be set.

instance str

Instance name for this request. This corresponds to the instance field on the request instance; if request 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 the request instance; if request 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
TypeDescription
google.cloud.compute_v1.types.OperationRepresents an Operation resource. Google Compute Engine has three Operation resources: \* [Global](/compute/docs/reference/rest/v1/globalOperations) \* [Regional](/compute/docs/reference/rest/v1/regionOperations) \* [Zonal](/compute/docs/reference/rest/v1/zoneOperations) You can use an operation resource to manage asynchronous API requests. For more information, read Handling API responses. Operations can be global, regional or zonal. - For global operations, use the globalOperations resource. - For regional operations, use the regionOperations resource. - For zonal operations, use the zonalOperations resource. For more information, read Global, Regional, and Zonal Resources.

set_service_account_unary

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: Union[google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault] = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())

Sets the service account on the instance. For more information, read Changing the service account and access scopes for an instance.

Parameters
NameDescription
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 the request instance; if request is provided, this should not be set.

zone str

The name of the zone for this request. This corresponds to the zone field on the request instance; if request is provided, this should not be set.

instance str

Name of the instance resource to start. This corresponds to the instance field on the request instance; if request 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 the request instance; if request 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
TypeDescription
google.cloud.compute_v1.types.OperationRepresents an Operation resource. Google Compute Engine has three Operation resources: \* [Global](/compute/docs/reference/rest/v1/globalOperations) \* [Regional](/compute/docs/reference/rest/v1/regionOperations) \* [Zonal](/compute/docs/reference/rest/v1/zoneOperations) You can use an operation resource to manage asynchronous API requests. For more information, read Handling API responses. Operations can be global, regional or zonal. - For global operations, use the globalOperations resource. - For regional operations, use the regionOperations resource. - For zonal operations, use the zonalOperations resource. For more information, read Global, Regional, and Zonal Resources.

set_shielded_instance_integrity_policy_unary

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: Union[google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault] = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())

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.

Parameters
NameDescription
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 the request instance; if request is provided, this should not be set.

zone str

The name of the zone for this request. This corresponds to the zone field on the request instance; if request 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 the request instance; if request 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 the request instance; if request 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
TypeDescription
google.cloud.compute_v1.types.OperationRepresents an Operation resource. Google Compute Engine has three Operation resources: \* [Global](/compute/docs/reference/rest/v1/globalOperations) \* [Regional](/compute/docs/reference/rest/v1/regionOperations) \* [Zonal](/compute/docs/reference/rest/v1/zoneOperations) You can use an operation resource to manage asynchronous API requests. For more information, read Handling API responses. Operations can be global, regional or zonal. - For global operations, use the globalOperations resource. - For regional operations, use the regionOperations resource. - For zonal operations, use the zonalOperations resource. For more information, read Global, Regional, and Zonal Resources.

set_tags_unary

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: Union[google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault] = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())

Sets network tags for the specified instance to the data included in the request.

Parameters
NameDescription
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 the request instance; if request is provided, this should not be set.

zone str

The name of the zone for this request. This corresponds to the zone field on the request instance; if request is provided, this should not be set.

instance str

Name of the instance scoping this request. This corresponds to the instance field on the request instance; if request 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 the request instance; if request 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
TypeDescription
google.cloud.compute_v1.types.OperationRepresents an Operation resource. Google Compute Engine has three Operation resources: \* [Global](/compute/docs/reference/rest/v1/globalOperations) \* [Regional](/compute/docs/reference/rest/v1/regionOperations) \* [Zonal](/compute/docs/reference/rest/v1/zoneOperations) You can use an operation resource to manage asynchronous API requests. For more information, read Handling API responses. Operations can be global, regional or zonal. - For global operations, use the globalOperations resource. - For regional operations, use the regionOperations resource. - For zonal operations, use the zonalOperations resource. For more information, read Global, Regional, and Zonal Resources.

simulate_maintenance_event_unary

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: Union[google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault] = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())

Simulates a host maintenance event on a VM. For more information, see Simulate a host maintenance event.

Parameters
NameDescription
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 the request instance; if request is provided, this should not be set.

zone str

The name of the zone for this request. This corresponds to the zone field on the request instance; if request is provided, this should not be set.

instance str

Name of the instance scoping this request. This corresponds to the instance field on the request instance; if request 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
TypeDescription
google.cloud.compute_v1.types.OperationRepresents an Operation resource. Google Compute Engine has three Operation resources: \* [Global](/compute/docs/reference/rest/v1/globalOperations) \* [Regional](/compute/docs/reference/rest/v1/regionOperations) \* [Zonal](/compute/docs/reference/rest/v1/zoneOperations) You can use an operation resource to manage asynchronous API requests. For more information, read Handling API responses. Operations can be global, regional or zonal. - For global operations, use the globalOperations resource. - For regional operations, use the regionOperations resource. - For zonal operations, use the zonalOperations resource. For more information, read Global, Regional, and Zonal Resources.

start_unary

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: Union[google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault] = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())

Starts an instance that was stopped using the instances().stop method. For more information, see Restart an instance.

Parameters
NameDescription
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 the request instance; if request is provided, this should not be set.

zone str

The name of the zone for this request. This corresponds to the zone field on the request instance; if request is provided, this should not be set.

instance str

Name of the instance resource to start. This corresponds to the instance field on the request instance; if request 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
TypeDescription
google.cloud.compute_v1.types.OperationRepresents an Operation resource. Google Compute Engine has three Operation resources: \* [Global](/compute/docs/reference/rest/v1/globalOperations) \* [Regional](/compute/docs/reference/rest/v1/regionOperations) \* [Zonal](/compute/docs/reference/rest/v1/zoneOperations) You can use an operation resource to manage asynchronous API requests. For more information, read Handling API responses. Operations can be global, regional or zonal. - For global operations, use the globalOperations resource. - For regional operations, use the regionOperations resource. - For zonal operations, use the zonalOperations resource. For more information, read Global, Regional, and Zonal Resources.

start_with_encryption_key_unary

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: Union[google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault] = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())

Starts an instance that was stopped using the instances().stop method. For more information, see Restart an instance.

Parameters
NameDescription
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 the request instance; if request is provided, this should not be set.

zone str

The name of the zone for this request. This corresponds to the zone field on the request instance; if request is provided, this should not be set.

instance str

Name of the instance resource to start. This corresponds to the instance field on the request instance; if request 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 the request instance; if request 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
TypeDescription
google.cloud.compute_v1.types.OperationRepresents an Operation resource. Google Compute Engine has three Operation resources: \* [Global](/compute/docs/reference/rest/v1/globalOperations) \* [Regional](/compute/docs/reference/rest/v1/regionOperations) \* [Zonal](/compute/docs/reference/rest/v1/zoneOperations) You can use an operation resource to manage asynchronous API requests. For more information, read Handling API responses. Operations can be global, regional or zonal. - For global operations, use the globalOperations resource. - For regional operations, use the regionOperations resource. - For zonal operations, use the zonalOperations resource. For more information, read Global, Regional, and Zonal Resources.

stop_unary

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: Union[google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault] = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())

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.

Parameters
NameDescription
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 the request instance; if request is provided, this should not be set.

zone str

The name of the zone for this request. This corresponds to the zone field on the request instance; if request is provided, this should not be set.

instance str

Name of the instance resource to stop. This corresponds to the instance field on the request instance; if request 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
TypeDescription
google.cloud.compute_v1.types.OperationRepresents an Operation resource. Google Compute Engine has three Operation resources: \* [Global](/compute/docs/reference/rest/v1/globalOperations) \* [Regional](/compute/docs/reference/rest/v1/regionOperations) \* [Zonal](/compute/docs/reference/rest/v1/zoneOperations) You can use an operation resource to manage asynchronous API requests. For more information, read Handling API responses. Operations can be global, regional or zonal. - For global operations, use the globalOperations resource. - For regional operations, use the regionOperations resource. - For zonal operations, use the zonalOperations resource. For more information, read Global, Regional, and Zonal Resources.

suspend_unary

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: Union[google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault] = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())

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.

Parameters
NameDescription
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 the request instance; if request is provided, this should not be set.

zone str

The name of the zone for this request. This corresponds to the zone field on the request instance; if request is provided, this should not be set.

instance str

Name of the instance resource to suspend. This corresponds to the instance field on the request instance; if request 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
TypeDescription
google.cloud.compute_v1.types.OperationRepresents an Operation resource. Google Compute Engine has three Operation resources: \* [Global](/compute/docs/reference/rest/v1/globalOperations) \* [Regional](/compute/docs/reference/rest/v1/regionOperations) \* [Zonal](/compute/docs/reference/rest/v1/zoneOperations) You can use an operation resource to manage asynchronous API requests. For more information, read Handling API responses. Operations can be global, regional or zonal. - For global operations, use the globalOperations resource. - For regional operations, use the regionOperations resource. - For zonal operations, use the zonalOperations resource. For more information, read Global, Regional, and Zonal Resources.

test_iam_permissions

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: Union[google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault] = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())

Returns permissions that a caller has on the specified resource.

Parameters
NameDescription
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 the request instance; if request is provided, this should not be set.

zone str

The name of the zone for this request. This corresponds to the zone field on the request instance; if request 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 the request instance; if request 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 the request instance; if request 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.

update_access_config_unary

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: Union[google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault] = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())

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.

Parameters
NameDescription
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 the request instance; if request is provided, this should not be set.

zone str

The name of the zone for this request. This corresponds to the zone field on the request instance; if request is provided, this should not be set.

instance str

The instance name for this request. This corresponds to the instance field on the request instance; if request 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 the request instance; if request 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 the request instance; if request 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
TypeDescription
google.cloud.compute_v1.types.OperationRepresents an Operation resource. Google Compute Engine has three Operation resources: \* [Global](/compute/docs/reference/rest/v1/globalOperations) \* [Regional](/compute/docs/reference/rest/v1/regionOperations) \* [Zonal](/compute/docs/reference/rest/v1/zoneOperations) You can use an operation resource to manage asynchronous API requests. For more information, read Handling API responses. Operations can be global, regional or zonal. - For global operations, use the globalOperations resource. - For regional operations, use the regionOperations resource. - For zonal operations, use the zonalOperations resource. For more information, read Global, Regional, and Zonal Resources.

update_display_device_unary

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: Union[google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault] = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())

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.

Parameters
NameDescription
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 the request instance; if request is provided, this should not be set.

zone str

The name of the zone for this request. This corresponds to the zone field on the request instance; if request is provided, this should not be set.

instance str

Name of the instance scoping this request. This corresponds to the instance field on the request instance; if request 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 the request instance; if request 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
TypeDescription
google.cloud.compute_v1.types.OperationRepresents an Operation resource. Google Compute Engine has three Operation resources: \* [Global](/compute/docs/reference/rest/v1/globalOperations) \* [Regional](/compute/docs/reference/rest/v1/regionOperations) \* [Zonal](/compute/docs/reference/rest/v1/zoneOperations) You can use an operation resource to manage asynchronous API requests. For more information, read Handling API responses. Operations can be global, regional or zonal. - For global operations, use the globalOperations resource. - For regional operations, use the regionOperations resource. - For zonal operations, use the zonalOperations resource. For more information, read Global, Regional, and Zonal Resources.

update_network_interface_unary

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: Union[google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault] = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())

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.

Parameters
NameDescription
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 the request instance; if request is provided, this should not be set.

zone str

The name of the zone for this request. This corresponds to the zone field on the request instance; if request is provided, this should not be set.

instance str

The instance name for this request. This corresponds to the instance field on the request instance; if request 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 the request instance; if request 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 the request instance; if request 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
TypeDescription
google.cloud.compute_v1.types.OperationRepresents an Operation resource. Google Compute Engine has three Operation resources: \* [Global](/compute/docs/reference/rest/v1/globalOperations) \* [Regional](/compute/docs/reference/rest/v1/regionOperations) \* [Zonal](/compute/docs/reference/rest/v1/zoneOperations) You can use an operation resource to manage asynchronous API requests. For more information, read Handling API responses. Operations can be global, regional or zonal. - For global operations, use the globalOperations resource. - For regional operations, use the regionOperations resource. - For zonal operations, use the zonalOperations resource. For more information, read Global, Regional, and Zonal Resources.

update_shielded_instance_config_unary

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: Union[google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault] = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())

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.

Parameters
NameDescription
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 the request instance; if request is provided, this should not be set.

zone str

The name of the zone for this request. This corresponds to the zone field on the request instance; if request 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 the request instance; if request 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 the request instance; if request 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
TypeDescription
google.cloud.compute_v1.types.OperationRepresents an Operation resource. Google Compute Engine has three Operation resources: \* [Global](/compute/docs/reference/rest/v1/globalOperations) \* [Regional](/compute/docs/reference/rest/v1/regionOperations) \* [Zonal](/compute/docs/reference/rest/v1/zoneOperations) You can use an operation resource to manage asynchronous API requests. For more information, read Handling API responses. Operations can be global, regional or zonal. - For global operations, use the globalOperations resource. - For regional operations, use the regionOperations resource. - For zonal operations, use the zonalOperations resource. For more information, read Global, Regional, and Zonal Resources.

update_unary

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: Union[google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault] = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())

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.

Parameters
NameDescription
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 the request instance; if request is provided, this should not be set.

zone str

The name of the zone for this request. This corresponds to the zone field on the request instance; if request is provided, this should not be set.

instance str

Name of the instance resource to update. This corresponds to the instance field on the request instance; if request 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 the request instance; if request 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
TypeDescription
google.cloud.compute_v1.types.OperationRepresents an Operation resource. Google Compute Engine has three Operation resources: \* [Global](/compute/docs/reference/rest/v1/globalOperations) \* [Regional](/compute/docs/reference/rest/v1/regionOperations) \* [Zonal](/compute/docs/reference/rest/v1/zoneOperations) You can use an operation resource to manage asynchronous API requests. For more information, read Handling API responses. Operations can be global, regional or zonal. - For global operations, use the globalOperations resource. - For regional operations, use the regionOperations resource. - For zonal operations, use the zonalOperations resource. For more information, read Global, Regional, and Zonal Resources.