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,30 @@
# -*- 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 ml language."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from googlecloudsdk.calliope import base
class Language(base.Group):
"""Use the Google Cloud Natural Language API to analyze text.
For more information, please see
https://cloud.google.com/natural-language/.
"""

View File

@@ -0,0 +1,123 @@
help_text:
language_help: |
Currently English, Spanish, Japanese, Chinese (Simplified and Traditional),
French, German, Italian, Korean, and Portuguese are supported.
language_help_ga: |
Currently English, Spanish, and Japanese are supported.
language_examples:
AE: |
To analyze entites in raw content 'puppies':
$ {command} --content='puppies'
To analyze entites in file 'myfile.txt':
$ {command} --content-file='myfile.txt'
To analyze entites in a remote file 'gs://bucket_name/mycontent.html' for Japanese language using
UTF-8 encoding:
$ {command} --content-file='gs://bucket_name/mycontent.html' --content-type=HTML --encoding-type=utf8 --language=ja-JP
AES: |
To analyze entity sentiment in raw content 'puppies':
$ {command} --content='puppies'
To analyze entity sentiment in file 'myfile.txt':
$ {command} --content-file='myfile.txt'
To analyze entity sentiment in a remote file 'gs://bucket_name/mycontent.html' for Japanese language using
UTF-8 encoding:
$ {command} --content-file='gs://bucket_name/mycontent.html' --content-type=HTML --encoding-type=utf8 --language=ja-JP
AS: |
To analyze sentiment in raw content 'I love puppies.':
$ {command} --content='I love puppies.'
To analyze sentiment in file 'myfile.txt':
$ {command} --content-file='myfile.txt'
To analyze sentiment in a remote file 'gs://bucket_name/mycontent.html' for Japanese language using
UTF-8 encoding:
$ {command} --content-file='gs://bucket_name/mycontent.html' --content-type=HTML --encoding-type=utf8 --language=ja-JP
ASX: |
To analyze syntax in raw content 'They drink.':
$ {command} --content='They drink'
To analyze syntax in file 'myfile.txt':
$ {command} --content-file='myfile.txt'
To analyze syntax in a remote file 'gs://bucket_name/mycontent.html' for Japanese language using
UTF-8 encoding:
$ {command} --content-file='gs://bucket_name/mycontent.html' --content-type=HTML --encoding-type=utf8 --language=ja-JP
CT: |
To classify text in raw content 'Long Political Text.':
$ {command} --content='Long Political Text.'
To classify text in file 'myfile.txt':
$ {command} --content-file='myfile.txt'
To classify text in a remote file 'gs://bucket_name/mycontent.html' for Japanese language:
$ {command} --content-file='gs://bucket_name/mycontent.html' --content-type=HTML --language=ja-JP
request:
collection: language.documents
api_version: v1
modify_request_hooks:
- googlecloudsdk.command_lib.ml.language.util:UpdateRequestWithInput
args:
content:
api_field: document.type
arg_name: content-type
default: plain-text
choices:
- arg_value: plain-text
enum_value: PLAIN_TEXT
- arg_value: html
enum_value: HTML
help_text: Specify the format of the input text.
language:
api_field: document.language
arg_name: language
help_text: |
Specify the language of the input text. If omitted, the server will
attempt to auto-detect. Both ISO (such as `en` or `es`) and BCP-47 (such
as `en-US` or `ja-JP`) language codes are accepted.
encoding:
api_field: encodingType
arg_name: encoding-type
default: utf8
help_text: |
The encoding type used by the API to calculate offsets. If set to `none`,
encoding-dependent offsets will be set at -1. This is an optional flag
only used for the entity mentions in results, and does not affect how the
input is read or analyzed.
content_group:
group:
mutex: true
required: true
params:
- arg_name: content
help_text: |
Specify input text on the command line. Useful for experiments, or
for extremely short text.
- arg_name: content-file
help_text: |
Specify a local file or Google Cloud Storage (format
`gs://bucket/object`) file path containing the text to be analyzed.
More useful for longer text or data output from another system.

View File

@@ -0,0 +1,55 @@
- release_tracks: [GA]
help_text:
brief: Use Google Cloud Natural Language API to identify entities in text.
description: |
Entity Analysis inspects the given text for common names or known entities
(proper nouns such as public figures, landmarks, etc.), and returns
information about those entities.
{language_help}
language_help: !COMMON help_text.language_help_ga
examples: !COMMON help_text.language_examples.AE
request:
_COMMON_: request
method: analyzeEntities
arguments:
params:
- _COMMON_: args.content_group
- _COMMON_: args.content
- _COMMON_: args.language
- _COMMON_: args.encoding
output:
format: json
- release_tracks: [ALPHA, BETA]
help_text:
brief: Use Google Cloud Natural Language API to identify entities in text.
description: |
Entity Analysis inspects the given text for common names or known entities
(proper nouns such as public figures, landmarks, etc.), and returns
information about those entities.
{language_help}
language_help: !COMMON help_text.language_help
examples: !COMMON help_text.language_examples.AE
request:
_COMMON_: request
api_version: v1beta2
method: analyzeEntities
arguments:
params:
- _COMMON_: args.content_group
- _COMMON_: args.content
- _COMMON_: args.language
- _COMMON_: args.encoding
output:
format: json

