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,33 @@
# -*- 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."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from googlecloudsdk.calliope import base
@base.ReleaseTracks(base.ReleaseTrack.ALPHA, base.ReleaseTrack.BETA,
base.ReleaseTrack.GA)
class Scheduler(base.Group):
"""Manage Cloud Scheduler jobs and schedules."""
category = base.CI_CD_CATEGORY
def Filter(self, context, args):
# TODO(b/190539417): Determine if command group works with project number
base.RequireProjectID(args)
del context, args

View File

@@ -0,0 +1,27 @@
# -*- coding: utf-8 -*- #
# Copyright 2025 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 CMEK configuration."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from googlecloudsdk.calliope import base
@base.DefaultUniverseOnly
@base.ReleaseTracks(base.ReleaseTrack.GA)
class CmekConfig(base.Group):
"""Manage CMEK configuration for Cloud Scheduler."""

View File

@@ -0,0 +1,54 @@
# -*- coding: utf-8 -*- #
# Copyright 2025 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.
"""`gcloud scheduler cmek-config describe` command."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from googlecloudsdk.api_lib import scheduler
from googlecloudsdk.calliope import base
from googlecloudsdk.command_lib.scheduler import flags
from googlecloudsdk.command_lib.scheduler import parsers
@base.DefaultUniverseOnly
@base.ReleaseTracks(base.ReleaseTrack.GA)
class GetCmekConfig(base.Command):
"""Get CMEK configuration for Cloud Scheduler in the specified location."""
detailed_help = {
'DESCRIPTION': """\
{description}
""",
'EXAMPLES': """\
To get a CMEK config:
$ {command} --location=my-location
""",
}
@staticmethod
def Args(parser):
flags.DescribeCmekConfigResourceFlag(parser)
def Run(self, args):
api = scheduler.GetApiAdapter(self.ReleaseTrack())
cmek_config_client = api.cmek_config
project_id, location_id = parsers.ParseKmsDescribeArgs(args)
cmek_config = cmek_config_client.GetCmekConfig(project_id, location_id)
return cmek_config

View File

@@ -0,0 +1,80 @@
# -*- coding: utf-8 -*- #
# Copyright 2025 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.
"""`gcloud scheduler cmek-config update` command."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from googlecloudsdk.api_lib import scheduler
from googlecloudsdk.api_lib.scheduler import cmek_config
from googlecloudsdk.calliope import base
from googlecloudsdk.command_lib.scheduler import flags
from googlecloudsdk.command_lib.scheduler import parsers
from googlecloudsdk.generated_clients.apis.cloudscheduler.v1 import cloudscheduler_v1_messages as messages
@base.DefaultUniverseOnly
@base.ReleaseTracks(base.ReleaseTrack.GA)
class UpdateCmekConfig(base.Command):
"""Update CMEK configuration for Cloud Scheduler in the specified location."""
detailed_help = {
'DESCRIPTION': """\
{description}
""",
'EXAMPLES': """\
To update a CMEK config:
$ {command} --location=my-location --kms-project=new-kms-project --kms-keyring=kms-keyring2 --kms-key-name=crypto-key2
""",
}
@staticmethod
def Args(parser):
flags.UpdateAndClearCmekConfigResourceFlag(parser)
def Run(self, args):
api = scheduler.GetApiAdapter(self.ReleaseTrack())
cmek_config_client = api.cmek_config
if args.clear_kms_key:
# When clearing, we only need to have location and _PROJECT()
project_id, location_id = parsers.ParseKmsClearArgs(args)
if location_id is None or project_id is None:
raise cmek_config.RequiredFieldsMissingError(
'The location or project are undefined.'
' Please set these flags properly.'
)
full_kms_key_name = ''
else:
project_id, location_id, full_kms_key_name = parsers.ParseKmsUpdateArgs(
args
)
# When updating, flags combination must be set properly. Either a full KMS
# key name is provided, or all of the flags are provided.
if full_kms_key_name is None or location_id is None or project_id is None:
raise cmek_config.RequiredFieldsMissingError(
'One or more of the --kms-key-name, --kms-keyring, --kms-project,'
' or --location are invalid. Please set these flags properly or'
' make sure the full KMS key name is valid. (args:'
' full_kms_key_name={}, location={}, kms_project={})'.format(
full_kms_key_name, location_id, project_id
)
)
config = messages.CmekConfig()
config.name = f'projects/{project_id}/locations/{location_id}/cmekConfig'
config.kmsKeyName = full_kms_key_name
update_cmek_config = cmek_config_client.UpdateCmekConfig(
project_id, location_id, config
)
return update_cmek_config

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 Jobs(base.Group):
"""Manage Cloud Scheduler jobs."""

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.

