Skip to content

Commit bc71fe9

Browse files
feat: Add support for multi region encryption config (#1136)
* feat: Add support for multi region encryption config docs: fix linting for several doc comments PiperOrigin-RevId: 630422337 Source-Link: googleapis/googleapis@65db386 Source-Link: googleapis/googleapis-gen@b798ca9 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYjc5OGNhOWY1NmUyYWQzZTBkMTQ5ODJiNjhiNjcyNGQxYzNkNjJiNSJ9 * 🦉 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 a9182a0 commit bc71fe9

File tree

12 files changed

+179
-58
lines changed

12 files changed

+179
-58
lines changed

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ class DatabaseAdminAsyncClient:
6969
7070
- create, drop, and list databases
7171
- update the schema of pre-existing databases
72-
- create, delete and list backups for a database
72+
- create, delete, copy and list backups for a database
7373
- restore a database from an existing backup
7474
"""
7575

@@ -351,7 +351,7 @@ async def sample_list_databases():
351351
Returns:
352352
google.cloud.spanner_admin_database_v1.services.database_admin.pagers.ListDatabasesAsyncPager:
353353
The response for
354-
[ListDatabases][google.spanner.admin.database.v1.DatabaseAdmin.ListDatabases].
354+
[ListDatabases][google.spanner.admin.database.v1.DatabaseAdmin.ListDatabases].
355355
356356
Iterating over this object will yield results and
357357
resolve additional pages automatically.
@@ -1168,7 +1168,7 @@ async def sample_get_database_ddl():
11681168
Returns:
11691169
google.cloud.spanner_admin_database_v1.types.GetDatabaseDdlResponse:
11701170
The response for
1171-
[GetDatabaseDdl][google.spanner.admin.database.v1.DatabaseAdmin.GetDatabaseDdl].
1171+
[GetDatabaseDdl][google.spanner.admin.database.v1.DatabaseAdmin.GetDatabaseDdl].
11721172
11731173
"""
11741174
# Create or coerce a protobuf request object.
@@ -1807,8 +1807,8 @@ async def copy_backup(
18071807
The [response][google.longrunning.Operation.response] field type
18081808
is [Backup][google.spanner.admin.database.v1.Backup], if
18091809
successful. Cancelling the returned operation will stop the
1810-
copying and delete the backup. Concurrent CopyBackup requests
1811-
can run on the same source backup.
1810+
copying and delete the destination backup. Concurrent CopyBackup
1811+
requests can run on the same source backup.
18121812
18131813
.. code-block:: python
18141814
@@ -2347,7 +2347,7 @@ async def sample_list_backups():
23472347
Returns:
23482348
google.cloud.spanner_admin_database_v1.services.database_admin.pagers.ListBackupsAsyncPager:
23492349
The response for
2350-
[ListBackups][google.spanner.admin.database.v1.DatabaseAdmin.ListBackups].
2350+
[ListBackups][google.spanner.admin.database.v1.DatabaseAdmin.ListBackups].
23512351
23522352
Iterating over this object will yield results and
23532353
resolve additional pages automatically.
@@ -2889,7 +2889,7 @@ async def sample_list_database_roles():
28892889
parent (:class:`str`):
28902890
Required. The database whose roles should be listed.
28912891
Values are of the form
2892-
``projects/<project>/instances/<instance>/databases/<database>/databaseRoles``.
2892+
``projects/<project>/instances/<instance>/databases/<database>``.
28932893
28942894
This corresponds to the ``parent`` field
28952895
on the ``request`` instance; if ``request`` is provided, this
@@ -2903,7 +2903,7 @@ async def sample_list_database_roles():
29032903
Returns:
29042904
google.cloud.spanner_admin_database_v1.services.database_admin.pagers.ListDatabaseRolesAsyncPager:
29052905
The response for
2906-
[ListDatabaseRoles][google.spanner.admin.database.v1.DatabaseAdmin.ListDatabaseRoles].
2906+
[ListDatabaseRoles][google.spanner.admin.database.v1.DatabaseAdmin.ListDatabaseRoles].
29072907
29082908
Iterating over this object will yield results and
29092909
resolve additional pages automatically.

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ class DatabaseAdminClient(metaclass=DatabaseAdminClientMeta):
110110
111111
- create, drop, and list databases
112112
- update the schema of pre-existing databases
113-
- create, delete and list backups for a database
113+
- create, delete, copy and list backups for a database
114114
- restore a database from an existing backup
115115
"""
116116

@@ -868,7 +868,7 @@ def sample_list_databases():
868868
Returns:
869869
google.cloud.spanner_admin_database_v1.services.database_admin.pagers.ListDatabasesPager:
870870
The response for
871-
[ListDatabases][google.spanner.admin.database.v1.DatabaseAdmin.ListDatabases].
871+
[ListDatabases][google.spanner.admin.database.v1.DatabaseAdmin.ListDatabases].
872872
873873
Iterating over this object will yield results and
874874
resolve additional pages automatically.
@@ -1667,7 +1667,7 @@ def sample_get_database_ddl():
16671667
Returns:
16681668
google.cloud.spanner_admin_database_v1.types.GetDatabaseDdlResponse:
16691669
The response for
1670-
[GetDatabaseDdl][google.spanner.admin.database.v1.DatabaseAdmin.GetDatabaseDdl].
1670+
[GetDatabaseDdl][google.spanner.admin.database.v1.DatabaseAdmin.GetDatabaseDdl].
16711671
16721672
"""
16731673
# Create or coerce a protobuf request object.
@@ -2303,8 +2303,8 @@ def copy_backup(
23032303
The [response][google.longrunning.Operation.response] field type
23042304
is [Backup][google.spanner.admin.database.v1.Backup], if
23052305
successful. Cancelling the returned operation will stop the
2306-
copying and delete the backup. Concurrent CopyBackup requests
2307-
can run on the same source backup.
2306+
copying and delete the destination backup. Concurrent CopyBackup
2307+
requests can run on the same source backup.
23082308
23092309
.. code-block:: python
23102310
@@ -2831,7 +2831,7 @@ def sample_list_backups():
28312831
Returns:
28322832
google.cloud.spanner_admin_database_v1.services.database_admin.pagers.ListBackupsPager:
28332833
The response for
2834-
[ListBackups][google.spanner.admin.database.v1.DatabaseAdmin.ListBackups].
2834+
[ListBackups][google.spanner.admin.database.v1.DatabaseAdmin.ListBackups].
28352835
28362836
Iterating over this object will yield results and
28372837
resolve additional pages automatically.
@@ -3361,7 +3361,7 @@ def sample_list_database_roles():
33613361
parent (str):
33623362
Required. The database whose roles should be listed.
33633363
Values are of the form
3364-
``projects/<project>/instances/<instance>/databases/<database>/databaseRoles``.
3364+
``projects/<project>/instances/<instance>/databases/<database>``.
33653365
33663366
This corresponds to the ``parent`` field
33673367
on the ``request`` instance; if ``request`` is provided, this
@@ -3375,7 +3375,7 @@ def sample_list_database_roles():
33753375
Returns:
33763376
google.cloud.spanner_admin_database_v1.services.database_admin.pagers.ListDatabaseRolesPager:
33773377
The response for
3378-
[ListDatabaseRoles][google.spanner.admin.database.v1.DatabaseAdmin.ListDatabaseRoles].
3378+
[ListDatabaseRoles][google.spanner.admin.database.v1.DatabaseAdmin.ListDatabaseRoles].
33793379
33803380
Iterating over this object will yield results and
33813381
resolve additional pages automatically.

google/cloud/spanner_admin_database_v1/services/database_admin/transports/grpc.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class DatabaseAdminGrpcTransport(DatabaseAdminTransport):
4444
4545
- create, drop, and list databases
4646
- update the schema of pre-existing databases
47-
- create, delete and list backups for a database
47+
- create, delete, copy and list backups for a database
4848
- restore a database from an existing backup
4949
5050
This class defines the same methods as the primary client, so the
@@ -681,8 +681,8 @@ def copy_backup(
681681
The [response][google.longrunning.Operation.response] field type
682682
is [Backup][google.spanner.admin.database.v1.Backup], if
683683
successful. Cancelling the returned operation will stop the
684-
copying and delete the backup. Concurrent CopyBackup requests
685-
can run on the same source backup.
684+
copying and delete the destination backup. Concurrent CopyBackup
685+
requests can run on the same source backup.
686686
687687
Returns:
688688
Callable[[~.CopyBackupRequest],

google/cloud/spanner_admin_database_v1/services/database_admin/transports/grpc_asyncio.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class DatabaseAdminGrpcAsyncIOTransport(DatabaseAdminTransport):
4747
4848
- create, drop, and list databases
4949
- update the schema of pre-existing databases
50-
- create, delete and list backups for a database
50+
- create, delete, copy and list backups for a database
5151
- restore a database from an existing backup
5252
5353
This class defines the same methods as the primary client, so the
@@ -695,8 +695,8 @@ def copy_backup(
695695
The [response][google.longrunning.Operation.response] field type
696696
is [Backup][google.spanner.admin.database.v1.Backup], if
697697
successful. Cancelling the returned operation will stop the
698-
copying and delete the backup. Concurrent CopyBackup requests
699-
can run on the same source backup.
698+
copying and delete the destination backup. Concurrent CopyBackup
699+
requests can run on the same source backup.
700700
701701
Returns:
702702
Callable[[~.CopyBackupRequest],

google/cloud/spanner_admin_database_v1/services/database_admin/transports/rest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -769,7 +769,7 @@ class DatabaseAdminRestTransport(DatabaseAdminTransport):
769769
770770
- create, drop, and list databases
771771
- update the schema of pre-existing databases
772-
- create, delete and list backups for a database
772+
- create, delete, copy and list backups for a database
773773
- restore a database from an existing backup
774774
775775
This class defines the same methods as the primary client, so the

google/cloud/spanner_admin_database_v1/types/backup.py

Lines changed: 77 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,16 @@ class Backup(proto.Message):
111111
encryption_info (google.cloud.spanner_admin_database_v1.types.EncryptionInfo):
112112
Output only. The encryption information for
113113
the backup.
114+
encryption_information (MutableSequence[google.cloud.spanner_admin_database_v1.types.EncryptionInfo]):
115+
Output only. The encryption information for the backup,
116+
whether it is protected by one or more KMS keys. The
117+
information includes all Cloud KMS key versions used to
118+
encrypt the backup. The
119+
``encryption_status' field inside of each``\ EncryptionInfo\`
120+
is not populated. At least one of the key versions must be
121+
available for the backup to be restored. If a key version is
122+
revoked in the middle of a restore, the restore behavior is
123+
undefined.
114124
database_dialect (google.cloud.spanner_admin_database_v1.types.DatabaseDialect):
115125
Output only. The database dialect information
116126
for the backup.
@@ -190,6 +200,13 @@ class State(proto.Enum):
190200
number=8,
191201
message=common.EncryptionInfo,
192202
)
203+
encryption_information: MutableSequence[
204+
common.EncryptionInfo
205+
] = proto.RepeatedField(
206+
proto.MESSAGE,
207+
number=13,
208+
message=common.EncryptionInfo,
209+
)
193210
database_dialect: common.DatabaseDialect = proto.Field(
194211
proto.ENUM,
195212
number=10,
@@ -366,7 +383,7 @@ class CopyBackupRequest(proto.Message):
366383

367384

368385
class CopyBackupMetadata(proto.Message):
369-
r"""Metadata type for the google.longrunning.Operation returned by
386+
r"""Metadata type for the operation returned by
370387
[CopyBackup][google.spanner.admin.database.v1.DatabaseAdmin.CopyBackup].
371388
372389
Attributes:
@@ -652,8 +669,8 @@ class ListBackupOperationsRequest(proto.Message):
652669
653670
- The operation's metadata type is
654671
[CreateBackupMetadata][google.spanner.admin.database.v1.CreateBackupMetadata].
655-
- The database the backup was taken from has a name
656-
containing the string "prod".
672+
- The source database name of backup contains the string
673+
"prod".
657674
658675
- ``(metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CreateBackupMetadata) AND``
659676
``(metadata.name:howl) AND``
@@ -673,8 +690,7 @@ class ListBackupOperationsRequest(proto.Message):
673690
674691
- The operation's metadata type is
675692
[CopyBackupMetadata][google.spanner.admin.database.v1.CopyBackupMetadata].
676-
- The source backup of the copied backup name contains
677-
the string "test".
693+
- The source backup name contains the string "test".
678694
- The operation started before 2022-01-18T14:50:00Z.
679695
- The operation resulted in an error.
680696
@@ -688,12 +704,12 @@ class ListBackupOperationsRequest(proto.Message):
688704
689705
- The operation's metadata type is
690706
[CreateBackupMetadata][google.spanner.admin.database.v1.CreateBackupMetadata]
691-
AND the database the backup was taken from has name
692-
containing string "test_db"
707+
AND the source database name of the backup contains
708+
the string "test_db"
693709
- The operation's metadata type is
694710
[CopyBackupMetadata][google.spanner.admin.database.v1.CopyBackupMetadata]
695-
AND the backup the backup was copied from has name
696-
containing string "test_bkp"
711+
AND the source backup name contains the string
712+
"test_bkp"
697713
698714
- The operation resulted in an error.
699715
page_size (int):
@@ -819,6 +835,26 @@ class CreateBackupEncryptionConfig(proto.Message):
819835
[encryption_type][google.spanner.admin.database.v1.CreateBackupEncryptionConfig.encryption_type]
820836
is ``CUSTOMER_MANAGED_ENCRYPTION``. Values are of the form
821837
``projects/<project>/locations/<location>/keyRings/<key_ring>/cryptoKeys/<kms_key_name>``.
838+
kms_key_names (MutableSequence[str]):
839+
Optional. Specifies the KMS configuration for the one or
840+
more keys used to protect the backup. Values are of the form
841+
``projects/<project>/locations/<location>/keyRings/<key_ring>/cryptoKeys/<kms_key_name>``.
842+
843+
The keys referenced by kms_key_names must fully cover all
844+
regions of the backup's instance configuration. Some
845+
examples:
846+
847+
- For single region instance configs, specify a single
848+
regional location KMS key.
849+
- For multi-regional instance configs of type
850+
GOOGLE_MANAGED, either specify a multi-regional location
851+
KMS key or multiple regional location KMS keys that cover
852+
all regions in the instance config.
853+
- For an instance config of type USER_MANAGED, please
854+
specify only regional location KMS keys to cover each
855+
region in the instance config. Multi-regional location
856+
KMS keys are not supported for USER_MANAGED instance
857+
configs.
822858
"""
823859

824860
class EncryptionType(proto.Enum):
@@ -854,6 +890,10 @@ class EncryptionType(proto.Enum):
854890
proto.STRING,
855891
number=2,
856892
)
893+
kms_key_names: MutableSequence[str] = proto.RepeatedField(
894+
proto.STRING,
895+
number=3,
896+
)
857897

858898

859899
class CopyBackupEncryptionConfig(proto.Message):
@@ -868,6 +908,27 @@ class CopyBackupEncryptionConfig(proto.Message):
868908
[encryption_type][google.spanner.admin.database.v1.CopyBackupEncryptionConfig.encryption_type]
869909
is ``CUSTOMER_MANAGED_ENCRYPTION``. Values are of the form
870910
``projects/<project>/locations/<location>/keyRings/<key_ring>/cryptoKeys/<kms_key_name>``.
911+
kms_key_names (MutableSequence[str]):
912+
Optional. Specifies the KMS configuration for the one or
913+
more keys used to protect the backup. Values are of the form
914+
``projects/<project>/locations/<location>/keyRings/<key_ring>/cryptoKeys/<kms_key_name>``.
915+
Kms keys specified can be in any order.
916+
917+
The keys referenced by kms_key_names must fully cover all
918+
regions of the backup's instance configuration. Some
919+
examples:
920+
921+
- For single region instance configs, specify a single
922+
regional location KMS key.
923+
- For multi-regional instance configs of type
924+
GOOGLE_MANAGED, either specify a multi-regional location
925+
KMS key or multiple regional location KMS keys that cover
926+
all regions in the instance config.
927+
- For an instance config of type USER_MANAGED, please
928+
specify only regional location KMS keys to cover each
929+
region in the instance config. Multi-regional location
930+
KMS keys are not supported for USER_MANAGED instance
931+
configs.
871932
"""
872933

873934
class EncryptionType(proto.Enum):
@@ -887,8 +948,9 @@ class EncryptionType(proto.Enum):
887948
GOOGLE_DEFAULT_ENCRYPTION (2):
888949
Use Google default encryption.
889950
CUSTOMER_MANAGED_ENCRYPTION (3):
890-
Use customer managed encryption. If specified,
891-
``kms_key_name`` must contain a valid Cloud KMS key.
951+
Use customer managed encryption. If specified, either
952+
``kms_key_name`` or ``kms_key_names`` must contain valid
953+
Cloud KMS key(s).
892954
"""
893955
ENCRYPTION_TYPE_UNSPECIFIED = 0
894956
USE_CONFIG_DEFAULT_OR_BACKUP_ENCRYPTION = 1
@@ -904,6 +966,10 @@ class EncryptionType(proto.Enum):
904966
proto.STRING,
905967
number=2,
906968
)
969+
kms_key_names: MutableSequence[str] = proto.RepeatedField(
970+
proto.STRING,
971+
number=3,
972+
)
907973

908974

909975
__all__ = tuple(sorted(__protobuf__.manifest))

google/cloud/spanner_admin_database_v1/types/common.py

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class DatabaseDialect(proto.Enum):
4242
Default value. This value will create a database with the
4343
GOOGLE_STANDARD_SQL dialect.
4444
GOOGLE_STANDARD_SQL (1):
45-
Google standard SQL.
45+
GoogleSQL supported SQL.
4646
POSTGRESQL (2):
4747
PostgreSQL supported SQL.
4848
"""
@@ -90,12 +90,36 @@ class EncryptionConfig(proto.Message):
9090
The Cloud KMS key to be used for encrypting and decrypting
9191
the database. Values are of the form
9292
``projects/<project>/locations/<location>/keyRings/<key_ring>/cryptoKeys/<kms_key_name>``.
93+
kms_key_names (MutableSequence[str]):
94+
Specifies the KMS configuration for the one or more keys
95+
used to encrypt the database. Values are of the form
96+
``projects/<project>/locations/<location>/keyRings/<key_ring>/cryptoKeys/<kms_key_name>``.
97+
98+
The keys referenced by kms_key_names must fully cover all
99+
regions of the database instance configuration. Some
100+
examples:
101+
102+
- For single region database instance configs, specify a
103+
single regional location KMS key.
104+
- For multi-regional database instance configs of type
105+
GOOGLE_MANAGED, either specify a multi-regional location
106+
KMS key or multiple regional location KMS keys that cover
107+
all regions in the instance config.
108+
- For a database instance config of type USER_MANAGED,
109+
please specify only regional location KMS keys to cover
110+
each region in the instance config. Multi-regional
111+
location KMS keys are not supported for USER_MANAGED
112+
instance configs.
93113
"""
94114

95115
kms_key_name: str = proto.Field(
96116
proto.STRING,
97117
number=2,
98118
)
119+
kms_key_names: MutableSequence[str] = proto.RepeatedField(
120+
proto.STRING,
121+
number=3,
122+
)
99123

100124

101125
class EncryptionInfo(proto.Message):

0 commit comments

Comments
 (0)