# Cloud Spanner API . projects . instances . databases

## Instance Methods

Returns the databaseRoles Resource.

Returns the operations Resource.

Returns the sessions Resource.

Close httplib2 connections.

Creates a new Cloud Spanner database and starts to prepare it for serving. The returned long-running operation will have a name of the format `/operations/` and can be used to track preparation of the database. The metadata field type is CreateDatabaseMetadata. The response field type is Database, if successful.

Drops (aka deletes) a Cloud Spanner database. Completed backups for the database will be retained according to their `expire_time`. Note: Cloud Spanner might continue to accept requests for a few seconds after the database has been deleted.

Gets the state of a Cloud Spanner database.

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

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. For backups, authorization requires `spanner.backups.getIamPolicy` permission on resource.

Request a specific scan with Database-specific data for Cloud Key Visualizer.

Lists Cloud Spanner databases.

Retrieves the next page of results.

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 has a name of the format `projects//instances//databases//operations/`, and can be used to track the progress of the operation, and to cancel it. The metadata field type is RestoreDatabaseMetadata. The response type is 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.

Sets the access control policy on a database or backup resource. Replaces any existing policy. Authorization requires `spanner.databases.setIamPolicy` permission on resource. For backups, authorization requires `spanner.backups.setIamPolicy` permission on resource.

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.

Updates the schema of a Cloud Spanner database by creating/altering/dropping tables, columns, indexes, etc. The returned long-running operation will have a name of the format `/operations/` and can be used to track execution of the schema change(s). The metadata field type is UpdateDatabaseDdlMetadata. The operation has no response.

### Method Details

`close()`

    Close httplib2 connections.

`create(parent, body=None, x__xgafv=None)`

    Creates a new Cloud Spanner database and starts to prepare it for serving. The returned long-running operation will have a name of the format `/operations/` and can be used to track preparation of the database. The metadata field type is CreateDatabaseMetadata. The response field type is Database, if successful.

    Args:
      parent: string, Required. The name of the instance that will serve the new database. Values are of the form `projects//instances/`. (required)
      body: object, The request body.
        The object takes the form of:

    { # The request for CreateDatabase.
      "createStatement": "A String", # Required. A `CREATE DATABASE` statement, which specifies the ID of the new database. The database ID must conform to the regular expression `a-z*[a-z0-9]` and be between 2 and 30 characters in length. If the database ID is a reserved word or if it contains a hyphen, the database ID must be enclosed in backticks (`` ` ``).
      "databaseDialect": "A String", # Optional. The dialect of the Cloud Spanner Database.
      "encryptionConfig": { # Encryption configuration for a Cloud Spanner database. # Optional. The encryption configuration for the database. If this field is not specified, Cloud Spanner will encrypt/decrypt all data at rest using Google default encryption.
        "kmsKeyName": "A String", # The Cloud KMS key to be used for encrypting and decrypting the database. Values are of the form `projects//locations//keyRings//cryptoKeys/`.
      },
      "extraStatements": [ # Optional. A list of DDL statements to run inside the newly created database. Statements can create tables, indexes, etc. These statements execute atomically with the creation of the database: if there is an error in any statement, the database is not created.
        "A String",
      ],
    }

      x__xgafv: string, V1 error format.
        Allowed values
          1 - v1 error format
          2 - v2 error format

    Returns:
      An object of the form:

        { # This resource represents a long-running operation that is the result of a network API call.
      "done": True or False, # If the value is `false`, it means the operation is still in progress. If `true`, the operation is completed, and either `error` or `response` is available.
      "error": { # The `Status` type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by [gRPC](https://github.com/grpc). Each `Status` message contains three pieces of data: error code, error message, and error details. You can find out more about this error model and how to work with it in the [API Design Guide](https://cloud.google.com/apis/design/errors). # The error result of the operation in case of failure or cancellation.
        "code": 42, # The status code, which should be an enum value of google.rpc.Code.
        "details": [ # A list of messages that carry the error details. There is a common set of message types for APIs to use.
          {
            "a_key": "", # Properties of the object. Contains field @type with type URL.
          },
        ],
        "message": "A String", # A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the google.rpc.Status.details field, or localized by the client.
      },
      "metadata": { # Service-specific metadata associated with the operation. It typically contains progress information and common metadata such as create time. Some services might not provide such metadata. Any method that returns a long-running operation should document the metadata type, if any.
        "a_key": "", # Properties of the object. Contains field @type with type URL.
      },
      "name": "A String", # The server-assigned name, which is only unique within the same service that originally returns it. If you use the default HTTP mapping, the `name` should be a resource name ending with `operations/{unique_id}`.
      "response": { # The normal response of the operation in case of success. If the original method returns no data on success, such as `Delete`, the response is `google.protobuf.Empty`. If the original method is standard `Get`/`Create`/`Update`, the response should be the resource. For other methods, the response should have the type `XxxResponse`, where `Xxx` is the original method name. For example, if the original method name is `TakeSnapshot()`, the inferred response type is `TakeSnapshotResponse`.
        "a_key": "", # Properties of the object. Contains field @type with type URL.
      },
    }

`dropDatabase(database, x__xgafv=None)`

    Drops (aka deletes) a Cloud Spanner database. Completed backups for the database will be retained according to their `expire_time`. Note: Cloud Spanner might continue to accept requests for a few seconds after the database has been deleted.

    Args:
      database: string, Required. The database to be dropped. (required)
      x__xgafv: string, V1 error format.
        Allowed values
          1 - v1 error format
          2 - v2 error format

    Returns:
      An object of the form:

        { # 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); }
    }

`get(name, x__xgafv=None)`

    Gets the state of a Cloud Spanner database.

    Args:
      name: string, Required. The name of the requested database. Values are of the form `projects//instances//databases/`. (required)
      x__xgafv: string, V1 error format.
        Allowed values
          1 - v1 error format
          2 - v2 error format

    Returns:
      An object of the form:

        { # A Cloud Spanner database.
      "createTime": "A String", # Output only. If exists, the time at which the database creation started.
      "databaseDialect": "A String", # Output only. The dialect of the Cloud Spanner Database.
      "defaultLeader": "A String", # Output only. The read-write region which contains the database's leader replicas. This is the same as the value of default_leader database option set using DatabaseAdmin.CreateDatabase or DatabaseAdmin.UpdateDatabaseDdl. If not explicitly set, this is empty.
      "earliestVersionTime": "A String", # Output only. Earliest timestamp at which older versions of the data can be read. This value is continuously updated by Cloud Spanner and becomes stale the moment it is queried. If you are using this value to recover data, make sure to account for the time from the moment when the value is queried to the moment when you initiate the recovery.
      "encryptionConfig": { # Encryption configuration for a Cloud Spanner database. # Output only. For databases that are using customer managed encryption, this field contains the encryption configuration for the database. For databases that are using Google default or other types of encryption, this field is empty.
        "kmsKeyName": "A String", # The Cloud KMS key to be used for encrypting and decrypting the database. Values are of the form `projects//locations//keyRings//cryptoKeys/`.
      },
      "encryptionInfo": [ # Output only. For databases that are using customer managed encryption, this field contains the encryption information for the database, such as encryption state and the Cloud KMS key versions that are in use. For databases that are using Google default or other types of encryption, this field is empty. This field is propagated lazily from the backend. There might be a delay from when a key version is being used and when it appears in this field.
        { # Encryption information for a Cloud Spanner database or backup.
          "encryptionStatus": { # The `Status` type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by [gRPC](https://github.com/grpc). Each `Status` message contains three pieces of data: error code, error message, and error details. You can find out more about this error model and how to work with it in the [API Design Guide](https://cloud.google.com/apis/design/errors). # Output only. If present, the status of a recent encrypt/decrypt call on underlying data for this database or backup. Regardless of status, data is always encrypted at rest.
            "code": 42, # The status code, which should be an enum value of google.rpc.Code.
            "details": [ # A list of messages that carry the error details. There is a common set of message types for APIs to use.
              {
                "a_key": "", # Properties of the object. Contains field @type with type URL.
              },
            ],
            "message": "A String", # A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the google.rpc.Status.details field, or localized by the client.
          },
          "encryptionType": "A String", # Output only. The type of encryption.
          "kmsKeyVersion": "A String", # Output only. A Cloud KMS key version that is being used to protect the database or backup.
        },
      ],
      "name": "A String", # Required. The name of the database. Values are of the form `projects//instances//databases/`, where `` is as specified in the `CREATE DATABASE` statement. This name can be passed to other API methods to identify the database.
      "restoreInfo": { # Information about the database restore. # Output only. Applicable only for restored databases. Contains information about the restore source.
        "backupInfo": { # Information about a backup. # Information about the backup used to restore the database. The backup may no longer exist.
          "backup": "A String", # Name of the backup.
          "createTime": "A String", # The time the CreateBackup request was received.
          "sourceDatabase": "A String", # Name of the database the backup was created from.
          "versionTime": "A String", # The backup contains an externally consistent copy of `source_database` at the timestamp specified by `version_time`. If the CreateBackup request did not specify `version_time`, the `version_time` of the backup is equivalent to the `create_time`.
        },
        "sourceType": "A String", # The type of the restore source.
      },
      "state": "A String", # Output only. The current database state.
      "versionRetentionPeriod": "A String", # Output only. The period in which Cloud Spanner retains all versions of data for the database. This is the same as the value of version_retention_period database option set using UpdateDatabaseDdl. Defaults to 1 hour, if not set.
    }

