google-cloud-private_catalog-v1beta1 0.1.4 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/AUTHENTICATION.md +1 -1
- data/README.md +13 -8
- data/lib/google/cloud/private_catalog/v1beta1/private_catalog/client.rb +12 -18
- data/lib/google/cloud/private_catalog/v1beta1/private_catalog/rest/client.rb +547 -0
- data/lib/google/cloud/private_catalog/v1beta1/private_catalog/rest/service_stub.rb +267 -0
- data/lib/google/cloud/private_catalog/v1beta1/private_catalog/rest.rb +71 -0
- data/lib/google/cloud/private_catalog/v1beta1/private_catalog.rb +7 -1
- data/lib/google/cloud/private_catalog/v1beta1/rest.rb +37 -0
- data/lib/google/cloud/private_catalog/v1beta1/version.rb +1 -1
- data/lib/google/cloud/private_catalog/v1beta1.rb +8 -1
- data/lib/google/cloud/privatecatalog/v1beta1/private_catalog_pb.rb +2 -4
- data/proto_docs/google/api/client.rb +318 -0
- data/proto_docs/google/api/launch_stage.rb +71 -0
- data/proto_docs/google/protobuf/any.rb +3 -3
- data/proto_docs/google/protobuf/empty.rb +0 -2
- data/proto_docs/google/protobuf/struct.rb +2 -2
- data/proto_docs/google/rpc/status.rb +4 -2
- metadata +19 -14
- data/proto_docs/google/protobuf/field_mask.rb +0 -229
@@ -0,0 +1,547 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2023 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/privatecatalog/v1beta1/private_catalog_pb"
|
21
|
+
require "google/cloud/private_catalog/v1beta1/private_catalog/rest/service_stub"
|
22
|
+
|
23
|
+
module Google
|
24
|
+
module Cloud
|
25
|
+
module PrivateCatalog
|
26
|
+
module V1beta1
|
27
|
+
module PrivateCatalog
|
28
|
+
module Rest
|
29
|
+
##
|
30
|
+
# REST client for the PrivateCatalog service.
|
31
|
+
#
|
32
|
+
# `PrivateCatalog` allows catalog consumers to retrieve `Catalog`, `Product`
|
33
|
+
# and `Version` resources under a target resource context.
|
34
|
+
#
|
35
|
+
# `Catalog` is computed based on the [Association][]s linked to the target
|
36
|
+
# resource and its ancestors. Each association's
|
37
|
+
# [google.cloud.privatecatalogproducer.v1beta.Catalog][] is transformed into a
|
38
|
+
# `Catalog`. If multiple associations have the same parent
|
39
|
+
# [google.cloud.privatecatalogproducer.v1beta.Catalog][], they are
|
40
|
+
# de-duplicated into one `Catalog`. Users must have
|
41
|
+
# `cloudprivatecatalog.catalogTargets.get` IAM permission on the resource
|
42
|
+
# context in order to access catalogs. `Catalog` contains the resource name and
|
43
|
+
# a subset of data of the original
|
44
|
+
# [google.cloud.privatecatalogproducer.v1beta.Catalog][].
|
45
|
+
#
|
46
|
+
# `Product` is child resource of the catalog. A `Product` contains the resource
|
47
|
+
# name and a subset of the data of the original
|
48
|
+
# [google.cloud.privatecatalogproducer.v1beta.Product][].
|
49
|
+
#
|
50
|
+
# `Version` is child resource of the product. A `Version` contains the resource
|
51
|
+
# name and a subset of the data of the original
|
52
|
+
# [google.cloud.privatecatalogproducer.v1beta.Version][].
|
53
|
+
#
|
54
|
+
class Client
|
55
|
+
# @private
|
56
|
+
attr_reader :private_catalog_stub
|
57
|
+
|
58
|
+
##
|
59
|
+
# Configure the PrivateCatalog Client class.
|
60
|
+
#
|
61
|
+
# See {::Google::Cloud::PrivateCatalog::V1beta1::PrivateCatalog::Rest::Client::Configuration}
|
62
|
+
# for a description of the configuration fields.
|
63
|
+
#
|
64
|
+
# @example
|
65
|
+
#
|
66
|
+
# # Modify the configuration for all PrivateCatalog clients
|
67
|
+
# ::Google::Cloud::PrivateCatalog::V1beta1::PrivateCatalog::Rest::Client.configure do |config|
|
68
|
+
# config.timeout = 10.0
|
69
|
+
# end
|
70
|
+
#
|
71
|
+
# @yield [config] Configure the Client client.
|
72
|
+
# @yieldparam config [Client::Configuration]
|
73
|
+
#
|
74
|
+
# @return [Client::Configuration]
|
75
|
+
#
|
76
|
+
def self.configure
|
77
|
+
@configure ||= begin
|
78
|
+
namespace = ["Google", "Cloud", "PrivateCatalog", "V1beta1"]
|
79
|
+
parent_config = while namespace.any?
|
80
|
+
parent_name = namespace.join "::"
|
81
|
+
parent_const = const_get parent_name
|
82
|
+
break parent_const.configure if parent_const.respond_to? :configure
|
83
|
+
namespace.pop
|
84
|
+
end
|
85
|
+
default_config = Client::Configuration.new parent_config
|
86
|
+
|
87
|
+
default_config
|
88
|
+
end
|
89
|
+
yield @configure if block_given?
|
90
|
+
@configure
|
91
|
+
end
|
92
|
+
|
93
|
+
##
|
94
|
+
# Configure the PrivateCatalog Client instance.
|
95
|
+
#
|
96
|
+
# The configuration is set to the derived mode, meaning that values can be changed,
|
97
|
+
# but structural changes (adding new fields, etc.) are not allowed. Structural changes
|
98
|
+
# should be made on {Client.configure}.
|
99
|
+
#
|
100
|
+
# See {::Google::Cloud::PrivateCatalog::V1beta1::PrivateCatalog::Rest::Client::Configuration}
|
101
|
+
# for a description of the configuration fields.
|
102
|
+
#
|
103
|
+
# @yield [config] Configure the Client client.
|
104
|
+
# @yieldparam config [Client::Configuration]
|
105
|
+
#
|
106
|
+
# @return [Client::Configuration]
|
107
|
+
#
|
108
|
+
def configure
|
109
|
+
yield @config if block_given?
|
110
|
+
@config
|
111
|
+
end
|
112
|
+
|
113
|
+
##
|
114
|
+
# Create a new PrivateCatalog REST client object.
|
115
|
+
#
|
116
|
+
# @example
|
117
|
+
#
|
118
|
+
# # Create a client using the default configuration
|
119
|
+
# client = ::Google::Cloud::PrivateCatalog::V1beta1::PrivateCatalog::Rest::Client.new
|
120
|
+
#
|
121
|
+
# # Create a client using a custom configuration
|
122
|
+
# client = ::Google::Cloud::PrivateCatalog::V1beta1::PrivateCatalog::Rest::Client.new do |config|
|
123
|
+
# config.timeout = 10.0
|
124
|
+
# end
|
125
|
+
#
|
126
|
+
# @yield [config] Configure the PrivateCatalog client.
|
127
|
+
# @yieldparam config [Client::Configuration]
|
128
|
+
#
|
129
|
+
def initialize
|
130
|
+
# Create the configuration object
|
131
|
+
@config = Configuration.new Client.configure
|
132
|
+
|
133
|
+
# Yield the configuration if needed
|
134
|
+
yield @config if block_given?
|
135
|
+
|
136
|
+
# Create credentials
|
137
|
+
credentials = @config.credentials
|
138
|
+
# Use self-signed JWT if the endpoint is unchanged from default,
|
139
|
+
# but only if the default endpoint does not have a region prefix.
|
140
|
+
enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
|
141
|
+
!@config.endpoint.split(".").first.include?("-")
|
142
|
+
credentials ||= Credentials.default scope: @config.scope,
|
143
|
+
enable_self_signed_jwt: enable_self_signed_jwt
|
144
|
+
if credentials.is_a?(::String) || credentials.is_a?(::Hash)
|
145
|
+
credentials = Credentials.new credentials, scope: @config.scope
|
146
|
+
end
|
147
|
+
|
148
|
+
@quota_project_id = @config.quota_project
|
149
|
+
@quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
|
150
|
+
|
151
|
+
@private_catalog_stub = ::Google::Cloud::PrivateCatalog::V1beta1::PrivateCatalog::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials
|
152
|
+
end
|
153
|
+
|
154
|
+
# Service calls
|
155
|
+
|
156
|
+
##
|
157
|
+
# Search {::Google::Cloud::PrivateCatalog::V1beta1::Catalog Catalog} resources that consumers have access to, within the
|
158
|
+
# scope of the consumer cloud resource hierarchy context.
|
159
|
+
#
|
160
|
+
# @overload search_catalogs(request, options = nil)
|
161
|
+
# Pass arguments to `search_catalogs` via a request object, either of type
|
162
|
+
# {::Google::Cloud::PrivateCatalog::V1beta1::SearchCatalogsRequest} or an equivalent Hash.
|
163
|
+
#
|
164
|
+
# @param request [::Google::Cloud::PrivateCatalog::V1beta1::SearchCatalogsRequest, ::Hash]
|
165
|
+
# A request object representing the call parameters. Required. To specify no
|
166
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
167
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
168
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
169
|
+
#
|
170
|
+
# @overload search_catalogs(resource: nil, query: nil, page_size: nil, page_token: nil)
|
171
|
+
# Pass arguments to `search_catalogs` via keyword arguments. Note that at
|
172
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
173
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
174
|
+
#
|
175
|
+
# @param resource [::String]
|
176
|
+
# Required. The name of the resource context. It can be in following formats:
|
177
|
+
#
|
178
|
+
# * `projects/{project}`
|
179
|
+
# * `folders/{folder}`
|
180
|
+
# * `organizations/{organization}`
|
181
|
+
# @param query [::String]
|
182
|
+
# The query to filter the catalogs. The supported queries are:
|
183
|
+
#
|
184
|
+
# * Get a single catalog: `name=catalogs/{catalog}`
|
185
|
+
# @param page_size [::Integer]
|
186
|
+
# The maximum number of entries that are requested.
|
187
|
+
# @param page_token [::String]
|
188
|
+
# A pagination token returned from a previous call to SearchCatalogs that
|
189
|
+
# indicates where this listing should continue from.
|
190
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
191
|
+
# @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::PrivateCatalog::V1beta1::Catalog>]
|
192
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
193
|
+
#
|
194
|
+
# @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::PrivateCatalog::V1beta1::Catalog>]
|
195
|
+
#
|
196
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
197
|
+
def search_catalogs request, options = nil
|
198
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
199
|
+
|
200
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::PrivateCatalog::V1beta1::SearchCatalogsRequest
|
201
|
+
|
202
|
+
# Converts hash and nil to an options object
|
203
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
204
|
+
|
205
|
+
# Customize the options with defaults
|
206
|
+
call_metadata = @config.rpcs.search_catalogs.metadata.to_h
|
207
|
+
|
208
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
209
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
210
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
211
|
+
gapic_version: ::Google::Cloud::PrivateCatalog::V1beta1::VERSION,
|
212
|
+
transports_version_send: [:rest]
|
213
|
+
|
214
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
215
|
+
|
216
|
+
options.apply_defaults timeout: @config.rpcs.search_catalogs.timeout,
|
217
|
+
metadata: call_metadata,
|
218
|
+
retry_policy: @config.rpcs.search_catalogs.retry_policy
|
219
|
+
|
220
|
+
options.apply_defaults timeout: @config.timeout,
|
221
|
+
metadata: @config.metadata,
|
222
|
+
retry_policy: @config.retry_policy
|
223
|
+
|
224
|
+
@private_catalog_stub.search_catalogs request, options do |result, operation|
|
225
|
+
result = ::Gapic::Rest::PagedEnumerable.new @private_catalog_stub, :search_catalogs, "catalogs", request, result, options
|
226
|
+
yield result, operation if block_given?
|
227
|
+
return result
|
228
|
+
end
|
229
|
+
rescue ::Gapic::Rest::Error => e
|
230
|
+
raise ::Google::Cloud::Error.from_error(e)
|
231
|
+
end
|
232
|
+
|
233
|
+
##
|
234
|
+
# Search {::Google::Cloud::PrivateCatalog::V1beta1::Product Product} resources that consumers have access to, within the
|
235
|
+
# scope of the consumer cloud resource hierarchy context.
|
236
|
+
#
|
237
|
+
# @overload search_products(request, options = nil)
|
238
|
+
# Pass arguments to `search_products` via a request object, either of type
|
239
|
+
# {::Google::Cloud::PrivateCatalog::V1beta1::SearchProductsRequest} or an equivalent Hash.
|
240
|
+
#
|
241
|
+
# @param request [::Google::Cloud::PrivateCatalog::V1beta1::SearchProductsRequest, ::Hash]
|
242
|
+
# A request object representing the call parameters. Required. To specify no
|
243
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
244
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
245
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
246
|
+
#
|
247
|
+
# @overload search_products(resource: nil, query: nil, page_size: nil, page_token: nil)
|
248
|
+
# Pass arguments to `search_products` via keyword arguments. Note that at
|
249
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
250
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
251
|
+
#
|
252
|
+
# @param resource [::String]
|
253
|
+
# Required. The name of the resource context. See {::Google::Cloud::PrivateCatalog::V1beta1::SearchCatalogsRequest#resource SearchCatalogsRequest.resource}
|
254
|
+
# for details.
|
255
|
+
# @param query [::String]
|
256
|
+
# The query to filter the products.
|
257
|
+
#
|
258
|
+
# The supported queries are:
|
259
|
+
# * List products of all catalogs: empty
|
260
|
+
# * List products under a catalog: `parent=catalogs/{catalog}`
|
261
|
+
# * Get a product by name:
|
262
|
+
# `name=catalogs/{catalog}/products/{product}`
|
263
|
+
# @param page_size [::Integer]
|
264
|
+
# The maximum number of entries that are requested.
|
265
|
+
# @param page_token [::String]
|
266
|
+
# A pagination token returned from a previous call to SearchProducts that
|
267
|
+
# indicates where this listing should continue from.
|
268
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
269
|
+
# @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::PrivateCatalog::V1beta1::Product>]
|
270
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
271
|
+
#
|
272
|
+
# @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::PrivateCatalog::V1beta1::Product>]
|
273
|
+
#
|
274
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
275
|
+
def search_products request, options = nil
|
276
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
277
|
+
|
278
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::PrivateCatalog::V1beta1::SearchProductsRequest
|
279
|
+
|
280
|
+
# Converts hash and nil to an options object
|
281
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
282
|
+
|
283
|
+
# Customize the options with defaults
|
284
|
+
call_metadata = @config.rpcs.search_products.metadata.to_h
|
285
|
+
|
286
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
287
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
288
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
289
|
+
gapic_version: ::Google::Cloud::PrivateCatalog::V1beta1::VERSION,
|
290
|
+
transports_version_send: [:rest]
|
291
|
+
|
292
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
293
|
+
|
294
|
+
options.apply_defaults timeout: @config.rpcs.search_products.timeout,
|
295
|
+
metadata: call_metadata,
|
296
|
+
retry_policy: @config.rpcs.search_products.retry_policy
|
297
|
+
|
298
|
+
options.apply_defaults timeout: @config.timeout,
|
299
|
+
metadata: @config.metadata,
|
300
|
+
retry_policy: @config.retry_policy
|
301
|
+
|
302
|
+
@private_catalog_stub.search_products request, options do |result, operation|
|
303
|
+
result = ::Gapic::Rest::PagedEnumerable.new @private_catalog_stub, :search_products, "products", request, result, options
|
304
|
+
yield result, operation if block_given?
|
305
|
+
return result
|
306
|
+
end
|
307
|
+
rescue ::Gapic::Rest::Error => e
|
308
|
+
raise ::Google::Cloud::Error.from_error(e)
|
309
|
+
end
|
310
|
+
|
311
|
+
##
|
312
|
+
# Search {::Google::Cloud::PrivateCatalog::V1beta1::Version Version} resources that consumers have access to, within the
|
313
|
+
# scope of the consumer cloud resource hierarchy context.
|
314
|
+
#
|
315
|
+
# @overload search_versions(request, options = nil)
|
316
|
+
# Pass arguments to `search_versions` via a request object, either of type
|
317
|
+
# {::Google::Cloud::PrivateCatalog::V1beta1::SearchVersionsRequest} or an equivalent Hash.
|
318
|
+
#
|
319
|
+
# @param request [::Google::Cloud::PrivateCatalog::V1beta1::SearchVersionsRequest, ::Hash]
|
320
|
+
# A request object representing the call parameters. Required. To specify no
|
321
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
322
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
323
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
324
|
+
#
|
325
|
+
# @overload search_versions(resource: nil, query: nil, page_size: nil, page_token: nil)
|
326
|
+
# Pass arguments to `search_versions` via keyword arguments. Note that at
|
327
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
328
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
329
|
+
#
|
330
|
+
# @param resource [::String]
|
331
|
+
# Required. The name of the resource context. See {::Google::Cloud::PrivateCatalog::V1beta1::SearchCatalogsRequest#resource SearchCatalogsRequest.resource}
|
332
|
+
# for details.
|
333
|
+
# @param query [::String]
|
334
|
+
# Required. The query to filter the versions.
|
335
|
+
#
|
336
|
+
# The supported queries are:
|
337
|
+
# * List versions under a product:
|
338
|
+
# `parent=catalogs/{catalog}/products/{product}`
|
339
|
+
# * Get a version by name:
|
340
|
+
# `name=catalogs/{catalog}/products/{product}/versions/{version}`
|
341
|
+
# @param page_size [::Integer]
|
342
|
+
# The maximum number of entries that are requested.
|
343
|
+
# @param page_token [::String]
|
344
|
+
# A pagination token returned from a previous call to SearchVersions
|
345
|
+
# that indicates where this listing should continue from.
|
346
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
347
|
+
# @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::PrivateCatalog::V1beta1::Version>]
|
348
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
349
|
+
#
|
350
|
+
# @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::PrivateCatalog::V1beta1::Version>]
|
351
|
+
#
|
352
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
353
|
+
def search_versions request, options = nil
|
354
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
355
|
+
|
356
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::PrivateCatalog::V1beta1::SearchVersionsRequest
|
357
|
+
|
358
|
+
# Converts hash and nil to an options object
|
359
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
360
|
+
|
361
|
+
# Customize the options with defaults
|
362
|
+
call_metadata = @config.rpcs.search_versions.metadata.to_h
|
363
|
+
|
364
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
365
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
366
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
367
|
+
gapic_version: ::Google::Cloud::PrivateCatalog::V1beta1::VERSION,
|
368
|
+
transports_version_send: [:rest]
|
369
|
+
|
370
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
371
|
+
|
372
|
+
options.apply_defaults timeout: @config.rpcs.search_versions.timeout,
|
373
|
+
metadata: call_metadata,
|
374
|
+
retry_policy: @config.rpcs.search_versions.retry_policy
|
375
|
+
|
376
|
+
options.apply_defaults timeout: @config.timeout,
|
377
|
+
metadata: @config.metadata,
|
378
|
+
retry_policy: @config.retry_policy
|
379
|
+
|
380
|
+
@private_catalog_stub.search_versions request, options do |result, operation|
|
381
|
+
result = ::Gapic::Rest::PagedEnumerable.new @private_catalog_stub, :search_versions, "versions", request, result, options
|
382
|
+
yield result, operation if block_given?
|
383
|
+
return result
|
384
|
+
end
|
385
|
+
rescue ::Gapic::Rest::Error => e
|
386
|
+
raise ::Google::Cloud::Error.from_error(e)
|
387
|
+
end
|
388
|
+
|
389
|
+
##
|
390
|
+
# Configuration class for the PrivateCatalog REST API.
|
391
|
+
#
|
392
|
+
# This class represents the configuration for PrivateCatalog REST,
|
393
|
+
# providing control over timeouts, retry behavior, logging, transport
|
394
|
+
# parameters, and other low-level controls. Certain parameters can also be
|
395
|
+
# applied individually to specific RPCs. See
|
396
|
+
# {::Google::Cloud::PrivateCatalog::V1beta1::PrivateCatalog::Rest::Client::Configuration::Rpcs}
|
397
|
+
# for a list of RPCs that can be configured independently.
|
398
|
+
#
|
399
|
+
# Configuration can be applied globally to all clients, or to a single client
|
400
|
+
# on construction.
|
401
|
+
#
|
402
|
+
# @example
|
403
|
+
#
|
404
|
+
# # Modify the global config, setting the timeout for
|
405
|
+
# # search_catalogs to 20 seconds,
|
406
|
+
# # and all remaining timeouts to 10 seconds.
|
407
|
+
# ::Google::Cloud::PrivateCatalog::V1beta1::PrivateCatalog::Rest::Client.configure do |config|
|
408
|
+
# config.timeout = 10.0
|
409
|
+
# config.rpcs.search_catalogs.timeout = 20.0
|
410
|
+
# end
|
411
|
+
#
|
412
|
+
# # Apply the above configuration only to a new client.
|
413
|
+
# client = ::Google::Cloud::PrivateCatalog::V1beta1::PrivateCatalog::Rest::Client.new do |config|
|
414
|
+
# config.timeout = 10.0
|
415
|
+
# config.rpcs.search_catalogs.timeout = 20.0
|
416
|
+
# end
|
417
|
+
#
|
418
|
+
# @!attribute [rw] endpoint
|
419
|
+
# The hostname or hostname:port of the service endpoint.
|
420
|
+
# Defaults to `"cloudprivatecatalog.googleapis.com"`.
|
421
|
+
# @return [::String]
|
422
|
+
# @!attribute [rw] credentials
|
423
|
+
# Credentials to send with calls. You may provide any of the following types:
|
424
|
+
# * (`String`) The path to a service account key file in JSON format
|
425
|
+
# * (`Hash`) A service account key as a Hash
|
426
|
+
# * (`Google::Auth::Credentials`) A googleauth credentials object
|
427
|
+
# (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
|
428
|
+
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
429
|
+
# (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
|
430
|
+
# * (`nil`) indicating no credentials
|
431
|
+
# @return [::Object]
|
432
|
+
# @!attribute [rw] scope
|
433
|
+
# The OAuth scopes
|
434
|
+
# @return [::Array<::String>]
|
435
|
+
# @!attribute [rw] lib_name
|
436
|
+
# The library name as recorded in instrumentation and logging
|
437
|
+
# @return [::String]
|
438
|
+
# @!attribute [rw] lib_version
|
439
|
+
# The library version as recorded in instrumentation and logging
|
440
|
+
# @return [::String]
|
441
|
+
# @!attribute [rw] timeout
|
442
|
+
# The call timeout in seconds.
|
443
|
+
# @return [::Numeric]
|
444
|
+
# @!attribute [rw] metadata
|
445
|
+
# Additional headers to be sent with the call.
|
446
|
+
# @return [::Hash{::Symbol=>::String}]
|
447
|
+
# @!attribute [rw] retry_policy
|
448
|
+
# The retry policy. The value is a hash with the following keys:
|
449
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
450
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
451
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
452
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
453
|
+
# trigger a retry.
|
454
|
+
# @return [::Hash]
|
455
|
+
# @!attribute [rw] quota_project
|
456
|
+
# A separate project against which to charge quota.
|
457
|
+
# @return [::String]
|
458
|
+
#
|
459
|
+
class Configuration
|
460
|
+
extend ::Gapic::Config
|
461
|
+
|
462
|
+
config_attr :endpoint, "cloudprivatecatalog.googleapis.com", ::String
|
463
|
+
config_attr :credentials, nil do |value|
|
464
|
+
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
465
|
+
allowed.any? { |klass| klass === value }
|
466
|
+
end
|
467
|
+
config_attr :scope, nil, ::String, ::Array, nil
|
468
|
+
config_attr :lib_name, nil, ::String, nil
|
469
|
+
config_attr :lib_version, nil, ::String, nil
|
470
|
+
config_attr :timeout, nil, ::Numeric, nil
|
471
|
+
config_attr :metadata, nil, ::Hash, nil
|
472
|
+
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
473
|
+
config_attr :quota_project, nil, ::String, nil
|
474
|
+
|
475
|
+
# @private
|
476
|
+
def initialize parent_config = nil
|
477
|
+
@parent_config = parent_config unless parent_config.nil?
|
478
|
+
|
479
|
+
yield self if block_given?
|
480
|
+
end
|
481
|
+
|
482
|
+
##
|
483
|
+
# Configurations for individual RPCs
|
484
|
+
# @return [Rpcs]
|
485
|
+
#
|
486
|
+
def rpcs
|
487
|
+
@rpcs ||= begin
|
488
|
+
parent_rpcs = nil
|
489
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
|
490
|
+
Rpcs.new parent_rpcs
|
491
|
+
end
|
492
|
+
end
|
493
|
+
|
494
|
+
##
|
495
|
+
# Configuration RPC class for the PrivateCatalog API.
|
496
|
+
#
|
497
|
+
# Includes fields providing the configuration for each RPC in this service.
|
498
|
+
# Each configuration object is of type `Gapic::Config::Method` and includes
|
499
|
+
# the following configuration fields:
|
500
|
+
#
|
501
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in seconds
|
502
|
+
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
|
503
|
+
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
504
|
+
# include the following keys:
|
505
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
506
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
507
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
508
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
509
|
+
# trigger a retry.
|
510
|
+
#
|
511
|
+
class Rpcs
|
512
|
+
##
|
513
|
+
# RPC-specific configuration for `search_catalogs`
|
514
|
+
# @return [::Gapic::Config::Method]
|
515
|
+
#
|
516
|
+
attr_reader :search_catalogs
|
517
|
+
##
|
518
|
+
# RPC-specific configuration for `search_products`
|
519
|
+
# @return [::Gapic::Config::Method]
|
520
|
+
#
|
521
|
+
attr_reader :search_products
|
522
|
+
##
|
523
|
+
# RPC-specific configuration for `search_versions`
|
524
|
+
# @return [::Gapic::Config::Method]
|
525
|
+
#
|
526
|
+
attr_reader :search_versions
|
527
|
+
|
528
|
+
# @private
|
529
|
+
def initialize parent_rpcs = nil
|
530
|
+
search_catalogs_config = parent_rpcs.search_catalogs if parent_rpcs.respond_to? :search_catalogs
|
531
|
+
@search_catalogs = ::Gapic::Config::Method.new search_catalogs_config
|
532
|
+
search_products_config = parent_rpcs.search_products if parent_rpcs.respond_to? :search_products
|
533
|
+
@search_products = ::Gapic::Config::Method.new search_products_config
|
534
|
+
search_versions_config = parent_rpcs.search_versions if parent_rpcs.respond_to? :search_versions
|
535
|
+
@search_versions = ::Gapic::Config::Method.new search_versions_config
|
536
|
+
|
537
|
+
yield self if block_given?
|
538
|
+
end
|
539
|
+
end
|
540
|
+
end
|
541
|
+
end
|
542
|
+
end
|
543
|
+
end
|
544
|
+
end
|
545
|
+
end
|
546
|
+
end
|
547
|
+
end
|