google-cloud-private_catalog-v1beta1 0.1.0

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