- NAME
-
- gcloud scheduler jobs create http - create a Cloud Scheduler job that triggers an action via HTTP
- SYNOPSIS
-
-
gcloud scheduler jobs create http
JOB
--schedule
=SCHEDULE
--uri
=URI
[--attempt-deadline
=ATTEMPT_DEADLINE
] [--description
=DESCRIPTION
] [--headers
=HEADERS
] [--http-method
=HTTP_METHOD
; default="post"] [--max-backoff
=MAX_BACKOFF
; default="1h"] [--max-doublings
=MAX_DOUBLINGS
; default=16] [--max-retry-attempts
=MAX_RETRY_ATTEMPTS
] [--max-retry-duration
=MAX_RETRY_DURATION
] [--min-backoff
=MIN_BACKOFF
; default="5s"] [--time-zone
=TIME_ZONE
; default="Etc/UTC"] [--message-body
=MESSAGE_BODY
|--message-body-from-file
=MESSAGE_BODY_FROM_FILE
] [[--oauth-service-account-email
=OAUTH_SERVICE_ACCOUNT_EMAIL
:--oauth-token-scope
=OAUTH_TOKEN_SCOPE
] | [--oidc-service-account-email
=OIDC_SERVICE_ACCOUNT_EMAIL
:--oidc-token-audience
=OIDC_TOKEN_AUDIENCE
]] [GCLOUD_WIDE_FLAG …
]
-
- DESCRIPTION
- Create a Cloud Scheduler job that triggers an action via HTTP.
- POSITIONAL ARGUMENTS
-
-
Job resource - Job to create. This represents a Cloud resource. (NOTE) Some
attributes are not given arguments in this group but can be set in other ways.
To set the [project] attribute: provide the argument [job] on the command line
with a fully specified name; provide the argument [--project] on the command
line; set the property [core/project]. To set the [location] attribute: provide
the argument [job] on the command line with a fully specified name; as the
location of the current project's App Engine App. This must be specified.
JOB
- ID of the job or fully qualified identifier for the job. To set the [job] attribute: provide the argument [job] on the command line.
-
Job resource - Job to create. This represents a Cloud resource. (NOTE) Some
attributes are not given arguments in this group but can be set in other ways.
To set the [project] attribute: provide the argument [job] on the command line
with a fully specified name; provide the argument [--project] on the command
line; set the property [core/project]. To set the [location] attribute: provide
the argument [job] on the command line with a fully specified name; as the
location of the current project's App Engine App. This must be specified.
- REQUIRED FLAGS
-
--schedule
=SCHEDULE
-
Schedule on which the job will be executed.
As a general rule, execution
n + 1
of a job will not begin until executionn
has finished. Cloud Scheduler will never allow two simultaneously outstanding executions. For example, this implies that if then+1
execution is scheduled to run at16:00
but then
execution takes until16:15
, then+1
execution will not start until16:15
. A scheduled start time will be delayed if the previous execution has not ended when its scheduled time occurs.If --retry-count > 0 and a job attempt fails, the job will be tried a total of --retry-count times, with exponential backoff, until the next scheduled start time.
The schedule can be either of the following types:
- Crontab: http://en.wikipedia.org/wiki/Cron#Overview
- English-like schedule: https://cloud.google.com/scheduler/docs/quickstart#defining_the_job_schedule
--uri
=URI
-
The full URI path that the request will be sent to. This string must begin with
either "http://" or "https://". For example,
http://acme.com
orhttps://acme.com/sales:8080
. Cloud Scheduler will encode some characters for safety and compatibility. The maximum allowed URL length is 2083 characters after encoding.
- OPTIONAL FLAGS
-
--attempt-deadline
=ATTEMPT_DEADLINE
- The deadline for job attempts. If the request handler doesn't respond by this dealine, the request is cancelled and the attempt is marked as failed. For example, 20s.
--description
=DESCRIPTION
- Human-readable description of the job.
--headers
=HEADERS
-
KEY=VALUE pairs of HTTP headers to include in the request.
Cannot be repeated
. For example:--headers Accept-Language=en-us,Accept=text/plain
--http-method
=HTTP_METHOD
; default="post"-
HTTP method to use for the request.
HTTP_METHOD
must be one of:delete
,get
,head
,post
,put
. --max-backoff
=MAX_BACKOFF
; default="1h"-
Maximum amount of time to wait before retrying a task after it fails. For
example,
10m
. Default is1h
. --max-doublings
=MAX_DOUBLINGS
; default=16- Maximum number of times that the interval between failed job retries will be doubled before the increase becomes constant.
--max-retry-attempts
=MAX_RETRY_ATTEMPTS
- Number of times to retry the request if it fails or times out. Must be in range 0-5 inclusive. Default is 0.
--max-retry-duration
=MAX_RETRY_DURATION
-
Time limit for retrying a failed task, measured from when the task was first
run. If specified with
--max-retry-attempts
greater than 0, the task will be retried until both limits are reached. Default is 0 (which means unlimited). --min-backoff
=MIN_BACKOFF
; default="5s"-
Minimum amount of time to wait before retrying a task after it fails. For
example,
10s
. Default is5s
. --time-zone
=TIME_ZONE
; default="Etc/UTC"-
Specifies the time zone to be used in interpreting --schedule. The value of this
field must be a time zone name from the tz database
(http://en.wikipedia.org/wiki/Tz_database).
Note that some time zones include a provision for daylight savings time. The rules for daylight saving time are determined by the chosen time zone.
For UTC use the string "utc". Default is "utc".
-
At most one of these may be specified:
--message-body
=MESSAGE_BODY
- Data payload to be included as the body of the HTTP request. May only be given with compatible HTTP methods (PUT or POST).
--message-body-from-file
=MESSAGE_BODY_FROM_FILE
- Path to file containing the data payload to be included as the body of the HTTP request. May only be given with compatible HTTP methods (PUT or POST).
-
How the request sent to the target when executing the job should be
authenticated. At most one of these may be specified:
-
OAuth2
--oauth-service-account-email
=OAUTH_SERVICE_ACCOUNT_EMAIL
-
The service account email to be used for generating an OAuth2 access token to be
included in the request sent to the target when executing the job. The service
account must be within the same project as the job. The caller must have
iam.serviceAccounts.actAs permission for the service account. The token must be
OAuth if the target is a Google APIs service with URL
*.googleapis.com
. This flag must be specified if any of the other arguments in this group are specified. --oauth-token-scope
=OAUTH_TOKEN_SCOPE
- The scope to be used when generating an OAuth2 access token to be included in the request sent to the target when executing the job. If not specified, "https://www.googleapis.com/auth/cloud-platform" will be used.
-
OpenId Connect
--oidc-service-account-email
=OIDC_SERVICE_ACCOUNT_EMAIL
-
The service account email to be used for generating an OpenId Connect token to
be included in the request sent to the target when executing the job. The
service account must be within the same project as the job. The caller must have
iam.serviceAccounts.actAs permission for the service account. The OIDC token is
generally used
except
for Google APIs hosted on*.googleapis.com
: these APIs expect an OAuth token. This flag must be specified if any of the other arguments in this group are specified. --oidc-token-audience
=OIDC_TOKEN_AUDIENCE
- The audience to be used when generating an OpenId Connect token to be included in the request sent to the target when executing the job. If not specified, the URI specified in target will be used.
-
OAuth2
- GCLOUD WIDE FLAGS
-
These flags are available to all commands:
--account
,--billing-project
,--configuration
,--flags-file
,--flatten
,--format
,--help
,--impersonate-service-account
,--log-http
,--project
,--quiet
,--trace-token
,--user-output-enabled
,--verbosity
.Run
$ gcloud help
for details. - API REFERENCE
-
This command uses the
cloudscheduler/v1
API. The full documentation for this API can be found at: https://cloud.google.com/scheduler/ - EXAMPLES
-
The following command creates a job that sends a HTTP GET request to
'http://example.com/path' every 3 hours:
gcloud scheduler jobs create http my-job --schedule="0 */3 * * *"
--uri="http://example.com/path" --http-method=GET - NOTES
-
These variants are also available:
gcloud alpha scheduler jobs create http
gcloud beta scheduler jobs create http
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2020-12-15 UTC.