- 3.51.0 (latest)
- 3.50.1
- 3.46.0
- 3.45.0
- 3.44.0
- 3.43.0
- 3.42.0
- 3.41.0
- 3.40.1
- 3.39.0
- 3.38.0
- 3.37.0
- 3.36.0
- 3.35.1
- 3.34.0
- 3.33.0
- 3.32.0
- 3.31.0
- 3.30.0
- 3.29.0
- 3.28.0
- 3.27.1
- 3.26.0
- 3.25.0
- 3.24.0
- 3.23.0
- 3.22.2
- 3.21.0
- 3.20.0
- 3.19.0
- 3.18.0
- 3.17.0
- 3.16.0
- 3.15.1
- 3.14.1
- 3.13.0
- 3.12.1
- 3.11.1
- 3.10.0
- 3.9.0
- 3.8.0
- 3.7.0
- 3.6.0
- 3.5.0
- 3.4.0
- 3.3.0
- 3.2.0
- 3.1.0
- 3.0.0
- 2.1.1
- 2.0.0
- 1.19.3
- 1.18.0
- 1.17.1
- 1.16.0
- 1.15.1
- 1.14.0
- 1.13.0
- 1.12.0
- 1.11.0
- 1.10.0
InstanceAdminAsyncClient(*, credentials: typing.Optional[google.auth.credentials.Credentials] = None, transport: typing.Optional[typing.Union[str, google.cloud.spanner_admin_instance_v1.services.instance_admin.transports.base.InstanceAdminTransport, typing.Callable[[...], google.cloud.spanner_admin_instance_v1.services.instance_admin.transports.base.InstanceAdminTransport]]] = 'grpc_asyncio', client_options: typing.Optional[google.api_core.client_options.ClientOptions] = None, client_info: google.api_core.gapic_v1.client_info.ClientInfo = <google.api_core.gapic_v1.client_info.ClientInfo object>)
Cloud Spanner Instance Admin API
The Cloud Spanner Instance Admin API can be used to create, delete, modify and list instances. Instances are dedicated Cloud Spanner serving and storage resources to be used by Cloud Spanner databases.
Each instance has a "configuration", which dictates where the serving resources for the Cloud Spanner instance are located (e.g., US-central, Europe). Configurations are created by Google based on resource availability.
Cloud Spanner billing is based on the instances that exist and their sizes. After an instance exists, there are no additional per-database or per-operation charges for use of the instance (though there may be additional network bandwidth charges). Instances offer isolation: problems with databases in one instance will not affect other instances. However, within an instance databases can affect each other. For example, if one database in an instance receives a lot of requests and consumes most of the instance resources, fewer resources are available for other databases in that instance, and their performance may suffer.
Properties
api_endpoint
Return the API endpoint used by the client instance.
Returns | |
---|---|
Type | Description |
str |
The API endpoint used by the client instance. |
transport
Returns the transport used by the client instance.
Returns | |
---|---|
Type | Description |
InstanceAdminTransport |
The transport used by the client instance. |
universe_domain
Return the universe domain used by the client instance.
Returns | |
---|---|
Type | Description |
str |
The universe domain used by the client instance. |
Methods
InstanceAdminAsyncClient
InstanceAdminAsyncClient(*, credentials: typing.Optional[google.auth.credentials.Credentials] = None, transport: typing.Optional[typing.Union[str, google.cloud.spanner_admin_instance_v1.services.instance_admin.transports.base.InstanceAdminTransport, typing.Callable[[...], google.cloud.spanner_admin_instance_v1.services.instance_admin.transports.base.InstanceAdminTransport]]] = 'grpc_asyncio', client_options: typing.Optional[google.api_core.client_options.ClientOptions] = None, client_info: google.api_core.gapic_v1.client_info.ClientInfo = <google.api_core.gapic_v1.client_info.ClientInfo object>)
Instantiates the instance admin async 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 |
Optional[Union[str,InstanceAdminTransport,Callable[..., InstanceAdminTransport]]]
The transport to use, or a Callable that constructs and returns a new transport to use. If a Callable is given, it will be called with the same set of initialization arguments as used in the InstanceAdminTransport constructor. If set to None, a transport is chosen automatically. |
client_options |
Optional[Union[google.api_core.client_options.ClientOptions, dict]]
Custom options for the client. 1. The |
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. |
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.
create_instance
create_instance(
request: typing.Optional[
typing.Union[
google.cloud.spanner_admin_instance_v1.types.spanner_instance_admin.CreateInstanceRequest,
dict,
]
] = None,
*,
parent: typing.Optional[str] = None,
instance_id: typing.Optional[str] = None,
instance: typing.Optional[
google.cloud.spanner_admin_instance_v1.types.spanner_instance_admin.Instance
] = None,
retry: typing.Optional[
typing.Union[
google.api_core.retry.retry_unary_async.AsyncRetry,
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.operation_async.AsyncOperation
Creates an instance and begins preparing it to begin serving.
The returned [long-running
operation][google.longrunning.Operation] can be used to track
the progress of preparing the new instance. The instance name is
assigned by the caller. If the named instance already exists,
CreateInstance
returns ALREADY_EXISTS
.
Immediately upon completion of this request:
- The instance is readable via the API, with all requested
attributes but no allocated resources. Its state is
CREATING
.
Until completion of the returned operation:
- Cancelling the operation renders the instance immediately unreadable via the API.
- The instance can be deleted.
- All other attempts to modify the instance are rejected.
Upon completion of the returned operation:
- Billing for all successfully-allocated resources begins (some types may have lower than the requested levels).
- Databases can be created in the instance.
- The instance's allocated resource levels are readable via the API.
- The instance's state becomes
READY
.
The returned [long-running
operation][google.longrunning.Operation] will have a name of the
format <instance_name>/operations/<operation_id>
and can be
used to track creation of the instance. The
metadata][google.longrunning.Operation.metadata]
field type is
CreateInstanceMetadata][google.spanner.admin.instance.v1.CreateInstanceMetadata]
.
The response][google.longrunning.Operation.response]
field type
is Instance][google.spanner.admin.instance.v1.Instance]
, if
successful.
# 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 spanner_admin_instance_v1
async def sample_create_instance():
# Create a client
client = spanner_admin_instance_v1.InstanceAdminAsyncClient()
# Initialize request argument(s)
instance = spanner_admin_instance_v1.Instance()
instance.name = "name_value"
instance.config = "config_value"
instance.display_name = "display_name_value"
request = spanner_admin_instance_v1.CreateInstanceRequest(
parent="parent_value",
instance_id="instance_id_value",
instance=instance,
)
# Make the request
operation = client.create_instance(request=request)
print("Waiting for operation to complete...")
response = (await operation).result()
# Handle the response
print(response)
Parameters | |
---|---|
Name | Description |
request |
Optional[Union[google.cloud.spanner_admin_instance_v1.types.CreateInstanceRequest, dict]]
The request object. The request for |
parent |
Required. The name of the project in which to create the instance. Values are of the form |
instance_id |
Required. The ID of the instance to create. Valid identifiers are of the form |
instance |
Instance
Required. The instance to create. The name may be omitted, but if specified must be |
retry |
google.api_core.retry_async.AsyncRetry
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.operation_async.AsyncOperation |
An object representing a long-running operation. The result type for the operation will be Instance An isolated set of Cloud Spanner resources on which databases can be hosted. |
create_instance_config
create_instance_config(
request: typing.Optional[
typing.Union[
google.cloud.spanner_admin_instance_v1.types.spanner_instance_admin.CreateInstanceConfigRequest,
dict,
]
] = None,
*,
parent: typing.Optional[str] = None,
instance_config: typing.Optional[
google.cloud.spanner_admin_instance_v1.types.spanner_instance_admin.InstanceConfig
] = None,
instance_config_id: typing.Optional[str] = None,
retry: typing.Optional[
typing.Union[
google.api_core.retry.retry_unary_async.AsyncRetry,
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.operation_async.AsyncOperation
Creates an instance configuration and begins preparing it to be
used. The returned [long-running
operation][google.longrunning.Operation] can be used to track
the progress of preparing the new instance configuration. The
instance configuration name is assigned by the caller. If the
named instance configuration already exists,
CreateInstanceConfig
returns ALREADY_EXISTS
.
Immediately after the request returns:
- The instance configuration is readable via the API, with all
requested attributes. The instance configuration's
reconciling][google.spanner.admin.instance.v1.InstanceConfig.reconciling]
field is set to true. Its state isCREATING
.
While the operation is pending:
- Cancelling the operation renders the instance configuration immediately unreadable via the API.
- Except for deleting the creating resource, all other attempts to modify the instance configuration are rejected.
Upon completion of the returned operation:
- Instances can be created using the instance configuration.
- The instance configuration's
reconciling][google.spanner.admin.instance.v1.InstanceConfig.reconciling]
field becomes false. Its state becomesREADY
.
The returned [long-running
operation][google.longrunning.Operation] will have a name of the
format <instance_config_name>/operations/<operation_id>
and
can be used to track creation of the instance configuration. The
metadata][google.longrunning.Operation.metadata]
field type is
CreateInstanceConfigMetadata][google.spanner.admin.instance.v1.CreateInstanceConfigMetadata]
.
The response][google.longrunning.Operation.response]
field type
is
InstanceConfig][google.spanner.admin.instance.v1.InstanceConfig]
,
if successful.
Authorization requires spanner.instanceConfigs.create
permission on the resource
parent][google.spanner.admin.instance.v1.CreateInstanceConfigRequest.parent]
.
# 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 spanner_admin_instance_v1
async def sample_create_instance_config():
# Create a client
client = spanner_admin_instance_v1.InstanceAdminAsyncClient()
# Initialize request argument(s)
request = spanner_admin_instance_v1.CreateInstanceConfigRequest(
parent="parent_value",
instance_config_id="instance_config_id_value",
)
# Make the request
operation = client.create_instance_config(request=request)
print("Waiting for operation to complete...")
response = (await operation).result()
# Handle the response
print(response)
Parameters | |
---|---|
Name | Description |
request |
Optional[Union[google.cloud.spanner_admin_instance_v1.types.CreateInstanceConfigRequest, dict]]
The request object. The request for |
parent |
Required. The name of the project in which to create the instance configuration. Values are of the form |
instance_config |
InstanceConfig
Required. The InstanceConfig proto of the configuration to create. instance_config.name must be |
instance_config_id |
Required. The ID of the instance configuration to create. Valid identifiers are of the form |
retry |
google.api_core.retry_async.AsyncRetry
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.operation_async.AsyncOperation |
An object representing a long-running operation. The result type for the operation will be InstanceConfig A possible configuration for a Cloud Spanner instance. Configurations define the geographic placement of nodes and their replication. |
create_instance_partition
create_instance_partition(
request: typing.Optional[
typing.Union[
google.cloud.spanner_admin_instance_v1.types.spanner_instance_admin.CreateInstancePartitionRequest,
dict,
]
] = None,
*,
parent: typing.Optional[str] = None,
instance_partition: typing.Optional[
google.cloud.spanner_admin_instance_v1.types.spanner_instance_admin.InstancePartition
] = None,
instance_partition_id: typing.Optional[str] = None,
retry: typing.Optional[
typing.Union[
google.api_core.retry.retry_unary_async.AsyncRetry,
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.operation_async.AsyncOperation
Creates an instance partition and begins preparing it to be
used. The returned [long-running
operation][google.longrunning.Operation] can be used to track
the progress of preparing the new instance partition. The
instance partition name is assigned by the caller. If the named
instance partition already exists, CreateInstancePartition
returns ALREADY_EXISTS
.
Immediately upon completion of this request:
- The instance partition is readable via the API, with all
requested attributes but no allocated resources. Its state is
CREATING
.
Until completion of the returned operation:
- Cancelling the operation renders the instance partition immediately unreadable via the API.
- The instance partition can be deleted.
- All other attempts to modify the instance partition are rejected.
Upon completion of the returned operation:
- Billing for all successfully-allocated resources begins (some types may have lower than the requested levels).
- Databases can start using this instance partition.
- The instance partition's allocated resource levels are readable via the API.
- The instance partition's state becomes
READY
.
The returned [long-running
operation][google.longrunning.Operation] will have a name of the
format <instance_partition_name>/operations/<operation_id>
and can be used to track creation of the instance partition. The
metadata][google.longrunning.Operation.metadata]
field type is
CreateInstancePartitionMetadata][google.spanner.admin.instance.v1.CreateInstancePartitionMetadata]
.
The response][google.longrunning.Operation.response]
field type
is
InstancePartition][google.spanner.admin.instance.v1.InstancePartition]
,
if successful.
# 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 spanner_admin_instance_v1
async def sample_create_instance_partition():
# Create a client
client = spanner_admin_instance_v1.InstanceAdminAsyncClient()
# Initialize request argument(s)
instance_partition = spanner_admin_instance_v1.InstancePartition()
instance_partition.node_count = 1070
instance_partition.name = "name_value"
instance_partition.config = "config_value"
instance_partition.display_name = "display_name_value"
request = spanner_admin_instance_v1.CreateInstancePartitionRequest(
parent="parent_value",
instance_partition_id="instance_partition_id_value",
instance_partition=instance_partition,
)
# Make the request
operation = client.create_instance_partition(request=request)
print("Waiting for operation to complete...")
response = (await operation).result()
# Handle the response
print(response)
Parameters | |
---|---|
Name | Description |
request |
Optional[Union[google.cloud.spanner_admin_instance_v1.types.CreateInstancePartitionRequest, dict]]
The request object. The request for |
parent |
Required. The name of the instance in which to create the instance partition. Values are of the form |
instance_partition |
InstancePartition
Required. The instance partition to create. The instance_partition.name may be omitted, but if specified must be |
instance_partition_id |
Required. The ID of the instance partition to create. Valid identifiers are of the form |
retry |
google.api_core.retry_async.AsyncRetry
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.operation_async.AsyncOperation |
An object representing a long-running operation. The result type for the operation will be InstancePartition An isolated set of Cloud Spanner resources that databases can define placements on. |
delete_instance
delete_instance(
request: typing.Optional[
typing.Union[
google.cloud.spanner_admin_instance_v1.types.spanner_instance_admin.DeleteInstanceRequest,
dict,
]
] = None,
*,
name: typing.Optional[str] = None,
retry: typing.Optional[
typing.Union[
google.api_core.retry.retry_unary_async.AsyncRetry,
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]] = ()
) -> None
Deletes an instance.
Immediately upon completion of the request:
- Billing ceases for all of the instance's reserved resources.
Soon afterward:
- The instance and all of its databases immediately and irrevocably disappear from the API. All data in the databases is permanently deleted.
# 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 spanner_admin_instance_v1
async def sample_delete_instance():
# Create a client
client = spanner_admin_instance_v1.InstanceAdminAsyncClient()
# Initialize request argument(s)
request = spanner_admin_instance_v1.DeleteInstanceRequest(
name="name_value",
)
# Make the request
await client.delete_instance(request=request)
Parameters | |
---|---|
Name | Description |
request |
Optional[Union[google.cloud.spanner_admin_instance_v1.types.DeleteInstanceRequest, dict]]
The request object. The request for |
name |
Required. The name of the instance to be deleted. Values are of the form |
retry |
google.api_core.retry_async.AsyncRetry
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. |
delete_instance_config
delete_instance_config(
request: typing.Optional[
typing.Union[
google.cloud.spanner_admin_instance_v1.types.spanner_instance_admin.DeleteInstanceConfigRequest,
dict,
]
] = None,
*,
name: typing.Optional[str] = None,
retry: typing.Optional[
typing.Union[
google.api_core.retry.retry_unary_async.AsyncRetry,
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]] = ()
) -> None
Deletes the instance configuration. Deletion is only allowed
when no instances are using the configuration. If any instances
are using the configuration, returns FAILED_PRECONDITION
.
Only user-managed configurations can be deleted.
Authorization requires spanner.instanceConfigs.delete
permission on the resource
name][google.spanner.admin.instance.v1.InstanceConfig.name]
.
# 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 spanner_admin_instance_v1
async def sample_delete_instance_config():
# Create a client
client = spanner_admin_instance_v1.InstanceAdminAsyncClient()
# Initialize request argument(s)
request = spanner_admin_instance_v1.DeleteInstanceConfigRequest(
name="name_value",
)
# Make the request
await client.delete_instance_config(request=request)
Parameters | |
---|---|
Name | Description |
request |
Optional[Union[google.cloud.spanner_admin_instance_v1.types.DeleteInstanceConfigRequest, dict]]
The request object. The request for |
name |
Required. The name of the instance configuration to be deleted. Values are of the form |
retry |
google.api_core.retry_async.AsyncRetry
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. |
delete_instance_partition
delete_instance_partition(
request: typing.Optional[
typing.Union[
google.cloud.spanner_admin_instance_v1.types.spanner_instance_admin.DeleteInstancePartitionRequest,
dict,
]
] = None,
*,
name: typing.Optional[str] = None,
retry: typing.Optional[
typing.Union[
google.api_core.retry.retry_unary_async.AsyncRetry,
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]] = ()
) -> None
Deletes an existing instance partition. Requires that the instance partition is not used by any database or backup and is not the default instance partition of an instance.
Authorization requires spanner.instancePartitions.delete
permission on the resource
name][google.spanner.admin.instance.v1.InstancePartition.name]
.
# 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 spanner_admin_instance_v1
async def sample_delete_instance_partition():
# Create a client
client = spanner_admin_instance_v1.InstanceAdminAsyncClient()
# Initialize request argument(s)
request = spanner_admin_instance_v1.DeleteInstancePartitionRequest(
name="name_value",
)
# Make the request
await client.delete_instance_partition(request=request)
Parameters | |
---|---|
Name | Description |
request |
Optional[Union[google.cloud.spanner_admin_instance_v1.types.DeleteInstancePartitionRequest, dict]]
The request object. The request for |
name |
Required. The name of the instance partition to be deleted. Values are of the form |
retry |
google.api_core.retry_async.AsyncRetry
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. |
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 |
InstanceAdminAsyncClient |
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 |
InstanceAdminAsyncClient |
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 |
InstanceAdminAsyncClient |
The constructed client. |
get_iam_policy
get_iam_policy(
request: typing.Optional[
typing.Union[google.iam.v1.iam_policy_pb2.GetIamPolicyRequest, dict]
] = None,
*,
resource: typing.Optional[str] = None,
retry: typing.Optional[
typing.Union[
google.api_core.retry.retry_unary_async.AsyncRetry,
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.iam.v1.policy_pb2.Policy
Gets the access control policy for an instance resource. Returns an empty policy if an instance exists but does not have a policy set.
Authorization requires spanner.instances.getIamPolicy
on
resource][google.iam.v1.GetIamPolicyRequest.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 spanner_admin_instance_v1
from google.iam.v1 import iam_policy_pb2 # type: ignore
async def sample_get_iam_policy():
# Create a client
client = spanner_admin_instance_v1.InstanceAdminAsyncClient()
# Initialize request argument(s)
request = iam_policy_pb2.GetIamPolicyRequest(
resource="resource_value",
)
# Make the request
response = await client.get_iam_policy(request=request)
# Handle the response
print(response)
Parameters | |
---|---|
Name | Description |
request |
Optional[Union[google.iam.v1.iam_policy_pb2.GetIamPolicyRequest, dict]]
The request object. Request message for |
resource |
REQUIRED: The resource for which the policy is being requested. See the operation documentation for the appropriate value for this field. This corresponds to the |
retry |
google.api_core.retry_async.AsyncRetry
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.iam.v1.policy_pb2.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:** :literal:\ { "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:** :literal:\ 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:">\ \ For a description of IAM and its features, see the [IAM documentation](\ https://cloud.google.com/iam/docs/). |
get_instance
get_instance(
request: typing.Optional[
typing.Union[
google.cloud.spanner_admin_instance_v1.types.spanner_instance_admin.GetInstanceRequest,
dict,
]
] = None,
*,
name: typing.Optional[str] = None,
retry: typing.Optional[
typing.Union[
google.api_core.retry.retry_unary_async.AsyncRetry,
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.spanner_admin_instance_v1.types.spanner_instance_admin.Instance
Gets information about a particular 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 spanner_admin_instance_v1
async def sample_get_instance():
# Create a client
client = spanner_admin_instance_v1.InstanceAdminAsyncClient()
# Initialize request argument(s)
request = spanner_admin_instance_v1.GetInstanceRequest(
name="name_value",
)
# Make the request
response = await client.get_instance(request=request)
# Handle the response
print(response)
Parameters | |
---|---|
Name | Description |
request |
Optional[Union[google.cloud.spanner_admin_instance_v1.types.GetInstanceRequest, dict]]
The request object. The request for |
name |
Required. The name of the requested instance. Values are of the form |
retry |
google.api_core.retry_async.AsyncRetry
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.spanner_admin_instance_v1.types.Instance |
An isolated set of Cloud Spanner resources on which databases can be hosted. |
get_instance_config
get_instance_config(
request: typing.Optional[
typing.Union[
google.cloud.spanner_admin_instance_v1.types.spanner_instance_admin.GetInstanceConfigRequest,
dict,
]
] = None,
*,
name: typing.Optional[str] = None,
retry: typing.Optional[
typing.Union[
google.api_core.retry.retry_unary_async.AsyncRetry,
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.spanner_admin_instance_v1.types.spanner_instance_admin.InstanceConfig
Gets information about a particular instance configuration.
# 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 spanner_admin_instance_v1
async def sample_get_instance_config():
# Create a client
client = spanner_admin_instance_v1.InstanceAdminAsyncClient()
# Initialize request argument(s)
request = spanner_admin_instance_v1.GetInstanceConfigRequest(
name="name_value",
)
# Make the request
response = await client.get_instance_config(request=request)
# Handle the response
print(response)
Parameters | |
---|---|
Name | Description |
request |
Optional[Union[google.cloud.spanner_admin_instance_v1.types.GetInstanceConfigRequest, dict]]
The request object. The request for |
name |
Required. The name of the requested instance configuration. Values are of the form |
retry |
google.api_core.retry_async.AsyncRetry
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.spanner_admin_instance_v1.types.InstanceConfig |
A possible configuration for a Cloud Spanner instance. Configurations define the geographic placement of nodes and their replication. |
get_instance_partition
get_instance_partition(
request: typing.Optional[
typing.Union[
google.cloud.spanner_admin_instance_v1.types.spanner_instance_admin.GetInstancePartitionRequest,
dict,
]
] = None,
*,
name: typing.Optional[str] = None,
retry: typing.Optional[
typing.Union[
google.api_core.retry.retry_unary_async.AsyncRetry,
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.spanner_admin_instance_v1.types.spanner_instance_admin.InstancePartition
)
Gets information about a particular instance partition.
# 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 spanner_admin_instance_v1
async def sample_get_instance_partition():
# Create a client
client = spanner_admin_instance_v1.InstanceAdminAsyncClient()
# Initialize request argument(s)
request = spanner_admin_instance_v1.GetInstancePartitionRequest(
name="name_value",
)
# Make the request
response = await client.get_instance_partition(request=request)
# Handle the response
print(response)
Parameters | |
---|---|
Name | Description |
request |
Optional[Union[google.cloud.spanner_admin_instance_v1.types.GetInstancePartitionRequest, dict]]
The request object. The request for |
name |
Required. The name of the requested instance partition. Values are of the form |
retry |
google.api_core.retry_async.AsyncRetry
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.spanner_admin_instance_v1.types.InstancePartition |
An isolated set of Cloud Spanner resources that databases can define placements on. |
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_transport_class
get_transport_class(
label: typing.Optional[str] = None,
) -> typing.Type[
google.cloud.spanner_admin_instance_v1.services.instance_admin.transports.base.InstanceAdminTransport
]
Returns an appropriate transport class.
Parameter | |
---|---|
Name | Description |
label |
typing.Optional[str]
The name of the desired transport. If none is provided, then the first transport in the registry is used. |
instance_config_path
instance_config_path(project: str, instance_config: str) -> str
Returns a fully-qualified instance_config string.
instance_partition_path
instance_partition_path(
project: str, instance: str, instance_partition: str
) -> str
Returns a fully-qualified instance_partition string.
instance_path
instance_path(project: str, instance: str) -> str
Returns a fully-qualified instance string.
list_instance_config_operations
list_instance_config_operations(
request: typing.Optional[
typing.Union[
google.cloud.spanner_admin_instance_v1.types.spanner_instance_admin.ListInstanceConfigOperationsRequest,
dict,
]
] = None,
*,
parent: typing.Optional[str] = None,
retry: typing.Optional[
typing.Union[
google.api_core.retry.retry_unary_async.AsyncRetry,
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.spanner_admin_instance_v1.services.instance_admin.pagers.ListInstanceConfigOperationsAsyncPager
)
Lists the user-managed instance configuration [long-running
operations][google.longrunning.Operation] in the given project.
An instance configuration operation has a name of the form
projects/<project>/instanceConfigs/<instance_config>/operations/<operation>
.
The long-running operation
metadata][google.longrunning.Operation.metadata]
field type
metadata.type_url
describes the type of the metadata.
Operations returned include those that have
completed/failed/canceled within the last 7 days, and pending
operations. Operations returned are ordered by
operation.metadata.value.start_time
in descending order
starting from the most recently started operation.
# 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 spanner_admin_instance_v1
async def sample_list_instance_config_operations():
# Create a client
client = spanner_admin_instance_v1.InstanceAdminAsyncClient()
# Initialize request argument(s)
request = spanner_admin_instance_v1.ListInstanceConfigOperationsRequest(
parent="parent_value",
)
# Make the request
page_result = client.list_instance_config_operations(request=request)
# Handle the response
async for response in page_result:
print(response)
Parameters | |
---|---|
Name | Description |
request |
Optional[Union[google.cloud.spanner_admin_instance_v1.types.ListInstanceConfigOperationsRequest, dict]]
The request object. The request for |
parent |
Required. The project of the instance configuration operations. Values are of the form |
retry |
google.api_core.retry_async.AsyncRetry
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.spanner_admin_instance_v1.services.instance_admin.pagers.ListInstanceConfigOperationsAsyncPager |
The response for ListInstanceConfigOperations][google.spanner.admin.instance.v1.InstanceAdmin.ListInstanceConfigOperations] . Iterating over this object will yield results and resolve additional pages automatically. |
list_instance_configs
list_instance_configs(
request: typing.Optional[
typing.Union[
google.cloud.spanner_admin_instance_v1.types.spanner_instance_admin.ListInstanceConfigsRequest,
dict,
]
] = None,
*,
parent: typing.Optional[str] = None,
retry: typing.Optional[
typing.Union[
google.api_core.retry.retry_unary_async.AsyncRetry,
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.spanner_admin_instance_v1.services.instance_admin.pagers.ListInstanceConfigsAsyncPager
)
Lists the supported instance configurations for a given project.
# 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 spanner_admin_instance_v1
async def sample_list_instance_configs():
# Create a client
client = spanner_admin_instance_v1.InstanceAdminAsyncClient()
# Initialize request argument(s)
request = spanner_admin_instance_v1.ListInstanceConfigsRequest(
parent="parent_value",
)
# Make the request
page_result = client.list_instance_configs(request=request)
# Handle the response
async for response in page_result:
print(response)
Parameters | |
---|---|
Name | Description |
request |
Optional[Union[google.cloud.spanner_admin_instance_v1.types.ListInstanceConfigsRequest, dict]]
The request object. The request for |
parent |
Required. The name of the project for which a list of supported instance configurations is requested. Values are of the form |
retry |
google.api_core.retry_async.AsyncRetry
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.spanner_admin_instance_v1.services.instance_admin.pagers.ListInstanceConfigsAsyncPager |
The response for ListInstanceConfigs][google.spanner.admin.instance.v1.InstanceAdmin.ListInstanceConfigs] . Iterating over this object will yield results and resolve additional pages automatically. |
list_instance_partition_operations
list_instance_partition_operations(
request: typing.Optional[
typing.Union[
google.cloud.spanner_admin_instance_v1.types.spanner_instance_admin.ListInstancePartitionOperationsRequest,
dict,
]
] = None,
*,
parent: typing.Optional[str] = None,
retry: typing.Optional[
typing.Union[
google.api_core.retry.retry_unary_async.AsyncRetry,
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.spanner_admin_instance_v1.services.instance_admin.pagers.ListInstancePartitionOperationsAsyncPager
)
Lists instance partition [long-running
operations][google.longrunning.Operation] in the given instance.
An instance partition operation has a name of the form
projects/<project>/instances/<instance>/instancePartitions/<instance_partition>/operations/<operation>
.
The long-running operation
metadata][google.longrunning.Operation.metadata]
field type
metadata.type_url
describes the type of the metadata.
Operations returned include those that have
completed/failed/canceled within the last 7 days, and pending
operations. Operations returned are ordered by
operation.metadata.value.start_time
in descending order
starting from the most recently started operation.
Authorization requires
spanner.instancePartitionOperations.list
permission on the
resource
parent][google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest.parent]
.
# 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 spanner_admin_instance_v1
async def sample_list_instance_partition_operations():
# Create a client
client = spanner_admin_instance_v1.InstanceAdminAsyncClient()
# Initialize request argument(s)
request = spanner_admin_instance_v1.ListInstancePartitionOperationsRequest(
parent="parent_value",
)
# Make the request
page_result = client.list_instance_partition_operations(request=request)
# Handle the response
async for response in page_result:
print(response)
Parameters | |
---|---|
Name | Description |
request |
Optional[Union[google.cloud.spanner_admin_instance_v1.types.ListInstancePartitionOperationsRequest, dict]]
The request object. The request for |
parent |
Required. The parent instance of the instance partition operations. Values are of the form |
retry |
google.api_core.retry_async.AsyncRetry
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.spanner_admin_instance_v1.services.instance_admin.pagers.ListInstancePartitionOperationsAsyncPager |
The response for ListInstancePartitionOperations][google.spanner.admin.instance.v1.InstanceAdmin.ListInstancePartitionOperations] . Iterating over this object will yield results and resolve additional pages automatically. |
list_instance_partitions
list_instance_partitions(
request: typing.Optional[
typing.Union[
google.cloud.spanner_admin_instance_v1.types.spanner_instance_admin.ListInstancePartitionsRequest,
dict,
]
] = None,
*,
parent: typing.Optional[str] = None,
retry: typing.Optional[
typing.Union[
google.api_core.retry.retry_unary_async.AsyncRetry,
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.spanner_admin_instance_v1.services.instance_admin.pagers.ListInstancePartitionsAsyncPager
)
Lists all instance partitions for the given 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 spanner_admin_instance_v1
async def sample_list_instance_partitions():
# Create a client
client = spanner_admin_instance_v1.InstanceAdminAsyncClient()
# Initialize request argument(s)
request = spanner_admin_instance_v1.ListInstancePartitionsRequest(
parent="parent_value",
)
# Make the request
page_result = client.list_instance_partitions(request=request)
# Handle the response
async for response in page_result:
print(response)
Parameters | |
---|---|
Name | Description |
request |
Optional[Union[google.cloud.spanner_admin_instance_v1.types.ListInstancePartitionsRequest, dict]]
The request object. The request for |
parent |
Required. The instance whose instance partitions should be listed. Values are of the form |
retry |
google.api_core.retry_async.AsyncRetry
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.spanner_admin_instance_v1.services.instance_admin.pagers.ListInstancePartitionsAsyncPager |
The response for ListInstancePartitions][google.spanner.admin.instance.v1.InstanceAdmin.ListInstancePartitions] . Iterating over this object will yield results and resolve additional pages automatically. |
list_instances
list_instances(
request: typing.Optional[
typing.Union[
google.cloud.spanner_admin_instance_v1.types.spanner_instance_admin.ListInstancesRequest,
dict,
]
] = None,
*,
parent: typing.Optional[str] = None,
retry: typing.Optional[
typing.Union[
google.api_core.retry.retry_unary_async.AsyncRetry,
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.spanner_admin_instance_v1.services.instance_admin.pagers.ListInstancesAsyncPager
)
Lists all instances in the given project.
# 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 spanner_admin_instance_v1
async def sample_list_instances():
# Create a client
client = spanner_admin_instance_v1.InstanceAdminAsyncClient()
# Initialize request argument(s)
request = spanner_admin_instance_v1.ListInstancesRequest(
parent="parent_value",
)
# Make the request
page_result = client.list_instances(request=request)
# Handle the response
async for response in page_result:
print(response)
Parameters | |
---|---|
Name | Description |
request |
Optional[Union[google.cloud.spanner_admin_instance_v1.types.ListInstancesRequest, dict]]
The request object. The request for |
parent |
Required. The name of the project for which a list of instances is requested. Values are of the form |
retry |
google.api_core.retry_async.AsyncRetry
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.spanner_admin_instance_v1.services.instance_admin.pagers.ListInstancesAsyncPager |
The response for ListInstances][google.spanner.admin.instance.v1.InstanceAdmin.ListInstances] . Iterating over this object will yield results and resolve additional pages automatically. |
move_instance
move_instance(
request: typing.Optional[
typing.Union[
google.cloud.spanner_admin_instance_v1.types.spanner_instance_admin.MoveInstanceRequest,
dict,
]
] = None,
*,
retry: typing.Optional[
typing.Union[
google.api_core.retry.retry_unary_async.AsyncRetry,
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.operation_async.AsyncOperation
Moves an instance to the target instance configuration. You can use the returned [long-running operation][google.longrunning.Operation] to track the progress of moving the instance.
MoveInstance
returns FAILED_PRECONDITION
if the instance
meets any of the following criteria:
- Is undergoing a move to a different instance configuration
- Has backups
- Has an ongoing update
- Contains any CMEK-enabled databases
- Is a free trial instance
While the operation is pending:
All other attempts to modify the instance, including changes to its compute capacity, are rejected.
The following database and backup admin operations are rejected:
DatabaseAdmin.CreateDatabase
DatabaseAdmin.UpdateDatabaseDdl
(disabled if default_leader is specified in the request.)DatabaseAdmin.RestoreDatabase
DatabaseAdmin.CreateBackup
DatabaseAdmin.CopyBackup
Both the source and target instance configurations are subject to hourly compute and storage charges.
The instance might experience higher read-write latencies and a higher transaction abort rate. However, moving an instance doesn't cause any downtime.
The returned [long-running
operation][google.longrunning.Operation] has a name of the
format <instance_name>/operations/<operation_id>
and can be
used to track the move instance operation. The
metadata][google.longrunning.Operation.metadata]
field type is
MoveInstanceMetadata][google.spanner.admin.instance.v1.MoveInstanceMetadata]
.
The response][google.longrunning.Operation.response]
field type
is Instance][google.spanner.admin.instance.v1.Instance]
, if
successful. Cancelling the operation sets its metadata's
cancel_time][google.spanner.admin.instance.v1.MoveInstanceMetadata.cancel_time]
.
Cancellation is not immediate because it involves moving any
data previously moved to the target instance configuration back
to the original instance configuration. You can use this
operation to track the progress of the cancellation. Upon
successful completion of the cancellation, the operation
terminates with CANCELLED
status.
If not cancelled, upon completion of the returned operation:
- The instance successfully moves to the target instance configuration.
- You are billed for compute and storage in target instance configuration.
Authorization requires the spanner.instances.update
permission on the resource
instance][google.spanner.admin.instance.v1.Instance]
.
For more details, see Move an
instance <https://cloud.google.com/spanner/docs/move-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 spanner_admin_instance_v1
async def sample_move_instance():
# Create a client
client = spanner_admin_instance_v1.InstanceAdminAsyncClient()
# Initialize request argument(s)
request = spanner_admin_instance_v1.MoveInstanceRequest(
name="name_value",
target_config="target_config_value",
)
# Make the request
operation = client.move_instance(request=request)
print("Waiting for operation to complete...")
response = (await operation).result()
# Handle the response
print(response)
Parameters | |
---|---|
Name | Description |
request |
Optional[Union[google.cloud.spanner_admin_instance_v1.types.MoveInstanceRequest, dict]]
The request object. The request for |
retry |
google.api_core.retry_async.AsyncRetry
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.operation_async.AsyncOperation |
An object representing a long-running operation. The result type for the operation will be MoveInstanceResponse The response for MoveInstance][google.spanner.admin.instance.v1.InstanceAdmin.MoveInstance] . |
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.
parse_instance_config_path
parse_instance_config_path(path: str) -> typing.Dict[str, str]
Parses a instance_config path into its component segments.
parse_instance_partition_path
parse_instance_partition_path(path: str) -> typing.Dict[str, str]
Parses a instance_partition path into its component segments.
parse_instance_path
parse_instance_path(path: str) -> typing.Dict[str, str]
Parses a instance path into its component segments.
set_iam_policy
set_iam_policy(
request: typing.Optional[
typing.Union[google.iam.v1.iam_policy_pb2.SetIamPolicyRequest, dict]
] = None,
*,
resource: typing.Optional[str] = None,
retry: typing.Optional[
typing.Union[
google.api_core.retry.retry_unary_async.AsyncRetry,
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.iam.v1.policy_pb2.Policy
Sets the access control policy on an instance resource. Replaces any existing policy.
Authorization requires spanner.instances.setIamPolicy
on
resource][google.iam.v1.SetIamPolicyRequest.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 spanner_admin_instance_v1
from google.iam.v1 import iam_policy_pb2 # type: ignore
async def sample_set_iam_policy():
# Create a client
client = spanner_admin_instance_v1.InstanceAdminAsyncClient()
# Initialize request argument(s)
request = iam_policy_pb2.SetIamPolicyRequest(
resource="resource_value",
)
# Make the request
response = await client.set_iam_policy(request=request)
# Handle the response
print(response)
Parameters | |
---|---|
Name | Description |
request |
Optional[Union[google.iam.v1.iam_policy_pb2.SetIamPolicyRequest, dict]]
The request object. Request message for |
resource |
REQUIRED: The resource for which the policy is being specified. See the operation documentation for the appropriate value for this field. This corresponds to the |
retry |
google.api_core.retry_async.AsyncRetry
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.iam.v1.policy_pb2.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:** :literal:\ { "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:** :literal:\ 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:">\ \ For a description of IAM and its features, see the [IAM documentation](\ https://cloud.google.com/iam/docs/). |
test_iam_permissions
test_iam_permissions(
request: typing.Optional[
typing.Union[google.iam.v1.iam_policy_pb2.TestIamPermissionsRequest, dict]
] = None,
*,
resource: typing.Optional[str] = None,
permissions: typing.Optional[typing.MutableSequence[str]] = None,
retry: typing.Optional[
typing.Union[
google.api_core.retry.retry_unary_async.AsyncRetry,
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.iam.v1.iam_policy_pb2.TestIamPermissionsResponse
Returns permissions that the caller has on the specified instance resource.
Attempting this RPC on a non-existent Cloud Spanner instance
resource will result in a NOT_FOUND error if the user has
spanner.instances.list
permission on the containing Google
Cloud Project. Otherwise returns an empty set of permissions.
# 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 spanner_admin_instance_v1
from google.iam.v1 import iam_policy_pb2 # type: ignore
async def sample_test_iam_permissions():
# Create a client
client = spanner_admin_instance_v1.InstanceAdminAsyncClient()
# Initialize request argument(s)
request = iam_policy_pb2.TestIamPermissionsRequest(
resource="resource_value",
permissions=['permissions_value1', 'permissions_value2'],
)
# Make the request
response = await client.test_iam_permissions(request=request)
# Handle the response
print(response)
Parameters | |
---|---|
Name | Description |
request |
Optional[Union[google.iam.v1.iam_policy_pb2.TestIamPermissionsRequest, dict]]
The request object. Request message for |
resource |
REQUIRED: The resource for which the policy detail is being requested. See the operation documentation for the appropriate value for this field. This corresponds to the |
permissions |
:class:
The set of permissions to check for the |
retry |
google.api_core.retry_async.AsyncRetry
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.iam.v1.iam_policy_pb2.TestIamPermissionsResponse |
Response message for TestIamPermissions method. |
update_instance
update_instance(
request: typing.Optional[
typing.Union[
google.cloud.spanner_admin_instance_v1.types.spanner_instance_admin.UpdateInstanceRequest,
dict,
]
] = None,
*,
instance: typing.Optional[
google.cloud.spanner_admin_instance_v1.types.spanner_instance_admin.Instance
] = None,
field_mask: typing.Optional[google.protobuf.field_mask_pb2.FieldMask] = None,
retry: typing.Optional[
typing.Union[
google.api_core.retry.retry_unary_async.AsyncRetry,
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.operation_async.AsyncOperation
Updates an instance, and begins allocating or releasing
resources as requested. The returned [long-running
operation][google.longrunning.Operation] can be used to track
the progress of updating the instance. If the named instance
does not exist, returns NOT_FOUND
.
Immediately upon completion of this request:
- For resource types for which a decrease in the instance's allocation has been requested, billing is based on the newly-requested level.
Until completion of the returned operation:
- Cancelling the operation sets its metadata's
cancel_time][google.spanner.admin.instance.v1.UpdateInstanceMetadata.cancel_time]
, and begins restoring resources to their pre-request values. The operation is guaranteed to succeed at undoing all resource changes, after which point it terminates with aCANCELLED
status. - All other attempts to modify the instance are rejected.
- Reading the instance via the API continues to give the pre-request resource levels.
Upon completion of the returned operation:
- Billing begins for all successfully-allocated resources (some types may have lower than the requested levels).
- All newly-reserved resources are available for serving the instance's tables.
- The instance's new resource levels are readable via the API.
The returned [long-running
operation][google.longrunning.Operation] will have a name of the
format <instance_name>/operations/<operation_id>
and can be
used to track the instance modification. The
metadata][google.longrunning.Operation.metadata]
field type is
UpdateInstanceMetadata][google.spanner.admin.instance.v1.UpdateInstanceMetadata]
.
The response][google.longrunning.Operation.response]
field type
is Instance][google.spanner.admin.instance.v1.Instance]
, if
successful.
Authorization requires spanner.instances.update
permission
on the resource
name][google.spanner.admin.instance.v1.Instance.name]
.
# 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 spanner_admin_instance_v1
async def sample_update_instance():
# Create a client
client = spanner_admin_instance_v1.InstanceAdminAsyncClient()
# Initialize request argument(s)
instance = spanner_admin_instance_v1.Instance()
instance.name = "name_value"
instance.config = "config_value"
instance.display_name = "display_name_value"
request = spanner_admin_instance_v1.UpdateInstanceRequest(
instance=instance,
)
# Make the request
operation = client.update_instance(request=request)
print("Waiting for operation to complete...")
response = (await operation).result()
# Handle the response
print(response)
Parameters | |
---|---|
Name | Description |
request |
Optional[Union[google.cloud.spanner_admin_instance_v1.types.UpdateInstanceRequest, dict]]
The request object. The request for |
instance |
Instance
Required. The instance to update, which must always include the instance name. Otherwise, only fields mentioned in |
field_mask |
Required. A mask specifying which fields in |
retry |
google.api_core.retry_async.AsyncRetry
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.operation_async.AsyncOperation |
An object representing a long-running operation. The result type for the operation will be Instance An isolated set of Cloud Spanner resources on which databases can be hosted. |
update_instance_config
update_instance_config(
request: typing.Optional[
typing.Union[
google.cloud.spanner_admin_instance_v1.types.spanner_instance_admin.UpdateInstanceConfigRequest,
dict,
]
] = None,
*,
instance_config: typing.Optional[
google.cloud.spanner_admin_instance_v1.types.spanner_instance_admin.InstanceConfig
] = None,
update_mask: typing.Optional[google.protobuf.field_mask_pb2.FieldMask] = None,
retry: typing.Optional[
typing.Union[
google.api_core.retry.retry_unary_async.AsyncRetry,
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.operation_async.AsyncOperation
Updates an instance configuration. The returned [long-running
operation][google.longrunning.Operation] can be used to track
the progress of updating the instance. If the named instance
configuration does not exist, returns NOT_FOUND
.
Only user-managed configurations can be updated.
Immediately after the request returns:
- The instance configuration's
reconciling][google.spanner.admin.instance.v1.InstanceConfig.reconciling]
field is set to true.
While the operation is pending:
- Cancelling the operation sets its metadata's
cancel_time][google.spanner.admin.instance.v1.UpdateInstanceConfigMetadata.cancel_time]
. The operation is guaranteed to succeed at undoing all changes, after which point it terminates with aCANCELLED
status. - All other attempts to modify the instance configuration are rejected.
- Reading the instance configuration via the API continues to give the pre-request values.
Upon completion of the returned operation:
- Creating instances using the instance configuration uses the new values.
- The new values of the instance configuration are readable via the API.
- The instance configuration's
reconciling][google.spanner.admin.instance.v1.InstanceConfig.reconciling]
field becomes false.
The returned [long-running
operation][google.longrunning.Operation] will have a name of the
format <instance_config_name>/operations/<operation_id>
and
can be used to track the instance configuration modification.
The metadata][google.longrunning.Operation.metadata]
field type
is
UpdateInstanceConfigMetadata][google.spanner.admin.instance.v1.UpdateInstanceConfigMetadata]
.
The response][google.longrunning.Operation.response]
field type
is
InstanceConfig][google.spanner.admin.instance.v1.InstanceConfig]
,
if successful.
Authorization requires spanner.instanceConfigs.update
permission on the resource
name][google.spanner.admin.instance.v1.InstanceConfig.name]
.
# 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 spanner_admin_instance_v1
async def sample_update_instance_config():
# Create a client
client = spanner_admin_instance_v1.InstanceAdminAsyncClient()
# Initialize request argument(s)
request = spanner_admin_instance_v1.UpdateInstanceConfigRequest(
)
# Make the request
operation = client.update_instance_config(request=request)
print("Waiting for operation to complete...")
response = (await operation).result()
# Handle the response
print(response)
Parameters | |
---|---|
Name | Description |
request |
Optional[Union[google.cloud.spanner_admin_instance_v1.types.UpdateInstanceConfigRequest, dict]]
The request object. The request for |
instance_config |
InstanceConfig
Required. The user instance configuration to update, which must always include the instance configuration name. Otherwise, only fields mentioned in |
update_mask |
Required. A mask specifying which fields in |
retry |
google.api_core.retry_async.AsyncRetry
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.operation_async.AsyncOperation |
An object representing a long-running operation. The result type for the operation will be InstanceConfig A possible configuration for a Cloud Spanner instance. Configurations define the geographic placement of nodes and their replication. |
update_instance_partition
update_instance_partition(
request: typing.Optional[
typing.Union[
google.cloud.spanner_admin_instance_v1.types.spanner_instance_admin.UpdateInstancePartitionRequest,
dict,
]
] = None,
*,
instance_partition: typing.Optional[
google.cloud.spanner_admin_instance_v1.types.spanner_instance_admin.InstancePartition
] = None,
field_mask: typing.Optional[google.protobuf.field_mask_pb2.FieldMask] = None,
retry: typing.Optional[
typing.Union[
google.api_core.retry.retry_unary_async.AsyncRetry,
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.operation_async.AsyncOperation
Updates an instance partition, and begins allocating or
releasing resources as requested. The returned [long-running
operation][google.longrunning.Operation] can be used to track
the progress of updating the instance partition. If the named
instance partition does not exist, returns NOT_FOUND
.
Immediately upon completion of this request:
- For resource types for which a decrease in the instance partition's allocation has been requested, billing is based on the newly-requested level.
Until completion of the returned operation:
- Cancelling the operation sets its metadata's
cancel_time][google.spanner.admin.instance.v1.UpdateInstancePartitionMetadata.cancel_time]
, and begins restoring resources to their pre-request values. The operation is guaranteed to succeed at undoing all resource changes, after which point it terminates with aCANCELLED
status. - All other attempts to modify the instance partition are rejected.
- Reading the instance partition via the API continues to give the pre-request resource levels.
Upon completion of the returned operation:
- Billing begins for all successfully-allocated resources (some types may have lower than the requested levels).
- All newly-reserved resources are available for serving the instance partition's tables.
- The instance partition's new resource levels are readable via the API.
The returned [long-running
operation][google.longrunning.Operation] will have a name of the
format <instance_partition_name>/operations/<operation_id>
and can be used to track the instance partition modification.
The metadata][google.longrunning.Operation.metadata]
field type
is
UpdateInstancePartitionMetadata][google.spanner.admin.instance.v1.UpdateInstancePartitionMetadata]
.
The response][google.longrunning.Operation.response]
field type
is
InstancePartition][google.spanner.admin.instance.v1.InstancePartition]
,
if successful.
Authorization requires spanner.instancePartitions.update
permission on the resource
name][google.spanner.admin.instance.v1.InstancePartition.name]
.
# 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 spanner_admin_instance_v1
async def sample_update_instance_partition():
# Create a client
client = spanner_admin_instance_v1.InstanceAdminAsyncClient()
# Initialize request argument(s)
instance_partition = spanner_admin_instance_v1.InstancePartition()
instance_partition.node_count = 1070
instance_partition.name = "name_value"
instance_partition.config = "config_value"
instance_partition.display_name = "display_name_value"
request = spanner_admin_instance_v1.UpdateInstancePartitionRequest(
instance_partition=instance_partition,
)
# Make the request
operation = client.update_instance_partition(request=request)
print("Waiting for operation to complete...")
response = (await operation).result()
# Handle the response
print(response)
Parameters | |
---|---|
Name | Description |
request |
Optional[Union[google.cloud.spanner_admin_instance_v1.types.UpdateInstancePartitionRequest, dict]]
The request object. The request for |
instance_partition |
InstancePartition
Required. The instance partition to update, which must always include the instance partition name. Otherwise, only fields mentioned in |
field_mask |
Required. A mask specifying which fields in |
retry |
google.api_core.retry_async.AsyncRetry
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.operation_async.AsyncOperation |
An object representing a long-running operation. The result type for the operation will be InstancePartition An isolated set of Cloud Spanner resources that databases can define placements on. |