`getDdl(database, x__xgafv=None)`

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

    Args:
      database: string, Required. The database whose schema we wish to get. Values are of the form `projects//instances//databases/` (required)
      x__xgafv: string, V1 error format.
        Allowed values
          1 - v1 error format
          2 - v2 error format

    Returns:
      An object of the form:

        { # The response for GetDatabaseDdl.
      "statements": [ # A list of formatted DDL statements defining the schema of the database specified in the request.
        "A String",
      ],
    }

`getIamPolicy(resource, body=None, x__xgafv=None)`

    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. For backups, authorization requires `spanner.backups.getIamPolicy` permission on resource.

    Args:
      resource: string, REQUIRED: The Cloud Spanner resource for which the policy is being retrieved. The format is `projects//instances/` for instance resources and `projects//instances//databases/` for database resources. (required)
      body: object, The request body.
        The object takes the form of:

    { # Request message for `GetIamPolicy` method.
      "options": { # Encapsulates settings provided to GetIamPolicy. # OPTIONAL: A `GetPolicyOptions` object for specifying options to `GetIamPolicy`.
        "requestedPolicyVersion": 42, # Optional. The maximum policy version that will be used to format the policy. Valid values are 0, 1, and 3. Requests specifying an invalid value will be rejected. Requests for policies with any conditional role bindings must specify version 3. Policies with no conditional role bindings may specify any valid value or leave the field unset. The policy in the response might use the policy version that you specified, or it might use a lower policy version. For example, if you specify version 3, but the policy has no conditional role bindings, the response uses version 1. To learn which resources support conditions in their IAM policies, see the [IAM documentation](https://cloud.google.com/iam/help/conditions/resource-policies).
      },
    }

      x__xgafv: string, V1 error format.
        Allowed values
          1 - v1 error format
          2 - v2 error format

    Returns:
      An object of the form:

        { # An Identity and Access Management (IAM) policy, which specifies access controls for Google Cloud resources. A `Policy` is a collection of `bindings`. A `binding` binds one or more `members`, or principals, to a single `role`. Principals can be user accounts, service accounts, Google groups, and domains (such as G Suite). A `role` is a named list of permissions; each `role` can be an IAM predefined role or a user-created custom role. For some types of Google Cloud resources, a `binding` can also specify a `condition`, which is a logical expression that allows access to a resource only if the expression evaluates to `true`. A condition can add constraints based on attributes of the request, the resource, or both. To learn which resources support conditions in their IAM policies, see the [IAM documentation](https://cloud.google.com/iam/help/conditions/resource-policies). **JSON example:** { "bindings": [ { "role": "roles/resourcemanager.organizationAdmin", "members": [ "user:mike@example.com", "group:admins@example.com", "domain:google.com", "serviceAccount:my-project-id@appspot.gserviceaccount.com" ] }, { "role": "roles/resourcemanager.organizationViewer", "members": [ "user:eve@example.com" ], "condition": { "title": "expirable access", "description": "Does not grant access after Sep 2020", "expression": "request.time < timestamp('2020-10-01T00:00:00.000Z')", } } ], "etag": "BwWWja0YfJA=", "version": 3 } **YAML example:** bindings: - members: - user:mike@example.com - group:admins@example.com - domain:google.com - serviceAccount:my-project-id@appspot.gserviceaccount.com role: roles/resourcemanager.organizationAdmin - members: - user:eve@example.com role: roles/resourcemanager.organizationViewer condition: title: expirable access description: Does not grant access after Sep 2020 expression: request.time < timestamp('2020-10-01T00:00:00.000Z') etag: BwWWja0YfJA= version: 3 For a description of IAM and its features, see the [IAM documentation](https://cloud.google.com/iam/docs/).
      "bindings": [ # Associates a list of `members`, or principals, with a `role`. Optionally, may specify a `condition` that determines how and when the `bindings` are applied. Each of the `bindings` must contain at least one principal. The `bindings` in a `Policy` can refer to up to 1,500 principals; up to 250 of these principals can be Google groups. Each occurrence of a principal counts towards these limits. For example, if the `bindings` grant 50 different roles to `user:alice@example.com`, and not to any other principal, then you can add another 1,450 principals to the `bindings` in the `Policy`.
        { # Associates `members`, or principals, with a `role`.
          "condition": { # Represents a textual expression in the Common Expression Language (CEL) syntax. CEL is a C-like expression language. The syntax and semantics of CEL are documented at https://github.com/google/cel-spec. Example (Comparison): title: "Summary size limit" description: "Determines if a summary is less than 100 chars" expression: "document.summary.size() < 100" Example (Equality): title: "Requestor is owner" description: "Determines if requestor is the document owner" expression: "document.owner == request.auth.claims.email" Example (Logic): title: "Public documents" description: "Determine whether the document should be publicly visible" expression: "document.type != 'private' && document.type != 'internal'" Example (Data Manipulation): title: "Notification string" description: "Create a notification string with a timestamp." expression: "'New message received at ' + string(document.create_time)" The exact variables and functions that may be referenced within an expression are determined by the service that evaluates it. See the service documentation for additional information. # The condition that is associated with this binding. If the condition evaluates to `true`, then this binding applies to the current request. If the condition evaluates to `false`, then this binding does not apply to the current request. However, a different role binding might grant the same role to one or more of the principals in this binding. To learn which resources support conditions in their IAM policies, see the [IAM documentation](https://cloud.google.com/iam/help/conditions/resource-policies).
            "description": "A String", # Optional. Description of the expression. This is a longer text which describes the expression, e.g. when hovered over it in a UI.
            "expression": "A String", # Textual representation of an expression in Common Expression Language syntax.
            "location": "A String", # Optional. String indicating the location of the expression for error reporting, e.g. a file name and a position in the file.
            "title": "A String", # Optional. Title for the expression, i.e. a short string describing its purpose. This can be used e.g. in UIs which allow to enter the expression.
          },
          "members": [ # Specifies the principals requesting access for a Google Cloud resource. `members` can have the following values: * `allUsers`: A special identifier that represents anyone who is on the internet; with or without a Google account. * `allAuthenticatedUsers`: A special identifier that represents anyone who is authenticated with a Google account or a service account. * `user:{emailid}`: An email address that represents a specific Google account. For example, `alice@example.com` . * `serviceAccount:{emailid}`: An email address that represents a Google service account. For example, `my-other-app@appspot.gserviceaccount.com`. * `serviceAccount:{projectid}.svc.id.goog[{namespace}/{kubernetes-sa}]`: An identifier for a [Kubernetes service account](https://cloud.google.com/kubernetes-engine/docs/how-to/kubernetes-service-accounts). For example, `my-project.svc.id.goog[my-namespace/my-kubernetes-sa]`. * `group:{emailid}`: An email address that represents a Google group. For example, `admins@example.com`. * `deleted:user:{emailid}?uid={uniqueid}`: An email address (plus unique identifier) representing a user that has been recently deleted. For example, `alice@example.com?uid=123456789012345678901`. If the user is recovered, this value reverts to `user:{emailid}` and the recovered user retains the role in the binding. * `deleted:serviceAccount:{emailid}?uid={uniqueid}`: An email address (plus unique identifier) representing a service account that has been recently deleted. For example, `my-other-app@appspot.gserviceaccount.com?uid=123456789012345678901`. If the service account is undeleted, this value reverts to `serviceAccount:{emailid}` and the undeleted service account retains the role in the binding. * `deleted:group:{emailid}?uid={uniqueid}`: An email address (plus unique identifier) representing a Google group that has been recently deleted. For example, `admins@example.com?uid=123456789012345678901`. If the group is recovered, this value reverts to `group:{emailid}` and the recovered group retains the role in the binding. * `domain:{domain}`: The G Suite domain (primary) that represents all the users of that domain. For example, `google.com` or `example.com`.
            "A String",
          ],
          "role": "A String", # Role that is assigned to the list of `members`, or principals. For example, `roles/viewer`, `roles/editor`, or `roles/owner`.
        },
      ],
      "etag": "A String", # `etag` is used for optimistic concurrency control as a way to help prevent simultaneous updates of a policy from overwriting each other. It is strongly suggested that systems make use of the `etag` in the read-modify-write cycle to perform policy updates in order to avoid race conditions: An `etag` is returned in the response to `getIamPolicy`, and systems are expected to put that etag in the request to `setIamPolicy` to ensure that their change will be applied to the same version of the policy. **Important:** If you use IAM Conditions, you must include the `etag` field whenever you call `setIamPolicy`. If you omit this field, then IAM allows you to overwrite a version `3` policy with a version `1` policy, and all of the conditions in the version `3` policy are lost.
      "version": 42, # Specifies the format of the policy. Valid values are `0`, `1`, and `3`. Requests that specify an invalid value are rejected. Any operation that affects conditional role bindings must specify version `3`. This requirement applies to the following operations: * Getting a policy that includes a conditional role binding * Adding a conditional role binding to a policy * Changing a conditional role binding in a policy * Removing any role binding, with or without a condition, from a policy that includes conditions **Important:** If you use IAM Conditions, you must include the `etag` field whenever you call `setIamPolicy`. If you omit this field, then IAM allows you to overwrite a version `3` policy with a version `1` policy, and all of the conditions in the version `3` policy are lost. If a policy does not include any conditions, operations on that policy may specify any valid version or leave the field unset. To learn which resources support conditions in their IAM policies, see the [IAM documentation](https://cloud.google.com/iam/help/conditions/resource-policies).
    }

