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: update gapic-generator and go microgen, backups generated api #55

Merged
merged 5 commits into from Jun 15, 2020
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions google/cloud/bigtable/cluster.py
Expand Up @@ -291,11 +291,11 @@ def update(self):
update operation.
"""
client = self._instance._client
# We are passing `None` for second argument location.
# We are passing `None` for third argument location.
# Location is set only at the time of creation of a cluster
# and can not be changed after cluster has been created.
return client.instance_admin_client.update_cluster(
self.name, self.serve_nodes, None
name=self.name, serve_nodes=self.serve_nodes, location=None
)

def delete(self):
Expand Down
4 changes: 2 additions & 2 deletions google/cloud/bigtable_admin_v2/__init__.py
Expand Up @@ -27,8 +27,8 @@

if sys.version_info[:2] == (2, 7):
message = (
"A future version of this library will drop support for Python 2.7."
"More details about Python 2 support for Google Cloud Client Libraries"
"A future version of this library will drop support for Python 2.7. "
"More details about Python 2 support for Google Cloud Client Libraries "
"can be found at https://cloud.google.com/python/docs/python2-sunset/"
)
warnings.warn(message, DeprecationWarning)
Expand Down
187 changes: 94 additions & 93 deletions google/cloud/bigtable_admin_v2/gapic/bigtable_instance_admin_client.py

Large diffs are not rendered by default.

786 changes: 703 additions & 83 deletions google/cloud/bigtable_admin_v2/gapic/bigtable_table_admin_client.py

Large diffs are not rendered by default.

Expand Up @@ -124,6 +124,36 @@
"retry_codes_name": "non_idempotent",
"retry_params_name": "non_idempotent_params",
},
"CreateBackup": {
"timeout_millis": 60000,
"retry_codes_name": "non_idempotent",
"retry_params_name": "non_idempotent_params",
},
"GetBackup": {
"timeout_millis": 60000,
"retry_codes_name": "idempotent",
"retry_params_name": "idempotent_params",
},
"ListBackups": {
"timeout_millis": 60000,
"retry_codes_name": "idempotent",
"retry_params_name": "idempotent_params",
},
"UpdateBackup": {
"timeout_millis": 60000,
"retry_codes_name": "non_idempotent",
"retry_params_name": "non_idempotent_params",
},
"DeleteBackup": {
"timeout_millis": 60000,
"retry_codes_name": "non_idempotent",
"retry_params_name": "non_idempotent_params",
},
"RestoreTable": {
"timeout_millis": 60000,
"retry_codes_name": "non_idempotent",
"retry_params_name": "non_idempotent_params",
},
},
}
}
Expand Down
48 changes: 41 additions & 7 deletions google/cloud/bigtable_admin_v2/gapic/enums.py
Expand Up @@ -19,6 +19,19 @@
import enum


class RestoreSourceType(enum.IntEnum):
"""
Indicates the type of the restore source.

Attributes:
RESTORE_SOURCE_TYPE_UNSPECIFIED (int): No restore associated.
BACKUP (int): A backup was used as the source of the restore.
"""

RESTORE_SOURCE_TYPE_UNSPECIFIED = 0
BACKUP = 1


class StorageType(enum.IntEnum):
"""
Storage media types for persisting Bigtable data.
Expand All @@ -34,6 +47,23 @@ class StorageType(enum.IntEnum):
HDD = 2


class Backup(object):
class State(enum.IntEnum):
"""
Indicates the current state of the backup.

Attributes:
STATE_UNSPECIFIED (int): Not specified.
CREATING (int): The pending backup is still being created. Operations on the backup
may fail with ``FAILED_PRECONDITION`` in this state.
READY (int): The backup is complete and ready for use.
"""

STATE_UNSPECIFIED = 0
CREATING = 1
READY = 2


class Cluster(object):
class State(enum.IntEnum):
"""
Expand Down Expand Up @@ -86,11 +116,11 @@ class Type(enum.IntEnum):
TYPE_UNSPECIFIED (int): The type of the instance is unspecified. If set when creating an
instance, a ``PRODUCTION`` instance will be created. If set when
updating an instance, the type will be left unchanged.
PRODUCTION (int): An instance meant for production use. ``serve_nodes`` must be set on the
cluster.
DEVELOPMENT (int): The instance is meant for development and testing purposes only; it has
no performance or uptime guarantees and is not covered by SLA. After a
development instance is created, it can be upgraded by updating the
PRODUCTION (int): An instance meant for production use. ``serve_nodes`` must be set on
the cluster.
DEVELOPMENT (int): The instance is meant for development and testing purposes only; it
has no performance or uptime guarantees and is not covered by SLA. After
a development instance is created, it can be upgraded by updating the
instance to type ``PRODUCTION``. An instance created as a production
instance cannot be changed to a development instance. When creating a
development instance, ``serve_nodes`` on the cluster must not be set.
Expand Down Expand Up @@ -142,8 +172,8 @@ class View(enum.IntEnum):
VIEW_UNSPECIFIED (int): Uses the default view for each method as documented in its request.
NAME_ONLY (int): Only populates ``name``.
SCHEMA_VIEW (int): Only populates ``name`` and fields related to the table's schema.
REPLICATION_VIEW (int): Only populates ``name`` and fields related to the table's replication
state.
REPLICATION_VIEW (int): Only populates ``name`` and fields related to the table's
replication state.
FULL (int): Populates all fields.
"""

