Skip to content

Commit d4acb64

Browse files
Google APIscopybara-github
authored andcommitted
feat: add block_project_ssh_keys field to the v1alpha job API to block project level ssh keys access to Batch created VMs
--- feat: remove visibility restriction of cancel job api, allow in v1alpha --- feat: update Go Datastore import path feat: update Go Bigtable import path --- docs: Refine usage scope for field `task_execution` and `task_state` in `status_events` PiperOrigin-RevId: 659840586
1 parent 7314e20 commit d4acb64

4 files changed

Lines changed: 76 additions & 7 deletions

File tree

google/cloud/batch/v1alpha/batch.proto

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,19 @@ service BatchService {
7575
};
7676
}
7777

78+
// Cancel a Job.
79+
rpc CancelJob(CancelJobRequest) returns (google.longrunning.Operation) {
80+
option (google.api.http) = {
81+
post: "/v1alpha/{name=projects/*/locations/*/jobs/*}:cancel"
82+
body: "*"
83+
};
84+
option (google.api.method_signature) = "name";
85+
option (google.longrunning.operation_info) = {
86+
response_type: "CancelJobResponse"
87+
metadata_type: "google.cloud.batch.v1alpha.OperationMetadata"
88+
};
89+
}
90+
7891
// Update a Job.
7992
rpc UpdateJob(UpdateJobRequest) returns (Job) {
8093
option (google.api.http) = {
@@ -233,6 +246,36 @@ message DeleteJobRequest {
233246
string request_id = 4 [(google.api.field_behavior) = OPTIONAL];
234247
}
235248

249+
// CancelJob Request.
250+
message CancelJobRequest {
251+
// Required. Job name.
252+
string name = 1 [
253+
(google.api.field_behavior) = REQUIRED,
254+
(google.api.resource_reference) = { type: "batch.googleapis.com/Job" }
255+
];
256+
257+
// Optional. An optional request ID to identify requests. Specify a unique
258+
// request ID so that if you must retry your request, the server will know to
259+
// ignore the request if it has already been completed. The server will
260+
// guarantee that for at least 60 minutes after the first request.
261+
//
262+
// For example, consider a situation where you make an initial request and
263+
// the request times out. If you make the request again with the same request
264+
// ID, the server can check if original operation with the same request ID
265+
// was received, and if so, will ignore the second request. This prevents
266+
// clients from accidentally creating duplicate commitments.
267+
//
268+
// The request ID must be a valid UUID with the exception that zero UUID is
269+
// not supported (00000000-0000-0000-0000-000000000000).
270+
string request_id = 4 [
271+
(google.api.field_info).format = UUID4,
272+
(google.api.field_behavior) = OPTIONAL
273+
];
274+
}
275+
276+
// Response to the CancelJob request.
277+
message CancelJobResponse {}
278+
236279
// UpdateJob Request.
237280
message UpdateJobRequest {
238281
// Required. The Job to update.

google/cloud/batch/v1alpha/batch_v1alpha_grpc_service_config.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@
44
{ "service": "google.cloud.batch.v1alpha.BatchService", "method": "ListJobs" },
55
{ "service": "google.cloud.batch.v1alpha.BatchService", "method": "ListTasks" },
66
{ "service": "google.cloud.batch.v1alpha.BatchService", "method": "ListResourceAllowances" },
7+
{ "service": "google.cloud.batch.v1alpha.BatchService", "method": "ListNodePools" },
78
{ "service": "google.cloud.batch.v1alpha.BatchService", "method": "GetJob" },
89
{ "service": "google.cloud.batch.v1alpha.BatchService", "method": "GetTask" },
9-
{ "service": "google.cloud.batch.v1alpha.BatchService", "method": "GetResourceAllowance" }
10+
{ "service": "google.cloud.batch.v1alpha.BatchService", "method": "GetResourceAllowance" },
11+
{ "service": "google.cloud.batch.v1alpha.BatchService", "method": "GetNodePool" }
1012
],
1113
"timeout": "60s",
1214
"retryPolicy": {
@@ -26,7 +28,9 @@
2628
{ "service": "google.cloud.batch.v1alpha.BatchService", "method": "CreateResourceAllowance" },
2729
{ "service": "google.cloud.batch.v1alpha.BatchService", "method": "DeleteResourceAllowance" },
2830
{ "service": "google.cloud.batch.v1alpha.BatchService", "method": "UpdateResourceAllowance"},
29-
{ "service": "google.cloud.batch.v1alpha.BatchService", "method": "CancelTasks"}
31+
{ "service": "google.cloud.batch.v1alpha.BatchService", "method": "CancelTasks"},
32+
{ "service": "google.cloud.batch.v1alpha.BatchService", "method": "CreateNodePool" },
33+
{ "service": "google.cloud.batch.v1alpha.BatchService", "method": "DeleteNodePool" }
3034
],
3135
"timeout": "60s"
3236
}]

google/cloud/batch/v1alpha/job.proto

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -511,6 +511,25 @@ message AllocationPolicy {
511511
// Optional. Set this field true if you want Batch to install Ops Agent on
512512
// your behalf. Default is false.
513513
bool install_ops_agent = 4 [(google.api.field_behavior) = OPTIONAL];
514+
515+
// Optional. Set this field to `true` if you want Batch to block
516+
// project-level SSH keys from accessing this job's VMs. Alternatively, you
517+
// can configure the job to specify a VM instance template that blocks
518+
// project-level SSH keys. In either case, Batch blocks project-level SSH
519+
// keys while creating the VMs for this job.
520+
//
521+
// Batch allows project-level SSH keys for a job's VMs only if all
522+
// the following are true:
523+
//
524+
// + This field is undefined or set to `false`.
525+
// + The job's VM instance template (if any) doesn't block project-level
526+
// SSH keys.
527+
//
528+
// Notably, you can override this behavior by manually updating a VM to
529+
// block or allow project-level SSH keys. For more information about
530+
// blocking project-level SSH keys, see the Compute Engine documentation:
531+
// https://cloud.google.com/compute/docs/connect/restrict-ssh-keys#block-keys
532+
bool block_project_ssh_keys = 5 [(google.api.field_behavior) = OPTIONAL];
514533
}
515534

516535
// A network interface.

google/cloud/batch/v1alpha/task.proto

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ message ComputeResource {
8686
int64 boot_disk_mib = 4;
8787
}
8888

89-
// Status event
89+
// Status event.
9090
message StatusEvent {
9191
// Type of the event.
9292
string type = 3;
@@ -97,10 +97,13 @@ message StatusEvent {
9797
// The time this event occurred.
9898
google.protobuf.Timestamp event_time = 2;
9999

100-
// Task Execution
100+
// Task Execution.
101+
// This field is only defined for task-level status events where the task
102+
// fails.
101103
TaskExecution task_execution = 4;
102104

103-
// Task State
105+
// Task State.
106+
// This field is only defined for task-level status events.
104107
TaskStatus.State task_state = 5;
105108
}
106109

@@ -125,7 +128,7 @@ message TaskExecution {
125128
string stderr_snippet = 2 [(google.api.field_behavior) = OPTIONAL];
126129
}
127130

128-
// Status of a task
131+
// Status of a task.
129132
message TaskStatus {
130133
// Task states.
131134
enum State {
@@ -151,7 +154,7 @@ message TaskStatus {
151154
UNEXECUTED = 6;
152155
}
153156

154-
// Task state
157+
// Task state.
155158
State state = 1;
156159

157160
// Detailed info about why the state is reached.

0 commit comments

Comments
 (0)