`getScans(name, endTime=None, startTime=None, view=None, x__xgafv=None)`

    Request a specific scan with Database-specific data for Cloud Key Visualizer.

    Args:
      name: string, Required. The unique name of the scan containing the requested information, specific to the Database service implementing this interface. (required)
      endTime: string, The upper bound for the time range to retrieve Scan data for.
      startTime: string, These fields restrict the Database-specific information returned in the `Scan.data` field. If a `View` is provided that does not include the `Scan.data` field, these are ignored. This range of time must be entirely contained within the defined time range of the targeted scan. The lower bound for the time range to retrieve Scan data for.
      view: string, Specifies which parts of the Scan should be returned in the response. Note, if left unspecified, the FULL view is assumed.
        Allowed values
          VIEW_UNSPECIFIED - Not specified, equivalent to SUMMARY.
          SUMMARY - Server responses only include `name`, `details`, `start_time` and `end_time`. The default value. Note, the ListScans method may only use this view type, others view types are not supported.
          FULL - Full representation of the scan is returned in the server response, including `data`.
      x__xgafv: string, V1 error format.
        Allowed values
          1 - v1 error format
          2 - v2 error format

    Returns:
      An object of the form:

        { # Scan is a structure which describes Cloud Key Visualizer scan information.
      "details": { # Additional information provided by the implementer.
        "a_key": "", # Properties of the object. Contains field @type with type URL.
      },
      "endTime": "A String", # The upper bound for when the scan is defined.
      "name": "A String", # The unique name of the scan, specific to the Database service implementing this interface.
      "scanData": { # ScanData contains Cloud Key Visualizer scan data used by the caller to construct a visualization. # Output only. Cloud Key Visualizer scan data. Note, this field is not available to the ListScans method.
        "data": { # Cloud Key Visualizer scan data. The range of time this information covers is captured via the above time range fields. Note, this field is not available to the ListScans method.
          "dataSourceEndToken": "A String", # The token signifying the end of a data_source.
          "dataSourceSeparatorToken": "A String", # The token delimiting a datasource name from the rest of a key in a data_source.
          "diagnosticMessages": [ # The list of messages (info, alerts, ...)
            { # A message representing the key visualizer diagnostic messages.
              "info": { # A message representing a user-facing string whose value may need to be translated before being displayed. # Information about this diagnostic information.
                "args": { # A map of arguments used when creating the localized message. Keys represent parameter names which may be used by the localized version when substituting dynamic values.
                  "a_key": "A String",
                },
                "message": "A String", # The canonical English version of this message. If no token is provided or the front-end has no message associated with the token, this text will be displayed as-is.
                "token": "A String", # The token identifying the message, e.g. 'METRIC_READ_CPU'. This should be unique within the service.
              },
              "metric": { # A message representing a user-facing string whose value may need to be translated before being displayed. # The metric.
                "args": { # A map of arguments used when creating the localized message. Keys represent parameter names which may be used by the localized version when substituting dynamic values.
                  "a_key": "A String",
                },
                "message": "A String", # The canonical English version of this message. If no token is provided or the front-end has no message associated with the token, this text will be displayed as-is.
                "token": "A String", # The token identifying the message, e.g. 'METRIC_READ_CPU'. This should be unique within the service.
              },
              "metricSpecific": True or False, # Whether this message is specific only for the current metric. By default Diagnostics are shown for all metrics, regardless which metric is the currently selected metric in the UI. However occasionally a metric will generate so many messages that the resulting visual clutter becomes overwhelming. In this case setting this to true, will show the diagnostic messages for that metric only if it is the currently selected metric.
              "severity": "A String", # The severity of the diagnostic message.
              "shortMessage": { # A message representing a user-facing string whose value may need to be translated before being displayed. # The short message.
                "args": { # A map of arguments used when creating the localized message. Keys represent parameter names which may be used by the localized version when substituting dynamic values.
                  "a_key": "A String",
                },
                "message": "A String", # The canonical English version of this message. If no token is provided or the front-end has no message associated with the token, this text will be displayed as-is.
                "token": "A String", # The token identifying the message, e.g. 'METRIC_READ_CPU'. This should be unique within the service.
              },
            },
          ],
          "endKeyStrings": [ # We discretize the entire keyspace into buckets. Assuming each bucket has an inclusive keyrange and covers keys from k(i) ... k(n). In this case k(n) would be an end key for a given range. end_key_string is the collection of all such end keys
            "A String",
          ],
          "hasPii": True or False, # Whether this scan contains PII.
          "indexedKeys": [ # Keys of key ranges that contribute significantly to a given metric Can be thought of as heavy hitters.
            "A String",
          ],
          "keySeparator": "A String", # The token delimiting the key prefixes.
          "keyUnit": "A String", # The unit for the key: e.g. 'key' or 'chunk'.
          "metrics": [ # The list of data objects for each metric.
            { # A message representing the actual monitoring data, values for each key bucket over time, of a metric.
              "aggregation": "A String", # The aggregation function used to aggregate each key bucket
              "category": { # A message representing a user-facing string whose value may need to be translated before being displayed. # The category of the metric, e.g. "Activity", "Alerts", "Reads", etc.
                "args": { # A map of arguments used when creating the localized message. Keys represent parameter names which may be used by the localized version when substituting dynamic values.
                  "a_key": "A String",
                },
                "message": "A String", # The canonical English version of this message. If no token is provided or the front-end has no message associated with the token, this text will be displayed as-is.
                "token": "A String", # The token identifying the message, e.g. 'METRIC_READ_CPU'. This should be unique within the service.
              },
              "derived": { # A message representing a derived metric. # The references to numerator and denominator metrics for a derived metric.
                "denominator": { # A message representing a user-facing string whose value may need to be translated before being displayed. # The name of the denominator metric. e.g. "rows".
                  "args": { # A map of arguments used when creating the localized message. Keys represent parameter names which may be used by the localized version when substituting dynamic values.
                    "a_key": "A String",
                  },
                  "message": "A String", # The canonical English version of this message. If no token is provided or the front-end has no message associated with the token, this text will be displayed as-is.
                  "token": "A String", # The token identifying the message, e.g. 'METRIC_READ_CPU'. This should be unique within the service.
                },
                "numerator": { # A message representing a user-facing string whose value may need to be translated before being displayed. # The name of the numerator metric. e.g. "latency".
                  "args": { # A map of arguments used when creating the localized message. Keys represent parameter names which may be used by the localized version when substituting dynamic values.
                    "a_key": "A String",
                  },
                  "message": "A String", # The canonical English version of this message. If no token is provided or the front-end has no message associated with the token, this text will be displayed as-is.
                  "token": "A String", # The token identifying the message, e.g. 'METRIC_READ_CPU'. This should be unique within the service.
                },
              },
              "displayLabel": { # A message representing a user-facing string whose value may need to be translated before being displayed. # The displayed label of the metric.
                "args": { # A map of arguments used when creating the localized message. Keys represent parameter names which may be used by the localized version when substituting dynamic values.
                  "a_key": "A String",
                },
                "message": "A String", # The canonical English version of this message. If no token is provided or the front-end has no message associated with the token, this text will be displayed as-is.
                "token": "A String", # The token identifying the message, e.g. 'METRIC_READ_CPU'. This should be unique within the service.
              },
              "hasNonzeroData": True or False, # Whether the metric has any non-zero data.
              "hotValue": 3.14, # The value that is considered hot for the metric. On a per metric basis hotness signals high utilization and something that might potentially be a cause for concern by the end user. hot_value is used to calibrate and scale visual color scales.
              "indexedHotKeys": { # The (sparse) mapping from time index to an IndexedHotKey message, representing those time intervals for which there are hot keys.
                "a_key": { # A message representing a (sparse) collection of hot keys for specific key buckets.
                  "sparseHotKeys": { # A (sparse) mapping from key bucket index to the index of the specific hot row key for that key bucket. The index of the hot row key can be translated to the actual row key via the ScanData.VisualizationData.indexed_keys repeated field.
                    "a_key": 42,
                  },
                },
              },
              "indexedKeyRangeInfos": { # The (sparse) mapping from time interval index to an IndexedKeyRangeInfos message, representing those time intervals for which there are informational messages concerning key ranges.
                "a_key": { # A message representing a (sparse) collection of KeyRangeInfos for specific key buckets.
                  "keyRangeInfos": { # A (sparse) mapping from key bucket index to the KeyRangeInfos for that key bucket.
                    "a_key": { # A message representing a list of specific information for multiple key ranges.
                      "infos": [ # The list individual KeyRangeInfos.
                        { # A message representing information for a key range (possibly one key).
                          "contextValues": [ # The list of context values for this key range.
                            { # A message representing context for a KeyRangeInfo, including a label, value, unit, and severity.
                              "label": { # A message representing a user-facing string whose value may need to be translated before being displayed. # The label for the context value. e.g. "latency".
                                "args": { # A map of arguments used when creating the localized message. Keys represent parameter names which may be used by the localized version when substituting dynamic values.
                                  "a_key": "A String",
                                },
                                "message": "A String", # The canonical English version of this message. If no token is provided or the front-end has no message associated with the token, this text will be displayed as-is.
                                "token": "A String", # The token identifying the message, e.g. 'METRIC_READ_CPU'. This should be unique within the service.
                              },
                              "severity": "A String", # The severity of this context.
                              "unit": "A String", # The unit of the context value.
                              "value": 3.14, # The value for the context.
                            },
                          ],
                          "endKeyIndex": 42, # The index of the end key in indexed_keys.
                          "info": { # A message representing a user-facing string whose value may need to be translated before being displayed. # Information about this key range, for all metrics.
                            "args": { # A map of arguments used when creating the localized message. Keys represent parameter names which may be used by the localized version when substituting dynamic values.
                              "a_key": "A String",
                            },
                            "message": "A String", # The canonical English version of this message. If no token is provided or the front-end has no message associated with the token, this text will be displayed as-is.
                            "token": "A String", # The token identifying the message, e.g. 'METRIC_READ_CPU'. This should be unique within the service.
                          },
                          "keysCount": "A String", # The number of keys this range covers.
                          "metric": { # A message representing a user-facing string whose value may need to be translated before being displayed. # The name of the metric. e.g. "latency".
                            "args": { # A map of arguments used when creating the localized message. Keys represent parameter names which may be used by the localized version when substituting dynamic values.
                              "a_key": "A String",
                            },
                            "message": "A String", # The canonical English version of this message. If no token is provided or the front-end has no message associated with the token, this text will be displayed as-is.
                            "token": "A String", # The token identifying the message, e.g. 'METRIC_READ_CPU'. This should be unique within the service.
                          },
                          "startKeyIndex": 42, # The index of the start key in indexed_keys.
                          "timeOffset": "A String", # The time offset. This is the time since the start of the time interval.
                          "unit": { # A message representing a user-facing string whose value may need to be translated before being displayed. # The unit of the metric. This is an unstructured field and will be mapped as is to the user.
                            "args": { # A map of arguments used when creating the localized message. Keys represent parameter names which may be used by the localized version when substituting dynamic values.
                              "a_key": "A String",
                            },
                            "message": "A String", # The canonical English version of this message. If no token is provided or the front-end has no message associated with the token, this text will be displayed as-is.
                            "token": "A String", # The token identifying the message, e.g. 'METRIC_READ_CPU'. This should be unique within the service.
                          },
                          "value": 3.14, # The value of the metric.
                        },
                      ],
                      "totalSize": 42, # The total size of the list of all KeyRangeInfos. This may be larger than the number of repeated messages above. If that is the case, this number may be used to determine how many are not being shown.
                    },
                  },
                },
              },
              "info": { # A message representing a user-facing string whose value may need to be translated before being displayed. # Information about the metric.
                "args": { # A map of arguments used when creating the localized message. Keys represent parameter names which may be used by the localized version when substituting dynamic values.
                  "a_key": "A String",
                },
                "message": "A String", # The canonical English version of this message. If no token is provided or the front-end has no message associated with the token, this text will be displayed as-is.
                "token": "A String", # The token identifying the message, e.g. 'METRIC_READ_CPU'. This should be unique within the service.
              },
              "matrix": { # A message representing a matrix of floats. # The data for the metric as a matrix.
                "rows": [ # The rows of the matrix.
                  { # A message representing a row of a matrix of floats.
                    "cols": [ # The columns of the row.
                      3.14,
                    ],
                  },
                ],
              },
              "unit": { # A message representing a user-facing string whose value may need to be translated before being displayed. # The unit of the metric.
                "args": { # A map of arguments used when creating the localized message. Keys represent parameter names which may be used by the localized version when substituting dynamic values.
                  "a_key": "A String",
                },
                "message": "A String", # The canonical English version of this message. If no token is provided or the front-end has no message associated with the token, this text will be displayed as-is.
                "token": "A String", # The token identifying the message, e.g. 'METRIC_READ_CPU'. This should be unique within the service.
              },
              "visible": True or False, # Whether the metric is visible to the end user.
            },
          ],
          "prefixNodes": [ # The list of extracted key prefix nodes used in the key prefix hierarchy.
            { # A message representing a key prefix node in the key prefix hierarchy. for eg. Bigtable keyspaces are lexicographically ordered mappings of keys to values. Keys often have a shared prefix structure where users use the keys to organize data. Eg ///employee In this case Keysight will possibly use one node for a company and reuse it for all employees that fall under the company. Doing so improves legibility in the UI.
              "dataSourceNode": True or False, # Whether this corresponds to a data_source name.
              "depth": 42, # The depth in the prefix hierarchy.
              "endIndex": 42, # The index of the end key bucket of the range that this node spans.
              "startIndex": 42, # The index of the start key bucket of the range that this node spans.
              "word": "A String", # The string represented by the prefix node.
            },
          ],
        },
        "endTime": "A String", # The upper bound for when the contained data is defined.
        "startTime": "A String", # A range of time (inclusive) for when the contained data is defined. The lower bound for when the contained data is defined.
      },
      "startTime": "A String", # A range of time (inclusive) for when the scan is defined. The lower bound for when the scan is defined.
    }

