- 3.46.0 (latest)
- 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
DatabaseAdminAsyncClient(*, credentials: google.auth.credentials.Credentials = None, transport: Union[str, google.cloud.spanner_admin_database_v1.services.database_admin.transports.base.DatabaseAdminTransport] = 'grpc_asyncio', client_options: <module 'google.api_core.client_options' from '/workspace/python-spanner/.nox/docfx/lib/python3.9/site-packages/google/api_core/client_options.py'> = None, client_info: google.api_core.gapic_v1.client_info.ClientInfo = <google.api_core.gapic_v1.client_info.ClientInfo object>)
Cloud Spanner Database Admin API The Cloud Spanner Database Admin API can be used to create, drop, and list databases. It also enables updating the schema of pre-existing databases. It can be also used to create, delete and list backups for a database and to restore from an existing backup.
Properties
transport
Returns the transport used by the client instance.
Returns | |
---|---|
Type | Description |
DatabaseAdminTransport | The transport used by the client instance. |
Methods
DatabaseAdminAsyncClient
DatabaseAdminAsyncClient(*, credentials: google.auth.credentials.Credentials = None, transport: Union[str, google.cloud.spanner_admin_database_v1.services.database_admin.transports.base.DatabaseAdminTransport] = 'grpc_asyncio', client_options: <module 'google.api_core.client_options' from '/workspace/python-spanner/.nox/docfx/lib/python3.9/site-packages/google/api_core/client_options.py'> = None, client_info: google.api_core.gapic_v1.client_info.ClientInfo = <google.api_core.gapic_v1.client_info.ClientInfo object>)
Instantiates the database admin 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,
The transport to use. If set to None, a transport is chosen automatically. |
client_options |
ClientOptions
Custom options for the client. It won't take effect if a |
Exceptions | |
---|---|
Type | Description |
google.auth.exceptions.MutualTlsChannelError | If mutual TLS transport creation failed for any reason. |
backup_path
backup_path(project: str, instance: str, backup: str)
Returns a fully-qualified backup string.
common_billing_account_path
common_billing_account_path(billing_account: str)
Returns a fully-qualified billing_account string.
common_folder_path
common_folder_path(folder: str)
Returns a fully-qualified folder string.
common_location_path
common_location_path(project: str, location: str)
Returns a fully-qualified location string.
common_organization_path
common_organization_path(organization: str)
Returns a fully-qualified organization string.
common_project_path
common_project_path(project: str)
Returns a fully-qualified project string.
create_backup
create_backup(request: Optional[google.cloud.spanner_admin_database_v1.types.backup.CreateBackupRequest] = None, *, parent: Optional[str] = None, backup: Optional[google.cloud.spanner_admin_database_v1.types.backup.Backup] = None, backup_id: Optional[str] = None, retry: google.api_core.retry.Retry = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())
Starts creating a new Cloud Spanner Backup. The returned backup
long-running operation][google.longrunning.Operation]
will have
a name of the format
projects/<project>/instances/<instance>/backups/<backup>/operations/<operation_id>
and can be used to track creation of the backup. The
metadata][google.longrunning.Operation.metadata]
field type is
CreateBackupMetadata][google.spanner.admin.database.v1.CreateBackupMetadata]
.
The response][google.longrunning.Operation.response]
field type
is Backup][google.spanner.admin.database.v1.Backup]
, if
successful. Cancelling the returned operation will stop the
creation and delete the backup. There can be only one pending
backup creation per database. Backup creation of different
databases can run concurrently.
Parameters | |
---|---|
Name | Description |
request |
CreateBackupRequest
The request object. The request for |
parent |
Required. The name of the instance in which the backup will be created. This must be the same instance that contains the database the backup will be created from. The backup will be stored in the location(s) specified in the instance configuration of this instance. Values are of the form |
backup |
Backup
Required. The backup to create. This corresponds to the |
backup_id |
Required. The id of the backup to be created. 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.operation_async.AsyncOperation | An object representing a long-running operation. The result type for the operation will be Backup A backup of a Cloud Spanner database. |
create_database
create_database(request: Optional[google.cloud.spanner_admin_database_v1.types.spanner_database_admin.CreateDatabaseRequest] = None, *, parent: Optional[str] = None, create_statement: Optional[str] = None, retry: google.api_core.retry.Retry = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())
Creates a new Cloud Spanner database and starts to prepare it
for serving. The returned [long-running
operation][google.longrunning.Operation] will have a name of the
format <database_name>/operations/<operation_id>
and can be
used to track preparation of the database. The
metadata][google.longrunning.Operation.metadata]
field type is
CreateDatabaseMetadata][google.spanner.admin.database.v1.CreateDatabaseMetadata]
.
The response][google.longrunning.Operation.response]
field type
is Database][google.spanner.admin.database.v1.Database]
, if
successful.
Parameters | |
---|---|
Name | Description |
request |
CreateDatabaseRequest
The request object. The request for |
parent |
Required. The name of the instance that will serve the new database. Values are of the form |
create_statement |
Required. A
|
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.operation_async.AsyncOperation | An object representing a long-running operation. The result type for the operation will be Database A Cloud Spanner database. |
crypto_key_path
crypto_key_path(project: str, location: str, key_ring: str, crypto_key: str)
Returns a fully-qualified crypto_key string.
crypto_key_version_path
crypto_key_version_path(
project: str, location: str, key_ring: str, crypto_key: str, crypto_key_version: str
)
Returns a fully-qualified crypto_key_version string.
database_path
database_path(project: str, instance: str, database: str)
Returns a fully-qualified database string.
delete_backup
delete_backup(request: Optional[google.cloud.spanner_admin_database_v1.types.backup.DeleteBackupRequest] = None, *, name: Optional[str] = None, retry: google.api_core.retry.Retry = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())
Deletes a pending or completed
Backup][google.spanner.admin.database.v1.Backup]
.
Parameters | |
---|---|
Name | Description |
request |
DeleteBackupRequest
The request object. The request for |
name |
Required. Name of the backup to delete. Values are of the form |
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. |
drop_database
drop_database(request: Optional[google.cloud.spanner_admin_database_v1.types.spanner_database_admin.DropDatabaseRequest] = None, *, database: Optional[str] = None, retry: google.api_core.retry.Retry = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())
Drops (aka deletes) a Cloud Spanner database. Completed backups
for the database will be retained according to their
expire_time
.
Parameters | |
---|---|
Name | Description |
request |
DropDatabaseRequest
The request object. The request for |
database |
Required. The database to be dropped. 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. |
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 |
DatabaseAdminAsyncClient | 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 |
DatabaseAdminAsyncClient | 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 |
DatabaseAdminAsyncClient | The constructed client. |
get_backup
get_backup(request: Optional[google.cloud.spanner_admin_database_v1.types.backup.GetBackupRequest] = None, *, name: Optional[str] = None, retry: google.api_core.retry.Retry = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())
Gets metadata on a pending or completed
Backup][google.spanner.admin.database.v1.Backup]
.
Parameters | |
---|---|
Name | Description |
request |
GetBackupRequest
The request object. The request for |
name |
Required. Name of the backup. Values are of the form |
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.spanner_admin_database_v1.types.Backup | A backup of a Cloud Spanner database. |
get_database
get_database(request: Optional[google.cloud.spanner_admin_database_v1.types.spanner_database_admin.GetDatabaseRequest] = None, *, name: Optional[str] = None, retry: google.api_core.retry.Retry = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())
Gets the state of a Cloud Spanner database.
Parameters | |
---|---|
Name | Description |
request |
GetDatabaseRequest
The request object. The request for |
name |
Required. The name of the requested database. Values are of the form |
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.spanner_admin_database_v1.types.Database | A Cloud Spanner database. |
get_database_ddl
get_database_ddl(request: Optional[google.cloud.spanner_admin_database_v1.types.spanner_database_admin.GetDatabaseDdlRequest] = None, *, database: Optional[str] = None, retry: google.api_core.retry.Retry = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())
Returns the schema of a Cloud Spanner database as a list of
formatted DDL statements. This method does not show pending
schema updates, those may be queried using the
Operations][google.longrunning.Operations]
API.
Parameters | |
---|---|
Name | Description |
request |
GetDatabaseDdlRequest
The request object. The request for |
database |
Required. The database whose schema we wish to get. Values are of the form |
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.spanner_admin_database_v1.types.GetDatabaseDdlResponse | The response for GetDatabaseDdl][google.spanner.admin.database.v1.DatabaseAdmin.GetDatabaseDdl] . |
get_iam_policy
get_iam_policy(request: Optional[google.iam.v1.iam_policy_pb2.GetIamPolicyRequest] = None, *, resource: Optional[str] = None, retry: google.api_core.retry.Retry = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())
Gets the access control policy for a database or backup resource. Returns an empty policy if a database or backup exists but does not have a policy set.
Authorization requires spanner.databases.getIamPolicy
permission on
resource][google.iam.v1.GetIamPolicyRequest.resource]
. For
backups, authorization requires spanner.backups.getIamPolicy
permission on
resource][google.iam.v1.GetIamPolicyRequest.resource]
.
Parameters | |
---|---|
Name | Description |
request |
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.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.iam.v1.policy_pb2.Policy | Defines an Identity and Access Management (IAM) policy. It is used to specify access control policies for Cloud Platform resources. A Policy is a collection of bindings. A binding binds one or more members to a single role. Members can be user accounts, service accounts, Google groups, and domains (such as G Suite). A role is a named list of permissions (defined by IAM or configured by users). A binding can optionally specify a condition, which is a logic expression that further constrains the role binding based on attributes about the request and/or target resource. **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')",="" }="" }="" ]="" }="" **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')="" for="" a="" description="" of="" iam="" and="" its="" features,="" see="" the="" [iam="" developer's="" guide](\=""> |
get_transport_class
get_transport_class()
Returns an appropriate transport class.
instance_path
instance_path(project: str, instance: str)
Returns a fully-qualified instance string.
list_backup_operations
list_backup_operations(request: Optional[google.cloud.spanner_admin_database_v1.types.backup.ListBackupOperationsRequest] = None, *, parent: Optional[str] = None, retry: google.api_core.retry.Retry = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())
Lists the backup [long-running
operations][google.longrunning.Operation] in the given instance.
A backup operation has a name of the form
projects/<project>/instances/<instance>/backups/<backup>/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.progress.start_time
in descending
order starting from the most recently started operation.
Parameters | |
---|---|
Name | Description |
request |
ListBackupOperationsRequest
The request object. The request for |
parent |
Required. The instance of the backup operations. Values are of the form |
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.spanner_admin_database_v1.services.database_admin.pagers.ListBackupOperationsAsyncPager | The response for ListBackupOperations][google.spanner.admin.database.v1.DatabaseAdmin.ListBackupOperations] . Iterating over this object will yield results and resolve additional pages automatically. |
list_backups
list_backups(request: Optional[google.cloud.spanner_admin_database_v1.types.backup.ListBackupsRequest] = None, *, parent: Optional[str] = None, retry: google.api_core.retry.Retry = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())
Lists completed and pending backups. Backups returned are
ordered by create_time
in descending order, starting from
the most recent create_time
.
Parameters | |
---|---|
Name | Description |
request |
ListBackupsRequest
The request object. The request for |
parent |
Required. The instance to list backups from. Values are of the form |
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.spanner_admin_database_v1.services.database_admin.pagers.ListBackupsAsyncPager | The response for ListBackups][google.spanner.admin.database.v1.DatabaseAdmin.ListBackups] . Iterating over this object will yield results and resolve additional pages automatically. |
list_database_operations
list_database_operations(request: Optional[google.cloud.spanner_admin_database_v1.types.spanner_database_admin.ListDatabaseOperationsRequest] = None, *, parent: Optional[str] = None, retry: google.api_core.retry.Retry = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())
Lists database
longrunning-operations][google.longrunning.Operation]
. A
database operation has a name of the form
projects/<project>/instances/<instance>/databases/<database>/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.
Parameters | |
---|---|
Name | Description |
request |
ListDatabaseOperationsRequest
The request object. The request for |
parent |
Required. The instance of the database operations. Values are of the form |
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.spanner_admin_database_v1.services.database_admin.pagers.ListDatabaseOperationsAsyncPager | The response for ListDatabaseOperations][google.spanner.admin.database.v1.DatabaseAdmin.ListDatabaseOperations] . Iterating over this object will yield results and resolve additional pages automatically. |
list_databases
list_databases(request: Optional[google.cloud.spanner_admin_database_v1.types.spanner_database_admin.ListDatabasesRequest] = None, *, parent: Optional[str] = None, retry: google.api_core.retry.Retry = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())
Lists Cloud Spanner databases.
Parameters | |
---|---|
Name | Description |
request |
ListDatabasesRequest
The request object. The request for |
parent |
Required. The instance whose databases should be listed. Values are of the form |
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.spanner_admin_database_v1.services.database_admin.pagers.ListDatabasesAsyncPager | The response for ListDatabases][google.spanner.admin.database.v1.DatabaseAdmin.ListDatabases] . Iterating over this object will yield results and resolve additional pages automatically. |
parse_backup_path
parse_backup_path(path: str)
Parses a backup path into its component segments.
parse_common_billing_account_path
parse_common_billing_account_path(path: str)
Parse a billing_account path into its component segments.
parse_common_folder_path
parse_common_folder_path(path: str)
Parse a folder path into its component segments.
parse_common_location_path
parse_common_location_path(path: str)
Parse a location path into its component segments.
parse_common_organization_path
parse_common_organization_path(path: str)
Parse a organization path into its component segments.
parse_common_project_path
parse_common_project_path(path: str)
Parse a project path into its component segments.
parse_crypto_key_path
parse_crypto_key_path(path: str)
Parses a crypto_key path into its component segments.
parse_crypto_key_version_path
parse_crypto_key_version_path(path: str)
Parses a crypto_key_version path into its component segments.
parse_database_path
parse_database_path(path: str)
Parses a database path into its component segments.
parse_instance_path
parse_instance_path(path: str)
Parses a instance path into its component segments.
restore_database
restore_database(request: Optional[google.cloud.spanner_admin_database_v1.types.spanner_database_admin.RestoreDatabaseRequest] = None, *, parent: Optional[str] = None, database_id: Optional[str] = None, backup: Optional[str] = None, retry: google.api_core.retry.Retry = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())
Create a new database by restoring from a completed backup. The
new database must be in the same project and in an instance with
the same instance configuration as the instance containing the
backup. The returned database [long-running
operation][google.longrunning.Operation] has a name of the
format
projects/<project>/instances/<instance>/databases/<database>/operations/<operation_id>
,
and can be used to track the progress of the operation, and to
cancel it. The metadata][google.longrunning.Operation.metadata]
field type is
RestoreDatabaseMetadata][google.spanner.admin.database.v1.RestoreDatabaseMetadata]
.
The response][google.longrunning.Operation.response]
type is
Database][google.spanner.admin.database.v1.Database]
, if
successful. Cancelling the returned operation will stop the
restore and delete the database. There can be only one database
being restored into an instance at a time. Once the restore
operation completes, a new restore operation can be initiated,
without waiting for the optimize operation associated with the
first restore to complete.
Parameters | |
---|---|
Name | Description |
request |
RestoreDatabaseRequest
The request object. The request for |
parent |
Required. The name of the instance in which to create the restored database. This instance must be in the same project and have the same instance configuration as the instance containing the source backup. Values are of the form |
database_id |
Required. The id of the database to create and restore to. This database must not already exist. The |
backup |
Name of the backup from which to restore. Values are of the form |
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.operation_async.AsyncOperation | An object representing a long-running operation. The result type for the operation will be Database A Cloud Spanner database. |
set_iam_policy
set_iam_policy(request: Optional[google.iam.v1.iam_policy_pb2.SetIamPolicyRequest] = None, *, resource: Optional[str] = None, retry: google.api_core.retry.Retry = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())
Sets the access control policy on a database or backup resource. Replaces any existing policy.
Authorization requires spanner.databases.setIamPolicy
permission on
resource][google.iam.v1.SetIamPolicyRequest.resource]
. For
backups, authorization requires spanner.backups.setIamPolicy
permission on
resource][google.iam.v1.SetIamPolicyRequest.resource]
.
Parameters | |
---|---|
Name | Description |
request |
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.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.iam.v1.policy_pb2.Policy | Defines an Identity and Access Management (IAM) policy. It is used to specify access control policies for Cloud Platform resources. A Policy is a collection of bindings. A binding binds one or more members to a single role. Members can be user accounts, service accounts, Google groups, and domains (such as G Suite). A role is a named list of permissions (defined by IAM or configured by users). A binding can optionally specify a condition, which is a logic expression that further constrains the role binding based on attributes about the request and/or target resource. **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')",="" }="" }="" ]="" }="" **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')="" for="" a="" description="" of="" iam="" and="" its="" features,="" see="" the="" [iam="" developer's="" guide](\=""> |
test_iam_permissions
test_iam_permissions(request: Optional[google.iam.v1.iam_policy_pb2.TestIamPermissionsRequest] = None, *, resource: Optional[str] = None, permissions: Optional[Sequence[str]] = None, retry: google.api_core.retry.Retry = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())
Returns permissions that the caller has on the specified database or backup resource.
Attempting this RPC on a non-existent Cloud Spanner database
will result in a NOT_FOUND error if the user has
spanner.databases.list
permission on the containing Cloud
Spanner instance. Otherwise returns an empty set of permissions.
Calling this method on a backup that does not exist will result
in a NOT_FOUND error if the user has spanner.backups.list
permission on the containing instance.
Parameters | |
---|---|
Name | Description |
request |
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.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.iam.v1.iam_policy_pb2.TestIamPermissionsResponse | Response message for TestIamPermissions method. |
update_backup
update_backup(request: Optional[google.cloud.spanner_admin_database_v1.types.backup.UpdateBackupRequest] = None, *, backup: Optional[google.cloud.spanner_admin_database_v1.types.backup.Backup] = None, update_mask: Optional[google.protobuf.field_mask_pb2.FieldMask] = None, retry: google.api_core.retry.Retry = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())
Updates a pending or completed
Backup][google.spanner.admin.database.v1.Backup]
.
Parameters | |
---|---|
Name | Description |
request |
UpdateBackupRequest
The request object. The request for |
backup |
Backup
Required. The backup to update. |
update_mask |
Required. A mask specifying which fields (e.g. |
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.spanner_admin_database_v1.types.Backup | A backup of a Cloud Spanner database. |
update_database_ddl
update_database_ddl(request: Optional[google.cloud.spanner_admin_database_v1.types.spanner_database_admin.UpdateDatabaseDdlRequest] = None, *, database: Optional[str] = None, statements: Optional[Sequence[str]] = None, retry: google.api_core.retry.Retry = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())
Updates the schema of a Cloud Spanner database by
creating/altering/dropping tables, columns, indexes, etc. The
returned long-running operation][google.longrunning.Operation]
will have a name of the format
<database_name>/operations/<operation_id>
and can be used to
track execution of the schema change(s). The
metadata][google.longrunning.Operation.metadata]
field type is
UpdateDatabaseDdlMetadata][google.spanner.admin.database.v1.UpdateDatabaseDdlMetadata]
.
The operation has no response.
Parameters | |
---|---|
Name | Description |
request |
UpdateDatabaseDdlRequest
The request object. Enqueues the given DDL statements to be applied, in order but not necessarily all at once, to the database schema at some point (or points) in the future. The server checks that the statements are executable (syntactically valid, name tables that exist, etc.) before enqueueing them, but they may still fail upon later execution (e.g., if a statement from another batch of statements is applied first and it conflicts in some way, or if there is some data-related problem like a |
database |
Required. The database to update. This corresponds to the |
statements |
:class:
Required. DDL statements to be applied to the database. 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.operation_async.AsyncOperation | An object representing a long-running operation. The result type for the operation will be google.protobuf.empty_pb2.Empty A generic empty message that you can re-use to avoid defining duplicated empty messages in your APIs. A typical example is to use it as the request or the response type of an API method. For instance: service Foo { rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); } The JSON representation for Empty is empty JSON object {}. |