Expand All @@ -170,10 +200,14 @@ class ReplicationState(enum.IntEnum):
READY (int): The table can serve Data API requests from this cluster. Depending on
replication delay, reads may not immediately reflect the state of the
table in other clusters.
READY_OPTIMIZING (int): The table is fully created and ready for use after a restore, and is
being optimized for performance. When optimizations are complete, the
table will transition to ``READY`` state.
"""

STATE_NOT_KNOWN = 0
INITIALIZING = 1
PLANNED_MAINTENANCE = 2
UNPLANNED_MAINTENANCE = 3
READY = 4
READY_OPTIMIZING = 5
Expand Up @@ -170,7 +170,9 @@ def list_instances(self):
def update_instance(self):
"""Return the gRPC stub for :meth:`BigtableInstanceAdminClient.update_instance`.

Updates an instance within a project.
Updates an instance within a project. This method updates only the display
name and type for an Instance. To update other Instance properties, such as
labels, use PartialUpdateInstance.

Returns:
Callable: A callable which accepts the appropriate
Expand All @@ -183,7 +185,8 @@ def update_instance(self):
def partial_update_instance(self):
"""Return the gRPC stub for :meth:`BigtableInstanceAdminClient.partial_update_instance`.

Partially updates an instance within a project.
Partially updates an instance within a project. This method can modify all
fields of an Instance and is the preferred way to update an Instance.

Returns:
Callable: A callable which accepts the appropriate
Expand Down
Expand Up @@ -267,8 +267,9 @@ def check_consistency(self):
def get_iam_policy(self):
"""Return the gRPC stub for :meth:`BigtableTableAdminClient.get_iam_policy`.

Gets the access control policy for a table resource. Returns an empty
policy if an table exists but does not have a policy set.
Gets the access control policy for a resource.
Returns an empty policy if the resource exists but does not have a policy
set.

Returns:
Callable: A callable which accepts the appropriate
Expand All @@ -281,8 +282,8 @@ def get_iam_policy(self):
def set_iam_policy(self):
"""Return the gRPC stub for :meth:`BigtableTableAdminClient.set_iam_policy`.

Sets the access control policy on a table resource. Replaces any existing
policy.
Sets the access control policy on a Table or Backup resource.
Replaces any existing policy.

Returns:
Callable: A callable which accepts the appropriate
Expand Down Expand Up @@ -380,3 +381,91 @@ def delete_snapshot(self):
deserialized response object.
"""
return self._stubs["bigtable_table_admin_stub"].DeleteSnapshot

@property
def create_backup(self):
"""Return the gRPC stub for :meth:`BigtableTableAdminClient.create_backup`.

Starts creating a new Cloud Bigtable Backup. The returned backup
``long-running operation`` can be used to track creation of the backup.
The ``metadata`` field type is ``CreateBackupMetadata``. The
``response`` field type is ``Backup``, if successful. Cancelling the
returned operation will stop the creation and delete the backup.

Returns:
Callable: A callable which accepts the appropriate
deserialized request object and returns a
deserialized response object.
"""
return self._stubs["bigtable_table_admin_stub"].CreateBackup

@property
def get_backup(self):
"""Return the gRPC stub for :meth:`BigtableTableAdminClient.get_backup`.

Gets metadata on a pending or completed Cloud Bigtable Backup.

Returns:
Callable: A callable which accepts the appropriate
deserialized request object and returns a
deserialized response object.
"""
return self._stubs["bigtable_table_admin_stub"].GetBackup

@property
def list_backups(self):
"""Return the gRPC stub for :meth:`BigtableTableAdminClient.list_backups`.

Lists Cloud Bigtable backups. Returns both completed and pending
backups.

Returns:
Callable: A callable which accepts the appropriate
deserialized request object and returns a
deserialized response object.
"""
return self._stubs["bigtable_table_admin_stub"].ListBackups

@property
def update_backup(self):
"""Return the gRPC stub for :meth:`BigtableTableAdminClient.update_backup`.

Updates a pending or completed Cloud Bigtable Backup.

Returns:
Callable: A callable which accepts the appropriate
deserialized request object and returns a
deserialized response object.
"""
return self._stubs["bigtable_table_admin_stub"].UpdateBackup

@property
def delete_backup(self):
"""Return the gRPC stub for :meth:`BigtableTableAdminClient.delete_backup`.

Deletes a pending or completed Cloud Bigtable backup.

Returns:
Callable: A callable which accepts the appropriate
deserialized request object and returns a
deserialized response object.
"""
return self._stubs["bigtable_table_admin_stub"].DeleteBackup

@property
def restore_table(self):
"""Return the gRPC stub for :meth:`BigtableTableAdminClient.restore_table`.

Create a new table by restoring from a completed backup. The new
table must be in the same instance as the instance containing the
backup. The returned table ``long-running operation`` can be used to
track the progress of the operation, and to cancel it. The ``metadata``
field type is ``RestoreTableMetadata``. The ``response`` type is
``Table``, if successful.

Returns:
Callable: A callable which accepts the appropriate
deserialized request object and returns a
deserialized response object.
"""
return self._stubs["bigtable_table_admin_stub"].RestoreTable