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,1114 @@
|
|
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 "gapic/operation"
|
20
|
+
|
21
|
+
module Google
|
22
|
+
module Cloud
|
23
|
+
module DiscoveryEngine
|
24
|
+
module V1
|
25
|
+
module ProjectService
|
26
|
+
module Rest
|
27
|
+
# Service that implements Longrunning Operations API.
|
28
|
+
class Operations
|
29
|
+
# @private
|
30
|
+
API_VERSION = ""
|
31
|
+
|
32
|
+
# @private
|
33
|
+
DEFAULT_ENDPOINT_TEMPLATE = "discoveryengine.$UNIVERSE_DOMAIN$"
|
34
|
+
|
35
|
+
# @private
|
36
|
+
attr_reader :operations_stub
|
37
|
+
|
38
|
+
##
|
39
|
+
# Configuration for the ProjectService Operations API.
|
40
|
+
#
|
41
|
+
# @yield [config] Configure the Operations client.
|
42
|
+
# @yieldparam config [Operations::Configuration]
|
43
|
+
#
|
44
|
+
# @return [Operations::Configuration]
|
45
|
+
#
|
46
|
+
def self.configure
|
47
|
+
@configure ||= Operations::Configuration.new
|
48
|
+
yield @configure if block_given?
|
49
|
+
@configure
|
50
|
+
end
|
51
|
+
|
52
|
+
##
|
53
|
+
# Configure the ProjectService Operations instance.
|
54
|
+
#
|
55
|
+
# The configuration is set to the derived mode, meaning that values can be changed,
|
56
|
+
# but structural changes (adding new fields, etc.) are not allowed. Structural changes
|
57
|
+
# should be made on {Operations.configure}.
|
58
|
+
#
|
59
|
+
# @yield [config] Configure the Operations client.
|
60
|
+
# @yieldparam config [Operations::Configuration]
|
61
|
+
#
|
62
|
+
# @return [Operations::Configuration]
|
63
|
+
#
|
64
|
+
def configure
|
65
|
+
yield @config if block_given?
|
66
|
+
@config
|
67
|
+
end
|
68
|
+
|
69
|
+
##
|
70
|
+
# The effective universe domain
|
71
|
+
#
|
72
|
+
# @return [String]
|
73
|
+
#
|
74
|
+
def universe_domain
|
75
|
+
@operations_stub.universe_domain
|
76
|
+
end
|
77
|
+
|
78
|
+
##
|
79
|
+
# Create a new Operations client object.
|
80
|
+
#
|
81
|
+
# @yield [config] Configure the Client client.
|
82
|
+
# @yieldparam config [Operations::Configuration]
|
83
|
+
#
|
84
|
+
def initialize
|
85
|
+
# Create the configuration object
|
86
|
+
@config = Configuration.new Operations.configure
|
87
|
+
|
88
|
+
# Yield the configuration if needed
|
89
|
+
yield @config if block_given?
|
90
|
+
|
91
|
+
# Create credentials
|
92
|
+
credentials = @config.credentials
|
93
|
+
credentials ||= Credentials.default scope: @config.scope
|
94
|
+
if credentials.is_a?(::String) || credentials.is_a?(::Hash)
|
95
|
+
credentials = Credentials.new credentials, scope: @config.scope
|
96
|
+
end
|
97
|
+
|
98
|
+
@quota_project_id = @config.quota_project
|
99
|
+
@quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
|
100
|
+
|
101
|
+
@operations_stub = OperationsServiceStub.new(
|
102
|
+
endpoint: @config.endpoint,
|
103
|
+
endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
|
104
|
+
universe_domain: @config.universe_domain,
|
105
|
+
credentials: credentials
|
106
|
+
)
|
107
|
+
|
108
|
+
# Used by an LRO wrapper for some methods of this service
|
109
|
+
@operations_client = self
|
110
|
+
end
|
111
|
+
|
112
|
+
# Service calls
|
113
|
+
|
114
|
+
##
|
115
|
+
# Lists operations that match the specified filter in the request. If the
|
116
|
+
# server doesn't support this method, it returns `UNIMPLEMENTED`.
|
117
|
+
#
|
118
|
+
# NOTE: the `name` binding allows API services to override the binding
|
119
|
+
# to use different resource name schemes, such as `users/*/operations`. To
|
120
|
+
# override the binding, API services can add a binding such as
|
121
|
+
# `"/v1/{name=users/*}/operations"` to their service configuration.
|
122
|
+
# For backwards compatibility, the default name includes the operations
|
123
|
+
# collection id, however overriding users must ensure the name binding
|
124
|
+
# is the parent resource, without the operations collection id.
|
125
|
+
#
|
126
|
+
# @overload list_operations(request, options = nil)
|
127
|
+
# Pass arguments to `list_operations` via a request object, either of type
|
128
|
+
# {::Google::Longrunning::ListOperationsRequest} or an equivalent Hash.
|
129
|
+
#
|
130
|
+
# @param request [::Google::Longrunning::ListOperationsRequest, ::Hash]
|
131
|
+
# A request object representing the call parameters. Required. To specify no
|
132
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
133
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
134
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
135
|
+
#
|
136
|
+
# @overload list_operations(name: nil, filter: nil, page_size: nil, page_token: nil)
|
137
|
+
# Pass arguments to `list_operations` via keyword arguments. Note that at
|
138
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
139
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
140
|
+
#
|
141
|
+
# @param name [::String]
|
142
|
+
# The name of the operation's parent resource.
|
143
|
+
# @param filter [::String]
|
144
|
+
# The standard list filter.
|
145
|
+
# @param page_size [::Integer]
|
146
|
+
# The standard list page size.
|
147
|
+
# @param page_token [::String]
|
148
|
+
# The standard list page token.
|
149
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
150
|
+
# @yieldparam result [::Gapic::Operation]
|
151
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
152
|
+
#
|
153
|
+
# @return [::Gapic::Operation]
|
154
|
+
#
|
155
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
156
|
+
#
|
157
|
+
# @example Basic example
|
158
|
+
# require "google/longrunning"
|
159
|
+
#
|
160
|
+
# # Create a client object. The client can be reused for multiple calls.
|
161
|
+
# client = Google::Longrunning::Operations::Rest::Client.new
|
162
|
+
#
|
163
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
164
|
+
# request = Google::Longrunning::ListOperationsRequest.new
|
165
|
+
#
|
166
|
+
# # Call the list_operations method.
|
167
|
+
# result = client.list_operations request
|
168
|
+
#
|
169
|
+
# # The returned object is of type Gapic::PagedEnumerable. You can iterate
|
170
|
+
# # over elements, and API calls will be issued to fetch pages as needed.
|
171
|
+
# result.each do |item|
|
172
|
+
# # Each element is of type ::Google::Longrunning::Operation.
|
173
|
+
# p item
|
174
|
+
# end
|
175
|
+
#
|
176
|
+
def list_operations request, options = nil
|
177
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
178
|
+
|
179
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::ListOperationsRequest
|
180
|
+
|
181
|
+
# Converts hash and nil to an options object
|
182
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
183
|
+
|
184
|
+
# Customize the options with defaults
|
185
|
+
call_metadata = @config.rpcs.list_operations.metadata.to_h
|
186
|
+
|
187
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
188
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
189
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
190
|
+
gapic_version: ::Google::Cloud::DiscoveryEngine::V1::VERSION,
|
191
|
+
transports_version_send: [:rest]
|
192
|
+
|
193
|
+
call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
194
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
195
|
+
|
196
|
+
options.apply_defaults timeout: @config.rpcs.list_operations.timeout,
|
197
|
+
metadata: call_metadata,
|
198
|
+
retry_policy: @config.rpcs.list_operations.retry_policy
|
199
|
+
|
200
|
+
options.apply_defaults timeout: @config.timeout,
|
201
|
+
metadata: @config.metadata,
|
202
|
+
retry_policy: @config.retry_policy
|
203
|
+
|
204
|
+
@operations_stub.list_operations request, options do |result, operation|
|
205
|
+
result = ::Gapic::Rest::PagedEnumerable.new @operations_stub, :list_operations, "operations", request, result, options
|
206
|
+
yield result, operation if block_given?
|
207
|
+
return result
|
208
|
+
end
|
209
|
+
rescue ::Gapic::Rest::Error => e
|
210
|
+
raise ::Google::Cloud::Error.from_error(e)
|
211
|
+
end
|
212
|
+
|
213
|
+
##
|
214
|
+
# Gets the latest state of a long-running operation. Clients can use this
|
215
|
+
# method to poll the operation result at intervals as recommended by the API
|
216
|
+
# service.
|
217
|
+
#
|
218
|
+
# @overload get_operation(request, options = nil)
|
219
|
+
# Pass arguments to `get_operation` via a request object, either of type
|
220
|
+
# {::Google::Longrunning::GetOperationRequest} or an equivalent Hash.
|
221
|
+
#
|
222
|
+
# @param request [::Google::Longrunning::GetOperationRequest, ::Hash]
|
223
|
+
# A request object representing the call parameters. Required. To specify no
|
224
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
225
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
226
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
227
|
+
#
|
228
|
+
# @overload get_operation(name: nil)
|
229
|
+
# Pass arguments to `get_operation` via keyword arguments. Note that at
|
230
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
231
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
232
|
+
#
|
233
|
+
# @param name [::String]
|
234
|
+
# The name of the operation resource.
|
235
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
236
|
+
# @yieldparam result [::Gapic::Operation]
|
237
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
238
|
+
#
|
239
|
+
# @return [::Gapic::Operation]
|
240
|
+
#
|
241
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
242
|
+
#
|
243
|
+
# @example Basic example
|
244
|
+
# require "google/longrunning"
|
245
|
+
#
|
246
|
+
# # Create a client object. The client can be reused for multiple calls.
|
247
|
+
# client = Google::Longrunning::Operations::Rest::Client.new
|
248
|
+
#
|
249
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
250
|
+
# request = Google::Longrunning::GetOperationRequest.new
|
251
|
+
#
|
252
|
+
# # Call the get_operation method.
|
253
|
+
# result = client.get_operation request
|
254
|
+
#
|
255
|
+
# # The returned object is of type Gapic::Operation. You can use it to
|
256
|
+
# # check the status of an operation, cancel it, or wait for results.
|
257
|
+
# # Here is how to wait for a response.
|
258
|
+
# result.wait_until_done! timeout: 60
|
259
|
+
# if result.response?
|
260
|
+
# p result.response
|
261
|
+
# else
|
262
|
+
# puts "No response received."
|
263
|
+
# end
|
264
|
+
#
|
265
|
+
def get_operation request, options = nil
|
266
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
267
|
+
|
268
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::GetOperationRequest
|
269
|
+
|
270
|
+
# Converts hash and nil to an options object
|
271
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
272
|
+
|
273
|
+
# Customize the options with defaults
|
274
|
+
call_metadata = @config.rpcs.get_operation.metadata.to_h
|
275
|
+
|
276
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
277
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
278
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
279
|
+
gapic_version: ::Google::Cloud::DiscoveryEngine::V1::VERSION,
|
280
|
+
transports_version_send: [:rest]
|
281
|
+
|
282
|
+
call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
283
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
284
|
+
|
285
|
+
options.apply_defaults timeout: @config.rpcs.get_operation.timeout,
|
286
|
+
metadata: call_metadata,
|
287
|
+
retry_policy: @config.rpcs.get_operation.retry_policy
|
288
|
+
|
289
|
+
options.apply_defaults timeout: @config.timeout,
|
290
|
+
metadata: @config.metadata,
|
291
|
+
retry_policy: @config.retry_policy
|
292
|
+
|
293
|
+
@operations_stub.get_operation request, options do |result, operation|
|
294
|
+
result = ::Gapic::Operation.new result, @operations_client, options: options
|
295
|
+
yield result, operation if block_given?
|
296
|
+
return result
|
297
|
+
end
|
298
|
+
rescue ::Gapic::Rest::Error => e
|
299
|
+
raise ::Google::Cloud::Error.from_error(e)
|
300
|
+
end
|
301
|
+
|
302
|
+
##
|
303
|
+
# Deletes a long-running operation. This method indicates that the client is
|
304
|
+
# no longer interested in the operation result. It does not cancel the
|
305
|
+
# operation. If the server doesn't support this method, it returns
|
306
|
+
# `google.rpc.Code.UNIMPLEMENTED`.
|
307
|
+
#
|
308
|
+
# @overload delete_operation(request, options = nil)
|
309
|
+
# Pass arguments to `delete_operation` via a request object, either of type
|
310
|
+
# {::Google::Longrunning::DeleteOperationRequest} or an equivalent Hash.
|
311
|
+
#
|
312
|
+
# @param request [::Google::Longrunning::DeleteOperationRequest, ::Hash]
|
313
|
+
# A request object representing the call parameters. Required. To specify no
|
314
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
315
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
316
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
317
|
+
#
|
318
|
+
# @overload delete_operation(name: nil)
|
319
|
+
# Pass arguments to `delete_operation` via keyword arguments. Note that at
|
320
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
321
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
322
|
+
#
|
323
|
+
# @param name [::String]
|
324
|
+
# The name of the operation resource to be deleted.
|
325
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
326
|
+
# @yieldparam result [::Google::Protobuf::Empty]
|
327
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
328
|
+
#
|
329
|
+
# @return [::Google::Protobuf::Empty]
|
330
|
+
#
|
331
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
332
|
+
#
|
333
|
+
# @example Basic example
|
334
|
+
# require "google/longrunning"
|
335
|
+
#
|
336
|
+
# # Create a client object. The client can be reused for multiple calls.
|
337
|
+
# client = Google::Longrunning::Operations::Rest::Client.new
|
338
|
+
#
|
339
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
340
|
+
# request = Google::Longrunning::DeleteOperationRequest.new
|
341
|
+
#
|
342
|
+
# # Call the delete_operation method.
|
343
|
+
# result = client.delete_operation request
|
344
|
+
#
|
345
|
+
# # The returned object is of type Google::Protobuf::Empty.
|
346
|
+
# p result
|
347
|
+
#
|
348
|
+
def delete_operation request, options = nil
|
349
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
350
|
+
|
351
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::DeleteOperationRequest
|
352
|
+
|
353
|
+
# Converts hash and nil to an options object
|
354
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
355
|
+
|
356
|
+
# Customize the options with defaults
|
357
|
+
call_metadata = @config.rpcs.delete_operation.metadata.to_h
|
358
|
+
|
359
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
360
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
361
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
362
|
+
gapic_version: ::Google::Cloud::DiscoveryEngine::V1::VERSION,
|
363
|
+
transports_version_send: [:rest]
|
364
|
+
|
365
|
+
call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
366
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
367
|
+
|
368
|
+
options.apply_defaults timeout: @config.rpcs.delete_operation.timeout,
|
369
|
+
metadata: call_metadata,
|
370
|
+
retry_policy: @config.rpcs.delete_operation.retry_policy
|
371
|
+
|
372
|
+
options.apply_defaults timeout: @config.timeout,
|
373
|
+
metadata: @config.metadata,
|
374
|
+
retry_policy: @config.retry_policy
|
375
|
+
|
376
|
+
@operations_stub.delete_operation request, options do |result, operation|
|
377
|
+
yield result, operation if block_given?
|
378
|
+
return result
|
379
|
+
end
|
380
|
+
rescue ::Gapic::Rest::Error => e
|
381
|
+
raise ::Google::Cloud::Error.from_error(e)
|
382
|
+
end
|
383
|
+
|
384
|
+
##
|
385
|
+
# Starts asynchronous cancellation on a long-running operation. The server
|
386
|
+
# makes a best effort to cancel the operation, but success is not
|
387
|
+
# guaranteed. If the server doesn't support this method, it returns
|
388
|
+
# `google.rpc.Code.UNIMPLEMENTED`. Clients can use
|
389
|
+
# Operations.GetOperation or
|
390
|
+
# other methods to check whether the cancellation succeeded or whether the
|
391
|
+
# operation completed despite cancellation. On successful cancellation,
|
392
|
+
# the operation is not deleted; instead, it becomes an operation with
|
393
|
+
# an {::Google::Longrunning::Operation#error Operation.error} value with a {::Google::Rpc::Status#code google.rpc.Status.code} of 1,
|
394
|
+
# corresponding to `Code.CANCELLED`.
|
395
|
+
#
|
396
|
+
# @overload cancel_operation(request, options = nil)
|
397
|
+
# Pass arguments to `cancel_operation` via a request object, either of type
|
398
|
+
# {::Google::Longrunning::CancelOperationRequest} or an equivalent Hash.
|
399
|
+
#
|
400
|
+
# @param request [::Google::Longrunning::CancelOperationRequest, ::Hash]
|
401
|
+
# A request object representing the call parameters. Required. To specify no
|
402
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
403
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
404
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
405
|
+
#
|
406
|
+
# @overload cancel_operation(name: nil)
|
407
|
+
# Pass arguments to `cancel_operation` via keyword arguments. Note that at
|
408
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
409
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
410
|
+
#
|
411
|
+
# @param name [::String]
|
412
|
+
# The name of the operation resource to be cancelled.
|
413
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
414
|
+
# @yieldparam result [::Google::Protobuf::Empty]
|
415
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
416
|
+
#
|
417
|
+
# @return [::Google::Protobuf::Empty]
|
418
|
+
#
|
419
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
420
|
+
#
|
421
|
+
# @example Basic example
|
422
|
+
# require "google/longrunning"
|
423
|
+
#
|
424
|
+
# # Create a client object. The client can be reused for multiple calls.
|
425
|
+
# client = Google::Longrunning::Operations::Rest::Client.new
|
426
|
+
#
|
427
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
428
|
+
# request = Google::Longrunning::CancelOperationRequest.new
|
429
|
+
#
|
430
|
+
# # Call the cancel_operation method.
|
431
|
+
# result = client.cancel_operation request
|
432
|
+
#
|
433
|
+
# # The returned object is of type Google::Protobuf::Empty.
|
434
|
+
# p result
|
435
|
+
#
|
436
|
+
def cancel_operation request, options = nil
|
437
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
438
|
+
|
439
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::CancelOperationRequest
|
440
|
+
|
441
|
+
# Converts hash and nil to an options object
|
442
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
443
|
+
|
444
|
+
# Customize the options with defaults
|
445
|
+
call_metadata = @config.rpcs.cancel_operation.metadata.to_h
|
446
|
+
|
447
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
448
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
449
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
450
|
+
gapic_version: ::Google::Cloud::DiscoveryEngine::V1::VERSION,
|
451
|
+
transports_version_send: [:rest]
|
452
|
+
|
453
|
+
call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
454
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
455
|
+
|
456
|
+
options.apply_defaults timeout: @config.rpcs.cancel_operation.timeout,
|
457
|
+
metadata: call_metadata,
|
458
|
+
retry_policy: @config.rpcs.cancel_operation.retry_policy
|
459
|
+
|
460
|
+
options.apply_defaults timeout: @config.timeout,
|
461
|
+
metadata: @config.metadata,
|
462
|
+
retry_policy: @config.retry_policy
|
463
|
+
|
464
|
+
@operations_stub.cancel_operation request, options do |result, operation|
|
465
|
+
yield result, operation if block_given?
|
466
|
+
return result
|
467
|
+
end
|
468
|
+
rescue ::Gapic::Rest::Error => e
|
469
|
+
raise ::Google::Cloud::Error.from_error(e)
|
470
|
+
end
|
471
|
+
|
472
|
+
##
|
473
|
+
# Configuration class for the Operations REST API.
|
474
|
+
#
|
475
|
+
# This class represents the configuration for Operations REST,
|
476
|
+
# providing control over timeouts, retry behavior, logging, transport
|
477
|
+
# parameters, and other low-level controls. Certain parameters can also be
|
478
|
+
# applied individually to specific RPCs. See
|
479
|
+
# {::Google::Longrunning::Operations::Rest::Client::Configuration::Rpcs}
|
480
|
+
# for a list of RPCs that can be configured independently.
|
481
|
+
#
|
482
|
+
# Configuration can be applied globally to all clients, or to a single client
|
483
|
+
# on construction.
|
484
|
+
#
|
485
|
+
# @example
|
486
|
+
#
|
487
|
+
# # Modify the global config, setting the timeout for
|
488
|
+
# # list_operations to 20 seconds,
|
489
|
+
# # and all remaining timeouts to 10 seconds.
|
490
|
+
# ::Google::Longrunning::Operations::Rest::Client.configure do |config|
|
491
|
+
# config.timeout = 10.0
|
492
|
+
# config.rpcs.list_operations.timeout = 20.0
|
493
|
+
# end
|
494
|
+
#
|
495
|
+
# # Apply the above configuration only to a new client.
|
496
|
+
# client = ::Google::Longrunning::Operations::Rest::Client.new do |config|
|
497
|
+
# config.timeout = 10.0
|
498
|
+
# config.rpcs.list_operations.timeout = 20.0
|
499
|
+
# end
|
500
|
+
#
|
501
|
+
# @!attribute [rw] endpoint
|
502
|
+
# A custom service endpoint, as a hostname or hostname:port. The default is
|
503
|
+
# nil, indicating to use the default endpoint in the current universe domain.
|
504
|
+
# @return [::String,nil]
|
505
|
+
# @!attribute [rw] credentials
|
506
|
+
# Credentials to send with calls. You may provide any of the following types:
|
507
|
+
# * (`String`) The path to a service account key file in JSON format
|
508
|
+
# * (`Hash`) A service account key as a Hash
|
509
|
+
# * (`Google::Auth::Credentials`) A googleauth credentials object
|
510
|
+
# (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
|
511
|
+
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
512
|
+
# (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
|
513
|
+
# * (`nil`) indicating no credentials
|
514
|
+
# @return [::Object]
|
515
|
+
# @!attribute [rw] scope
|
516
|
+
# The OAuth scopes
|
517
|
+
# @return [::Array<::String>]
|
518
|
+
# @!attribute [rw] lib_name
|
519
|
+
# The library name as recorded in instrumentation and logging
|
520
|
+
# @return [::String]
|
521
|
+
# @!attribute [rw] lib_version
|
522
|
+
# The library version as recorded in instrumentation and logging
|
523
|
+
# @return [::String]
|
524
|
+
# @!attribute [rw] timeout
|
525
|
+
# The call timeout in seconds.
|
526
|
+
# @return [::Numeric]
|
527
|
+
# @!attribute [rw] metadata
|
528
|
+
# Additional headers to be sent with the call.
|
529
|
+
# @return [::Hash{::Symbol=>::String}]
|
530
|
+
# @!attribute [rw] retry_policy
|
531
|
+
# The retry policy. The value is a hash with the following keys:
|
532
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
533
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
534
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
535
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
536
|
+
# trigger a retry.
|
537
|
+
# @return [::Hash]
|
538
|
+
# @!attribute [rw] quota_project
|
539
|
+
# A separate project against which to charge quota.
|
540
|
+
# @return [::String]
|
541
|
+
# @!attribute [rw] universe_domain
|
542
|
+
# The universe domain within which to make requests. This determines the
|
543
|
+
# default endpoint URL. The default value of nil uses the environment
|
544
|
+
# universe (usually the default "googleapis.com" universe).
|
545
|
+
# @return [::String,nil]
|
546
|
+
#
|
547
|
+
class Configuration
|
548
|
+
extend ::Gapic::Config
|
549
|
+
|
550
|
+
# @private
|
551
|
+
# The endpoint specific to the default "googleapis.com" universe. Deprecated.
|
552
|
+
DEFAULT_ENDPOINT = "discoveryengine.googleapis.com"
|
553
|
+
|
554
|
+
config_attr :endpoint, nil, ::String, nil
|
555
|
+
config_attr :credentials, nil do |value|
|
556
|
+
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
557
|
+
allowed.any? { |klass| klass === value }
|
558
|
+
end
|
559
|
+
config_attr :scope, nil, ::String, ::Array, nil
|
560
|
+
config_attr :lib_name, nil, ::String, nil
|
561
|
+
config_attr :lib_version, nil, ::String, nil
|
562
|
+
config_attr :timeout, nil, ::Numeric, nil
|
563
|
+
config_attr :metadata, nil, ::Hash, nil
|
564
|
+
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
565
|
+
config_attr :quota_project, nil, ::String, nil
|
566
|
+
config_attr :universe_domain, nil, ::String, nil
|
567
|
+
|
568
|
+
# @private
|
569
|
+
def initialize parent_config = nil
|
570
|
+
@parent_config = parent_config unless parent_config.nil?
|
571
|
+
|
572
|
+
yield self if block_given?
|
573
|
+
end
|
574
|
+
|
575
|
+
##
|
576
|
+
# Configurations for individual RPCs
|
577
|
+
# @return [Rpcs]
|
578
|
+
#
|
579
|
+
def rpcs
|
580
|
+
@rpcs ||= begin
|
581
|
+
parent_rpcs = nil
|
582
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
|
583
|
+
Rpcs.new parent_rpcs
|
584
|
+
end
|
585
|
+
end
|
586
|
+
|
587
|
+
##
|
588
|
+
# Configuration RPC class for the Operations API.
|
589
|
+
#
|
590
|
+
# Includes fields providing the configuration for each RPC in this service.
|
591
|
+
# Each configuration object is of type `Gapic::Config::Method` and includes
|
592
|
+
# the following configuration fields:
|
593
|
+
#
|
594
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in seconds
|
595
|
+
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
|
596
|
+
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
597
|
+
# include the following keys:
|
598
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
599
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
600
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
601
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
602
|
+
# trigger a retry.
|
603
|
+
#
|
604
|
+
class Rpcs
|
605
|
+
##
|
606
|
+
# RPC-specific configuration for `list_operations`
|
607
|
+
# @return [::Gapic::Config::Method]
|
608
|
+
#
|
609
|
+
attr_reader :list_operations
|
610
|
+
##
|
611
|
+
# RPC-specific configuration for `get_operation`
|
612
|
+
# @return [::Gapic::Config::Method]
|
613
|
+
#
|
614
|
+
attr_reader :get_operation
|
615
|
+
##
|
616
|
+
# RPC-specific configuration for `delete_operation`
|
617
|
+
# @return [::Gapic::Config::Method]
|
618
|
+
#
|
619
|
+
attr_reader :delete_operation
|
620
|
+
##
|
621
|
+
# RPC-specific configuration for `cancel_operation`
|
622
|
+
# @return [::Gapic::Config::Method]
|
623
|
+
#
|
624
|
+
attr_reader :cancel_operation
|
625
|
+
|
626
|
+
# @private
|
627
|
+
def initialize parent_rpcs = nil
|
628
|
+
list_operations_config = parent_rpcs.list_operations if parent_rpcs.respond_to? :list_operations
|
629
|
+
@list_operations = ::Gapic::Config::Method.new list_operations_config
|
630
|
+
get_operation_config = parent_rpcs.get_operation if parent_rpcs.respond_to? :get_operation
|
631
|
+
@get_operation = ::Gapic::Config::Method.new get_operation_config
|
632
|
+
delete_operation_config = parent_rpcs.delete_operation if parent_rpcs.respond_to? :delete_operation
|
633
|
+
@delete_operation = ::Gapic::Config::Method.new delete_operation_config
|
634
|
+
cancel_operation_config = parent_rpcs.cancel_operation if parent_rpcs.respond_to? :cancel_operation
|
635
|
+
@cancel_operation = ::Gapic::Config::Method.new cancel_operation_config
|
636
|
+
|
637
|
+
yield self if block_given?
|
638
|
+
end
|
639
|
+
end
|
640
|
+
end
|
641
|
+
end
|
642
|
+
|
643
|
+
##
|
644
|
+
# @private
|
645
|
+
# REST service stub for the Longrunning Operations API.
|
646
|
+
# Service stub contains baseline method implementations
|
647
|
+
# including transcoding, making the REST call, and deserialing the response.
|
648
|
+
class OperationsServiceStub
|
649
|
+
def initialize endpoint:, endpoint_template:, universe_domain:, credentials:
|
650
|
+
# These require statements are intentionally placed here to initialize
|
651
|
+
# the REST modules only when it's required.
|
652
|
+
require "gapic/rest"
|
653
|
+
|
654
|
+
@client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint,
|
655
|
+
endpoint_template: endpoint_template,
|
656
|
+
universe_domain: universe_domain,
|
657
|
+
credentials: credentials
|
658
|
+
end
|
659
|
+
|
660
|
+
##
|
661
|
+
# Baseline implementation for the list_operations REST call
|
662
|
+
#
|
663
|
+
# @param request_pb [::Google::Longrunning::ListOperationsRequest]
|
664
|
+
# A request object representing the call parameters. Required.
|
665
|
+
# @param options [::Gapic::CallOptions]
|
666
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
667
|
+
#
|
668
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
669
|
+
# @yieldparam result [::Google::Longrunning::ListOperationsResponse]
|
670
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
671
|
+
#
|
672
|
+
# @return [::Google::Longrunning::ListOperationsResponse]
|
673
|
+
# A result object deserialized from the server's reply
|
674
|
+
def list_operations request_pb, options = nil
|
675
|
+
raise ::ArgumentError, "request must be provided" if request_pb.nil?
|
676
|
+
|
677
|
+
verb, uri, query_string_params, body = OperationsServiceStub.transcode_list_operations_request request_pb
|
678
|
+
query_string_params = if query_string_params.any?
|
679
|
+
query_string_params.to_h { |p| p.split "=", 2 }
|
680
|
+
else
|
681
|
+
{}
|
682
|
+
end
|
683
|
+
|
684
|
+
response = @client_stub.make_http_request(
|
685
|
+
verb,
|
686
|
+
uri: uri,
|
687
|
+
body: body || "",
|
688
|
+
params: query_string_params,
|
689
|
+
options: options
|
690
|
+
)
|
691
|
+
operation = ::Gapic::Rest::TransportOperation.new response
|
692
|
+
result = ::Google::Longrunning::ListOperationsResponse.decode_json response.body, ignore_unknown_fields: true
|
693
|
+
|
694
|
+
yield result, operation if block_given?
|
695
|
+
result
|
696
|
+
end
|
697
|
+
|
698
|
+
##
|
699
|
+
# Baseline implementation for the get_operation REST call
|
700
|
+
#
|
701
|
+
# @param request_pb [::Google::Longrunning::GetOperationRequest]
|
702
|
+
# A request object representing the call parameters. Required.
|
703
|
+
# @param options [::Gapic::CallOptions]
|
704
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
705
|
+
#
|
706
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
707
|
+
# @yieldparam result [::Google::Longrunning::Operation]
|
708
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
709
|
+
#
|
710
|
+
# @return [::Google::Longrunning::Operation]
|
711
|
+
# A result object deserialized from the server's reply
|
712
|
+
def get_operation request_pb, options = nil
|
713
|
+
raise ::ArgumentError, "request must be provided" if request_pb.nil?
|
714
|
+
|
715
|
+
verb, uri, query_string_params, body = OperationsServiceStub.transcode_get_operation_request request_pb
|
716
|
+
query_string_params = if query_string_params.any?
|
717
|
+
query_string_params.to_h { |p| p.split "=", 2 }
|
718
|
+
else
|
719
|
+
{}
|
720
|
+
end
|
721
|
+
|
722
|
+
response = @client_stub.make_http_request(
|
723
|
+
verb,
|
724
|
+
uri: uri,
|
725
|
+
body: body || "",
|
726
|
+
params: query_string_params,
|
727
|
+
options: options
|
728
|
+
)
|
729
|
+
operation = ::Gapic::Rest::TransportOperation.new response
|
730
|
+
result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true
|
731
|
+
|
732
|
+
yield result, operation if block_given?
|
733
|
+
result
|
734
|
+
end
|
735
|
+
|
736
|
+
##
|
737
|
+
# Baseline implementation for the delete_operation REST call
|
738
|
+
#
|
739
|
+
# @param request_pb [::Google::Longrunning::DeleteOperationRequest]
|
740
|
+
# A request object representing the call parameters. Required.
|
741
|
+
# @param options [::Gapic::CallOptions]
|
742
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
743
|
+
#
|
744
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
745
|
+
# @yieldparam result [::Google::Protobuf::Empty]
|
746
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
747
|
+
#
|
748
|
+
# @return [::Google::Protobuf::Empty]
|
749
|
+
# A result object deserialized from the server's reply
|
750
|
+
def delete_operation request_pb, options = nil
|
751
|
+
raise ::ArgumentError, "request must be provided" if request_pb.nil?
|
752
|
+
|
753
|
+
verb, uri, query_string_params, body = OperationsServiceStub.transcode_delete_operation_request request_pb
|
754
|
+
query_string_params = if query_string_params.any?
|
755
|
+
query_string_params.to_h { |p| p.split "=", 2 }
|
756
|
+
else
|
757
|
+
{}
|
758
|
+
end
|
759
|
+
|
760
|
+
response = @client_stub.make_http_request(
|
761
|
+
verb,
|
762
|
+
uri: uri,
|
763
|
+
body: body || "",
|
764
|
+
params: query_string_params,
|
765
|
+
options: options
|
766
|
+
)
|
767
|
+
operation = ::Gapic::Rest::TransportOperation.new response
|
768
|
+
result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true
|
769
|
+
|
770
|
+
yield result, operation if block_given?
|
771
|
+
result
|
772
|
+
end
|
773
|
+
|
774
|
+
##
|
775
|
+
# Baseline implementation for the cancel_operation REST call
|
776
|
+
#
|
777
|
+
# @param request_pb [::Google::Longrunning::CancelOperationRequest]
|
778
|
+
# A request object representing the call parameters. Required.
|
779
|
+
# @param options [::Gapic::CallOptions]
|
780
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
781
|
+
#
|
782
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
783
|
+
# @yieldparam result [::Google::Protobuf::Empty]
|
784
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
785
|
+
#
|
786
|
+
# @return [::Google::Protobuf::Empty]
|
787
|
+
# A result object deserialized from the server's reply
|
788
|
+
def cancel_operation request_pb, options = nil
|
789
|
+
raise ::ArgumentError, "request must be provided" if request_pb.nil?
|
790
|
+
|
791
|
+
verb, uri, query_string_params, body = OperationsServiceStub.transcode_cancel_operation_request request_pb
|
792
|
+
query_string_params = if query_string_params.any?
|
793
|
+
query_string_params.to_h { |p| p.split "=", 2 }
|
794
|
+
else
|
795
|
+
{}
|
796
|
+
end
|
797
|
+
|
798
|
+
response = @client_stub.make_http_request(
|
799
|
+
verb,
|
800
|
+
uri: uri,
|
801
|
+
body: body || "",
|
802
|
+
params: query_string_params,
|
803
|
+
options: options
|
804
|
+
)
|
805
|
+
operation = ::Gapic::Rest::TransportOperation.new response
|
806
|
+
result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true
|
807
|
+
|
808
|
+
yield result, operation if block_given?
|
809
|
+
result
|
810
|
+
end
|
811
|
+
|
812
|
+
##
|
813
|
+
# @private
|
814
|
+
#
|
815
|
+
# GRPC transcoding helper method for the list_operations REST call
|
816
|
+
#
|
817
|
+
# @param request_pb [::Google::Longrunning::ListOperationsRequest]
|
818
|
+
# A request object representing the call parameters. Required.
|
819
|
+
# @return [Array(String, [String, nil], Hash{String => String})]
|
820
|
+
# Uri, Body, Query string parameters
|
821
|
+
def self.transcode_list_operations_request request_pb
|
822
|
+
transcoder = Gapic::Rest::GrpcTranscoder.new
|
823
|
+
.with_bindings(
|
824
|
+
uri_method: :get,
|
825
|
+
uri_template: "/v1/{name}/operations",
|
826
|
+
matches: [
|
827
|
+
["name", %r{^projects/[^/]+/?$}, false]
|
828
|
+
]
|
829
|
+
)
|
830
|
+
.with_bindings(
|
831
|
+
uri_method: :get,
|
832
|
+
uri_template: "/v1/{name}/operations",
|
833
|
+
matches: [
|
834
|
+
["name", %r{^projects/[^/]+/locations/[^/]+/collections/[^/]+/dataConnector/?$}, false]
|
835
|
+
]
|
836
|
+
)
|
837
|
+
.with_bindings(
|
838
|
+
uri_method: :get,
|
839
|
+
uri_template: "/v1/{name}/operations",
|
840
|
+
matches: [
|
841
|
+
["name", %r{^projects/[^/]+/locations/[^/]+/collections/[^/]+/dataStores/[^/]+/branches/[^/]+/?$}, false]
|
842
|
+
]
|
843
|
+
)
|
844
|
+
.with_bindings(
|
845
|
+
uri_method: :get,
|
846
|
+
uri_template: "/v1/{name}/operations",
|
847
|
+
matches: [
|
848
|
+
["name", %r{^projects/[^/]+/locations/[^/]+/collections/[^/]+/dataStores/[^/]+/models/[^/]+/?$}, false]
|
849
|
+
]
|
850
|
+
)
|
851
|
+
.with_bindings(
|
852
|
+
uri_method: :get,
|
853
|
+
uri_template: "/v1/{name}/operations",
|
854
|
+
matches: [
|
855
|
+
["name", %r{^projects/[^/]+/locations/[^/]+/collections/[^/]+/dataStores/[^/]+/schemas/[^/]+/?$}, false]
|
856
|
+
]
|
857
|
+
)
|
858
|
+
.with_bindings(
|
859
|
+
uri_method: :get,
|
860
|
+
uri_template: "/v1/{name}/operations",
|
861
|
+
matches: [
|
862
|
+
["name", %r{^projects/[^/]+/locations/[^/]+/collections/[^/]+/dataStores/[^/]+/siteSearchEngine/targetSites/?$}, false]
|
863
|
+
]
|
864
|
+
)
|
865
|
+
.with_bindings(
|
866
|
+
uri_method: :get,
|
867
|
+
uri_template: "/v1/{name}/operations",
|
868
|
+
matches: [
|
869
|
+
["name", %r{^projects/[^/]+/locations/[^/]+/collections/[^/]+/dataStores/[^/]+/siteSearchEngine/?$}, false]
|
870
|
+
]
|
871
|
+
)
|
872
|
+
.with_bindings(
|
873
|
+
uri_method: :get,
|
874
|
+
uri_template: "/v1/{name}/operations",
|
875
|
+
matches: [
|
876
|
+
["name", %r{^projects/[^/]+/locations/[^/]+/collections/[^/]+/dataStores/[^/]+/?$}, false]
|
877
|
+
]
|
878
|
+
)
|
879
|
+
.with_bindings(
|
880
|
+
uri_method: :get,
|
881
|
+
uri_template: "/v1/{name}/operations",
|
882
|
+
matches: [
|
883
|
+
["name", %r{^projects/[^/]+/locations/[^/]+/collections/[^/]+/engines/[^/]+/?$}, false]
|
884
|
+
]
|
885
|
+
)
|
886
|
+
.with_bindings(
|
887
|
+
uri_method: :get,
|
888
|
+
uri_template: "/v1/{name}/operations",
|
889
|
+
matches: [
|
890
|
+
["name", %r{^projects/[^/]+/locations/[^/]+/collections/[^/]+/?$}, false]
|
891
|
+
]
|
892
|
+
)
|
893
|
+
.with_bindings(
|
894
|
+
uri_method: :get,
|
895
|
+
uri_template: "/v1/{name}/operations",
|
896
|
+
matches: [
|
897
|
+
["name", %r{^projects/[^/]+/locations/[^/]+/dataStores/[^/]+/branches/[^/]+/?$}, false]
|
898
|
+
]
|
899
|
+
)
|
900
|
+
.with_bindings(
|
901
|
+
uri_method: :get,
|
902
|
+
uri_template: "/v1/{name}/operations",
|
903
|
+
matches: [
|
904
|
+
["name", %r{^projects/[^/]+/locations/[^/]+/dataStores/[^/]+/models/[^/]+/?$}, false]
|
905
|
+
]
|
906
|
+
)
|
907
|
+
.with_bindings(
|
908
|
+
uri_method: :get,
|
909
|
+
uri_template: "/v1/{name}/operations",
|
910
|
+
matches: [
|
911
|
+
["name", %r{^projects/[^/]+/locations/[^/]+/dataStores/[^/]+/?$}, false]
|
912
|
+
]
|
913
|
+
)
|
914
|
+
.with_bindings(
|
915
|
+
uri_method: :get,
|
916
|
+
uri_template: "/v1/{name}/operations",
|
917
|
+
matches: [
|
918
|
+
["name", %r{^projects/[^/]+/locations/[^/]+/?$}, false]
|
919
|
+
]
|
920
|
+
)
|
921
|
+
.with_bindings(
|
922
|
+
uri_method: :get,
|
923
|
+
uri_template: "/v1/{name}/operations",
|
924
|
+
matches: [
|
925
|
+
["name", %r{^projects/[^/]+/?$}, false]
|
926
|
+
]
|
927
|
+
)
|
928
|
+
transcoder.transcode request_pb
|
929
|
+
end
|
930
|
+
|
931
|
+
##
|
932
|
+
# @private
|
933
|
+
#
|
934
|
+
# GRPC transcoding helper method for the get_operation REST call
|
935
|
+
#
|
936
|
+
# @param request_pb [::Google::Longrunning::GetOperationRequest]
|
937
|
+
# A request object representing the call parameters. Required.
|
938
|
+
# @return [Array(String, [String, nil], Hash{String => String})]
|
939
|
+
# Uri, Body, Query string parameters
|
940
|
+
def self.transcode_get_operation_request request_pb
|
941
|
+
transcoder = Gapic::Rest::GrpcTranscoder.new
|
942
|
+
.with_bindings(
|
943
|
+
uri_method: :get,
|
944
|
+
uri_template: "/v1/{name}",
|
945
|
+
matches: [
|
946
|
+
["name", %r{^projects/[^/]+/operations/[^/]+/?$}, false]
|
947
|
+
]
|
948
|
+
)
|
949
|
+
.with_bindings(
|
950
|
+
uri_method: :get,
|
951
|
+
uri_template: "/v1/{name}",
|
952
|
+
matches: [
|
953
|
+
["name", %r{^projects/[^/]+/locations/[^/]+/collections/[^/]+/dataConnector/operations/[^/]+/?$}, false]
|
954
|
+
]
|
955
|
+
)
|
956
|
+
.with_bindings(
|
957
|
+
uri_method: :get,
|
958
|
+
uri_template: "/v1/{name}",
|
959
|
+
matches: [
|
960
|
+
["name", %r{^projects/[^/]+/locations/[^/]+/collections/[^/]+/dataStores/[^/]+/branches/[^/]+/operations/[^/]+/?$}, false]
|
961
|
+
]
|
962
|
+
)
|
963
|
+
.with_bindings(
|
964
|
+
uri_method: :get,
|
965
|
+
uri_template: "/v1/{name}",
|
966
|
+
matches: [
|
967
|
+
["name", %r{^projects/[^/]+/locations/[^/]+/collections/[^/]+/dataStores/[^/]+/models/[^/]+/operations/[^/]+/?$}, false]
|
968
|
+
]
|
969
|
+
)
|
970
|
+
.with_bindings(
|
971
|
+
uri_method: :get,
|
972
|
+
uri_template: "/v1/{name}",
|
973
|
+
matches: [
|
974
|
+
["name", %r{^projects/[^/]+/locations/[^/]+/collections/[^/]+/dataStores/[^/]+/operations/[^/]+/?$}, false]
|
975
|
+
]
|
976
|
+
)
|
977
|
+
.with_bindings(
|
978
|
+
uri_method: :get,
|
979
|
+
uri_template: "/v1/{name}",
|
980
|
+
matches: [
|
981
|
+
["name", %r{^projects/[^/]+/locations/[^/]+/collections/[^/]+/dataStores/[^/]+/schemas/[^/]+/operations/[^/]+/?$}, false]
|
982
|
+
]
|
983
|
+
)
|
984
|
+
.with_bindings(
|
985
|
+
uri_method: :get,
|
986
|
+
uri_template: "/v1/{name}",
|
987
|
+
matches: [
|
988
|
+
["name", %r{^projects/[^/]+/locations/[^/]+/collections/[^/]+/dataStores/[^/]+/siteSearchEngine/operations/[^/]+/?$}, false]
|
989
|
+
]
|
990
|
+
)
|
991
|
+
.with_bindings(
|
992
|
+
uri_method: :get,
|
993
|
+
uri_template: "/v1/{name}",
|
994
|
+
matches: [
|
995
|
+
["name", %r{^projects/[^/]+/locations/[^/]+/collections/[^/]+/dataStores/[^/]+/siteSearchEngine/targetSites/operations/[^/]+/?$}, false]
|
996
|
+
]
|
997
|
+
)
|
998
|
+
.with_bindings(
|
999
|
+
uri_method: :get,
|
1000
|
+
uri_template: "/v1/{name}",
|
1001
|
+
matches: [
|
1002
|
+
["name", %r{^projects/[^/]+/locations/[^/]+/collections/[^/]+/engines/[^/]+/operations/[^/]+/?$}, false]
|
1003
|
+
]
|
1004
|
+
)
|
1005
|
+
.with_bindings(
|
1006
|
+
uri_method: :get,
|
1007
|
+
uri_template: "/v1/{name}",
|
1008
|
+
matches: [
|
1009
|
+
["name", %r{^projects/[^/]+/locations/[^/]+/collections/[^/]+/operations/[^/]+/?$}, false]
|
1010
|
+
]
|
1011
|
+
)
|
1012
|
+
.with_bindings(
|
1013
|
+
uri_method: :get,
|
1014
|
+
uri_template: "/v1/{name}",
|
1015
|
+
matches: [
|
1016
|
+
["name", %r{^projects/[^/]+/locations/[^/]+/dataStores/[^/]+/branches/[^/]+/operations/[^/]+/?$}, false]
|
1017
|
+
]
|
1018
|
+
)
|
1019
|
+
.with_bindings(
|
1020
|
+
uri_method: :get,
|
1021
|
+
uri_template: "/v1/{name}",
|
1022
|
+
matches: [
|
1023
|
+
["name", %r{^projects/[^/]+/locations/[^/]+/dataStores/[^/]+/models/[^/]+/operations/[^/]+/?$}, false]
|
1024
|
+
]
|
1025
|
+
)
|
1026
|
+
.with_bindings(
|
1027
|
+
uri_method: :get,
|
1028
|
+
uri_template: "/v1/{name}",
|
1029
|
+
matches: [
|
1030
|
+
["name", %r{^projects/[^/]+/locations/[^/]+/dataStores/[^/]+/operations/[^/]+/?$}, false]
|
1031
|
+
]
|
1032
|
+
)
|
1033
|
+
.with_bindings(
|
1034
|
+
uri_method: :get,
|
1035
|
+
uri_template: "/v1/{name}",
|
1036
|
+
matches: [
|
1037
|
+
["name", %r{^projects/[^/]+/locations/[^/]+/operations/[^/]+/?$}, false]
|
1038
|
+
]
|
1039
|
+
)
|
1040
|
+
.with_bindings(
|
1041
|
+
uri_method: :get,
|
1042
|
+
uri_template: "/v1/{name}",
|
1043
|
+
matches: [
|
1044
|
+
["name", %r{^projects/[^/]+/operations/[^/]+/?$}, false]
|
1045
|
+
]
|
1046
|
+
)
|
1047
|
+
transcoder.transcode request_pb
|
1048
|
+
end
|
1049
|
+
|
1050
|
+
##
|
1051
|
+
# @private
|
1052
|
+
#
|
1053
|
+
# GRPC transcoding helper method for the delete_operation REST call
|
1054
|
+
#
|
1055
|
+
# @param request_pb [::Google::Longrunning::DeleteOperationRequest]
|
1056
|
+
# A request object representing the call parameters. Required.
|
1057
|
+
# @return [Array(String, [String, nil], Hash{String => String})]
|
1058
|
+
# Uri, Body, Query string parameters
|
1059
|
+
def self.transcode_delete_operation_request request_pb
|
1060
|
+
transcoder = Gapic::Rest::GrpcTranscoder.new
|
1061
|
+
.with_bindings(
|
1062
|
+
uri_method: :delete,
|
1063
|
+
uri_template: "/v1/{name}",
|
1064
|
+
matches: [
|
1065
|
+
["name", %r{^operations(?:/.*)?$}, true]
|
1066
|
+
]
|
1067
|
+
)
|
1068
|
+
transcoder.transcode request_pb
|
1069
|
+
end
|
1070
|
+
|
1071
|
+
##
|
1072
|
+
# @private
|
1073
|
+
#
|
1074
|
+
# GRPC transcoding helper method for the cancel_operation REST call
|
1075
|
+
#
|
1076
|
+
# @param request_pb [::Google::Longrunning::CancelOperationRequest]
|
1077
|
+
# A request object representing the call parameters. Required.
|
1078
|
+
# @return [Array(String, [String, nil], Hash{String => String})]
|
1079
|
+
# Uri, Body, Query string parameters
|
1080
|
+
def self.transcode_cancel_operation_request request_pb
|
1081
|
+
transcoder = Gapic::Rest::GrpcTranscoder.new
|
1082
|
+
.with_bindings(
|
1083
|
+
uri_method: :post,
|
1084
|
+
uri_template: "/v1/{name}:cancel",
|
1085
|
+
body: "*",
|
1086
|
+
matches: [
|
1087
|
+
["name", %r{^projects/[^/]+/operations/[^/]+/?$}, false]
|
1088
|
+
]
|
1089
|
+
)
|
1090
|
+
.with_bindings(
|
1091
|
+
uri_method: :post,
|
1092
|
+
uri_template: "/v1/{name}:cancel",
|
1093
|
+
body: "*",
|
1094
|
+
matches: [
|
1095
|
+
["name", %r{^projects/[^/]+/locations/[^/]+/collections/[^/]+/dataStores/[^/]+/branches/[^/]+/operations/[^/]+/?$}, false]
|
1096
|
+
]
|
1097
|
+
)
|
1098
|
+
.with_bindings(
|
1099
|
+
uri_method: :post,
|
1100
|
+
uri_template: "/v1/{name}:cancel",
|
1101
|
+
body: "*",
|
1102
|
+
matches: [
|
1103
|
+
["name", %r{^projects/[^/]+/locations/[^/]+/dataStores/[^/]+/branches/[^/]+/operations/[^/]+/?$}, false]
|
1104
|
+
]
|
1105
|
+
)
|
1106
|
+
transcoder.transcode request_pb
|
1107
|
+
end
|
1108
|
+
end
|
1109
|
+
end
|
1110
|
+
end
|
1111
|
+
end
|
1112
|
+
end
|
1113
|
+
end
|
1114
|
+
end
|