Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(spanner): add instance replica info; annotate protos, update docstrings (via synth) #9577

Merged
merged 1 commit into from
Nov 12, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,7 @@ def update_database_ddl(

Args:
database (str): Required. The database to update.
statements (list[str]): DDL statements to be applied to the database.
statements (list[str]): Required. DDL statements to be applied to the database.
operation_id (str): 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``.
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ def CreateDatabase(self, request, context):
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
[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.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
Expand All @@ -116,8 +116,7 @@ def UpdateDatabaseDdl(self, request, context):
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.
[UpdateDatabaseDdlMetadata][google.spanner.admin.database.v1.UpdateDatabaseDdlMetadata]. The operation has no response.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details("Method not implemented!")
Expand All @@ -140,19 +139,20 @@ def GetDatabaseDdl(self, request, context):
raise NotImplementedError("Method not implemented!")

def SetIamPolicy(self, request, context):
"""Sets the access control policy on a database resource. Replaces any
existing policy.
"""Sets the access control policy on a database resource.
Replaces any existing policy.

Authorization requires `spanner.databases.setIamPolicy` permission on
[resource][google.iam.v1.SetIamPolicyRequest.resource].
Authorization requires `spanner.databases.setIamPolicy`
permission on [resource][google.iam.v1.SetIamPolicyRequest.resource].
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details("Method not implemented!")
raise NotImplementedError("Method not implemented!")

def GetIamPolicy(self, request, context):
"""Gets the access control policy for a database resource. Returns an empty
policy if a database exists but does not have a policy set.
"""Gets the access control policy for a database resource.
Returns an empty policy if a database exists but does
not have a policy set.

Authorization requires `spanner.databases.getIamPolicy` permission on
[resource][google.iam.v1.GetIamPolicyRequest.resource].
Expand All @@ -164,10 +164,10 @@ def GetIamPolicy(self, request, context):
def TestIamPermissions(self, request, context):
"""Returns permissions that the caller has on the specified database 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.
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.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details("Method not implemented!")
Expand Down
37 changes: 37 additions & 0 deletions spanner/google/cloud/spanner_admin_instance_v1/gapic/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,40 @@ class State(enum.IntEnum):
STATE_UNSPECIFIED = 0
CREATING = 1
READY = 2


class ReplicaInfo(object):
class ReplicaType(enum.IntEnum):
"""
Indicates the type of replica. See the `replica types
documentation <https://cloud.google.com/spanner/docs/replication#replica_types>`__
for more details.

Attributes:
TYPE_UNSPECIFIED (int): Not specified.
READ_WRITE (int): Read-write replicas support both reads and writes. These replicas:

- Maintain a full copy of your data.
- Serve reads.
- Can vote whether to commit a write.
- Participate in leadership election.
- Are eligible to become a leader.
READ_ONLY (int): Read-only replicas only support reads (not writes). Read-only replicas:

- Maintain a full copy of your data.
- Serve reads.
- Do not participate in voting to commit writes.
- Are not eligible to become a leader.
WITNESS (int): Witness replicas don't support reads but do participate in voting to
commit writes. Witness replicas:

- Do not maintain a full copy of data.
- Do not serve reads.
- Vote whether to commit writes.
- Participate in leader election but are not eligible to become leader.
"""

TYPE_UNSPECIFIED = 0
READ_WRITE = 1
READ_ONLY = 2
WITNESS = 3
Original file line number Diff line number Diff line change
Expand Up @@ -679,7 +679,7 @@ def create_instance(
parent (str): Required. The name of the project in which to create the instance.
Values are of the form ``projects/<project>``.
instance_id (str): Required. The ID of the instance to create. Valid identifiers are of the
form ``[a-z][-a-z0-9]*[a-z0-9]`` and must be between 6 and 30 characters
form ``[a-z][-a-z0-9]*[a-z0-9]`` and must be between 2 and 64 characters
in length.
instance (Union[dict, ~google.cloud.spanner_admin_instance_v1.types.Instance]): Required. The instance to create. The name may be omitted, but if
specified must be ``<parent>/instances/<instance_id>``.
Expand Down
Loading