Skip to content

Commit b95801f

Browse files
feat: add fields and the BackupType proto for Hot Backups (#1010)
* feat: add fields and the BackupType proto for Hot Backups docs: clarify comments and fix typos PiperOrigin-RevId: 658791576 Source-Link: googleapis/googleapis@c93b54f Source-Link: googleapis/googleapis-gen@e52ba38 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiZTUyYmEzOGE5NWE4MmY3NTg4ZDBkZDNhMjI4NGM5ODg1MGRhYjllMSJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * 🦉 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>
1 parent 6686abf commit b95801f

File tree

7 files changed

+86
-16
lines changed

7 files changed

+86
-16
lines changed

google/cloud/bigtable_admin_v2/services/bigtable_table_admin/async_client.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2777,7 +2777,7 @@ async def restore_table(
27772777
operation][google.longrunning.Operation] can be used to track
27782778
the progress of the operation, and to cancel it. The
27792779
[metadata][google.longrunning.Operation.metadata] field type is
2780-
[RestoreTableMetadata][google.bigtable.admin.RestoreTableMetadata].
2780+
[RestoreTableMetadata][google.bigtable.admin.v2.RestoreTableMetadata].
27812781
The [response][google.longrunning.Operation.response] type is
27822782
[Table][google.bigtable.admin.v2.Table], if successful.
27832783
@@ -2862,8 +2862,8 @@ async def copy_backup(
28622862
[CopyBackup][google.bigtable.admin.v2.BigtableTableAdmin.CopyBackup].
28632863
parent (:class:`str`):
28642864
Required. The name of the destination cluster that will
2865-
contain the backup copy. The cluster must already
2866-
exists. Values are of the form:
2865+
contain the backup copy. The cluster must already exist.
2866+
Values are of the form:
28672867
``projects/{project}/instances/{instance}/clusters/{cluster}``.
28682868
28692869
This corresponds to the ``parent`` field

google/cloud/bigtable_admin_v2/services/bigtable_table_admin/client.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3245,7 +3245,7 @@ def restore_table(
32453245
operation][google.longrunning.Operation] can be used to track
32463246
the progress of the operation, and to cancel it. The
32473247
[metadata][google.longrunning.Operation.metadata] field type is
3248-
[RestoreTableMetadata][google.bigtable.admin.RestoreTableMetadata].
3248+
[RestoreTableMetadata][google.bigtable.admin.v2.RestoreTableMetadata].
32493249
The [response][google.longrunning.Operation.response] type is
32503250
[Table][google.bigtable.admin.v2.Table], if successful.
32513251
@@ -3328,8 +3328,8 @@ def copy_backup(
33283328
[CopyBackup][google.bigtable.admin.v2.BigtableTableAdmin.CopyBackup].
33293329
parent (str):
33303330
Required. The name of the destination cluster that will
3331-
contain the backup copy. The cluster must already
3332-
exists. Values are of the form:
3331+
contain the backup copy. The cluster must already exist.
3332+
Values are of the form:
33333333
``projects/{project}/instances/{instance}/clusters/{cluster}``.
33343334
33353335
This corresponds to the ``parent`` field

google/cloud/bigtable_admin_v2/services/bigtable_table_admin/transports/grpc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1019,7 +1019,7 @@ def restore_table(
10191019
operation][google.longrunning.Operation] can be used to track
10201020
the progress of the operation, and to cancel it. The
10211021
[metadata][google.longrunning.Operation.metadata] field type is
1022-
[RestoreTableMetadata][google.bigtable.admin.RestoreTableMetadata].
1022+
[RestoreTableMetadata][google.bigtable.admin.v2.RestoreTableMetadata].
10231023
The [response][google.longrunning.Operation.response] type is
10241024
[Table][google.bigtable.admin.v2.Table], if successful.
10251025

google/cloud/bigtable_admin_v2/services/bigtable_table_admin/transports/grpc_asyncio.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1048,7 +1048,7 @@ def restore_table(
10481048
operation][google.longrunning.Operation] can be used to track
10491049
the progress of the operation, and to cancel it. The
10501050
[metadata][google.longrunning.Operation.metadata] field type is
1051-
[RestoreTableMetadata][google.bigtable.admin.RestoreTableMetadata].
1051+
[RestoreTableMetadata][google.bigtable.admin.v2.RestoreTableMetadata].
10521052
The [response][google.longrunning.Operation.response] type is
10531053
[Table][google.bigtable.admin.v2.Table], if successful.
10541054

google/cloud/bigtable_admin_v2/types/bigtable_table_admin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1356,7 +1356,7 @@ class CopyBackupRequest(proto.Message):
13561356
Attributes:
13571357
parent (str):
13581358
Required. The name of the destination cluster that will
1359-
contain the backup copy. The cluster must already exists.
1359+
contain the backup copy. The cluster must already exist.
13601360
Values are of the form:
13611361
``projects/{project}/instances/{instance}/clusters/{cluster}``.
13621362
backup_id (str):

google/cloud/bigtable_admin_v2/types/table.py

Lines changed: 59 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -781,13 +781,18 @@ class Backup(proto.Message):
781781
this backup was copied. If a backup is not
782782
created by copying a backup, this field will be
783783
empty. Values are of the form:
784-
projects/<project>/instances/<instance>/backups/<backup>.
784+
785+
projects/<project>/instances/<instance>/clusters/<cluster>/backups/<backup>
785786
expire_time (google.protobuf.timestamp_pb2.Timestamp):
786-
Required. The expiration time of the backup, with
787-
microseconds granularity that must be at least 6 hours and
788-
at most 90 days from the time the request is received. Once
789-
the ``expire_time`` has passed, Cloud Bigtable will delete
790-
the backup and free the resources used by the backup.
787+
Required. The expiration time of the backup. When creating a
788+
backup or updating its ``expire_time``, the value must be
789+
greater than the backup creation time by:
790+
791+
- At least 6 hours
792+
- At most 90 days
793+
794+
Once the ``expire_time`` has passed, Cloud Bigtable will
795+
delete the backup.
791796
start_time (google.protobuf.timestamp_pb2.Timestamp):
792797
Output only. ``start_time`` is the time that the backup was
793798
started (i.e. approximately the time the
@@ -805,6 +810,20 @@ class Backup(proto.Message):
805810
encryption_info (google.cloud.bigtable_admin_v2.types.EncryptionInfo):
806811
Output only. The encryption information for
807812
the backup.
813+
backup_type (google.cloud.bigtable_admin_v2.types.Backup.BackupType):
814+
Indicates the backup type of the backup.
815+
hot_to_standard_time (google.protobuf.timestamp_pb2.Timestamp):
816+
The time at which the hot backup will be converted to a
817+
standard backup. Once the ``hot_to_standard_time`` has
818+
passed, Cloud Bigtable will convert the hot backup to a
819+
standard backup. This value must be greater than the backup
820+
creation time by:
821+
822+
- At least 24 hours
823+
824+
This field only applies for hot backups. When creating or
825+
updating a standard backup, attempting to set this field
826+
will fail the request.
808827
"""
809828

810829
class State(proto.Enum):
@@ -823,6 +842,28 @@ class State(proto.Enum):
823842
CREATING = 1
824843
READY = 2
825844

845+
class BackupType(proto.Enum):
846+
r"""The type of the backup.
847+
848+
Values:
849+
BACKUP_TYPE_UNSPECIFIED (0):
850+
Not specified.
851+
STANDARD (1):
852+
The default type for Cloud Bigtable managed
853+
backups. Supported for backups created in both
854+
HDD and SSD instances. Requires optimization
855+
when restored to a table in an SSD instance.
856+
HOT (2):
857+
A backup type with faster restore to SSD
858+
performance. Only supported for backups created
859+
in SSD instances. A new SSD table restored from
860+
a hot backup reaches production performance more
861+
quickly than a standard backup.
862+
"""
863+
BACKUP_TYPE_UNSPECIFIED = 0
864+
STANDARD = 1
865+
HOT = 2
866+
826867
name: str = proto.Field(
827868
proto.STRING,
828869
number=1,
@@ -864,6 +905,16 @@ class State(proto.Enum):
864905
number=9,
865906
message="EncryptionInfo",
866907
)
908+
backup_type: BackupType = proto.Field(
909+
proto.ENUM,
910+
number=11,
911+
enum=BackupType,
912+
)
913+
hot_to_standard_time: timestamp_pb2.Timestamp = proto.Field(
914+
proto.MESSAGE,
915+
number=12,
916+
message=timestamp_pb2.Timestamp,
917+
)
867918

868919

869920
class BackupInfo(proto.Message):
@@ -888,7 +939,8 @@ class BackupInfo(proto.Message):
888939
this backup was copied. If a backup is not
889940
created by copying a backup, this field will be
890941
empty. Values are of the form:
891-
projects/<project>/instances/<instance>/backups/<backup>.
942+
943+
projects/<project>/instances/<instance>/clusters/<cluster>/backups/<backup>
892944
"""
893945

894946
backup: str = proto.Field(

tests/unit/gapic/bigtable_admin_v2/test_bigtable_table_admin.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9753,6 +9753,7 @@ def test_get_backup(request_type, transport: str = "grpc"):
97539753
source_backup="source_backup_value",
97549754
size_bytes=1089,
97559755
state=table.Backup.State.CREATING,
9756+
backup_type=table.Backup.BackupType.STANDARD,
97569757
)
97579758
response = client.get_backup(request)
97589759

@@ -9769,6 +9770,7 @@ def test_get_backup(request_type, transport: str = "grpc"):
97699770
assert response.source_backup == "source_backup_value"
97709771
assert response.size_bytes == 1089
97719772
assert response.state == table.Backup.State.CREATING
9773+
assert response.backup_type == table.Backup.BackupType.STANDARD
97729774

97739775

97749776
def test_get_backup_empty_call():
@@ -9872,6 +9874,7 @@ async def test_get_backup_empty_call_async():
98729874
source_backup="source_backup_value",
98739875
size_bytes=1089,
98749876
state=table.Backup.State.CREATING,
9877+
backup_type=table.Backup.BackupType.STANDARD,
98759878
)
98769879
)
98779880
response = await client.get_backup()
@@ -9942,6 +9945,7 @@ async def test_get_backup_async(
99429945
source_backup="source_backup_value",
99439946
size_bytes=1089,
99449947
state=table.Backup.State.CREATING,
9948+
backup_type=table.Backup.BackupType.STANDARD,
99459949
)
99469950
)
99479951
response = await client.get_backup(request)
@@ -9959,6 +9963,7 @@ async def test_get_backup_async(
99599963
assert response.source_backup == "source_backup_value"
99609964
assert response.size_bytes == 1089
99619965
assert response.state == table.Backup.State.CREATING
9966+
assert response.backup_type == table.Backup.BackupType.STANDARD
99629967

99639968

99649969
@pytest.mark.asyncio
@@ -10131,6 +10136,7 @@ def test_update_backup(request_type, transport: str = "grpc"):
1013110136
source_backup="source_backup_value",
1013210137
size_bytes=1089,
1013310138
state=table.Backup.State.CREATING,
10139+
backup_type=table.Backup.BackupType.STANDARD,
1013410140
)
1013510141
response = client.update_backup(request)
1013610142

@@ -10147,6 +10153,7 @@ def test_update_backup(request_type, transport: str = "grpc"):
1014710153
assert response.source_backup == "source_backup_value"
1014810154
assert response.size_bytes == 1089
1014910155
assert response.state == table.Backup.State.CREATING
10156+
assert response.backup_type == table.Backup.BackupType.STANDARD
1015010157

1015110158

1015210159
def test_update_backup_empty_call():
@@ -10246,6 +10253,7 @@ async def test_update_backup_empty_call_async():
1024610253
source_backup="source_backup_value",
1024710254
size_bytes=1089,
1024810255
state=table.Backup.State.CREATING,
10256+
backup_type=table.Backup.BackupType.STANDARD,
1024910257
)
1025010258
)
1025110259
response = await client.update_backup()
@@ -10319,6 +10327,7 @@ async def test_update_backup_async(
1031910327
source_backup="source_backup_value",
1032010328
size_bytes=1089,
1032110329
state=table.Backup.State.CREATING,
10330+
backup_type=table.Backup.BackupType.STANDARD,
1032210331
)
1032310332
)
1032410333
response = await client.update_backup(request)
@@ -10336,6 +10345,7 @@ async def test_update_backup_async(
1033610345
assert response.source_backup == "source_backup_value"
1033710346
assert response.size_bytes == 1089
1033810347
assert response.state == table.Backup.State.CREATING
10348+
assert response.backup_type == table.Backup.BackupType.STANDARD
1033910349

1034010350

1034110351
@pytest.mark.asyncio
@@ -19957,6 +19967,8 @@ def test_create_backup_rest(request_type):
1995719967
},
1995819968
"kms_key_version": "kms_key_version_value",
1995919969
},
19970+
"backup_type": 1,
19971+
"hot_to_standard_time": {},
1996019972
}
1996119973
# The version of a generated dependency at test runtime may differ from the version used during generation.
1996219974
# Delete any fields which are not present in the current runtime dependency
@@ -20368,6 +20380,7 @@ def test_get_backup_rest(request_type):
2036820380
source_backup="source_backup_value",
2036920381
size_bytes=1089,
2037020382
state=table.Backup.State.CREATING,
20383+
backup_type=table.Backup.BackupType.STANDARD,
2037120384
)
2037220385