`list(parent, pageSize=None, pageToken=None, x__xgafv=None)`

    Lists Cloud Spanner databases.

    Args:
      parent: string, Required. The instance whose databases should be listed. Values are of the form `projects//instances/`. (required)
      pageSize: integer, Number of databases to be returned in the response. If 0 or less, defaults to the server's maximum allowed page size.
      pageToken: string, If non-empty, `page_token` should contain a next_page_token from a previous ListDatabasesResponse.
      x__xgafv: string, V1 error format.
        Allowed values
          1 - v1 error format
          2 - v2 error format

    Returns:
      An object of the form:

        { # The response for ListDatabases.
      "databases": [ # Databases that matched the request.
        { # A Cloud Spanner database.
          "createTime": "A String", # Output only. If exists, the time at which the database creation started.
          "databaseDialect": "A String", # Output only. The dialect of the Cloud Spanner Database.
          "defaultLeader": "A String", # Output only. The read-write region which contains the database's leader replicas. This is the same as the value of default_leader database option set using DatabaseAdmin.CreateDatabase or DatabaseAdmin.UpdateDatabaseDdl. If not explicitly set, this is empty.
          "earliestVersionTime": "A String", # Output only. Earliest timestamp at which older versions of the data can be read. This value is continuously updated by Cloud Spanner and becomes stale the moment it is queried. If you are using this value to recover data, make sure to account for the time from the moment when the value is queried to the moment when you initiate the recovery.
          "encryptionConfig": { # Encryption configuration for a Cloud Spanner database. # Output only. For databases that are using customer managed encryption, this field contains the encryption configuration for the database. For databases that are using Google default or other types of encryption, this field is empty.
            "kmsKeyName": "A String", # The Cloud KMS key to be used for encrypting and decrypting the database. Values are of the form `projects//locations//keyRings//cryptoKeys/`.
          },
          "encryptionInfo": [ # Output only. For databases that are using customer managed encryption, this field contains the encryption information for the database, such as encryption state and the Cloud KMS key versions that are in use. For databases that are using Google default or other types of encryption, this field is empty. This field is propagated lazily from the backend. There might be a delay from when a key version is being used and when it appears in this field.
            { # Encryption information for a Cloud Spanner database or backup.
              "encryptionStatus": { # The `Status` type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by [gRPC](https://github.com/grpc). Each `Status` message contains three pieces of data: error code, error message, and error details. You can find out more about this error model and how to work with it in the [API Design Guide](https://cloud.google.com/apis/design/errors). # Output only. If present, the status of a recent encrypt/decrypt call on underlying data for this database or backup. Regardless of status, data is always encrypted at rest.
                "code": 42, # The status code, which should be an enum value of google.rpc.Code.
                "details": [ # A list of messages that carry the error details. There is a common set of message types for APIs to use.
                  {
                    "a_key": "", # Properties of the object. Contains field @type with type URL.
                  },
                ],
                "message": "A String", # A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the google.rpc.Status.details field, or localized by the client.
              },
              "encryptionType": "A String", # Output only. The type of encryption.
              "kmsKeyVersion": "A String", # Output only. A Cloud KMS key version that is being used to protect the database or backup.
            },
          ],
          "name": "A String", # Required. The name of the database. Values are of the form `projects//instances//databases/`, where `` is as specified in the `CREATE DATABASE` statement. This name can be passed to other API methods to identify the database.
          "restoreInfo": { # Information about the database restore. # Output only. Applicable only for restored databases. Contains information about the restore source.
            "backupInfo": { # Information about a backup. # Information about the backup used to restore the database. The backup may no longer exist.
              "backup": "A String", # Name of the backup.
              "createTime": "A String", # The time the CreateBackup request was received.
              "sourceDatabase": "A String", # Name of the database the backup was created from.
              "versionTime": "A String", # The backup contains an externally consistent copy of `source_database` at the timestamp specified by `version_time`. If the CreateBackup request did not specify `version_time`, the `version_time` of the backup is equivalent to the `create_time`.
            },
            "sourceType": "A String", # The type of the restore source.
          },
          "state": "A String", # Output only. The current database state.
          "versionRetentionPeriod": "A String", # Output only. The period in which Cloud Spanner retains all versions of data for the database. This is the same as the value of version_retention_period database option set using UpdateDatabaseDdl. Defaults to 1 hour, if not set.
        },
      ],
      "nextPageToken": "A String", # `next_page_token` can be sent in a subsequent ListDatabases call to fetch more of the matching databases.
    }

