google-cloud-ces-v1beta 0.a → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.yardopts +12 -0
- data/AUTHENTICATION.md +122 -0
- data/README.md +154 -8
- data/lib/google/cloud/ces/v1beta/agent_pb.rb +30 -0
- data/lib/google/cloud/ces/v1beta/agent_service/client.rb +5635 -0
- data/lib/google/cloud/ces/v1beta/agent_service/credentials.rb +48 -0
- data/lib/google/cloud/ces/v1beta/agent_service/operations.rb +841 -0
- data/lib/google/cloud/ces/v1beta/agent_service/paths.rb +481 -0
- data/lib/google/cloud/ces/v1beta/agent_service/rest/client.rb +5243 -0
- data/lib/google/cloud/ces/v1beta/agent_service/rest/operations.rb +925 -0
- data/lib/google/cloud/ces/v1beta/agent_service/rest/service_stub.rb +3213 -0
- data/lib/google/cloud/ces/v1beta/agent_service/rest.rb +55 -0
- data/lib/google/cloud/ces/v1beta/agent_service.rb +57 -0
- data/lib/google/cloud/ces/v1beta/agent_service_pb.rb +131 -0
- data/lib/google/cloud/ces/v1beta/agent_service_services_pb.rb +148 -0
- data/lib/google/cloud/ces/v1beta/agent_tool_pb.rb +24 -0
- data/lib/google/cloud/ces/v1beta/agent_transfers_pb.rb +29 -0
- data/lib/google/cloud/ces/v1beta/app_pb.rb +67 -0
- data/lib/google/cloud/ces/v1beta/app_version_pb.rb +32 -0
- data/lib/google/cloud/ces/v1beta/auth_pb.rb +34 -0
- data/lib/google/cloud/ces/v1beta/bigquery_export_pb.rb +23 -0
- data/lib/google/cloud/ces/v1beta/bindings_override.rb +75 -0
- data/lib/google/cloud/ces/v1beta/changelog_pb.rb +26 -0
- data/lib/google/cloud/ces/v1beta/client_function_pb.rb +24 -0
- data/lib/google/cloud/ces/v1beta/common_pb.rb +46 -0
- data/lib/google/cloud/ces/v1beta/connector_tool_pb.rb +27 -0
- data/lib/google/cloud/ces/v1beta/connector_toolset_pb.rb +25 -0
- data/lib/google/cloud/ces/v1beta/conversation_pb.rb +31 -0
- data/lib/google/cloud/ces/v1beta/data_store_pb.rb +27 -0
- data/lib/google/cloud/ces/v1beta/data_store_tool_pb.rb +40 -0
- data/lib/google/cloud/ces/v1beta/deployment_pb.rb +26 -0
- data/lib/google/cloud/ces/v1beta/evaluation_pb.rb +98 -0
- data/lib/google/cloud/ces/v1beta/evaluation_service/client.rb +3732 -0
- data/lib/google/cloud/ces/v1beta/evaluation_service/credentials.rb +48 -0
- data/lib/google/cloud/ces/v1beta/evaluation_service/operations.rb +841 -0
- data/lib/google/cloud/ces/v1beta/evaluation_service/paths.rb +306 -0
- data/lib/google/cloud/ces/v1beta/evaluation_service/rest/client.rb +3473 -0
- data/lib/google/cloud/ces/v1beta/evaluation_service/rest/operations.rb +925 -0
- data/lib/google/cloud/ces/v1beta/evaluation_service/rest/service_stub.rb +2047 -0
- data/lib/google/cloud/ces/v1beta/evaluation_service/rest.rb +54 -0
- data/lib/google/cloud/ces/v1beta/evaluation_service.rb +56 -0
- data/lib/google/cloud/ces/v1beta/evaluation_service_pb.rb +86 -0
- data/lib/google/cloud/ces/v1beta/evaluation_service_services_pb.rb +110 -0
- data/lib/google/cloud/ces/v1beta/example_pb.rb +34 -0
- data/lib/google/cloud/ces/v1beta/fakes_pb.rb +25 -0
- data/lib/google/cloud/ces/v1beta/file_context_pb.rb +24 -0
- data/lib/google/cloud/ces/v1beta/file_search_tool_pb.rb +24 -0
- data/lib/google/cloud/ces/v1beta/golden_run_pb.rb +21 -0
- data/lib/google/cloud/ces/v1beta/google_search_tool_pb.rb +24 -0
- data/lib/google/cloud/ces/v1beta/guardrail_pb.rb +37 -0
- data/lib/google/cloud/ces/v1beta/mcp_tool_pb.rb +26 -0
- data/lib/google/cloud/ces/v1beta/mcp_toolset_pb.rb +25 -0
- data/lib/google/cloud/ces/v1beta/mocks_pb.rb +26 -0
- data/lib/google/cloud/ces/v1beta/omnichannel_pb.rb +31 -0
- data/lib/google/cloud/ces/v1beta/omnichannel_service_pb.rb +27 -0
- data/lib/google/cloud/ces/v1beta/open_api_tool_pb.rb +25 -0
- data/lib/google/cloud/ces/v1beta/open_api_toolset_pb.rb +25 -0
- data/lib/google/cloud/ces/v1beta/python_function_pb.rb +23 -0
- data/lib/google/cloud/ces/v1beta/rest.rb +42 -0
- data/lib/google/cloud/ces/v1beta/schema_pb.rb +25 -0
- data/lib/google/cloud/ces/v1beta/search_suggestions_pb.rb +22 -0
- data/lib/google/cloud/ces/v1beta/security_settings_pb.rb +27 -0
- data/lib/google/cloud/ces/v1beta/session_service/client.rb +760 -0
- data/lib/google/cloud/ces/v1beta/session_service/credentials.rb +48 -0
- data/lib/google/cloud/ces/v1beta/session_service/paths.rb +117 -0
- data/lib/google/cloud/ces/v1beta/session_service/rest/client.rb +560 -0
- data/lib/google/cloud/ces/v1beta/session_service/rest/service_stub.rb +199 -0
- data/lib/google/cloud/ces/v1beta/session_service/rest.rb +53 -0
- data/lib/google/cloud/ces/v1beta/session_service.rb +55 -0
- data/lib/google/cloud/ces/v1beta/session_service_pb.rb +53 -0
- data/lib/google/cloud/ces/v1beta/session_service_services_pb.rb +120 -0
- data/lib/google/cloud/ces/v1beta/system_tool_pb.rb +23 -0
- data/lib/google/cloud/ces/v1beta/tool_pb.rb +38 -0
- data/lib/google/cloud/ces/v1beta/tool_service/client.rb +727 -0
- data/lib/google/cloud/ces/v1beta/tool_service/credentials.rb +48 -0
- data/lib/google/cloud/ces/v1beta/tool_service/paths.rb +94 -0
- data/lib/google/cloud/ces/v1beta/tool_service/rest/client.rb +671 -0
- data/lib/google/cloud/ces/v1beta/tool_service/rest/service_stub.rb +267 -0
- data/lib/google/cloud/ces/v1beta/tool_service/rest.rb +53 -0
- data/lib/google/cloud/ces/v1beta/tool_service.rb +55 -0
- data/lib/google/cloud/ces/v1beta/tool_service_pb.rb +36 -0
- data/lib/google/cloud/ces/v1beta/tool_service_services_pb.rb +50 -0
- data/lib/google/cloud/ces/v1beta/toolset_pb.rb +30 -0
- data/lib/google/cloud/ces/v1beta/toolset_tool_pb.rb +24 -0
- data/lib/google/cloud/ces/v1beta/version.rb +7 -2
- data/lib/google/cloud/ces/v1beta/widget_service/client.rb +501 -0
- data/lib/google/cloud/ces/v1beta/widget_service/credentials.rb +48 -0
- data/lib/google/cloud/ces/v1beta/widget_service/paths.rb +75 -0
- data/lib/google/cloud/ces/v1beta/widget_service/rest/client.rb +459 -0
- data/lib/google/cloud/ces/v1beta/widget_service/rest/service_stub.rb +143 -0
- data/lib/google/cloud/ces/v1beta/widget_service/rest.rb +53 -0
- data/lib/google/cloud/ces/v1beta/widget_service.rb +55 -0
- data/lib/google/cloud/ces/v1beta/widget_service_pb.rb +28 -0
- data/lib/google/cloud/ces/v1beta/widget_service_services_pb.rb +46 -0
- data/lib/google/cloud/ces/v1beta/widget_tool_pb.rb +29 -0
- data/lib/google/cloud/ces/v1beta.rb +49 -0
- data/lib/google-cloud-ces-v1beta.rb +21 -0
- data/proto_docs/README.md +4 -0
- data/proto_docs/google/api/client.rb +593 -0
- data/proto_docs/google/api/field_behavior.rb +85 -0
- data/proto_docs/google/api/launch_stage.rb +71 -0
- data/proto_docs/google/api/resource.rb +227 -0
- data/proto_docs/google/cloud/ces/v1beta/agent.rb +224 -0
- data/proto_docs/google/cloud/ces/v1beta/agent_service.rb +1661 -0
- data/proto_docs/google/cloud/ces/v1beta/agent_tool.rb +48 -0
- data/proto_docs/google/cloud/ces/v1beta/agent_transfers.rb +111 -0
- data/proto_docs/google/cloud/ces/v1beta/app.rb +836 -0
- data/proto_docs/google/cloud/ces/v1beta/app_version.rb +83 -0
- data/proto_docs/google/cloud/ces/v1beta/auth.rb +214 -0
- data/proto_docs/google/cloud/ces/v1beta/bigquery_export.rb +45 -0
- data/proto_docs/google/cloud/ces/v1beta/changelog.rb +73 -0
- data/proto_docs/google/cloud/ces/v1beta/client_function.rb +48 -0
- data/proto_docs/google/cloud/ces/v1beta/common.rb +375 -0
- data/proto_docs/google/cloud/ces/v1beta/connector_tool.rb +122 -0
- data/proto_docs/google/cloud/ces/v1beta/connector_toolset.rb +52 -0
- data/proto_docs/google/cloud/ces/v1beta/conversation.rb +156 -0
- data/proto_docs/google/cloud/ces/v1beta/data_store.rb +102 -0
- data/proto_docs/google/cloud/ces/v1beta/data_store_tool.rb +328 -0
- data/proto_docs/google/cloud/ces/v1beta/deployment.rb +62 -0
- data/proto_docs/google/cloud/ces/v1beta/evaluation.rb +1618 -0
- data/proto_docs/google/cloud/ces/v1beta/evaluation_service.rb +1009 -0
- data/proto_docs/google/cloud/ces/v1beta/example.rb +245 -0
- data/proto_docs/google/cloud/ces/v1beta/fakes.rb +67 -0
- data/proto_docs/google/cloud/ces/v1beta/file_context.rb +50 -0
- data/proto_docs/google/cloud/ces/v1beta/file_search_tool.rb +60 -0
- data/proto_docs/google/cloud/ces/v1beta/golden_run.rb +40 -0
- data/proto_docs/google/cloud/ces/v1beta/google_search_tool.rb +76 -0
- data/proto_docs/google/cloud/ces/v1beta/guardrail.rb +324 -0
- data/proto_docs/google/cloud/ces/v1beta/mcp_tool.rb +85 -0
- data/proto_docs/google/cloud/ces/v1beta/mcp_toolset.rb +71 -0
- data/proto_docs/google/cloud/ces/v1beta/mocks.rb +60 -0
- data/proto_docs/google/cloud/ces/v1beta/omnichannel.rb +163 -0
- data/proto_docs/google/cloud/ces/v1beta/omnichannel_service.rb +45 -0
- data/proto_docs/google/cloud/ces/v1beta/open_api_tool.rb +66 -0
- data/proto_docs/google/cloud/ces/v1beta/open_api_toolset.rb +57 -0
- data/proto_docs/google/cloud/ces/v1beta/python_function.rb +44 -0
- data/proto_docs/google/cloud/ces/v1beta/schema.rb +162 -0
- data/proto_docs/google/cloud/ces/v1beta/search_suggestions.rb +55 -0
- data/proto_docs/google/cloud/ces/v1beta/security_settings.rb +80 -0
- data/proto_docs/google/cloud/ces/v1beta/session_service.rb +490 -0
- data/proto_docs/google/cloud/ces/v1beta/system_tool.rb +38 -0
- data/proto_docs/google/cloud/ces/v1beta/tool.rb +126 -0
- data/proto_docs/google/cloud/ces/v1beta/tool_service.rb +173 -0
- data/proto_docs/google/cloud/ces/v1beta/toolset.rb +80 -0
- data/proto_docs/google/cloud/ces/v1beta/toolset_tool.rb +40 -0
- data/proto_docs/google/cloud/ces/v1beta/widget_service.rb +62 -0
- data/proto_docs/google/cloud/ces/v1beta/widget_tool.rb +146 -0
- data/proto_docs/google/longrunning/operations.rb +191 -0
- data/proto_docs/google/protobuf/any.rb +145 -0
- data/proto_docs/google/protobuf/duration.rb +98 -0
- data/proto_docs/google/protobuf/empty.rb +34 -0
- data/proto_docs/google/protobuf/field_mask.rb +229 -0
- data/proto_docs/google/protobuf/struct.rb +108 -0
- data/proto_docs/google/protobuf/timestamp.rb +127 -0
- data/proto_docs/google/rpc/status.rb +48 -0
- metadata +204 -9
|
@@ -0,0 +1,760 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Copyright 2026 Google LLC
|
|
4
|
+
#
|
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
# you may not use this file except in compliance with the License.
|
|
7
|
+
# You may obtain a copy of the License at
|
|
8
|
+
#
|
|
9
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
#
|
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
# See the License for the specific language governing permissions and
|
|
15
|
+
# limitations under the License.
|
|
16
|
+
|
|
17
|
+
# Auto-generated by gapic-generator-ruby. DO NOT EDIT!
|
|
18
|
+
|
|
19
|
+
require "google/cloud/errors"
|
|
20
|
+
require "google/cloud/ces/v1beta/session_service_pb"
|
|
21
|
+
require "google/cloud/location"
|
|
22
|
+
|
|
23
|
+
module Google
|
|
24
|
+
module Cloud
|
|
25
|
+
module Ces
|
|
26
|
+
module V1beta
|
|
27
|
+
module SessionService
|
|
28
|
+
##
|
|
29
|
+
# Client for the SessionService service.
|
|
30
|
+
#
|
|
31
|
+
# Session service provides APIs for interacting with CES agents.
|
|
32
|
+
#
|
|
33
|
+
class Client
|
|
34
|
+
# @private
|
|
35
|
+
API_VERSION = ""
|
|
36
|
+
|
|
37
|
+
# @private
|
|
38
|
+
DEFAULT_ENDPOINT_TEMPLATE = "ces.$UNIVERSE_DOMAIN$"
|
|
39
|
+
|
|
40
|
+
include Paths
|
|
41
|
+
|
|
42
|
+
# @private
|
|
43
|
+
attr_reader :session_service_stub
|
|
44
|
+
|
|
45
|
+
##
|
|
46
|
+
# Configure the SessionService Client class.
|
|
47
|
+
#
|
|
48
|
+
# See {::Google::Cloud::Ces::V1beta::SessionService::Client::Configuration}
|
|
49
|
+
# for a description of the configuration fields.
|
|
50
|
+
#
|
|
51
|
+
# @example
|
|
52
|
+
#
|
|
53
|
+
# # Modify the configuration for all SessionService clients
|
|
54
|
+
# ::Google::Cloud::Ces::V1beta::SessionService::Client.configure do |config|
|
|
55
|
+
# config.timeout = 10.0
|
|
56
|
+
# end
|
|
57
|
+
#
|
|
58
|
+
# @yield [config] Configure the Client client.
|
|
59
|
+
# @yieldparam config [Client::Configuration]
|
|
60
|
+
#
|
|
61
|
+
# @return [Client::Configuration]
|
|
62
|
+
#
|
|
63
|
+
def self.configure
|
|
64
|
+
@configure ||= begin
|
|
65
|
+
namespace = ["Google", "Cloud", "Ces", "V1beta"]
|
|
66
|
+
parent_config = while namespace.any?
|
|
67
|
+
parent_name = namespace.join "::"
|
|
68
|
+
parent_const = const_get parent_name
|
|
69
|
+
break parent_const.configure if parent_const.respond_to? :configure
|
|
70
|
+
namespace.pop
|
|
71
|
+
end
|
|
72
|
+
default_config = Client::Configuration.new parent_config
|
|
73
|
+
|
|
74
|
+
default_config.timeout = 60.0
|
|
75
|
+
default_config.retry_policy = {
|
|
76
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
default_config.rpcs.run_session.timeout = 220.0
|
|
80
|
+
default_config.rpcs.run_session.retry_policy = {
|
|
81
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: []
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
default_config.rpcs.bidi_run_session.timeout = 3600.0
|
|
85
|
+
default_config.rpcs.bidi_run_session.retry_policy = {
|
|
86
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: []
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
default_config
|
|
90
|
+
end
|
|
91
|
+
yield @configure if block_given?
|
|
92
|
+
@configure
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
##
|
|
96
|
+
# Configure the SessionService Client instance.
|
|
97
|
+
#
|
|
98
|
+
# The configuration is set to the derived mode, meaning that values can be changed,
|
|
99
|
+
# but structural changes (adding new fields, etc.) are not allowed. Structural changes
|
|
100
|
+
# should be made on {Client.configure}.
|
|
101
|
+
#
|
|
102
|
+
# See {::Google::Cloud::Ces::V1beta::SessionService::Client::Configuration}
|
|
103
|
+
# for a description of the configuration fields.
|
|
104
|
+
#
|
|
105
|
+
# @yield [config] Configure the Client client.
|
|
106
|
+
# @yieldparam config [Client::Configuration]
|
|
107
|
+
#
|
|
108
|
+
# @return [Client::Configuration]
|
|
109
|
+
#
|
|
110
|
+
def configure
|
|
111
|
+
yield @config if block_given?
|
|
112
|
+
@config
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
##
|
|
116
|
+
# The effective universe domain
|
|
117
|
+
#
|
|
118
|
+
# @return [String]
|
|
119
|
+
#
|
|
120
|
+
def universe_domain
|
|
121
|
+
@session_service_stub.universe_domain
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
##
|
|
125
|
+
# Create a new SessionService client object.
|
|
126
|
+
#
|
|
127
|
+
# @example
|
|
128
|
+
#
|
|
129
|
+
# # Create a client using the default configuration
|
|
130
|
+
# client = ::Google::Cloud::Ces::V1beta::SessionService::Client.new
|
|
131
|
+
#
|
|
132
|
+
# # Create a client using a custom configuration
|
|
133
|
+
# client = ::Google::Cloud::Ces::V1beta::SessionService::Client.new do |config|
|
|
134
|
+
# config.timeout = 10.0
|
|
135
|
+
# end
|
|
136
|
+
#
|
|
137
|
+
# @yield [config] Configure the SessionService client.
|
|
138
|
+
# @yieldparam config [Client::Configuration]
|
|
139
|
+
#
|
|
140
|
+
def initialize
|
|
141
|
+
# These require statements are intentionally placed here to initialize
|
|
142
|
+
# the gRPC module only when it's required.
|
|
143
|
+
# See https://github.com/googleapis/toolkit/issues/446
|
|
144
|
+
require "gapic/grpc"
|
|
145
|
+
require "google/cloud/ces/v1beta/session_service_services_pb"
|
|
146
|
+
|
|
147
|
+
# Create the configuration object
|
|
148
|
+
@config = Configuration.new Client.configure
|
|
149
|
+
|
|
150
|
+
# Yield the configuration if needed
|
|
151
|
+
yield @config if block_given?
|
|
152
|
+
|
|
153
|
+
# Create credentials
|
|
154
|
+
credentials = @config.credentials
|
|
155
|
+
# Use self-signed JWT if the endpoint is unchanged from default,
|
|
156
|
+
# but only if the default endpoint does not have a region prefix.
|
|
157
|
+
enable_self_signed_jwt = @config.endpoint.nil? ||
|
|
158
|
+
(@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
|
|
159
|
+
!@config.endpoint.split(".").first.include?("-"))
|
|
160
|
+
credentials ||= Credentials.default scope: @config.scope,
|
|
161
|
+
enable_self_signed_jwt: enable_self_signed_jwt
|
|
162
|
+
if credentials.is_a?(::String) || credentials.is_a?(::Hash)
|
|
163
|
+
credentials = Credentials.new credentials, scope: @config.scope
|
|
164
|
+
end
|
|
165
|
+
@quota_project_id = @config.quota_project
|
|
166
|
+
@quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
|
|
167
|
+
|
|
168
|
+
@session_service_stub = ::Gapic::ServiceStub.new(
|
|
169
|
+
::Google::Cloud::Ces::V1beta::SessionService::Stub,
|
|
170
|
+
credentials: credentials,
|
|
171
|
+
endpoint: @config.endpoint,
|
|
172
|
+
endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
|
|
173
|
+
universe_domain: @config.universe_domain,
|
|
174
|
+
channel_args: @config.channel_args,
|
|
175
|
+
interceptors: @config.interceptors,
|
|
176
|
+
channel_pool_config: @config.channel_pool,
|
|
177
|
+
logger: @config.logger
|
|
178
|
+
)
|
|
179
|
+
|
|
180
|
+
@session_service_stub.stub_logger&.info do |entry|
|
|
181
|
+
entry.set_system_name
|
|
182
|
+
entry.set_service
|
|
183
|
+
entry.message = "Created client for #{entry.service}"
|
|
184
|
+
entry.set_credentials_fields credentials
|
|
185
|
+
entry.set "customEndpoint", @config.endpoint if @config.endpoint
|
|
186
|
+
entry.set "defaultTimeout", @config.timeout if @config.timeout
|
|
187
|
+
entry.set "quotaProject", @quota_project_id if @quota_project_id
|
|
188
|
+
end
|
|
189
|
+
|
|
190
|
+
@location_client = Google::Cloud::Location::Locations::Client.new do |config|
|
|
191
|
+
config.credentials = credentials
|
|
192
|
+
config.quota_project = @quota_project_id
|
|
193
|
+
config.endpoint = @session_service_stub.endpoint
|
|
194
|
+
config.universe_domain = @session_service_stub.universe_domain
|
|
195
|
+
config.logger = @session_service_stub.logger if config.respond_to? :logger=
|
|
196
|
+
end
|
|
197
|
+
end
|
|
198
|
+
|
|
199
|
+
##
|
|
200
|
+
# Get the associated client for mix-in of the Locations.
|
|
201
|
+
#
|
|
202
|
+
# @return [Google::Cloud::Location::Locations::Client]
|
|
203
|
+
#
|
|
204
|
+
attr_reader :location_client
|
|
205
|
+
|
|
206
|
+
##
|
|
207
|
+
# The logger used for request/response debug logging.
|
|
208
|
+
#
|
|
209
|
+
# @return [Logger]
|
|
210
|
+
#
|
|
211
|
+
def logger
|
|
212
|
+
@session_service_stub.logger
|
|
213
|
+
end
|
|
214
|
+
|
|
215
|
+
# Service calls
|
|
216
|
+
|
|
217
|
+
##
|
|
218
|
+
# Initiates a single-turn interaction with the CES agent within a session.
|
|
219
|
+
#
|
|
220
|
+
# @overload run_session(request, options = nil)
|
|
221
|
+
# Pass arguments to `run_session` via a request object, either of type
|
|
222
|
+
# {::Google::Cloud::Ces::V1beta::RunSessionRequest} or an equivalent Hash.
|
|
223
|
+
#
|
|
224
|
+
# @param request [::Google::Cloud::Ces::V1beta::RunSessionRequest, ::Hash]
|
|
225
|
+
# A request object representing the call parameters. Required. To specify no
|
|
226
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
|
227
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
|
228
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
|
229
|
+
#
|
|
230
|
+
# @overload run_session(config: nil, inputs: nil)
|
|
231
|
+
# Pass arguments to `run_session` via keyword arguments. Note that at
|
|
232
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
|
233
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
|
234
|
+
#
|
|
235
|
+
# @param config [::Google::Cloud::Ces::V1beta::SessionConfig, ::Hash]
|
|
236
|
+
# Required. The configuration for the session.
|
|
237
|
+
# @param inputs [::Array<::Google::Cloud::Ces::V1beta::SessionInput, ::Hash>]
|
|
238
|
+
# Required. Inputs for the session.
|
|
239
|
+
#
|
|
240
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
|
241
|
+
# @yieldparam response [::Google::Cloud::Ces::V1beta::RunSessionResponse]
|
|
242
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
|
243
|
+
#
|
|
244
|
+
# @return [::Google::Cloud::Ces::V1beta::RunSessionResponse]
|
|
245
|
+
#
|
|
246
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
|
247
|
+
#
|
|
248
|
+
# @example Basic example
|
|
249
|
+
# require "google/cloud/ces/v1beta"
|
|
250
|
+
#
|
|
251
|
+
# # Create a client object. The client can be reused for multiple calls.
|
|
252
|
+
# client = Google::Cloud::Ces::V1beta::SessionService::Client.new
|
|
253
|
+
#
|
|
254
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
|
255
|
+
# request = Google::Cloud::Ces::V1beta::RunSessionRequest.new
|
|
256
|
+
#
|
|
257
|
+
# # Call the run_session method.
|
|
258
|
+
# result = client.run_session request
|
|
259
|
+
#
|
|
260
|
+
# # The returned object is of type Google::Cloud::Ces::V1beta::RunSessionResponse.
|
|
261
|
+
# p result
|
|
262
|
+
#
|
|
263
|
+
def run_session request, options = nil
|
|
264
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
|
265
|
+
|
|
266
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Ces::V1beta::RunSessionRequest
|
|
267
|
+
|
|
268
|
+
# Converts hash and nil to an options object
|
|
269
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
|
270
|
+
|
|
271
|
+
# Customize the options with defaults
|
|
272
|
+
metadata = @config.rpcs.run_session.metadata.to_h
|
|
273
|
+
|
|
274
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
|
275
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
|
276
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
|
277
|
+
gapic_version: ::Google::Cloud::Ces::V1beta::VERSION
|
|
278
|
+
metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
|
279
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
|
280
|
+
|
|
281
|
+
header_params = {}
|
|
282
|
+
if request.config&.session
|
|
283
|
+
header_params["config.session"] = request.config.session
|
|
284
|
+
end
|
|
285
|
+
|
|
286
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
|
287
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
|
288
|
+
|
|
289
|
+
options.apply_defaults timeout: @config.rpcs.run_session.timeout,
|
|
290
|
+
metadata: metadata,
|
|
291
|
+
retry_policy: @config.rpcs.run_session.retry_policy
|
|
292
|
+
|
|
293
|
+
options.apply_defaults timeout: @config.timeout,
|
|
294
|
+
metadata: @config.metadata,
|
|
295
|
+
retry_policy: @config.retry_policy
|
|
296
|
+
|
|
297
|
+
@session_service_stub.call_rpc :run_session, request, options: options do |response, operation|
|
|
298
|
+
yield response, operation if block_given?
|
|
299
|
+
end
|
|
300
|
+
rescue ::GRPC::BadStatus => e
|
|
301
|
+
raise ::Google::Cloud::Error.from_error(e)
|
|
302
|
+
end
|
|
303
|
+
|
|
304
|
+
##
|
|
305
|
+
# Initiates a single-turn interaction with the CES agent. Uses server-side
|
|
306
|
+
# streaming to deliver incremental results and partial responses as they are
|
|
307
|
+
# generated.
|
|
308
|
+
#
|
|
309
|
+
# By default, complete responses (e.g., messages from callbacks or full LLM
|
|
310
|
+
# responses) are sent to the client as soon as they are available. To enable
|
|
311
|
+
# streaming individual text chunks directly from the model, set
|
|
312
|
+
# {::Google::Cloud::Ces::V1beta::SessionConfig#enable_text_streaming enable_text_streaming}
|
|
313
|
+
# to true.
|
|
314
|
+
#
|
|
315
|
+
# @overload stream_run_session(request, options = nil)
|
|
316
|
+
# Pass arguments to `stream_run_session` via a request object, either of type
|
|
317
|
+
# {::Google::Cloud::Ces::V1beta::RunSessionRequest} or an equivalent Hash.
|
|
318
|
+
#
|
|
319
|
+
# @param request [::Google::Cloud::Ces::V1beta::RunSessionRequest, ::Hash]
|
|
320
|
+
# A request object representing the call parameters. Required. To specify no
|
|
321
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
|
322
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
|
323
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
|
324
|
+
#
|
|
325
|
+
# @overload stream_run_session(config: nil, inputs: nil)
|
|
326
|
+
# Pass arguments to `stream_run_session` via keyword arguments. Note that at
|
|
327
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
|
328
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
|
329
|
+
#
|
|
330
|
+
# @param config [::Google::Cloud::Ces::V1beta::SessionConfig, ::Hash]
|
|
331
|
+
# Required. The configuration for the session.
|
|
332
|
+
# @param inputs [::Array<::Google::Cloud::Ces::V1beta::SessionInput, ::Hash>]
|
|
333
|
+
# Required. Inputs for the session.
|
|
334
|
+
#
|
|
335
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
|
336
|
+
# @yieldparam response [::Enumerable<::Google::Cloud::Ces::V1beta::RunSessionResponse>]
|
|
337
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
|
338
|
+
#
|
|
339
|
+
# @return [::Enumerable<::Google::Cloud::Ces::V1beta::RunSessionResponse>]
|
|
340
|
+
#
|
|
341
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
|
342
|
+
#
|
|
343
|
+
# @example Basic example
|
|
344
|
+
# require "google/cloud/ces/v1beta"
|
|
345
|
+
#
|
|
346
|
+
# # Create a client object. The client can be reused for multiple calls.
|
|
347
|
+
# client = Google::Cloud::Ces::V1beta::SessionService::Client.new
|
|
348
|
+
#
|
|
349
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
|
350
|
+
# request = Google::Cloud::Ces::V1beta::RunSessionRequest.new
|
|
351
|
+
#
|
|
352
|
+
# # Call the stream_run_session method to start streaming.
|
|
353
|
+
# output = client.stream_run_session request
|
|
354
|
+
#
|
|
355
|
+
# # The returned object is a streamed enumerable yielding elements of type
|
|
356
|
+
# # ::Google::Cloud::Ces::V1beta::RunSessionResponse
|
|
357
|
+
# output.each do |current_response|
|
|
358
|
+
# p current_response
|
|
359
|
+
# end
|
|
360
|
+
#
|
|
361
|
+
def stream_run_session request, options = nil
|
|
362
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
|
363
|
+
|
|
364
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Ces::V1beta::RunSessionRequest
|
|
365
|
+
|
|
366
|
+
# Converts hash and nil to an options object
|
|
367
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
|
368
|
+
|
|
369
|
+
# Customize the options with defaults
|
|
370
|
+
metadata = @config.rpcs.stream_run_session.metadata.to_h
|
|
371
|
+
|
|
372
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
|
373
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
|
374
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
|
375
|
+
gapic_version: ::Google::Cloud::Ces::V1beta::VERSION
|
|
376
|
+
metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
|
377
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
|
378
|
+
|
|
379
|
+
header_params = {}
|
|
380
|
+
if request.config&.session
|
|
381
|
+
header_params["config.session"] = request.config.session
|
|
382
|
+
end
|
|
383
|
+
|
|
384
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
|
385
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
|
386
|
+
|
|
387
|
+
options.apply_defaults timeout: @config.rpcs.stream_run_session.timeout,
|
|
388
|
+
metadata: metadata,
|
|
389
|
+
retry_policy: @config.rpcs.stream_run_session.retry_policy
|
|
390
|
+
|
|
391
|
+
options.apply_defaults timeout: @config.timeout,
|
|
392
|
+
metadata: @config.metadata,
|
|
393
|
+
retry_policy: @config.retry_policy
|
|
394
|
+
|
|
395
|
+
@session_service_stub.call_rpc :stream_run_session, request, options: options do |response, operation|
|
|
396
|
+
yield response, operation if block_given?
|
|
397
|
+
end
|
|
398
|
+
rescue ::GRPC::BadStatus => e
|
|
399
|
+
raise ::Google::Cloud::Error.from_error(e)
|
|
400
|
+
end
|
|
401
|
+
|
|
402
|
+
##
|
|
403
|
+
# Establishes a bidirectional streaming connection with the CES agent.
|
|
404
|
+
# The agent processes continuous multimodal inputs (e.g., text, audio) and
|
|
405
|
+
# generates real-time multimodal output streams.
|
|
406
|
+
#
|
|
407
|
+
# --- Client Request Stream ---
|
|
408
|
+
# The client streams requests in the following order:
|
|
409
|
+
#
|
|
410
|
+
# 1. Initialization:
|
|
411
|
+
# The first message must contain
|
|
412
|
+
# {::Google::Cloud::Ces::V1beta::BidiSessionClientMessage#config SessionConfig}.
|
|
413
|
+
# For audio sessions, this should also include
|
|
414
|
+
# {::Google::Cloud::Ces::V1beta::SessionConfig#input_audio_config InputAudioConfig}
|
|
415
|
+
# and
|
|
416
|
+
# {::Google::Cloud::Ces::V1beta::SessionConfig#output_audio_config OutputAudioConfig}
|
|
417
|
+
# to define audio processing and synthesis parameters.
|
|
418
|
+
#
|
|
419
|
+
# 2. Interaction:
|
|
420
|
+
# Subsequent messages stream
|
|
421
|
+
# {::Google::Cloud::Ces::V1beta::BidiSessionClientMessage#realtime_input SessionInput}
|
|
422
|
+
# containing real-time user input data.
|
|
423
|
+
#
|
|
424
|
+
# 3. Termination:
|
|
425
|
+
# The client should half-close the stream when there is no more user
|
|
426
|
+
# input. It should also half-close upon receiving
|
|
427
|
+
# {::Google::Cloud::Ces::V1beta::BidiSessionServerMessage#end_session EndSession}
|
|
428
|
+
# or {::Google::Cloud::Ces::V1beta::BidiSessionServerMessage#go_away GoAway}
|
|
429
|
+
# from the agent.
|
|
430
|
+
#
|
|
431
|
+
# --- Server Response Stream ---
|
|
432
|
+
# For each interaction turn, the agent streams messages in the following
|
|
433
|
+
# sequence:
|
|
434
|
+
#
|
|
435
|
+
# 1. Speech Recognition (First N messages):
|
|
436
|
+
# Contains
|
|
437
|
+
# {::Google::Cloud::Ces::V1beta::BidiSessionServerMessage#recognition_result RecognitionResult}
|
|
438
|
+
# representing the concatenated user speech segments captured so far.
|
|
439
|
+
# This is only populated for audio sessions.
|
|
440
|
+
#
|
|
441
|
+
# 2. Response (Next M messages):
|
|
442
|
+
# Contains
|
|
443
|
+
# {::Google::Cloud::Ces::V1beta::BidiSessionServerMessage#session_output SessionOutput}
|
|
444
|
+
# delivering the agent's response in various modalities (e.g., text,
|
|
445
|
+
# audio).
|
|
446
|
+
#
|
|
447
|
+
# 3. Turn Completion (Final message of the turn):
|
|
448
|
+
# Contains
|
|
449
|
+
# {::Google::Cloud::Ces::V1beta::BidiSessionServerMessage#session_output SessionOutput}
|
|
450
|
+
# with
|
|
451
|
+
# {::Google::Cloud::Ces::V1beta::SessionOutput#turn_completed turn_completed}
|
|
452
|
+
# set to true. This signals the end of the current turn and includes
|
|
453
|
+
# {::Google::Cloud::Ces::V1beta::SessionOutput#diagnostic_info DiagnosticInfo}
|
|
454
|
+
# with execution details.
|
|
455
|
+
#
|
|
456
|
+
# --- Audio Best Practices ---
|
|
457
|
+
# 1. Streaming:
|
|
458
|
+
# Stream {::Google::Cloud::Ces::V1beta::SessionInput#audio audio data}
|
|
459
|
+
# **CONTINUOUSLY**, even during silence. Recommended chunk size: 40-120ms
|
|
460
|
+
# (balances latency vs. efficiency).
|
|
461
|
+
#
|
|
462
|
+
# 2. Playback & Interruption:
|
|
463
|
+
# Play {::Google::Cloud::Ces::V1beta::SessionOutput#audio audio responses}
|
|
464
|
+
# upon receipt. Stop playback immediately if an
|
|
465
|
+
# {::Google::Cloud::Ces::V1beta::BidiSessionServerMessage#interruption_signal InterruptionSignal}
|
|
466
|
+
# is received (e.g., user barge-in or new agent response).
|
|
467
|
+
#
|
|
468
|
+
# @param request [::Gapic::StreamInput, ::Enumerable<::Google::Cloud::Ces::V1beta::BidiSessionClientMessage, ::Hash>]
|
|
469
|
+
# An enumerable of {::Google::Cloud::Ces::V1beta::BidiSessionClientMessage} instances.
|
|
470
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
|
471
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
|
472
|
+
#
|
|
473
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
|
474
|
+
# @yieldparam response [::Enumerable<::Google::Cloud::Ces::V1beta::BidiSessionServerMessage>]
|
|
475
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
|
476
|
+
#
|
|
477
|
+
# @return [::Enumerable<::Google::Cloud::Ces::V1beta::BidiSessionServerMessage>]
|
|
478
|
+
#
|
|
479
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
|
480
|
+
#
|
|
481
|
+
# @example Basic example
|
|
482
|
+
# require "google/cloud/ces/v1beta"
|
|
483
|
+
#
|
|
484
|
+
# # Create a client object. The client can be reused for multiple calls.
|
|
485
|
+
# client = Google::Cloud::Ces::V1beta::SessionService::Client.new
|
|
486
|
+
#
|
|
487
|
+
# # Create an input stream.
|
|
488
|
+
# input = Gapic::StreamInput.new
|
|
489
|
+
#
|
|
490
|
+
# # Call the bidi_run_session method to start streaming.
|
|
491
|
+
# output = client.bidi_run_session input
|
|
492
|
+
#
|
|
493
|
+
# # Send requests on the stream. For each request object, set fields by
|
|
494
|
+
# # passing keyword arguments. Be sure to close the stream when done.
|
|
495
|
+
# input << Google::Cloud::Ces::V1beta::BidiSessionClientMessage.new
|
|
496
|
+
# input << Google::Cloud::Ces::V1beta::BidiSessionClientMessage.new
|
|
497
|
+
# input.close
|
|
498
|
+
#
|
|
499
|
+
# # The returned object is a streamed enumerable yielding elements of type
|
|
500
|
+
# # ::Google::Cloud::Ces::V1beta::BidiSessionServerMessage
|
|
501
|
+
# output.each do |current_response|
|
|
502
|
+
# p current_response
|
|
503
|
+
# end
|
|
504
|
+
#
|
|
505
|
+
def bidi_run_session request, options = nil
|
|
506
|
+
unless request.is_a? ::Enumerable
|
|
507
|
+
raise ::ArgumentError, "request must be an Enumerable" unless request.respond_to? :to_enum
|
|
508
|
+
request = request.to_enum
|
|
509
|
+
end
|
|
510
|
+
|
|
511
|
+
request = request.lazy.map do |req|
|
|
512
|
+
::Gapic::Protobuf.coerce req, to: ::Google::Cloud::Ces::V1beta::BidiSessionClientMessage
|
|
513
|
+
end
|
|
514
|
+
|
|
515
|
+
# Converts hash and nil to an options object
|
|
516
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
|
517
|
+
|
|
518
|
+
# Customize the options with defaults
|
|
519
|
+
metadata = @config.rpcs.bidi_run_session.metadata.to_h
|
|
520
|
+
|
|
521
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
|
522
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
|
523
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
|
524
|
+
gapic_version: ::Google::Cloud::Ces::V1beta::VERSION
|
|
525
|
+
metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
|
526
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
|
527
|
+
|
|
528
|
+
options.apply_defaults timeout: @config.rpcs.bidi_run_session.timeout,
|
|
529
|
+
metadata: metadata,
|
|
530
|
+
retry_policy: @config.rpcs.bidi_run_session.retry_policy
|
|
531
|
+
|
|
532
|
+
options.apply_defaults timeout: @config.timeout,
|
|
533
|
+
metadata: @config.metadata,
|
|
534
|
+
retry_policy: @config.retry_policy
|
|
535
|
+
|
|
536
|
+
@session_service_stub.call_rpc :bidi_run_session, request, options: options do |response, operation|
|
|
537
|
+
yield response, operation if block_given?
|
|
538
|
+
end
|
|
539
|
+
rescue ::GRPC::BadStatus => e
|
|
540
|
+
raise ::Google::Cloud::Error.from_error(e)
|
|
541
|
+
end
|
|
542
|
+
|
|
543
|
+
##
|
|
544
|
+
# Configuration class for the SessionService API.
|
|
545
|
+
#
|
|
546
|
+
# This class represents the configuration for SessionService,
|
|
547
|
+
# providing control over timeouts, retry behavior, logging, transport
|
|
548
|
+
# parameters, and other low-level controls. Certain parameters can also be
|
|
549
|
+
# applied individually to specific RPCs. See
|
|
550
|
+
# {::Google::Cloud::Ces::V1beta::SessionService::Client::Configuration::Rpcs}
|
|
551
|
+
# for a list of RPCs that can be configured independently.
|
|
552
|
+
#
|
|
553
|
+
# Configuration can be applied globally to all clients, or to a single client
|
|
554
|
+
# on construction.
|
|
555
|
+
#
|
|
556
|
+
# @example
|
|
557
|
+
#
|
|
558
|
+
# # Modify the global config, setting the timeout for
|
|
559
|
+
# # run_session to 20 seconds,
|
|
560
|
+
# # and all remaining timeouts to 10 seconds.
|
|
561
|
+
# ::Google::Cloud::Ces::V1beta::SessionService::Client.configure do |config|
|
|
562
|
+
# config.timeout = 10.0
|
|
563
|
+
# config.rpcs.run_session.timeout = 20.0
|
|
564
|
+
# end
|
|
565
|
+
#
|
|
566
|
+
# # Apply the above configuration only to a new client.
|
|
567
|
+
# client = ::Google::Cloud::Ces::V1beta::SessionService::Client.new do |config|
|
|
568
|
+
# config.timeout = 10.0
|
|
569
|
+
# config.rpcs.run_session.timeout = 20.0
|
|
570
|
+
# end
|
|
571
|
+
#
|
|
572
|
+
# @!attribute [rw] endpoint
|
|
573
|
+
# A custom service endpoint, as a hostname or hostname:port. The default is
|
|
574
|
+
# nil, indicating to use the default endpoint in the current universe domain.
|
|
575
|
+
# @return [::String,nil]
|
|
576
|
+
# @!attribute [rw] credentials
|
|
577
|
+
# Credentials to send with calls. You may provide any of the following types:
|
|
578
|
+
# * (`Google::Auth::Credentials`) A googleauth credentials object
|
|
579
|
+
# (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
|
|
580
|
+
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
|
581
|
+
# (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
|
|
582
|
+
# * (`GRPC::Core::Channel`) a gRPC channel with included credentials
|
|
583
|
+
# * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
|
|
584
|
+
# * (`nil`) indicating no credentials
|
|
585
|
+
#
|
|
586
|
+
# @note Warning: Passing a `String` to a keyfile path or a `Hash` of credentials
|
|
587
|
+
# is deprecated. Providing an unvalidated credential configuration to
|
|
588
|
+
# Google APIs can compromise the security of your systems and data.
|
|
589
|
+
#
|
|
590
|
+
# @example
|
|
591
|
+
#
|
|
592
|
+
# # The recommended way to provide credentials is to use the `make_creds` method
|
|
593
|
+
# # on the appropriate credentials class for your environment.
|
|
594
|
+
#
|
|
595
|
+
# require "googleauth"
|
|
596
|
+
#
|
|
597
|
+
# credentials = ::Google::Auth::ServiceAccountCredentials.make_creds(
|
|
598
|
+
# json_key_io: ::File.open("/path/to/keyfile.json")
|
|
599
|
+
# )
|
|
600
|
+
#
|
|
601
|
+
# client = ::Google::Cloud::Ces::V1beta::SessionService::Client.new do |config|
|
|
602
|
+
# config.credentials = credentials
|
|
603
|
+
# end
|
|
604
|
+
#
|
|
605
|
+
# @note Warning: If you accept a credential configuration (JSON file or Hash) from an
|
|
606
|
+
# external source for authentication to Google Cloud, you must validate it before
|
|
607
|
+
# providing it to a Google API client library. Providing an unvalidated credential
|
|
608
|
+
# configuration to Google APIs can compromise the security of your systems and data.
|
|
609
|
+
# For more information, refer to [Validate credential configurations from external
|
|
610
|
+
# sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
|
|
611
|
+
# @return [::Object]
|
|
612
|
+
# @!attribute [rw] scope
|
|
613
|
+
# The OAuth scopes
|
|
614
|
+
# @return [::Array<::String>]
|
|
615
|
+
# @!attribute [rw] lib_name
|
|
616
|
+
# The library name as recorded in instrumentation and logging
|
|
617
|
+
# @return [::String]
|
|
618
|
+
# @!attribute [rw] lib_version
|
|
619
|
+
# The library version as recorded in instrumentation and logging
|
|
620
|
+
# @return [::String]
|
|
621
|
+
# @!attribute [rw] channel_args
|
|
622
|
+
# Extra parameters passed to the gRPC channel. Note: this is ignored if a
|
|
623
|
+
# `GRPC::Core::Channel` object is provided as the credential.
|
|
624
|
+
# @return [::Hash]
|
|
625
|
+
# @!attribute [rw] interceptors
|
|
626
|
+
# An array of interceptors that are run before calls are executed.
|
|
627
|
+
# @return [::Array<::GRPC::ClientInterceptor>]
|
|
628
|
+
# @!attribute [rw] timeout
|
|
629
|
+
# The call timeout in seconds.
|
|
630
|
+
# @return [::Numeric]
|
|
631
|
+
# @!attribute [rw] metadata
|
|
632
|
+
# Additional gRPC headers to be sent with the call.
|
|
633
|
+
# @return [::Hash{::Symbol=>::String}]
|
|
634
|
+
# @!attribute [rw] retry_policy
|
|
635
|
+
# The retry policy. The value is a hash with the following keys:
|
|
636
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
|
637
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
|
638
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
|
639
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
|
640
|
+
# trigger a retry.
|
|
641
|
+
# @return [::Hash]
|
|
642
|
+
# @!attribute [rw] quota_project
|
|
643
|
+
# A separate project against which to charge quota.
|
|
644
|
+
# @return [::String]
|
|
645
|
+
# @!attribute [rw] universe_domain
|
|
646
|
+
# The universe domain within which to make requests. This determines the
|
|
647
|
+
# default endpoint URL. The default value of nil uses the environment
|
|
648
|
+
# universe (usually the default "googleapis.com" universe).
|
|
649
|
+
# @return [::String,nil]
|
|
650
|
+
# @!attribute [rw] logger
|
|
651
|
+
# A custom logger to use for request/response debug logging, or the value
|
|
652
|
+
# `:default` (the default) to construct a default logger, or `nil` to
|
|
653
|
+
# explicitly disable logging.
|
|
654
|
+
# @return [::Logger,:default,nil]
|
|
655
|
+
#
|
|
656
|
+
class Configuration
|
|
657
|
+
extend ::Gapic::Config
|
|
658
|
+
|
|
659
|
+
# @private
|
|
660
|
+
# The endpoint specific to the default "googleapis.com" universe. Deprecated.
|
|
661
|
+
DEFAULT_ENDPOINT = "ces.googleapis.com"
|
|
662
|
+
|
|
663
|
+
config_attr :endpoint, nil, ::String, nil
|
|
664
|
+
config_attr :credentials, nil do |value|
|
|
665
|
+
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil]
|
|
666
|
+
allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC::Core::Channel
|
|
667
|
+
allowed.any? { |klass| klass === value }
|
|
668
|
+
end
|
|
669
|
+
config_attr :scope, nil, ::String, ::Array, nil
|
|
670
|
+
config_attr :lib_name, nil, ::String, nil
|
|
671
|
+
config_attr :lib_version, nil, ::String, nil
|
|
672
|
+
config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
|
|
673
|
+
config_attr :interceptors, nil, ::Array, nil
|
|
674
|
+
config_attr :timeout, nil, ::Numeric, nil
|
|
675
|
+
config_attr :metadata, nil, ::Hash, nil
|
|
676
|
+
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
|
677
|
+
config_attr :quota_project, nil, ::String, nil
|
|
678
|
+
config_attr :universe_domain, nil, ::String, nil
|
|
679
|
+
config_attr :logger, :default, ::Logger, nil, :default
|
|
680
|
+
|
|
681
|
+
# @private
|
|
682
|
+
def initialize parent_config = nil
|
|
683
|
+
@parent_config = parent_config unless parent_config.nil?
|
|
684
|
+
|
|
685
|
+
yield self if block_given?
|
|
686
|
+
end
|
|
687
|
+
|
|
688
|
+
##
|
|
689
|
+
# Configurations for individual RPCs
|
|
690
|
+
# @return [Rpcs]
|
|
691
|
+
#
|
|
692
|
+
def rpcs
|
|
693
|
+
@rpcs ||= begin
|
|
694
|
+
parent_rpcs = nil
|
|
695
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
|
|
696
|
+
Rpcs.new parent_rpcs
|
|
697
|
+
end
|
|
698
|
+
end
|
|
699
|
+
|
|
700
|
+
##
|
|
701
|
+
# Configuration for the channel pool
|
|
702
|
+
# @return [::Gapic::ServiceStub::ChannelPool::Configuration]
|
|
703
|
+
#
|
|
704
|
+
def channel_pool
|
|
705
|
+
@channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new
|
|
706
|
+
end
|
|
707
|
+
|
|
708
|
+
##
|
|
709
|
+
# Configuration RPC class for the SessionService API.
|
|
710
|
+
#
|
|
711
|
+
# Includes fields providing the configuration for each RPC in this service.
|
|
712
|
+
# Each configuration object is of type `Gapic::Config::Method` and includes
|
|
713
|
+
# the following configuration fields:
|
|
714
|
+
#
|
|
715
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in seconds
|
|
716
|
+
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
|
|
717
|
+
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
|
718
|
+
# include the following keys:
|
|
719
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
|
720
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
|
721
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
|
722
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
|
723
|
+
# trigger a retry.
|
|
724
|
+
#
|
|
725
|
+
class Rpcs
|
|
726
|
+
##
|
|
727
|
+
# RPC-specific configuration for `run_session`
|
|
728
|
+
# @return [::Gapic::Config::Method]
|
|
729
|
+
#
|
|
730
|
+
attr_reader :run_session
|
|
731
|
+
##
|
|
732
|
+
# RPC-specific configuration for `stream_run_session`
|
|
733
|
+
# @return [::Gapic::Config::Method]
|
|
734
|
+
#
|
|
735
|
+
attr_reader :stream_run_session
|
|
736
|
+
##
|
|
737
|
+
# RPC-specific configuration for `bidi_run_session`
|
|
738
|
+
# @return [::Gapic::Config::Method]
|
|
739
|
+
#
|
|
740
|
+
attr_reader :bidi_run_session
|
|
741
|
+
|
|
742
|
+
# @private
|
|
743
|
+
def initialize parent_rpcs = nil
|
|
744
|
+
run_session_config = parent_rpcs.run_session if parent_rpcs.respond_to? :run_session
|
|
745
|
+
@run_session = ::Gapic::Config::Method.new run_session_config
|
|
746
|
+
stream_run_session_config = parent_rpcs.stream_run_session if parent_rpcs.respond_to? :stream_run_session
|
|
747
|
+
@stream_run_session = ::Gapic::Config::Method.new stream_run_session_config
|
|
748
|
+
bidi_run_session_config = parent_rpcs.bidi_run_session if parent_rpcs.respond_to? :bidi_run_session
|
|
749
|
+
@bidi_run_session = ::Gapic::Config::Method.new bidi_run_session_config
|
|
750
|
+
|
|
751
|
+
yield self if block_given?
|
|
752
|
+
end
|
|
753
|
+
end
|
|
754
|
+
end
|
|
755
|
+
end
|
|
756
|
+
end
|
|
757
|
+
end
|
|
758
|
+
end
|
|
759
|
+
end
|
|
760
|
+
end
|