View File

@@ -0,0 +1,15 @@
- help_text:
brief: Delete a job.
description: Delete a job.
examples: |
The following command deletes a job:
$ {command} my-job
request:
collection: cloudscheduler.projects.locations.jobs
arguments:
resource:
help_text: The job you want to delete.
spec: !REF googlecloudsdk.command_lib.scheduler.resources:job

View File

@@ -0,0 +1,15 @@
- help_text:
brief: Show details about a job.
description: Show details about a job.
examples: |
The following command shows details about a job:
$ {command} my-job
request:
collection: cloudscheduler.projects.locations.jobs
arguments:
resource:
help_text: The job you want to show details for.
spec: !REF googlecloudsdk.command_lib.scheduler.resources:job

View File

@@ -0,0 +1,37 @@
- help_text:
brief: List jobs.
description: List jobs.
examples: |
The following command lists all jobs in a project:
$ {command}
request:
collection: cloudscheduler.projects.locations.jobs
response:
id_field: name
arguments:
resource:
help_text: The location where you want to list the jobs.
spec: !REF googlecloudsdk.command_lib.scheduler.resources:location
output:
format: |
table(
name.basename():label=ID,
name.segment(-3):label=LOCATION,
format(
"{0} ({1})",
schedule,
timeZone
):label="SCHEDULE (TZ)",
format(
"{0}{1}{2}",
pubsubTarget.yesno(yes="Pub/Sub", no=""),
appEngineHttpTarget.yesno(yes="App Engine", no=""),
httpTarget.yesno(yes="HTTP", no="")
):label=TARGET_TYPE,
state:label=STATE
)

View File

@@ -0,0 +1,25 @@
- help_text:
brief: Pause the execution of a job.
description: Pause the execution of a job.
examples: |
The following command pauses the execution of a job:
$ {command} my-job
request:
collection: cloudscheduler.projects.locations.jobs
method: pause
static_fields:
pauseJobRequest: {}
arguments:
resource:
help_text: The job to pause.
spec: !REF googlecloudsdk.command_lib.scheduler.resources:job
response:
modify_response_hooks:
- googlecloudsdk.command_lib.scheduler.util:LogPauseSuccess
output:
format: none

View File

@@ -0,0 +1,25 @@
- help_text:
brief: Resume execution of a paused job.
description: Resume execution of a paused job.
examples: |
The following command resumes execution of a paused job:
$ {command} my-job
request:
collection: cloudscheduler.projects.locations.jobs
method: resume
static_fields:
resumeJobRequest: {}
arguments:
resource:
help_text: The job to resume.
spec: !REF googlecloudsdk.command_lib.scheduler.resources:job
response:
modify_response_hooks:
- googlecloudsdk.command_lib.scheduler.util:LogResumeSuccess
output:
format: none

View File

@@ -0,0 +1,21 @@
- help_text:
brief: Trigger an on-demand execution of a job.
description: Trigger an on-demand execution of a job.
examples: |
The following command runs a jobs:
$ {command} my-job
request:
collection: cloudscheduler.projects.locations.jobs
method: run
static_fields:
runJobRequest: {}
arguments:
resource:
help_text: The job you want to run.
spec: !REF googlecloudsdk.command_lib.scheduler.resources:job
output:
format: none

View File

@@ -0,0 +1,25 @@
# -*- coding: utf-8 -*- #
# Copyright 2019 Google Inc. 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 Update(base.Group):
"""Update Cloud Scheduler jobs for various types of targets."""

View File