`list_next()`

    Retrieves the next page of results.

            Args:
              previous_request: The request for the previous page. (required)
              previous_response: The response from the request for the previous page. (required)

            Returns:
              A request object that you can call 'execute()' on to request the next
              page. Returns None if there are no more items in the collection.

`restore(parent, body=None, x__xgafv=None)`

    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 has a name of the format `projects//instances//databases//operations/`, and can be used to track the progress of the operation, and to cancel it. The metadata field type is RestoreDatabaseMetadata. The response type is 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.

    Args:
      parent: string, 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 `projects//instances/`. (required)
      body: object, The request body.
        The object takes the form of:

    { # The request for RestoreDatabase.
      "backup": "A String", # Name of the backup from which to restore. Values are of the form `projects//instances//backups/`.
      "databaseId": "A String", # Required. The id of the database to create and restore to. This database must not already exist. The `database_id` appended to `parent` forms the full database name of the form `projects//instances//databases/`.
      "encryptionConfig": { # Encryption configuration for the restored database. # Optional. An encryption configuration describing the encryption type and key resources in Cloud KMS used to encrypt/decrypt the database to restore to. If this field is not specified, the restored database will use the same encryption configuration as the backup by default, namely encryption_type = `USE_CONFIG_DEFAULT_OR_BACKUP_ENCRYPTION`.
        "encryptionType": "A String", # Required. The encryption type of the restored database.
        "kmsKeyName": "A String", # Optional. The Cloud KMS key that will be used to encrypt/decrypt the restored database. This field should be set only when encryption_type is `CUSTOMER_MANAGED_ENCRYPTION`. Values are of the form `projects//locations//keyRings//cryptoKeys/`.
      },
    }

      x__xgafv: string, V1 error format.
        Allowed values
          1 - v1 error format
          2 - v2 error format

    Returns:
      An object of the form:

        { # This resource represents a long-running operation that is the result of a network API call.
      "done": True or False, # If the value is `false`, it means the operation is still in progress. If `true`, the operation is completed, and either `error` or `response` is available.
      "error": { # The `Status` type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by [gRPC](https://github.com/grpc). Each `Status` message contains three pieces of data: error code, error message, and error details. You can find out more about this error model and how to work with it in the [API Design Guide](https://cloud.google.com/apis/design/errors). # The error result of the operation in case of failure or cancellation.
        "code": 42, # The status code, which should be an enum value of google.rpc.Code.
        "details": [ # A list of messages that carry the error details. There is a common set of message types for APIs to use.
          {
            "a_key": "", # Properties of the object. Contains field @type with type URL.
          },
        ],
        "message": "A String", # A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the google.rpc.Status.details field, or localized by the client.
      },
      "metadata": { # Service-specific metadata associated with the operation. It typically contains progress information and common metadata such as create time. Some services might not provide such metadata. Any method that returns a long-running operation should document the metadata type, if any.
        "a_key": "", # Properties of the object. Contains field @type with type URL.
      },
      "name": "A String", # The server-assigned name, which is only unique within the same service that originally returns it. If you use the default HTTP mapping, the `name` should be a resource name ending with `operations/{unique_id}`.
      "response": { # The normal response of the operation in case of success. If the original method returns no data on success, such as `Delete`, the response is `google.protobuf.Empty`. If the original method is standard `Get`/`Create`/`Update`, the response should be the resource. For other methods, the response should have the type `XxxResponse`, where `Xxx` is the original method name. For example, if the original method name is `TakeSnapshot()`, the inferred response type is `TakeSnapshotResponse`.
        "a_key": "", # Properties of the object. Contains field @type with type URL.
      },
    }

