Skip to content

Commit

Permalink
feat: add ChangeStreamConfig to CreateTable and UpdateTable (#786)
Browse files Browse the repository at this point in the history
* feat: add ChangeStreamConfig to CreateTable and UpdateTable

PiperOrigin-RevId: 534836567

Source-Link: googleapis/googleapis@eb2d1f1

Source-Link: googleapis/googleapis-gen@64cebcf
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNjRjZWJjZmMyNzY1YmZmNWFmYjE5YzE0MGQ0YjE2MDBkZmRhZWJhZCJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

---------

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
  • Loading branch information
gcf-owl-bot[bot] and gcf-owl-bot[bot] committed May 25, 2023
1 parent 9e35ad2 commit cef70f2
Show file tree
Hide file tree
Showing 8 changed files with 67 additions and 18 deletions.
2 changes: 2 additions & 0 deletions google/cloud/bigtable_admin/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@
from google.cloud.bigtable_admin_v2.types.instance import Instance
from google.cloud.bigtable_admin_v2.types.table import Backup
from google.cloud.bigtable_admin_v2.types.table import BackupInfo
from google.cloud.bigtable_admin_v2.types.table import ChangeStreamConfig
from google.cloud.bigtable_admin_v2.types.table import ColumnFamily
from google.cloud.bigtable_admin_v2.types.table import EncryptionInfo
from google.cloud.bigtable_admin_v2.types.table import GcRule
Expand Down Expand Up @@ -282,6 +283,7 @@
"Instance",
"Backup",
"BackupInfo",
"ChangeStreamConfig",
"ColumnFamily",
"EncryptionInfo",
"GcRule",
Expand Down
2 changes: 2 additions & 0 deletions google/cloud/bigtable_admin_v2/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@
from .types.instance import Instance
from .types.table import Backup
from .types.table import BackupInfo
from .types.table import ChangeStreamConfig
from .types.table import ColumnFamily
from .types.table import EncryptionInfo
from .types.table import GcRule
Expand All @@ -110,6 +111,7 @@
"BackupInfo",
"BigtableInstanceAdminClient",
"BigtableTableAdminClient",
"ChangeStreamConfig",
"CheckConsistencyRequest",
"CheckConsistencyResponse",
"Cluster",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -683,16 +683,19 @@ async def update_table(
should not be set.
update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`):
Required. The list of fields to update. A mask
specifying which fields (e.g. ``deletion_protection``)
specifying which fields (e.g. ``change_stream_config``)
in the ``table`` field should be updated. This mask is
relative to the ``table`` field, not to the request
message. The wildcard (*) path is currently not
supported. Currently UpdateTable is only supported for
the following field:
the following fields:
- ``deletion_protection`` If ``column_families`` is set
in ``update_mask``, it will return an UNIMPLEMENTED
error.
- ``change_stream_config``
- ``change_stream_config.retention_period``
- ``deletion_protection``
If ``column_families`` is set in ``update_mask``, it
will return an UNIMPLEMENTED error.
This corresponds to the ``update_mask`` field
on the ``request`` instance; if ``request`` is provided, this
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -992,16 +992,19 @@ def update_table(
should not be set.
update_mask (google.protobuf.field_mask_pb2.FieldMask):
Required. The list of fields to update. A mask
specifying which fields (e.g. ``deletion_protection``)
specifying which fields (e.g. ``change_stream_config``)
in the ``table`` field should be updated. This mask is
relative to the ``table`` field, not to the request
message. The wildcard (*) path is currently not
supported. Currently UpdateTable is only supported for
the following field:
the following fields:
- ``deletion_protection`` If ``column_families`` is set
in ``update_mask``, it will return an UNIMPLEMENTED
error.
- ``change_stream_config``
- ``change_stream_config.retention_period``
- ``deletion_protection``
If ``column_families`` is set in ``update_mask``, it
will return an UNIMPLEMENTED error.
This corresponds to the ``update_mask`` field
on the ``request`` instance; if ``request`` is provided, this
Expand Down
2 changes: 2 additions & 0 deletions google/cloud/bigtable_admin_v2/types/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@
from .table import (
Backup,
BackupInfo,
ChangeStreamConfig,
ColumnFamily,
EncryptionInfo,
GcRule,
Expand Down Expand Up @@ -170,6 +171,7 @@
"Instance",
"Backup",
"BackupInfo",
"ChangeStreamConfig",
"ColumnFamily",
"EncryptionInfo",
"GcRule",
Expand Down
20 changes: 12 additions & 8 deletions google/cloud/bigtable_admin_v2/types/bigtable_table_admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -460,14 +460,18 @@ class UpdateTableRequest(proto.Message):
used to identify the table to update.
update_mask (google.protobuf.field_mask_pb2.FieldMask):
Required. The list of fields to update. A mask specifying
which fields (e.g. ``deletion_protection``) in the ``table``
field should be updated. This mask is relative to the
``table`` field, not to the request message. The wildcard
(*) path is currently not supported. Currently UpdateTable
is only supported for the following field:
- ``deletion_protection`` If ``column_families`` is set in
``update_mask``, it will return an UNIMPLEMENTED error.
which fields (e.g. ``change_stream_config``) in the
``table`` field should be updated. This mask is relative to
the ``table`` field, not to the request message. The
wildcard (*) path is currently not supported. Currently
UpdateTable is only supported for the following fields:
- ``change_stream_config``
- ``change_stream_config.retention_period``
- ``deletion_protection``
If ``column_families`` is set in ``update_mask``, it will
return an UNIMPLEMENTED error.
"""

table: gba_table.Table = proto.Field(
Expand Down
31 changes: 31 additions & 0 deletions google/cloud/bigtable_admin_v2/types/table.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
manifest={
"RestoreSourceType",
"RestoreInfo",
"ChangeStreamConfig",
"Table",
"ColumnFamily",
"GcRule",
Expand Down Expand Up @@ -82,6 +83,27 @@ class RestoreInfo(proto.Message):
)


class ChangeStreamConfig(proto.Message):
r"""Change stream configuration.
Attributes:
retention_period (google.protobuf.duration_pb2.Duration):
How long the change stream should be
retained. Change stream data older than the
retention period will not be returned when
reading the change stream from the table.
Values must be at least 1 day and at most 7
days, and will be truncated to microsecond
granularity.
"""

retention_period: duration_pb2.Duration = proto.Field(
proto.MESSAGE,
number=1,
message=duration_pb2.Duration,
)


class Table(proto.Message):
r"""A collection of user data indexed by row, column, and
timestamp. Each table is served using the resources of its
Expand Down Expand Up @@ -114,6 +136,10 @@ class Table(proto.Message):
another data source (e.g. a backup), this field
will be populated with information about the
restore.
change_stream_config (google.cloud.bigtable_admin_v2.types.ChangeStreamConfig):
If specified, enable the change stream on
this table. Otherwise, the change stream is
disabled and the change stream is not retained.
deletion_protection (bool):
Set to true to make the table protected
against data loss. i.e. deleting the following
Expand Down Expand Up @@ -263,6 +289,11 @@ class ReplicationState(proto.Enum):
number=6,
message="RestoreInfo",
)
change_stream_config: "ChangeStreamConfig" = proto.Field(
proto.MESSAGE,
number=8,
message="ChangeStreamConfig",
)
deletion_protection: bool = proto.Field(
proto.BOOL,
number=9,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8202,6 +8202,7 @@ def test_update_table_rest(request_type):
"source_table": "source_table_value",
},
},
"change_stream_config": {"retention_period": {"seconds": 751, "nanos": 543}},
"deletion_protection": True,
}
request = request_type(**request_init)
Expand Down Expand Up @@ -8399,6 +8400,7 @@ def test_update_table_rest_bad_request(
"source_table": "source_table_value",
},
},
"change_stream_config": {"retention_period": {"seconds": 751, "nanos": 543}},
"deletion_protection": True,
}
request = request_type(**request_init)
Expand Down

0 comments on commit cef70f2

Please sign in to comment.