@@ -0,0 +1,123 @@
- help_text:
brief: Update a Cloud Scheduler job with an App Engine target.
description: Update a Cloud Scheduler job with an App Engine target.
examples: |
Update my-job's retry attempt limit:
$ {command} my-job --max-retry-attempts=2
request:
collection: cloudscheduler.projects.locations.jobs
method: patch
modify_request_hooks:
- googlecloudsdk.command_lib.scheduler.util:SetRequestJobName
- googlecloudsdk.command_lib.scheduler.util:SetAppEngineRequestMessageBody
- googlecloudsdk.command_lib.scheduler.util:SetAppEngineRequestUpdateHeaders
- googlecloudsdk.command_lib.scheduler.util:UpdateAppEngineMaskHook
arguments:
resource:
help_text: Job to update.
spec: !REF googlecloudsdk.command_lib.scheduler.resources:job
params:
- _REF_: googlecloudsdk.command_lib.scheduler.flags:schedule
- _REF_: googlecloudsdk.command_lib.scheduler.flags:clearable_timezone
- _REF_: googlecloudsdk.command_lib.scheduler.flags:description
- _REF_: googlecloudsdk.command_lib.scheduler.flags:attempt_deadline
- _REF_: googlecloudsdk.command_lib.scheduler.flags:clearable_retry_attempts
- _REF_: googlecloudsdk.command_lib.scheduler.flags:clearable_retry_duration
- _REF_: googlecloudsdk.command_lib.scheduler.flags:clearable_min_backoff
- _REF_: googlecloudsdk.command_lib.scheduler.flags:clearable_max_backoff
- _REF_: googlecloudsdk.command_lib.scheduler.flags:clearable_max_doublings
- group:
mutex: true
params:
- 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 "/").
- arg_name: clear-relative-url
action: store_true
processor: googlecloudsdk.command_lib.scheduler.util:ClearFlag
help_text: |
Clear the field corresponding to `--relative-url`.
- 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.
- group:
mutex: true
params:
- arg_name: clear-service
action: store_true
processor: googlecloudsdk.command_lib.scheduler.util:ClearFlag
help_text: |
Clear the field corresponding to `--service`.
- api_field: job.appEngineHttpTarget.appEngineRouting.service
arg_name: service
default: default
help_text: |
ID of the App Engine service to send the request to.
- group:
mutex: true
params:
- arg_name: clear-headers
action: store_true
processor: googlecloudsdk.command_lib.scheduler.util:ClearFlag
help_text: |
Clear the list of HTTP headers.
- group:
params:
- arg_name: update-headers
metavar: KEY=VALUE
type: "googlecloudsdk.calliope.arg_parsers:ArgDict:"
help_text: |
KEY=VALUE pairs of HTTP headers to include in the request.
*Cannot be repeated*. For example:
`--update-headers Accept-Language=en-us,Accept=text/plain`
- arg_name: remove-headers
type: "googlecloudsdk.calliope.arg_parsers:ArgList:"
help_text: |
KEY1,KEY2 list of HTTP headers to remove from the request.
`--remove-headers Accept-Language,Accept`
- 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).
- arg_name: clear-message-body
action: store_true
processor: googlecloudsdk.command_lib.scheduler.util:ClearFlag
help_text: |
Clear the field corresponding to `--message-body` or `--message-body-from-file`.

View File

