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,27 @@
# -*- coding: utf-8 -*- #
# Copyright 2020 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.
"""The command group for the Transcoder CLI."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from googlecloudsdk.calliope import base
@base.ReleaseTracks(base.ReleaseTrack.GA)
class Jobs(base.Group):
"""Manage Cloud Transcoder jobs."""

View File

@@ -0,0 +1,85 @@
# -*- coding: utf-8 -*- #
# Copyright 2020 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.
"""Cloud Transcoder jobs create command."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from googlecloudsdk.api_lib.transcoder import jobs
from googlecloudsdk.calliope import base
from googlecloudsdk.command_lib.transcoder import flags
from googlecloudsdk.command_lib.transcoder import resource_args
from googlecloudsdk.command_lib.transcoder import util
from googlecloudsdk.command_lib.util.args import labels_util
class Create(base.CreateCommand):
"""Create Transcoder jobs."""
detailed_help = {'EXAMPLES': """
To create a transcoder job with default template, input URI, and output URI:
$ {command} --location=us-central1 --input-uri="gs://bucket/input.mp4" --output-uri="gs://bucket/output/"
To create a transcoder job with template id, input URI, and output URI:
$ {command} --location=us-central1 --input-uri="gs://bucket/input.mp4" --output-uri="gs://bucket/output/" --template-id=my-template
To create a transcoder job with json format configuration:
$ {command} --location=us-central1 --json="config: json-format"
To create a transcoder job with json format configuration file:
$ {command} --location=us-central1 --file="config.json"
To create a transcoder job with labels:
$ {command} --location=us-central1 --file="config.json" --labels=key=value
To create a transcoder job in batch mode:
$ {command} --location=us-central1 --file="config.json" --mode=PROCESSING_MODE_BATCH
To create a transcoder job in batch mode with priority:
$ {command} --location=us-central1 --file="config.json" --mode=PROCESSING_MODE_BATCH --batch-mode-priority=3
To create a transcoder job with optimizations disabled:
$ {command} --location=us-central1 --file="config.json" --optimization=DISABLED
"""}
@staticmethod
def Args(parser):
resource_args.AddLocationResourceArg(parser)
flags.AddCreateJobFlags(parser)
parser.display_info.AddFormat('json')
labels_util.AddCreateLabelsFlags(parser)
def Run(self, args):
"""Create a job."""
util.ValidateCreateJobArguments(args)
client = jobs.JobsClient(self.ReleaseTrack())
parent_ref = args.CONCEPTS.location.Parse()
return client.Create(
parent_ref=parent_ref,
args=args,
)

View File

@@ -0,0 +1,56 @@
# -*- coding: utf-8 -*- #
# Copyright 2020 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.
"""Transcoder API jobs delete command."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from googlecloudsdk.api_lib.transcoder import jobs
from googlecloudsdk.calliope import base
from googlecloudsdk.command_lib.transcoder import resource_args
from googlecloudsdk.core import log
from googlecloudsdk.core.console import console_io
class Delete(base.DeleteCommand):
"""Delete transcoder jobs."""
detailed_help = {
'EXAMPLES': """
To delete a transcoder job:
$ {command} JOB_NAME --location=us-central1
"""
}
@staticmethod
def Args(parser):
resource_args.AddJobResourceArg(parser)
def Run(self, args):
"""Delete a job."""
client = jobs.JobsClient(self.ReleaseTrack())
job_ref = args.CONCEPTS.job_name.Parse()
console_io.PromptContinue(
'You are about to delete job [{}]'.format(job_ref.jobsId),
throw_if_unattended=True, cancel_on_no=True)
result = client.Delete(job_ref)
log.DeletedResource(job_ref.RelativeName(), kind='job')
return result

View File

@@ -0,0 +1,49 @@
# -*- coding: utf-8 -*- #
# Copyright 2020 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.
"""Transcoder API job describe command."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from googlecloudsdk.api_lib.transcoder import jobs
from googlecloudsdk.calliope import base
from googlecloudsdk.command_lib.transcoder import resource_args
class Describe(base.DescribeCommand):
"""Describe transcoder jobs."""
detailed_help = {
'EXAMPLES': """
To describe a transcoder job:
$ {command} JOB_NAME --location=us-central1
"""
}
@staticmethod
def Args(parser):
resource_args.AddJobResourceArg(parser)
parser.display_info.AddFormat('json')
def Run(self, args):
"""Describe a job."""
client = jobs.JobsClient(self.ReleaseTrack())
job_ref = args.CONCEPTS.job_name.Parse()
return client.Get(job_ref)

View File

@@ -0,0 +1,58 @@
# -*- coding: utf-8 -*- #
# Copyright 2020 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.
"""Transcoder API jobs list command."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from googlecloudsdk.api_lib.transcoder import jobs
from googlecloudsdk.calliope import base
from googlecloudsdk.command_lib.transcoder import resource_args
_FORMAT = """\
table(
name,
state,
failureReason
)
"""
class List(base.ListCommand):
"""List transcoder jobs."""
detailed_help = {
'EXAMPLES': """
To list transcoder jobs in ``us-central1'':
$ {command} --location=us-central1
"""
}
@staticmethod
def Args(parser):
resource_args.AddLocationResourceArg(parser)
parser.display_info.AddFormat(_FORMAT)
def Run(self, args):
"""List jobs."""
client = jobs.JobsClient(self.ReleaseTrack())
parent_ref = args.CONCEPTS.location.Parse()
return client.List(parent_ref, page_size=args.page_size)