target.proto 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356
  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/resource.proto";
  18. import "google/api/annotations.proto";
  19. option go_package = "google.golang.org/genproto/googleapis/cloud/scheduler/v1;scheduler";
  20. option java_multiple_files = true;
  21. option java_outer_classname = "TargetProto";
  22. option java_package = "com.google.cloud.scheduler.v1";
  23. // Http target. The job will be pushed to the job handler by means of
  24. // an HTTP request via an [http_method][google.cloud.scheduler.v1.HttpTarget.http_method] such as HTTP
  25. // POST, HTTP GET, etc. The job is acknowledged by means of an HTTP
  26. // response code in the range [200 - 299]. A failure to receive a response
  27. // constitutes a failed execution. For a redirected request, the response
  28. // returned by the redirected request is considered.
  29. message HttpTarget {
  30. // Required. The full URI path that the request will be sent to. This string
  31. // must begin with either "http://" or "https://". Some examples of
  32. // valid values for [uri][google.cloud.scheduler.v1.HttpTarget.uri] are:
  33. // `http://acme.com` and `https://acme.com/sales:8080`. Cloud Scheduler will
  34. // encode some characters for safety and compatibility. The maximum allowed
  35. // URL length is 2083 characters after encoding.
  36. string uri = 1;
  37. // Which HTTP method to use for the request.
  38. HttpMethod http_method = 2;
  39. // The user can specify HTTP request headers to send with the job's
  40. // HTTP request. This map contains the header field names and
  41. // values. Repeated headers are not supported, but a header value can
  42. // contain commas. These headers represent a subset of the headers
  43. // that will accompany the job's HTTP request. Some HTTP request
  44. // headers will be ignored or replaced. A partial list of headers that
  45. // will be ignored or replaced is below:
  46. // - Host: This will be computed by Cloud Scheduler and derived from
  47. // [uri][google.cloud.scheduler.v1.HttpTarget.uri].
  48. // * `Content-Length`: This will be computed by Cloud Scheduler.
  49. // * `User-Agent`: This will be set to `"Google-Cloud-Scheduler"`.
  50. // * `X-Google-*`: Google internal use only.
  51. // * `X-AppEngine-*`: Google internal use only.
  52. //
  53. // The total size of headers must be less than 80KB.
  54. map<string, string> headers = 3;
  55. // HTTP request body. A request body is allowed only if the HTTP
  56. // method is POST, PUT, or PATCH. It is an error to set body on a job with an
  57. // incompatible [HttpMethod][google.cloud.scheduler.v1.HttpMethod].
  58. bytes body = 4;
  59. // The mode for generating an `Authorization` header for HTTP requests.
  60. //
  61. // If specified, all `Authorization` headers in the [HttpTarget.headers][google.cloud.scheduler.v1.HttpTarget.headers]
  62. // field will be overridden.
  63. oneof authorization_header {
  64. // If specified, an
  65. // [OAuth token](https://developers.google.com/identity/protocols/OAuth2)
  66. // will be generated and attached as an `Authorization` header in the HTTP
  67. // request.
  68. //
  69. // This type of authorization should generally only be used when calling
  70. // Google APIs hosted on *.googleapis.com.
  71. OAuthToken oauth_token = 5;
  72. // If specified, an
  73. // [OIDC](https://developers.google.com/identity/protocols/OpenIDConnect)
  74. // token will be generated and attached as an `Authorization` header in the
  75. // HTTP request.
  76. //
  77. // This type of authorization can be used for many scenarios, including
  78. // calling Cloud Run, or endpoints where you intend to validate the token
  79. // yourself.
  80. OidcToken oidc_token = 6;
  81. }
  82. }
  83. // App Engine target. The job will be pushed to a job handler by means
  84. // of an HTTP request via an [http_method][google.cloud.scheduler.v1.AppEngineHttpTarget.http_method] such
  85. // as HTTP POST, HTTP GET, etc. The job is acknowledged by means of an
  86. // HTTP response code in the range [200 - 299]. Error 503 is
  87. // considered an App Engine system error instead of an application
  88. // error. Requests returning error 503 will be retried regardless of
  89. // retry configuration and not counted against retry counts. Any other
  90. // response code, or a failure to receive a response before the
  91. // deadline, constitutes a failed attempt.
  92. message AppEngineHttpTarget {
  93. // The HTTP method to use for the request. PATCH and OPTIONS are not
  94. // permitted.
  95. HttpMethod http_method = 1;
  96. // App Engine Routing setting for the job.
  97. AppEngineRouting app_engine_routing = 2;
  98. // The relative URI.
  99. //
  100. // The relative URL must begin with "/" and must be a valid HTTP relative URL.
  101. // It can contain a path, query string arguments, and `#` fragments.
  102. // If the relative URL is empty, then the root path "/" will be used.
  103. // No spaces are allowed, and the maximum length allowed is 2083 characters.
  104. string relative_uri = 3;
  105. // HTTP request headers.
  106. //
  107. // This map contains the header field names and values. Headers can be set
  108. // when the job is created.
  109. //
  110. // Cloud Scheduler sets some headers to default values:
  111. //
  112. // * `User-Agent`: By default, this header is
  113. // `"AppEngine-Google; (+http://code.google.com/appengine)"`.
  114. // This header can be modified, but Cloud Scheduler will append
  115. // `"AppEngine-Google; (+http://code.google.com/appengine)"` to the
  116. // modified `User-Agent`.
  117. // * `X-CloudScheduler`: This header will be set to true.
  118. //
  119. // If the job has an [body][google.cloud.scheduler.v1.AppEngineHttpTarget.body], Cloud Scheduler sets
  120. // the following headers:
  121. //
  122. // * `Content-Type`: By default, the `Content-Type` header is set to
  123. // `"application/octet-stream"`. The default can be overridden by explictly
  124. // setting `Content-Type` to a particular media type when the job is
  125. // created.
  126. // For example, `Content-Type` can be set to `"application/json"`.
  127. // * `Content-Length`: This is computed by Cloud Scheduler. This value is
  128. // output only. It cannot be changed.
  129. //
  130. // The headers below are output only. They cannot be set or overridden:
  131. //
  132. // * `X-Google-*`: For Google internal use only.
  133. // * `X-AppEngine-*`: For Google internal use only.
  134. //
  135. // In addition, some App Engine headers, which contain
  136. // job-specific information, are also be sent to the job handler.
  137. map<string, string> headers = 4;
  138. // Body.
  139. //
  140. // HTTP request body. A request body is allowed only if the HTTP method is
  141. // POST or PUT. It will result in invalid argument error to set a body on a
  142. // job with an incompatible [HttpMethod][google.cloud.scheduler.v1.HttpMethod].
  143. bytes body = 5;
  144. }
  145. // Pub/Sub target. The job will be delivered by publishing a message to
  146. // the given Pub/Sub topic.
  147. message PubsubTarget {
  148. // Required. The name of the Cloud Pub/Sub topic to which messages will
  149. // be published when a job is delivered. The topic name must be in the
  150. // same format as required by PubSub's
  151. // [PublishRequest.name](https://cloud.google.com/pubsub/docs/reference/rpc/google.pubsub.v1#publishrequest),
  152. // for example `projects/PROJECT_ID/topics/TOPIC_ID`.
  153. //
  154. // The topic must be in the same project as the Cloud Scheduler job.
  155. string topic_name = 1 [(google.api.resource_reference) = {
  156. type: "pubsub.googleapis.com/Topic"
  157. }];
  158. // The message payload for PubsubMessage.
  159. //
  160. // Pubsub message must contain either non-empty data, or at least one
  161. // attribute.
  162. bytes data = 3;
  163. // Attributes for PubsubMessage.
  164. //
  165. // Pubsub message must contain either non-empty data, or at least one
  166. // attribute.
  167. map<string, string> attributes = 4;
  168. }
  169. // App Engine Routing.
  170. //
  171. // For more information about services, versions, and instances see
  172. // [An Overview of App
  173. // Engine](https://cloud.google.com/appengine/docs/python/an-overview-of-app-engine),
  174. // [Microservices Architecture on Google App
  175. // Engine](https://cloud.google.com/appengine/docs/python/microservices-on-app-engine),
  176. // [App Engine Standard request
  177. // routing](https://cloud.google.com/appengine/docs/standard/python/how-requests-are-routed),
  178. // and [App Engine Flex request
  179. // routing](https://cloud.google.com/appengine/docs/flexible/python/how-requests-are-routed).
  180. message AppEngineRouting {
  181. // App service.
  182. //
  183. // By default, the job is sent to the service which is the default
  184. // service when the job is attempted.
  185. string service = 1;
  186. // App version.
  187. //
  188. // By default, the job is sent to the version which is the default
  189. // version when the job is attempted.
  190. string version = 2;
  191. // App instance.
  192. //
  193. // By default, the job is sent to an instance which is available when
  194. // the job is attempted.
  195. //
  196. // Requests can only be sent to a specific instance if
  197. // [manual scaling is used in App Engine
  198. // Standard](https://cloud.google.com/appengine/docs/python/an-overview-of-app-engine?hl=en_US#scaling_types_and_instance_classes).
  199. // App Engine Flex does not support instances. For more information, see
  200. // [App Engine Standard request
  201. // routing](https://cloud.google.com/appengine/docs/standard/python/how-requests-are-routed)
  202. // and [App Engine Flex request
  203. // routing](https://cloud.google.com/appengine/docs/flexible/python/how-requests-are-routed).
  204. string instance = 3;
  205. // Output only. The host that the job is sent to.
  206. //
  207. // For more information about how App Engine requests are routed, see
  208. // [here](https://cloud.google.com/appengine/docs/standard/python/how-requests-are-routed).
  209. //
  210. // The host is constructed as:
  211. //
  212. //
  213. // * `host = [application_domain_name]`</br>
  214. // `| [service] + '.' + [application_domain_name]`</br>
  215. // `| [version] + '.' + [application_domain_name]`</br>
  216. // `| [version_dot_service]+ '.' + [application_domain_name]`</br>
  217. // `| [instance] + '.' + [application_domain_name]`</br>
  218. // `| [instance_dot_service] + '.' + [application_domain_name]`</br>
  219. // `| [instance_dot_version] + '.' + [application_domain_name]`</br>
  220. // `| [instance_dot_version_dot_service] + '.' + [application_domain_name]`
  221. //
  222. // * `application_domain_name` = The domain name of the app, for
  223. // example <app-id>.appspot.com, which is associated with the
  224. // job's project ID.
  225. //
  226. // * `service =` [service][google.cloud.scheduler.v1.AppEngineRouting.service]
  227. //
  228. // * `version =` [version][google.cloud.scheduler.v1.AppEngineRouting.version]
  229. //
  230. // * `version_dot_service =`
  231. // [version][google.cloud.scheduler.v1.AppEngineRouting.version] `+ '.' +`
  232. // [service][google.cloud.scheduler.v1.AppEngineRouting.service]
  233. //
  234. // * `instance =` [instance][google.cloud.scheduler.v1.AppEngineRouting.instance]
  235. //
  236. // * `instance_dot_service =`
  237. // [instance][google.cloud.scheduler.v1.AppEngineRouting.instance] `+ '.' +`
  238. // [service][google.cloud.scheduler.v1.AppEngineRouting.service]
  239. //
  240. // * `instance_dot_version =`
  241. // [instance][google.cloud.scheduler.v1.AppEngineRouting.instance] `+ '.' +`
  242. // [version][google.cloud.scheduler.v1.AppEngineRouting.version]
  243. //
  244. // * `instance_dot_version_dot_service =`
  245. // [instance][google.cloud.scheduler.v1.AppEngineRouting.instance] `+ '.' +`
  246. // [version][google.cloud.scheduler.v1.AppEngineRouting.version] `+ '.' +`
  247. // [service][google.cloud.scheduler.v1.AppEngineRouting.service]
  248. //
  249. //
  250. // If [service][google.cloud.scheduler.v1.AppEngineRouting.service] is empty, then the job will be sent
  251. // to the service which is the default service when the job is attempted.
  252. //
  253. // If [version][google.cloud.scheduler.v1.AppEngineRouting.version] is empty, then the job will be sent
  254. // to the version which is the default version when the job is attempted.
  255. //
  256. // If [instance][google.cloud.scheduler.v1.AppEngineRouting.instance] is empty, then the job will be
  257. // sent to an instance which is available when the job is attempted.
  258. //
  259. // If [service][google.cloud.scheduler.v1.AppEngineRouting.service],
  260. // [version][google.cloud.scheduler.v1.AppEngineRouting.version], or
  261. // [instance][google.cloud.scheduler.v1.AppEngineRouting.instance] is invalid, then the job will be sent
  262. // to the default version of the default service when the job is attempted.
  263. string host = 4;
  264. }
  265. // The HTTP method used to execute the job.
  266. enum HttpMethod {
  267. // HTTP method unspecified. Defaults to POST.
  268. HTTP_METHOD_UNSPECIFIED = 0;
  269. // HTTP POST
  270. POST = 1;
  271. // HTTP GET
  272. GET = 2;
  273. // HTTP HEAD
  274. HEAD = 3;
  275. // HTTP PUT
  276. PUT = 4;
  277. // HTTP DELETE
  278. DELETE = 5;
  279. // HTTP PATCH
  280. PATCH = 6;
  281. // HTTP OPTIONS
  282. OPTIONS = 7;
  283. }
  284. // Contains information needed for generating an
  285. // [OAuth token](https://developers.google.com/identity/protocols/OAuth2).
  286. // This type of authorization should generally only be used when calling Google
  287. // APIs hosted on *.googleapis.com.
  288. message OAuthToken {
  289. // [Service account email](https://cloud.google.com/iam/docs/service-accounts)
  290. // to be used for generating OAuth token.
  291. // The service account must be within the same project as the job. The caller
  292. // must have iam.serviceAccounts.actAs permission for the service account.
  293. string service_account_email = 1;
  294. // OAuth scope to be used for generating OAuth access token.
  295. // If not specified, "https://www.googleapis.com/auth/cloud-platform"
  296. // will be used.
  297. string scope = 2;
  298. }
  299. // Contains information needed for generating an
  300. // [OpenID Connect
  301. // token](https://developers.google.com/identity/protocols/OpenIDConnect).
  302. // This type of authorization can be used for many scenarios, including
  303. // calling Cloud Run, or endpoints where you intend to validate the token
  304. // yourself.
  305. message OidcToken {
  306. // [Service account email](https://cloud.google.com/iam/docs/service-accounts)
  307. // to be used for generating OIDC token.
  308. // The service account must be within the same project as the job. The caller
  309. // must have iam.serviceAccounts.actAs permission for the service account.
  310. string service_account_email = 1;
  311. // Audience to be used when generating OIDC token. If not specified, the URI
  312. // specified in target will be used.
  313. string audience = 2;
  314. }
  315. // The Pub/Sub Topic resource definition is in google/cloud/pubsub/v1/,
  316. // but we do not import that proto directly; therefore, we redefine the
  317. // pattern here.
  318. option (google.api.resource_definition) = {
  319. type: "pubsub.googleapis.com/Topic"
  320. pattern: "projects/{project}/topics/{topic}"
  321. };