Skip to content

Commit 713ac6c

Browse files
Google APIscopybara-github
authored andcommitted
feat: onboard Resource Allowance API methods on v1alpha
PiperOrigin-RevId: 619697259
1 parent 0e74ae7 commit 713ac6c

3 files changed

Lines changed: 391 additions & 0 deletions

File tree

google/cloud/batch/v1alpha/batch.proto

Lines changed: 211 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,11 @@ import "google/api/field_behavior.proto";
2222
import "google/api/field_info.proto";
2323
import "google/api/resource.proto";
2424
import "google/cloud/batch/v1alpha/job.proto";
25+
import "google/cloud/batch/v1alpha/resource_allowance.proto";
2526
import "google/cloud/batch/v1alpha/task.proto";
2627
import "google/longrunning/operations.proto";
2728
import "google/protobuf/empty.proto";
29+
import "google/protobuf/field_mask.proto";
2830
import "google/protobuf/timestamp.proto";
2931

3032
option csharp_namespace = "Google.Cloud.Batch.V1Alpha";
@@ -96,6 +98,58 @@ service BatchService {
9698
};
9799
option (google.api.method_signature) = "parent";
98100
}
101+
102+
// Create a Resource Allowance.
103+
rpc CreateResourceAllowance(CreateResourceAllowanceRequest)
104+
returns (ResourceAllowance) {
105+
option (google.api.http) = {
106+
post: "/v1alpha/{parent=projects/*/locations/*}/resourceAllowances"
107+
body: "resource_allowance"
108+
};
109+
option (google.api.method_signature) =
110+
"parent,resource_allowance,resource_allowance_id";
111+
}
112+
113+
// Get a ResourceAllowance specified by its resource name.
114+
rpc GetResourceAllowance(GetResourceAllowanceRequest)
115+
returns (ResourceAllowance) {
116+
option (google.api.http) = {
117+
get: "/v1alpha/{name=projects/*/locations/*/resourceAllowances/*}"
118+
};
119+
option (google.api.method_signature) = "name";
120+
}
121+
122+
// Delete a ResourceAllowance.
123+
rpc DeleteResourceAllowance(DeleteResourceAllowanceRequest)
124+
returns (google.longrunning.Operation) {
125+
option (google.api.http) = {
126+
delete: "/v1alpha/{name=projects/*/locations/*/resourceAllowances/*}"
127+
};
128+
option (google.api.method_signature) = "name";
129+
option (google.longrunning.operation_info) = {
130+
response_type: "google.protobuf.Empty"
131+
metadata_type: "google.cloud.batch.v1alpha.OperationMetadata"
132+
};
133+
}
134+
135+
// List all ResourceAllowances for a project within a region.
136+
rpc ListResourceAllowances(ListResourceAllowancesRequest)
137+
returns (ListResourceAllowancesResponse) {
138+
option (google.api.http) = {
139+
get: "/v1alpha/{parent=projects/*/locations/*}/resourceAllowances"
140+
};
141+
option (google.api.method_signature) = "parent";
142+
}
143+
144+
// Update a Resource Allowance.
145+
rpc UpdateResourceAllowance(UpdateResourceAllowanceRequest)
146+
returns (ResourceAllowance) {
147+
option (google.api.http) = {
148+
patch: "/v1alpha/{resource_allowance.name=projects/*/locations/*/resourceAllowances/*}"
149+
body: "resource_allowance"
150+
};
151+
option (google.api.method_signature) = "resource_allowance,update_mask";
152+
}
99153
}
100154

101155
// CreateJob Request.
@@ -247,6 +301,163 @@ message GetTaskRequest {
247301
];
248302
}
249303