View File

@@ -0,0 +1,53 @@
- release_tracks: [GA]
help_text:
brief: Use Google Cloud Natural Language API to identify entity-level sentiment.
description: |
Entity level sentiment combines both entity analysis and sentiment analysis
and attempts to determine the sentiment (positive or negative) expressed
about entities within the text.
Currently only English is supported for this feature.
examples: !COMMON help_text.language_examples.AES
request:
_COMMON_: request
method: analyzeEntitySentiment
arguments:
params:
- _COMMON_: args.content_group
- _COMMON_: args.content
- _COMMON_: args.language
- _COMMON_: args.encoding
output:
format: json
- release_tracks: [ALPHA, BETA]
help_text:
brief: Use Google Cloud Natural Language API to identify entity-level sentiment.
description: |
Entity level sentiment combines both entity analysis and sentiment analysis
and attempts to determine the sentiment (positive or negative) expressed
about entities within the text.
Currently only English is supported for this feature.
examples: !COMMON help_text.language_examples.AES
request:
_COMMON_: request
api_version: v1beta2
method: analyzeEntitySentiment
arguments:
params:
- _COMMON_: args.content_group
- _COMMON_: args.content
- _COMMON_: args.language
- _COMMON_: args.encoding
output:
format: json

View File

@@ -0,0 +1,55 @@
- release_tracks: [GA]
help_text:
brief: Use Google Cloud Natural Language API to identify sentiments in a text.
description: |
Sentiment Analysis inspects the given text and identifies the prevailing
emotional opinion within the text, especially to determine a writer's
attitude as positive, negative, or neutral.
{language_help}
language_help: !COMMON help_text.language_help_ga
examples: !COMMON help_text.language_examples.AS
request:
_COMMON_: request
method: analyzeSentiment
arguments:
params:
- _COMMON_: args.content_group
- _COMMON_: args.content
- _COMMON_: args.language
- _COMMON_: args.encoding
output:
format: json
- release_tracks: [ALPHA, BETA]
help_text:
brief: Use Google Cloud Natural Language API to identify sentiments in a text.
description: |
Sentiment Analysis inspects the given text and identifies the prevailing
emotional opinion within the text, especially to determine a writer's
attitude as positive, negative, or neutral.
{language_help}
language_help: !COMMON help_text.language_help
examples: !COMMON help_text.language_examples.AS
request:
_COMMON_: request
api_version: v1beta2
method: analyzeSentiment
arguments:
params:
- _COMMON_: args.content_group
- _COMMON_: args.content
- _COMMON_: args.language
- _COMMON_: args.encoding
output:
format: json

View File

@@ -0,0 +1,55 @@
- release_tracks: [GA]
help_text:
brief: Use Google Cloud Natural Language API to identify linguistic information.
description: |
Syntactic Analysis extracts linguistic information, breaking up the given
text into a series of sentences and tokens (generally, word boundaries),
providing further analysis on those tokens.
{language_help}
language_help: !COMMON help_text.language_help_ga
examples: !COMMON help_text.language_examples.ASX
request:
_COMMON_: request
method: analyzeSyntax
arguments:
params:
- _COMMON_: args.content_group
- _COMMON_: args.content
- _COMMON_: args.language
- _COMMON_: args.encoding
output:
format: json
- release_tracks: [ALPHA, BETA]
help_text:
brief: Use Google Cloud Natural Language API to identify linguistic information.
description: |
Syntactic Analysis extracts linguistic information, breaking up the given
text into a series of sentences and tokens (generally, word boundaries),
providing further analysis on those tokens.
{language_help}
language_help: !COMMON help_text.language_help
examples: !COMMON help_text.language_examples.ASX
request:
_COMMON_: request
api_version: v1beta2
method: analyzeSyntax
arguments:
params:
- _COMMON_: args.content_group
- _COMMON_: args.content
- _COMMON_: args.language
- _COMMON_: args.encoding
output:
format: json

View File

@@ -0,0 +1,55 @@
- release_tracks: [GA]
help_text:
brief: Classifies input document into categories.
description: |
Classifies input document into categories. Returns a list of categories
representing the document. Only the most relevant categories a document
are returned e.g. if `/Science` and `/Science/Astronomy` both apply to a
document, then only the `/Science/Astronomy` category is returned, as it
is the more specific result.
Currently only English is supported for this feature.
examples: !COMMON help_text.language_examples.CT
request:
_COMMON_: request
api_version: v1
method: classifyText
arguments:
params:
- _COMMON_: args.content_group
- _COMMON_: args.content
- _COMMON_: args.language
output:
format: json
- release_tracks: [ALPHA, BETA]
help_text:
brief: Classifies input document into categories.
description: |
Classifies input document into categories. Returns a list of categories
representing the document. Only the most relevant categories a document
are returned e.g. if `/Science` and `/Science/Astronomy` both apply to a
document, then only the `/Science/Astronomy` category is returned, as it
is the more specific result.
Currently only English is supported for this feature.
examples: !COMMON help_text.language_examples.CT
request:
_COMMON_: request
api_version: v1beta2
method: classifyText
arguments:
params:
- _COMMON_: args.content_group
- _COMMON_: args.content
- _COMMON_: args.language
output:
format: json