target.proto 15 KB

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