cloudscheduler.proto 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268
  1. // Copyright 2019 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. //
  15. syntax = "proto3";
  16. package google.cloud.scheduler.v1;
  17. import "google/api/annotations.proto";
  18. import "google/api/client.proto";
  19. import "google/api/field_behavior.proto";
  20. import "google/api/resource.proto";
  21. import "google/cloud/scheduler/v1/job.proto";
  22. import "google/protobuf/empty.proto";
  23. import "google/protobuf/field_mask.proto";
  24. option go_package = "google.golang.org/genproto/googleapis/cloud/scheduler/v1;scheduler";
  25. option java_multiple_files = true;
  26. option java_outer_classname = "SchedulerProto";
  27. option java_package = "com.google.cloud.scheduler.v1";
  28. option objc_class_prefix = "SCHEDULER";
  29. // The Cloud Scheduler API allows external entities to reliably
  30. // schedule asynchronous jobs.
  31. service CloudScheduler {
  32. option (google.api.default_host) = "cloudscheduler.googleapis.com";
  33. option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform";
  34. // Lists jobs.
  35. rpc ListJobs(ListJobsRequest) returns (ListJobsResponse) {
  36. option (google.api.http) = {
  37. get: "/v1/{parent=projects/*/locations/*}/jobs"
  38. };
  39. option (google.api.method_signature) = "parent";
  40. }
  41. // Gets a job.
  42. rpc GetJob(GetJobRequest) returns (Job) {
  43. option (google.api.http) = {
  44. get: "/v1/{name=projects/*/locations/*/jobs/*}"
  45. };
  46. option (google.api.method_signature) = "name";
  47. }
  48. // Creates a job.
  49. rpc CreateJob(CreateJobRequest) returns (Job) {
  50. option (google.api.http) = {
  51. post: "/v1/{parent=projects/*/locations/*}/jobs"
  52. body: "job"
  53. };
  54. option (google.api.method_signature) = "parent,job";
  55. }
  56. // Updates a job.
  57. //
  58. // If successful, the updated [Job][google.cloud.scheduler.v1.Job] is returned. If the job does
  59. // not exist, `NOT_FOUND` is returned.
  60. //
  61. // If UpdateJob does not successfully return, it is possible for the
  62. // job to be in an [Job.State.UPDATE_FAILED][google.cloud.scheduler.v1.Job.State.UPDATE_FAILED] state. A job in this state may
  63. // not be executed. If this happens, retry the UpdateJob request
  64. // until a successful response is received.
  65. rpc UpdateJob(UpdateJobRequest) returns (Job) {
  66. option (google.api.http) = {
  67. patch: "/v1/{job.name=projects/*/locations/*/jobs/*}"
  68. body: "job"
  69. };
  70. option (google.api.method_signature) = "job,update_mask";
  71. }
  72. // Deletes a job.
  73. rpc DeleteJob(DeleteJobRequest) returns (google.protobuf.Empty) {
  74. option (google.api.http) = {
  75. delete: "/v1/{name=projects/*/locations/*/jobs/*}"
  76. };
  77. option (google.api.method_signature) = "name";
  78. }
  79. // Pauses a job.
  80. //
  81. // If a job is paused then the system will stop executing the job
  82. // until it is re-enabled via [ResumeJob][google.cloud.scheduler.v1.CloudScheduler.ResumeJob]. The
  83. // state of the job is stored in [state][google.cloud.scheduler.v1.Job.state]; if paused it
  84. // will be set to [Job.State.PAUSED][google.cloud.scheduler.v1.Job.State.PAUSED]. A job must be in [Job.State.ENABLED][google.cloud.scheduler.v1.Job.State.ENABLED]
  85. // to be paused.
  86. rpc PauseJob(PauseJobRequest) returns (Job) {
  87. option (google.api.http) = {
  88. post: "/v1/{name=projects/*/locations/*/jobs/*}:pause"
  89. body: "*"
  90. };
  91. option (google.api.method_signature) = "name";
  92. }
  93. // Resume a job.
  94. //
  95. // This method reenables a job after it has been [Job.State.PAUSED][google.cloud.scheduler.v1.Job.State.PAUSED]. The
  96. // state of a job is stored in [Job.state][google.cloud.scheduler.v1.Job.state]; after calling this method it
  97. // will be set to [Job.State.ENABLED][google.cloud.scheduler.v1.Job.State.ENABLED]. A job must be in
  98. // [Job.State.PAUSED][google.cloud.scheduler.v1.Job.State.PAUSED] to be resumed.
  99. rpc ResumeJob(ResumeJobRequest) returns (Job) {
  100. option (google.api.http) = {
  101. post: "/v1/{name=projects/*/locations/*/jobs/*}:resume"
  102. body: "*"
  103. };
  104. option (google.api.method_signature) = "name";
  105. }
  106. // Forces a job to run now.
  107. //
  108. // When this method is called, Cloud Scheduler will dispatch the job, even
  109. // if the job is already running.
  110. rpc RunJob(RunJobRequest) returns (Job) {
  111. option (google.api.http) = {
  112. post: "/v1/{name=projects/*/locations/*/jobs/*}:run"
  113. body: "*"
  114. };
  115. option (google.api.method_signature) = "name";
  116. }
  117. }
  118. // Request message for listing jobs using [ListJobs][google.cloud.scheduler.v1.CloudScheduler.ListJobs].
  119. message ListJobsRequest {
  120. // Required. The location name. For example:
  121. // `projects/PROJECT_ID/locations/LOCATION_ID`.
  122. string parent = 1 [
  123. (google.api.field_behavior) = REQUIRED,
  124. (google.api.resource_reference) = {
  125. child_type: "cloudscheduler.googleapis.com/Job"
  126. }
  127. ];
  128. // Requested page size.
  129. //
  130. // The maximum page size is 500. If unspecified, the page size will
  131. // be the maximum. Fewer jobs than requested might be returned,
  132. // even if more jobs exist; use next_page_token to determine if more
  133. // jobs exist.
  134. int32 page_size = 5;
  135. // A token identifying a page of results the server will return. To
  136. // request the first page results, page_token must be empty. To
  137. // request the next page of results, page_token must be the value of
  138. // [next_page_token][google.cloud.scheduler.v1.ListJobsResponse.next_page_token] returned from
  139. // the previous call to [ListJobs][google.cloud.scheduler.v1.CloudScheduler.ListJobs]. It is an error to
  140. // switch the value of [filter][google.cloud.scheduler.v1.ListJobsRequest.filter] or
  141. // [order_by][google.cloud.scheduler.v1.ListJobsRequest.order_by] while iterating through pages.
  142. string page_token = 6;
  143. }
  144. // Response message for listing jobs using [ListJobs][google.cloud.scheduler.v1.CloudScheduler.ListJobs].
  145. message ListJobsResponse {
  146. // The list of jobs.
  147. repeated Job jobs = 1;
  148. // A token to retrieve next page of results. Pass this value in the
  149. // [page_token][google.cloud.scheduler.v1.ListJobsRequest.page_token] field in the subsequent call to
  150. // [ListJobs][google.cloud.scheduler.v1.CloudScheduler.ListJobs] to retrieve the next page of results.
  151. // If this is empty it indicates that there are no more results
  152. // through which to paginate.
  153. //
  154. // The page token is valid for only 2 hours.
  155. string next_page_token = 2;
  156. }
  157. // Request message for [GetJob][google.cloud.scheduler.v1.CloudScheduler.GetJob].
  158. message GetJobRequest {
  159. // Required. The job name. For example:
  160. // `projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID`.
  161. string name = 1 [
  162. (google.api.field_behavior) = REQUIRED,
  163. (google.api.resource_reference) = {
  164. type: "cloudscheduler.googleapis.com/Job"
  165. }
  166. ];
  167. }
  168. // Request message for [CreateJob][google.cloud.scheduler.v1.CloudScheduler.CreateJob].
  169. message CreateJobRequest {
  170. // Required. The location name. For example:
  171. // `projects/PROJECT_ID/locations/LOCATION_ID`.
  172. string parent = 1 [
  173. (google.api.field_behavior) = REQUIRED,
  174. (google.api.resource_reference) = {
  175. child_type: "cloudscheduler.googleapis.com/Job"
  176. }
  177. ];
  178. // Required. The job to add. The user can optionally specify a name for the
  179. // job in [name][google.cloud.scheduler.v1.Job.name]. [name][google.cloud.scheduler.v1.Job.name] cannot be the same as an
  180. // existing job. If a name is not specified then the system will
  181. // generate a random unique name that will be returned
  182. // ([name][google.cloud.scheduler.v1.Job.name]) in the response.
  183. Job job = 2 [(google.api.field_behavior) = REQUIRED];
  184. }
  185. // Request message for [UpdateJob][google.cloud.scheduler.v1.CloudScheduler.UpdateJob].
  186. message UpdateJobRequest {
  187. // Required. The new job properties. [name][google.cloud.scheduler.v1.Job.name] must be specified.
  188. //
  189. // Output only fields cannot be modified using UpdateJob.
  190. // Any value specified for an output only field will be ignored.
  191. Job job = 1 [(google.api.field_behavior) = REQUIRED];
  192. // A mask used to specify which fields of the job are being updated.
  193. google.protobuf.FieldMask update_mask = 2
  194. [(google.api.field_behavior) = REQUIRED];
  195. }
  196. // Request message for deleting a job using
  197. // [DeleteJob][google.cloud.scheduler.v1.CloudScheduler.DeleteJob].
  198. message DeleteJobRequest {
  199. // Required. The job name. For example:
  200. // `projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID`.
  201. string name = 1 [
  202. (google.api.field_behavior) = REQUIRED,
  203. (google.api.resource_reference) = {
  204. type: "cloudscheduler.googleapis.com/Job"
  205. }
  206. ];
  207. }
  208. // Request message for [PauseJob][google.cloud.scheduler.v1.CloudScheduler.PauseJob].
  209. message PauseJobRequest {
  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. // Request message for [ResumeJob][google.cloud.scheduler.v1.CloudScheduler.ResumeJob].
  220. message ResumeJobRequest {
  221. // Required. The job name. For example:
  222. // `projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID`.
  223. string name = 1 [
  224. (google.api.field_behavior) = REQUIRED,
  225. (google.api.resource_reference) = {
  226. type: "cloudscheduler.googleapis.com/Job"
  227. }
  228. ];
  229. }
  230. // Request message for forcing a job to run now using
  231. // [RunJob][google.cloud.scheduler.v1.CloudScheduler.RunJob].
  232. message RunJobRequest {
  233. // Required. The job name. For example:
  234. // `projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID`.
  235. string name = 1 [
  236. (google.api.field_behavior) = REQUIRED,
  237. (google.api.resource_reference) = {
  238. type: "cloudscheduler.googleapis.com/Job"
  239. }
  240. ];
  241. }