InstancesClient(*, credentials: typing.Optional[google.auth.credentials.Credentials] = None, transport: typing.Optional[typing.Union[str, google.cloud.compute_v1.services.instances.transports.base.InstancesTransport]] = None, client_options: typing.Optional[typing.Union[google.api_core.client_options.ClientOptions, dict]] = None, client_info: google.api_core.gapic_v1.client_info.ClientInfo = <google.api_core.gapic_v1.client_info.ClientInfo object>)
The Instances API.
Properties
transport
Returns the transport used by the client instance.
Returns | |
---|---|
Type | Description |
InstancesTransport | The transport used by the client instance. |
Methods
InstancesClient
InstancesClient(*, credentials: typing.Optional[google.auth.credentials.Credentials] = None, transport: typing.Optional[typing.Union[str, google.cloud.compute_v1.services.instances.transports.base.InstancesTransport]] = None, client_options: typing.Optional[typing.Union[google.api_core.client_options.ClientOptions, dict]] = None, client_info: google.api_core.gapic_v1.client_info.ClientInfo = <google.api_core.gapic_v1.client_info.ClientInfo object>)
Instantiates the instances client.
Parameters | |
---|---|
Name | Description |
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. NOTE: "rest" transport functionality is currently in a beta state (preview). We welcome your feedback via an issue in this library's source repository. |
client_options |
Optional[Union[google.api_core.client_options.ClientOptions, dict]]
Custom options for the client. It won't take effect if a |
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 |
Exceptions | |
---|---|
Type | Description |
google.auth.exceptions.MutualTLSChannelError | If mutual TLS transport creation failed for any reason. |
__exit__
__exit__(type, value, traceback)
Releases underlying transport's resources.
add_access_config
add_access_config(
request: typing.Optional[
typing.Union[
google.cloud.compute_v1.types.compute.AddAccessConfigInstanceRequest, dict
]
] = None,
*,
project: typing.Optional[str] = None,
zone: typing.Optional[str] = None,
instance: typing.Optional[str] = None,
network_interface: typing.Optional[str] = None,
access_config_resource: typing.Optional[
google.cloud.compute_v1.types.compute.AccessConfig
] = None,
retry: typing.Union[
google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, str]] = ()
) -> google.api_core.extended_operation.ExtendedOperation
Adds an access config to an instance's network interface.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import compute_v1
def sample_add_access_config():
# Create a client
client = compute_v1.InstancesClient()
# Initialize request argument(s)
request = compute_v1.AddAccessConfigInstanceRequest(
instance="instance_value",
network_interface="network_interface_value",
project="project_value",
zone="zone_value",
)
# Make the request
response = client.add_access_config(request=request)
# Handle the response
print(response)
Parameters | |
---|---|
Name | Description |
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 |
zone |
str
The name of the zone for this request. This corresponds to the |
instance |
str
The instance name for this request. This corresponds to the |
network_interface |
str
The name of the network interface to add to this instance. This corresponds to the |
access_config_resource |
google.cloud.compute_v1.types.AccessConfig
The body resource for this request This corresponds to the |
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 | |
---|---|
Type | Description |
google.api_core.extended_operation.ExtendedOperation | An object representing a extended long-running operation. |
add_access_config_unary
add_access_config_unary(
request: typing.Optional[
typing.Union[
google.cloud.compute_v1.types.compute.AddAccessConfigInstanceRequest, dict
]
] = None,
*,
project: typing.Optional[str] = None,
zone: typing.Optional[str] = None,
instance: typing.Optional[str] = None,
network_interface: typing.Optional[str] = None,
access_config_resource: typing.Optional[
google.cloud.compute_v1.types.compute.AccessConfig
] = None,
retry: typing.Union[
google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, str]] = ()
) -> google.cloud.compute_v1.types.compute.Operation
Adds an access config to an instance's network interface.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import compute_v1
def sample_add_access_config():
# Create a client
client = compute_v1.InstancesClient()
# Initialize request argument(s)
request = compute_v1.AddAccessConfigInstanceRequest(
instance="instance_value",
network_interface="network_interface_value",
project="project_value",
zone="zone_value",
)
# Make the request
response = client.add_access_config(request=request)
# Handle the response
print(response)
Parameters | |
---|---|
Name | Description |
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 |
zone |
str
The name of the zone for this request. This corresponds to the |
instance |
str
The instance name for this request. This corresponds to the |
network_interface |
str
The name of the network interface to add to this instance. This corresponds to the |
access_config_resource |
google.cloud.compute_v1.types.AccessConfig
The body resource for this request This corresponds to the |
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 | |
---|---|
Type | Description |
google.api_core.extended_operation.ExtendedOperation | An object representing a extended long-running operation. |
add_resource_policies
add_resource_policies(
request: typing.Optional[
typing.Union[
google.cloud.compute_v1.types.compute.AddResourcePoliciesInstanceRequest,
dict,
]
] = None,
*,
project: typing.Optional[str] = None,
zone: typing.Optional[str] = None,
instance: typing.Optional[str] = None,
instances_add_resource_policies_request_resource: typing.Optional[
google.cloud.compute_v1.types.compute.InstancesAddResourcePoliciesRequest
] = None,
retry: typing.Union[
google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, str]] = ()
) -> google.api_core.extended_operation.ExtendedOperation
Adds existing resource policies to an instance. You can only add one policy right now which will be applied to this instance for scheduling live migrations.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import compute_v1
def sample_add_resource_policies():
# Create a client
client = compute_v1.InstancesClient()
# Initialize request argument(s)
request = compute_v1.AddResourcePoliciesInstanceRequest(
instance="instance_value",
project="project_value",
zone="zone_value",
)
# Make the request
response = client.add_resource_policies(request=request)
# Handle the response
print(response)
Parameters | |
---|---|
Name | Description |
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 |
zone |
str
The name of the zone for this request. This corresponds to the |
instance |
str
The instance name for this request. This corresponds to the |
instances_add_resource_policies_request_resource |
google.cloud.compute_v1.types.InstancesAddResourcePoliciesRequest
The body resource for this request This corresponds to the |
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 | |
---|---|
Type | Description |
google.api_core.extended_operation.ExtendedOperation | An object representing a extended long-running operation. |
add_resource_policies_unary
add_resource_policies_unary(
request: typing.Optional[
typing.Union[
google.cloud.compute_v1.types.compute.AddResourcePoliciesInstanceRequest,
dict,
]
] = None,
*,
project: typing.Optional[str] = None,
zone: typing.Optional[str] = None,
instance: typing.Optional[str] = None,
instances_add_resource_policies_request_resource: typing.Optional[
google.cloud.compute_v1.types.compute.InstancesAddResourcePoliciesRequest
] = None,
retry: typing.Union[
google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, str]] = ()
) -> google.cloud.compute_v1.types.compute.Operation
Adds existing resource policies to an instance. You can only add one policy right now which will be applied to this instance for scheduling live migrations.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import compute_v1
def sample_add_resource_policies():
# Create a client
client = compute_v1.InstancesClient()
# Initialize request argument(s)
request = compute_v1.AddResourcePoliciesInstanceRequest(
instance="instance_value",
project="project_value",
zone="zone_value",
)
# Make the request
response = client.add_resource_policies(request=request)
# Handle the response
print(response)
Parameters | |
---|---|
Name | Description |
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 |
zone |
str
The name of the zone for this request. This corresponds to the |
instance |
str
The instance name for this request. This corresponds to the |
instances_add_resource_policies_request_resource |
google.cloud.compute_v1.types.InstancesAddResourcePoliciesRequest
The body resource for this request This corresponds to the |
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 | |
---|---|
Type | Description |
google.api_core.extended_operation.ExtendedOperation | An object representing a extended long-running operation. |
aggregated_list
aggregated_list(
request: typing.Optional[
typing.Union[
google.cloud.compute_v1.types.compute.AggregatedListInstancesRequest, dict
]
] = None,
*,
project: typing.Optional[str] = None,
retry: typing.Union[
google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, str]] = ()
) -> google.cloud.compute_v1.services.instances.pagers.AggregatedListPager
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.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import compute_v1
def sample_aggregated_list():
# Create a client
client = compute_v1.InstancesClient()
# Initialize request argument(s)
request = compute_v1.AggregatedListInstancesRequest(
project="project_value",
)
# Make the request
page_result = client.aggregated_list(request=request)
# Handle the response
for response in page_result:
print(response)
Parameters | |
---|---|
Name | Description |
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 |
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 | |
---|---|
Type | Description |
google.cloud.compute_v1.services.instances.pagers.AggregatedListPager | Iterating over this object will yield results and resolve additional pages automatically. |
attach_disk
attach_disk(
request: typing.Optional[
typing.Union[
google.cloud.compute_v1.types.compute.AttachDiskInstanceRequest, dict
]
] = None,
*,
project: typing.Optional[str] = None,
zone: typing.Optional[str] = None,
instance: typing.Optional[str] = None,
attached_disk_resource: typing.Optional[
google.cloud.compute_v1.types.compute.AttachedDisk
] = None,
retry: typing.Union[
google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, str]] = ()
) -> google.api_core.extended_operation.ExtendedOperation
Attaches an existing Disk resource to an instance. You must first create the disk before you can attach it. It is not possible to create and attach a disk at the same time. For more information, read Adding a persistent disk to your instance.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import compute_v1
def sample_attach_disk():
# Create a client
client = compute_v1.InstancesClient()
# Initialize request argument(s)
request = compute_v1.AttachDiskInstanceRequest(
instance="instance_value",
project="project_value",
zone="zone_value",
)
# Make the request
response = client.attach_disk(request=request)
# Handle the response
print(response)
Parameters | |
---|---|
Name | Description |
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 |
zone |
str
The name of the zone for this request. This corresponds to the |
instance |
str
The instance name for this request. This corresponds to the |
attached_disk_resource |
google.cloud.compute_v1.types.AttachedDisk
The body resource for this request This corresponds to the |
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 | |
---|---|
Type | Description |
google.api_core.extended_operation.ExtendedOperation | An object representing a extended long-running operation. |
attach_disk_unary
attach_disk_unary(
request: typing.Optional[
typing.Union[
google.cloud.compute_v1.types.compute.AttachDiskInstanceRequest, dict
]
] = None,
*,
project: typing.Optional[str] = None,
zone: typing.Optional[str] = None,
instance: typing.Optional[str] = None,
attached_disk_resource: typing.Optional[
google.cloud.compute_v1.types.compute.AttachedDisk
] = None,
retry: typing.Union[
google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, str]] = ()
) -> google.cloud.compute_v1.types.compute.Operation
Attaches an existing Disk resource to an instance. You must first create the disk before you can attach it. It is not possible to create and attach a disk at the same time. For more information, read Adding a persistent disk to your instance.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import compute_v1
def sample_attach_disk():
# Create a client
client = compute_v1.InstancesClient()
# Initialize request argument(s)
request = compute_v1.AttachDiskInstanceRequest(
instance="instance_value",
project="project_value",
zone="zone_value",
)
# Make the request
response = client.attach_disk(request=request)
# Handle the response
print(response)
Parameters | |
---|---|
Name | Description |
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 |
zone |
str
The name of the zone for this request. This corresponds to the |
instance |
str
The instance name for this request. This corresponds to the |
attached_disk_resource |
google.cloud.compute_v1.types.AttachedDisk
The body resource for this request This corresponds to the |
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 | |
---|---|
Type | Description |
google.api_core.extended_operation.ExtendedOperation | An object representing a extended long-running operation. |
bulk_insert
bulk_insert(
request: typing.Optional[
typing.Union[
google.cloud.compute_v1.types.compute.BulkInsertInstanceRequest, dict
]
] = None,
*,
project: typing.Optional[str] = None,
zone: typing.Optional[str] = None,
bulk_insert_instance_resource_resource: typing.Optional[
google.cloud.compute_v1.types.compute.BulkInsertInstanceResource
] = None,
retry: typing.Union[
google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, str]] = ()
) -> google.api_core.extended_operation.ExtendedOperation
Creates multiple instances. Count specifies the number of instances to create. For more information, see About bulk creation of VMs.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import compute_v1
def sample_bulk_insert():
# Create a client
client = compute_v1.InstancesClient()
# Initialize request argument(s)
request = compute_v1.BulkInsertInstanceRequest(
project="project_value",
zone="zone_value",
)
# Make the request
response = client.bulk_insert(request=request)
# Handle the response
print(response)
Parameters | |
---|---|
Name | Description |
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 |
zone |
str
The name of the zone for this request. This corresponds to the |
bulk_insert_instance_resource_resource |
google.cloud.compute_v1.types.BulkInsertInstanceResource
The body resource for this request This corresponds to the |
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 | |
---|---|
Type | Description |
google.api_core.extended_operation.ExtendedOperation | An object representing a extended long-running operation. |
bulk_insert_unary
bulk_insert_unary(
request: typing.Optional[
typing.Union[
google.cloud.compute_v1.types.compute.BulkInsertInstanceRequest, dict
]
] = None,
*,
project: typing.Optional[str] = None,
zone: typing.Optional[str] = None,
bulk_insert_instance_resource_resource: typing.Optional[
google.cloud.compute_v1.types.compute.BulkInsertInstanceResource
] = None,
retry: typing.Union[
google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, str]] = ()
) -> google.cloud.compute_v1.types.compute.Operation
Creates multiple instances. Count specifies the number of instances to create. For more information, see About bulk creation of VMs.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import compute_v1
def sample_bulk_insert():
# Create a client
client = compute_v1.InstancesClient()
# Initialize request argument(s)
request = compute_v1.BulkInsertInstanceRequest(
project="project_value",
zone="zone_value",
)
# Make the request
response = client.bulk_insert(request=request)
# Handle the response
print(response)
Parameters | |
---|---|
Name | Description |
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 |
zone |
str
The name of the zone for this request. This corresponds to the |
bulk_insert_instance_resource_resource |
google.cloud.compute_v1.types.BulkInsertInstanceResource
The body resource for this request This corresponds to the |
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 | |
---|---|
Type | Description |
google.api_core.extended_operation.ExtendedOperation | An object representing a extended long-running operation. |
common_billing_account_path
common_billing_account_path(billing_account: str) -> str
Returns a fully-qualified billing_account string.
common_folder_path
common_folder_path(folder: str) -> str
Returns a fully-qualified folder string.
common_location_path
common_location_path(project: str, location: str) -> str
Returns a fully-qualified location string.
common_organization_path
common_organization_path(organization: str) -> str
Returns a fully-qualified organization string.
common_project_path
common_project_path(project: str) -> str
Returns a fully-qualified project string.
delete
delete(
request: typing.Optional[
typing.Union[google.cloud.compute_v1.types.compute.DeleteInstanceRequest, dict]
] = None,
*,
project: typing.Optional[str] = None,
zone: typing.Optional[str] = None,
instance: typing.Optional[str] = None,
retry: typing.Union[
google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, str]] = ()
) -> google.api_core.extended_operation.ExtendedOperation
Deletes the specified Instance resource. For more information, see Deleting an instance.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import compute_v1
def sample_delete():
# Create a client
client = compute_v1.InstancesClient()
# Initialize request argument(s)
request = compute_v1.DeleteInstanceRequest(
instance="instance_value",
project="project_value",
zone="zone_value",
)
# Make the request
response = client.delete(request=request)
# Handle the response
print(response)
Parameters | |
---|---|
Name | Description |
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 |
zone |
str
The name of the zone for this request. This corresponds to the |
instance |
str
Name of the instance resource to delete. This corresponds to the |
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 | |
---|---|
Type | Description |
google.api_core.extended_operation.ExtendedOperation | An object representing a extended long-running operation. |
delete_access_config
delete_access_config(
request: typing.Optional[
typing.Union[
google.cloud.compute_v1.types.compute.DeleteAccessConfigInstanceRequest,
dict,
]
] = None,
*,
project: typing.Optional[str] = None,
zone: typing.Optional[str] = None,
instance: typing.Optional[str] = None,
access_config: typing.Optional[str] = None,
network_interface: typing.Optional[str] = None,
retry: typing.Union[
google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, str]] = ()
) -> google.api_core.extended_operation.ExtendedOperation
Deletes an access config from an instance's network interface.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import compute_v1
def sample_delete_access_config():
# Create a client
client = compute_v1.InstancesClient()
# Initialize request argument(s)
request = compute_v1.DeleteAccessConfigInstanceRequest(
access_config="access_config_value",
instance="instance_value",
network_interface="network_interface_value",
project="project_value",
zone="zone_value",
)
# Make the request
response = client.delete_access_config(request=request)
# Handle the response
print(response)
Parameters | |
---|---|
Name | Description |
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 |
zone |
str
The name of the zone for this request. This corresponds to the |
instance |
str
The instance name for this request. This corresponds to the |
access_config |
str
The name of the access config to delete. This corresponds to the |
network_interface |
str
The name of the network interface. This corresponds to the |
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 | |
---|---|
Type | Description |
google.api_core.extended_operation.ExtendedOperation | An object representing a extended long-running operation. |
delete_access_config_unary
delete_access_config_unary(
request: typing.Optional[
typing.Union[
google.cloud.compute_v1.types.compute.DeleteAccessConfigInstanceRequest,
dict,
]
] = None,
*,
project: typing.Optional[str] = None,
zone: typing.Optional[str] = None,
instance: typing.Optional[str] = None,
access_config: typing.Optional[str] = None,
network_interface: typing.Optional[str] = None,
retry: typing.Union[
google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, str]] = ()
) -> google.cloud.compute_v1.types.compute.Operation
Deletes an access config from an instance's network interface.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import compute_v1
def sample_delete_access_config():
# Create a client
client = compute_v1.InstancesClient()
# Initialize request argument(s)
request = compute_v1.DeleteAccessConfigInstanceRequest(
access_config="access_config_value",
instance="instance_value",
network_interface="network_interface_value",
project="project_value",
zone="zone_value",
)
# Make the request
response = client.delete_access_config(request=request)
# Handle the response
print(response)
Parameters | |
---|---|
Name | Description |
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 |
zone |
str
The name of the zone for this request. This corresponds to the |
instance |
str
The instance name for this request. This corresponds to the |
access_config |
str
The name of the access config to delete. This corresponds to the |
network_interface |
str
The name of the network interface. This corresponds to the |
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 | |
---|---|
Type | Description |
google.api_core.extended_operation.ExtendedOperation | An object representing a extended long-running operation. |
delete_unary
delete_unary(
request: typing.Optional[
typing.Union[google.cloud.compute_v1.types.compute.DeleteInstanceRequest, dict]
] = None,
*,
project: typing.Optional[str] = None,
zone: typing.Optional[str] = None,
instance: typing.Optional[str] = None,
retry: typing.Union[
google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, str]] = ()
) -> google.cloud.compute_v1.types.compute.Operation
Deletes the specified Instance resource. For more information, see Deleting an instance.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import compute_v1
def sample_delete():
# Create a client
client = compute_v1.InstancesClient()
# Initialize request argument(s)
request = compute_v1.DeleteInstanceRequest(
instance="instance_value",
project="project_value",
zone="zone_value",
)
# Make the request
response = client.delete(request=request)
# Handle the response
print(response)
Parameters | |
---|---|
Name | Description |
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 |
zone |
str
The name of the zone for this request. This corresponds to the |
instance |
str
Name of the instance resource to delete. This corresponds to the |
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 | |
---|---|
Type | Description |
google.api_core.extended_operation.ExtendedOperation | An object representing a extended long-running operation. |
detach_disk
detach_disk(
request: typing.Optional[
typing.Union[
google.cloud.compute_v1.types.compute.DetachDiskInstanceRequest, dict
]
] = None,
*,
project: typing.Optional[str] = None,
zone: typing.Optional[str] = None,
instance: typing.Optional[str] = None,
device_name: typing.Optional[str] = None,
retry: typing.Union[
google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, str]] = ()
) -> google.api_core.extended_operation.ExtendedOperation
Detaches a disk from an instance.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import compute_v1
def sample_detach_disk():
# Create a client
client = compute_v1.InstancesClient()
# Initialize request argument(s)
request = compute_v1.DetachDiskInstanceRequest(
device_name="device_name_value",
instance="instance_value",
project="project_value",
zone="zone_value",
)
# Make the request
response = client.detach_disk(request=request)
# Handle the response
print(response)
Parameters | |
---|---|
Name | Description |
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 |
zone |
str
The name of the zone for this request. This corresponds to the |
instance |
str
Instance name for this request. This corresponds to the |
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 |
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 | |
---|---|
Type | Description |
google.api_core.extended_operation.ExtendedOperation | An object representing a extended long-running operation. |
detach_disk_unary
detach_disk_unary(
request: typing.Optional[
typing.Union[
google.cloud.compute_v1.types.compute.DetachDiskInstanceRequest, dict
]
] = None,
*,
project: typing.Optional[str] = None,
zone: typing.Optional[str] = None,
instance: typing.Optional[str] = None,
device_name: typing.Optional[str] = None,
retry: typing.Union[
google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, str]] = ()
) -> google.cloud.compute_v1.types.compute.Operation
Detaches a disk from an instance.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import compute_v1
def sample_detach_disk():
# Create a client
client = compute_v1.InstancesClient()
# Initialize request argument(s)
request = compute_v1.DetachDiskInstanceRequest(
device_name="device_name_value",
instance="instance_value",
project="project_value",
zone="zone_value",
)
# Make the request
response = client.detach_disk(request=request)
# Handle the response
print(response)
Parameters | |
---|---|
Name | Description |
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 |
zone |
str
The name of the zone for this request. This corresponds to the |
instance |
str
Instance name for this request. This corresponds to the |
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 |
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 | |
---|---|
Type | Description |
google.api_core.extended_operation.ExtendedOperation | An object representing a extended long-running operation. |
from_service_account_file
from_service_account_file(filename: str, *args, **kwargs)
Creates an instance of this client using the provided credentials file.
Parameter | |
---|---|
Name | Description |
filename |
str
The path to the service account private key json file. |
Returns | |
---|---|
Type | Description |
InstancesClient | The 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 | |
---|---|
Name | Description |
info |
dict
The service account private key info. |
Returns | |
---|---|
Type | Description |
InstancesClient | The 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 | |
---|---|
Name | Description |
filename |
str
The path to the service account private key json file. |
Returns | |
---|---|
Type | Description |
InstancesClient | The constructed client. |
get
get(
request: typing.Optional[
typing.Union[google.cloud.compute_v1.types.compute.GetInstanceRequest, dict]
] = None,
*,
project: typing.Optional[str] = None,
zone: typing.Optional[str] = None,
instance: typing.Optional[str] = None,
retry: typing.Union[
google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, str]] = ()
) -> google.cloud.compute_v1.types.compute.Instance
Returns the specified Instance resource.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import compute_v1
def sample_get():
# Create a client
client = compute_v1.InstancesClient()
# Initialize request argument(s)
request = compute_v1.GetInstanceRequest(
instance="instance_value",
project="project_value",
zone="zone_value",
)
# Make the request
response = client.get(request=request)
# Handle the response
print(response)
Parameters | |
---|---|
Name | Description |
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 |
zone |
str
The name of the zone for this request. This corresponds to the |
instance |
str
Name of the instance resource to return. This corresponds to the |
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 | |
---|---|
Type | Description |
google.cloud.compute_v1.types.Instance | Represents 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: typing.Optional[
typing.Union[
google.cloud.compute_v1.types.compute.GetEffectiveFirewallsInstanceRequest,
dict,
]
] = None,
*,
project: typing.Optional[str] = None,
zone: typing.Optional[str] = None,
instance: typing.Optional[str] = None,
network_interface: typing.Optional[str] = None,
retry: typing.Union[
google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, str]] = ()
) -> google.cloud.compute_v1.types.compute.InstancesGetEffectiveFirewallsResponse
Returns effective firewalls applied to an interface of the instance.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import compute_v1
def sample_get_effective_firewalls():
# Create a client
client = compute_v1.InstancesClient()
# Initialize request argument(s)
request = compute_v1.GetEffectiveFirewallsInstanceRequest(
instance="instance_value",
network_interface="network_interface_value",
project="project_value",
zone="zone_value",
)
# Make the request
response = client.get_effective_firewalls(request=request)
# Handle the response
print(response)
Parameters | |
---|---|
Name | Description |
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 |
zone |
str
The name of the zone for this request. This corresponds to the |
instance |
str
Name of the instance scoping this request. This corresponds to the |
network_interface |
str
The name of the network interface to get the effective firewalls. This corresponds to the |
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: typing.Optional[
typing.Union[
google.cloud.compute_v1.types.compute.GetGuestAttributesInstanceRequest,
dict,
]
] = None,
*,
project: typing.Optional[str] = None,
zone: typing.Optional[str] = None,
instance: typing.Optional[str] = None,
retry: typing.Union[
google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, str]] = ()
) -> google.cloud.compute_v1.types.compute.GuestAttributes
Returns the specified guest attributes entry.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import compute_v1
def sample_get_guest_attributes():
# Create a client
client = compute_v1.InstancesClient()
# Initialize request argument(s)
request = compute_v1.GetGuestAttributesInstanceRequest(
instance="instance_value",
project="project_value",
zone="zone_value",
)
# Make the request
response = client.get_guest_attributes(request=request)
# Handle the response
print(response)
Parameters | |
---|---|
Name | Description |
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 |
zone |
str
The name of the zone for this request. This corresponds to the |
instance |
str
Name of the instance scoping this request. This corresponds to the |
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 | |
---|---|
Type | Description |
google.cloud.compute_v1.types.GuestAttributes | A guest attributes entry. |
get_iam_policy
get_iam_policy(
request: typing.Optional[
typing.Union[
google.cloud.compute_v1.types.compute.GetIamPolicyInstanceRequest, dict
]
] = None,
*,
project: typing.Optional[str] = None,
zone: typing.Optional[str] = None,
resource: typing.Optional[str] = None,
retry: typing.Union[
google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, str]] = ()
) -> google.cloud.compute_v1.types.compute.Policy
Gets the access control policy for a resource. May be empty if no such policy or resource exists.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import compute_v1
def sample_get_iam_policy():
# Create a client
client = compute_v1.InstancesClient()
# Initialize request argument(s)
request = compute_v1.GetIamPolicyInstanceRequest(
project="project_value",
resource="resource_value",
zone="zone_value",
)
# Make the request
response = client.get_iam_policy(request=request)
# Handle the response
print(response)
Parameters | |
---|---|
Name | Description |
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 |
zone |
str
The name of the zone for this request. This corresponds to the |
resource |
str
Name or id of the resource for this request. This corresponds to the |
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 | |
---|---|
Type | Description |
google.cloud.compute_v1.types.Policy | An Identity and Access Management (IAM) policy, which specifies access controls for Google Cloud resources. A Policy is a collection of bindings. A binding binds one or more members, or principals, to a single role. Principals can be user accounts, service accounts, Google groups, and domains (such as G Suite). A role is a named list of permissions; each role can be an IAM predefined role or a user-created custom role. For some types of Google Cloud resources, a binding can also specify a condition, which is a logical expression that allows access to a resource only if the expression evaluates to true. A condition can add constraints based on attributes of the request, the resource, or both. To learn which resources support conditions in their IAM policies, see the [IAM documentation](\ https://cloud.google.com/iam/help/conditions/resource-policies). **JSON example:** { "bindings": [ { "role": "roles/resourcemanager.organizationAdmin", "members": [ "user:mike@example.com", "group:admins@example.com", "domain:google.com", "serviceAccount:my-project-id@appspot.gserviceaccount.com" ] }, { "role": "roles/resourcemanager.organizationViewer", "members": [ "user:eve@example.com" ], "condition": { "title": "expirable access", "description": "Does not grant access after Sep 2020", "expression": "request.time < timestamp('2020-10-01t00:00:00.000z')",="" }="" }="" ],="" "etag":="" "bwwwja0yfja=", " version":="" 3="" }="" **yaml="" example:**="" bindings:="" -="" members:="" -="" user:\="" mike@example.com="" -="" group:\="" admins@example.com="" -="" domain:google.com="" -="" serviceaccount:\="" my-project-id@appspot.gserviceaccount.com="" role:="" roles/resourcemanager.organizationadmin="" -="" members:="" -="" user:\="" eve@example.com="" role:="" roles/resourcemanager.organizationviewer="" condition:="" title:="" expirable="" access="" description:="" does="" not="" grant="" access="" after="" sep="" 2020="" expression:="" request.time="">< timestamp('2020-10-01t00:00:00.000z')="" etag:="" bwwwja0yfja="version:" 3="" for="" a="" description="" of="" iam="" and="" its="" features,="" see="" the="" [iam="" documentation](\=""> |
get_mtls_endpoint_and_cert_source
get_mtls_endpoint_and_cert_source(
client_options: typing.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 variable is "never", use the default API
endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise
use the default API endpoint.
More details can be found at https://google.aip.dev/auth/4114.
Parameter | |
---|---|
Name | Description |
client_options |
google.api_core.client_options.ClientOptions
Custom options for the client. Only the |
Exceptions | |
---|---|
Type | Description |
google.auth.exceptions.MutualTLSChannelError | If any errors happen. |
Returns | |
---|---|
Type | Description |
Tuple[str, Callable[[], Tuple[bytes, bytes]]] | returns the API endpoint and the client cert source to use. |
get_screenshot
get_screenshot(
request: typing.Optional[
typing.Union[
google.cloud.compute_v1.types.compute.GetScreenshotInstanceRequest, dict
]
] = None,
*,
project: typing.Optional[str] = None,
zone: typing.Optional[str] = None,
instance: typing.Optional[str] = None,
retry: typing.Union[
google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, str]] = ()
) -> google.cloud.compute_v1.types.compute.Screenshot
Returns the screenshot from the specified instance.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import compute_v1
def sample_get_screenshot():
# Create a client
client = compute_v1.InstancesClient()
# Initialize request argument(s)
request = compute_v1.GetScreenshotInstanceRequest(
instance="instance_value",
project="project_value",
zone="zone_value",
)
# Make the request
response = client.get_screenshot(request=request)
# Handle the response
print(response)
Parameters | |
---|---|
Name | Description |
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 |
zone |
str
The name of the zone for this request. This corresponds to the |
instance |
str
Name of the instance scoping this request. This corresponds to the |
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 | |
---|---|
Type | Description |
google.cloud.compute_v1.types.Screenshot | An instance's screenshot. |
get_serial_port_output
get_serial_port_output(
request: typing.Optional[
typing.Union[
google.cloud.compute_v1.types.compute.GetSerialPortOutputInstanceRequest,
dict,
]
] = None,
*,
project: typing.Optional[str] = None,
zone: typing.Optional[str] = None,
instance: typing.Optional[str] = None,
retry: typing.Union[
google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, str]] = ()
) -> google.cloud.compute_v1.types.compute.SerialPortOutput
Returns the last 1 MB of serial port output from the specified instance.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import compute_v1
def sample_get_serial_port_output():
# Create a client
client = compute_v1.InstancesClient()
# Initialize request argument(s)
request = compute_v1.GetSerialPortOutputInstanceRequest(
instance="instance_value",
project="project_value",
zone="zone_value",
)
# Make the request
response = client.get_serial_port_output(request=request)
# Handle the response
print(response)
Parameters | |
---|---|
Name | Description |
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 |
zone |
str
The name of the zone for this request. This corresponds to the |
instance |
str
Name of the instance for this request. This corresponds to the |
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 | |
---|---|
Type | Description |
google.cloud.compute_v1.types.SerialPortOutput | An instance serial console output. |
get_shielded_instance_identity
get_shielded_instance_identity(
request: typing.Optional[
typing.Union[
google.cloud.compute_v1.types.compute.GetShieldedInstanceIdentityInstanceRequest,
dict,
]
] = None,
*,
project: typing.Optional[str] = None,
zone: typing.Optional[str] = None,
instance: typing.Optional[str] = None,
retry: typing.Union[
google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, str]] = ()
) -> google.cloud.compute_v1.types.compute.ShieldedInstanceIdentity
Returns the Shielded Instance Identity of an instance
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import compute_v1
def sample_get_shielded_instance_identity():
# Create a client
client = compute_v1.InstancesClient()
# Initialize request argument(s)
request = compute_v1.GetShieldedInstanceIdentityInstanceRequest(
instance="instance_value",
project="project_value",
zone="zone_value",
)
# Make the request
response = client.get_shielded_instance_identity(request=request)
# Handle the response
print(response)
Parameters | |
---|---|
Name | Description |
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 |
zone |
str
The name of the zone for this request. This corresponds to the |
instance |
str
Name or id of the instance scoping this request. This corresponds to the |
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 | |
---|---|
Type | Description |
google.cloud.compute_v1.types.ShieldedInstanceIdentity | A Shielded Instance Identity. |
insert
insert(
request: typing.Optional[
typing.Union[google.cloud.compute_v1.types.compute.InsertInstanceRequest, dict]
] = None,
*,
project: typing.Optional[str] = None,
zone: typing.Optional[str] = None,
instance_resource: typing.Optional[
google.cloud.compute_v1.types.compute.Instance
] = None,
retry: typing.Union[
google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, str]] = ()
) -> google.api_core.extended_operation.ExtendedOperation
Creates an instance resource in the specified project using the data included in the request.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import compute_v1
def sample_insert():
# Create a client
client = compute_v1.InstancesClient()
# Initialize request argument(s)
request = compute_v1.InsertInstanceRequest(
project="project_value",
zone="zone_value",
)
# Make the request
response = client.insert(request=request)
# Handle the response
print(response)
Parameters | |
---|---|
Name | Description |
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 |
zone |
str
The name of the zone for this request. This corresponds to the |
instance_resource |
google.cloud.compute_v1.types.Instance
The body resource for this request This corresponds to the |
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 | |
---|---|
Type | Description |
google.api_core.extended_operation.ExtendedOperation | An object representing a extended long-running operation. |
insert_unary
insert_unary(
request: typing.Optional[
typing.Union[google.cloud.compute_v1.types.compute.InsertInstanceRequest, dict]
] = None,
*,
project: typing.Optional[str] = None,
zone: typing.Optional[str] = None,
instance_resource: typing.Optional[
google.cloud.compute_v1.types.compute.Instance
] = None,
retry: typing.Union[
google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, str]] = ()
) -> google.cloud.compute_v1.types.compute.Operation
Creates an instance resource in the specified project using the data included in the request.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import compute_v1
def sample_insert():
# Create a client
client = compute_v1.InstancesClient()
# Initialize request argument(s)
request = compute_v1.InsertInstanceRequest(
project="project_value",
zone="zone_value",
)
# Make the request
response = client.insert(request=request)
# Handle the response
print(response)
Parameters | |
---|---|
Name | Description |
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 |
zone |
str
The name of the zone for this request. This corresponds to the |
instance_resource |
google.cloud.compute_v1.types.Instance
The body resource for this request This corresponds to the |
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 | |
---|---|
Type | Description |
google.api_core.extended_operation.ExtendedOperation | An object representing a extended long-running operation. |
list
list(
request: typing.Optional[
typing.Union[google.cloud.compute_v1.types.compute.ListInstancesRequest, dict]
] = None,
*,
project: typing.Optional[str] = None,
zone: typing.Optional[str] = None,
retry: typing.Union[
google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, str]] = ()
) -> google.cloud.compute_v1.services.instances.pagers.ListPager
Retrieves the list of instances contained within the specified zone.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import compute_v1
def sample_list():
# Create a client
client = compute_v1.InstancesClient()
# Initialize request argument(s)
request = compute_v1.ListInstancesRequest(
project="project_value",
zone="zone_value",
)
# Make the request
page_result = client.list(request=request)
# Handle the response
for response in page_result:
print(response)
Parameters | |
---|---|
Name | Description |
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 |
zone |
str
The name of the zone for this request. This corresponds to the |
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 | |
---|---|
Type | Description |
google.cloud.compute_v1.services.instances.pagers.ListPager | Contains a list of instances. Iterating over this object will yield results and resolve additional pages automatically. |
list_referrers
list_referrers(
request: typing.Optional[
typing.Union[
google.cloud.compute_v1.types.compute.ListReferrersInstancesRequest, dict
]
] = None,
*,
project: typing.Optional[str] = None,
zone: typing.Optional[str] = None,
instance: typing.Optional[str] = None,
retry: typing.Union[
google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, str]] = ()
) -> google.cloud.compute_v1.services.instances.pagers.ListReferrersPager
Retrieves a list of resources that refer to the VM instance specified in the request. For example, if the VM instance is part of a managed or unmanaged instance group, the referrers list includes the instance group. For more information, read Viewing referrers to VM instances.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import compute_v1
def sample_list_referrers():
# Create a client
client = compute_v1.InstancesClient()
# Initialize request argument(s)
request = compute_v1.ListReferrersInstancesRequest(
instance="instance_value",
project="project_value",
zone="zone_value",
)
# Make the request
page_result = client.list_referrers(request=request)
# Handle the response
for response in page_result:
print(response)
Parameters | |
---|---|
Name | Description |
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 |
zone |
str
The name of the zone for this request. This corresponds to the |
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 |
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 | |
---|---|
Type | Description |
google.cloud.compute_v1.services.instances.pagers.ListReferrersPager | Contains 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) -> typing.Dict[str, str]
Parse a billing_account path into its component segments.
parse_common_folder_path
parse_common_folder_path(path: str) -> typing.Dict[str, str]
Parse a folder path into its component segments.
parse_common_location_path
parse_common_location_path(path: str) -> typing.Dict[str, str]
Parse a location path into its component segments.
parse_common_organization_path
parse_common_organization_path(path: str) -> typing.Dict[str, str]
Parse a organization path into its component segments.
parse_common_project_path
parse_common_project_path(path: str) -> typing.Dict[str, str]
Parse a project path into its component segments.
remove_resource_policies
remove_resource_policies(
request: typing.Optional[
typing.Union[
google.cloud.compute_v1.types.compute.RemoveResourcePoliciesInstanceRequest,
dict,
]
] = None,
*,
project: typing.Optional[str] = None,
zone: typing.Optional[str] = None,
instance: typing.Optional[str] = None,
instances_remove_resource_policies_request_resource: typing.Optional[
google.cloud.compute_v1.types.compute.InstancesRemoveResourcePoliciesRequest
] = None,
retry: typing.Union[
google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, str]] = ()
) -> google.api_core.extended_operation.ExtendedOperation
Removes resource policies from an instance.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import compute_v1
def sample_remove_resource_policies():
# Create a client
client = compute_v1.InstancesClient()
# Initialize request argument(s)
request = compute_v1.RemoveResourcePoliciesInstanceRequest(
instance="instance_value",
project="project_value",
zone="zone_value",
)
# Make the request
response = client.remove_resource_policies(request=request)
# Handle the response
print(response)
Parameters | |
---|---|
Name | Description |
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 |
zone |
str
The name of the zone for this request. This corresponds to the |
instance |
str
The instance name for this request. This corresponds to the |
instances_remove_resource_policies_request_resource |
google.cloud.compute_v1.types.InstancesRemoveResourcePoliciesRequest
The body resource for this request This corresponds to the |
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 | |
---|---|
Type | Description |
google.api_core.extended_operation.ExtendedOperation | An object representing a extended long-running operation. |
remove_resource_policies_unary
remove_resource_policies_unary(
request: typing.Optional[
typing.Union[
google.cloud.compute_v1.types.compute.RemoveResourcePoliciesInstanceRequest,
dict,
]
] = None,
*,
project: typing.Optional[str] = None,
zone: typing.Optional[str] = None,
instance: typing.Optional[str] = None,
instances_remove_resource_policies_request_resource: typing.Optional[
google.cloud.compute_v1.types.compute.InstancesRemoveResourcePoliciesRequest
] = None,
retry: typing.Union[
google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, str]] = ()
) -> google.cloud.compute_v1.types.compute.Operation
Removes resource policies from an instance.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import compute_v1
def sample_remove_resource_policies():
# Create a client
client = compute_v1.InstancesClient()
# Initialize request argument(s)
request = compute_v1.RemoveResourcePoliciesInstanceRequest(
instance="instance_value",
project="project_value",
zone="zone_value",
)
# Make the request
response = client.remove_resource_policies(request=request)
# Handle the response
print(response)
Parameters | |
---|---|
Name | Description |
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 |
zone |
str
The name of the zone for this request. This corresponds to the |
instance |
str
The instance name for this request. This corresponds to the |
instances_remove_resource_policies_request_resource |
google.cloud.compute_v1.types.InstancesRemoveResourcePoliciesRequest
The body resource for this request This corresponds to the |
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 | |
---|---|
Type | Description |
google.api_core.extended_operation.ExtendedOperation | An object representing a extended long-running operation. |
reset
reset(
request: typing.Optional[
typing.Union[google.cloud.compute_v1.types.compute.ResetInstanceRequest, dict]
] = None,
*,
project: typing.Optional[str] = None,
zone: typing.Optional[str] = None,
instance: typing.Optional[str] = None,
retry: typing.Union[
google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, str]] = ()
) -> google.api_core.extended_operation.ExtendedOperation
Performs a reset on the instance. This is a hard reset. The VM does not do a graceful shutdown. For more information, see Resetting an instance.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import compute_v1
def sample_reset():
# Create a client
client = compute_v1.InstancesClient()
# Initialize request argument(s)
request = compute_v1.ResetInstanceRequest(
instance="instance_value",
project="project_value",
zone="zone_value",
)
# Make the request
response = client.reset(request=request)
# Handle the response
print(response)
Parameters | |
---|---|
Name | Description |
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 |
zone |
str
The name of the zone for this request. This corresponds to the |
instance |
str
Name of the instance scoping this request. This corresponds to the |
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 | |
---|---|
Type | Description |
google.api_core.extended_operation.ExtendedOperation | An object representing a extended long-running operation. |
reset_unary
reset_unary(
request: typing.Optional[
typing.Union[google.cloud.compute_v1.types.compute.ResetInstanceRequest, dict]
] = None,
*,
project: typing.Optional[str] = None,
zone: typing.Optional[str] = None,
instance: typing.Optional[str] = None,
retry: typing.Union[
google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, str]] = ()
) -> google.cloud.compute_v1.types.compute.Operation
Performs a reset on the instance. This is a hard reset. The VM does not do a graceful shutdown. For more information, see Resetting an instance.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import compute_v1
def sample_reset():
# Create a client
client = compute_v1.InstancesClient()
# Initialize request argument(s)
request = compute_v1.ResetInstanceRequest(
instance="instance_value",
project="project_value",
zone="zone_value",
)
# Make the request
response = client.reset(request=request)
# Handle the response
print(response)
Parameters | |
---|---|
Name | Description |
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 |
zone |
str
The name of the zone for this request. This corresponds to the |
instance |
str
Name of the instance scoping this request. This corresponds to the |
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 | |
---|---|
Type | Description |
google.api_core.extended_operation.ExtendedOperation | An object representing a extended long-running operation. |
resume
resume(
request: typing.Optional[
typing.Union[google.cloud.compute_v1.types.compute.ResumeInstanceRequest, dict]
] = None,
*,
project: typing.Optional[str] = None,
zone: typing.Optional[str] = None,
instance: typing.Optional[str] = None,
retry: typing.Union[
google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, str]] = ()
) -> google.api_core.extended_operation.ExtendedOperation
Resumes an instance that was suspended using the instances().suspend method.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import compute_v1
def sample_resume():
# Create a client
client = compute_v1.InstancesClient()
# Initialize request argument(s)
request = compute_v1.ResumeInstanceRequest(
instance="instance_value",
project="project_value",
zone="zone_value",
)
# Make the request
response = client.resume(request=request)
# Handle the response
print(response)
Parameters | |
---|---|
Name | Description |
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 |
zone |
str
The name of the zone for this request. This corresponds to the |
instance |
str
Name of the instance resource to resume. This corresponds to the |
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 | |
---|---|
Type | Description |
google.api_core.extended_operation.ExtendedOperation | An object representing a extended long-running operation. |
resume_unary
resume_unary(
request: typing.Optional[
typing.Union[google.cloud.compute_v1.types.compute.ResumeInstanceRequest, dict]
] = None,
*,
project: typing.Optional[str] = None,
zone: typing.Optional[str] = None,
instance: typing.Optional[str] = None,
retry: typing.Union[
google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, str]] = ()
) -> google.cloud.compute_v1.types.compute.Operation
Resumes an instance that was suspended using the instances().suspend method.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import compute_v1
def sample_resume():
# Create a client
client = compute_v1.InstancesClient()
# Initialize request argument(s)
request = compute_v1.ResumeInstanceRequest(
instance="instance_value",
project="project_value",
zone="zone_value",
)
# Make the request
response = client.resume(request=request)
# Handle the response
print(response)
Parameters | |
---|---|
Name | Description |
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 |
zone |
str
The name of the zone for this request. This corresponds to the |
instance |
str
Name of the instance resource to resume. This corresponds to the |
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 | |
---|---|
Type | Description |
google.api_core.extended_operation.ExtendedOperation | An object representing a extended long-running operation. |
send_diagnostic_interrupt
send_diagnostic_interrupt(
request: typing.Optional[
typing.Union[
google.cloud.compute_v1.types.compute.SendDiagnosticInterruptInstanceRequest,
dict,
]
] = None,
*,
project: typing.Optional[str] = None,
zone: typing.Optional[str] = None,
instance: typing.Optional[str] = None,
retry: typing.Union[
google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, str]] = ()
) -> google.cloud.compute_v1.types.compute.SendDiagnosticInterruptInstanceResponse
Sends diagnostic interrupt to the instance.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import compute_v1
def sample_send_diagnostic_interrupt():
# Create a client
client = compute_v1.InstancesClient()
# Initialize request argument(s)
request = compute_v1.SendDiagnosticInterruptInstanceRequest(
instance="instance_value",
project="project_value",
zone="zone_value",
)
# Make the request
response = client.send_diagnostic_interrupt(request=request)
# Handle the response
print(response)
Parameters | |
---|---|
Name | Description |
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 |
zone |
str
The name of the zone for this request. This corresponds to the |
instance |
str
Name of the instance scoping this request. This corresponds to the |
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 | |
---|---|
Type | Description |
google.cloud.compute_v1.types.SendDiagnosticInterruptInstanceResponse | A response message for Instances.SendDiagnosticInterrupt. See the method description for details. |
set_deletion_protection
set_deletion_protection(
request: typing.Optional[
typing.Union[
google.cloud.compute_v1.types.compute.SetDeletionProtectionInstanceRequest,
dict,
]
] = None,
*,
project: typing.Optional[str] = None,
zone: typing.Optional[str] = None,
resource: typing.Optional[str] = None,
retry: typing.Union[
google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, str]] = ()
) -> google.api_core.extended_operation.ExtendedOperation
Sets deletion protection on the instance.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import compute_v1
def sample_set_deletion_protection():
# Create a client
client = compute_v1.InstancesClient()
# Initialize request argument(s)
request = compute_v1.SetDeletionProtectionInstanceRequest(
project="project_value",
resource="resource_value",
zone="zone_value",
)
# Make the request
response = client.set_deletion_protection(request=request)
# Handle the response
print(response)
Parameters | |
---|---|
Name | Description |
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 |
zone |
str
The name of the zone for this request. This corresponds to the |
resource |
str
Name or id of the resource for this request. This corresponds to the |
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 | |
---|---|
Type | Description |
google.api_core.extended_operation.ExtendedOperation | An object representing a extended long-running operation. |
set_deletion_protection_unary
set_deletion_protection_unary(
request: typing.Optional[
typing.Union[
google.cloud.compute_v1.types.compute.SetDeletionProtectionInstanceRequest,
dict,
]
] = None,
*,
project: typing.Optional[str] = None,
zone: typing.Optional[str] = None,
resource: typing.Optional[str] = None,
retry: typing.Union[
google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, str]] = ()
) -> google.cloud.compute_v1.types.compute.Operation
Sets deletion protection on the instance.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import compute_v1
def sample_set_deletion_protection():
# Create a client
client = compute_v1.InstancesClient()
# Initialize request argument(s)
request = compute_v1.SetDeletionProtectionInstanceRequest(
project="project_value",
resource="resource_value",
zone="zone_value",
)
# Make the request
response = client.set_deletion_protection(request=request)
# Handle the response
print(response)
Parameters | |
---|---|
Name | Description |
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 |
zone |
str
The name of the zone for this request. This corresponds to the |
resource |
str
Name or id of the resource for this request. This corresponds to the |
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 | |
---|---|
Type | Description |
google.api_core.extended_operation.ExtendedOperation | An object representing a extended long-running operation. |
set_disk_auto_delete
set_disk_auto_delete(
request: typing.Optional[
typing.Union[
google.cloud.compute_v1.types.compute.SetDiskAutoDeleteInstanceRequest, dict
]
] = None,
*,
project: typing.Optional[str] = None,
zone: typing.Optional[str] = None,
instance: typing.Optional[str] = None,
auto_delete: typing.Optional[bool] = None,
device_name: typing.Optional[str] = None,
retry: typing.Union[
google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, str]] = ()
) -> google.api_core.extended_operation.ExtendedOperation
Sets the auto-delete flag for a disk attached to an instance.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import compute_v1
def sample_set_disk_auto_delete():
# Create a client
client = compute_v1.InstancesClient()
# Initialize request argument(s)
request = compute_v1.SetDiskAutoDeleteInstanceRequest(
auto_delete=True,
device_name="device_name_value",
instance="instance_value",
project="project_value",
zone="zone_value",
)
# Make the request
response = client.set_disk_auto_delete(request=request)
# Handle the response
print(response)
Parameters | |
---|---|
Name | Description |
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 |
zone |
str
The name of the zone for this request. This corresponds to the |
instance |
str
The instance name for this request. This corresponds to the |
auto_delete |
bool
Whether to auto-delete the disk when the instance is deleted. This corresponds to the |
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 |
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 | |
---|---|
Type | Description |
google.api_core.extended_operation.ExtendedOperation | An object representing a extended long-running operation. |
set_disk_auto_delete_unary
set_disk_auto_delete_unary(
request: typing.Optional[
typing.Union[
google.cloud.compute_v1.types.compute.SetDiskAutoDeleteInstanceRequest, dict
]
] = None,
*,
project: typing.Optional[str] = None,
zone: typing.Optional[str] = None,
instance: typing.Optional[str] = None,
auto_delete: typing.Optional[bool] = None,
device_name: typing.Optional[str] = None,
retry: typing.Union[
google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, str]] = ()
) -> google.cloud.compute_v1.types.compute.Operation
Sets the auto-delete flag for a disk attached to an instance.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import compute_v1
def sample_set_disk_auto_delete():
# Create a client
client = compute_v1.InstancesClient()
# Initialize request argument(s)
request = compute_v1.SetDiskAutoDeleteInstanceRequest(
auto_delete=True,
device_name="device_name_value",
instance="instance_value",
project="project_value",
zone="zone_value",
)
# Make the request
response = client.set_disk_auto_delete(request=request)
# Handle the response
print(response)
Parameters | |
---|---|
Name | Description |
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 |
zone |
str
The name of the zone for this request. This corresponds to the |
instance |
str
The instance name for this request. This corresponds to the |
auto_delete |
bool
Whether to auto-delete the disk when the instance is deleted. This corresponds to the |
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 |
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 | |
---|---|
Type | Description |
google.api_core.extended_operation.ExtendedOperation | An object representing a extended long-running operation. |
set_iam_policy
set_iam_policy(
request: typing.Optional[
typing.Union[
google.cloud.compute_v1.types.compute.SetIamPolicyInstanceRequest, dict
]
] = None,
*,
project: typing.Optional[str] = None,
zone: typing.Optional[str] = None,
resource: typing.Optional[str] = None,
zone_set_policy_request_resource: typing.Optional[
google.cloud.compute_v1.types.compute.ZoneSetPolicyRequest
] = None,
retry: typing.Union[
google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, str]] = ()
) -> google.cloud.compute_v1.types.compute.Policy
Sets the access control policy on the specified resource. Replaces any existing policy.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import compute_v1
def sample_set_iam_policy():
# Create a client
client = compute_v1.InstancesClient()
# Initialize request argument(s)
request = compute_v1.SetIamPolicyInstanceRequest(
project="project_value",
resource="resource_value",
zone="zone_value",
)
# Make the request
response = client.set_iam_policy(request=request)
# Handle the response
print(response)
Parameters | |
---|---|
Name | Description |
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 |
zone |
str
The name of the zone for this request. This corresponds to the |
resource |
str
Name or id of the resource for this request. This corresponds to the |
zone_set_policy_request_resource |
google.cloud.compute_v1.types.ZoneSetPolicyRequest
The body resource for this request This corresponds to the |
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 | |
---|---|
Type | Description |
google.cloud.compute_v1.types.Policy | An Identity and Access Management (IAM) policy, which specifies access controls for Google Cloud resources. A Policy is a collection of bindings. A binding binds one or more members, or principals, to a single role. Principals can be user accounts, service accounts, Google groups, and domains (such as G Suite). A role is a named list of permissions; each role can be an IAM predefined role or a user-created custom role. For some types of Google Cloud resources, a binding can also specify a condition, which is a logical expression that allows access to a resource only if the expression evaluates to true. A condition can add constraints based on attributes of the request, the resource, or both. To learn which resources support conditions in their IAM policies, see the [IAM documentation](\ https://cloud.google.com/iam/help/conditions/resource-policies). **JSON example:** { "bindings": [ { "role": "roles/resourcemanager.organizationAdmin", "members": [ "user:mike@example.com", "group:admins@example.com", "domain:google.com", "serviceAccount:my-project-id@appspot.gserviceaccount.com" ] }, { "role": "roles/resourcemanager.organizationViewer", "members": [ "user:eve@example.com" ], "condition": { "title": "expirable access", "description": "Does not grant access after Sep 2020", "expression": "request.time < timestamp('2020-10-01t00:00:00.000z')",="" }="" }="" ],="" "etag":="" "bwwwja0yfja=", " version":="" 3="" }="" **yaml="" example:**="" bindings:="" -="" members:="" -="" user:\="" mike@example.com="" -="" group:\="" admins@example.com="" -="" domain:google.com="" -="" serviceaccount:\="" my-project-id@appspot.gserviceaccount.com="" role:="" roles/resourcemanager.organizationadmin="" -="" members:="" -="" user:\="" eve@example.com="" role:="" roles/resourcemanager.organizationviewer="" condition:="" title:="" expirable="" access="" description:="" does="" not="" grant="" access="" after="" sep="" 2020="" expression:="" request.time="">< timestamp('2020-10-01t00:00:00.000z')="" etag:="" bwwwja0yfja="version:" 3="" for="" a="" description="" of="" iam="" and="" its="" features,="" see="" the="" [iam="" documentation](\=""> |
set_labels
set_labels(
request: typing.Optional[
typing.Union[
google.cloud.compute_v1.types.compute.SetLabelsInstanceRequest, dict
]
] = None,
*,
project: typing.Optional[str] = None,
zone: typing.Optional[str] = None,
instance: typing.Optional[str] = None,
instances_set_labels_request_resource: typing.Optional[
google.cloud.compute_v1.types.compute.InstancesSetLabelsRequest
] = None,
retry: typing.Union[
google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, str]] = ()
) -> google.api_core.extended_operation.ExtendedOperation
Sets labels on an instance. To learn more about labels, read the Labeling Resources documentation.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import compute_v1
def sample_set_labels():
# Create a client
client = compute_v1.InstancesClient()
# Initialize request argument(s)
request = compute_v1.SetLabelsInstanceRequest(
instance="instance_value",
project="project_value",
zone="zone_value",
)
# Make the request
response = client.set_labels(request=request)
# Handle the response
print(response)
Parameters | |
---|---|
Name | Description |
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 |
zone |
str
The name of the zone for this request. This corresponds to the |
instance |
str
Name of the instance scoping this request. This corresponds to the |
instances_set_labels_request_resource |
google.cloud.compute_v1.types.InstancesSetLabelsRequest
The body resource for this request This corresponds to the |
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 | |
---|---|
Type | Description |
google.api_core.extended_operation.ExtendedOperation | An object representing a extended long-running operation. |
set_labels_unary
set_labels_unary(
request: typing.Optional[
typing.Union[
google.cloud.compute_v1.types.compute.SetLabelsInstanceRequest, dict
]
] = None,
*,
project: typing.Optional[str] = None,
zone: typing.Optional[str] = None,
instance: typing.Optional[str] = None,
instances_set_labels_request_resource: typing.Optional[
google.cloud.compute_v1.types.compute.InstancesSetLabelsRequest
] = None,
retry: typing.Union[
google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, str]] = ()
) -> google.cloud.compute_v1.types.compute.Operation
Sets labels on an instance. To learn more about labels, read the Labeling Resources documentation.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import compute_v1
def sample_set_labels():
# Create a client
client = compute_v1.InstancesClient()
# Initialize request argument(s)
request = compute_v1.SetLabelsInstanceRequest(
instance="instance_value",
project="project_value",
zone="zone_value",
)
# Make the request
response = client.set_labels(request=request)
# Handle the response
print(response)
Parameters | |
---|---|
Name | Description |
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 |
zone |
str
The name of the zone for this request. This corresponds to the |
instance |
str
Name of the instance scoping this request. This corresponds to the |
instances_set_labels_request_resource |
google.cloud.compute_v1.types.InstancesSetLabelsRequest
The body resource for this request This corresponds to the |
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 | |
---|---|
Type | Description |
google.api_core.extended_operation.ExtendedOperation | An object representing a extended long-running operation. |
set_machine_resources
set_machine_resources(
request: typing.Optional[
typing.Union[
google.cloud.compute_v1.types.compute.SetMachineResourcesInstanceRequest,
dict,
]
] = None,
*,
project: typing.Optional[str] = None,
zone: typing.Optional[str] = None,
instance: typing.Optional[str] = None,
instances_set_machine_resources_request_resource: typing.Optional[
google.cloud.compute_v1.types.compute.InstancesSetMachineResourcesRequest
] = None,
retry: typing.Union[
google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, str]] = ()
) -> google.api_core.extended_operation.ExtendedOperation
Changes the number and/or type of accelerator for a stopped instance to the values specified in the request.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import compute_v1
def sample_set_machine_resources():
# Create a client
client = compute_v1.InstancesClient()
# Initialize request argument(s)
request = compute_v1.SetMachineResourcesInstanceRequest(
instance="instance_value",
project="project_value",
zone="zone_value",
)
# Make the request
response = client.set_machine_resources(request=request)
# Handle the response
print(response)
Parameters | |
---|---|
Name | Description |
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 |
zone |
str
The name of the zone for this request. This corresponds to the |
instance |
str
Name of the instance scoping this request. This corresponds to the |
instances_set_machine_resources_request_resource |
google.cloud.compute_v1.types.InstancesSetMachineResourcesRequest
The body resource for this request This corresponds to the |
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 | |
---|---|
Type | Description |
google.api_core.extended_operation.ExtendedOperation | An object representing a extended long-running operation. |
set_machine_resources_unary
set_machine_resources_unary(
request: typing.Optional[
typing.Union[
google.cloud.compute_v1.types.compute.SetMachineResourcesInstanceRequest,
dict,
]
] = None,
*,
project: typing.Optional[str] = None,
zone: typing.Optional[str] = None,
instance: typing.Optional[str] = None,
instances_set_machine_resources_request_resource: typing.Optional[
google.cloud.compute_v1.types.compute.InstancesSetMachineResourcesRequest
] = None,
retry: typing.Union[
google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, str]] = ()
) -> google.cloud.compute_v1.types.compute.Operation
Changes the number and/or type of accelerator for a stopped instance to the values specified in the request.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import compute_v1
def sample_set_machine_resources():
# Create a client
client = compute_v1.InstancesClient()
# Initialize request argument(s)
request = compute_v1.SetMachineResourcesInstanceRequest(
instance="instance_value",
project="project_value",
zone="zone_value",
)
# Make the request
response = client.set_machine_resources(request=request)
# Handle the response
print(response)
Parameters | |
---|---|
Name | Description |
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 |
zone |
str
The name of the zone for this request. This corresponds to the |
instance |
str
Name of the instance scoping this request. This corresponds to the |
instances_set_machine_resources_request_resource |
google.cloud.compute_v1.types.InstancesSetMachineResourcesRequest
The body resource for this request This corresponds to the |
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 | |
---|---|
Type | Description |
google.api_core.extended_operation.ExtendedOperation | An object representing a extended long-running operation. |
set_machine_type
set_machine_type(
request: typing.Optional[
typing.Union[
google.cloud.compute_v1.types.compute.SetMachineTypeInstanceRequest, dict
]
] = None,
*,
project: typing.Optional[str] = None,
zone: typing.Optional[str] = None,
instance: typing.Optional[str] = None,
instances_set_machine_type_request_resource: typing.Optional[
google.cloud.compute_v1.types.compute.InstancesSetMachineTypeRequest
] = None,
retry: typing.Union[
google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, str]] = ()
) -> google.api_core.extended_operation.ExtendedOperation
Changes the machine type for a stopped instance to the machine type specified in the request.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import compute_v1
def sample_set_machine_type():
# Create a client
client = compute_v1.InstancesClient()
# Initialize request argument(s)
request = compute_v1.SetMachineTypeInstanceRequest(
instance="instance_value",
project="project_value",
zone="zone_value",
)
# Make the request
response = client.set_machine_type(request=request)
# Handle the response
print(response)
Parameters | |
---|---|
Name | Description |
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 |
zone |
str
The name of the zone for this request. This corresponds to the |
instance |
str
Name of the instance scoping this request. This corresponds to the |
instances_set_machine_type_request_resource |
google.cloud.compute_v1.types.InstancesSetMachineTypeRequest
The body resource for this request This corresponds to the |
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 | |
---|---|
Type | Description |
google.api_core.extended_operation.ExtendedOperation | An object representing a extended long-running operation. |
set_machine_type_unary
set_machine_type_unary(
request: typing.Optional[
typing.Union[
google.cloud.compute_v1.types.compute.SetMachineTypeInstanceRequest, dict
]
] = None,
*,
project: typing.Optional[str] = None,
zone: typing.Optional[str] = None,
instance: typing.Optional[str] = None,
instances_set_machine_type_request_resource: typing.Optional[
google.cloud.compute_v1.types.compute.InstancesSetMachineTypeRequest
] = None,
retry: typing.Union[
google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, str]] = ()
) -> google.cloud.compute_v1.types.compute.Operation
Changes the machine type for a stopped instance to the machine type specified in the request.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import compute_v1
def sample_set_machine_type():
# Create a client
client = compute_v1.InstancesClient()
# Initialize request argument(s)
request = compute_v1.SetMachineTypeInstanceRequest(
instance="instance_value",
project="project_value",
zone="zone_value",
)
# Make the request
response = client.set_machine_type(request=request)
# Handle the response
print(response)
Parameters | |
---|---|
Name | Description |
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 |
zone |
str
The name of the zone for this request. This corresponds to the |
instance |
str
Name of the instance scoping this request. This corresponds to the |
instances_set_machine_type_request_resource |
google.cloud.compute_v1.types.InstancesSetMachineTypeRequest
The body resource for this request This corresponds to the |
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 | |
---|---|
Type | Description |
google.api_core.extended_operation.ExtendedOperation | An object representing a extended long-running operation. |
set_metadata
set_metadata(
request: typing.Optional[
typing.Union[
google.cloud.compute_v1.types.compute.SetMetadataInstanceRequest, dict
]
] = None,
*,
project: typing.Optional[str] = None,
zone: typing.Optional[str] = None,
instance: typing.Optional[str] = None,
metadata_resource: typing.Optional[
google.cloud.compute_v1.types.compute.Metadata
] = None,
retry: typing.Union[
google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, str]] = ()
) -> google.api_core.extended_operation.ExtendedOperation
Sets metadata for the specified instance to the data included in the request.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import compute_v1
def sample_set_metadata():
# Create a client
client = compute_v1.InstancesClient()
# Initialize request argument(s)
request = compute_v1.SetMetadataInstanceRequest(
instance="instance_value",
project="project_value",
zone="zone_value",
)
# Make the request
response = client.set_metadata(request=request)
# Handle the response
print(response)
Parameters | |
---|---|
Name | Description |
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 |
zone |
str
The name of the zone for this request. This corresponds to the |
instance |
str
Name of the instance scoping this request. This corresponds to the |
metadata_resource |
google.cloud.compute_v1.types.Metadata
The body resource for this request This corresponds to the |
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 | |
---|---|
Type | Description |
google.api_core.extended_operation.ExtendedOperation | An object representing a extended long-running operation. |
set_metadata_unary
set_metadata_unary(
request: typing.Optional[
typing.Union[
google.cloud.compute_v1.types.compute.SetMetadataInstanceRequest, dict
]
] = None,
*,
project: typing.Optional[str] = None,
zone: typing.Optional[str] = None,
instance: typing.Optional[str] = None,
metadata_resource: typing.Optional[
google.cloud.compute_v1.types.compute.Metadata
] = None,
retry: typing.Union[
google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, str]] = ()
) -> google.cloud.compute_v1.types.compute.Operation
Sets metadata for the specified instance to the data included in the request.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import compute_v1
def sample_set_metadata():
# Create a client
client = compute_v1.InstancesClient()
# Initialize request argument(s)
request = compute_v1.SetMetadataInstanceRequest(
instance="instance_value",
project="project_value",
zone="zone_value",
)
# Make the request
response = client.set_metadata(request=request)
# Handle the response
print(response)
Parameters | |
---|---|
Name | Description |
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 |
zone |
str
The name of the zone for this request. This corresponds to the |
instance |
str
Name of the instance scoping this request. This corresponds to the |
metadata_resource |
google.cloud.compute_v1.types.Metadata
The body resource for this request This corresponds to the |
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 | |
---|---|
Type | Description |
google.api_core.extended_operation.ExtendedOperation | An object representing a extended long-running operation. |
set_min_cpu_platform
set_min_cpu_platform(
request: typing.Optional[
typing.Union[
google.cloud.compute_v1.types.compute.SetMinCpuPlatformInstanceRequest, dict
]
] = None,
*,
project: typing.Optional[str] = None,
zone: typing.Optional[str] = None,
instance: typing.Optional[str] = None,
instances_set_min_cpu_platform_request_resource: typing.Optional[
google.cloud.compute_v1.types.compute.InstancesSetMinCpuPlatformRequest
] = None,
retry: typing.Union[
google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, str]] = ()
) -> google.api_core.extended_operation.ExtendedOperation
Changes the minimum CPU platform that this instance should use. This method can only be called on a stopped instance. For more information, read Specifying a Minimum CPU Platform.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import compute_v1
def sample_set_min_cpu_platform():
# Create a client
client = compute_v1.InstancesClient()
# Initialize request argument(s)
request = compute_v1.SetMinCpuPlatformInstanceRequest(
instance="instance_value",
project="project_value",
zone="zone_value",
)
# Make the request
response = client.set_min_cpu_platform(request=request)
# Handle the response
print(response)
Parameters | |
---|---|
Name | Description |
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 |
zone |
str
The name of the zone for this request. This corresponds to the |
instance |
str
Name of the instance scoping this request. This corresponds to the |
instances_set_min_cpu_platform_request_resource |
google.cloud.compute_v1.types.InstancesSetMinCpuPlatformRequest
The body resource for this request This corresponds to the |
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 | |
---|---|
Type | Description |
google.api_core.extended_operation.ExtendedOperation | An object representing a extended long-running operation. |
set_min_cpu_platform_unary
set_min_cpu_platform_unary(
request: typing.Optional[
typing.Union[
google.cloud.compute_v1.types.compute.SetMinCpuPlatformInstanceRequest, dict
]
] = None,
*,
project: typing.Optional[str] = None,
zone: typing.Optional[str] = None,
instance: typing.Optional[str] = None,
instances_set_min_cpu_platform_request_resource: typing.Optional[
google.cloud.compute_v1.types.compute.InstancesSetMinCpuPlatformRequest
] = None,
retry: typing.Union[
google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, str]] = ()
) -> google.cloud.compute_v1.types.compute.Operation
Changes the minimum CPU platform that this instance should use. This method can only be called on a stopped instance. For more information, read Specifying a Minimum CPU Platform.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import compute_v1
def sample_set_min_cpu_platform():
# Create a client
client = compute_v1.InstancesClient()
# Initialize request argument(s)
request = compute_v1.SetMinCpuPlatformInstanceRequest(
instance="instance_value",
project="project_value",
zone="zone_value",
)
# Make the request
response = client.set_min_cpu_platform(request=request)
# Handle the response
print(response)
Parameters | |
---|---|
Name | Description |
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 |
zone |
str
The name of the zone for this request. This corresponds to the |
instance |
str
Name of the instance scoping this request. This corresponds to the |
instances_set_min_cpu_platform_request_resource |
google.cloud.compute_v1.types.InstancesSetMinCpuPlatformRequest
The body resource for this request This corresponds to the |
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 | |
---|---|
Type | Description |
google.api_core.extended_operation.ExtendedOperation | An object representing a extended long-running operation. |
set_name
set_name(
request: typing.Optional[
typing.Union[google.cloud.compute_v1.types.compute.SetNameInstanceRequest, dict]
] = None,
*,
project: typing.Optional[str] = None,
zone: typing.Optional[str] = None,
instance: typing.Optional[str] = None,
instances_set_name_request_resource: typing.Optional[
google.cloud.compute_v1.types.compute.InstancesSetNameRequest
] = None,
retry: typing.Union[
google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, str]] = ()
) -> google.api_core.extended_operation.ExtendedOperation
Sets name of an instance.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import compute_v1
def sample_set_name():
# Create a client
client = compute_v1.InstancesClient()
# Initialize request argument(s)
request = compute_v1.SetNameInstanceRequest(
instance="instance_value",
project="project_value",
zone="zone_value",
)
# Make the request
response = client.set_name(request=request)
# Handle the response
print(response)
Parameters | |
---|---|
Name | Description |
request |
Union[google.cloud.compute_v1.types.SetNameInstanceRequest, dict]
The request object. A request message for Instances.SetName. See the method description for details. |
project |
str
Project ID for this request. This corresponds to the |
zone |
str
The name of the zone for this request. This corresponds to the |
instance |
str
The instance name for this request. This corresponds to the |
instances_set_name_request_resource |
google.cloud.compute_v1.types.InstancesSetNameRequest
The body resource for this request This corresponds to the |
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 | |
---|---|
Type | Description |
google.api_core.extended_operation.ExtendedOperation | An object representing a extended long-running operation. |
set_name_unary
set_name_unary(
request: typing.Optional[
typing.Union[google.cloud.compute_v1.types.compute.SetNameInstanceRequest, dict]
] = None,
*,
project: typing.Optional[str] = None,
zone: typing.Optional[str] = None,
instance: typing.Optional[str] = None,
instances_set_name_request_resource: typing.Optional[
google.cloud.compute_v1.types.compute.InstancesSetNameRequest
] = None,
retry: typing.Union[
google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, str]] = ()
) -> google.cloud.compute_v1.types.compute.Operation
Sets name of an instance.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import compute_v1
def sample_set_name():
# Create a client
client = compute_v1.InstancesClient()
# Initialize request argument(s)
request = compute_v1.SetNameInstanceRequest(
instance="instance_value",
project="project_value",
zone="zone_value",
)
# Make the request
response = client.set_name(request=request)
# Handle the response
print(response)
Parameters | |
---|---|
Name | Description |
request |
Union[google.cloud.compute_v1.types.SetNameInstanceRequest, dict]
The request object. A request message for Instances.SetName. See the method description for details. |
project |
str
Project ID for this request. This corresponds to the |
zone |
str
The name of the zone for this request. This corresponds to the |
instance |
str
The instance name for this request. This corresponds to the |
instances_set_name_request_resource |
google.cloud.compute_v1.types.InstancesSetNameRequest
The body resource for this request This corresponds to the |
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 | |
---|---|
Type | Description |
google.api_core.extended_operation.ExtendedOperation | An object representing a extended long-running operation. |
set_scheduling
set_scheduling(
request: typing.Optional[
typing.Union[
google.cloud.compute_v1.types.compute.SetSchedulingInstanceRequest, dict
]
] = None,
*,
project: typing.Optional[str] = None,
zone: typing.Optional[str] = None,
instance: typing.Optional[str] = None,
scheduling_resource: typing.Optional[
google.cloud.compute_v1.types.compute.Scheduling
] = None,
retry: typing.Union[
google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, str]] = ()
) -> google.api_core.extended_operation.ExtendedOperation
Sets an instance's scheduling options. You can only call this
method on a stopped instance, that is, a VM instance that is in
a TERMINATED
state. See Instance Life Cycle for more
information on the possible instance states. For more
information about setting scheduling options for a VM, see Set
VM host maintenance policy.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import compute_v1
def sample_set_scheduling():
# Create a client
client = compute_v1.InstancesClient()
# Initialize request argument(s)
request = compute_v1.SetSchedulingInstanceRequest(
instance="instance_value",
project="project_value",
zone="zone_value",
)
# Make the request
response = client.set_scheduling(request=request)
# Handle the response
print(response)
Parameters | |
---|---|
Name | Description |
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 |
zone |
str
The name of the zone for this request. This corresponds to the |
instance |
str
Instance name for this request. This corresponds to the |
scheduling_resource |
google.cloud.compute_v1.types.Scheduling
The body resource for this request This corresponds to the |
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 | |
---|---|
Type | Description |
google.api_core.extended_operation.ExtendedOperation | An object representing a extended long-running operation. |
set_scheduling_unary
set_scheduling_unary(
request: typing.Optional[
typing.Union[
google.cloud.compute_v1.types.compute.SetSchedulingInstanceRequest, dict
]
] = None,
*,
project: typing.Optional[str] = None,
zone: typing.Optional[str] = None,
instance: typing.Optional[str] = None,
scheduling_resource: typing.Optional[
google.cloud.compute_v1.types.compute.Scheduling
] = None,
retry: typing.Union[
google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, str]] = ()
) -> google.cloud.compute_v1.types.compute.Operation
Sets an instance's scheduling options. You can only call this
method on a stopped instance, that is, a VM instance that is in
a TERMINATED
state. See Instance Life Cycle for more
information on the possible instance states. For more
information about setting scheduling options for a VM, see Set
VM host maintenance policy.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import compute_v1
def sample_set_scheduling():
# Create a client
client = compute_v1.InstancesClient()
# Initialize request argument(s)
request = compute_v1.SetSchedulingInstanceRequest(
instance="instance_value",
project="project_value",
zone="zone_value",
)
# Make the request
response = client.set_scheduling(request=request)
# Handle the response
print(response)
Parameters | |
---|---|
Name | Description |
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 |
zone |
str
The name of the zone for this request. This corresponds to the |
instance |
str
Instance name for this request. This corresponds to the |
scheduling_resource |
google.cloud.compute_v1.types.Scheduling
The body resource for this request This corresponds to the |
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 | |
---|---|
Type | Description |
google.api_core.extended_operation.ExtendedOperation | An object representing a extended long-running operation. |
set_service_account
set_service_account(
request: typing.Optional[
typing.Union[
google.cloud.compute_v1.types.compute.SetServiceAccountInstanceRequest, dict
]
] = None,
*,
project: typing.Optional[str] = None,
zone: typing.Optional[str] = None,
instance: typing.Optional[str] = None,
instances_set_service_account_request_resource: typing.Optional[
google.cloud.compute_v1.types.compute.InstancesSetServiceAccountRequest
] = None,
retry: typing.Union[
google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, str]] = ()
) -> google.api_core.extended_operation.ExtendedOperation
Sets the service account on the instance. For more information, read Changing the service account and access scopes for an instance.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import compute_v1
def sample_set_service_account():
# Create a client
client = compute_v1.InstancesClient()
# Initialize request argument(s)
request = compute_v1.SetServiceAccountInstanceRequest(
instance="instance_value",
project="project_value",
zone="zone_value",
)
# Make the request
response = client.set_service_account(request=request)
# Handle the response
print(response)
Parameters | |
---|---|
Name | Description |
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 |
zone |
str
The name of the zone for this request. This corresponds to the |
instance |
str
Name of the instance resource to start. This corresponds to the |
instances_set_service_account_request_resource |
google.cloud.compute_v1.types.InstancesSetServiceAccountRequest
The body resource for this request This corresponds to the |
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 | |
---|---|
Type | Description |
google.api_core.extended_operation.ExtendedOperation | An object representing a extended long-running operation. |
set_service_account_unary
set_service_account_unary(
request: typing.Optional[
typing.Union[
google.cloud.compute_v1.types.compute.SetServiceAccountInstanceRequest, dict
]
] = None,
*,
project: typing.Optional[str] = None,
zone: typing.Optional[str] = None,
instance: typing.Optional[str] = None,
instances_set_service_account_request_resource: typing.Optional[
google.cloud.compute_v1.types.compute.InstancesSetServiceAccountRequest
] = None,
retry: typing.Union[
google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, str]] = ()
) -> google.cloud.compute_v1.types.compute.Operation
Sets the service account on the instance. For more information, read Changing the service account and access scopes for an instance.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import compute_v1
def sample_set_service_account():
# Create a client
client = compute_v1.InstancesClient()
# Initialize request argument(s)
request = compute_v1.SetServiceAccountInstanceRequest(
instance="instance_value",
project="project_value",
zone="zone_value",
)
# Make the request
response = client.set_service_account(request=request)
# Handle the response
print(response)
Parameters | |
---|---|
Name | Description |
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 |
zone |
str
The name of the zone for this request. This corresponds to the |
instance |
str
Name of the instance resource to start. This corresponds to the |
instances_set_service_account_request_resource |
google.cloud.compute_v1.types.InstancesSetServiceAccountRequest
The body resource for this request This corresponds to the |
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 | |
---|---|
Type | Description |
google.api_core.extended_operation.ExtendedOperation | An object representing a extended long-running operation. |
set_shielded_instance_integrity_policy
set_shielded_instance_integrity_policy(
request: typing.Optional[
typing.Union[
google.cloud.compute_v1.types.compute.SetShieldedInstanceIntegrityPolicyInstanceRequest,
dict,
]
] = None,
*,
project: typing.Optional[str] = None,
zone: typing.Optional[str] = None,
instance: typing.Optional[str] = None,
shielded_instance_integrity_policy_resource: typing.Optional[
google.cloud.compute_v1.types.compute.ShieldedInstanceIntegrityPolicy
] = None,
retry: typing.Union[
google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, str]] = ()
) -> google.api_core.extended_operation.ExtendedOperation
Sets the Shielded Instance integrity policy for an instance. You can only use this method on a running instance. This method supports PATCH semantics and uses the JSON merge patch format and processing rules.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import compute_v1
def sample_set_shielded_instance_integrity_policy():
# Create a client
client = compute_v1.InstancesClient()
# Initialize request argument(s)
request = compute_v1.SetShieldedInstanceIntegrityPolicyInstanceRequest(
instance="instance_value",
project="project_value",
zone="zone_value",
)
# Make the request
response = client.set_shielded_instance_integrity_policy(request=request)
# Handle the response
print(response)
Parameters | |
---|---|
Name | Description |
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 |
zone |
str
The name of the zone for this request. This corresponds to the |
instance |
str
Name or id of the instance scoping this request. This corresponds to the |
shielded_instance_integrity_policy_resource |
google.cloud.compute_v1.types.ShieldedInstanceIntegrityPolicy
The body resource for this request This corresponds to the |
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 | |
---|---|
Type | Description |
google.api_core.extended_operation.ExtendedOperation | An object representing a extended long-running operation. |
set_shielded_instance_integrity_policy_unary
set_shielded_instance_integrity_policy_unary(
request: typing.Optional[
typing.Union[
google.cloud.compute_v1.types.compute.SetShieldedInstanceIntegrityPolicyInstanceRequest,
dict,
]
] = None,
*,
project: typing.Optional[str] = None,
zone: typing.Optional[str] = None,
instance: typing.Optional[str] = None,
shielded_instance_integrity_policy_resource: typing.Optional[
google.cloud.compute_v1.types.compute.ShieldedInstanceIntegrityPolicy
] = None,
retry: typing.Union[
google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, str]] = ()
) -> google.cloud.compute_v1.types.compute.Operation
Sets the Shielded Instance integrity policy for an instance. You can only use this method on a running instance. This method supports PATCH semantics and uses the JSON merge patch format and processing rules.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import compute_v1
def sample_set_shielded_instance_integrity_policy():
# Create a client
client = compute_v1.InstancesClient()
# Initialize request argument(s)
request = compute_v1.SetShieldedInstanceIntegrityPolicyInstanceRequest(
instance="instance_value",
project="project_value",
zone="zone_value",
)
# Make the request
response = client.set_shielded_instance_integrity_policy(request=request)
# Handle the response
print(response)
Parameters | |
---|---|
Name | Description |
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 |
zone |
str
The name of the zone for this request. This corresponds to the |
instance |
str
Name or id of the instance scoping this request. This corresponds to the |
shielded_instance_integrity_policy_resource |
google.cloud.compute_v1.types.ShieldedInstanceIntegrityPolicy
The body resource for this request This corresponds to the |
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 | |
---|---|
Type | Description |
google.api_core.extended_operation.ExtendedOperation | An object representing a extended long-running operation. |
set_tags
set_tags(
request: typing.Optional[
typing.Union[google.cloud.compute_v1.types.compute.SetTagsInstanceRequest, dict]
] = None,
*,
project: typing.Optional[str] = None,
zone: typing.Optional[str] = None,
instance: typing.Optional[str] = None,
tags_resource: typing.Optional[google.cloud.compute_v1.types.compute.Tags] = None,
retry: typing.Union[
google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, str]] = ()
) -> google.api_core.extended_operation.ExtendedOperation
Sets network tags for the specified instance to the data included in the request.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import compute_v1
def sample_set_tags():
# Create a client
client = compute_v1.InstancesClient()
# Initialize request argument(s)
request = compute_v1.SetTagsInstanceRequest(
instance="instance_value",
project="project_value",
zone="zone_value",
)
# Make the request
response = client.set_tags(request=request)
# Handle the response
print(response)
Parameters | |
---|---|
Name | Description |
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 |
zone |
str
The name of the zone for this request. This corresponds to the |
instance |
str
Name of the instance scoping this request. This corresponds to the |
tags_resource |
google.cloud.compute_v1.types.Tags
The body resource for this request This corresponds to the |
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 | |
---|---|
Type | Description |
google.api_core.extended_operation.ExtendedOperation | An object representing a extended long-running operation. |
set_tags_unary
set_tags_unary(
request: typing.Optional[
typing.Union[google.cloud.compute_v1.types.compute.SetTagsInstanceRequest, dict]
] = None,
*,
project: typing.Optional[str] = None,
zone: typing.Optional[str] = None,
instance: typing.Optional[str] = None,
tags_resource: typing.Optional[google.cloud.compute_v1.types.compute.Tags] = None,
retry: typing.Union[
google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, str]] = ()
) -> google.cloud.compute_v1.types.compute.Operation
Sets network tags for the specified instance to the data included in the request.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import compute_v1
def sample_set_tags():
# Create a client
client = compute_v1.InstancesClient()
# Initialize request argument(s)
request = compute_v1.SetTagsInstanceRequest(
instance="instance_value",
project="project_value",
zone="zone_value",
)
# Make the request
response = client.set_tags(request=request)
# Handle the response
print(response)
Parameters | |
---|---|
Name | Description |
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 |
zone |
str
The name of the zone for this request. This corresponds to the |
instance |
str
Name of the instance scoping this request. This corresponds to the |
tags_resource |
google.cloud.compute_v1.types.Tags
The body resource for this request This corresponds to the |
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 | |
---|---|
Type | Description |
google.api_core.extended_operation.ExtendedOperation | An object representing a extended long-running operation. |
simulate_maintenance_event
simulate_maintenance_event(
request: typing.Optional[
typing.Union[
google.cloud.compute_v1.types.compute.SimulateMaintenanceEventInstanceRequest,
dict,
]
] = None,
*,
project: typing.Optional[str] = None,
zone: typing.Optional[str] = None,
instance: typing.Optional[str] = None,
retry: typing.Union[
google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, str]] = ()
) -> google.api_core.extended_operation.ExtendedOperation
Simulates a host maintenance event on a VM. For more information, see Simulate a host maintenance event.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import compute_v1
def sample_simulate_maintenance_event():
# Create a client
client = compute_v1.InstancesClient()
# Initialize request argument(s)
request = compute_v1.SimulateMaintenanceEventInstanceRequest(
instance="instance_value",
project="project_value",
zone="zone_value",
)
# Make the request
response = client.simulate_maintenance_event(request=request)
# Handle the response
print(response)
Parameters | |
---|---|
Name | Description |
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 |
zone |
str
The name of the zone for this request. This corresponds to the |
instance |
str
Name of the instance scoping this request. This corresponds to the |
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 | |
---|---|
Type | Description |
google.api_core.extended_operation.ExtendedOperation | An object representing a extended long-running operation. |
simulate_maintenance_event_unary
simulate_maintenance_event_unary(
request: typing.Optional[
typing.Union[
google.cloud.compute_v1.types.compute.SimulateMaintenanceEventInstanceRequest,
dict,
]
] = None,
*,
project: typing.Optional[str] = None,
zone: typing.Optional[str] = None,
instance: typing.Optional[str] = None,
retry: typing.Union[
google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, str]] = ()
) -> google.cloud.compute_v1.types.compute.Operation
Simulates a host maintenance event on a VM. For more information, see Simulate a host maintenance event.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import compute_v1
def sample_simulate_maintenance_event():
# Create a client
client = compute_v1.InstancesClient()
# Initialize request argument(s)
request = compute_v1.SimulateMaintenanceEventInstanceRequest(
instance="instance_value",
project="project_value",
zone="zone_value",
)
# Make the request
response = client.simulate_maintenance_event(request=request)
# Handle the response
print(response)
Parameters | |
---|---|
Name | Description |
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 |
zone |
str
The name of the zone for this request. This corresponds to the |
instance |
str
Name of the instance scoping this request. This corresponds to the |
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 | |
---|---|
Type | Description |
google.api_core.extended_operation.ExtendedOperation | An object representing a extended long-running operation. |
start
start(
request: typing.Optional[
typing.Union[google.cloud.compute_v1.types.compute.StartInstanceRequest, dict]
] = None,
*,
project: typing.Optional[str] = None,
zone: typing.Optional[str] = None,
instance: typing.Optional[str] = None,
retry: typing.Union[
google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, str]] = ()
) -> google.api_core.extended_operation.ExtendedOperation
Starts an instance that was stopped using the instances().stop method. For more information, see Restart an instance.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import compute_v1
def sample_start():
# Create a client
client = compute_v1.InstancesClient()
# Initialize request argument(s)
request = compute_v1.StartInstanceRequest(
instance="instance_value",
project="project_value",
zone="zone_value",
)
# Make the request
response = client.start(request=request)
# Handle the response
print(response)
Parameters | |
---|---|
Name | Description |
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 |
zone |
str
The name of the zone for this request. This corresponds to the |
instance |
str
Name of the instance resource to start. This corresponds to the |
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 | |
---|---|
Type | Description |
google.api_core.extended_operation.ExtendedOperation | An object representing a extended long-running operation. |
start_unary
start_unary(
request: typing.Optional[
typing.Union[google.cloud.compute_v1.types.compute.StartInstanceRequest, dict]
] = None,
*,
project: typing.Optional[str] = None,
zone: typing.Optional[str] = None,
instance: typing.Optional[str] = None,
retry: typing.Union[
google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, str]] = ()
) -> google.cloud.compute_v1.types.compute.Operation
Starts an instance that was stopped using the instances().stop method. For more information, see Restart an instance.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import compute_v1
def sample_start():
# Create a client
client = compute_v1.InstancesClient()
# Initialize request argument(s)
request = compute_v1.StartInstanceRequest(
instance="instance_value",
project="project_value",
zone="zone_value",
)
# Make the request
response = client.start(request=request)
# Handle the response
print(response)
Parameters | |
---|---|
Name | Description |
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 |
zone |
str
The name of the zone for this request. This corresponds to the |
instance |
str
Name of the instance resource to start. This corresponds to the |
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 | |
---|---|
Type | Description |
google.api_core.extended_operation.ExtendedOperation | An object representing a extended long-running operation. |
start_with_encryption_key
start_with_encryption_key(
request: typing.Optional[
typing.Union[
google.cloud.compute_v1.types.compute.StartWithEncryptionKeyInstanceRequest,
dict,
]
] = None,
*,
project: typing.Optional[str] = None,
zone: typing.Optional[str] = None,
instance: typing.Optional[str] = None,
instances_start_with_encryption_key_request_resource: typing.Optional[
google.cloud.compute_v1.types.compute.InstancesStartWithEncryptionKeyRequest
] = None,
retry: typing.Union[
google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, str]] = ()
) -> google.api_core.extended_operation.ExtendedOperation
Starts an instance that was stopped using the instances().stop method. For more information, see Restart an instance.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import compute_v1
def sample_start_with_encryption_key():
# Create a client
client = compute_v1.InstancesClient()
# Initialize request argument(s)
request = compute_v1.StartWithEncryptionKeyInstanceRequest(
instance="instance_value",
project="project_value",
zone="zone_value",
)
# Make the request
response = client.start_with_encryption_key(request=request)
# Handle the response
print(response)
Parameters | |
---|---|
Name | Description |
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 |
zone |
str
The name of the zone for this request. This corresponds to the |
instance |
str
Name of the instance resource to start. This corresponds to the |
instances_start_with_encryption_key_request_resource |
google.cloud.compute_v1.types.InstancesStartWithEncryptionKeyRequest
The body resource for this request This corresponds to the |
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 | |
---|---|
Type | Description |
google.api_core.extended_operation.ExtendedOperation | An object representing a extended long-running operation. |
start_with_encryption_key_unary
start_with_encryption_key_unary(
request: typing.Optional[
typing.Union[
google.cloud.compute_v1.types.compute.StartWithEncryptionKeyInstanceRequest,
dict,
]
] = None,
*,
project: typing.Optional[str] = None,
zone: typing.Optional[str] = None,
instance: typing.Optional[str] = None,
instances_start_with_encryption_key_request_resource: typing.Optional[
google.cloud.compute_v1.types.compute.InstancesStartWithEncryptionKeyRequest
] = None,
retry: typing.Union[
google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, str]] = ()
) -> google.cloud.compute_v1.types.compute.Operation
Starts an instance that was stopped using the instances().stop method. For more information, see Restart an instance.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import compute_v1
def sample_start_with_encryption_key():
# Create a client
client = compute_v1.InstancesClient()
# Initialize request argument(s)
request = compute_v1.StartWithEncryptionKeyInstanceRequest(
instance="instance_value",
project="project_value",
zone="zone_value",
)
# Make the request
response = client.start_with_encryption_key(request=request)
# Handle the response
print(response)
Parameters | |
---|---|
Name | Description |
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 |
zone |
str
The name of the zone for this request. This corresponds to the |
instance |
str
Name of the instance resource to start. This corresponds to the |
instances_start_with_encryption_key_request_resource |
google.cloud.compute_v1.types.InstancesStartWithEncryptionKeyRequest
The body resource for this request This corresponds to the |
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 | |
---|---|
Type | Description |
google.api_core.extended_operation.ExtendedOperation | An object representing a extended long-running operation. |
stop
stop(
request: typing.Optional[
typing.Union[google.cloud.compute_v1.types.compute.StopInstanceRequest, dict]
] = None,
*,
project: typing.Optional[str] = None,
zone: typing.Optional[str] = None,
instance: typing.Optional[str] = None,
retry: typing.Union[
google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, str]] = ()
) -> google.api_core.extended_operation.ExtendedOperation
Stops a running instance, shutting it down cleanly, and allows you to restart the instance at a later time. Stopped instances do not incur VM usage charges while they are stopped. However, resources that the VM is using, such as persistent disks and static IP addresses, will continue to be charged until they are deleted. For more information, see Stopping an instance.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import compute_v1
def sample_stop():
# Create a client
client = compute_v1.InstancesClient()
# Initialize request argument(s)
request = compute_v1.StopInstanceRequest(
instance="instance_value",
project="project_value",
zone="zone_value",
)
# Make the request
response = client.stop(request=request)
# Handle the response
print(response)
Parameters | |
---|---|
Name | Description |
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 |
zone |
str
The name of the zone for this request. This corresponds to the |
instance |
str
Name of the instance resource to stop. This corresponds to the |
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 | |
---|---|
Type | Description |
google.api_core.extended_operation.ExtendedOperation | An object representing a extended long-running operation. |
stop_unary
stop_unary(
request: typing.Optional[
typing.Union[google.cloud.compute_v1.types.compute.StopInstanceRequest, dict]
] = None,
*,
project: typing.Optional[str] = None,
zone: typing.Optional[str] = None,
instance: typing.Optional[str] = None,
retry: typing.Union[
google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, str]] = ()
) -> google.cloud.compute_v1.types.compute.Operation
Stops a running instance, shutting it down cleanly, and allows you to restart the instance at a later time. Stopped instances do not incur VM usage charges while they are stopped. However, resources that the VM is using, such as persistent disks and static IP addresses, will continue to be charged until they are deleted. For more information, see Stopping an instance.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import compute_v1
def sample_stop():
# Create a client
client = compute_v1.InstancesClient()
# Initialize request argument(s)
request = compute_v1.StopInstanceRequest(
instance="instance_value",
project="project_value",
zone="zone_value",
)
# Make the request
response = client.stop(request=request)
# Handle the response
print(response)
Parameters | |
---|---|
Name | Description |
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 |
zone |
str
The name of the zone for this request. This corresponds to the |
instance |
str
Name of the instance resource to stop. This corresponds to the |
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 | |
---|---|
Type | Description |
google.api_core.extended_operation.ExtendedOperation | An object representing a extended long-running operation. |
suspend
suspend(
request: typing.Optional[
typing.Union[google.cloud.compute_v1.types.compute.SuspendInstanceRequest, dict]
] = None,
*,
project: typing.Optional[str] = None,
zone: typing.Optional[str] = None,
instance: typing.Optional[str] = None,
retry: typing.Union[
google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, str]] = ()
) -> google.api_core.extended_operation.ExtendedOperation
This method suspends a running instance, saving its state to persistent storage, and allows you to resume the instance at a later time. Suspended instances have no compute costs (cores or RAM), and incur only storage charges for the saved VM memory and localSSD data. Any charged resources the virtual machine was using, such as persistent disks and static IP addresses, will continue to be charged while the instance is suspended. For more information, see Suspending and resuming an instance.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import compute_v1
def sample_suspend():
# Create a client
client = compute_v1.InstancesClient()
# Initialize request argument(s)
request = compute_v1.SuspendInstanceRequest(
instance="instance_value",
project="project_value",
zone="zone_value",
)
# Make the request
response = client.suspend(request=request)
# Handle the response
print(response)
Parameters | |
---|---|
Name | Description |
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 |
zone |
str
The name of the zone for this request. This corresponds to the |
instance |
str
Name of the instance resource to suspend. This corresponds to the |
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 | |
---|---|
Type | Description |
google.api_core.extended_operation.ExtendedOperation | An object representing a extended long-running operation. |
suspend_unary
suspend_unary(
request: typing.Optional[
typing.Union[google.cloud.compute_v1.types.compute.SuspendInstanceRequest, dict]
] = None,
*,
project: typing.Optional[str] = None,
zone: typing.Optional[str] = None,
instance: typing.Optional[str] = None,
retry: typing.Union[
google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, str]] = ()
) -> google.cloud.compute_v1.types.compute.Operation
This method suspends a running instance, saving its state to persistent storage, and allows you to resume the instance at a later time. Suspended instances have no compute costs (cores or RAM), and incur only storage charges for the saved VM memory and localSSD data. Any charged resources the virtual machine was using, such as persistent disks and static IP addresses, will continue to be charged while the instance is suspended. For more information, see Suspending and resuming an instance.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import compute_v1
def sample_suspend():
# Create a client
client = compute_v1.InstancesClient()
# Initialize request argument(s)
request = compute_v1.SuspendInstanceRequest(
instance="instance_value",
project="project_value",
zone="zone_value",
)
# Make the request
response = client.suspend(request=request)
# Handle the response
print(response)
Parameters | |
---|---|
Name | Description |
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 |
zone |
str
The name of the zone for this request. This corresponds to the |
instance |
str
Name of the instance resource to suspend. This corresponds to the |
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 | |
---|---|
Type | Description |
google.api_core.extended_operation.ExtendedOperation | An object representing a extended long-running operation. |
test_iam_permissions
test_iam_permissions(
request: typing.Optional[
typing.Union[
google.cloud.compute_v1.types.compute.TestIamPermissionsInstanceRequest,
dict,
]
] = None,
*,
project: typing.Optional[str] = None,
zone: typing.Optional[str] = None,
resource: typing.Optional[str] = None,
test_permissions_request_resource: typing.Optional[
google.cloud.compute_v1.types.compute.TestPermissionsRequest
] = None,
retry: typing.Union[
google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, str]] = ()
) -> google.cloud.compute_v1.types.compute.TestPermissionsResponse
Returns permissions that a caller has on the specified resource.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import compute_v1
def sample_test_iam_permissions():
# Create a client
client = compute_v1.InstancesClient()
# Initialize request argument(s)
request = compute_v1.TestIamPermissionsInstanceRequest(
project="project_value",
resource="resource_value",
zone="zone_value",
)
# Make the request
response = client.test_iam_permissions(request=request)
# Handle the response
print(response)
Parameters | |
---|---|
Name | Description |
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 |
zone |
str
The name of the zone for this request. This corresponds to the |
resource |
str
Name or id of the resource for this request. This corresponds to the |
test_permissions_request_resource |
google.cloud.compute_v1.types.TestPermissionsRequest
The body resource for this request This corresponds to the |
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
update(
request: typing.Optional[
typing.Union[google.cloud.compute_v1.types.compute.UpdateInstanceRequest, dict]
] = None,
*,
project: typing.Optional[str] = None,
zone: typing.Optional[str] = None,
instance: typing.Optional[str] = None,
instance_resource: typing.Optional[
google.cloud.compute_v1.types.compute.Instance
] = None,
retry: typing.Union[
google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, str]] = ()
) -> google.api_core.extended_operation.ExtendedOperation
Updates an instance only if the necessary resources are available. This method can update only a specific set of instance properties. See Updating a running instance for a list of updatable instance properties.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import compute_v1
def sample_update():
# Create a client
client = compute_v1.InstancesClient()
# Initialize request argument(s)
request = compute_v1.UpdateInstanceRequest(
instance="instance_value",
project="project_value",
zone="zone_value",
)
# Make the request
response = client.update(request=request)
# Handle the response
print(response)
Parameters | |
---|---|
Name | Description |
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 |
zone |
str
The name of the zone for this request. This corresponds to the |
instance |
str
Name of the instance resource to update. This corresponds to the |
instance_resource |
google.cloud.compute_v1.types.Instance
The body resource for this request This corresponds to the |
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 | |
---|---|
Type | Description |
google.api_core.extended_operation.ExtendedOperation | An object representing a extended long-running operation. |
update_access_config
update_access_config(
request: typing.Optional[
typing.Union[
google.cloud.compute_v1.types.compute.UpdateAccessConfigInstanceRequest,
dict,
]
] = None,
*,
project: typing.Optional[str] = None,
zone: typing.Optional[str] = None,
instance: typing.Optional[str] = None,
network_interface: typing.Optional[str] = None,
access_config_resource: typing.Optional[
google.cloud.compute_v1.types.compute.AccessConfig
] = None,
retry: typing.Union[
google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, str]] = ()
) -> google.api_core.extended_operation.ExtendedOperation
Updates the specified access config from an instance's network interface with the data included in the request. This method supports PATCH semantics and uses the JSON merge patch format and processing rules.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import compute_v1
def sample_update_access_config():
# Create a client
client = compute_v1.InstancesClient()
# Initialize request argument(s)
request = compute_v1.UpdateAccessConfigInstanceRequest(
instance="instance_value",
network_interface="network_interface_value",
project="project_value",
zone="zone_value",
)
# Make the request
response = client.update_access_config(request=request)
# Handle the response
print(response)
Parameters | |
---|---|
Name | Description |
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 |
zone |
str
The name of the zone for this request. This corresponds to the |
instance |
str
The instance name for this request. This corresponds to the |
network_interface |
str
The name of the network interface where the access config is attached. This corresponds to the |
access_config_resource |
google.cloud.compute_v1.types.AccessConfig
The body resource for this request This corresponds to the |
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 | |
---|---|
Type | Description |
google.api_core.extended_operation.ExtendedOperation | An object representing a extended long-running operation. |
update_access_config_unary
update_access_config_unary(
request: typing.Optional[
typing.Union[
google.cloud.compute_v1.types.compute.UpdateAccessConfigInstanceRequest,
dict,
]
] = None,
*,
project: typing.Optional[str] = None,
zone: typing.Optional[str] = None,
instance: typing.Optional[str] = None,
network_interface: typing.Optional[str] = None,
access_config_resource: typing.Optional[
google.cloud.compute_v1.types.compute.AccessConfig
] = None,
retry: typing.Union[
google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, str]] = ()
) -> google.cloud.compute_v1.types.compute.Operation
Updates the specified access config from an instance's network interface with the data included in the request. This method supports PATCH semantics and uses the JSON merge patch format and processing rules.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import compute_v1
def sample_update_access_config():
# Create a client
client = compute_v1.InstancesClient()
# Initialize request argument(s)
request = compute_v1.UpdateAccessConfigInstanceRequest(
instance="instance_value",
network_interface="network_interface_value",
project="project_value",
zone="zone_value",
)
# Make the request
response = client.update_access_config(request=request)
# Handle the response
print(response)
Parameters | |
---|---|
Name | Description |
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 |
zone |
str
The name of the zone for this request. This corresponds to the |
instance |
str
The instance name for this request. This corresponds to the |
network_interface |
str
The name of the network interface where the access config is attached. This corresponds to the |
access_config_resource |
google.cloud.compute_v1.types.AccessConfig
The body resource for this request This corresponds to the |
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 | |
---|---|
Type | Description |
google.api_core.extended_operation.ExtendedOperation | An object representing a extended long-running operation. |
update_display_device
update_display_device(
request: typing.Optional[
typing.Union[
google.cloud.compute_v1.types.compute.UpdateDisplayDeviceInstanceRequest,
dict,
]
] = None,
*,
project: typing.Optional[str] = None,
zone: typing.Optional[str] = None,
instance: typing.Optional[str] = None,
display_device_resource: typing.Optional[
google.cloud.compute_v1.types.compute.DisplayDevice
] = None,
retry: typing.Union[
google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, str]] = ()
) -> google.api_core.extended_operation.ExtendedOperation
Updates the Display config for a VM instance. You can only use this method on a stopped VM instance. This method supports PATCH semantics and uses the JSON merge patch format and processing rules.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import compute_v1
def sample_update_display_device():
# Create a client
client = compute_v1.InstancesClient()
# Initialize request argument(s)
request = compute_v1.UpdateDisplayDeviceInstanceRequest(
instance="instance_value",
project="project_value",
zone="zone_value",
)
# Make the request
response = client.update_display_device(request=request)
# Handle the response
print(response)
Parameters | |
---|---|
Name | Description |
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 |
zone |
str
The name of the zone for this request. This corresponds to the |
instance |
str
Name of the instance scoping this request. This corresponds to the |
display_device_resource |
google.cloud.compute_v1.types.DisplayDevice
The body resource for this request This corresponds to the |
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 | |
---|---|
Type | Description |
google.api_core.extended_operation.ExtendedOperation | An object representing a extended long-running operation. |
update_display_device_unary
update_display_device_unary(
request: typing.Optional[
typing.Union[
google.cloud.compute_v1.types.compute.UpdateDisplayDeviceInstanceRequest,
dict,
]
] = None,
*,
project: typing.Optional[str] = None,
zone: typing.Optional[str] = None,
instance: typing.Optional[str] = None,
display_device_resource: typing.Optional[
google.cloud.compute_v1.types.compute.DisplayDevice
] = None,
retry: typing.Union[
google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, str]] = ()
) -> google.cloud.compute_v1.types.compute.Operation
Updates the Display config for a VM instance. You can only use this method on a stopped VM instance. This method supports PATCH semantics and uses the JSON merge patch format and processing rules.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import compute_v1
def sample_update_display_device():
# Create a client
client = compute_v1.InstancesClient()
# Initialize request argument(s)
request = compute_v1.UpdateDisplayDeviceInstanceRequest(
instance="instance_value",
project="project_value",
zone="zone_value",
)
# Make the request
response = client.update_display_device(request=request)
# Handle the response
print(response)
Parameters | |
---|---|
Name | Description |
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 |
zone |
str
The name of the zone for this request. This corresponds to the |
instance |
str
Name of the instance scoping this request. This corresponds to the |
display_device_resource |
google.cloud.compute_v1.types.DisplayDevice
The body resource for this request This corresponds to the |
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 | |
---|---|
Type | Description |
google.api_core.extended_operation.ExtendedOperation | An object representing a extended long-running operation. |
update_network_interface
update_network_interface(
request: typing.Optional[
typing.Union[
google.cloud.compute_v1.types.compute.UpdateNetworkInterfaceInstanceRequest,
dict,
]
] = None,
*,
project: typing.Optional[str] = None,
zone: typing.Optional[str] = None,
instance: typing.Optional[str] = None,
network_interface: typing.Optional[str] = None,
network_interface_resource: typing.Optional[
google.cloud.compute_v1.types.compute.NetworkInterface
] = None,
retry: typing.Union[
google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, str]] = ()
) -> google.api_core.extended_operation.ExtendedOperation
Updates an instance's network interface. This method can only update an interface's alias IP range and attached network. See Modifying alias IP ranges for an existing instance for instructions on changing alias IP ranges. See Migrating a VM between networks for instructions on migrating an interface. This method follows PATCH semantics.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import compute_v1
def sample_update_network_interface():
# Create a client
client = compute_v1.InstancesClient()
# Initialize request argument(s)
request = compute_v1.UpdateNetworkInterfaceInstanceRequest(
instance="instance_value",
network_interface="network_interface_value",
project="project_value",
zone="zone_value",
)
# Make the request
response = client.update_network_interface(request=request)
# Handle the response
print(response)
Parameters | |
---|---|
Name | Description |
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 |
zone |
str
The name of the zone for this request. This corresponds to the |
instance |
str
The instance name for this request. This corresponds to the |
network_interface |
str
The name of the network interface to update. This corresponds to the |
network_interface_resource |
google.cloud.compute_v1.types.NetworkInterface
The body resource for this request This corresponds to the |
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 | |
---|---|
Type | Description |
google.api_core.extended_operation.ExtendedOperation | An object representing a extended long-running operation. |
update_network_interface_unary
update_network_interface_unary(
request: typing.Optional[
typing.Union[
google.cloud.compute_v1.types.compute.UpdateNetworkInterfaceInstanceRequest,
dict,
]
] = None,
*,
project: typing.Optional[str] = None,
zone: typing.Optional[str] = None,
instance: typing.Optional[str] = None,
network_interface: typing.Optional[str] = None,
network_interface_resource: typing.Optional[
google.cloud.compute_v1.types.compute.NetworkInterface
] = None,
retry: typing.Union[
google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, str]] = ()
) -> google.cloud.compute_v1.types.compute.Operation
Updates an instance's network interface. This method can only update an interface's alias IP range and attached network. See Modifying alias IP ranges for an existing instance for instructions on changing alias IP ranges. See Migrating a VM between networks for instructions on migrating an interface. This method follows PATCH semantics.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import compute_v1
def sample_update_network_interface():
# Create a client
client = compute_v1.InstancesClient()
# Initialize request argument(s)
request = compute_v1.UpdateNetworkInterfaceInstanceRequest(
instance="instance_value",
network_interface="network_interface_value",
project="project_value",
zone="zone_value",
)
# Make the request
response = client.update_network_interface(request=request)
# Handle the response
print(response)
Parameters | |
---|---|
Name | Description |
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 |
zone |
str
The name of the zone for this request. This corresponds to the |
instance |
str
The instance name for this request. This corresponds to the |
network_interface |
str
The name of the network interface to update. This corresponds to the |
network_interface_resource |
google.cloud.compute_v1.types.NetworkInterface
The body resource for this request This corresponds to the |
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 | |
---|---|
Type | Description |
google.api_core.extended_operation.ExtendedOperation | An object representing a extended long-running operation. |
update_shielded_instance_config
update_shielded_instance_config(
request: typing.Optional[
typing.Union[
google.cloud.compute_v1.types.compute.UpdateShieldedInstanceConfigInstanceRequest,
dict,
]
] = None,
*,
project: typing.Optional[str] = None,
zone: typing.Optional[str] = None,
instance: typing.Optional[str] = None,
shielded_instance_config_resource: typing.Optional[
google.cloud.compute_v1.types.compute.ShieldedInstanceConfig
] = None,
retry: typing.Union[
google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, str]] = ()
) -> google.api_core.extended_operation.ExtendedOperation
Updates the Shielded Instance config for an instance. You can only use this method on a stopped instance. This method supports PATCH semantics and uses the JSON merge patch format and processing rules.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import compute_v1
def sample_update_shielded_instance_config():
# Create a client
client = compute_v1.InstancesClient()
# Initialize request argument(s)
request = compute_v1.UpdateShieldedInstanceConfigInstanceRequest(
instance="instance_value",
project="project_value",
zone="zone_value",
)
# Make the request
response = client.update_shielded_instance_config(request=request)
# Handle the response
print(response)
Parameters | |
---|---|
Name | Description |
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 |
zone |
str
The name of the zone for this request. This corresponds to the |
instance |
str
Name or id of the instance scoping this request. This corresponds to the |
shielded_instance_config_resource |
google.cloud.compute_v1.types.ShieldedInstanceConfig
The body resource for this request This corresponds to the |
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 | |
---|---|
Type | Description |
google.api_core.extended_operation.ExtendedOperation | An object representing a extended long-running operation. |
update_shielded_instance_config_unary
update_shielded_instance_config_unary(
request: typing.Optional[
typing.Union[
google.cloud.compute_v1.types.compute.UpdateShieldedInstanceConfigInstanceRequest,
dict,
]
] = None,
*,
project: typing.Optional[str] = None,
zone: typing.Optional[str] = None,
instance: typing.Optional[str] = None,
shielded_instance_config_resource: typing.Optional[
google.cloud.compute_v1.types.compute.ShieldedInstanceConfig
] = None,
retry: typing.Union[
google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, str]] = ()
) -> google.cloud.compute_v1.types.compute.Operation
Updates the Shielded Instance config for an instance. You can only use this method on a stopped instance. This method supports PATCH semantics and uses the JSON merge patch format and processing rules.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import compute_v1
def sample_update_shielded_instance_config():
# Create a client
client = compute_v1.InstancesClient()
# Initialize request argument(s)
request = compute_v1.UpdateShieldedInstanceConfigInstanceRequest(
instance="instance_value",
project="project_value",
zone="zone_value",
)
# Make the request
response = client.update_shielded_instance_config(request=request)
# Handle the response
print(response)
Parameters | |
---|---|
Name | Description |
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 |
zone |
str
The name of the zone for this request. This corresponds to the |
instance |
str
Name or id of the instance scoping this request. This corresponds to the |
shielded_instance_config_resource |
google.cloud.compute_v1.types.ShieldedInstanceConfig
The body resource for this request This corresponds to the |
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 | |
---|---|
Type | Description |
google.api_core.extended_operation.ExtendedOperation | An object representing a extended long-running operation. |
update_unary
update_unary(
request: typing.Optional[
typing.Union[google.cloud.compute_v1.types.compute.UpdateInstanceRequest, dict]
] = None,
*,
project: typing.Optional[str] = None,
zone: typing.Optional[str] = None,
instance: typing.Optional[str] = None,
instance_resource: typing.Optional[
google.cloud.compute_v1.types.compute.Instance
] = None,
retry: typing.Union[
google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, str]] = ()
) -> google.cloud.compute_v1.types.compute.Operation
Updates an instance only if the necessary resources are available. This method can update only a specific set of instance properties. See Updating a running instance for a list of updatable instance properties.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import compute_v1
def sample_update():
# Create a client
client = compute_v1.InstancesClient()
# Initialize request argument(s)
request = compute_v1.UpdateInstanceRequest(
instance="instance_value",
project="project_value",
zone="zone_value",
)
# Make the request
response = client.update(request=request)
# Handle the response
print(response)
Parameters | |
---|---|
Name | Description |
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 |
zone |
str
The name of the zone for this request. This corresponds to the |
instance |
str
Name of the instance resource to update. This corresponds to the |
instance_resource |
google.cloud.compute_v1.types.Instance
The body resource for this request This corresponds to the |
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 | |
---|---|
Type | Description |
google.api_core.extended_operation.ExtendedOperation | An object representing a extended long-running operation. |