Skip to content

Commit a0066e7

Browse files
Google APIscopybara-github
authored andcommitted
feat: Adding FetchBackupsForResourceType API
feat: Adding `ListDataSourceReferences` API feat: Adding `source_resource` fields to Backup resource feat: Adding new workload specific fields for Cloud SQL PiperOrigin-RevId: 827762328
1 parent faa7932 commit a0066e7

File tree

4 files changed

+163
-0
lines changed

4 files changed

+163
-0
lines changed

google/cloud/backupdr/v1/backupdr.proto

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,15 @@ service BackupDR {
200200
option (google.api.method_signature) = "parent";
201201
}
202202

203+
// Fetch Backups for a given resource type.
204+
rpc FetchBackupsForResourceType(FetchBackupsForResourceTypeRequest)
205+
returns (FetchBackupsForResourceTypeResponse) {
206+
option (google.api.http) = {
207+
get: "/v1/{parent=projects/*/locations/*/backupVaults/*/dataSources/*}/backups:fetchForResourceType"
208+
};
209+
option (google.api.method_signature) = "parent,resource_type";
210+
}
211+
203212
// Gets details of a Backup.
204213
rpc GetBackup(GetBackupRequest) returns (Backup) {
205214
option (google.api.http) = {
@@ -417,6 +426,15 @@ service BackupDR {
417426
option (google.api.method_signature) = "name";
418427
}
419428

429+
// Lists DataSourceReferences for a given project and location.
430+
rpc ListDataSourceReferences(ListDataSourceReferencesRequest)
431+
returns (ListDataSourceReferencesResponse) {
432+
option (google.api.http) = {
433+
get: "/v1/{parent=projects/*/locations/*}/dataSourceReferences"
434+
};
435+
option (google.api.method_signature) = "parent";
436+
}
437+
420438
// Fetch DataSourceReferences for a given project, location and resource type.
421439
rpc FetchDataSourceReferencesForResourceType(
422440
FetchDataSourceReferencesForResourceTypeRequest)

google/cloud/backupdr/v1/backupvault.proto

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -637,6 +637,14 @@ message Backup {
637637
(google.api.field_behavior) = OUTPUT_ONLY,
638638
(google.api.field_behavior) = OPTIONAL
639639
];
640+
641+
// Resource that is being backed up.
642+
oneof source_resource {
643+
// Output only. Unique identifier of the GCP resource that is being backed
644+
// up.
645+
BackupGcpResource gcp_resource = 31
646+
[(google.api.field_behavior) = OUTPUT_ONLY];
647+
}
640648
}
641649

642650
// Message for creating a BackupVault.
@@ -780,6 +788,62 @@ message FetchUsableBackupVaultsResponse {
780788
repeated string unreachable = 3;
781789
}
782790

791+
// Request for the FetchBackupsForResourceType method.
792+
message FetchBackupsForResourceTypeRequest {
793+
// Required. Datasources are the parent resource for the backups.
794+
// Format:
795+
// projects/{project}/locations/{location}/backupVaults/{backupVaultId}/dataSources/{datasourceId}
796+
string parent = 1 [
797+
(google.api.field_behavior) = REQUIRED,
798+
(google.api.resource_reference) = {
799+
child_type: "backupdr.googleapis.com/Backup"
800+
}
801+
];
802+
803+
// Required. The type of the GCP resource.
804+
// Ex: sqladmin.googleapis.com/Instance
805+
string resource_type = 2 [(google.api.field_behavior) = REQUIRED];
806+
807+
// Optional. The maximum number of Backups to return. The service may
808+
// return fewer than this value. If unspecified, at most 50
809+
// Backups will be returned. The maximum value is 100; values
810+
// above 100 will be coerced to 100.
811+
int32 page_size = 3 [(google.api.field_behavior) = OPTIONAL];
812+
813+
// Optional. A page token, received from a previous call of
814+
// `FetchBackupsForResourceType`.
815+
// Provide this to retrieve the subsequent page.
816+
//
817+
// When paginating, all other parameters provided to
818+
// `FetchBackupsForResourceType` must match
819+
// the call that provided the page token.
820+
string page_token = 4 [(google.api.field_behavior) = OPTIONAL];
821+
822+
// Optional. A filter expression that filters the results fetched in the
823+
// response. The expression must specify the field name, a comparison
824+
// operator, and the value that you want to use for filtering. Supported
825+
// fields:
826+
string filter = 5 [(google.api.field_behavior) = OPTIONAL];
827+
828+
// Optional. A comma-separated list of fields to order by, sorted in ascending
829+
// order. Use "desc" after a field name for descending.
830+
string order_by = 6 [(google.api.field_behavior) = OPTIONAL];
831+
832+
// Optional. This parameter is used to specify the view of the backup.
833+
// If not specified, the default view is BASIC.
834+
BackupView view = 7 [(google.api.field_behavior) = OPTIONAL];
835+
}
836+
837+
// Response for the FetchBackupsForResourceType method.
838+
message FetchBackupsForResourceTypeResponse {
839+
// The Backups from the specified parent.
840+
repeated Backup backups = 1;
841+
842+
// A token, which can be sent as `page_token` to retrieve the next page.
843+
// If this field is omitted, there are no subsequent pages.
844+
string next_page_token = 2;
845+
}
846+
783847
// Request message for getting a BackupVault.
784848
message GetBackupVaultRequest {
785849
// Required. Name of the backupvault store resource name, in the format
@@ -1189,6 +1253,19 @@ message GcpResource {
11891253
string type = 3;
11901254
}
11911255

1256+
// Minimum details to identify a Google Cloud resource for a backup.
1257+
message BackupGcpResource {
1258+
// Name of the Google Cloud resource.
1259+
string gcp_resourcename = 1;
1260+
1261+
// Location of the resource: <region>/<zone>/"global"/"unspecified".
1262+
string location = 2;
1263+
1264+
// Type of the resource. Use the Unified Resource Type,
1265+
// eg. compute.googleapis.com/Instance.
1266+
string type = 3;
1267+
}
1268+
11921269
// Backup configuration state. Is the resource configured for backup?
11931270
enum BackupConfigState {
11941271
// The possible states of backup configuration.

google/cloud/backupdr/v1/backupvault_cloudsql.proto

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,17 @@ message CloudSqlInstanceBackupProperties {
7979
}
8080
];
8181

82+
// Output only. The instance creation timestamp.
83+
google.protobuf.Timestamp instance_create_time = 5
84+
[(google.api.field_behavior) = OUTPUT_ONLY];
85+
8286
// Output only. The tier (or machine type) for this instance. Example:
8387
// `db-custom-1-3840`
8488
string instance_tier = 6 [(google.api.field_behavior) = OUTPUT_ONLY];
89+
90+
// Output only. The instance delete timestamp.
91+
google.protobuf.Timestamp instance_delete_time = 8
92+
[(google.api.field_behavior) = OUTPUT_ONLY];
8593
}
8694

8795
// CloudSqlInstanceDataSourceReferenceProperties represents the properties of a

google/cloud/backupdr/v1/datasourcereference.proto

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,11 @@ message DataSourceReference {
7373
// Output only. The GCP resource that the DataSource is associated with.
7474
DataSourceGcpResourceInfo data_source_gcp_resource_info = 7
7575
[(google.api.field_behavior) = OUTPUT_ONLY];
76+
77+
// Output only. Total size of the storage used by all backup resources for the
78+
// referenced datasource.
79+
optional int64 total_stored_bytes = 8
80+
[(google.api.field_behavior) = OUTPUT_ONLY];
7681
}
7782

7883
// Information of backup configuration on the DataSource.
@@ -122,6 +127,61 @@ message GetDataSourceReferenceRequest {
122127
];
123128
}
124129