@@ -0,0 +1,119 @@
- help_text:
brief: Update a Cloud Scheduler job that triggers an action via HTTP.
description: Update a Cloud Scheduler job that triggers an action via HTTP.
examples: |
Update my-job's retry attempt limit:
$ {command} my-job --max-retry-attempts=2
request:
collection: cloudscheduler.projects.locations.jobs
method: patch
modify_request_hooks:
- googlecloudsdk.command_lib.scheduler.util:SetRequestJobName
- googlecloudsdk.command_lib.scheduler.util:SetHTTPRequestMessageBody
- googlecloudsdk.command_lib.scheduler.util:SetHTTPRequestUpdateHeaders
- googlecloudsdk.command_lib.scheduler.util:UpdateHTTPMaskHook
arguments:
resource:
help_text: Job to update.
spec: !REF googlecloudsdk.command_lib.scheduler.resources:job
params:
- _REF_: googlecloudsdk.command_lib.scheduler.flags:schedule
- _REF_: googlecloudsdk.command_lib.scheduler.flags:clearable_timezone
- _REF_: googlecloudsdk.command_lib.scheduler.flags:description
- _REF_: googlecloudsdk.command_lib.scheduler.flags:clearable_retry_attempts
- _REF_: googlecloudsdk.command_lib.scheduler.flags:clearable_retry_duration
- _REF_: googlecloudsdk.command_lib.scheduler.flags:clearable_min_backoff
- _REF_: googlecloudsdk.command_lib.scheduler.flags:clearable_max_backoff
- _REF_: googlecloudsdk.command_lib.scheduler.flags:clearable_max_doublings
- api_field: job.httpTarget.uri
arg_name: uri
# 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.
- _REF_: googlecloudsdk.command_lib.scheduler.flags:attempt_deadline
- group:
mutex: true
params:
- arg_name: clear-headers
action: store_true
processor: googlecloudsdk.command_lib.scheduler.util:ClearFlag
help_text: |
Clear the list of HTTP headers.
- group:
params:
- arg_name: update-headers
metavar: KEY=VALUE
type: "googlecloudsdk.calliope.arg_parsers:ArgDict:"
help_text: |
KEY=VALUE pairs of HTTP headers to include in the request.
*Cannot be repeated*. For example:
`--update-headers Accept-Language=en-us,Accept=text/plain`
- arg_name: remove-headers
type: "googlecloudsdk.calliope.arg_parsers:ArgList:"
help_text: |
KEY1,KEY2 list of HTTP headers to remove from the request.
`--remove-headers Accept-Language,Accept`
- 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).
- arg_name: clear-message-body
action: store_true
processor: googlecloudsdk.command_lib.scheduler.util:ClearFlag
help_text: |
Clear the field corresponding to `--message-body` or `--message-body-from-file`.
- 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
- arg_name: clear-auth-token
action: store_true
processor: googlecloudsdk.command_lib.scheduler.util:ClearFlag
help_text: |
Clear the auth token fields: `--oidc-service-account-email`,
`--oidc-token-audience`, `--oauth-service-account-email`,
and `--oauth-token-scope`.

View File

@@ -0,0 +1,65 @@
- help_text:
brief: Update a Cloud Scheduler job with a Pub/Sub target.
description: Update a Cloud Scheduler job with a Pub/Sub target.
examples: |
Update my-job's retry attempt limit:
$ {command} my-job --max-retry-attempts=2
request:
collection: cloudscheduler.projects.locations.jobs
method: patch
modify_request_hooks:
- googlecloudsdk.command_lib.scheduler.util:SetRequestJobName
- googlecloudsdk.command_lib.scheduler.util:SetPubsubRequestMessageBody
- googlecloudsdk.command_lib.scheduler.util:SetPubsubRequestUpdateAttributes
- googlecloudsdk.command_lib.scheduler.util:UpdatePubSubMaskHook
arguments:
resource:
help_text: Job to update.
spec: !REF googlecloudsdk.command_lib.scheduler.resources:job
params:
- _REF_: googlecloudsdk.command_lib.scheduler.flags:schedule
- _REF_: googlecloudsdk.command_lib.scheduler.flags:clearable_timezone
- _REF_: googlecloudsdk.command_lib.scheduler.flags:description
- _REF_: googlecloudsdk.command_lib.scheduler.flags:clearable_retry_attempts
- _REF_: googlecloudsdk.command_lib.scheduler.flags:clearable_retry_duration
- _REF_: googlecloudsdk.command_lib.scheduler.flags:clearable_min_backoff
- _REF_: googlecloudsdk.command_lib.scheduler.flags:clearable_max_backoff
- _REF_: googlecloudsdk.command_lib.scheduler.flags:clearable_max_doublings
- _REF_: googlecloudsdk.command_lib.scheduler.flags:pubsub_topic
- group:
mutex: 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: 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.
- group:
mutex: true
params:
- arg_name: clear-attributes
api_field: job.pubsubTarget.attributes
action: store_true
processor: googlecloudsdk.command_lib.scheduler.util:ClearFlag
help_text: |
Clear the field corresponding to `--attributes`.
- group:
params:
- arg_name: update-attributes
metavar: KEY=VALUE
type: "googlecloudsdk.calliope.arg_parsers:ArgDict:"
help_text: |
Comma-separated list of attributes. Each attribute has the form
"NAME=VALUE". You can specify up to 100 attributes.
- arg_name: remove-attributes
type: "googlecloudsdk.calliope.arg_parsers:ArgList:"
help_text: |
Comma-separated list of attribute keys to remove with the form
"KEY1,KEY2".