`setIamPolicy(resource, body=None, x__xgafv=None)`

    Sets the access control policy on a database or backup resource. Replaces any existing policy. Authorization requires `spanner.databases.setIamPolicy` permission on resource. For backups, authorization requires `spanner.backups.setIamPolicy` permission on resource.

    Args:
      resource: string, REQUIRED: The Cloud Spanner resource for which the policy is being set. The format is `projects//instances/` for instance resources and `projects//instances//databases/` for databases resources. (required)
      body: object, The request body.
        The object takes the form of:

    { # Request message for `SetIamPolicy` method.
      "policy": { # An Identity and Access Management (IAM) policy, which specifies access controls for Google Cloud resources. A `Policy` is a collection of `bindings`. A `binding` binds one or more `members`, or principals, to a single `role`. Principals can be user accounts, service accounts, Google groups, and domains (such as G Suite). A `role` is a named list of permissions; each `role` can be an IAM predefined role or a user-created custom role. For some types of Google Cloud resources, a `binding` can also specify a `condition`, which is a logical expression that allows access to a resource only if the expression evaluates to `true`. A condition can add constraints based on attributes of the request, the resource, or both. To learn which resources support conditions in their IAM policies, see the [IAM documentation](https://cloud.google.com/iam/help/conditions/resource-policies). **JSON example:** { "bindings": [ { "role": "roles/resourcemanager.organizationAdmin", "members": [ "user:mike@example.com", "group:admins@example.com", "domain:google.com", "serviceAccount:my-project-id@appspot.gserviceaccount.com" ] }, { "role": "roles/resourcemanager.organizationViewer", "members": [ "user:eve@example.com" ], "condition": { "title": "expirable access", "description": "Does not grant access after Sep 2020", "expression": "request.time < timestamp('2020-10-01T00:00:00.000Z')", } } ], "etag": "BwWWja0YfJA=", "version": 3 } **YAML example:** bindings: - members: - user:mike@example.com - group:admins@example.com - domain:google.com - serviceAccount:my-project-id@appspot.gserviceaccount.com role: roles/resourcemanager.organizationAdmin - members: - user:eve@example.com role: roles/resourcemanager.organizationViewer condition: title: expirable access description: Does not grant access after Sep 2020 expression: request.time < timestamp('2020-10-01T00:00:00.000Z') etag: BwWWja0YfJA= version: 3 For a description of IAM and its features, see the [IAM documentation](https://cloud.google.com/iam/docs/). # REQUIRED: The complete policy to be applied to the `resource`. The size of the policy is limited to a few 10s of KB. An empty policy is a valid policy but certain Google Cloud services (such as Projects) might reject them.
        "bindings": [ # Associates a list of `members`, or principals, with a `role`. Optionally, may specify a `condition` that determines how and when the `bindings` are applied. Each of the `bindings` must contain at least one principal. The `bindings` in a `Policy` can refer to up to 1,500 principals; up to 250 of these principals can be Google groups. Each occurrence of a principal counts towards these limits. For example, if the `bindings` grant 50 different roles to `user:alice@example.com`, and not to any other principal, then you can add another 1,450 principals to the `bindings` in the `Policy`.
          { # Associates `members`, or principals, with a `role`.
            "condition": { # Represents a textual expression in the Common Expression Language (CEL) syntax. CEL is a C-like expression language. The syntax and semantics of CEL are documented at https://github.com/google/cel-spec. Example (Comparison): title: "Summary size limit" description: "Determines if a summary is less than 100 chars" expression: "document.summary.size() < 100" Example (Equality): title: "Requestor is owner" description: "Determines if requestor is the document owner" expression: "document.owner == request.auth.claims.email" Example (Logic): title: "Public documents" description: "Determine whether the document should be publicly visible" expression: "document.type != 'private' && document.type != 'internal'" Example (Data Manipulation): title: "Notification string" description: "Create a notification string with a timestamp." expression: "'New message received at ' + string(document.create_time)" The exact variables and functions that may be referenced within an expression are determined by the service that evaluates it. See the service documentation for additional information. # The condition that is associated with this binding. If the condition evaluates to `true`, then this binding applies to the current request. If the condition evaluates to `false`, then this binding does not apply to the current request. However, a different role binding might grant the same role to one or more of the principals in this binding. To learn which resources support conditions in their IAM policies, see the [IAM documentation](https://cloud.google.com/iam/help/conditions/resource-policies).
              "description": "A String", # Optional. Description of the expression. This is a longer text which describes the expression, e.g. when hovered over it in a UI.
              "expression": "A String", # Textual representation of an expression in Common Expression Language syntax.
              "location": "A String", # Optional. String indicating the location of the expression for error reporting, e.g. a file name and a position in the file.
              "title": "A String", # Optional. Title for the expression, i.e. a short string describing its purpose. This can be used e.g. in UIs which allow to enter the expression.
            },
            "members": [ # Specifies the principals requesting access for a Google Cloud resource. `members` can have the following values: * `allUsers`: A special identifier that represents anyone who is on the internet; with or without a Google account. * `allAuthenticatedUsers`: A special identifier that represents anyone who is authenticated with a Google account or a service account. * `user:{emailid}`: An email address that represents a specific Google account. For example, `alice@example.com` . * `serviceAccount:{emailid}`: An email address that represents a Google service account. For example, `my-other-app@appspot.gserviceaccount.com`. * `serviceAccount:{projectid}.svc.id.goog[{namespace}/{kubernetes-sa}]`: An identifier for a [Kubernetes service account](https://cloud.google.com/kubernetes-engine/docs/how-to/kubernetes-service-accounts). For example, `my-project.svc.id.goog[my-namespace/my-kubernetes-sa]`. * `group:{emailid}`: An email address that represents a Google group. For example, `admins@example.com`. * `deleted:user:{emailid}?uid={uniqueid}`: An email address (plus unique identifier) representing a user that has been recently deleted. For example, `alice@example.com?uid=123456789012345678901`. If the user is recovered, this value reverts to `user:{emailid}` and the recovered user retains the role in the binding. * `deleted:serviceAccount:{emailid}?uid={uniqueid}`: An email address (plus unique identifier) representing a service account that has been recently deleted. For example, `my-other-app@appspot.gserviceaccount.com?uid=123456789012345678901`. If the service account is undeleted, this value reverts to `serviceAccount:{emailid}` and the undeleted service account retains the role in the binding. * `deleted:group:{emailid}?uid={uniqueid}`: An email address (plus unique identifier) representing a Google group that has been recently deleted. For example, `admins@example.com?uid=123456789012345678901`. If the group is recovered, this value reverts to `group:{emailid}` and the recovered group retains the role in the binding. * `domain:{domain}`: The G Suite domain (primary) that represents all the users of that domain. For example, `google.com` or `example.com`.
              "A String",
            ],
            "role": "A String", # Role that is assigned to the list of `members`, or principals. For example, `roles/viewer`, `roles/editor`, or `roles/owner`.
          },
        ],
        "etag": "A String", # `etag` is used for optimistic concurrency control as a way to help prevent simultaneous updates of a policy from overwriting each other. It is strongly suggested that systems make use of the `etag` in the read-modify-write cycle to perform policy updates in order to avoid race conditions: An `etag` is returned in the response to `getIamPolicy`, and systems are expected to put that etag in the request to `setIamPolicy` to ensure that their change will be applied to the same version of the policy. **Important:** If you use IAM Conditions, you must include the `etag` field whenever you call `setIamPolicy`. If you omit this field, then IAM allows you to overwrite a version `3` policy with a version `1` policy, and all of the conditions in the version `3` policy are lost.
        "version": 42, # Specifies the format of the policy. Valid values are `0`, `1`, and `3`. Requests that specify an invalid value are rejected. Any operation that affects conditional role bindings must specify version `3`. This requirement applies to the following operations: * Getting a policy that includes a conditional role binding * Adding a conditional role binding to a policy * Changing a conditional role binding in a policy * Removing any role binding, with or without a condition, from a policy that includes conditions **Important:** If you use IAM Conditions, you must include the `etag` field whenever you call `setIamPolicy`. If you omit this field, then IAM allows you to overwrite a version `3` policy with a version `1` policy, and all of the conditions in the version `3` policy are lost. If a policy does not include any conditions, operations on that policy may specify any valid version or leave the field unset. To learn which resources support conditions in their IAM policies, see the [IAM documentation](https://cloud.google.com/iam/help/conditions/resource-policies).
      },
    }

      x__xgafv: string, V1 error format.
        Allowed values
          1 - v1 error format
          2 - v2 error format

    Returns:
      An object of the form:

        { # An Identity and Access Management (IAM) policy, which specifies access controls for Google Cloud resources. A `Policy` is a collection of `bindings`. A `binding` binds one or more `members`, or principals, to a single `role`. Principals can be user accounts, service accounts, Google groups, and domains (such as G Suite). A `role` is a named list of permissions; each `role` can be an IAM predefined role or a user-created custom role. For some types of Google Cloud resources, a `binding` can also specify a `condition`, which is a logical expression that allows access to a resource only if the expression evaluates to `true`. A condition can add constraints based on attributes of the request, the resource, or both. To learn which resources support conditions in their IAM policies, see the [IAM documentation](https://cloud.google.com/iam/help/conditions/resource-policies). **JSON example:** { "bindings": [ { "role": "roles/resourcemanager.organizationAdmin", "members": [ "user:mike@example.com", "group:admins@example.com", "domain:google.com", "serviceAccount:my-project-id@appspot.gserviceaccount.com" ] }, { "role": "roles/resourcemanager.organizationViewer", "members": [ "user:eve@example.com" ], "condition": { "title": "expirable access", "description": "Does not grant access after Sep 2020", "expression": "request.time < timestamp('2020-10-01T00:00:00.000Z')", } } ], "etag": "BwWWja0YfJA=", "version": 3 } **YAML example:** bindings: - members: - user:mike@example.com - group:admins@example.com - domain:google.com - serviceAccount:my-project-id@appspot.gserviceaccount.com role: roles/resourcemanager.organizationAdmin - members: - user:eve@example.com role: roles/resourcemanager.organizationViewer condition: title: expirable access description: Does not grant access after Sep 2020 expression: request.time < timestamp('2020-10-01T00:00:00.000Z') etag: BwWWja0YfJA= version: 3 For a description of IAM and its features, see the [IAM documentation](https://cloud.google.com/iam/docs/).
      "bindings": [ # Associates a list of `members`, or principals, with a `role`. Optionally, may specify a `condition` that determines how and when the `bindings` are applied. Each of the `bindings` must contain at least one principal. The `bindings` in a `Policy` can refer to up to 1,500 principals; up to 250 of these principals can be Google groups. Each occurrence of a principal counts towards these limits. For example, if the `bindings` grant 50 different roles to `user:alice@example.com`, and not to any other principal, then you can add another 1,450 principals to the `bindings` in the `Policy`.
        { # Associates `members`, or principals, with a `role`.
          "condition": { # Represents a textual expression in the Common Expression Language (CEL) syntax. CEL is a C-like expression language. The syntax and semantics of CEL are documented at https://github.com/google/cel-spec. Example (Comparison): title: "Summary size limit" description: "Determines if a summary is less than 100 chars" expression: "document.summary.size() < 100" Example (Equality): title: "Requestor is owner" description: "Determines if requestor is the document owner" expression: "document.owner == request.auth.claims.email" Example (Logic): title: "Public documents" description: "Determine whether the document should be publicly visible" expression: "document.type != 'private' && document.type != 'internal'" Example (Data Manipulation): title: "Notification string" description: "Create a notification string with a timestamp." expression: "'New message received at ' + string(document.create_time)" The exact variables and functions that may be referenced within an expression are determined by the service that evaluates it. See the service documentation for additional information. # The condition that is associated with this binding. If the condition evaluates to `true`, then this binding applies to the current request. If the condition evaluates to `false`, then this binding does not apply to the current request. However, a different role binding might grant the same role to one or more of the principals in this binding. To learn which resources support conditions in their IAM policies, see the [IAM documentation](https://cloud.google.com/iam/help/conditions/resource-policies).
            "description": "A String", # Optional. Description of the expression. This is a longer text which describes the expression, e.g. when hovered over it in a UI.
            "expression": "A String", # Textual representation of an expression in Common Expression Language syntax.
            "location": "A String", # Optional. String indicating the location of the expression for error reporting, e.g. a file name and a position in the file.
            "title": "A String", # Optional. Title for the expression, i.e. a short string describing its purpose. This can be used e.g. in UIs which allow to enter the expression.
          },
          "members": [ # Specifies the principals requesting access for a Google Cloud resource. `members` can have the following values: * `allUsers`: A special identifier that represents anyone who is on the internet; with or without a Google account. * `allAuthenticatedUsers`: A special identifier that represents anyone who is authenticated with a Google account or a service account. * `user:{emailid}`: An email address that represents a specific Google account. For example, `alice@example.com` . * `serviceAccount:{emailid}`: An email address that represents a Google service account. For example, `my-other-app@appspot.gserviceaccount.com`. * `serviceAccount:{projectid}.svc.id.goog[{namespace}/{kubernetes-sa}]`: An identifier for a [Kubernetes service account](https://cloud.google.com/kubernetes-engine/docs/how-to/kubernetes-service-accounts). For example, `my-project.svc.id.goog[my-namespace/my-kubernetes-sa]`. * `group:{emailid}`: An email address that represents a Google group. For example, `admins@example.com`. * `deleted:user:{emailid}?uid={uniqueid}`: An email address (plus unique identifier) representing a user that has been recently deleted. For example, `alice@example.com?uid=123456789012345678901`. If the user is recovered, this value reverts to `user:{emailid}` and the recovered user retains the role in the binding. * `deleted:serviceAccount:{emailid}?uid={uniqueid}`: An email address (plus unique identifier) representing a service account that has been recently deleted. For example, `my-other-app@appspot.gserviceaccount.com?uid=123456789012345678901`. If the service account is undeleted, this value reverts to `serviceAccount:{emailid}` and the undeleted service account retains the role in the binding. * `deleted:group:{emailid}?uid={uniqueid}`: An email address (plus unique identifier) representing a Google group that has been recently deleted. For example, `admins@example.com?uid=123456789012345678901`. If the group is recovered, this value reverts to `group:{emailid}` and the recovered group retains the role in the binding. * `domain:{domain}`: The G Suite domain (primary) that represents all the users of that domain. For example, `google.com` or `example.com`.
            "A String",
          ],
          "role": "A String", # Role that is assigned to the list of `members`, or principals. For example, `roles/viewer`, `roles/editor`, or `roles/owner`.
        },
      ],
      "etag": "A String", # `etag` is used for optimistic concurrency control as a way to help prevent simultaneous updates of a policy from overwriting each other. It is strongly suggested that systems make use of the `etag` in the read-modify-write cycle to perform policy updates in order to avoid race conditions: An `etag` is returned in the response to `getIamPolicy`, and systems are expected to put that etag in the request to `setIamPolicy` to ensure that their change will be applied to the same version of the policy. **Important:** If you use IAM Conditions, you must include the `etag` field whenever you call `setIamPolicy`. If you omit this field, then IAM allows you to overwrite a version `3` policy with a version `1` policy, and all of the conditions in the version `3` policy are lost.
      "version": 42, # Specifies the format of the policy. Valid values are `0`, `1`, and `3`. Requests that specify an invalid value are rejected. Any operation that affects conditional role bindings must specify version `3`. This requirement applies to the following operations: * Getting a policy that includes a conditional role binding * Adding a conditional role binding to a policy * Changing a conditional role binding in a policy * Removing any role binding, with or without a condition, from a policy that includes conditions **Important:** If you use IAM Conditions, you must include the `etag` field whenever you call `setIamPolicy`. If you omit this field, then IAM allows you to overwrite a version `3` policy with a version `1` policy, and all of the conditions in the version `3` policy are lost. If a policy does not include any conditions, operations on that policy may specify any valid version or leave the field unset. To learn which resources support conditions in their IAM policies, see the [IAM documentation](https://cloud.google.com/iam/help/conditions/resource-policies).
    }

