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,28 @@
# -*- 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.
"""The gcloud dialogflow agent command group."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from googlecloudsdk.calliope import base
@base.ReleaseTracks(base.ReleaseTrack.ALPHA)
class Agent(base.Group):
"""Manage, train, and query the Dialogflow agent for a project.
"""

View File

@@ -0,0 +1,22 @@
release_tracks: [ALPHA]
help_text:
brief: Describe the Dialogflow agent of the current project.
description: |
Describe the Dialogflow agent of the current project.
examples: |
To describe the agent for the current project:
$ {command}
To describe the agent for a given project:
$ {command} --project="my-project"
arguments:
resource:
help_text: Project to use.
spec: !REF googlecloudsdk.command_lib.dialogflow.resources:project
request:
collection: dialogflow.projects
method: getAgent

View File

@@ -0,0 +1,45 @@
release_tracks: [ALPHA]
command_type: GENERIC
help_text:
brief: Export the Dialogflow agent to a zip file.
description: |
Export the Dialogflow agent of the current project to a zip file. The zip file will contain
data on all intents and entity types of the agent.
examples: |
To export the agent of the current project to local file path/to/agent.zip:
$ {command} --destination="path/to/agent.zip"
To export the agent of the current project to agent.zip in Google Storage Bucket `mybucket`:
$ {command} --destination="gs://mybucket/agent.zip"
arguments:
resource:
help_text: The agent to export.
spec: !REF googlecloudsdk.command_lib.dialogflow.resources:project
is_parent_resource: true
params:
- arg_name: destination
help_text: |
Path to a file or the URI to a Google Cloud Storage to save the agent to. Note: A URI must
start with "gs://".
required: true
request:
collection: dialogflow.projects.agent
method: export
modify_request_hooks:
- googlecloudsdk.command_lib.dialogflow.agent.hooks:SetAgentUri
async:
collection: dialogflow.projects.operations
extract_resource_result: false
response:
modify_response_hooks:
- googlecloudsdk.command_lib.dialogflow.agent.hooks:SaveAgentToFile
result_attribute: response
output:
format: none

View File

@@ -0,0 +1,58 @@
release_tracks: [ALPHA]
command_type: GENERIC
help_text:
brief: Import a Dialogflow agent from a zip file.
description: |
Import a Dialogflow agent from a ZIP file and upload it to the agent of the current project.
By default, uploads new intents and entity types without deleting the existing ones. Intents
and entity types with the same name are replaced with the new versions.
examples: |
To import local file `path/to/agent.zip` to the agent of the current project:
$ {command} --source="path/to/agent.zip"
To import `agent.zip` in Google Storage Bucket `mybucket` to the agent of the current project:
$ {command} --source="gs://mybucket/agent.zip"
To import local file `path/to/agent.zip` to the agent of the current project and replace all
existing resources in the agent:
$ {command} --source="path/to/agent.zip" --replace-all
arguments:
resource:
help_text: The agent to import.
spec: !REF googlecloudsdk.command_lib.dialogflow.resources:project
is_parent_resource: true
params:
- arg_name: source
help_text: |
Path to a file or the URI to a Google Cloud Storage file containing the agent to import.
Note: A URI must start with "gs://".
required: true
- arg_name: replace-all
type: bool
action: store_true
help_text: |
If true, replace the current agent version with a new one. All the intents and entity types
in the older version will be deleted.
request:
collection: dialogflow.projects.agent
method: import
modify_method_hook:
googlecloudsdk.command_lib.dialogflow.agent.hooks:ChooseImportOrRestoreMethod
modify_request_hooks:
- googlecloudsdk.command_lib.dialogflow.agent.hooks:ModifyImportOrRestoreRequest
async:
collection: dialogflow.projects.operations
extract_resource_result: false
response:
modify_response_hooks:
- googlecloudsdk.command_lib.dialogflow.agent.hooks:LogImportSuccess
output:
format: none

View File

@@ -0,0 +1,74 @@
release_tracks: [ALPHA]
help_text:
brief: Send a text or audio conversational query to the agent of the current project.
description: |
Send a text or audio conversational query to the agent of the current project.
examples: |
To query the agent of the current project with text:
$ {command} --query-text="hi"
To query the agent of the current project with text in session `my-session`:
$ {command} --session="my-session" --query-text="hi"
To query the agent of the current project with audio:
$ {command} --query-audio-file="path/to/audio_file.wav" --sample-rate="16000" --audio-encoding="AUDIO_ENCODING_LINEAR_16"
arguments:
params:
- arg_name: session
api_field: session
processor: googlecloudsdk.command_lib.dialogflow.agent.hooks:AddSessionPrefix
default: DEFAULT_SESSION
help_text: |
ID of the session to send the query to. This can be any number or string up to 36 bytes. By
default, a different random ID will be used for every request.
- arg_name: language
default: en
help_text: |
The language code of the query. For information on supported languages, see:
https://dialogflow.com/docs/languages.
- group:
mutex: true
required: true
params:
- arg_name: query-text
api_field: googleCloudDialogflowV2DetectIntentRequest.queryInput.text.text
help_text: Conversational query in the form of text.
- group:
help_text: |
Audio file and config:
params:
- arg_name: query-audio-file
required: true
processor: googlecloudsdk.core.util.files:ReadBinaryFileContents
api_field: googleCloudDialogflowV2DetectIntentRequest.inputAudio
help_text: |
Path to an audio file to use as a conversational query.
- arg_name: sample-rate
required: true
api_field: |-
googleCloudDialogflowV2DetectIntentRequest.queryInput.audioConfig.sampleRateHertz
help_text: |
Sample rate of the audio file in Hertz.
- arg_name: audio-encoding
required: true
api_field: |-
googleCloudDialogflowV2DetectIntentRequest.queryInput.audioConfig.audioEncoding
help_text: |
Encoding of the audio file.
See here for more information:
https://cloud.google.com/dialogflow-enterprise/docs/reference/rest/v2/projects.agent.sessions/detectIntent#AudioEncoding.
request:
collection: dialogflow.projects.agent.sessions
disable_resource_check: true
method: detectIntent
modify_request_hooks:
- googlecloudsdk.command_lib.dialogflow.agent.hooks:SetQueryLanguage
output:
format: value(queryResult.fulfillmentText)

View File

@@ -0,0 +1,30 @@
release_tracks: [ALPHA]
help_text:
brief: Train the Dialogflow agent of the current project.
description: |
Train the Dialogflow agent of the current project with its current intents and entities.
examples: |
To train the agent for the current project:
$ {command}
arguments:
resource:
help_text: The agent to train.
spec: !REF googlecloudsdk.command_lib.dialogflow.resources:project
is_parent_resource: true
request:
collection: dialogflow.projects.agent
method: train
async:
collection: dialogflow.projects.operations
extract_resource_result: false
response:
modify_response_hooks:
- googlecloudsdk.command_lib.dialogflow.agent.hooks:LogTrainSuccess
output:
format: none