Skip to content

Commit 39a3264

Browse files
committed
generate CMEK protos (via synth)
1 parent 8a3f8ca commit 39a3264

File tree

9 files changed

+491
-277
lines changed

9 files changed

+491
-277
lines changed

google/cloud/spanner_admin_database_v1/gapic/database_admin_client.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
database_admin_grpc_transport,
4141
)
4242
from google.cloud.spanner_admin_database_v1.proto import backup_pb2
43+
from google.cloud.spanner_admin_database_v1.proto import common_pb2
4344
from google.cloud.spanner_admin_database_v1.proto import spanner_database_admin_pb2
4445
from google.cloud.spanner_admin_database_v1.proto import spanner_database_admin_pb2_grpc
4546
from google.iam.v1 import iam_policy_pb2
@@ -100,6 +101,17 @@ def backup_path(cls, project, instance, backup):
100101
backup=backup,
101102
)
102103

104+
@classmethod
105+
def crypto_key_path(cls, project, location, key_ring, crypto_key):
106+
"""Return a fully-qualified crypto_key string."""
107+
return google.api_core.path_template.expand(
108+
"projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}",
109+
project=project,
110+
location=location,
111+
key_ring=key_ring,
112+
crypto_key=crypto_key,
113+
)
114+
103115
@classmethod
104116
def database_path(cls, project, instance, database):
105117
"""Return a fully-qualified database string."""
@@ -341,6 +353,7 @@ def create_database(
341353
parent,
342354
create_statement,
343355
extra_statements=None,
356+
encryption_config=None,
344357
retry=google.api_core.gapic_v1.method.DEFAULT,
345358
timeout=google.api_core.gapic_v1.method.DEFAULT,
346359
metadata=None,
@@ -386,6 +399,10 @@ def create_database(
386399
database. Statements can create tables, indexes, etc. These
387400
statements execute atomically with the creation of the database:
388401
if there is an error in any statement, the database is not created.
402+
encryption_config (Union[dict, ~google.cloud.spanner_admin_database_v1.types.EncryptionConfig]): Optional.
403+
404+
If a dict is provided, it must be of the same form as the protobuf
405+
message :class:`~google.cloud.spanner_admin_database_v1.types.EncryptionConfig`
389406
retry (Optional[google.api_core.retry.Retry]): A retry object used
390407
to retry requests. If ``None`` is specified, requests will
391408
be retried using a default configuration.
@@ -420,6 +437,7 @@ def create_database(
420437
parent=parent,
421438
create_statement=create_statement,
422439
extra_statements=extra_statements,
440+
encryption_config=encryption_config,
423441
)
424442
if metadata is None:
425443
metadata = []

google/cloud/spanner_admin_database_v1/gapic/enums.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,3 +72,24 @@ class State(enum.IntEnum):
7272
CREATING = 1
7373
READY = 2
7474
READY_OPTIMIZING = 3
75+
76+
77+
class EncryptionInfo(object):
78+
class Type(enum.IntEnum):
79+
"""
80+
Possible encryption types for a resource.
81+
82+
Attributes:
83+
TYPE_UNSPECIFIED (int): Encryption type was not specified, though data at rest remains encrypted.
84+
GOOGLE_DEFAULT_ENCRYPTION (int): The data backing this resource is encrypted at rest with a key that is
85+
fully managed by Google. No key version or status will be populated.
86+
This is the default state.
87+
CUSTOMER_MANAGED_ENCRYPTION (int): The data backing this resource is encrypted at rest with a key that
88+
is managed by the customer. The active version of the key.
89+
'kms_key_version' will be populated, and 'encryption_status' may be
90+
populated.
91+
"""
92+
93+
TYPE_UNSPECIFIED = 0
94+
GOOGLE_DEFAULT_ENCRYPTION = 1
95+
CUSTOMER_MANAGED_ENCRYPTION = 2

google/cloud/spanner_admin_database_v1/proto/backup.proto

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,13 @@ import "google/longrunning/operations.proto";
2222
import "google/protobuf/field_mask.proto";
2323
import "google/protobuf/timestamp.proto";
2424
import "google/spanner/admin/database/v1/common.proto";
25-
import "google/api/annotations.proto";
2625

2726
option csharp_namespace = "Google.Cloud.Spanner.Admin.Database.V1";
2827
option go_package = "google.golang.org/genproto/googleapis/spanner/admin/database/v1;database";
2928
option java_multiple_files = true;
3029
option java_outer_classname = "BackupProto";
3130
option java_package = "com.google.spanner.admin.database.v1";
3231
option php_namespace = "Google\\Cloud\\Spanner\\Admin\\Database\\V1";
33-
option ruby_package = "Google::Cloud::Spanner::Admin::Database::V1";
3432

3533
// A backup of a Cloud Spanner database.
3634
message Backup {
@@ -104,6 +102,11 @@ message Backup {
104102
// restored database from the backup enters the `READY` state, the reference
105103
// to the backup is removed.
106104
repeated string referencing_databases = 7 [(google.api.field_behavior) = OUTPUT_ONLY];
105+
106+
// Output only. The encryption information for the backup.
107+
// If the encryption key protecting this resource is customer managed, then
108+
// kms_key_version will be filled.
109+
EncryptionInfo encryption_info = 8 [(google.api.field_behavior) = OUTPUT_ONLY];
107110
}
108111

109112
// The request for [CreateBackup][google.spanner.admin.database.v1.DatabaseAdmin.CreateBackup].

0 commit comments

Comments
 (0)