View File

@@ -0,0 +1,27 @@
# -*- coding: utf-8 -*- #
# Copyright 2021 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 locations."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from googlecloudsdk.calliope import base
@base.ReleaseTracks(base.ReleaseTrack.ALPHA, base.ReleaseTrack.BETA,
base.ReleaseTrack.GA)
class Locations(base.Group):
"""Get information about Cloud Scheduler locations."""

View File

@@ -0,0 +1,52 @@
# -*- coding: utf-8 -*- #
# Copyright 2021 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.
"""`gcloud scheduler locations describe` command."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from googlecloudsdk.api_lib.scheduler import GetApiAdapter
from googlecloudsdk.calliope import base
from googlecloudsdk.command_lib.scheduler import util
from googlecloudsdk.core import properties
from googlecloudsdk.core import resources
class Describe(base.DescribeCommand):
"""Show details about a location."""
detailed_help = {
'DESCRIPTION': """\
{description}
""",
'EXAMPLES': """\
To describe a location:
$ {command} my-location
""",
}
@staticmethod
def Args(parser):
base.Argument(
'location', help='The Cloud location to describe.').AddToParser(parser)
def Run(self, args):
locations_client = GetApiAdapter(self.ReleaseTrack()).locations
location_ref = resources.REGISTRY.Parse(
args.location,
params={'projectsId': properties.VALUES.core.project.GetOrFail()},
collection=util.LOCATIONS_COLLECTION)
return locations_client.Get(location_ref)

View File

@@ -0,0 +1,46 @@
# -*- coding: utf-8 -*- #
# Copyright 2021 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.
"""`gcloud scheduler locations list` command."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from googlecloudsdk.api_lib.scheduler import GetApiAdapter
from googlecloudsdk.calliope import base
from googlecloudsdk.command_lib.scheduler import util
class List(base.ListCommand):
"""Lists the locations where Cloud Scheduler is available."""
detailed_help = {
'DESCRIPTION': """\
{description}
""",
'EXAMPLES': """\
To list the locations where Cloud Scheduler is available:
$ {command}
""",
}
@staticmethod
def Args(parser):
util.AddListLocationsFormats(parser)
def Run(self, args):
locations_client = GetApiAdapter(self.ReleaseTrack()).locations
project_ref = util.ParseProject()
return locations_client.List(project_ref, args.limit, args.page_size)

View File

@@ -0,0 +1,27 @@
# -*- coding: utf-8 -*- #
# Copyright 2025 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 operations."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from googlecloudsdk.calliope import base
@base.DefaultUniverseOnly
@base.ReleaseTracks(base.ReleaseTrack.GA)
class Operations(base.Group):
"""Get information about Cloud Scheduler operations."""

View File

@@ -0,0 +1,59 @@
# -*- coding: utf-8 -*- #
# Copyright 2025 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.
"""`gcloud scheduler operations describe` command."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from googlecloudsdk.api_lib.scheduler import GetApiAdapter
from googlecloudsdk.calliope import base
from googlecloudsdk.command_lib.scheduler import util
from googlecloudsdk.core import resources
@base.DefaultUniverseOnly
class Describe(base.DescribeCommand):
"""Show the latest status of an operation."""
detailed_help = {
'DESCRIPTION': """\
{description}
""",
'EXAMPLES': """\
To describe the latest status of an operation:
$ {command} projects/my-project/locations/us-central1/operations/my-operation
""",
}
@staticmethod
def Args(parser):
parser.add_argument(
'--name',
help=(
'The full name of the Cloud Scheduler operation to describe.'
' Format:'
' projects/{project}/locations/{location}/operations/{operation}'
),
required=True,
)
def Run(self, args):
operations_client = GetApiAdapter(self.ReleaseTrack()).operations
operation_ref = resources.REGISTRY.Parse(
args.name,
collection=util.OPERATIONS_COLLECTION,
)
return operations_client.Get(operation_ref)