Skip to content

Commit fc225fe

Browse files
Google APIscopybara-github
authored andcommitted
feat: add CRUD APIs on Databases
feat: add PG 17 as a Database version chore: annotate `EncryptionConfig.kms_key_name`, `SecondaryConfig.primary_cluster_name`, `PrimaryConfig.secondary_cluster_names`, and `PscInstanceConfig.service_attachment_link` with what resource they're referencing feat: add configuration for Managed Connection Pool feat: update `Database.charset` to be immutable feat: add additional fields to Database object to specify the collation type, character type, if it is a template database, and the template to use for the database feat: add field to ExecuteSQL request to just validate the sql statement feat: add fields on the estimated/actual start/end times for an Upgrade Cluster operation docs: specify that the STOPPED state is not used for clusters anymore PiperOrigin-RevId: 811874303
1 parent 4d3b3a5 commit fc225fe

File tree

3 files changed

+110
-21
lines changed

3 files changed

+110
-21
lines changed

google/cloud/alloydb/v1/alloydb_v1_grpc_service_config.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,11 @@
99
{ "service": "google.cloud.alloydb.v1.AlloyDBAdmin", "method": "GetBackup" },
1010
{ "service": "google.cloud.alloydb.v1.AlloyDBAdmin", "method": "ListSupportedDatabaseFlags" },
1111
{ "service": "google.cloud.alloydb.v1.AlloyDBAdmin", "method": "GenerateClientCertificate" },
12-
{ "service": "google.cloud.alloydb.v1.AlloyDBAdmin", "method": "GetConnectionInfo" }
12+
{ "service": "google.cloud.alloydb.v1.AlloyDBAdmin", "method": "GetConnectionInfo" },
13+
{ "service":"google.cloud.alloydb.v1.AlloyDBAdmin", "method": "CreateDatabase"},
14+
{ "service":"google.cloud.alloydb.v1.AlloyDBAdmin", "method": "GetDatabase"},
15+
{ "service": "google.cloud.alloydb.v1.AlloyDBAdmin", "method": "UpdateDatabase" },
16+
{ "service": "google.cloud.alloydb.v1.AlloyDBAdmin", "method": "DeleteDatabase" }
1317
],
1418
"timeout": "60s",
1519
"retryPolicy": {

google/cloud/alloydb/v1/resources.proto

Lines changed: 78 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,14 @@ option (google.api.resource_definition) = {
4242
type: "compute.googleapis.com/Network"
4343
pattern: "projects/{project}/global/networks/{network}"
4444
};
45+
option (google.api.resource_definition) = {
46+
type: "cloudkms.googleapis.com/CryptoKey"
47+
pattern: "projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}"
48+
};
49+
option (google.api.resource_definition) = {
50+
type: "compute.googleapis.com/ServiceAttachment"
51+
pattern: "projects/{project}/regions/{region}/serviceAttachments/{service_attachment}"
52+
};
4553

4654
// View on Instance. Pass this enum to rpcs that returns an Instance message to
4755
// control which subsets of fields to get.
@@ -92,6 +100,9 @@ enum DatabaseVersion {
92100

93101
// The database version is Postgres 16.
94102
POSTGRES_16 = 4;
103+
104+
// The database version is Postgres 17.
105+
POSTGRES_17 = 5;
95106
}
96107

97108
// Subscription_type added to distinguish between Standard and Trial
@@ -150,7 +161,9 @@ message EncryptionConfig {
150161
// The fully-qualified resource name of the KMS key.
151162
// Each Cloud KMS key is regionalized and has the following format:
152163
// projects/[PROJECT]/locations/[REGION]/keyRings/[RING]/cryptoKeys/[KEY_NAME]
153-
string kms_key_name = 1;
164+
string kms_key_name = 1 [(google.api.resource_reference) = {
165+
type: "cloudkms.googleapis.com/CryptoKey"
166+
}];
154167
}
155168

156169
// EncryptionInfo describes the encryption information of a cluster or a backup.
@@ -495,7 +508,9 @@ message Cluster {
495508
message SecondaryConfig {
496509
// The name of the primary cluster name with the format:
497510
// * projects/{project}/locations/{region}/clusters/{cluster_id}
498-
string primary_cluster_name = 1;
511+
string primary_cluster_name = 1 [(google.api.resource_reference) = {
512+
type: "alloydb.googleapis.com/Cluster"
513+
}];
499514
}
500515

501516
// Configuration for the primary cluster. It has the list of clusters that are
@@ -504,8 +519,12 @@ message Cluster {
504519
message PrimaryConfig {
505520
// Output only. Names of the clusters that are replicating from this
506521
// cluster.
507-
repeated string secondary_cluster_names = 1
508-
[(google.api.field_behavior) = OUTPUT_ONLY];
522+
repeated string secondary_cluster_names = 1 [
523+
(google.api.field_behavior) = OUTPUT_ONLY,
524+
(google.api.resource_reference) = {
525+
type: "alloydb.googleapis.com/Cluster"
526+
}
527+
];
509528
}
510529

511530
// PscConfig contains PSC related configuration at a cluster level.
@@ -543,11 +562,8 @@ message Cluster {
543562
// The cluster is active and running.
544563
READY = 1;
545564

546-
// The cluster is stopped. All instances in the cluster are stopped.
547-
// Customers can start a stopped cluster at any point and all their
548-
// instances will come back to life with same names and IP resources. In
549-
// this state, customer pays for storage.
550-
// Associated backups could also be present in a stopped cluster.
565+
// This is unused. Even when all instances in the cluster are stopped, the
566+
// cluster remains in READY state.
551567
STOPPED = 2;
552568

553569
// The cluster is empty and has no associated resources.
@@ -942,8 +958,12 @@ message Instance {
942958
// Service Connect (PSC) is enabled for the instance.
943959
// The name of the resource will be in the format of
944960
// `projects/<alloydb-tenant-project-number>/regions/<region-name>/serviceAttachments/<service-attachment-name>`
945-
string service_attachment_link = 1
946-
[(google.api.field_behavior) = OUTPUT_ONLY];
961+
string service_attachment_link = 1 [
962+
(google.api.field_behavior) = OUTPUT_ONLY,
963+
(google.api.resource_reference) = {
964+
type: "compute.googleapis.com/ServiceAttachment"
965+
}
966+
];
947967

948968
// Optional. List of consumer projects that are allowed to create
949969
// PSC endpoints to service-attachments to this instance.
@@ -1008,6 +1028,18 @@ message Instance {
10081028
[(google.api.field_behavior) = OPTIONAL];
10091029
}
10101030

1031+
// Configuration for Managed Connection Pool (MCP).
1032+
message ConnectionPoolConfig {
1033+
// Optional. Whether to enable Managed Connection Pool (MCP).
1034+
bool enabled = 12 [(google.api.field_behavior) = OPTIONAL];
1035+
1036+
// Optional. Connection Pool flags, as a list of "key": "value" pairs.
1037+
map<string, string> flags = 13 [(google.api.field_behavior) = OPTIONAL];
1038+
1039+
// Output only. The number of running poolers per instance.
1040+
int32 pooler_count = 14 [(google.api.field_behavior) = OUTPUT_ONLY];
1041+
}
1042+
10111043
// Instance State
10121044
enum State {
10131045
// The state of the instance is unknown.
@@ -1246,6 +1278,10 @@ message Instance {
12461278
// etc.). Please refer to the API documentation for more details.
12471279
ActivationPolicy activation_policy = 35
12481280
[(google.api.field_behavior) = OPTIONAL];
1281+
1282+
// Optional. The configuration for Managed Connection Pool (MCP).
1283+
ConnectionPoolConfig connection_pool_config = 37
1284+
[(google.api.field_behavior) = OPTIONAL];
12491285
}
12501286

12511287
// ConnectionInfo singleton resource.
@@ -1634,13 +1670,38 @@ message Database {
16341670
// `projects/{project}/locations/{location}/clusters/{cluster}/databases/{database}`.
16351671
string name = 1 [(google.api.field_behavior) = IDENTIFIER];
16361672

1637-
// Optional. Charset for the database.
1673+
// Optional. Immutable. Charset for the database.
16381674
// This field can contain any PostgreSQL supported charset name.
16391675
// Example values include "UTF8", "SQL_ASCII", etc.
1640-
string charset = 2 [(google.api.field_behavior) = OPTIONAL];
1676+
string charset = 2 [
1677+
(google.api.field_behavior) = OPTIONAL,
1678+
(google.api.field_behavior) = IMMUTABLE
1679+
];
16411680

1642-
// Optional. Collation for the database.
1643-
// Name of the custom or native collation for postgres.
1644-
// Example values include "C", "POSIX", etc
1645-
string collation = 3 [(google.api.field_behavior) = OPTIONAL];
1681+
// Optional. Immutable. lc_collate for the database.
1682+
// String sort order.
1683+
// Example values include "C", "POSIX", etc.
1684+
string collation = 3 [
1685+
(google.api.field_behavior) = OPTIONAL,
1686+
(google.api.field_behavior) = IMMUTABLE
1687+
];
1688+
1689+
// Optional. Immutable. lc_ctype for the database.
1690+
// Character classification (What is a letter? The upper-case equivalent?).
1691+
// Example values include "C", "POSIX", etc.
1692+
string character_type = 4 [
1693+
(google.api.field_behavior) = OPTIONAL,
1694+
(google.api.field_behavior) = IMMUTABLE
1695+
];
1696+
1697+
// Input only. Immutable. Template of the database to be used for creating a
1698+
// new database.
1699+
string database_template = 6 [
1700+
(google.api.field_behavior) = INPUT_ONLY,
1701+
(google.api.field_behavior) = IMMUTABLE
1702+
];
1703+
1704+
// Optional. Whether the database is a template database.
1705+
optional bool is_template_database = 7
1706+
[(google.api.field_behavior) = OPTIONAL];
16461707
}

google/cloud/alloydb/v1/service.proto

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1606,6 +1606,10 @@ message ExecuteSqlRequest {
16061606
// Required. SQL statement to execute on database. Any valid statement is
16071607
// permitted, including DDL, DML, DQL statements.
16081608
string sql_statement = 4 [(google.api.field_behavior) = REQUIRED];
1609+
1610+
// Optional. If set, validates the sql statement by performing
1611+
// syntax and semantic validation and doesn't execute the query.
1612+
bool validate_only = 6 [(google.api.field_behavior) = OPTIONAL];
16091613
}
16101614

16111615
// Execute a SQL statement response.
@@ -1976,6 +1980,23 @@ message OperationMetadata {
19761980
message UpgradeClusterStatus {
19771981
// Status of an upgrade stage.
19781982
message StageStatus {
1983+
// Timing information for the stage execution.
1984+
message StageSchedule {
1985+
// When the stage is expected to start. Set only if the stage has not
1986+
// started yet.
1987+
google.protobuf.Timestamp estimated_start_time = 1;
1988+
1989+
// Actual start time of the stage. Set only if the stage has started.
1990+
google.protobuf.Timestamp actual_start_time = 2;
1991+
1992+
// When the stage is expected to end. Set only if the stage has not
1993+
// completed yet.
1994+
google.protobuf.Timestamp estimated_end_time = 3;
1995+
1996+
// Actual end time of the stage. Set only if the stage has completed.
1997+
google.protobuf.Timestamp actual_end_time = 4;
1998+
}
1999+
19792000
// Stage specific status information, if any.
19802001
oneof stage_specific_status {
19812002
// Read pool instances upgrade metadata.
@@ -1987,6 +2008,9 @@ message UpgradeClusterStatus {
19872008

19882009
// State of this stage.
19892010
UpgradeClusterResponse.Status state = 2;
2011+
2012+
// Output only. Timing information for the stage execution.
2013+
StageSchedule schedule = 3 [(google.api.field_behavior) = OUTPUT_ONLY];
19902014
}
19912015

19922016
// Read pool instances upgrade specific status.
@@ -2173,7 +2197,7 @@ message DeleteUserRequest {
21732197
bool validate_only = 3 [(google.api.field_behavior) = OPTIONAL];
21742198
}
21752199

2176-
// Message for requesting list of Databases.
2200+
// Message for ListDatabases request.
21772201
message ListDatabasesRequest {
21782202
// Required. Parent value for ListDatabasesRequest.
21792203
string parent = 1 [
@@ -2199,9 +2223,9 @@ message ListDatabasesRequest {
21992223
string filter = 4 [(google.api.field_behavior) = OPTIONAL];
22002224
}
22012225

2202-
// Message for response to listing Databases.
2226+
// Message for ListDatabases response.
22032227
message ListDatabasesResponse {
2204-
// The list of databases
2228+
// The list of databases.
22052229
repeated Database databases = 1;
22062230

22072231
// A token identifying the next page of results the server should return.

0 commit comments

Comments
 (0)