feat: Add new gcloud commands, API clients, and third-party libraries across various services.

This commit is contained in:
2026-01-01 20:26:35 +01:00
parent 5e23cbece0
commit a19e592eb7
25221 changed files with 8324611 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
# -*- coding: utf-8 -*- #
# Copyright 2017 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Command group for Cloud Scheduler jobs."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from googlecloudsdk.calliope import base
class Create(base.Group):
"""Create Cloud Scheduler jobs for various types of targets."""

View File

@@ -0,0 +1,93 @@
- help_text:
brief: Create a Cloud Scheduler job with an App Engine target.
description: Create a Cloud Scheduler job with an App Engine target.
examples: |
The following command creates a job that sends a request to the
'/cron-handler' path in you App Engine app every 3 hours:
$ {command} my-job --schedule="0 */3 * * *"
--relative-url="/cron-handler"
request:
collection: cloudscheduler.projects.locations.jobs
method: create
modify_request_hooks:
- googlecloudsdk.command_lib.scheduler.util:ModifyCreateJobRequest
arguments:
resource:
help_text: Job to create.
spec: !REF googlecloudsdk.command_lib.scheduler.resources:job
params:
- _REF_: googlecloudsdk.command_lib.scheduler.flags:schedule
required: true
- _REF_: googlecloudsdk.command_lib.scheduler.flags:timezone
- _REF_: googlecloudsdk.command_lib.scheduler.flags:description
- _REF_: googlecloudsdk.command_lib.scheduler.flags:attempt_deadline
- _REF_: googlecloudsdk.command_lib.scheduler.flags:retry_attempts
- _REF_: googlecloudsdk.command_lib.scheduler.flags:retry_duration
- _REF_: googlecloudsdk.command_lib.scheduler.flags:min_backoff
- _REF_: googlecloudsdk.command_lib.scheduler.flags:max_backoff
- _REF_: googlecloudsdk.command_lib.scheduler.flags:max_doublings
- api_field: job.appEngineHttpTarget.relativeUri
arg_name: relative-url
default: /
type: googlecloudsdk.calliope.arg_parsers:RegexpValidator:pattern=^/.*,description=Must
begin with [/].)
help_text: |
Relative URL to use for the request (beginning with "/").
- api_field: job.appEngineHttpTarget.httpMethod
arg_name: http-method
default: post
choices:
- arg_value: post
enum_value: POST
- arg_value: head
enum_value: HEAD
- arg_value: get
enum_value: GET
- arg_value: put
enum_value: PUT
- arg_value: delete
enum_value: DELETE
help_text: |
HTTP method to use for the request.
# TODO(b/113588592) Convert --version and --service to a resource arg.
- api_field: job.appEngineHttpTarget.appEngineRouting.version
arg_name: version
help_text: |
Version of the App Engine service to send the request to.
- api_field: job.appEngineHttpTarget.appEngineRouting.service
arg_name: service
help_text: |
ID of the App Engine service to send the request to.
- api_field: job.appEngineHttpTarget.headers.additionalProperties
arg_name: headers
metavar: KEY=VALUE
type:
arg_dict:
flatten: true
spec:
- api_field: key
- api_field: value
help_text: |-
KEY=VALUE pairs of HTTP headers to include in the request.
*Cannot be repeated*. For example:
`--headers Accept-Language=en-us,Accept=text/plain`
- group:
mutex: true
params:
- api_field: job.appEngineHttpTarget.body
arg_name: message-body
help_text: |
Data payload to be included as the body of the HTTP
request. May only be given with compatible HTTP methods (PUT
or POST).
- api_field: job.appEngineHttpTarget.body
arg_name: message-body-from-file
type: "googlecloudsdk.calliope.arg_parsers:FileContents:binary=True"
help_text: |
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).

View File