304+
// CreateResourceAllowance Request.
305+
message CreateResourceAllowanceRequest {
306+
// Required. The parent resource name where the ResourceAllowance will be
307+
// created. Pattern: "projects/{project}/locations/{location}"
308+
string parent = 1 [
309+
(google.api.field_behavior) = REQUIRED,
310+
(google.api.resource_reference) = {
311+
child_type: "batch.googleapis.com/ResourceAllowance"
312+
}
313+
];
314+
315+
// ID used to uniquely identify the ResourceAllowance within its parent scope.
316+
// This field should contain at most 63 characters and must start with
317+
// lowercase characters.
318+
// Only lowercase characters, numbers and '-' are accepted.
319+
// The '-' character cannot be the first or the last one.
320+
// A system generated ID will be used if the field is not set.
321+
//
322+
// The resource_allowance.name field in the request will be ignored and the
323+
// created resource name of the ResourceAllowance will be
324+
// "{parent}/resourceAllowances/{resource_allowance_id}".
325+
string resource_allowance_id = 2;
326+
327+
// Required. The ResourceAllowance to create.
328+
ResourceAllowance resource_allowance = 3
329+
[(google.api.field_behavior) = REQUIRED];
330+
331+
// Optional. An optional request ID to identify requests. Specify a unique
332+
// request ID so that if you must retry your request, the server will know to
333+
// ignore the request if it has already been completed. The server will
334+
// guarantee that for at least 60 minutes since the first request.
335+
//
336+
// For example, consider a situation where you make an initial request and
337+
// the request times out. If you make the request again with the same request
338+
// ID, the server can check if original operation with the same request ID
339+
// was received, and if so, will ignore the second request. This prevents
340+
// clients from accidentally creating duplicate commitments.
341+
//
342+
// The request ID must be a valid UUID with the exception that zero UUID is
343+
// not supported (00000000-0000-0000-0000-000000000000).
344+
string request_id = 4 [
345+
(google.api.field_info).format = UUID4,
346+
(google.api.field_behavior) = OPTIONAL
347+
];
348+
}
349+
350+
// GetResourceAllowance Request.
351+
message GetResourceAllowanceRequest {
352+
// Required. ResourceAllowance name.
353+
string name = 1 [
354+
(google.api.field_behavior) = REQUIRED,
355+
(google.api.resource_reference) = {
356+
type: "batch.googleapis.com/ResourceAllowance"
357+
}
358+
];
359+
}
360+
361+
// DeleteResourceAllowance Request.
362+
message DeleteResourceAllowanceRequest {
363+
// Required. ResourceAllowance name.
364+
string name = 1 [
365+
(google.api.field_behavior) = REQUIRED,
366+
(google.api.resource_reference) = {
367+
type: "batch.googleapis.com/ResourceAllowance"
368+
}
369+
];
370+
371+
// Optional. Reason for this deletion.
372+
string reason = 2 [(google.api.field_behavior) = OPTIONAL];
373+
374+
// Optional. An optional request ID to identify requests. Specify a unique
375+
// request ID so that if you must retry your request, the server will know to
376+
// ignore the request if it has already been completed. The server will
377+
// guarantee that for at least 60 minutes after the first request.
378+
//
379+
// For example, consider a situation where you make an initial request and
380+
// the request times out. If you make the request again with the same request
381+
// ID, the server can check if original operation with the same request ID
382+
// was received, and if so, will ignore the second request. This prevents
383+
// clients from accidentally creating duplicate commitments.
384+
//
385+
// The request ID must be a valid UUID with the exception that zero UUID is
386+
// not supported (00000000-0000-0000-0000-000000000000).
387+
string request_id = 4 [
388+
(google.api.field_info).format = UUID4,
389+
(google.api.field_behavior) = OPTIONAL
390+
];
391+
}
392+
393+
// ListResourceAllowances Request.
394+
message ListResourceAllowancesRequest {
395+
// Required. Parent path.
396+
string parent = 1 [
397+
(google.api.field_behavior) = REQUIRED,
398+
(google.api.resource_reference) = {
399+
child_type: "batch.googleapis.com/ResourceAllowance"
400+
}
401+
];
402+
403+
// Optional. Page size.
404+
int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL];
405+
406+
// Optional. Page token.
407+
string page_token = 3 [(google.api.field_behavior) = OPTIONAL];
408+
}
409+
410+
// ListResourceAllowances Response.
411+
message ListResourceAllowancesResponse {
412+
// ResourceAllowances.
413+
repeated ResourceAllowance resource_allowances = 1;
414+
415+
// Next page token.
416+
string next_page_token = 2;
417+
418+
// Locations that could not be reached.
419+
repeated string unreachable = 3;
420+
}
421+
422+
// UpdateResourceAllowance Request.
423+
message UpdateResourceAllowanceRequest {
424+
// Required. The ResourceAllowance to update.
425+
// Update description.
426+
// Only fields specified in `update_mask` are updated.
427+
ResourceAllowance resource_allowance = 1
428+
[(google.api.field_behavior) = REQUIRED];
429+
430+
// Required. Mask of fields to update.
431+
//
432+
// Field mask is used to specify the fields to be overwritten in the
433+
// ResourceAllowance resource by the update.
434+
// The fields specified in the update_mask are relative to the resource, not
435+
// the full request. A field will be overwritten if it is in the mask. If the
436+
// user does not provide a mask then all fields will be overwritten.
437+
//
438+
// UpdateResourceAllowance request now only supports update on `limit` field.
439+
google.protobuf.FieldMask update_mask = 2
440+
[(google.api.field_behavior) = REQUIRED];
441+
442+
// Optional. An optional request ID to identify requests. Specify a unique
443+
// request ID so that if you must retry your request, the server will know to
444+
// ignore the request if it has already been completed. The server will
445+
// guarantee that for at least 60 minutes since the first request.
446+
//
447+
// For example, consider a situation where you make an initial request and
448+
// the request times out. If you make the request again with the same request
449+
// ID, the server can check if original operation with the same request ID
450+
// was received, and if so, will ignore the second request. This prevents
451+
// clients from accidentally creating duplicate commitments.
452+
//
453+
// The request ID must be a valid UUID with the exception that zero UUID is
454+
// not supported (00000000-0000-0000-0000-000000000000).
455+
string request_id = 3 [
456+
(google.api.field_info).format = UUID4,
457+
(google.api.field_behavior) = OPTIONAL
458+
];
459+
}
460+
250461
// Represents the metadata of the long-running operation.
251462
message OperationMetadata {
252463
// Output only. The time the operation was created.

google/cloud/batch/v1alpha/notification.proto

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,13 @@ option java_package = "com.google.cloud.batch.v1alpha";
2626
option objc_class_prefix = "GCB";
2727
option php_namespace = "Google\\Cloud\\Batch\\V1alpha";
2828
option ruby_package = "Google::Cloud::Batch::V1alpha";
29+
30+
// Notification on resource state change.
31+
message Notification {
32+
// Required. The Pub/Sub topic where notifications like the resource allowance
33+
// state changes will be published. The topic must exist in the same project
34+
// as the job and billings will be charged to this project. If not specified,
35+
// no Pub/Sub messages will be sent. Topic format:
36+
// `projects/{project}/topics/{topic}`.
37+
string pubsub_topic = 1 [(google.api.field_behavior) = REQUIRED];
38+
}

0 commit comments

Comments
 (0)