2037320386
# Wrap the value into a proper Response obj
@@ -20388,6 +20401,7 @@ def test_get_backup_rest(request_type):
2038820401
assert response.source_backup == "source_backup_value"
2038920402
assert response.size_bytes == 1089
2039020403
assert response.state == table.Backup.State.CREATING
20404+
assert response.backup_type == table.Backup.BackupType.STANDARD
2039120405

2039220406

2039320407
def test_get_backup_rest_use_cached_wrapped_rpc():
@@ -20697,6 +20711,8 @@ def test_update_backup_rest(request_type):
2069720711
},
2069820712
"kms_key_version": "kms_key_version_value",
2069920713
},
20714+
"backup_type": 1,
20715+
"hot_to_standard_time": {},
2070020716
}
2070120717
# The version of a generated dependency at test runtime may differ from the version used during generation.
2070220718
# Delete any fields which are not present in the current runtime dependency
@@ -20776,6 +20792,7 @@ def get_message_fields(field):
2077620792
source_backup="source_backup_value",
2077720793
size_bytes=1089,
2077820794
state=table.Backup.State.CREATING,
20795+
backup_type=table.Backup.BackupType.STANDARD,
2077920796
)
2078020797

2078120798
# Wrap the value into a proper Response obj
@@ -20796,6 +20813,7 @@ def get_message_fields(field):
2079620813
assert response.source_backup == "source_backup_value"
2079720814
assert response.size_bytes == 1089
2079820815
assert response.state == table.Backup.State.CREATING
20816+
assert response.backup_type == table.Backup.BackupType.STANDARD
2079920817

2080020818

2080120819
def test_update_backup_rest_use_cached_wrapped_rpc():

0 commit comments

Comments
 (0)