130+
// Request for the ListDataSourceReferences method.
131+
message ListDataSourceReferencesRequest {
132+
// Required. The parent resource name.
133+
// Format: projects/{project}/locations/{location}
134+
string parent = 1 [
135+
(google.api.field_behavior) = REQUIRED,
136+
(google.api.resource_reference) = {
137+
child_type: "backupdr.googleapis.com/DataSourceReference"
138+
}
139+
];
140+
141+
// Optional. The maximum number of DataSourceReferences to return. The service
142+
// may return fewer than this value. If unspecified, at most 50
143+
// DataSourceReferences will be returned. The maximum value is 100; values
144+
// above 100 will be coerced to 100.
145+
int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL];
146+
147+
// Optional. A page token, received from a previous `ListDataSourceReferences`
148+
// call. Provide this to retrieve the subsequent page.
149+
//
150+
// When paginating, all other parameters provided to
151+
// `ListDataSourceReferences` must match the call that provided the page
152+
// token.
153+
string page_token = 3 [(google.api.field_behavior) = OPTIONAL];
154+
155+
// Optional. A filter expression that filters the results listed in the
156+
// response. The expression must specify the field name, a comparison
157+
// operator, and the value that you want to use for filtering.
158+
//
159+
// The following field and operator combinations are supported:
160+
//
161+
// * data_source_gcp_resource_info.gcp_resourcename with `=`, `!=`
162+
// * data_source_gcp_resource_info.type with `=`, `!=`
163+
string filter = 4 [(google.api.field_behavior) = OPTIONAL];
164+
165+
// Optional. A comma-separated list of fields to order by, sorted in ascending
166+
// order. Use "desc" after a field name for descending.
167+
//
168+
// Supported fields:
169+
//
170+
// * data_source
171+
// * data_source_gcp_resource_info.gcp_resourcename
172+
string order_by = 5 [(google.api.field_behavior) = OPTIONAL];
173+
}
174+
175+
// Response for the ListDataSourceReferences method.
176+
message ListDataSourceReferencesResponse {
177+
// The DataSourceReferences from the specified parent.
178+
repeated DataSourceReference data_source_references = 1;
179+
180+
// A token, which can be sent as `page_token` to retrieve the next page.
181+
// If this field is omitted, there are no subsequent pages.
182+
string next_page_token = 2;
183+
}
184+
125185
// Request for the FetchDataSourceReferencesForResourceType method.
126186
message FetchDataSourceReferencesForResourceTypeRequest {
127187
// Required. The parent resource name.

0 commit comments

Comments
 (0)