xref: /aosp_15_r20/external/googleapis/google/cloud/scheduler/v1beta1/cloudscheduler.proto (revision d5c09012810ac0c9f33fe448fb6da8260d444cc9)
1// Copyright 2022 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15syntax = "proto3";
16
17package google.cloud.scheduler.v1beta1;
18
19import "google/api/annotations.proto";
20import "google/api/client.proto";
21import "google/api/field_behavior.proto";
22import "google/api/resource.proto";
23import "google/cloud/scheduler/v1beta1/job.proto";
24import "google/protobuf/empty.proto";
25import "google/protobuf/field_mask.proto";
26
27option go_package = "cloud.google.com/go/scheduler/apiv1beta1/schedulerpb;schedulerpb";
28option java_multiple_files = true;
29option java_outer_classname = "SchedulerProto";
30option java_package = "com.google.cloud.scheduler.v1beta1";
31option objc_class_prefix = "SCHEDULER";
32
33// The Cloud Scheduler API allows external entities to reliably
34// schedule asynchronous jobs.
35service CloudScheduler {
36  option (google.api.default_host) = "cloudscheduler.googleapis.com";
37  option (google.api.oauth_scopes) =
38      "https://www.googleapis.com/auth/cloud-platform";
39
40  // Lists jobs.
41  rpc ListJobs(ListJobsRequest) returns (ListJobsResponse) {
42    option (google.api.http) = {
43      get: "/v1beta1/{parent=projects/*/locations/*}/jobs"
44    };
45    option (google.api.method_signature) = "parent";
46  }
47
48  // Gets a job.
49  rpc GetJob(GetJobRequest) returns (Job) {
50    option (google.api.http) = {
51      get: "/v1beta1/{name=projects/*/locations/*/jobs/*}"
52    };
53    option (google.api.method_signature) = "name";
54  }
55
56  // Creates a job.
57  rpc CreateJob(CreateJobRequest) returns (Job) {
58    option (google.api.http) = {
59      post: "/v1beta1/{parent=projects/*/locations/*}/jobs"
60      body: "job"
61    };
62    option (google.api.method_signature) = "parent,job";
63  }
64
65  // Updates a job.
66  //
67  // If successful, the updated [Job][google.cloud.scheduler.v1beta1.Job] is
68  // returned. If the job does not exist, `NOT_FOUND` is returned.
69  //
70  // If UpdateJob does not successfully return, it is possible for the
71  // job to be in an
72  // [Job.State.UPDATE_FAILED][google.cloud.scheduler.v1beta1.Job.State.UPDATE_FAILED]
73  // state. A job in this state may not be executed. If this happens, retry the
74  // UpdateJob request until a successful response is received.
75  rpc UpdateJob(UpdateJobRequest) returns (Job) {
76    option (google.api.http) = {
77      patch: "/v1beta1/{job.name=projects/*/locations/*/jobs/*}"
78      body: "job"
79    };
80    option (google.api.method_signature) = "job,update_mask";
81  }
82
83  // Deletes a job.
84  rpc DeleteJob(DeleteJobRequest) returns (google.protobuf.Empty) {
85    option (google.api.http) = {
86      delete: "/v1beta1/{name=projects/*/locations/*/jobs/*}"
87    };
88    option (google.api.method_signature) = "name";
89  }
90
91  // Pauses a job.
92  //
93  // If a job is paused then the system will stop executing the job
94  // until it is re-enabled via
95  // [ResumeJob][google.cloud.scheduler.v1beta1.CloudScheduler.ResumeJob]. The
96  // state of the job is stored in
97  // [state][google.cloud.scheduler.v1beta1.Job.state]; if paused it will be set
98  // to [Job.State.PAUSED][google.cloud.scheduler.v1beta1.Job.State.PAUSED]. A
99  // job must be in
100  // [Job.State.ENABLED][google.cloud.scheduler.v1beta1.Job.State.ENABLED] to be
101  // paused.
102  rpc PauseJob(PauseJobRequest) returns (Job) {
103    option (google.api.http) = {
104      post: "/v1beta1/{name=projects/*/locations/*/jobs/*}:pause"
105      body: "*"
106    };
107    option (google.api.method_signature) = "name";
108  }
109
110  // Resume a job.
111  //
112  // This method reenables a job after it has been
113  // [Job.State.PAUSED][google.cloud.scheduler.v1beta1.Job.State.PAUSED]. The
114  // state of a job is stored in
115  // [Job.state][google.cloud.scheduler.v1beta1.Job.state]; after calling this
116  // method it will be set to
117  // [Job.State.ENABLED][google.cloud.scheduler.v1beta1.Job.State.ENABLED]. A
118  // job must be in
119  // [Job.State.PAUSED][google.cloud.scheduler.v1beta1.Job.State.PAUSED] to be
120  // resumed.
121  rpc ResumeJob(ResumeJobRequest) returns (Job) {
122    option (google.api.http) = {
123      post: "/v1beta1/{name=projects/*/locations/*/jobs/*}:resume"
124      body: "*"
125    };
126    option (google.api.method_signature) = "name";
127  }
128
129  // Forces a job to run now.
130  //
131  // When this method is called, Cloud Scheduler will dispatch the job, even
132  // if the job is already running.
133  rpc RunJob(RunJobRequest) returns (Job) {
134    option (google.api.http) = {
135      post: "/v1beta1/{name=projects/*/locations/*/jobs/*}:run"
136      body: "*"
137    };
138    option (google.api.method_signature) = "name";
139  }
140}
141
142// Request message for listing jobs using
143// [ListJobs][google.cloud.scheduler.v1beta1.CloudScheduler.ListJobs].
144message ListJobsRequest {
145  // Required. The location name. For example:
146  // `projects/PROJECT_ID/locations/LOCATION_ID`.
147  string parent = 1 [
148    (google.api.field_behavior) = REQUIRED,
149    (google.api.resource_reference) = {
150      child_type: "cloudscheduler.googleapis.com/Job"
151    }
152  ];
153
154  // `filter` can be used to specify a subset of jobs.
155  //
156  // If `filter` equals `target_config="HttpConfig"`, then the http
157  // target jobs are retrieved. If `filter` equals
158  // `target_config="PubSubConfig"`, then the Pub/Sub target jobs are
159  // retrieved. If `filter` equals `labels.foo=value1
160  // labels.foo=value2` then only jobs which are labeled with
161  // foo=value1 AND foo=value2 will be returned.
162  string filter = 4;
163
164  // Requested page size.
165  //
166  // The maximum page size is 500. If unspecified, the page size will
167  // be the maximum. Fewer jobs than requested might be returned,
168  // even if more jobs exist; use next_page_token to determine if more
169  // jobs exist.
170  int32 page_size = 5;
171
172  // A token identifying a page of results the server will return. To
173  // request the first page results, page_token must be empty. To
174  // request the next page of results, page_token must be the value of
175  // [next_page_token][google.cloud.scheduler.v1beta1.ListJobsResponse.next_page_token]
176  // returned from the previous call to
177  // [ListJobs][google.cloud.scheduler.v1beta1.CloudScheduler.ListJobs]. It is
178  // an error to switch the value of
179  // [filter][google.cloud.scheduler.v1beta1.ListJobsRequest.filter] or
180  // [order_by][google.cloud.scheduler.v1beta1.ListJobsRequest.order_by] while
181  // iterating through pages.
182  string page_token = 6;
183
184  // This field is used to manage the legacy App Engine Cron jobs using the
185  // Cloud Scheduler API. If the field is set to true, the jobs in the __cron
186  // queue will be listed instead.
187  bool legacy_app_engine_cron = 7;
188}
189
190// Response message for listing jobs using
191// [ListJobs][google.cloud.scheduler.v1beta1.CloudScheduler.ListJobs].
192message ListJobsResponse {
193  // The list of jobs.
194  repeated Job jobs = 1;
195
196  // A token to retrieve next page of results. Pass this value in the
197  // [page_token][google.cloud.scheduler.v1beta1.ListJobsRequest.page_token]
198  // field in the subsequent call to
199  // [ListJobs][google.cloud.scheduler.v1beta1.CloudScheduler.ListJobs] to
200  // retrieve the next page of results. If this is empty it indicates that there
201  // are no more results through which to paginate.
202  //
203  // The page token is valid for only 2 hours.
204  string next_page_token = 2;
205}
206
207// Request message for
208// [GetJob][google.cloud.scheduler.v1beta1.CloudScheduler.GetJob].
209message GetJobRequest {
210  // Required. The job name. For example:
211  // `projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID`.
212  string name = 1 [
213    (google.api.field_behavior) = REQUIRED,
214    (google.api.resource_reference) = {
215      type: "cloudscheduler.googleapis.com/Job"
216    }
217  ];
218}
219
220// Request message for
221// [CreateJob][google.cloud.scheduler.v1beta1.CloudScheduler.CreateJob].
222message CreateJobRequest {
223  // Required. The location name. For example:
224  // `projects/PROJECT_ID/locations/LOCATION_ID`.
225  string parent = 1 [
226    (google.api.field_behavior) = REQUIRED,
227    (google.api.resource_reference) = {
228      child_type: "cloudscheduler.googleapis.com/Job"
229    }
230  ];
231
232  // Required. The job to add. The user can optionally specify a name for the
233  // job in [name][google.cloud.scheduler.v1beta1.Job.name].
234  // [name][google.cloud.scheduler.v1beta1.Job.name] cannot be the same as an
235  // existing job. If a name is not specified then the system will
236  // generate a random unique name that will be returned
237  // ([name][google.cloud.scheduler.v1beta1.Job.name]) in the response.
238  Job job = 2 [(google.api.field_behavior) = REQUIRED];
239}
240
241// Request message for
242// [UpdateJob][google.cloud.scheduler.v1beta1.CloudScheduler.UpdateJob].
243message UpdateJobRequest {
244  // Required. The new job properties.
245  // [name][google.cloud.scheduler.v1beta1.Job.name] must be specified.
246  //
247  // Output only fields cannot be modified using UpdateJob.
248  // Any value specified for an output only field will be ignored.
249  Job job = 1 [(google.api.field_behavior) = REQUIRED];
250
251  // A  mask used to specify which fields of the job are being updated.
252  google.protobuf.FieldMask update_mask = 2;
253}
254
255// Request message for deleting a job using
256// [DeleteJob][google.cloud.scheduler.v1beta1.CloudScheduler.DeleteJob].
257message DeleteJobRequest {
258  // Required. The job name. For example:
259  // `projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID`.
260  string name = 1 [
261    (google.api.field_behavior) = REQUIRED,
262    (google.api.resource_reference) = {
263      type: "cloudscheduler.googleapis.com/Job"
264    }
265  ];
266
267  // This field is used to manage the legacy App Engine Cron jobs using the
268  // Cloud Scheduler API. If the field is set to true, the job in the __cron
269  // queue with the corresponding name will be deleted instead.
270  bool legacy_app_engine_cron = 2;
271}
272
273// Request message for
274// [PauseJob][google.cloud.scheduler.v1beta1.CloudScheduler.PauseJob].
275message PauseJobRequest {
276  // Required. The job name. For example:
277  // `projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID`.
278  string name = 1 [
279    (google.api.field_behavior) = REQUIRED,
280    (google.api.resource_reference) = {
281      type: "cloudscheduler.googleapis.com/Job"
282    }
283  ];
284}
285
286// Request message for
287// [ResumeJob][google.cloud.scheduler.v1beta1.CloudScheduler.ResumeJob].
288message ResumeJobRequest {
289  // Required. The job name. For example:
290  // `projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID`.
291  string name = 1 [
292    (google.api.field_behavior) = REQUIRED,
293    (google.api.resource_reference) = {
294      type: "cloudscheduler.googleapis.com/Job"
295    }
296  ];
297}
298
299// Request message for forcing a job to run now using
300// [RunJob][google.cloud.scheduler.v1beta1.CloudScheduler.RunJob].
301message RunJobRequest {
302  // Required. The job name. For example:
303  // `projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID`.
304  string name = 1 [
305    (google.api.field_behavior) = REQUIRED,
306    (google.api.resource_reference) = {
307      type: "cloudscheduler.googleapis.com/Job"
308    }
309  ];
310
311  // This field is used to manage the legacy App Engine Cron jobs using the
312  // Cloud Scheduler API. If the field is set to true, the job in the __cron
313  // queue with the corresponding name will be forced to run instead.
314  bool legacy_app_engine_cron = 2;
315}
316