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 2019 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 ml translate."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from googlecloudsdk.calliope import base
@base.ReleaseTracks(base.ReleaseTrack.BETA, base.ReleaseTrack.ALPHA)
class Translate(base.Group):
"""Cloud ML Translate command groups."""

View File

@@ -0,0 +1,75 @@
- release_tracks: [ALPHA, BETA]
help_text:
brief:
Translates a large volume of text in asynchronous batch mode.
description: |
Translates a large volume of text in asynchronous batch mode. This command
provides real-time output as the inputs are being processed.
examples: |
The following command translates 'input.txt' file into French and Spanish:
$ {command} --source=gs://input.txt=text/plain --zone=us-central1 --target-language-codes=fr-CA,es-ES --source-language=en-US --models=fr-CA=TRL321456,es-ES=general/base --destination=gs://output
request:
collection: translate.projects.locations
method: batchTranslateText
modify_request_hooks:
- googlecloudsdk.command_lib.ml.translate.hooks:UpdateRequestBatchTranslateText
BETA:
api_version: v3
ALPHA:
api_version: v3beta1
arguments:
resource:
help_text: project.
spec: !REF googlecloudsdk.command_lib.ml.translate.resources:project
override_resource_collection: true
params:
- _REF_: googlecloudsdk.command_lib.ml.translate.flags:zone
- arg_name: source
required: true
metavar: FILE_PATH[=FILE_TYPE]
type: 'googlecloudsdk.calliope.arg_parsers:ArgDict:allow_key_only=True'
help_text: |
Comma-separated list of entries of the form FILE_PATH[=FILE_TYPE]
specifying source files and files types for the translation. FILE_PATH must
be a Google Cloud Storage URI. FILE_TYPE defaults to 'text/html' if not
present. Possible FILE_TYPES are 'text/html', 'text/plain'.
Usage:
'--source gs://input/input.txt=text/plain,gs://input/my.html=text/html'
- arg_name: models
metavar: KEY=VALUE
type: 'googlecloudsdk.calliope.arg_parsers:ArgDict:'
help_text: |
Models to use for translation. Comma-separated dictionary where map's key
is target language code, map's value is model name. Value can be a built-in
general model, or an AutoML Translation model.
Usage:
'--models es-ES=TRL321456789,en-US=general/nmt'
- arg_name: glossaries
metavar: KEY=VALUE
type: 'googlecloudsdk.calliope.arg_parsers:ArgDict:'
help_text: |
Glossaries to be applied for translation. Comma-separated dictionary
where map's key is target language code, map's value is glossary name.
- arg_name: destination
required: true
help_text: |
Location to which the results should be written. Must be a Google Cloud
Storage URI.
- arg_name: target-language-codes
type: 'googlecloudsdk.calliope.arg_parsers:ArgList:'
required: true
help_text: |
The languages to which the text is to be translated. Specify up to 10
language codes here.
- arg_name: source-language
required: true
help_text: |
Source language code of the text.

View File

@@ -0,0 +1,51 @@
- release_tracks: [ALPHA, BETA]
help_text:
brief: Use the Google Cloud Translation API to detect languages.
description: |
Detects the language of text in a request.
examples: |
The following command detects the language of 'What beautiful weather!'
$ {command} --content='What beautiful weather!' --zone=us-central1
request:
collection: translate.projects.locations
method: detectLanguage
BETA:
api_version: v3
ALPHA:
api_version: v3beta1
modify_request_hooks:
- googlecloudsdk.command_lib.ml.translate.hooks:UpdateRequestLangDetection
arguments:
resource:
help_text: project.
spec: !REF googlecloudsdk.command_lib.ml.translate.resources:project
override_resource_collection: true
params:
- _REF_: googlecloudsdk.command_lib.ml.translate.flags:zone
- arg_name: mime-type
help_text: |
Format of the source text, for example, 'text/html', 'text/plain'. Defaults to
'text/html'.
- arg_name: model
help_text: |
Language detection model to be used. If not specified, the default
(language-detection/default) model is used.
Authorization requires the following Google IAM permission on the specified resource model:
cloudtranslate.languageDetectionModels.predict
- group:
mutex: true
required: true
help_text: Contents group.
params:
- arg_name: content
help_text: |
Content of the input in string format.
- arg_name: content-file
help_text: |
Specify a local file path with content.

View File

@@ -0,0 +1,52 @@
- release_tracks: [ALPHA, BETA]
help_text:
brief: Returns a list of supported languages for translation.
description: |
List supported languages for translation.
examples: |
The following command lists supported languages.
$ {command} --zone=global
request:
collection: translate.projects.locations
method: getSupportedLanguages
BETA:
api_version: v3
ALPHA:
api_version: v3beta1
modify_request_hooks:
- googlecloudsdk.command_lib.ml.translate.hooks:UpdateRequestGetSupportedLanguages
arguments:
resource:
help_text: endpoint location
spec: !REF googlecloudsdk.command_lib.ml.translate.resources:project
override_resource_collection: true
params:
- _REF_: googlecloudsdk.command_lib.ml.translate.flags:zone
- api_field: displayLanguageCode
arg_name: display-language-code
help_text: |
The language to use to return localized, human-readable name of supported languages.
If missing, then display names aren't returned in the response.
- api_field: model
arg_name: model
help_text: |
Get supported languages of specified model.
Authorization requires one or more of the following Google IAM permissions on the specified
resource model:
cloudtranslate.generalModels.get
automl.models.get
Defaults to 'general/base'.
Usage:
AutoML models: '--model=TRL321456789'
General models: '--model=general/nmt'

View File

@@ -0,0 +1,79 @@
- release_tracks: [ALPHA, BETA]
help_text:
brief: Use the Google Cloud Translation API to translate between languages.
description: |
Translates input text and returns translated text.
examples: |
The following command translates 'What beautiful weather!' into French.
$ {command} --content='What beautiful weather!' --zone=us-central1 --target-language=fr-CA
request:
collection: translate.projects.locations
method: translateText
BETA:
api_version: v3
ALPHA:
api_version: v3beta1
modify_request_hooks:
- googlecloudsdk.command_lib.ml.translate.hooks:UpdateRequestTranslateText
arguments:
resource:
help_text: endpoint location
spec: !REF googlecloudsdk.command_lib.ml.translate.resources:project
override_resource_collection: true
params:
- _REF_: googlecloudsdk.command_lib.ml.translate.flags:zone
- arg_name: model
help_text: |
The model type requested for this translation. The format depends on the model type:
for AutoML Translation models: model-id
for General (built-in) models: general/nmt or general/base
Authorization requires one or more of the following Google IAM permissions on the specified
resource model:
cloudtranslate.generalModels.predict
automl.models.predict
If missing, the system decides which google base model to use.
Usage:
AutoML models: '--model=TRL321456789'
General models: '--model=general/nmt'
- group:
mutex: true
required: true
help_text: Contents group.
params:
- arg_name: content
help_text: |
The content of the input in string format. We recommend that the content be less
than 30k codepoints.
- arg_name: content-file
help_text: |
Specify a local file path containing the text to be translated.
- arg_name: target-language
required: true
help_text: |
The BCP-47 language code to use for translation of the input text.
- arg_name: source-language
help_text: |
The BCP-47 language code of the input text if known, for example, 'en-US' or 'sr-Latn'. If
the source language isn't specified, the API attempts to identify the source language
automatically and returns the source language in the response.
- arg_name: glossary-config
help_text: |
Glossary to be applied. The glossary must be within the same region as the model.
- arg_name: mime-type
help_text: |
The format of the source text, for example, 'text/html', 'text/plain'. Defaults to
'text/html'.