@@ -0,0 +1,100 @@
- help_text:
brief: Create a Cloud Scheduler job that triggers an action via HTTP.
description: Create a Cloud Scheduler job that triggers an action via HTTP.
examples: |
The following command creates a job that sends a HTTP GET request to
'http://example.com/path' every 3 hours:
$ {command} my-job --schedule="0 */3 * * *"
--uri="http://example.com/path" --http-method=GET
request:
collection: cloudscheduler.projects.locations.jobs
method: create
modify_request_hooks:
- googlecloudsdk.command_lib.scheduler.util:ModifyCreateJobRequest
arguments:
resource:
help_text: Job to create.
spec: !REF googlecloudsdk.command_lib.scheduler.resources:job
params:
- _REF_: googlecloudsdk.command_lib.scheduler.flags:schedule
required: true
- _REF_: googlecloudsdk.command_lib.scheduler.flags:timezone
- _REF_: googlecloudsdk.command_lib.scheduler.flags:description
- _REF_: googlecloudsdk.command_lib.scheduler.flags:attempt_deadline
- _REF_: googlecloudsdk.command_lib.scheduler.flags:retry_attempts
- _REF_: googlecloudsdk.command_lib.scheduler.flags:retry_duration
- _REF_: googlecloudsdk.command_lib.scheduler.flags:min_backoff
- _REF_: googlecloudsdk.command_lib.scheduler.flags:max_backoff
- _REF_: googlecloudsdk.command_lib.scheduler.flags:max_doublings
- api_field: job.httpTarget.uri
arg_name: uri
required: true
# Can't use : in argument hooks so omit it both from regex and help
# message.
type:
googlecloudsdk.calliope.arg_parsers:RegexpValidator:pattern=^https?.//.*,description=Must
be a valid HTTP or HTTPS URL.
help_text: |
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` or `https://acme.com/sales:8080`. Cloud Scheduler will
encode some characters for safety and compatibility. The maximum allowed
URL length is 2083 characters after encoding.
- api_field: job.httpTarget.httpMethod
arg_name: http-method
default: post
choices:
- arg_value: post
enum_value: POST
- arg_value: head
enum_value: HEAD
- arg_value: get
enum_value: GET
- arg_value: put
enum_value: PUT
- arg_value: delete
enum_value: DELETE
help_text: |
HTTP method to use for the request.
- api_field: job.httpTarget.headers.additionalProperties
arg_name: headers
metavar: KEY=VALUE
type:
arg_dict:
flatten: true
spec:
- api_field: key
- api_field: value
help_text: |
KEY=VALUE pairs of HTTP headers to include in the request.
*Cannot be repeated*. For example:
`--headers Accept-Language=en-us,Accept=text/plain`
- group:
mutex: true
params:
- api_field: job.httpTarget.body
arg_name: message-body
help_text: |
Data payload to be included as the body of the HTTP
request. May only be given with compatible HTTP methods (PUT
or POST).
- api_field: job.httpTarget.body
arg_name: message-body-from-file
type:
googlecloudsdk.calliope.arg_parsers:FileContents:binary=True
help_text: |
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).
- group:
help_text: |
How the request sent to the target when executing the job should be
authenticated.
mutex: true
params:
- _REF_: googlecloudsdk.command_lib.scheduler.flags:auth_token_openid
- _REF_: googlecloudsdk.command_lib.scheduler.flags:auth_token_oauth

View File

@@ -0,0 +1,54 @@
- help_text:
brief: Create a Cloud Scheduler job with a Pub/Sub target.
description: Create a Cloud Scheduler job with a Pub/Sub target.
examples: |
The following command creates a job that publishes a message with the body
'Hello' to the Pub/Sub topic 'cron-topic' every 3 hours:
$ {command} my-job --schedule="0 */3 * * *"
--topic=cron-topic --message-body="Hello"
request:
collection: cloudscheduler.projects.locations.jobs
method: create
modify_request_hooks:
- googlecloudsdk.command_lib.scheduler.util:ModifyCreatePubsubJobRequest
arguments:
resource:
help_text: Job to create.
spec: !REF googlecloudsdk.command_lib.scheduler.resources:job
params:
- _REF_: googlecloudsdk.command_lib.scheduler.flags:schedule
required: true
- _REF_: googlecloudsdk.command_lib.scheduler.flags:timezone
- _REF_: googlecloudsdk.command_lib.scheduler.flags:description
- _REF_: googlecloudsdk.command_lib.scheduler.flags:retry_attempts
- _REF_: googlecloudsdk.command_lib.scheduler.flags:retry_duration
- _REF_: googlecloudsdk.command_lib.scheduler.flags:min_backoff
- _REF_: googlecloudsdk.command_lib.scheduler.flags:max_backoff
- _REF_: googlecloudsdk.command_lib.scheduler.flags:max_doublings
- _REF_: googlecloudsdk.command_lib.scheduler.flags:pubsub_topic
required: true
- group:
mutex: false
required: true
help_text: |
Body of the message to publish to the given topic name. Information on
message formatting and size limits can be found at:
https://cloud.google.com/pubsub/docs/publisher#publish
params:
- arg_name: attributes
api_field: job.pubsubTarget.attributes
type: googlecloudsdk.command_lib.scheduler.util:ParseAttributes
help_text: |
Comma-separated list of attributes. Each attribute has the form
"NAME=VALUE". You can specify up to 100 attributes.
- group:
mutex: true
params:
- arg_name: message-body
help_text: Body of the message.
- arg_name: message-body-from-file
type: "googlecloudsdk.calliope.arg_parsers:FileContents:"
help_text: Path to a file containing the body of the message.