google-cloud-dataqna-v1alpha 0.13.1 → 0.13.2
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 +1 -1
- data/README.md +2 -2
- data/lib/google/cloud/dataqna/v1alpha/auto_suggestion_service/client.rb +1 -1
- data/lib/google/cloud/dataqna/v1alpha/auto_suggestion_service/credentials.rb +1 -1
- data/lib/google/cloud/dataqna/v1alpha/auto_suggestion_service/paths.rb +1 -1
- data/lib/google/cloud/dataqna/v1alpha/auto_suggestion_service/rest/client.rb +510 -0
- data/lib/google/cloud/dataqna/v1alpha/auto_suggestion_service/rest/service_stub.rb +143 -0
- data/lib/google/cloud/dataqna/v1alpha/auto_suggestion_service/rest.rb +117 -0
- data/lib/google/cloud/dataqna/v1alpha/auto_suggestion_service.rb +7 -1
- data/lib/google/cloud/dataqna/v1alpha/auto_suggestion_service_services_pb.rb +1 -1
- data/lib/google/cloud/dataqna/v1alpha/question_service/client.rb +1 -1
- data/lib/google/cloud/dataqna/v1alpha/question_service/credentials.rb +1 -1
- data/lib/google/cloud/dataqna/v1alpha/question_service/paths.rb +1 -1
- data/lib/google/cloud/dataqna/v1alpha/question_service/rest/client.rb +808 -0
- data/lib/google/cloud/dataqna/v1alpha/question_service/rest/service_stub.rb +389 -0
- data/lib/google/cloud/dataqna/v1alpha/question_service/rest.rb +66 -0
- data/lib/google/cloud/dataqna/v1alpha/question_service.rb +7 -1
- data/lib/google/cloud/dataqna/v1alpha/question_service_services_pb.rb +1 -1
- data/lib/google/cloud/dataqna/v1alpha/rest.rb +38 -0
- data/lib/google/cloud/dataqna/v1alpha/version.rb +1 -1
- data/lib/google/cloud/dataqna/v1alpha.rb +6 -1
- data/lib/google-cloud-dataqna-v1alpha.rb +1 -1
- data/proto_docs/README.md +1 -1
- data/proto_docs/google/api/client.rb +1 -1
- data/proto_docs/google/api/field_behavior.rb +1 -1
- data/proto_docs/google/api/launch_stage.rb +1 -1
- data/proto_docs/google/api/resource.rb +1 -1
- data/proto_docs/google/cloud/dataqna/v1alpha/annotated_string.rb +1 -1
- data/proto_docs/google/cloud/dataqna/v1alpha/auto_suggestion_service.rb +1 -1
- data/proto_docs/google/cloud/dataqna/v1alpha/question.rb +1 -1
- data/proto_docs/google/cloud/dataqna/v1alpha/question_service.rb +1 -1
- data/proto_docs/google/cloud/dataqna/v1alpha/user_feedback.rb +1 -1
- data/proto_docs/google/protobuf/any.rb +1 -1
- data/proto_docs/google/protobuf/duration.rb +1 -1
- data/proto_docs/google/protobuf/field_mask.rb +1 -1
- data/proto_docs/google/protobuf/timestamp.rb +8 -7
- data/proto_docs/google/rpc/status.rb +1 -1
- metadata +8 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ae6725b19074a40da890a18ca073bed6113b0a318c804e4ea4937cce25da0dac
|
|
4
|
+
data.tar.gz: 0faccbb6c7bf31e3dca1b11434488da0e1d35b1588ef6501827c5790851637b3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b79b724d9c58271ef465605c0638a4a7347ee18d4b7ed0204864d36fbf8ab91d8e773dfa9401dc786d7c6b0b315ced47d9e29b2887c06384c79eb7d7a113e30c
|
|
7
|
+
data.tar.gz: 337d8de87838009acabd6e9a952d9fe3a0a91297ddfc860500ee97518f01e43550553a5786dff406633e6acef2837196481b12189ea00d52ab01b70d8634cbce
|
data/.yardopts
CHANGED
data/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Ruby Client for the
|
|
1
|
+
# Ruby Client for the Data QnA V1ALPHA API
|
|
2
2
|
|
|
3
3
|
Data QnA is a natural language question and answer service for BigQuery data.
|
|
4
4
|
|
|
@@ -6,7 +6,7 @@ Data QnA is a natural language question and answer service for BigQuery data.
|
|
|
6
6
|
https://github.com/googleapis/google-cloud-ruby
|
|
7
7
|
|
|
8
8
|
This gem is a _versioned_ client. It provides basic client classes for a
|
|
9
|
-
specific version of the
|
|
9
|
+
specific version of the Data QnA V1ALPHA API. Most users should consider using
|
|
10
10
|
the main client gem,
|
|
11
11
|
[google-cloud-dataqna](https://rubygems.org/gems/google-cloud-dataqna).
|
|
12
12
|
See the section below titled *Which client should I use?* for more information.
|
|
@@ -0,0 +1,510 @@
|
|
|
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/dataqna/v1alpha/auto_suggestion_service_pb"
|
|
21
|
+
require "google/cloud/dataqna/v1alpha/auto_suggestion_service/rest/service_stub"
|
|
22
|
+
|
|
23
|
+
module Google
|
|
24
|
+
module Cloud
|
|
25
|
+
module DataQnA
|
|
26
|
+
module V1alpha
|
|
27
|
+
module AutoSuggestionService
|
|
28
|
+
module Rest
|
|
29
|
+
##
|
|
30
|
+
# REST client for the AutoSuggestionService service.
|
|
31
|
+
#
|
|
32
|
+
# This stateless API provides automatic suggestions for natural language
|
|
33
|
+
# queries for the data sources in the provided project and location.
|
|
34
|
+
#
|
|
35
|
+
# The service provides a resourceless operation `suggestQueries` that can be
|
|
36
|
+
# called to get a list of suggestions for a given incomplete query and scope
|
|
37
|
+
# (or list of scopes) under which the query is to be interpreted.
|
|
38
|
+
#
|
|
39
|
+
# There are two types of suggestions, ENTITY for single entity suggestions
|
|
40
|
+
# and TEMPLATE for full sentences. By default, both types are returned.
|
|
41
|
+
#
|
|
42
|
+
# Example Request:
|
|
43
|
+
# ```
|
|
44
|
+
# GetSuggestions({
|
|
45
|
+
# parent: "locations/us/projects/my-project"
|
|
46
|
+
# scopes:
|
|
47
|
+
# "//bigquery.googleapis.com/projects/my-project/datasets/my-dataset/tables/my-table"
|
|
48
|
+
# query: "top it"
|
|
49
|
+
# })
|
|
50
|
+
# ```
|
|
51
|
+
#
|
|
52
|
+
# The service will retrieve information based on the given scope(s) and give
|
|
53
|
+
# suggestions based on that (e.g. "top item" for "top it" if "item" is a known
|
|
54
|
+
# dimension for the provided scope).
|
|
55
|
+
# ```
|
|
56
|
+
# suggestions {
|
|
57
|
+
# suggestion_info {
|
|
58
|
+
# annotated_suggestion {
|
|
59
|
+
# text_formatted: "top item by sum of usd_revenue_net"
|
|
60
|
+
# markups {
|
|
61
|
+
# type: DIMENSION
|
|
62
|
+
# start_char_index: 4
|
|
63
|
+
# length: 4
|
|
64
|
+
# }
|
|
65
|
+
# markups {
|
|
66
|
+
# type: METRIC
|
|
67
|
+
# start_char_index: 19
|
|
68
|
+
# length: 15
|
|
69
|
+
# }
|
|
70
|
+
# }
|
|
71
|
+
# query_matches {
|
|
72
|
+
# start_char_index: 0
|
|
73
|
+
# length: 6
|
|
74
|
+
# }
|
|
75
|
+
# }
|
|
76
|
+
# suggestion_type: TEMPLATE
|
|
77
|
+
# ranking_score: 0.9
|
|
78
|
+
# }
|
|
79
|
+
# suggestions {
|
|
80
|
+
# suggestion_info {
|
|
81
|
+
# annotated_suggestion {
|
|
82
|
+
# text_formatted: "item"
|
|
83
|
+
# markups {
|
|
84
|
+
# type: DIMENSION
|
|
85
|
+
# start_char_index: 4
|
|
86
|
+
# length: 2
|
|
87
|
+
# }
|
|
88
|
+
# }
|
|
89
|
+
# query_matches {
|
|
90
|
+
# start_char_index: 0
|
|
91
|
+
# length: 6
|
|
92
|
+
# }
|
|
93
|
+
# }
|
|
94
|
+
# suggestion_type: ENTITY
|
|
95
|
+
# ranking_score: 0.8
|
|
96
|
+
# }
|
|
97
|
+
# ```
|
|
98
|
+
#
|
|
99
|
+
class Client
|
|
100
|
+
# @private
|
|
101
|
+
API_VERSION = ""
|
|
102
|
+
|
|
103
|
+
# @private
|
|
104
|
+
DEFAULT_ENDPOINT_TEMPLATE = "dataqna.$UNIVERSE_DOMAIN$"
|
|
105
|
+
|
|
106
|
+
include Paths
|
|
107
|
+
|
|
108
|
+
# @private
|
|
109
|
+
attr_reader :auto_suggestion_service_stub
|
|
110
|
+
|
|
111
|
+
##
|
|
112
|
+
# Configure the AutoSuggestionService Client class.
|
|
113
|
+
#
|
|
114
|
+
# See {::Google::Cloud::DataQnA::V1alpha::AutoSuggestionService::Rest::Client::Configuration}
|
|
115
|
+
# for a description of the configuration fields.
|
|
116
|
+
#
|
|
117
|
+
# @example
|
|
118
|
+
#
|
|
119
|
+
# # Modify the configuration for all AutoSuggestionService clients
|
|
120
|
+
# ::Google::Cloud::DataQnA::V1alpha::AutoSuggestionService::Rest::Client.configure do |config|
|
|
121
|
+
# config.timeout = 10.0
|
|
122
|
+
# end
|
|
123
|
+
#
|
|
124
|
+
# @yield [config] Configure the Client client.
|
|
125
|
+
# @yieldparam config [Client::Configuration]
|
|
126
|
+
#
|
|
127
|
+
# @return [Client::Configuration]
|
|
128
|
+
#
|
|
129
|
+
def self.configure
|
|
130
|
+
@configure ||= begin
|
|
131
|
+
namespace = ["Google", "Cloud", "DataQnA", "V1alpha"]
|
|
132
|
+
parent_config = while namespace.any?
|
|
133
|
+
parent_name = namespace.join "::"
|
|
134
|
+
parent_const = const_get parent_name
|
|
135
|
+
break parent_const.configure if parent_const.respond_to? :configure
|
|
136
|
+
namespace.pop
|
|
137
|
+
end
|
|
138
|
+
default_config = Client::Configuration.new parent_config
|
|
139
|
+
|
|
140
|
+
default_config.timeout = 2.0
|
|
141
|
+
|
|
142
|
+
default_config
|
|
143
|
+
end
|
|
144
|
+
yield @configure if block_given?
|
|
145
|
+
@configure
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
##
|
|
149
|
+
# Configure the AutoSuggestionService Client instance.
|
|
150
|
+
#
|
|
151
|
+
# The configuration is set to the derived mode, meaning that values can be changed,
|
|
152
|
+
# but structural changes (adding new fields, etc.) are not allowed. Structural changes
|
|
153
|
+
# should be made on {Client.configure}.
|
|
154
|
+
#
|
|
155
|
+
# See {::Google::Cloud::DataQnA::V1alpha::AutoSuggestionService::Rest::Client::Configuration}
|
|
156
|
+
# for a description of the configuration fields.
|
|
157
|
+
#
|
|
158
|
+
# @yield [config] Configure the Client client.
|
|
159
|
+
# @yieldparam config [Client::Configuration]
|
|
160
|
+
#
|
|
161
|
+
# @return [Client::Configuration]
|
|
162
|
+
#
|
|
163
|
+
def configure
|
|
164
|
+
yield @config if block_given?
|
|
165
|
+
@config
|
|
166
|
+
end
|
|
167
|
+
|
|
168
|
+
##
|
|
169
|
+
# The effective universe domain
|
|
170
|
+
#
|
|
171
|
+
# @return [String]
|
|
172
|
+
#
|
|
173
|
+
def universe_domain
|
|
174
|
+
@auto_suggestion_service_stub.universe_domain
|
|
175
|
+
end
|
|
176
|
+
|
|
177
|
+
##
|
|
178
|
+
# Create a new AutoSuggestionService REST client object.
|
|
179
|
+
#
|
|
180
|
+
# @example
|
|
181
|
+
#
|
|
182
|
+
# # Create a client using the default configuration
|
|
183
|
+
# client = ::Google::Cloud::DataQnA::V1alpha::AutoSuggestionService::Rest::Client.new
|
|
184
|
+
#
|
|
185
|
+
# # Create a client using a custom configuration
|
|
186
|
+
# client = ::Google::Cloud::DataQnA::V1alpha::AutoSuggestionService::Rest::Client.new do |config|
|
|
187
|
+
# config.timeout = 10.0
|
|
188
|
+
# end
|
|
189
|
+
#
|
|
190
|
+
# @yield [config] Configure the AutoSuggestionService client.
|
|
191
|
+
# @yieldparam config [Client::Configuration]
|
|
192
|
+
#
|
|
193
|
+
def initialize
|
|
194
|
+
# Create the configuration object
|
|
195
|
+
@config = Configuration.new Client.configure
|
|
196
|
+
|
|
197
|
+
# Yield the configuration if needed
|
|
198
|
+
yield @config if block_given?
|
|
199
|
+
|
|
200
|
+
# Create credentials
|
|
201
|
+
credentials = @config.credentials
|
|
202
|
+
# Use self-signed JWT if the endpoint is unchanged from default,
|
|
203
|
+
# but only if the default endpoint does not have a region prefix.
|
|
204
|
+
enable_self_signed_jwt = @config.endpoint.nil? ||
|
|
205
|
+
(@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
|
|
206
|
+
!@config.endpoint.split(".").first.include?("-"))
|
|
207
|
+
credentials ||= Credentials.default scope: @config.scope,
|
|
208
|
+
enable_self_signed_jwt: enable_self_signed_jwt
|
|
209
|
+
if credentials.is_a?(::String) || credentials.is_a?(::Hash)
|
|
210
|
+
credentials = Credentials.new credentials, scope: @config.scope
|
|
211
|
+
end
|
|
212
|
+
|
|
213
|
+
@quota_project_id = @config.quota_project
|
|
214
|
+
@quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
|
|
215
|
+
|
|
216
|
+
@auto_suggestion_service_stub = ::Google::Cloud::DataQnA::V1alpha::AutoSuggestionService::Rest::ServiceStub.new(
|
|
217
|
+
endpoint: @config.endpoint,
|
|
218
|
+
endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
|
|
219
|
+
universe_domain: @config.universe_domain,
|
|
220
|
+
credentials: credentials,
|
|
221
|
+
logger: @config.logger
|
|
222
|
+
)
|
|
223
|
+
|
|
224
|
+
@auto_suggestion_service_stub.logger(stub: true)&.info do |entry|
|
|
225
|
+
entry.set_system_name
|
|
226
|
+
entry.set_service
|
|
227
|
+
entry.message = "Created client for #{entry.service}"
|
|
228
|
+
entry.set_credentials_fields credentials
|
|
229
|
+
entry.set "customEndpoint", @config.endpoint if @config.endpoint
|
|
230
|
+
entry.set "defaultTimeout", @config.timeout if @config.timeout
|
|
231
|
+
entry.set "quotaProject", @quota_project_id if @quota_project_id
|
|
232
|
+
end
|
|
233
|
+
end
|
|
234
|
+
|
|
235
|
+
##
|
|
236
|
+
# The logger used for request/response debug logging.
|
|
237
|
+
#
|
|
238
|
+
# @return [Logger]
|
|
239
|
+
#
|
|
240
|
+
def logger
|
|
241
|
+
@auto_suggestion_service_stub.logger
|
|
242
|
+
end
|
|
243
|
+
|
|
244
|
+
# Service calls
|
|
245
|
+
|
|
246
|
+
##
|
|
247
|
+
# Gets a list of suggestions based on a prefix string.
|
|
248
|
+
# AutoSuggestion tolerance should be less than 1 second.
|
|
249
|
+
#
|
|
250
|
+
# @overload suggest_queries(request, options = nil)
|
|
251
|
+
# Pass arguments to `suggest_queries` via a request object, either of type
|
|
252
|
+
# {::Google::Cloud::DataQnA::V1alpha::SuggestQueriesRequest} or an equivalent Hash.
|
|
253
|
+
#
|
|
254
|
+
# @param request [::Google::Cloud::DataQnA::V1alpha::SuggestQueriesRequest, ::Hash]
|
|
255
|
+
# A request object representing the call parameters. Required. To specify no
|
|
256
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
|
257
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
|
258
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
|
259
|
+
#
|
|
260
|
+
# @overload suggest_queries(parent: nil, scopes: nil, query: nil, suggestion_types: nil)
|
|
261
|
+
# Pass arguments to `suggest_queries` via keyword arguments. Note that at
|
|
262
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
|
263
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
|
264
|
+
#
|
|
265
|
+
# @param parent [::String]
|
|
266
|
+
# Required. The parent of the suggestion query is the resource denoting the project and
|
|
267
|
+
# location.
|
|
268
|
+
# @param scopes [::Array<::String>]
|
|
269
|
+
# The scopes to which this search is restricted. The only supported scope
|
|
270
|
+
# pattern is
|
|
271
|
+
# `//bigquery.googleapis.com/projects/{GCP-PROJECT-ID}/datasets/{DATASET-ID}/tables/{TABLE-ID}`.
|
|
272
|
+
# @param query [::String]
|
|
273
|
+
# User query for which to generate suggestions. If the query is empty, zero
|
|
274
|
+
# state suggestions are returned. This allows UIs to display suggestions
|
|
275
|
+
# right away, helping the user to get a sense of what a query might look
|
|
276
|
+
# like.
|
|
277
|
+
# @param suggestion_types [::Array<::Google::Cloud::DataQnA::V1alpha::SuggestionType>]
|
|
278
|
+
# The requested suggestion type. Multiple suggestion types can be
|
|
279
|
+
# requested, but there is no guarantee that the service will return
|
|
280
|
+
# suggestions for each type. Suggestions for a requested type might rank
|
|
281
|
+
# lower than suggestions for other types and the service may decide to cut
|
|
282
|
+
# these suggestions off.
|
|
283
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
|
284
|
+
# @yieldparam result [::Google::Cloud::DataQnA::V1alpha::SuggestQueriesResponse]
|
|
285
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
|
286
|
+
#
|
|
287
|
+
# @return [::Google::Cloud::DataQnA::V1alpha::SuggestQueriesResponse]
|
|
288
|
+
#
|
|
289
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
|
290
|
+
#
|
|
291
|
+
# @example Basic example
|
|
292
|
+
# require "google/cloud/dataqna/v1alpha"
|
|
293
|
+
#
|
|
294
|
+
# # Create a client object. The client can be reused for multiple calls.
|
|
295
|
+
# client = Google::Cloud::DataQnA::V1alpha::AutoSuggestionService::Rest::Client.new
|
|
296
|
+
#
|
|
297
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
|
298
|
+
# request = Google::Cloud::DataQnA::V1alpha::SuggestQueriesRequest.new
|
|
299
|
+
#
|
|
300
|
+
# # Call the suggest_queries method.
|
|
301
|
+
# result = client.suggest_queries request
|
|
302
|
+
#
|
|
303
|
+
# # The returned object is of type Google::Cloud::DataQnA::V1alpha::SuggestQueriesResponse.
|
|
304
|
+
# p result
|
|
305
|
+
#
|
|
306
|
+
def suggest_queries request, options = nil
|
|
307
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
|
308
|
+
|
|
309
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DataQnA::V1alpha::SuggestQueriesRequest
|
|
310
|
+
|
|
311
|
+
# Converts hash and nil to an options object
|
|
312
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
|
313
|
+
|
|
314
|
+
# Customize the options with defaults
|
|
315
|
+
call_metadata = @config.rpcs.suggest_queries.metadata.to_h
|
|
316
|
+
|
|
317
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
|
318
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
|
319
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
|
320
|
+
gapic_version: ::Google::Cloud::DataQnA::V1alpha::VERSION,
|
|
321
|
+
transports_version_send: [:rest]
|
|
322
|
+
|
|
323
|
+
call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
|
324
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
|
325
|
+
|
|
326
|
+
options.apply_defaults timeout: @config.rpcs.suggest_queries.timeout,
|
|
327
|
+
metadata: call_metadata,
|
|
328
|
+
retry_policy: @config.rpcs.suggest_queries.retry_policy
|
|
329
|
+
|
|
330
|
+
options.apply_defaults timeout: @config.timeout,
|
|
331
|
+
metadata: @config.metadata,
|
|
332
|
+
retry_policy: @config.retry_policy
|
|
333
|
+
|
|
334
|
+
@auto_suggestion_service_stub.suggest_queries request, options do |result, operation|
|
|
335
|
+
yield result, operation if block_given?
|
|
336
|
+
end
|
|
337
|
+
rescue ::Gapic::Rest::Error => e
|
|
338
|
+
raise ::Google::Cloud::Error.from_error(e)
|
|
339
|
+
end
|
|
340
|
+
|
|
341
|
+
##
|
|
342
|
+
# Configuration class for the AutoSuggestionService REST API.
|
|
343
|
+
#
|
|
344
|
+
# This class represents the configuration for AutoSuggestionService REST,
|
|
345
|
+
# providing control over timeouts, retry behavior, logging, transport
|
|
346
|
+
# parameters, and other low-level controls. Certain parameters can also be
|
|
347
|
+
# applied individually to specific RPCs. See
|
|
348
|
+
# {::Google::Cloud::DataQnA::V1alpha::AutoSuggestionService::Rest::Client::Configuration::Rpcs}
|
|
349
|
+
# for a list of RPCs that can be configured independently.
|
|
350
|
+
#
|
|
351
|
+
# Configuration can be applied globally to all clients, or to a single client
|
|
352
|
+
# on construction.
|
|
353
|
+
#
|
|
354
|
+
# @example
|
|
355
|
+
#
|
|
356
|
+
# # Modify the global config, setting the timeout for
|
|
357
|
+
# # suggest_queries to 20 seconds,
|
|
358
|
+
# # and all remaining timeouts to 10 seconds.
|
|
359
|
+
# ::Google::Cloud::DataQnA::V1alpha::AutoSuggestionService::Rest::Client.configure do |config|
|
|
360
|
+
# config.timeout = 10.0
|
|
361
|
+
# config.rpcs.suggest_queries.timeout = 20.0
|
|
362
|
+
# end
|
|
363
|
+
#
|
|
364
|
+
# # Apply the above configuration only to a new client.
|
|
365
|
+
# client = ::Google::Cloud::DataQnA::V1alpha::AutoSuggestionService::Rest::Client.new do |config|
|
|
366
|
+
# config.timeout = 10.0
|
|
367
|
+
# config.rpcs.suggest_queries.timeout = 20.0
|
|
368
|
+
# end
|
|
369
|
+
#
|
|
370
|
+
# @!attribute [rw] endpoint
|
|
371
|
+
# A custom service endpoint, as a hostname or hostname:port. The default is
|
|
372
|
+
# nil, indicating to use the default endpoint in the current universe domain.
|
|
373
|
+
# @return [::String,nil]
|
|
374
|
+
# @!attribute [rw] credentials
|
|
375
|
+
# Credentials to send with calls. You may provide any of the following types:
|
|
376
|
+
# * (`String`) The path to a service account key file in JSON format
|
|
377
|
+
# * (`Hash`) A service account key as a Hash
|
|
378
|
+
# * (`Google::Auth::Credentials`) A googleauth credentials object
|
|
379
|
+
# (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
|
|
380
|
+
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
|
381
|
+
# (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
|
|
382
|
+
# * (`nil`) indicating no credentials
|
|
383
|
+
#
|
|
384
|
+
# Warning: If you accept a credential configuration (JSON file or Hash) from an
|
|
385
|
+
# external source for authentication to Google Cloud, you must validate it before
|
|
386
|
+
# providing it to a Google API client library. Providing an unvalidated credential
|
|
387
|
+
# configuration to Google APIs can compromise the security of your systems and data.
|
|
388
|
+
# For more information, refer to [Validate credential configurations from external
|
|
389
|
+
# sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
|
|
390
|
+
# @return [::Object]
|
|
391
|
+
# @!attribute [rw] scope
|
|
392
|
+
# The OAuth scopes
|
|
393
|
+
# @return [::Array<::String>]
|
|
394
|
+
# @!attribute [rw] lib_name
|
|
395
|
+
# The library name as recorded in instrumentation and logging
|
|
396
|
+
# @return [::String]
|
|
397
|
+
# @!attribute [rw] lib_version
|
|
398
|
+
# The library version as recorded in instrumentation and logging
|
|
399
|
+
# @return [::String]
|
|
400
|
+
# @!attribute [rw] timeout
|
|
401
|
+
# The call timeout in seconds.
|
|
402
|
+
# @return [::Numeric]
|
|
403
|
+
# @!attribute [rw] metadata
|
|
404
|
+
# Additional headers to be sent with the call.
|
|
405
|
+
# @return [::Hash{::Symbol=>::String}]
|
|
406
|
+
# @!attribute [rw] retry_policy
|
|
407
|
+
# The retry policy. The value is a hash with the following keys:
|
|
408
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
|
409
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
|
410
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
|
411
|
+
# * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0.
|
|
412
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
|
413
|
+
# trigger a retry.
|
|
414
|
+
# @return [::Hash]
|
|
415
|
+
# @!attribute [rw] quota_project
|
|
416
|
+
# A separate project against which to charge quota.
|
|
417
|
+
# @return [::String]
|
|
418
|
+
# @!attribute [rw] universe_domain
|
|
419
|
+
# The universe domain within which to make requests. This determines the
|
|
420
|
+
# default endpoint URL. The default value of nil uses the environment
|
|
421
|
+
# universe (usually the default "googleapis.com" universe).
|
|
422
|
+
# @return [::String,nil]
|
|
423
|
+
# @!attribute [rw] logger
|
|
424
|
+
# A custom logger to use for request/response debug logging, or the value
|
|
425
|
+
# `:default` (the default) to construct a default logger, or `nil` to
|
|
426
|
+
# explicitly disable logging.
|
|
427
|
+
# @return [::Logger,:default,nil]
|
|
428
|
+
#
|
|
429
|
+
class Configuration
|
|
430
|
+
extend ::Gapic::Config
|
|
431
|
+
|
|
432
|
+
# @private
|
|
433
|
+
# The endpoint specific to the default "googleapis.com" universe. Deprecated.
|
|
434
|
+
DEFAULT_ENDPOINT = "dataqna.googleapis.com"
|
|
435
|
+
|
|
436
|
+
config_attr :endpoint, nil, ::String, nil
|
|
437
|
+
config_attr :credentials, nil do |value|
|
|
438
|
+
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil]
|
|
439
|
+
allowed.any? { |klass| klass === value }
|
|
440
|
+
end
|
|
441
|
+
config_attr :scope, nil, ::String, ::Array, nil
|
|
442
|
+
config_attr :lib_name, nil, ::String, nil
|
|
443
|
+
config_attr :lib_version, nil, ::String, nil
|
|
444
|
+
config_attr :timeout, nil, ::Numeric, nil
|
|
445
|
+
config_attr :metadata, nil, ::Hash, nil
|
|
446
|
+
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
|
447
|
+
config_attr :quota_project, nil, ::String, nil
|
|
448
|
+
config_attr :universe_domain, nil, ::String, nil
|
|
449
|
+
config_attr :logger, :default, ::Logger, nil, :default
|
|
450
|
+
|
|
451
|
+
# @private
|
|
452
|
+
def initialize parent_config = nil
|
|
453
|
+
@parent_config = parent_config unless parent_config.nil?
|
|
454
|
+
|
|
455
|
+
yield self if block_given?
|
|
456
|
+
end
|
|
457
|
+
|
|
458
|
+
##
|
|
459
|
+
# Configurations for individual RPCs
|
|
460
|
+
# @return [Rpcs]
|
|
461
|
+
#
|
|
462
|
+
def rpcs
|
|
463
|
+
@rpcs ||= begin
|
|
464
|
+
parent_rpcs = nil
|
|
465
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
|
|
466
|
+
Rpcs.new parent_rpcs
|
|
467
|
+
end
|
|
468
|
+
end
|
|
469
|
+
|
|
470
|
+
##
|
|
471
|
+
# Configuration RPC class for the AutoSuggestionService API.
|
|
472
|
+
#
|
|
473
|
+
# Includes fields providing the configuration for each RPC in this service.
|
|
474
|
+
# Each configuration object is of type `Gapic::Config::Method` and includes
|
|
475
|
+
# the following configuration fields:
|
|
476
|
+
#
|
|
477
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in seconds
|
|
478
|
+
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
|
|
479
|
+
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
|
480
|
+
# include the following keys:
|
|
481
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
|
482
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
|
483
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
|
484
|
+
# * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0.
|
|
485
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
|
486
|
+
# trigger a retry.
|
|
487
|
+
#
|
|
488
|
+
class Rpcs
|
|
489
|
+
##
|
|
490
|
+
# RPC-specific configuration for `suggest_queries`
|
|
491
|
+
# @return [::Gapic::Config::Method]
|
|
492
|
+
#
|
|
493
|
+
attr_reader :suggest_queries
|
|
494
|
+
|
|
495
|
+
# @private
|
|
496
|
+
def initialize parent_rpcs = nil
|
|
497
|
+
suggest_queries_config = parent_rpcs.suggest_queries if parent_rpcs.respond_to? :suggest_queries
|
|
498
|
+
@suggest_queries = ::Gapic::Config::Method.new suggest_queries_config
|
|
499
|
+
|
|
500
|
+
yield self if block_given?
|
|
501
|
+
end
|
|
502
|
+
end
|
|
503
|
+
end
|
|
504
|
+
end
|
|
505
|
+
end
|
|
506
|
+
end
|
|
507
|
+
end
|
|
508
|
+
end
|
|
509
|
+
end
|
|
510
|
+
end
|