`testIamPermissions(resource, body=None, x__xgafv=None)`

    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.

    Args:
      resource: string, REQUIRED: The Cloud Spanner resource for which permissions are being tested. The format is `projects//instances/` for instance resources and `projects//instances//databases/` for database resources. (required)
      body: object, The request body.
        The object takes the form of:

    { # Request message for `TestIamPermissions` method.
      "permissions": [ # REQUIRED: The set of permissions to check for 'resource'. Permissions with wildcards (such as '*', 'spanner.*', 'spanner.instances.*') are not allowed.
        "A String",
      ],
    }

      x__xgafv: string, V1 error format.
        Allowed values
          1 - v1 error format
          2 - v2 error format

    Returns:
      An object of the form:

        { # Response message for `TestIamPermissions` method.
      "permissions": [ # A subset of `TestPermissionsRequest.permissions` that the caller is allowed.
        "A String",
      ],
    }

`updateDdl(database, body=None, x__xgafv=None)`

    Updates the schema of a Cloud Spanner database by creating/altering/dropping tables, columns, indexes, etc. The returned long-running operation will have a name of the format `/operations/` and can be used to track execution of the schema change(s). The metadata field type is UpdateDatabaseDdlMetadata. The operation has no response.

    Args:
      database: string, Required. The database to update. (required)
      body: object, The request body.
        The object takes the form of:

    { # 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 `NULL` value in a column to which `NOT NULL` would be added). If a statement fails, all subsequent statements in the batch are automatically cancelled. Each batch of statements is assigned a name which can be used with the Operations API to monitor progress. See the operation_id field for more details.
      "operationId": "A String", # If empty, the new update request is assigned an automatically-generated operation ID. Otherwise, `operation_id` is used to construct the name of the resulting Operation. Specifying an explicit operation ID simplifies determining whether the statements were executed in the event that the UpdateDatabaseDdl call is replayed, or the return value is otherwise lost: the database and `operation_id` fields can be combined to form the name of the resulting longrunning.Operation: `/operations/`. `operation_id` should be unique within the database, and must be a valid identifier: `a-z*`. Note that automatically-generated operation IDs always begin with an underscore. If the named operation already exists, UpdateDatabaseDdl returns `ALREADY_EXISTS`.
      "statements": [ # Required. DDL statements to be applied to the database.
        "A String",
      ],
    }

      x__xgafv: string, V1 error format.
        Allowed values
          1 - v1 error format
          2 - v2 error format

    Returns:
      An object of the form:

        { # This resource represents a long-running operation that is the result of a network API call.
      "done": True or False, # If the value is `false`, it means the operation is still in progress. If `true`, the operation is completed, and either `error` or `response` is available.
      "error": { # The `Status` type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by [gRPC](https://github.com/grpc). Each `Status` message contains three pieces of data: error code, error message, and error details. You can find out more about this error model and how to work with it in the [API Design Guide](https://cloud.google.com/apis/design/errors). # The error result of the operation in case of failure or cancellation.
        "code": 42, # The status code, which should be an enum value of google.rpc.Code.
        "details": [ # A list of messages that carry the error details. There is a common set of message types for APIs to use.
          {
            "a_key": "", # Properties of the object. Contains field @type with type URL.
          },
        ],
        "message": "A String", # A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the google.rpc.Status.details field, or localized by the client.
      },
      "metadata": { # Service-specific metadata associated with the operation. It typically contains progress information and common metadata such as create time. Some services might not provide such metadata. Any method that returns a long-running operation should document the metadata type, if any.
        "a_key": "", # Properties of the object. Contains field @type with type URL.
      },
      "name": "A String", # The server-assigned name, which is only unique within the same service that originally returns it. If you use the default HTTP mapping, the `name` should be a resource name ending with `operations/{unique_id}`.
      "response": { # The normal response of the operation in case of success. If the original method returns no data on success, such as `Delete`, the response is `google.protobuf.Empty`. If the original method is standard `Get`/`Create`/`Update`, the response should be the resource. For other methods, the response should have the type `XxxResponse`, where `Xxx` is the original method name. For example, if the original method name is `TakeSnapshot()`, the inferred response type is `TakeSnapshotResponse`.
        "a_key": "", # Properties of the object. Contains field @type with type URL.
      },
    }