Skip to content

Commit b503fc9

Browse files
feat(spanner): Add resource reference annotation to backup schedules (#1176)
* feat(spanner): Add support for Cloud Spanner Incremental Backups PiperOrigin-RevId: 657612329 Source-Link: googleapis/googleapis@e77b669 Source-Link: googleapis/googleapis-gen@0f66346 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMGY2NjM0NjlmM2VkY2MzNGM2MGMxYmJlMDE3MjdjYzVlYjk3MWM2MCJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * chore: Update gapic-generator-python to v1.18.5 PiperOrigin-RevId: 661268868 Source-Link: googleapis/googleapis@f7d214c Source-Link: googleapis/googleapis-gen@79a8411 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNzlhODQxMWJiZGIyNWE5ODNmYTNhYWU4YzBlMTQzMjdkZjEyOWY5NCJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * feat(spanner): add edition field to the instance proto PiperOrigin-RevId: 662226829 Source-Link: googleapis/googleapis@eb87f47 Source-Link: googleapis/googleapis-gen@0fb784e Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMGZiNzg0ZTgyNjdmMDkzMWQyNGYxNTJlYzVmNjZlODA5YzJhMmVmYiJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * feat(spanner): Add resource reference annotation to backup schedules docs(spanner): Add an example to filter backups based on schedule name PiperOrigin-RevId: 662402292 Source-Link: googleapis/googleapis@96facec Source-Link: googleapis/googleapis-gen@fe33f1c Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiZmUzM2YxYzYxNDE1YWVmNGU3MGY0OTFkZmI4Nzg5YTY4ZThkOTA4MyJ9 * 🦉 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> Co-authored-by: Sri Harsha CH <[email protected]>
1 parent 55f83dc commit b503fc9

27 files changed

+2419
-562
lines changed

google/cloud/spanner_admin_database_v1/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
from .types.backup import DeleteBackupRequest
3333
from .types.backup import FullBackupSpec
3434
from .types.backup import GetBackupRequest
35+
from .types.backup import IncrementalBackupSpec
3536
from .types.backup import ListBackupOperationsRequest
3637
from .types.backup import ListBackupOperationsResponse
3738
from .types.backup import ListBackupsRequest
@@ -108,6 +109,7 @@
108109
"GetDatabaseDdlRequest",
109110
"GetDatabaseDdlResponse",
110111
"GetDatabaseRequest",
112+
"IncrementalBackupSpec",
111113
"ListBackupOperationsRequest",
112114
"ListBackupOperationsResponse",
113115
"ListBackupSchedulesRequest",

google/cloud/spanner_admin_database_v1/services/database_admin/async_client.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
# limitations under the License.
1515
#
1616
from collections import OrderedDict
17-
import functools
1817
import re
1918
from typing import (
2019
Dict,
@@ -230,9 +229,7 @@ def universe_domain(self) -> str:
230229
"""
231230
return self._client._universe_domain
232231

233-
get_transport_class = functools.partial(
234-
type(DatabaseAdminClient).get_transport_class, type(DatabaseAdminClient)
235-
)
232+
get_transport_class = DatabaseAdminClient.get_transport_class
236233

237234
def __init__(
238235
self,

google/cloud/spanner_admin_database_v1/services/database_admin/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -819,7 +819,7 @@ def __init__(
819819
transport_init: Union[
820820
Type[DatabaseAdminTransport], Callable[..., DatabaseAdminTransport]
821821
] = (
822-
type(self).get_transport_class(transport)
822+
DatabaseAdminClient.get_transport_class(transport)
823823
if isinstance(transport, str) or transport is None
824824
else cast(Callable[..., DatabaseAdminTransport], transport)
825825
)

google/cloud/spanner_admin_database_v1/types/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
DeleteBackupRequest,
2626
FullBackupSpec,
2727
GetBackupRequest,
28+
IncrementalBackupSpec,
2829
ListBackupOperationsRequest,
2930
ListBackupOperationsResponse,
3031
ListBackupsRequest,
@@ -88,6 +89,7 @@
8889
"DeleteBackupRequest",
8990
"FullBackupSpec",
9091
"GetBackupRequest",
92+
"IncrementalBackupSpec",
9193
"ListBackupOperationsRequest",
9294
"ListBackupOperationsResponse",
9395
"ListBackupsRequest",

google/cloud/spanner_admin_database_v1/types/backup.py

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
"CreateBackupEncryptionConfig",
4545
"CopyBackupEncryptionConfig",
4646
"FullBackupSpec",
47+
"IncrementalBackupSpec",
4748
},
4849
)
4950

@@ -98,6 +99,30 @@ class Backup(proto.Message):
9899
equivalent to the ``create_time``.
99100
size_bytes (int):
100101
Output only. Size of the backup in bytes.
102+
freeable_size_bytes (int):
103+
Output only. The number of bytes that will be
104+
freed by deleting this backup. This value will
105+
be zero if, for example, this backup is part of
106+
an incremental backup chain and younger backups
107+
in the chain require that we keep its data. For
108+
backups not in an incremental backup chain, this
109+
is always the size of the backup. This value may
110+
change if backups on the same chain get created,
111+
deleted or expired.
112+
exclusive_size_bytes (int):
113+
Output only. For a backup in an incremental
114+
backup chain, this is the storage space needed
115+
to keep the data that has changed since the
116+
previous backup. For all other backups, this is
117+
always the size of the backup. This value may
118+
change if backups on the same chain get deleted
119+
or expired.
120+
121+
This field can be used to calculate the total
122+
storage space used by a set of backups. For
123+
example, the total space used by all backups of
124+
a database can be computed by summing up this
125+
field.
101126
state (google.cloud.spanner_admin_database_v1.types.Backup.State):
102127
Output only. The current state of the backup.
103128
referencing_databases (MutableSequence[str]):
@@ -156,6 +181,24 @@ class Backup(proto.Message):
156181
If collapsing is not done, then this field
157182
captures the single backup schedule URI
158183
associated with creating this backup.
184+
incremental_backup_chain_id (str):
185+
Output only. Populated only for backups in an incremental
186+
backup chain. Backups share the same chain id if and only if
187+
they belong to the same incremental backup chain. Use this
188+
field to determine which backups are part of the same
189+
incremental backup chain. The ordering of backups in the
190+
chain can be determined by ordering the backup
191+
``version_time``.
192+
oldest_version_time (google.protobuf.timestamp_pb2.Timestamp):
193+
Output only. Data deleted at a time older
194+
than this is guaranteed not to be retained in
195+
order to support this backup. For a backup in an
196+
incremental backup chain, this is the version
197+
time of the oldest backup that exists or ever
198+
existed in the chain. For all other backups,
199+
this is the version time of the backup. This
200+
field can be used to understand what data is
201+
being retained by the backup system.
159202
"""
160203

161204
class State(proto.Enum):
@@ -201,6 +244,14 @@ class State(proto.Enum):
201244
proto.INT64,
202245
number=5,
203246
)
247+
freeable_size_bytes: int = proto.Field(
248+
proto.INT64,
249+
number=15,
250+
)
251+
exclusive_size_bytes: int = proto.Field(
252+
proto.INT64,
253+
number=16,
254+
)
204255
state: State = proto.Field(
205256
proto.ENUM,
206257
number=6,
@@ -240,6 +291,15 @@ class State(proto.Enum):
240291
proto.STRING,
241292
number=14,
242293
)
294+
incremental_backup_chain_id: str = proto.Field(
295+
proto.STRING,
296+
number=17,
297+
)
298+
oldest_version_time: timestamp_pb2.Timestamp = proto.Field(
299+
proto.MESSAGE,
300+
number=18,
301+
message=timestamp_pb2.Timestamp,
302+
)
243303

244304

245305
class CreateBackupRequest(proto.Message):
@@ -553,6 +613,7 @@ class ListBackupsRequest(proto.Message):
553613
- ``version_time`` (and values are of the format
554614
YYYY-MM-DDTHH:MM:SSZ)
555615
- ``size_bytes``
616+
- ``backup_schedules``
556617
557618
You can combine multiple expressions by enclosing each
558619
expression in parentheses. By default, expressions are
@@ -576,6 +637,8 @@ class ListBackupsRequest(proto.Message):
576637
``expire_time`` is before 2018-03-28T14:50:00Z.
577638
- ``size_bytes > 10000000000`` - The backup's size is
578639
greater than 10GB
640+
- ``backup_schedules:daily`` - The backup is created from a
641+
schedule with "daily" in its name.
579642
page_size (int):
580643
Number of backups to be returned in the
581644
response. If 0 or less, defaults to the server's
@@ -999,4 +1062,15 @@ class FullBackupSpec(proto.Message):
9991062
"""
10001063

10011064

1065+
class IncrementalBackupSpec(proto.Message):
1066+
r"""The specification for incremental backup chains.
1067+
An incremental backup stores the delta of changes between a
1068+
previous backup and the database contents at a given version
1069+
time. An incremental backup chain consists of a full backup and
1070+
zero or more successive incremental backups. The first backup
1071+
created for an incremental backup chain is always a full backup.
1072+
1073+
"""
1074+
1075+
10021076
__all__ = tuple(sorted(__protobuf__.manifest))

google/cloud/spanner_admin_database_v1/types/backup_schedule.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,10 @@ class BackupSchedule(proto.Message):
6666
specification for a Spanner database.
6767
Next ID: 10
6868
69+
This message has `oneof`_ fields (mutually exclusive fields).
70+
For each oneof, at most one member field can be set at the same time.
71+
Setting any member of the oneof automatically clears all other
72+
members.
6973
7074
.. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
7175
@@ -96,6 +100,11 @@ class BackupSchedule(proto.Message):
96100
full_backup_spec (google.cloud.spanner_admin_database_v1.types.FullBackupSpec):
97101
The schedule creates only full backups.
98102
103+
This field is a member of `oneof`_ ``backup_type_spec``.
104+
incremental_backup_spec (google.cloud.spanner_admin_database_v1.types.IncrementalBackupSpec):
105+
The schedule creates incremental backup
106+
chains.
107+
99108
This field is a member of `oneof`_ ``backup_type_spec``.
100109
update_time (google.protobuf.timestamp_pb2.Timestamp):
101110
Output only. The timestamp at which the
@@ -129,6 +138,12 @@ class BackupSchedule(proto.Message):
129138
oneof="backup_type_spec",
130139
message=backup.FullBackupSpec,
131140
)
141+
incremental_backup_spec: backup.IncrementalBackupSpec = proto.Field(
142+
proto.MESSAGE,
143+
number=8,
144+
oneof="backup_type_spec",
145+
message=backup.IncrementalBackupSpec,
146+
)
132147
update_time: timestamp_pb2.Timestamp = proto.Field(
133148
proto.MESSAGE,
134149
number=9,

google/cloud/spanner_admin_instance_v1/__init__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@
4949
from .types.spanner_instance_admin import ListInstancePartitionsResponse
5050
from .types.spanner_instance_admin import ListInstancesRequest
5151
from .types.spanner_instance_admin import ListInstancesResponse
52+
from .types.spanner_instance_admin import MoveInstanceMetadata
53+
from .types.spanner_instance_admin import MoveInstanceRequest
54+
from .types.spanner_instance_admin import MoveInstanceResponse
5255
from .types.spanner_instance_admin import ReplicaInfo
5356
from .types.spanner_instance_admin import UpdateInstanceConfigMetadata
5457
from .types.spanner_instance_admin import UpdateInstanceConfigRequest
@@ -87,6 +90,9 @@
8790
"ListInstancePartitionsResponse",
8891
"ListInstancesRequest",
8992
"ListInstancesResponse",
93+
"MoveInstanceMetadata",
94+
"MoveInstanceRequest",
95+
"MoveInstanceResponse",
9096
"OperationProgress",
9197
"ReplicaInfo",
9298
"UpdateInstanceConfigMetadata",

google/cloud/spanner_admin_instance_v1/gapic_metadata.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,11 @@
8585
"list_instances"
8686
]
8787
},
88+
"MoveInstance": {
89+
"methods": [
90+
"move_instance"
91+
]
92+
},
8893
"SetIamPolicy": {
8994
"methods": [
9095
"set_iam_policy"
@@ -190,6 +195,11 @@
190195
"list_instances"
191196
]
192197
},
198+
"MoveInstance": {
199+
"methods": [
200+
"move_instance"
201+
]
202+
},
193203
"SetIamPolicy": {
194204
"methods": [
195205
"set_iam_policy"
@@ -295,6 +305,11 @@
295305
"list_instances"
296306
]
297307
},
308+
"MoveInstance": {
309+
"methods": [
310+
"move_instance"
311+
]
312+
},
298313
"SetIamPolicy": {
299314
"methods": [
300315
"set_iam_policy"

0 commit comments

Comments
 (0)