google-cloud-discovery_engine-v1 0.7.0 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/google/cloud/discovery_engine/v1/completion_service/client.rb +9 -3
- data/lib/google/cloud/discovery_engine/v1/completion_service/operations.rb +13 -5
- data/lib/google/cloud/discovery_engine/v1/completion_service/rest/client.rb +9 -3
- data/lib/google/cloud/discovery_engine/v1/completion_service/rest/operations.rb +28 -5
- data/lib/google/cloud/discovery_engine/v1/control_service/client.rb +875 -0
- data/lib/google/cloud/discovery_engine/v1/control_service/credentials.rb +47 -0
- data/lib/google/cloud/discovery_engine/v1/control_service/paths.rb +167 -0
- data/lib/google/cloud/discovery_engine/v1/control_service/rest/client.rb +814 -0
- data/lib/google/cloud/discovery_engine/v1/control_service/rest/service_stub.rb +440 -0
- data/lib/google/cloud/discovery_engine/v1/control_service/rest.rb +55 -0
- data/lib/google/cloud/discovery_engine/v1/control_service.rb +58 -0
- data/lib/google/cloud/discovery_engine/v1/conversational_search_service/client.rb +764 -6
- data/lib/google/cloud/discovery_engine/v1/conversational_search_service/paths.rb +199 -0
- data/lib/google/cloud/discovery_engine/v1/conversational_search_service/rest/client.rb +715 -6
- data/lib/google/cloud/discovery_engine/v1/conversational_search_service/rest/service_stub.rb +520 -0
- data/lib/google/cloud/discovery_engine/v1/data_store_service/client.rb +15 -7
- data/lib/google/cloud/discovery_engine/v1/data_store_service/operations.rb +13 -5
- data/lib/google/cloud/discovery_engine/v1/data_store_service/paths.rb +45 -0
- data/lib/google/cloud/discovery_engine/v1/data_store_service/rest/client.rb +15 -7
- data/lib/google/cloud/discovery_engine/v1/data_store_service/rest/operations.rb +28 -5
- data/lib/google/cloud/discovery_engine/v1/document_service/client.rb +23 -13
- data/lib/google/cloud/discovery_engine/v1/document_service/operations.rb +13 -5
- data/lib/google/cloud/discovery_engine/v1/document_service/rest/client.rb +23 -13
- data/lib/google/cloud/discovery_engine/v1/document_service/rest/operations.rb +28 -5
- data/lib/google/cloud/discovery_engine/v1/engine_service/client.rb +13 -5
- data/lib/google/cloud/discovery_engine/v1/engine_service/operations.rb +13 -5
- data/lib/google/cloud/discovery_engine/v1/engine_service/rest/client.rb +13 -5
- data/lib/google/cloud/discovery_engine/v1/engine_service/rest/operations.rb +28 -5
- data/lib/google/cloud/discovery_engine/v1/grounded_generation_service/client.rb +471 -0
- data/lib/google/cloud/discovery_engine/v1/grounded_generation_service/credentials.rb +47 -0
- data/lib/google/cloud/discovery_engine/v1/grounded_generation_service/paths.rb +52 -0
- data/lib/google/cloud/discovery_engine/v1/grounded_generation_service/rest/client.rb +438 -0
- data/lib/google/cloud/discovery_engine/v1/grounded_generation_service/rest/service_stub.rb +129 -0
- data/lib/google/cloud/discovery_engine/v1/grounded_generation_service/rest.rb +52 -0
- data/lib/google/cloud/discovery_engine/v1/grounded_generation_service.rb +55 -0
- data/lib/google/cloud/discovery_engine/v1/project_service/client.rb +485 -0
- data/lib/google/cloud/discovery_engine/v1/project_service/credentials.rb +47 -0
- data/lib/google/cloud/discovery_engine/v1/project_service/operations.rb +809 -0
- data/lib/google/cloud/discovery_engine/v1/project_service/paths.rb +47 -0
- data/lib/google/cloud/discovery_engine/v1/project_service/rest/client.rb +452 -0
- data/lib/google/cloud/discovery_engine/v1/project_service/rest/operations.rb +1114 -0
- data/lib/google/cloud/discovery_engine/v1/project_service/rest/service_stub.rb +129 -0
- data/lib/google/cloud/discovery_engine/v1/project_service/rest.rb +54 -0
- data/lib/google/cloud/discovery_engine/v1/project_service.rb +57 -0
- data/lib/google/cloud/discovery_engine/v1/rank_service/client.rb +481 -0
- data/lib/google/cloud/discovery_engine/v1/rank_service/credentials.rb +47 -0
- data/lib/google/cloud/discovery_engine/v1/rank_service/paths.rb +52 -0
- data/lib/google/cloud/discovery_engine/v1/rank_service/rest/client.rb +448 -0
- data/lib/google/cloud/discovery_engine/v1/rank_service/rest/service_stub.rb +129 -0
- data/lib/google/cloud/discovery_engine/v1/rank_service/rest.rb +52 -0
- data/lib/google/cloud/discovery_engine/v1/rank_service.rb +55 -0
- data/lib/google/cloud/discovery_engine/v1/recommendation_service/client.rb +24 -19
- data/lib/google/cloud/discovery_engine/v1/recommendation_service/paths.rb +66 -0
- data/lib/google/cloud/discovery_engine/v1/recommendation_service/rest/client.rb +24 -19
- data/lib/google/cloud/discovery_engine/v1/rest.rb +4 -0
- data/lib/google/cloud/discovery_engine/v1/schema_service/client.rb +18 -10
- data/lib/google/cloud/discovery_engine/v1/schema_service/operations.rb +13 -5
- data/lib/google/cloud/discovery_engine/v1/schema_service/rest/client.rb +18 -10
- data/lib/google/cloud/discovery_engine/v1/schema_service/rest/operations.rb +28 -5
- data/lib/google/cloud/discovery_engine/v1/search_service/client.rb +15 -8
- data/lib/google/cloud/discovery_engine/v1/search_service/rest/client.rb +15 -8
- data/lib/google/cloud/discovery_engine/v1/site_search_engine_service/client.rb +27 -12
- data/lib/google/cloud/discovery_engine/v1/site_search_engine_service/operations.rb +13 -5
- data/lib/google/cloud/discovery_engine/v1/site_search_engine_service/rest/client.rb +27 -12
- data/lib/google/cloud/discovery_engine/v1/site_search_engine_service/rest/operations.rb +28 -5
- data/lib/google/cloud/discovery_engine/v1/user_event_service/client.rb +23 -6
- data/lib/google/cloud/discovery_engine/v1/user_event_service/operations.rb +13 -5
- data/lib/google/cloud/discovery_engine/v1/user_event_service/paths.rb +21 -0
- data/lib/google/cloud/discovery_engine/v1/user_event_service/rest/client.rb +23 -6
- data/lib/google/cloud/discovery_engine/v1/user_event_service/rest/operations.rb +28 -5
- data/lib/google/cloud/discovery_engine/v1/user_event_service/rest/service_stub.rb +8 -0
- data/lib/google/cloud/discovery_engine/v1/version.rb +1 -1
- data/lib/google/cloud/discovery_engine/v1.rb +4 -0
- data/lib/google/cloud/discoveryengine/v1/answer_pb.rb +69 -0
- data/lib/google/cloud/discoveryengine/v1/common_pb.rb +2 -1
- data/lib/google/cloud/discoveryengine/v1/control_pb.rb +55 -0
- data/lib/google/cloud/discoveryengine/v1/control_service_pb.rb +57 -0
- data/lib/google/cloud/discoveryengine/v1/control_service_services_pb.rb +69 -0
- data/lib/google/cloud/discoveryengine/v1/conversational_search_service_pb.rb +32 -1
- data/lib/google/cloud/discoveryengine/v1/conversational_search_service_services_pb.rb +25 -0
- data/lib/google/cloud/discoveryengine/v1/data_store_pb.rb +3 -1
- data/lib/google/cloud/discoveryengine/v1/document_processing_config_pb.rb +48 -0
- data/lib/google/cloud/discoveryengine/v1/document_service_services_pb.rb +1 -1
- data/lib/google/cloud/discoveryengine/v1/engine_pb.rb +1 -1
- data/lib/google/cloud/discoveryengine/v1/grounded_generation_service_pb.rb +52 -0
- data/lib/google/cloud/discoveryengine/v1/grounded_generation_service_services_pb.rb +45 -0
- data/lib/google/cloud/discoveryengine/v1/grounding_pb.rb +46 -0
- data/lib/google/cloud/discoveryengine/v1/project_pb.rb +49 -0
- data/lib/google/cloud/discoveryengine/v1/project_service_pb.rb +50 -0
- data/lib/google/cloud/discoveryengine/v1/project_service_services_pb.rb +51 -0
- data/lib/google/cloud/discoveryengine/v1/rank_service_pb.rb +49 -0
- data/lib/google/cloud/discoveryengine/v1/rank_service_services_pb.rb +45 -0
- data/lib/google/cloud/discoveryengine/v1/session_pb.rb +50 -0
- data/lib/google/cloud/discoveryengine/v1/site_search_engine_pb.rb +1 -1
- data/lib/google/cloud/discoveryengine/v1/user_event_pb.rb +1 -1
- data/lib/google/cloud/discoveryengine/v1/user_event_service_pb.rb +1 -1
- data/lib/google/cloud/discoveryengine/v1/user_event_service_services_pb.rb +1 -1
- data/proto_docs/google/cloud/discoveryengine/v1/answer.rb +362 -0
- data/proto_docs/google/cloud/discoveryengine/v1/common.rb +16 -0
- data/proto_docs/google/cloud/discoveryengine/v1/control.rb +207 -0
- data/proto_docs/google/cloud/discoveryengine/v1/control_service.rb +126 -0
- data/proto_docs/google/cloud/discoveryengine/v1/conversation.rb +2 -2
- data/proto_docs/google/cloud/discoveryengine/v1/conversational_search_service.rb +485 -0
- data/proto_docs/google/cloud/discoveryengine/v1/data_store.rb +3 -0
- data/proto_docs/google/cloud/discoveryengine/v1/data_store_service.rb +2 -2
- data/proto_docs/google/cloud/discoveryengine/v1/document_processing_config.rb +102 -0
- data/proto_docs/google/cloud/discoveryengine/v1/document_service.rb +5 -5
- data/proto_docs/google/cloud/discoveryengine/v1/engine.rb +3 -3
- data/proto_docs/google/cloud/discoveryengine/v1/grounded_generation_service.rb +144 -0
- data/proto_docs/google/cloud/discoveryengine/v1/grounding.rb +79 -0
- data/proto_docs/google/cloud/discoveryengine/v1/import_config.rb +4 -4
- data/proto_docs/google/cloud/discoveryengine/v1/project.rb +106 -0
- data/proto_docs/google/cloud/discoveryengine/v1/project_service.rb +57 -0
- data/proto_docs/google/cloud/discoveryengine/v1/rank_service.rb +124 -0
- data/proto_docs/google/cloud/discoveryengine/v1/recommendation_service.rb +20 -19
- data/proto_docs/google/cloud/discoveryengine/v1/schema_service.rb +5 -5
- data/proto_docs/google/cloud/discoveryengine/v1/search_service.rb +23 -18
- data/proto_docs/google/cloud/discoveryengine/v1/session.rb +88 -0
- data/proto_docs/google/cloud/discoveryengine/v1/site_search_engine.rb +3 -0
- data/proto_docs/google/cloud/discoveryengine/v1/user_event.rb +24 -3
- data/proto_docs/google/cloud/discoveryengine/v1/user_event_service.rb +13 -1
- metadata +56 -2
@@ -0,0 +1,875 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2024 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/discoveryengine/v1/control_service_pb"
|
21
|
+
require "google/cloud/location"
|
22
|
+
|
23
|
+
module Google
|
24
|
+
module Cloud
|
25
|
+
module DiscoveryEngine
|
26
|
+
module V1
|
27
|
+
module ControlService
|
28
|
+
##
|
29
|
+
# Client for the ControlService service.
|
30
|
+
#
|
31
|
+
# Service for performing CRUD operations on Controls.
|
32
|
+
# Controls allow for custom logic to be implemented in the serving path.
|
33
|
+
# Controls need to be attached to a Serving Config to be considered during a
|
34
|
+
# request.
|
35
|
+
#
|
36
|
+
class Client
|
37
|
+
# @private
|
38
|
+
API_VERSION = ""
|
39
|
+
|
40
|
+
# @private
|
41
|
+
DEFAULT_ENDPOINT_TEMPLATE = "discoveryengine.$UNIVERSE_DOMAIN$"
|
42
|
+
|
43
|
+
include Paths
|
44
|
+
|
45
|
+
# @private
|
46
|
+
attr_reader :control_service_stub
|
47
|
+
|
48
|
+
##
|
49
|
+
# Configure the ControlService Client class.
|
50
|
+
#
|
51
|
+
# See {::Google::Cloud::DiscoveryEngine::V1::ControlService::Client::Configuration}
|
52
|
+
# for a description of the configuration fields.
|
53
|
+
#
|
54
|
+
# @example
|
55
|
+
#
|
56
|
+
# # Modify the configuration for all ControlService clients
|
57
|
+
# ::Google::Cloud::DiscoveryEngine::V1::ControlService::Client.configure do |config|
|
58
|
+
# config.timeout = 10.0
|
59
|
+
# end
|
60
|
+
#
|
61
|
+
# @yield [config] Configure the Client client.
|
62
|
+
# @yieldparam config [Client::Configuration]
|
63
|
+
#
|
64
|
+
# @return [Client::Configuration]
|
65
|
+
#
|
66
|
+
def self.configure
|
67
|
+
@configure ||= begin
|
68
|
+
namespace = ["Google", "Cloud", "DiscoveryEngine", "V1"]
|
69
|
+
parent_config = while namespace.any?
|
70
|
+
parent_name = namespace.join "::"
|
71
|
+
parent_const = const_get parent_name
|
72
|
+
break parent_const.configure if parent_const.respond_to? :configure
|
73
|
+
namespace.pop
|
74
|
+
end
|
75
|
+
default_config = Client::Configuration.new parent_config
|
76
|
+
|
77
|
+
default_config.timeout = 30.0
|
78
|
+
default_config.retry_policy = {
|
79
|
+
initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
|
80
|
+
}
|
81
|
+
|
82
|
+
default_config
|
83
|
+
end
|
84
|
+
yield @configure if block_given?
|
85
|
+
@configure
|
86
|
+
end
|
87
|
+
|
88
|
+
##
|
89
|
+
# Configure the ControlService Client instance.
|
90
|
+
#
|
91
|
+
# The configuration is set to the derived mode, meaning that values can be changed,
|
92
|
+
# but structural changes (adding new fields, etc.) are not allowed. Structural changes
|
93
|
+
# should be made on {Client.configure}.
|
94
|
+
#
|
95
|
+
# See {::Google::Cloud::DiscoveryEngine::V1::ControlService::Client::Configuration}
|
96
|
+
# for a description of the configuration fields.
|
97
|
+
#
|
98
|
+
# @yield [config] Configure the Client client.
|
99
|
+
# @yieldparam config [Client::Configuration]
|
100
|
+
#
|
101
|
+
# @return [Client::Configuration]
|
102
|
+
#
|
103
|
+
def configure
|
104
|
+
yield @config if block_given?
|
105
|
+
@config
|
106
|
+
end
|
107
|
+
|
108
|
+
##
|
109
|
+
# The effective universe domain
|
110
|
+
#
|
111
|
+
# @return [String]
|
112
|
+
#
|
113
|
+
def universe_domain
|
114
|
+
@control_service_stub.universe_domain
|
115
|
+
end
|
116
|
+
|
117
|
+
##
|
118
|
+
# Create a new ControlService client object.
|
119
|
+
#
|
120
|
+
# @example
|
121
|
+
#
|
122
|
+
# # Create a client using the default configuration
|
123
|
+
# client = ::Google::Cloud::DiscoveryEngine::V1::ControlService::Client.new
|
124
|
+
#
|
125
|
+
# # Create a client using a custom configuration
|
126
|
+
# client = ::Google::Cloud::DiscoveryEngine::V1::ControlService::Client.new do |config|
|
127
|
+
# config.timeout = 10.0
|
128
|
+
# end
|
129
|
+
#
|
130
|
+
# @yield [config] Configure the ControlService client.
|
131
|
+
# @yieldparam config [Client::Configuration]
|
132
|
+
#
|
133
|
+
def initialize
|
134
|
+
# These require statements are intentionally placed here to initialize
|
135
|
+
# the gRPC module only when it's required.
|
136
|
+
# See https://github.com/googleapis/toolkit/issues/446
|
137
|
+
require "gapic/grpc"
|
138
|
+
require "google/cloud/discoveryengine/v1/control_service_services_pb"
|
139
|
+
|
140
|
+
# Create the configuration object
|
141
|
+
@config = Configuration.new Client.configure
|
142
|
+
|
143
|
+
# Yield the configuration if needed
|
144
|
+
yield @config if block_given?
|
145
|
+
|
146
|
+
# Create credentials
|
147
|
+
credentials = @config.credentials
|
148
|
+
# Use self-signed JWT if the endpoint is unchanged from default,
|
149
|
+
# but only if the default endpoint does not have a region prefix.
|
150
|
+
enable_self_signed_jwt = @config.endpoint.nil? ||
|
151
|
+
(@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
|
152
|
+
!@config.endpoint.split(".").first.include?("-"))
|
153
|
+
credentials ||= Credentials.default scope: @config.scope,
|
154
|
+
enable_self_signed_jwt: enable_self_signed_jwt
|
155
|
+
if credentials.is_a?(::String) || credentials.is_a?(::Hash)
|
156
|
+
credentials = Credentials.new credentials, scope: @config.scope
|
157
|
+
end
|
158
|
+
@quota_project_id = @config.quota_project
|
159
|
+
@quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
|
160
|
+
|
161
|
+
@control_service_stub = ::Gapic::ServiceStub.new(
|
162
|
+
::Google::Cloud::DiscoveryEngine::V1::ControlService::Stub,
|
163
|
+
credentials: credentials,
|
164
|
+
endpoint: @config.endpoint,
|
165
|
+
endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
|
166
|
+
universe_domain: @config.universe_domain,
|
167
|
+
channel_args: @config.channel_args,
|
168
|
+
interceptors: @config.interceptors,
|
169
|
+
channel_pool_config: @config.channel_pool
|
170
|
+
)
|
171
|
+
|
172
|
+
@location_client = Google::Cloud::Location::Locations::Client.new do |config|
|
173
|
+
config.credentials = credentials
|
174
|
+
config.quota_project = @quota_project_id
|
175
|
+
config.endpoint = @control_service_stub.endpoint
|
176
|
+
config.universe_domain = @control_service_stub.universe_domain
|
177
|
+
end
|
178
|
+
end
|
179
|
+
|
180
|
+
##
|
181
|
+
# Get the associated client for mix-in of the Locations.
|
182
|
+
#
|
183
|
+
# @return [Google::Cloud::Location::Locations::Client]
|
184
|
+
#
|
185
|
+
attr_reader :location_client
|
186
|
+
|
187
|
+
# Service calls
|
188
|
+
|
189
|
+
##
|
190
|
+
# Creates a Control.
|
191
|
+
#
|
192
|
+
# By default 1000 controls are allowed for a data store.
|
193
|
+
# A request can be submitted to adjust this limit.
|
194
|
+
# If the {::Google::Cloud::DiscoveryEngine::V1::Control Control} to create already
|
195
|
+
# exists, an ALREADY_EXISTS error is returned.
|
196
|
+
#
|
197
|
+
# @overload create_control(request, options = nil)
|
198
|
+
# Pass arguments to `create_control` via a request object, either of type
|
199
|
+
# {::Google::Cloud::DiscoveryEngine::V1::CreateControlRequest} or an equivalent Hash.
|
200
|
+
#
|
201
|
+
# @param request [::Google::Cloud::DiscoveryEngine::V1::CreateControlRequest, ::Hash]
|
202
|
+
# A request object representing the call parameters. Required. To specify no
|
203
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
204
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
205
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
206
|
+
#
|
207
|
+
# @overload create_control(parent: nil, control: nil, control_id: nil)
|
208
|
+
# Pass arguments to `create_control` via keyword arguments. Note that at
|
209
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
210
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
211
|
+
#
|
212
|
+
# @param parent [::String]
|
213
|
+
# Required. Full resource name of parent data store. Format:
|
214
|
+
# `projects/{project_number}/locations/{location_id}/collections/{collection_id}/dataStores/{data_store_id}`
|
215
|
+
# or
|
216
|
+
# `projects/{project_number}/locations/{location_id}/collections/{collection_id}/engines/{engine_id}`.
|
217
|
+
# @param control [::Google::Cloud::DiscoveryEngine::V1::Control, ::Hash]
|
218
|
+
# Required. The Control to create.
|
219
|
+
# @param control_id [::String]
|
220
|
+
# Required. The ID to use for the Control, which will become the final
|
221
|
+
# component of the Control's resource name.
|
222
|
+
#
|
223
|
+
# This value must be within 1-63 characters.
|
224
|
+
# Valid characters are /[a-z][0-9]-_/.
|
225
|
+
#
|
226
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
227
|
+
# @yieldparam response [::Google::Cloud::DiscoveryEngine::V1::Control]
|
228
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
229
|
+
#
|
230
|
+
# @return [::Google::Cloud::DiscoveryEngine::V1::Control]
|
231
|
+
#
|
232
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
233
|
+
#
|
234
|
+
# @example Basic example
|
235
|
+
# require "google/cloud/discovery_engine/v1"
|
236
|
+
#
|
237
|
+
# # Create a client object. The client can be reused for multiple calls.
|
238
|
+
# client = Google::Cloud::DiscoveryEngine::V1::ControlService::Client.new
|
239
|
+
#
|
240
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
241
|
+
# request = Google::Cloud::DiscoveryEngine::V1::CreateControlRequest.new
|
242
|
+
#
|
243
|
+
# # Call the create_control method.
|
244
|
+
# result = client.create_control request
|
245
|
+
#
|
246
|
+
# # The returned object is of type Google::Cloud::DiscoveryEngine::V1::Control.
|
247
|
+
# p result
|
248
|
+
#
|
249
|
+
def create_control request, options = nil
|
250
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
251
|
+
|
252
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DiscoveryEngine::V1::CreateControlRequest
|
253
|
+
|
254
|
+
# Converts hash and nil to an options object
|
255
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
256
|
+
|
257
|
+
# Customize the options with defaults
|
258
|
+
metadata = @config.rpcs.create_control.metadata.to_h
|
259
|
+
|
260
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
261
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
262
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
263
|
+
gapic_version: ::Google::Cloud::DiscoveryEngine::V1::VERSION
|
264
|
+
metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
265
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
266
|
+
|
267
|
+
header_params = {}
|
268
|
+
if request.parent
|
269
|
+
header_params["parent"] = request.parent
|
270
|
+
end
|
271
|
+
|
272
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
273
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
274
|
+
|
275
|
+
options.apply_defaults timeout: @config.rpcs.create_control.timeout,
|
276
|
+
metadata: metadata,
|
277
|
+
retry_policy: @config.rpcs.create_control.retry_policy
|
278
|
+
|
279
|
+
options.apply_defaults timeout: @config.timeout,
|
280
|
+
metadata: @config.metadata,
|
281
|
+
retry_policy: @config.retry_policy
|
282
|
+
|
283
|
+
@control_service_stub.call_rpc :create_control, request, options: options do |response, operation|
|
284
|
+
yield response, operation if block_given?
|
285
|
+
return response
|
286
|
+
end
|
287
|
+
rescue ::GRPC::BadStatus => e
|
288
|
+
raise ::Google::Cloud::Error.from_error(e)
|
289
|
+
end
|
290
|
+
|
291
|
+
##
|
292
|
+
# Deletes a Control.
|
293
|
+
#
|
294
|
+
# If the {::Google::Cloud::DiscoveryEngine::V1::Control Control} to delete does
|
295
|
+
# not exist, a NOT_FOUND error is returned.
|
296
|
+
#
|
297
|
+
# @overload delete_control(request, options = nil)
|
298
|
+
# Pass arguments to `delete_control` via a request object, either of type
|
299
|
+
# {::Google::Cloud::DiscoveryEngine::V1::DeleteControlRequest} or an equivalent Hash.
|
300
|
+
#
|
301
|
+
# @param request [::Google::Cloud::DiscoveryEngine::V1::DeleteControlRequest, ::Hash]
|
302
|
+
# A request object representing the call parameters. Required. To specify no
|
303
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
304
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
305
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
306
|
+
#
|
307
|
+
# @overload delete_control(name: nil)
|
308
|
+
# Pass arguments to `delete_control` via keyword arguments. Note that at
|
309
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
310
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
311
|
+
#
|
312
|
+
# @param name [::String]
|
313
|
+
# Required. The resource name of the Control to delete. Format:
|
314
|
+
# `projects/{project_number}/locations/{location_id}/collections/{collection_id}/dataStores/{data_store_id}/controls/{control_id}`
|
315
|
+
#
|
316
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
317
|
+
# @yieldparam response [::Google::Protobuf::Empty]
|
318
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
319
|
+
#
|
320
|
+
# @return [::Google::Protobuf::Empty]
|
321
|
+
#
|
322
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
323
|
+
#
|
324
|
+
# @example Basic example
|
325
|
+
# require "google/cloud/discovery_engine/v1"
|
326
|
+
#
|
327
|
+
# # Create a client object. The client can be reused for multiple calls.
|
328
|
+
# client = Google::Cloud::DiscoveryEngine::V1::ControlService::Client.new
|
329
|
+
#
|
330
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
331
|
+
# request = Google::Cloud::DiscoveryEngine::V1::DeleteControlRequest.new
|
332
|
+
#
|
333
|
+
# # Call the delete_control method.
|
334
|
+
# result = client.delete_control request
|
335
|
+
#
|
336
|
+
# # The returned object is of type Google::Protobuf::Empty.
|
337
|
+
# p result
|
338
|
+
#
|
339
|
+
def delete_control request, options = nil
|
340
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
341
|
+
|
342
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DiscoveryEngine::V1::DeleteControlRequest
|
343
|
+
|
344
|
+
# Converts hash and nil to an options object
|
345
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
346
|
+
|
347
|
+
# Customize the options with defaults
|
348
|
+
metadata = @config.rpcs.delete_control.metadata.to_h
|
349
|
+
|
350
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
351
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
352
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
353
|
+
gapic_version: ::Google::Cloud::DiscoveryEngine::V1::VERSION
|
354
|
+
metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
355
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
356
|
+
|
357
|
+
header_params = {}
|
358
|
+
if request.name
|
359
|
+
header_params["name"] = request.name
|
360
|
+
end
|
361
|
+
|
362
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
363
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
364
|
+
|
365
|
+
options.apply_defaults timeout: @config.rpcs.delete_control.timeout,
|
366
|
+
metadata: metadata,
|
367
|
+
retry_policy: @config.rpcs.delete_control.retry_policy
|
368
|
+
|
369
|
+
options.apply_defaults timeout: @config.timeout,
|
370
|
+
metadata: @config.metadata,
|
371
|
+
retry_policy: @config.retry_policy
|
372
|
+
|
373
|
+
@control_service_stub.call_rpc :delete_control, request, options: options do |response, operation|
|
374
|
+
yield response, operation if block_given?
|
375
|
+
return response
|
376
|
+
end
|
377
|
+
rescue ::GRPC::BadStatus => e
|
378
|
+
raise ::Google::Cloud::Error.from_error(e)
|
379
|
+
end
|
380
|
+
|
381
|
+
##
|
382
|
+
# Updates a Control.
|
383
|
+
#
|
384
|
+
# {::Google::Cloud::DiscoveryEngine::V1::Control Control} action type cannot be
|
385
|
+
# changed. If the {::Google::Cloud::DiscoveryEngine::V1::Control Control} to
|
386
|
+
# update does not exist, a NOT_FOUND error is returned.
|
387
|
+
#
|
388
|
+
# @overload update_control(request, options = nil)
|
389
|
+
# Pass arguments to `update_control` via a request object, either of type
|
390
|
+
# {::Google::Cloud::DiscoveryEngine::V1::UpdateControlRequest} or an equivalent Hash.
|
391
|
+
#
|
392
|
+
# @param request [::Google::Cloud::DiscoveryEngine::V1::UpdateControlRequest, ::Hash]
|
393
|
+
# A request object representing the call parameters. Required. To specify no
|
394
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
395
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
396
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
397
|
+
#
|
398
|
+
# @overload update_control(control: nil, update_mask: nil)
|
399
|
+
# Pass arguments to `update_control` via keyword arguments. Note that at
|
400
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
401
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
402
|
+
#
|
403
|
+
# @param control [::Google::Cloud::DiscoveryEngine::V1::Control, ::Hash]
|
404
|
+
# Required. The Control to update.
|
405
|
+
# @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
|
406
|
+
# Optional. Indicates which fields in the provided
|
407
|
+
# {::Google::Cloud::DiscoveryEngine::V1::Control Control} to update. The following
|
408
|
+
# are NOT supported:
|
409
|
+
#
|
410
|
+
# * {::Google::Cloud::DiscoveryEngine::V1::Control#name Control.name}
|
411
|
+
# * {::Google::Cloud::DiscoveryEngine::V1::Control#solution_type Control.solution_type}
|
412
|
+
#
|
413
|
+
# If not set or empty, all supported fields are updated.
|
414
|
+
#
|
415
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
416
|
+
# @yieldparam response [::Google::Cloud::DiscoveryEngine::V1::Control]
|
417
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
418
|
+
#
|
419
|
+
# @return [::Google::Cloud::DiscoveryEngine::V1::Control]
|
420
|
+
#
|
421
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
422
|
+
#
|
423
|
+
# @example Basic example
|
424
|
+
# require "google/cloud/discovery_engine/v1"
|
425
|
+
#
|
426
|
+
# # Create a client object. The client can be reused for multiple calls.
|
427
|
+
# client = Google::Cloud::DiscoveryEngine::V1::ControlService::Client.new
|
428
|
+
#
|
429
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
430
|
+
# request = Google::Cloud::DiscoveryEngine::V1::UpdateControlRequest.new
|
431
|
+
#
|
432
|
+
# # Call the update_control method.
|
433
|
+
# result = client.update_control request
|
434
|
+
#
|
435
|
+
# # The returned object is of type Google::Cloud::DiscoveryEngine::V1::Control.
|
436
|
+
# p result
|
437
|
+
#
|
438
|
+
def update_control request, options = nil
|
439
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
440
|
+
|
441
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DiscoveryEngine::V1::UpdateControlRequest
|
442
|
+
|
443
|
+
# Converts hash and nil to an options object
|
444
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
445
|
+
|
446
|
+
# Customize the options with defaults
|
447
|
+
metadata = @config.rpcs.update_control.metadata.to_h
|
448
|
+
|
449
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
450
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
451
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
452
|
+
gapic_version: ::Google::Cloud::DiscoveryEngine::V1::VERSION
|
453
|
+
metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
454
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
455
|
+
|
456
|
+
header_params = {}
|
457
|
+
if request.control&.name
|
458
|
+
header_params["control.name"] = request.control.name
|
459
|
+
end
|
460
|
+
|
461
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
462
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
463
|
+
|
464
|
+
options.apply_defaults timeout: @config.rpcs.update_control.timeout,
|
465
|
+
metadata: metadata,
|
466
|
+
retry_policy: @config.rpcs.update_control.retry_policy
|
467
|
+
|
468
|
+
options.apply_defaults timeout: @config.timeout,
|
469
|
+
metadata: @config.metadata,
|
470
|
+
retry_policy: @config.retry_policy
|
471
|
+
|
472
|
+
@control_service_stub.call_rpc :update_control, request, options: options do |response, operation|
|
473
|
+
yield response, operation if block_given?
|
474
|
+
return response
|
475
|
+
end
|
476
|
+
rescue ::GRPC::BadStatus => e
|
477
|
+
raise ::Google::Cloud::Error.from_error(e)
|
478
|
+
end
|
479
|
+
|
480
|
+
##
|
481
|
+
# Gets a Control.
|
482
|
+
#
|
483
|
+
# @overload get_control(request, options = nil)
|
484
|
+
# Pass arguments to `get_control` via a request object, either of type
|
485
|
+
# {::Google::Cloud::DiscoveryEngine::V1::GetControlRequest} or an equivalent Hash.
|
486
|
+
#
|
487
|
+
# @param request [::Google::Cloud::DiscoveryEngine::V1::GetControlRequest, ::Hash]
|
488
|
+
# A request object representing the call parameters. Required. To specify no
|
489
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
490
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
491
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
492
|
+
#
|
493
|
+
# @overload get_control(name: nil)
|
494
|
+
# Pass arguments to `get_control` via keyword arguments. Note that at
|
495
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
496
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
497
|
+
#
|
498
|
+
# @param name [::String]
|
499
|
+
# Required. The resource name of the Control to get. Format:
|
500
|
+
# `projects/{project_number}/locations/{location_id}/collections/{collection_id}/dataStores/{data_store_id}/controls/{control_id}`
|
501
|
+
#
|
502
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
503
|
+
# @yieldparam response [::Google::Cloud::DiscoveryEngine::V1::Control]
|
504
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
505
|
+
#
|
506
|
+
# @return [::Google::Cloud::DiscoveryEngine::V1::Control]
|
507
|
+
#
|
508
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
509
|
+
#
|
510
|
+
# @example Basic example
|
511
|
+
# require "google/cloud/discovery_engine/v1"
|
512
|
+
#
|
513
|
+
# # Create a client object. The client can be reused for multiple calls.
|
514
|
+
# client = Google::Cloud::DiscoveryEngine::V1::ControlService::Client.new
|
515
|
+
#
|
516
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
517
|
+
# request = Google::Cloud::DiscoveryEngine::V1::GetControlRequest.new
|
518
|
+
#
|
519
|
+
# # Call the get_control method.
|
520
|
+
# result = client.get_control request
|
521
|
+
#
|
522
|
+
# # The returned object is of type Google::Cloud::DiscoveryEngine::V1::Control.
|
523
|
+
# p result
|
524
|
+
#
|
525
|
+
def get_control request, options = nil
|
526
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
527
|
+
|
528
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DiscoveryEngine::V1::GetControlRequest
|
529
|
+
|
530
|
+
# Converts hash and nil to an options object
|
531
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
532
|
+
|
533
|
+
# Customize the options with defaults
|
534
|
+
metadata = @config.rpcs.get_control.metadata.to_h
|
535
|
+
|
536
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
537
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
538
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
539
|
+
gapic_version: ::Google::Cloud::DiscoveryEngine::V1::VERSION
|
540
|
+
metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
541
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
542
|
+
|
543
|
+
header_params = {}
|
544
|
+
if request.name
|
545
|
+
header_params["name"] = request.name
|
546
|
+
end
|
547
|
+
|
548
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
549
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
550
|
+
|
551
|
+
options.apply_defaults timeout: @config.rpcs.get_control.timeout,
|
552
|
+
metadata: metadata,
|
553
|
+
retry_policy: @config.rpcs.get_control.retry_policy
|
554
|
+
|
555
|
+
options.apply_defaults timeout: @config.timeout,
|
556
|
+
metadata: @config.metadata,
|
557
|
+
retry_policy: @config.retry_policy
|
558
|
+
|
559
|
+
@control_service_stub.call_rpc :get_control, request, options: options do |response, operation|
|
560
|
+
yield response, operation if block_given?
|
561
|
+
return response
|
562
|
+
end
|
563
|
+
rescue ::GRPC::BadStatus => e
|
564
|
+
raise ::Google::Cloud::Error.from_error(e)
|
565
|
+
end
|
566
|
+
|
567
|
+
##
|
568
|
+
# Lists all Controls by their parent
|
569
|
+
# {::Google::Cloud::DiscoveryEngine::V1::DataStore DataStore}.
|
570
|
+
#
|
571
|
+
# @overload list_controls(request, options = nil)
|
572
|
+
# Pass arguments to `list_controls` via a request object, either of type
|
573
|
+
# {::Google::Cloud::DiscoveryEngine::V1::ListControlsRequest} or an equivalent Hash.
|
574
|
+
#
|
575
|
+
# @param request [::Google::Cloud::DiscoveryEngine::V1::ListControlsRequest, ::Hash]
|
576
|
+
# A request object representing the call parameters. Required. To specify no
|
577
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
578
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
579
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
580
|
+
#
|
581
|
+
# @overload list_controls(parent: nil, page_size: nil, page_token: nil, filter: nil)
|
582
|
+
# Pass arguments to `list_controls` via keyword arguments. Note that at
|
583
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
584
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
585
|
+
#
|
586
|
+
# @param parent [::String]
|
587
|
+
# Required. The data store resource name. Format:
|
588
|
+
# `projects/{project_number}/locations/{location_id}/collections/{collection_id}/dataStores/{data_store_id}`
|
589
|
+
# or
|
590
|
+
# `projects/{project_number}/locations/{location_id}/collections/{collection_id}/engines/{engine_id}`.
|
591
|
+
# @param page_size [::Integer]
|
592
|
+
# Optional. Maximum number of results to return. If unspecified, defaults
|
593
|
+
# to 50. Max allowed value is 1000.
|
594
|
+
# @param page_token [::String]
|
595
|
+
# Optional. A page token, received from a previous `ListControls` call.
|
596
|
+
# Provide this to retrieve the subsequent page.
|
597
|
+
# @param filter [::String]
|
598
|
+
# Optional. A filter to apply on the list results. Supported features:
|
599
|
+
#
|
600
|
+
# * List all the products under the parent branch if
|
601
|
+
# {::Google::Cloud::DiscoveryEngine::V1::ListControlsRequest#filter filter} is
|
602
|
+
# unset. Currently this field is unsupported.
|
603
|
+
#
|
604
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
605
|
+
# @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::DiscoveryEngine::V1::Control>]
|
606
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
607
|
+
#
|
608
|
+
# @return [::Gapic::PagedEnumerable<::Google::Cloud::DiscoveryEngine::V1::Control>]
|
609
|
+
#
|
610
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
611
|
+
#
|
612
|
+
# @example Basic example
|
613
|
+
# require "google/cloud/discovery_engine/v1"
|
614
|
+
#
|
615
|
+
# # Create a client object. The client can be reused for multiple calls.
|
616
|
+
# client = Google::Cloud::DiscoveryEngine::V1::ControlService::Client.new
|
617
|
+
#
|
618
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
619
|
+
# request = Google::Cloud::DiscoveryEngine::V1::ListControlsRequest.new
|
620
|
+
#
|
621
|
+
# # Call the list_controls method.
|
622
|
+
# result = client.list_controls request
|
623
|
+
#
|
624
|
+
# # The returned object is of type Gapic::PagedEnumerable. You can iterate
|
625
|
+
# # over elements, and API calls will be issued to fetch pages as needed.
|
626
|
+
# result.each do |item|
|
627
|
+
# # Each element is of type ::Google::Cloud::DiscoveryEngine::V1::Control.
|
628
|
+
# p item
|
629
|
+
# end
|
630
|
+
#
|
631
|
+
def list_controls request, options = nil
|
632
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
633
|
+
|
634
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DiscoveryEngine::V1::ListControlsRequest
|
635
|
+
|
636
|
+
# Converts hash and nil to an options object
|
637
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
638
|
+
|
639
|
+
# Customize the options with defaults
|
640
|
+
metadata = @config.rpcs.list_controls.metadata.to_h
|
641
|
+
|
642
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
643
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
644
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
645
|
+
gapic_version: ::Google::Cloud::DiscoveryEngine::V1::VERSION
|
646
|
+
metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
647
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
648
|
+
|
649
|
+
header_params = {}
|
650
|
+
if request.parent
|
651
|
+
header_params["parent"] = request.parent
|
652
|
+
end
|
653
|
+
|
654
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
655
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
656
|
+
|
657
|
+
options.apply_defaults timeout: @config.rpcs.list_controls.timeout,
|
658
|
+
metadata: metadata,
|
659
|
+
retry_policy: @config.rpcs.list_controls.retry_policy
|
660
|
+
|
661
|
+
options.apply_defaults timeout: @config.timeout,
|
662
|
+
metadata: @config.metadata,
|
663
|
+
retry_policy: @config.retry_policy
|
664
|
+
|
665
|
+
@control_service_stub.call_rpc :list_controls, request, options: options do |response, operation|
|
666
|
+
response = ::Gapic::PagedEnumerable.new @control_service_stub, :list_controls, request, response, operation, options
|
667
|
+
yield response, operation if block_given?
|
668
|
+
return response
|
669
|
+
end
|
670
|
+
rescue ::GRPC::BadStatus => e
|
671
|
+
raise ::Google::Cloud::Error.from_error(e)
|
672
|
+
end
|
673
|
+
|
674
|
+
##
|
675
|
+
# Configuration class for the ControlService API.
|
676
|
+
#
|
677
|
+
# This class represents the configuration for ControlService,
|
678
|
+
# providing control over timeouts, retry behavior, logging, transport
|
679
|
+
# parameters, and other low-level controls. Certain parameters can also be
|
680
|
+
# applied individually to specific RPCs. See
|
681
|
+
# {::Google::Cloud::DiscoveryEngine::V1::ControlService::Client::Configuration::Rpcs}
|
682
|
+
# for a list of RPCs that can be configured independently.
|
683
|
+
#
|
684
|
+
# Configuration can be applied globally to all clients, or to a single client
|
685
|
+
# on construction.
|
686
|
+
#
|
687
|
+
# @example
|
688
|
+
#
|
689
|
+
# # Modify the global config, setting the timeout for
|
690
|
+
# # create_control to 20 seconds,
|
691
|
+
# # and all remaining timeouts to 10 seconds.
|
692
|
+
# ::Google::Cloud::DiscoveryEngine::V1::ControlService::Client.configure do |config|
|
693
|
+
# config.timeout = 10.0
|
694
|
+
# config.rpcs.create_control.timeout = 20.0
|
695
|
+
# end
|
696
|
+
#
|
697
|
+
# # Apply the above configuration only to a new client.
|
698
|
+
# client = ::Google::Cloud::DiscoveryEngine::V1::ControlService::Client.new do |config|
|
699
|
+
# config.timeout = 10.0
|
700
|
+
# config.rpcs.create_control.timeout = 20.0
|
701
|
+
# end
|
702
|
+
#
|
703
|
+
# @!attribute [rw] endpoint
|
704
|
+
# A custom service endpoint, as a hostname or hostname:port. The default is
|
705
|
+
# nil, indicating to use the default endpoint in the current universe domain.
|
706
|
+
# @return [::String,nil]
|
707
|
+
# @!attribute [rw] credentials
|
708
|
+
# Credentials to send with calls. You may provide any of the following types:
|
709
|
+
# * (`String`) The path to a service account key file in JSON format
|
710
|
+
# * (`Hash`) A service account key as a Hash
|
711
|
+
# * (`Google::Auth::Credentials`) A googleauth credentials object
|
712
|
+
# (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
|
713
|
+
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
714
|
+
# (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
|
715
|
+
# * (`GRPC::Core::Channel`) a gRPC channel with included credentials
|
716
|
+
# * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
|
717
|
+
# * (`nil`) indicating no credentials
|
718
|
+
# @return [::Object]
|
719
|
+
# @!attribute [rw] scope
|
720
|
+
# The OAuth scopes
|
721
|
+
# @return [::Array<::String>]
|
722
|
+
# @!attribute [rw] lib_name
|
723
|
+
# The library name as recorded in instrumentation and logging
|
724
|
+
# @return [::String]
|
725
|
+
# @!attribute [rw] lib_version
|
726
|
+
# The library version as recorded in instrumentation and logging
|
727
|
+
# @return [::String]
|
728
|
+
# @!attribute [rw] channel_args
|
729
|
+
# Extra parameters passed to the gRPC channel. Note: this is ignored if a
|
730
|
+
# `GRPC::Core::Channel` object is provided as the credential.
|
731
|
+
# @return [::Hash]
|
732
|
+
# @!attribute [rw] interceptors
|
733
|
+
# An array of interceptors that are run before calls are executed.
|
734
|
+
# @return [::Array<::GRPC::ClientInterceptor>]
|
735
|
+
# @!attribute [rw] timeout
|
736
|
+
# The call timeout in seconds.
|
737
|
+
# @return [::Numeric]
|
738
|
+
# @!attribute [rw] metadata
|
739
|
+
# Additional gRPC headers to be sent with the call.
|
740
|
+
# @return [::Hash{::Symbol=>::String}]
|
741
|
+
# @!attribute [rw] retry_policy
|
742
|
+
# The retry policy. The value is a hash with the following keys:
|
743
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
744
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
745
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
746
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
747
|
+
# trigger a retry.
|
748
|
+
# @return [::Hash]
|
749
|
+
# @!attribute [rw] quota_project
|
750
|
+
# A separate project against which to charge quota.
|
751
|
+
# @return [::String]
|
752
|
+
# @!attribute [rw] universe_domain
|
753
|
+
# The universe domain within which to make requests. This determines the
|
754
|
+
# default endpoint URL. The default value of nil uses the environment
|
755
|
+
# universe (usually the default "googleapis.com" universe).
|
756
|
+
# @return [::String,nil]
|
757
|
+
#
|
758
|
+
class Configuration
|
759
|
+
extend ::Gapic::Config
|
760
|
+
|
761
|
+
# @private
|
762
|
+
# The endpoint specific to the default "googleapis.com" universe. Deprecated.
|
763
|
+
DEFAULT_ENDPOINT = "discoveryengine.googleapis.com"
|
764
|
+
|
765
|
+
config_attr :endpoint, nil, ::String, nil
|
766
|
+
config_attr :credentials, nil do |value|
|
767
|
+
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
768
|
+
allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
|
769
|
+
allowed.any? { |klass| klass === value }
|
770
|
+
end
|
771
|
+
config_attr :scope, nil, ::String, ::Array, nil
|
772
|
+
config_attr :lib_name, nil, ::String, nil
|
773
|
+
config_attr :lib_version, nil, ::String, nil
|
774
|
+
config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
|
775
|
+
config_attr :interceptors, nil, ::Array, nil
|
776
|
+
config_attr :timeout, nil, ::Numeric, nil
|
777
|
+
config_attr :metadata, nil, ::Hash, nil
|
778
|
+
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
779
|
+
config_attr :quota_project, nil, ::String, nil
|
780
|
+
config_attr :universe_domain, nil, ::String, nil
|
781
|
+
|
782
|
+
# @private
|
783
|
+
def initialize parent_config = nil
|
784
|
+
@parent_config = parent_config unless parent_config.nil?
|
785
|
+
|
786
|
+
yield self if block_given?
|
787
|
+
end
|
788
|
+
|
789
|
+
##
|
790
|
+
# Configurations for individual RPCs
|
791
|
+
# @return [Rpcs]
|
792
|
+
#
|
793
|
+
def rpcs
|
794
|
+
@rpcs ||= begin
|
795
|
+
parent_rpcs = nil
|
796
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
|
797
|
+
Rpcs.new parent_rpcs
|
798
|
+
end
|
799
|
+
end
|
800
|
+
|
801
|
+
##
|
802
|
+
# Configuration for the channel pool
|
803
|
+
# @return [::Gapic::ServiceStub::ChannelPool::Configuration]
|
804
|
+
#
|
805
|
+
def channel_pool
|
806
|
+
@channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new
|
807
|
+
end
|
808
|
+
|
809
|
+
##
|
810
|
+
# Configuration RPC class for the ControlService API.
|
811
|
+
#
|
812
|
+
# Includes fields providing the configuration for each RPC in this service.
|
813
|
+
# Each configuration object is of type `Gapic::Config::Method` and includes
|
814
|
+
# the following configuration fields:
|
815
|
+
#
|
816
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in seconds
|
817
|
+
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
|
818
|
+
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
819
|
+
# include the following keys:
|
820
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
821
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
822
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
823
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
824
|
+
# trigger a retry.
|
825
|
+
#
|
826
|
+
class Rpcs
|
827
|
+
##
|
828
|
+
# RPC-specific configuration for `create_control`
|
829
|
+
# @return [::Gapic::Config::Method]
|
830
|
+
#
|
831
|
+
attr_reader :create_control
|
832
|
+
##
|
833
|
+
# RPC-specific configuration for `delete_control`
|
834
|
+
# @return [::Gapic::Config::Method]
|
835
|
+
#
|
836
|
+
attr_reader :delete_control
|
837
|
+
##
|
838
|
+
# RPC-specific configuration for `update_control`
|
839
|
+
# @return [::Gapic::Config::Method]
|
840
|
+
#
|
841
|
+
attr_reader :update_control
|
842
|
+
##
|
843
|
+
# RPC-specific configuration for `get_control`
|
844
|
+
# @return [::Gapic::Config::Method]
|
845
|
+
#
|
846
|
+
attr_reader :get_control
|
847
|
+
##
|
848
|
+
# RPC-specific configuration for `list_controls`
|
849
|
+
# @return [::Gapic::Config::Method]
|
850
|
+
#
|
851
|
+
attr_reader :list_controls
|
852
|
+
|
853
|
+
# @private
|
854
|
+
def initialize parent_rpcs = nil
|
855
|
+
create_control_config = parent_rpcs.create_control if parent_rpcs.respond_to? :create_control
|
856
|
+
@create_control = ::Gapic::Config::Method.new create_control_config
|
857
|
+
delete_control_config = parent_rpcs.delete_control if parent_rpcs.respond_to? :delete_control
|
858
|
+
@delete_control = ::Gapic::Config::Method.new delete_control_config
|
859
|
+
update_control_config = parent_rpcs.update_control if parent_rpcs.respond_to? :update_control
|
860
|
+
@update_control = ::Gapic::Config::Method.new update_control_config
|
861
|
+
get_control_config = parent_rpcs.get_control if parent_rpcs.respond_to? :get_control
|
862
|
+
@get_control = ::Gapic::Config::Method.new get_control_config
|
863
|
+
list_controls_config = parent_rpcs.list_controls if parent_rpcs.respond_to? :list_controls
|
864
|
+
@list_controls = ::Gapic::Config::Method.new list_controls_config
|
865
|
+
|
866
|
+
yield self if block_given?
|
867
|
+
end
|
868
|
+
end
|
869
|
+
end
|
870
|
+
end
|
871
|
+
end
|
872
|
+
end
|
873
|
+
end
|
874
|
+
end
|
875
|
+
end
|