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