google-cloud-service_directory-v1beta1 0.9.0 → 0.10.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,1743 @@
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/servicedirectory/v1beta1/registration_service_pb"
21
+ require "google/cloud/service_directory/v1beta1/registration_service/rest/service_stub"
22
+
23
+ module Google
24
+ module Cloud
25
+ module ServiceDirectory
26
+ module V1beta1
27
+ module RegistrationService
28
+ module Rest
29
+ ##
30
+ # REST client for the RegistrationService service.
31
+ #
32
+ # Service Directory API for registering services. It defines the following
33
+ # resource model:
34
+ #
35
+ # - The API has a collection of
36
+ # {::Google::Cloud::ServiceDirectory::V1beta1::Namespace Namespace}
37
+ # resources, named `projects/*/locations/*/namespaces/*`.
38
+ #
39
+ # - Each Namespace has a collection of
40
+ # {::Google::Cloud::ServiceDirectory::V1beta1::Service Service} resources, named
41
+ # `projects/*/locations/*/namespaces/*/services/*`.
42
+ #
43
+ # - Each Service has a collection of
44
+ # {::Google::Cloud::ServiceDirectory::V1beta1::Endpoint Endpoint}
45
+ # resources, named
46
+ # `projects/*/locations/*/namespaces/*/services/*/endpoints/*`.
47
+ #
48
+ class Client
49
+ include Paths
50
+
51
+ # @private
52
+ attr_reader :registration_service_stub
53
+
54
+ ##
55
+ # Configure the RegistrationService Client class.
56
+ #
57
+ # See {::Google::Cloud::ServiceDirectory::V1beta1::RegistrationService::Rest::Client::Configuration}
58
+ # for a description of the configuration fields.
59
+ #
60
+ # @example
61
+ #
62
+ # # Modify the configuration for all RegistrationService clients
63
+ # ::Google::Cloud::ServiceDirectory::V1beta1::RegistrationService::Rest::Client.configure do |config|
64
+ # config.timeout = 10.0
65
+ # end
66
+ #
67
+ # @yield [config] Configure the Client client.
68
+ # @yieldparam config [Client::Configuration]
69
+ #
70
+ # @return [Client::Configuration]
71
+ #
72
+ def self.configure
73
+ @configure ||= begin
74
+ namespace = ["Google", "Cloud", "ServiceDirectory", "V1beta1"]
75
+ parent_config = while namespace.any?
76
+ parent_name = namespace.join "::"
77
+ parent_const = const_get parent_name
78
+ break parent_const.configure if parent_const.respond_to? :configure
79
+ namespace.pop
80
+ end
81
+ default_config = Client::Configuration.new parent_config
82
+
83
+ default_config.timeout = 15.0
84
+ default_config.retry_policy = {
85
+ initial_delay: 1.0, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 2]
86
+ }
87
+
88
+ default_config
89
+ end
90
+ yield @configure if block_given?
91
+ @configure
92
+ end
93
+
94
+ ##
95
+ # Configure the RegistrationService Client instance.
96
+ #
97
+ # The configuration is set to the derived mode, meaning that values can be changed,
98
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
99
+ # should be made on {Client.configure}.
100
+ #
101
+ # See {::Google::Cloud::ServiceDirectory::V1beta1::RegistrationService::Rest::Client::Configuration}
102
+ # for a description of the configuration fields.
103
+ #
104
+ # @yield [config] Configure the Client client.
105
+ # @yieldparam config [Client::Configuration]
106
+ #
107
+ # @return [Client::Configuration]
108
+ #
109
+ def configure
110
+ yield @config if block_given?
111
+ @config
112
+ end
113
+
114
+ ##
115
+ # Create a new RegistrationService REST client object.
116
+ #
117
+ # @example
118
+ #
119
+ # # Create a client using the default configuration
120
+ # client = ::Google::Cloud::ServiceDirectory::V1beta1::RegistrationService::Rest::Client.new
121
+ #
122
+ # # Create a client using a custom configuration
123
+ # client = ::Google::Cloud::ServiceDirectory::V1beta1::RegistrationService::Rest::Client.new do |config|
124
+ # config.timeout = 10.0
125
+ # end
126
+ #
127
+ # @yield [config] Configure the RegistrationService client.
128
+ # @yieldparam config [Client::Configuration]
129
+ #
130
+ def initialize
131
+ # Create the configuration object
132
+ @config = Configuration.new Client.configure
133
+
134
+ # Yield the configuration if needed
135
+ yield @config if block_given?
136
+
137
+ # Create credentials
138
+ credentials = @config.credentials
139
+ # Use self-signed JWT if the endpoint is unchanged from default,
140
+ # but only if the default endpoint does not have a region prefix.
141
+ enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
142
+ !@config.endpoint.split(".").first.include?("-")
143
+ credentials ||= Credentials.default scope: @config.scope,
144
+ enable_self_signed_jwt: enable_self_signed_jwt
145
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
146
+ credentials = Credentials.new credentials, scope: @config.scope
147
+ end
148
+
149
+ @quota_project_id = @config.quota_project
150
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
151
+
152
+ @registration_service_stub = ::Google::Cloud::ServiceDirectory::V1beta1::RegistrationService::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials
153
+ end
154
+
155
+ # Service calls
156
+
157
+ ##
158
+ # Creates a namespace, and returns the new namespace.
159
+ #
160
+ # @overload create_namespace(request, options = nil)
161
+ # Pass arguments to `create_namespace` via a request object, either of type
162
+ # {::Google::Cloud::ServiceDirectory::V1beta1::CreateNamespaceRequest} or an equivalent Hash.
163
+ #
164
+ # @param request [::Google::Cloud::ServiceDirectory::V1beta1::CreateNamespaceRequest, ::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 create_namespace(parent: nil, namespace_id: nil, namespace: nil)
171
+ # Pass arguments to `create_namespace` 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 parent [::String]
176
+ # Required. The resource name of the project and location the namespace
177
+ # will be created in.
178
+ # @param namespace_id [::String]
179
+ # Required. The Resource ID must be 1-63 characters long, and comply with
180
+ # <a href="https://www.ietf.org/rfc/rfc1035.txt" target="_blank">RFC1035</a>.
181
+ # Specifically, the name must be 1-63 characters long and match the regular
182
+ # expression `[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?` which means the first
183
+ # character must be a lowercase letter, and all following characters must
184
+ # be a dash, lowercase letter, or digit, except the last character, which
185
+ # cannot be a dash.
186
+ # @param namespace [::Google::Cloud::ServiceDirectory::V1beta1::Namespace, ::Hash]
187
+ # Required. A namespace with initial fields set.
188
+ # @yield [result, operation] Access the result along with the TransportOperation object
189
+ # @yieldparam result [::Google::Cloud::ServiceDirectory::V1beta1::Namespace]
190
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
191
+ #
192
+ # @return [::Google::Cloud::ServiceDirectory::V1beta1::Namespace]
193
+ #
194
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
195
+ def create_namespace request, options = nil
196
+ raise ::ArgumentError, "request must be provided" if request.nil?
197
+
198
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::ServiceDirectory::V1beta1::CreateNamespaceRequest
199
+
200
+ # Converts hash and nil to an options object
201
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
202
+
203
+ # Customize the options with defaults
204
+ call_metadata = @config.rpcs.create_namespace.metadata.to_h
205
+
206
+ # Set x-goog-api-client and x-goog-user-project headers
207
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
208
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
209
+ gapic_version: ::Google::Cloud::ServiceDirectory::V1beta1::VERSION,
210
+ transports_version_send: [:rest]
211
+
212
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
213
+
214
+ options.apply_defaults timeout: @config.rpcs.create_namespace.timeout,
215
+ metadata: call_metadata,
216
+ retry_policy: @config.rpcs.create_namespace.retry_policy
217
+
218
+ options.apply_defaults timeout: @config.timeout,
219
+ metadata: @config.metadata,
220
+ retry_policy: @config.retry_policy
221
+
222
+ @registration_service_stub.create_namespace request, options do |result, operation|
223
+ yield result, operation if block_given?
224
+ return result
225
+ end
226
+ rescue ::Gapic::Rest::Error => e
227
+ raise ::Google::Cloud::Error.from_error(e)
228
+ end
229
+
230
+ ##
231
+ # Lists all namespaces.
232
+ #
233
+ # @overload list_namespaces(request, options = nil)
234
+ # Pass arguments to `list_namespaces` via a request object, either of type
235
+ # {::Google::Cloud::ServiceDirectory::V1beta1::ListNamespacesRequest} or an equivalent Hash.
236
+ #
237
+ # @param request [::Google::Cloud::ServiceDirectory::V1beta1::ListNamespacesRequest, ::Hash]
238
+ # A request object representing the call parameters. Required. To specify no
239
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
240
+ # @param options [::Gapic::CallOptions, ::Hash]
241
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
242
+ #
243
+ # @overload list_namespaces(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil)
244
+ # Pass arguments to `list_namespaces` via keyword arguments. Note that at
245
+ # least one keyword argument is required. To specify no parameters, or to keep all
246
+ # the default parameter values, pass an empty Hash as a request object (see above).
247
+ #
248
+ # @param parent [::String]
249
+ # Required. The resource name of the project and location whose namespaces you'd like
250
+ # to list.
251
+ # @param page_size [::Integer]
252
+ # Optional. The maximum number of items to return.
253
+ # @param page_token [::String]
254
+ # Optional. The next_page_token value returned from a previous List request, if any.
255
+ # @param filter [::String]
256
+ # Optional. The filter to list results by.
257
+ #
258
+ # General `filter` string syntax:
259
+ # `<field> <operator> <value> (<logical connector>)`
260
+ #
261
+ # * `<field>` can be `name` or `labels.<key>` for map field
262
+ # * `<operator>` can be `<`, `>`, `<=`, `>=`, `!=`, `=`, `:`. Of which `:`
263
+ # means `HAS`, and is roughly the same as `=`
264
+ # * `<value>` must be the same data type as field
265
+ # * `<logical connector>` can be `AND`, `OR`, `NOT`
266
+ #
267
+ # Examples of valid filters:
268
+ #
269
+ # * `labels.owner` returns namespaces that have a label with the key
270
+ # `owner`, this is the same as `labels:owner`
271
+ # * `labels.owner=sd` returns namespaces that have key/value `owner=sd`
272
+ # * `name>projects/my-project/locations/us-east1/namespaces/namespace-c`
273
+ # returns namespaces that have name that is alphabetically later than the
274
+ # string, so "namespace-e" is returned but "namespace-a" is not
275
+ # * `labels.owner!=sd AND labels.foo=bar` returns namespaces that have
276
+ # `owner` in label key but value is not `sd` AND have key/value `foo=bar`
277
+ # * `doesnotexist.foo=bar` returns an empty list. Note that namespace
278
+ # doesn't have a field called "doesnotexist". Since the filter does not
279
+ # match any namespaces, it returns no results
280
+ #
281
+ # For more information about filtering, see
282
+ # [API Filtering](https://aip.dev/160).
283
+ # @param order_by [::String]
284
+ # Optional. The order to list results by.
285
+ #
286
+ # General `order_by` string syntax: `<field> (<asc|desc>) (,)`
287
+ #
288
+ # * `<field>` allows value: `name`
289
+ # * `<asc|desc>` ascending or descending order by `<field>`. If this is
290
+ # left blank, `asc` is used
291
+ #
292
+ # Note that an empty `order_by` string results in default order, which is
293
+ # order by `name` in ascending order.
294
+ # @yield [result, operation] Access the result along with the TransportOperation object
295
+ # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::ServiceDirectory::V1beta1::Namespace>]
296
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
297
+ #
298
+ # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::ServiceDirectory::V1beta1::Namespace>]
299
+ #
300
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
301
+ def list_namespaces request, options = nil
302
+ raise ::ArgumentError, "request must be provided" if request.nil?
303
+
304
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::ServiceDirectory::V1beta1::ListNamespacesRequest
305
+
306
+ # Converts hash and nil to an options object
307
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
308
+
309
+ # Customize the options with defaults
310
+ call_metadata = @config.rpcs.list_namespaces.metadata.to_h
311
+
312
+ # Set x-goog-api-client and x-goog-user-project headers
313
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
314
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
315
+ gapic_version: ::Google::Cloud::ServiceDirectory::V1beta1::VERSION,
316
+ transports_version_send: [:rest]
317
+
318
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
319
+
320
+ options.apply_defaults timeout: @config.rpcs.list_namespaces.timeout,
321
+ metadata: call_metadata,
322
+ retry_policy: @config.rpcs.list_namespaces.retry_policy
323
+
324
+ options.apply_defaults timeout: @config.timeout,
325
+ metadata: @config.metadata,
326
+ retry_policy: @config.retry_policy
327
+
328
+ @registration_service_stub.list_namespaces request, options do |result, operation|
329
+ result = ::Gapic::Rest::PagedEnumerable.new @registration_service_stub, :list_namespaces, "namespaces", request, result, options
330
+ yield result, operation if block_given?
331
+ return result
332
+ end
333
+ rescue ::Gapic::Rest::Error => e
334
+ raise ::Google::Cloud::Error.from_error(e)
335
+ end
336
+
337
+ ##
338
+ # Gets a namespace.
339
+ #
340
+ # @overload get_namespace(request, options = nil)
341
+ # Pass arguments to `get_namespace` via a request object, either of type
342
+ # {::Google::Cloud::ServiceDirectory::V1beta1::GetNamespaceRequest} or an equivalent Hash.
343
+ #
344
+ # @param request [::Google::Cloud::ServiceDirectory::V1beta1::GetNamespaceRequest, ::Hash]
345
+ # A request object representing the call parameters. Required. To specify no
346
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
347
+ # @param options [::Gapic::CallOptions, ::Hash]
348
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
349
+ #
350
+ # @overload get_namespace(name: nil)
351
+ # Pass arguments to `get_namespace` via keyword arguments. Note that at
352
+ # least one keyword argument is required. To specify no parameters, or to keep all
353
+ # the default parameter values, pass an empty Hash as a request object (see above).
354
+ #
355
+ # @param name [::String]
356
+ # Required. The name of the namespace to retrieve.
357
+ # @yield [result, operation] Access the result along with the TransportOperation object
358
+ # @yieldparam result [::Google::Cloud::ServiceDirectory::V1beta1::Namespace]
359
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
360
+ #
361
+ # @return [::Google::Cloud::ServiceDirectory::V1beta1::Namespace]
362
+ #
363
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
364
+ def get_namespace request, options = nil
365
+ raise ::ArgumentError, "request must be provided" if request.nil?
366
+
367
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::ServiceDirectory::V1beta1::GetNamespaceRequest
368
+
369
+ # Converts hash and nil to an options object
370
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
371
+
372
+ # Customize the options with defaults
373
+ call_metadata = @config.rpcs.get_namespace.metadata.to_h
374
+
375
+ # Set x-goog-api-client and x-goog-user-project headers
376
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
377
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
378
+ gapic_version: ::Google::Cloud::ServiceDirectory::V1beta1::VERSION,
379
+ transports_version_send: [:rest]
380
+
381
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
382
+
383
+ options.apply_defaults timeout: @config.rpcs.get_namespace.timeout,
384
+ metadata: call_metadata,
385
+ retry_policy: @config.rpcs.get_namespace.retry_policy
386
+
387
+ options.apply_defaults timeout: @config.timeout,
388
+ metadata: @config.metadata,
389
+ retry_policy: @config.retry_policy
390
+
391
+ @registration_service_stub.get_namespace request, options do |result, operation|
392
+ yield result, operation if block_given?
393
+ return result
394
+ end
395
+ rescue ::Gapic::Rest::Error => e
396
+ raise ::Google::Cloud::Error.from_error(e)
397
+ end
398
+
399
+ ##
400
+ # Updates a namespace.
401
+ #
402
+ # @overload update_namespace(request, options = nil)
403
+ # Pass arguments to `update_namespace` via a request object, either of type
404
+ # {::Google::Cloud::ServiceDirectory::V1beta1::UpdateNamespaceRequest} or an equivalent Hash.
405
+ #
406
+ # @param request [::Google::Cloud::ServiceDirectory::V1beta1::UpdateNamespaceRequest, ::Hash]
407
+ # A request object representing the call parameters. Required. To specify no
408
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
409
+ # @param options [::Gapic::CallOptions, ::Hash]
410
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
411
+ #
412
+ # @overload update_namespace(namespace: nil, update_mask: nil)
413
+ # Pass arguments to `update_namespace` via keyword arguments. Note that at
414
+ # least one keyword argument is required. To specify no parameters, or to keep all
415
+ # the default parameter values, pass an empty Hash as a request object (see above).
416
+ #
417
+ # @param namespace [::Google::Cloud::ServiceDirectory::V1beta1::Namespace, ::Hash]
418
+ # Required. The updated namespace.
419
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
420
+ # Required. List of fields to be updated in this request.
421
+ # @yield [result, operation] Access the result along with the TransportOperation object
422
+ # @yieldparam result [::Google::Cloud::ServiceDirectory::V1beta1::Namespace]
423
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
424
+ #
425
+ # @return [::Google::Cloud::ServiceDirectory::V1beta1::Namespace]
426
+ #
427
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
428
+ def update_namespace request, options = nil
429
+ raise ::ArgumentError, "request must be provided" if request.nil?
430
+
431
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::ServiceDirectory::V1beta1::UpdateNamespaceRequest
432
+
433
+ # Converts hash and nil to an options object
434
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
435
+
436
+ # Customize the options with defaults
437
+ call_metadata = @config.rpcs.update_namespace.metadata.to_h
438
+
439
+ # Set x-goog-api-client and x-goog-user-project headers
440
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
441
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
442
+ gapic_version: ::Google::Cloud::ServiceDirectory::V1beta1::VERSION,
443
+ transports_version_send: [:rest]
444
+
445
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
446
+
447
+ options.apply_defaults timeout: @config.rpcs.update_namespace.timeout,
448
+ metadata: call_metadata,
449
+ retry_policy: @config.rpcs.update_namespace.retry_policy
450
+
451
+ options.apply_defaults timeout: @config.timeout,
452
+ metadata: @config.metadata,
453
+ retry_policy: @config.retry_policy
454
+
455
+ @registration_service_stub.update_namespace request, options do |result, operation|
456
+ yield result, operation if block_given?
457
+ return result
458
+ end
459
+ rescue ::Gapic::Rest::Error => e
460
+ raise ::Google::Cloud::Error.from_error(e)
461
+ end
462
+
463
+ ##
464
+ # Deletes a namespace. This also deletes all services and endpoints in
465
+ # the namespace.
466
+ #
467
+ # @overload delete_namespace(request, options = nil)
468
+ # Pass arguments to `delete_namespace` via a request object, either of type
469
+ # {::Google::Cloud::ServiceDirectory::V1beta1::DeleteNamespaceRequest} or an equivalent Hash.
470
+ #
471
+ # @param request [::Google::Cloud::ServiceDirectory::V1beta1::DeleteNamespaceRequest, ::Hash]
472
+ # A request object representing the call parameters. Required. To specify no
473
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
474
+ # @param options [::Gapic::CallOptions, ::Hash]
475
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
476
+ #
477
+ # @overload delete_namespace(name: nil)
478
+ # Pass arguments to `delete_namespace` via keyword arguments. Note that at
479
+ # least one keyword argument is required. To specify no parameters, or to keep all
480
+ # the default parameter values, pass an empty Hash as a request object (see above).
481
+ #
482
+ # @param name [::String]
483
+ # Required. The name of the namespace to delete.
484
+ # @yield [result, operation] Access the result along with the TransportOperation object
485
+ # @yieldparam result [::Google::Protobuf::Empty]
486
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
487
+ #
488
+ # @return [::Google::Protobuf::Empty]
489
+ #
490
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
491
+ def delete_namespace request, options = nil
492
+ raise ::ArgumentError, "request must be provided" if request.nil?
493
+
494
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::ServiceDirectory::V1beta1::DeleteNamespaceRequest
495
+
496
+ # Converts hash and nil to an options object
497
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
498
+
499
+ # Customize the options with defaults
500
+ call_metadata = @config.rpcs.delete_namespace.metadata.to_h
501
+
502
+ # Set x-goog-api-client and x-goog-user-project headers
503
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
504
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
505
+ gapic_version: ::Google::Cloud::ServiceDirectory::V1beta1::VERSION,
506
+ transports_version_send: [:rest]
507
+
508
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
509
+
510
+ options.apply_defaults timeout: @config.rpcs.delete_namespace.timeout,
511
+ metadata: call_metadata,
512
+ retry_policy: @config.rpcs.delete_namespace.retry_policy
513
+
514
+ options.apply_defaults timeout: @config.timeout,
515
+ metadata: @config.metadata,
516
+ retry_policy: @config.retry_policy
517
+
518
+ @registration_service_stub.delete_namespace request, options do |result, operation|
519
+ yield result, operation if block_given?
520
+ return result
521
+ end
522
+ rescue ::Gapic::Rest::Error => e
523
+ raise ::Google::Cloud::Error.from_error(e)
524
+ end
525
+
526
+ ##
527
+ # Creates a service, and returns the new service.
528
+ #
529
+ # @overload create_service(request, options = nil)
530
+ # Pass arguments to `create_service` via a request object, either of type
531
+ # {::Google::Cloud::ServiceDirectory::V1beta1::CreateServiceRequest} or an equivalent Hash.
532
+ #
533
+ # @param request [::Google::Cloud::ServiceDirectory::V1beta1::CreateServiceRequest, ::Hash]
534
+ # A request object representing the call parameters. Required. To specify no
535
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
536
+ # @param options [::Gapic::CallOptions, ::Hash]
537
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
538
+ #
539
+ # @overload create_service(parent: nil, service_id: nil, service: nil)
540
+ # Pass arguments to `create_service` via keyword arguments. Note that at
541
+ # least one keyword argument is required. To specify no parameters, or to keep all
542
+ # the default parameter values, pass an empty Hash as a request object (see above).
543
+ #
544
+ # @param parent [::String]
545
+ # Required. The resource name of the namespace this service will belong to.
546
+ # @param service_id [::String]
547
+ # Required. The Resource ID must be 1-63 characters long, and comply with
548
+ # <a href="https://www.ietf.org/rfc/rfc1035.txt" target="_blank">RFC1035</a>.
549
+ # Specifically, the name must be 1-63 characters long and match the regular
550
+ # expression `[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?` which means the first
551
+ # character must be a lowercase letter, and all following characters must
552
+ # be a dash, lowercase letter, or digit, except the last character, which
553
+ # cannot be a dash.
554
+ # @param service [::Google::Cloud::ServiceDirectory::V1beta1::Service, ::Hash]
555
+ # Required. A service with initial fields set.
556
+ # @yield [result, operation] Access the result along with the TransportOperation object
557
+ # @yieldparam result [::Google::Cloud::ServiceDirectory::V1beta1::Service]
558
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
559
+ #
560
+ # @return [::Google::Cloud::ServiceDirectory::V1beta1::Service]
561
+ #
562
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
563
+ def create_service request, options = nil
564
+ raise ::ArgumentError, "request must be provided" if request.nil?
565
+
566
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::ServiceDirectory::V1beta1::CreateServiceRequest
567
+
568
+ # Converts hash and nil to an options object
569
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
570
+
571
+ # Customize the options with defaults
572
+ call_metadata = @config.rpcs.create_service.metadata.to_h
573
+
574
+ # Set x-goog-api-client and x-goog-user-project headers
575
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
576
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
577
+ gapic_version: ::Google::Cloud::ServiceDirectory::V1beta1::VERSION,
578
+ transports_version_send: [:rest]
579
+
580
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
581
+
582
+ options.apply_defaults timeout: @config.rpcs.create_service.timeout,
583
+ metadata: call_metadata,
584
+ retry_policy: @config.rpcs.create_service.retry_policy
585
+
586
+ options.apply_defaults timeout: @config.timeout,
587
+ metadata: @config.metadata,
588
+ retry_policy: @config.retry_policy
589
+
590
+ @registration_service_stub.create_service request, options do |result, operation|
591
+ yield result, operation if block_given?
592
+ return result
593
+ end
594
+ rescue ::Gapic::Rest::Error => e
595
+ raise ::Google::Cloud::Error.from_error(e)
596
+ end
597
+
598
+ ##
599
+ # Lists all services belonging to a namespace.
600
+ #
601
+ # @overload list_services(request, options = nil)
602
+ # Pass arguments to `list_services` via a request object, either of type
603
+ # {::Google::Cloud::ServiceDirectory::V1beta1::ListServicesRequest} or an equivalent Hash.
604
+ #
605
+ # @param request [::Google::Cloud::ServiceDirectory::V1beta1::ListServicesRequest, ::Hash]
606
+ # A request object representing the call parameters. Required. To specify no
607
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
608
+ # @param options [::Gapic::CallOptions, ::Hash]
609
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
610
+ #
611
+ # @overload list_services(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil)
612
+ # Pass arguments to `list_services` via keyword arguments. Note that at
613
+ # least one keyword argument is required. To specify no parameters, or to keep all
614
+ # the default parameter values, pass an empty Hash as a request object (see above).
615
+ #
616
+ # @param parent [::String]
617
+ # Required. The resource name of the namespace whose services you'd
618
+ # like to list.
619
+ # @param page_size [::Integer]
620
+ # Optional. The maximum number of items to return.
621
+ # @param page_token [::String]
622
+ # Optional. The next_page_token value returned from a previous List request,
623
+ # if any.
624
+ # @param filter [::String]
625
+ # Optional. The filter to list results by.
626
+ #
627
+ # General `filter` string syntax:
628
+ # `<field> <operator> <value> (<logical connector>)`
629
+ #
630
+ # * `<field>` can be `name` or `metadata.<key>` for map field
631
+ # * `<operator>` can be `<`, `>`, `<=`, `>=`, `!=`, `=`, `:`. Of which `:`
632
+ # means `HAS`, and is roughly the same as `=`
633
+ # * `<value>` must be the same data type as field
634
+ # * `<logical connector>` can be `AND`, `OR`, `NOT`
635
+ #
636
+ # Examples of valid filters:
637
+ #
638
+ # * `metadata.owner` returns services that have a metadata with the key
639
+ # `owner`, this is the same as `metadata:owner`
640
+ # * `metadata.protocol=gRPC` returns services that have key/value
641
+ # `protocol=gRPC`
642
+ # *
643
+ # `name>projects/my-project/locations/us-east1/namespaces/my-namespace/services/service-c`
644
+ # returns services that have name that is alphabetically later than the
645
+ # string, so "service-e" is returned but "service-a" is not
646
+ # * `metadata.owner!=sd AND metadata.foo=bar` returns services that have
647
+ # `owner` in metadata key but value is not `sd` AND have key/value
648
+ # `foo=bar`
649
+ # * `doesnotexist.foo=bar` returns an empty list. Note that service
650
+ # doesn't have a field called "doesnotexist". Since the filter does not
651
+ # match any services, it returns no results
652
+ #
653
+ # For more information about filtering, see
654
+ # [API Filtering](https://aip.dev/160).
655
+ # @param order_by [::String]
656
+ # Optional. The order to list results by.
657
+ #
658
+ # General `order_by` string syntax: `<field> (<asc|desc>) (,)`
659
+ #
660
+ # * `<field>` allows value: `name`
661
+ # * `<asc|desc>` ascending or descending order by `<field>`. If this is
662
+ # left blank, `asc` is used
663
+ #
664
+ # Note that an empty `order_by` string results in default order, which is
665
+ # order by `name` in ascending order.
666
+ # @yield [result, operation] Access the result along with the TransportOperation object
667
+ # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::ServiceDirectory::V1beta1::Service>]
668
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
669
+ #
670
+ # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::ServiceDirectory::V1beta1::Service>]
671
+ #
672
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
673
+ def list_services request, options = nil
674
+ raise ::ArgumentError, "request must be provided" if request.nil?
675
+
676
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::ServiceDirectory::V1beta1::ListServicesRequest
677
+
678
+ # Converts hash and nil to an options object
679
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
680
+
681
+ # Customize the options with defaults
682
+ call_metadata = @config.rpcs.list_services.metadata.to_h
683
+
684
+ # Set x-goog-api-client and x-goog-user-project headers
685
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
686
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
687
+ gapic_version: ::Google::Cloud::ServiceDirectory::V1beta1::VERSION,
688
+ transports_version_send: [:rest]
689
+
690
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
691
+
692
+ options.apply_defaults timeout: @config.rpcs.list_services.timeout,
693
+ metadata: call_metadata,
694
+ retry_policy: @config.rpcs.list_services.retry_policy
695
+
696
+ options.apply_defaults timeout: @config.timeout,
697
+ metadata: @config.metadata,
698
+ retry_policy: @config.retry_policy
699
+
700
+ @registration_service_stub.list_services request, options do |result, operation|
701
+ result = ::Gapic::Rest::PagedEnumerable.new @registration_service_stub, :list_services, "services", request, result, options
702
+ yield result, operation if block_given?
703
+ return result
704
+ end
705
+ rescue ::Gapic::Rest::Error => e
706
+ raise ::Google::Cloud::Error.from_error(e)
707
+ end
708
+
709
+ ##
710
+ # Gets a service.
711
+ #
712
+ # @overload get_service(request, options = nil)
713
+ # Pass arguments to `get_service` via a request object, either of type
714
+ # {::Google::Cloud::ServiceDirectory::V1beta1::GetServiceRequest} or an equivalent Hash.
715
+ #
716
+ # @param request [::Google::Cloud::ServiceDirectory::V1beta1::GetServiceRequest, ::Hash]
717
+ # A request object representing the call parameters. Required. To specify no
718
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
719
+ # @param options [::Gapic::CallOptions, ::Hash]
720
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
721
+ #
722
+ # @overload get_service(name: nil)
723
+ # Pass arguments to `get_service` via keyword arguments. Note that at
724
+ # least one keyword argument is required. To specify no parameters, or to keep all
725
+ # the default parameter values, pass an empty Hash as a request object (see above).
726
+ #
727
+ # @param name [::String]
728
+ # Required. The name of the service to get.
729
+ # @yield [result, operation] Access the result along with the TransportOperation object
730
+ # @yieldparam result [::Google::Cloud::ServiceDirectory::V1beta1::Service]
731
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
732
+ #
733
+ # @return [::Google::Cloud::ServiceDirectory::V1beta1::Service]
734
+ #
735
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
736
+ def get_service request, options = nil
737
+ raise ::ArgumentError, "request must be provided" if request.nil?
738
+
739
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::ServiceDirectory::V1beta1::GetServiceRequest
740
+
741
+ # Converts hash and nil to an options object
742
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
743
+
744
+ # Customize the options with defaults
745
+ call_metadata = @config.rpcs.get_service.metadata.to_h
746
+
747
+ # Set x-goog-api-client and x-goog-user-project headers
748
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
749
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
750
+ gapic_version: ::Google::Cloud::ServiceDirectory::V1beta1::VERSION,
751
+ transports_version_send: [:rest]
752
+
753
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
754
+
755
+ options.apply_defaults timeout: @config.rpcs.get_service.timeout,
756
+ metadata: call_metadata,
757
+ retry_policy: @config.rpcs.get_service.retry_policy
758
+
759
+ options.apply_defaults timeout: @config.timeout,
760
+ metadata: @config.metadata,
761
+ retry_policy: @config.retry_policy
762
+
763
+ @registration_service_stub.get_service request, options do |result, operation|
764
+ yield result, operation if block_given?
765
+ return result
766
+ end
767
+ rescue ::Gapic::Rest::Error => e
768
+ raise ::Google::Cloud::Error.from_error(e)
769
+ end
770
+
771
+ ##
772
+ # Updates a service.
773
+ #
774
+ # @overload update_service(request, options = nil)
775
+ # Pass arguments to `update_service` via a request object, either of type
776
+ # {::Google::Cloud::ServiceDirectory::V1beta1::UpdateServiceRequest} or an equivalent Hash.
777
+ #
778
+ # @param request [::Google::Cloud::ServiceDirectory::V1beta1::UpdateServiceRequest, ::Hash]
779
+ # A request object representing the call parameters. Required. To specify no
780
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
781
+ # @param options [::Gapic::CallOptions, ::Hash]
782
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
783
+ #
784
+ # @overload update_service(service: nil, update_mask: nil)
785
+ # Pass arguments to `update_service` via keyword arguments. Note that at
786
+ # least one keyword argument is required. To specify no parameters, or to keep all
787
+ # the default parameter values, pass an empty Hash as a request object (see above).
788
+ #
789
+ # @param service [::Google::Cloud::ServiceDirectory::V1beta1::Service, ::Hash]
790
+ # Required. The updated service.
791
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
792
+ # Required. List of fields to be updated in this request.
793
+ # @yield [result, operation] Access the result along with the TransportOperation object
794
+ # @yieldparam result [::Google::Cloud::ServiceDirectory::V1beta1::Service]
795
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
796
+ #
797
+ # @return [::Google::Cloud::ServiceDirectory::V1beta1::Service]
798
+ #
799
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
800
+ def update_service request, options = nil
801
+ raise ::ArgumentError, "request must be provided" if request.nil?
802
+
803
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::ServiceDirectory::V1beta1::UpdateServiceRequest
804
+
805
+ # Converts hash and nil to an options object
806
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
807
+
808
+ # Customize the options with defaults
809
+ call_metadata = @config.rpcs.update_service.metadata.to_h
810
+
811
+ # Set x-goog-api-client and x-goog-user-project headers
812
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
813
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
814
+ gapic_version: ::Google::Cloud::ServiceDirectory::V1beta1::VERSION,
815
+ transports_version_send: [:rest]
816
+
817
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
818
+
819
+ options.apply_defaults timeout: @config.rpcs.update_service.timeout,
820
+ metadata: call_metadata,
821
+ retry_policy: @config.rpcs.update_service.retry_policy
822
+
823
+ options.apply_defaults timeout: @config.timeout,
824
+ metadata: @config.metadata,
825
+ retry_policy: @config.retry_policy
826
+
827
+ @registration_service_stub.update_service request, options do |result, operation|
828
+ yield result, operation if block_given?
829
+ return result
830
+ end
831
+ rescue ::Gapic::Rest::Error => e
832
+ raise ::Google::Cloud::Error.from_error(e)
833
+ end
834
+
835
+ ##
836
+ # Deletes a service. This also deletes all endpoints associated with
837
+ # the service.
838
+ #
839
+ # @overload delete_service(request, options = nil)
840
+ # Pass arguments to `delete_service` via a request object, either of type
841
+ # {::Google::Cloud::ServiceDirectory::V1beta1::DeleteServiceRequest} or an equivalent Hash.
842
+ #
843
+ # @param request [::Google::Cloud::ServiceDirectory::V1beta1::DeleteServiceRequest, ::Hash]
844
+ # A request object representing the call parameters. Required. To specify no
845
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
846
+ # @param options [::Gapic::CallOptions, ::Hash]
847
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
848
+ #
849
+ # @overload delete_service(name: nil)
850
+ # Pass arguments to `delete_service` via keyword arguments. Note that at
851
+ # least one keyword argument is required. To specify no parameters, or to keep all
852
+ # the default parameter values, pass an empty Hash as a request object (see above).
853
+ #
854
+ # @param name [::String]
855
+ # Required. The name of the service to delete.
856
+ # @yield [result, operation] Access the result along with the TransportOperation object
857
+ # @yieldparam result [::Google::Protobuf::Empty]
858
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
859
+ #
860
+ # @return [::Google::Protobuf::Empty]
861
+ #
862
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
863
+ def delete_service request, options = nil
864
+ raise ::ArgumentError, "request must be provided" if request.nil?
865
+
866
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::ServiceDirectory::V1beta1::DeleteServiceRequest
867
+
868
+ # Converts hash and nil to an options object
869
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
870
+
871
+ # Customize the options with defaults
872
+ call_metadata = @config.rpcs.delete_service.metadata.to_h
873
+
874
+ # Set x-goog-api-client and x-goog-user-project headers
875
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
876
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
877
+ gapic_version: ::Google::Cloud::ServiceDirectory::V1beta1::VERSION,
878
+ transports_version_send: [:rest]
879
+
880
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
881
+
882
+ options.apply_defaults timeout: @config.rpcs.delete_service.timeout,
883
+ metadata: call_metadata,
884
+ retry_policy: @config.rpcs.delete_service.retry_policy
885
+
886
+ options.apply_defaults timeout: @config.timeout,
887
+ metadata: @config.metadata,
888
+ retry_policy: @config.retry_policy
889
+
890
+ @registration_service_stub.delete_service request, options do |result, operation|
891
+ yield result, operation if block_given?
892
+ return result
893
+ end
894
+ rescue ::Gapic::Rest::Error => e
895
+ raise ::Google::Cloud::Error.from_error(e)
896
+ end
897
+
898
+ ##
899
+ # Creates an endpoint, and returns the new endpoint.
900
+ #
901
+ # @overload create_endpoint(request, options = nil)
902
+ # Pass arguments to `create_endpoint` via a request object, either of type
903
+ # {::Google::Cloud::ServiceDirectory::V1beta1::CreateEndpointRequest} or an equivalent Hash.
904
+ #
905
+ # @param request [::Google::Cloud::ServiceDirectory::V1beta1::CreateEndpointRequest, ::Hash]
906
+ # A request object representing the call parameters. Required. To specify no
907
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
908
+ # @param options [::Gapic::CallOptions, ::Hash]
909
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
910
+ #
911
+ # @overload create_endpoint(parent: nil, endpoint_id: nil, endpoint: nil)
912
+ # Pass arguments to `create_endpoint` via keyword arguments. Note that at
913
+ # least one keyword argument is required. To specify no parameters, or to keep all
914
+ # the default parameter values, pass an empty Hash as a request object (see above).
915
+ #
916
+ # @param parent [::String]
917
+ # Required. The resource name of the service that this endpoint provides.
918
+ # @param endpoint_id [::String]
919
+ # Required. The Resource ID must be 1-63 characters long, and comply with
920
+ # <a href="https://www.ietf.org/rfc/rfc1035.txt" target="_blank">RFC1035</a>.
921
+ # Specifically, the name must be 1-63 characters long and match the regular
922
+ # expression `[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?` which means the first
923
+ # character must be a lowercase letter, and all following characters must
924
+ # be a dash, lowercase letter, or digit, except the last character, which
925
+ # cannot be a dash.
926
+ # @param endpoint [::Google::Cloud::ServiceDirectory::V1beta1::Endpoint, ::Hash]
927
+ # Required. A endpoint with initial fields set.
928
+ # @yield [result, operation] Access the result along with the TransportOperation object
929
+ # @yieldparam result [::Google::Cloud::ServiceDirectory::V1beta1::Endpoint]
930
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
931
+ #
932
+ # @return [::Google::Cloud::ServiceDirectory::V1beta1::Endpoint]
933
+ #
934
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
935
+ def create_endpoint request, options = nil
936
+ raise ::ArgumentError, "request must be provided" if request.nil?
937
+
938
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::ServiceDirectory::V1beta1::CreateEndpointRequest
939
+
940
+ # Converts hash and nil to an options object
941
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
942
+
943
+ # Customize the options with defaults
944
+ call_metadata = @config.rpcs.create_endpoint.metadata.to_h
945
+
946
+ # Set x-goog-api-client and x-goog-user-project headers
947
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
948
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
949
+ gapic_version: ::Google::Cloud::ServiceDirectory::V1beta1::VERSION,
950
+ transports_version_send: [:rest]
951
+
952
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
953
+
954
+ options.apply_defaults timeout: @config.rpcs.create_endpoint.timeout,
955
+ metadata: call_metadata,
956
+ retry_policy: @config.rpcs.create_endpoint.retry_policy
957
+
958
+ options.apply_defaults timeout: @config.timeout,
959
+ metadata: @config.metadata,
960
+ retry_policy: @config.retry_policy
961
+
962
+ @registration_service_stub.create_endpoint request, options do |result, operation|
963
+ yield result, operation if block_given?
964
+ return result
965
+ end
966
+ rescue ::Gapic::Rest::Error => e
967
+ raise ::Google::Cloud::Error.from_error(e)
968
+ end
969
+
970
+ ##
971
+ # Lists all endpoints.
972
+ #
973
+ # @overload list_endpoints(request, options = nil)
974
+ # Pass arguments to `list_endpoints` via a request object, either of type
975
+ # {::Google::Cloud::ServiceDirectory::V1beta1::ListEndpointsRequest} or an equivalent Hash.
976
+ #
977
+ # @param request [::Google::Cloud::ServiceDirectory::V1beta1::ListEndpointsRequest, ::Hash]
978
+ # A request object representing the call parameters. Required. To specify no
979
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
980
+ # @param options [::Gapic::CallOptions, ::Hash]
981
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
982
+ #
983
+ # @overload list_endpoints(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil)
984
+ # Pass arguments to `list_endpoints` via keyword arguments. Note that at
985
+ # least one keyword argument is required. To specify no parameters, or to keep all
986
+ # the default parameter values, pass an empty Hash as a request object (see above).
987
+ #
988
+ # @param parent [::String]
989
+ # Required. The resource name of the service whose endpoints you'd like to
990
+ # list.
991
+ # @param page_size [::Integer]
992
+ # Optional. The maximum number of items to return.
993
+ # @param page_token [::String]
994
+ # Optional. The next_page_token value returned from a previous List request,
995
+ # if any.
996
+ # @param filter [::String]
997
+ # Optional. The filter to list results by.
998
+ #
999
+ # General `filter` string syntax:
1000
+ # `<field> <operator> <value> (<logical connector>)`
1001
+ #
1002
+ # * `<field>` can be `name`, `address`, `port`, or `metadata.<key>` for map
1003
+ # field
1004
+ # * `<operator>` can be `<`, `>`, `<=`, `>=`, `!=`, `=`, `:`. Of which `:`
1005
+ # means `HAS`, and is roughly the same as `=`
1006
+ # * `<value>` must be the same data type as field
1007
+ # * `<logical connector>` can be `AND`, `OR`, `NOT`
1008
+ #
1009
+ # Examples of valid filters:
1010
+ #
1011
+ # * `metadata.owner` returns endpoints that have a metadata with the key
1012
+ # `owner`, this is the same as `metadata:owner`
1013
+ # * `metadata.protocol=gRPC` returns endpoints that have key/value
1014
+ # `protocol=gRPC`
1015
+ # * `address=192.108.1.105` returns endpoints that have this address
1016
+ # * `port>8080` returns endpoints that have port number larger than 8080
1017
+ # *
1018
+ # `name>projects/my-project/locations/us-east1/namespaces/my-namespace/services/my-service/endpoints/endpoint-c`
1019
+ # returns endpoints that have name that is alphabetically later than the
1020
+ # string, so "endpoint-e" is returned but "endpoint-a" is not
1021
+ # * `metadata.owner!=sd AND metadata.foo=bar` returns endpoints that have
1022
+ # `owner` in metadata key but value is not `sd` AND have key/value
1023
+ # `foo=bar`
1024
+ # * `doesnotexist.foo=bar` returns an empty list. Note that endpoint
1025
+ # doesn't have a field called "doesnotexist". Since the filter does not
1026
+ # match any endpoints, it returns no results
1027
+ #
1028
+ # For more information about filtering, see
1029
+ # [API Filtering](https://aip.dev/160).
1030
+ # @param order_by [::String]
1031
+ # Optional. The order to list results by.
1032
+ #
1033
+ # General `order_by` string syntax: `<field> (<asc|desc>) (,)`
1034
+ #
1035
+ # * `<field>` allows values: `name`, `address`, `port`
1036
+ # * `<asc|desc>` ascending or descending order by `<field>`. If this is
1037
+ # left blank, `asc` is used
1038
+ #
1039
+ # Note that an empty `order_by` string results in default order, which is
1040
+ # order by `name` in ascending order.
1041
+ # @yield [result, operation] Access the result along with the TransportOperation object
1042
+ # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::ServiceDirectory::V1beta1::Endpoint>]
1043
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
1044
+ #
1045
+ # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::ServiceDirectory::V1beta1::Endpoint>]
1046
+ #
1047
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
1048
+ def list_endpoints request, options = nil
1049
+ raise ::ArgumentError, "request must be provided" if request.nil?
1050
+
1051
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::ServiceDirectory::V1beta1::ListEndpointsRequest
1052
+
1053
+ # Converts hash and nil to an options object
1054
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1055
+
1056
+ # Customize the options with defaults
1057
+ call_metadata = @config.rpcs.list_endpoints.metadata.to_h
1058
+
1059
+ # Set x-goog-api-client and x-goog-user-project headers
1060
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1061
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1062
+ gapic_version: ::Google::Cloud::ServiceDirectory::V1beta1::VERSION,
1063
+ transports_version_send: [:rest]
1064
+
1065
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1066
+
1067
+ options.apply_defaults timeout: @config.rpcs.list_endpoints.timeout,
1068
+ metadata: call_metadata,
1069
+ retry_policy: @config.rpcs.list_endpoints.retry_policy
1070
+
1071
+ options.apply_defaults timeout: @config.timeout,
1072
+ metadata: @config.metadata,
1073
+ retry_policy: @config.retry_policy
1074
+
1075
+ @registration_service_stub.list_endpoints request, options do |result, operation|
1076
+ result = ::Gapic::Rest::PagedEnumerable.new @registration_service_stub, :list_endpoints, "endpoints", request, result, options
1077
+ yield result, operation if block_given?
1078
+ return result
1079
+ end
1080
+ rescue ::Gapic::Rest::Error => e
1081
+ raise ::Google::Cloud::Error.from_error(e)
1082
+ end
1083
+
1084
+ ##
1085
+ # Gets an endpoint.
1086
+ #
1087
+ # @overload get_endpoint(request, options = nil)
1088
+ # Pass arguments to `get_endpoint` via a request object, either of type
1089
+ # {::Google::Cloud::ServiceDirectory::V1beta1::GetEndpointRequest} or an equivalent Hash.
1090
+ #
1091
+ # @param request [::Google::Cloud::ServiceDirectory::V1beta1::GetEndpointRequest, ::Hash]
1092
+ # A request object representing the call parameters. Required. To specify no
1093
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1094
+ # @param options [::Gapic::CallOptions, ::Hash]
1095
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
1096
+ #
1097
+ # @overload get_endpoint(name: nil)
1098
+ # Pass arguments to `get_endpoint` via keyword arguments. Note that at
1099
+ # least one keyword argument is required. To specify no parameters, or to keep all
1100
+ # the default parameter values, pass an empty Hash as a request object (see above).
1101
+ #
1102
+ # @param name [::String]
1103
+ # Required. The name of the endpoint to get.
1104
+ # @yield [result, operation] Access the result along with the TransportOperation object
1105
+ # @yieldparam result [::Google::Cloud::ServiceDirectory::V1beta1::Endpoint]
1106
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
1107
+ #
1108
+ # @return [::Google::Cloud::ServiceDirectory::V1beta1::Endpoint]
1109
+ #
1110
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
1111
+ def get_endpoint request, options = nil
1112
+ raise ::ArgumentError, "request must be provided" if request.nil?
1113
+
1114
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::ServiceDirectory::V1beta1::GetEndpointRequest
1115
+
1116
+ # Converts hash and nil to an options object
1117
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1118
+
1119
+ # Customize the options with defaults
1120
+ call_metadata = @config.rpcs.get_endpoint.metadata.to_h
1121
+
1122
+ # Set x-goog-api-client and x-goog-user-project headers
1123
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1124
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1125
+ gapic_version: ::Google::Cloud::ServiceDirectory::V1beta1::VERSION,
1126
+ transports_version_send: [:rest]
1127
+
1128
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1129
+
1130
+ options.apply_defaults timeout: @config.rpcs.get_endpoint.timeout,
1131
+ metadata: call_metadata,
1132
+ retry_policy: @config.rpcs.get_endpoint.retry_policy
1133
+
1134
+ options.apply_defaults timeout: @config.timeout,
1135
+ metadata: @config.metadata,
1136
+ retry_policy: @config.retry_policy
1137
+
1138
+ @registration_service_stub.get_endpoint request, options do |result, operation|
1139
+ yield result, operation if block_given?
1140
+ return result
1141
+ end
1142
+ rescue ::Gapic::Rest::Error => e
1143
+ raise ::Google::Cloud::Error.from_error(e)
1144
+ end
1145
+
1146
+ ##
1147
+ # Updates an endpoint.
1148
+ #
1149
+ # @overload update_endpoint(request, options = nil)
1150
+ # Pass arguments to `update_endpoint` via a request object, either of type
1151
+ # {::Google::Cloud::ServiceDirectory::V1beta1::UpdateEndpointRequest} or an equivalent Hash.
1152
+ #
1153
+ # @param request [::Google::Cloud::ServiceDirectory::V1beta1::UpdateEndpointRequest, ::Hash]
1154
+ # A request object representing the call parameters. Required. To specify no
1155
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1156
+ # @param options [::Gapic::CallOptions, ::Hash]
1157
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
1158
+ #
1159
+ # @overload update_endpoint(endpoint: nil, update_mask: nil)
1160
+ # Pass arguments to `update_endpoint` via keyword arguments. Note that at
1161
+ # least one keyword argument is required. To specify no parameters, or to keep all
1162
+ # the default parameter values, pass an empty Hash as a request object (see above).
1163
+ #
1164
+ # @param endpoint [::Google::Cloud::ServiceDirectory::V1beta1::Endpoint, ::Hash]
1165
+ # Required. The updated endpoint.
1166
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
1167
+ # Required. List of fields to be updated in this request.
1168
+ # @yield [result, operation] Access the result along with the TransportOperation object
1169
+ # @yieldparam result [::Google::Cloud::ServiceDirectory::V1beta1::Endpoint]
1170
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
1171
+ #
1172
+ # @return [::Google::Cloud::ServiceDirectory::V1beta1::Endpoint]
1173
+ #
1174
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
1175
+ def update_endpoint request, options = nil
1176
+ raise ::ArgumentError, "request must be provided" if request.nil?
1177
+
1178
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::ServiceDirectory::V1beta1::UpdateEndpointRequest
1179
+
1180
+ # Converts hash and nil to an options object
1181
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1182
+
1183
+ # Customize the options with defaults
1184
+ call_metadata = @config.rpcs.update_endpoint.metadata.to_h
1185
+
1186
+ # Set x-goog-api-client and x-goog-user-project headers
1187
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1188
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1189
+ gapic_version: ::Google::Cloud::ServiceDirectory::V1beta1::VERSION,
1190
+ transports_version_send: [:rest]
1191
+
1192
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1193
+
1194
+ options.apply_defaults timeout: @config.rpcs.update_endpoint.timeout,
1195
+ metadata: call_metadata,
1196
+ retry_policy: @config.rpcs.update_endpoint.retry_policy
1197
+
1198
+ options.apply_defaults timeout: @config.timeout,
1199
+ metadata: @config.metadata,
1200
+ retry_policy: @config.retry_policy
1201
+
1202
+ @registration_service_stub.update_endpoint request, options do |result, operation|
1203
+ yield result, operation if block_given?
1204
+ return result
1205
+ end
1206
+ rescue ::Gapic::Rest::Error => e
1207
+ raise ::Google::Cloud::Error.from_error(e)
1208
+ end
1209
+
1210
+ ##
1211
+ # Deletes an endpoint.
1212
+ #
1213
+ # @overload delete_endpoint(request, options = nil)
1214
+ # Pass arguments to `delete_endpoint` via a request object, either of type
1215
+ # {::Google::Cloud::ServiceDirectory::V1beta1::DeleteEndpointRequest} or an equivalent Hash.
1216
+ #
1217
+ # @param request [::Google::Cloud::ServiceDirectory::V1beta1::DeleteEndpointRequest, ::Hash]
1218
+ # A request object representing the call parameters. Required. To specify no
1219
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1220
+ # @param options [::Gapic::CallOptions, ::Hash]
1221
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
1222
+ #
1223
+ # @overload delete_endpoint(name: nil)
1224
+ # Pass arguments to `delete_endpoint` via keyword arguments. Note that at
1225
+ # least one keyword argument is required. To specify no parameters, or to keep all
1226
+ # the default parameter values, pass an empty Hash as a request object (see above).
1227
+ #
1228
+ # @param name [::String]
1229
+ # Required. The name of the endpoint to delete.
1230
+ # @yield [result, operation] Access the result along with the TransportOperation object
1231
+ # @yieldparam result [::Google::Protobuf::Empty]
1232
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
1233
+ #
1234
+ # @return [::Google::Protobuf::Empty]
1235
+ #
1236
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
1237
+ def delete_endpoint request, options = nil
1238
+ raise ::ArgumentError, "request must be provided" if request.nil?
1239
+
1240
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::ServiceDirectory::V1beta1::DeleteEndpointRequest
1241
+
1242
+ # Converts hash and nil to an options object
1243
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1244
+
1245
+ # Customize the options with defaults
1246
+ call_metadata = @config.rpcs.delete_endpoint.metadata.to_h
1247
+
1248
+ # Set x-goog-api-client and x-goog-user-project headers
1249
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1250
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1251
+ gapic_version: ::Google::Cloud::ServiceDirectory::V1beta1::VERSION,
1252
+ transports_version_send: [:rest]
1253
+
1254
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1255
+
1256
+ options.apply_defaults timeout: @config.rpcs.delete_endpoint.timeout,
1257
+ metadata: call_metadata,
1258
+ retry_policy: @config.rpcs.delete_endpoint.retry_policy
1259
+
1260
+ options.apply_defaults timeout: @config.timeout,
1261
+ metadata: @config.metadata,
1262
+ retry_policy: @config.retry_policy
1263
+
1264
+ @registration_service_stub.delete_endpoint request, options do |result, operation|
1265
+ yield result, operation if block_given?
1266
+ return result
1267
+ end
1268
+ rescue ::Gapic::Rest::Error => e
1269
+ raise ::Google::Cloud::Error.from_error(e)
1270
+ end
1271
+
1272
+ ##
1273
+ # Gets the IAM Policy for a resource (namespace or service only).
1274
+ #
1275
+ # @overload get_iam_policy(request, options = nil)
1276
+ # Pass arguments to `get_iam_policy` via a request object, either of type
1277
+ # {::Google::Iam::V1::GetIamPolicyRequest} or an equivalent Hash.
1278
+ #
1279
+ # @param request [::Google::Iam::V1::GetIamPolicyRequest, ::Hash]
1280
+ # A request object representing the call parameters. Required. To specify no
1281
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1282
+ # @param options [::Gapic::CallOptions, ::Hash]
1283
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
1284
+ #
1285
+ # @overload get_iam_policy(resource: nil, options: nil)
1286
+ # Pass arguments to `get_iam_policy` via keyword arguments. Note that at
1287
+ # least one keyword argument is required. To specify no parameters, or to keep all
1288
+ # the default parameter values, pass an empty Hash as a request object (see above).
1289
+ #
1290
+ # @param resource [::String]
1291
+ # REQUIRED: The resource for which the policy is being requested.
1292
+ # See the operation documentation for the appropriate value for this field.
1293
+ # @param options [::Google::Iam::V1::GetPolicyOptions, ::Hash]
1294
+ # OPTIONAL: A `GetPolicyOptions` object for specifying options to
1295
+ # `GetIamPolicy`.
1296
+ # @yield [result, operation] Access the result along with the TransportOperation object
1297
+ # @yieldparam result [::Google::Iam::V1::Policy]
1298
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
1299
+ #
1300
+ # @return [::Google::Iam::V1::Policy]
1301
+ #
1302
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
1303
+ def get_iam_policy request, options = nil
1304
+ raise ::ArgumentError, "request must be provided" if request.nil?
1305
+
1306
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Iam::V1::GetIamPolicyRequest
1307
+
1308
+ # Converts hash and nil to an options object
1309
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1310
+
1311
+ # Customize the options with defaults
1312
+ call_metadata = @config.rpcs.get_iam_policy.metadata.to_h
1313
+
1314
+ # Set x-goog-api-client and x-goog-user-project headers
1315
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1316
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1317
+ gapic_version: ::Google::Cloud::ServiceDirectory::V1beta1::VERSION,
1318
+ transports_version_send: [:rest]
1319
+
1320
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1321
+
1322
+ options.apply_defaults timeout: @config.rpcs.get_iam_policy.timeout,
1323
+ metadata: call_metadata,
1324
+ retry_policy: @config.rpcs.get_iam_policy.retry_policy
1325
+
1326
+ options.apply_defaults timeout: @config.timeout,
1327
+ metadata: @config.metadata,
1328
+ retry_policy: @config.retry_policy
1329
+
1330
+ @registration_service_stub.get_iam_policy request, options do |result, operation|
1331
+ yield result, operation if block_given?
1332
+ return result
1333
+ end
1334
+ rescue ::Gapic::Rest::Error => e
1335
+ raise ::Google::Cloud::Error.from_error(e)
1336
+ end
1337
+
1338
+ ##
1339
+ # Sets the IAM Policy for a resource (namespace or service only).
1340
+ #
1341
+ # @overload set_iam_policy(request, options = nil)
1342
+ # Pass arguments to `set_iam_policy` via a request object, either of type
1343
+ # {::Google::Iam::V1::SetIamPolicyRequest} or an equivalent Hash.
1344
+ #
1345
+ # @param request [::Google::Iam::V1::SetIamPolicyRequest, ::Hash]
1346
+ # A request object representing the call parameters. Required. To specify no
1347
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1348
+ # @param options [::Gapic::CallOptions, ::Hash]
1349
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
1350
+ #
1351
+ # @overload set_iam_policy(resource: nil, policy: nil, update_mask: nil)
1352
+ # Pass arguments to `set_iam_policy` via keyword arguments. Note that at
1353
+ # least one keyword argument is required. To specify no parameters, or to keep all
1354
+ # the default parameter values, pass an empty Hash as a request object (see above).
1355
+ #
1356
+ # @param resource [::String]
1357
+ # REQUIRED: The resource for which the policy is being specified.
1358
+ # See the operation documentation for the appropriate value for this field.
1359
+ # @param policy [::Google::Iam::V1::Policy, ::Hash]
1360
+ # REQUIRED: The complete policy to be applied to the `resource`. The size of
1361
+ # the policy is limited to a few 10s of KB. An empty policy is a
1362
+ # valid policy but certain Cloud Platform services (such as Projects)
1363
+ # might reject them.
1364
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
1365
+ # OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only
1366
+ # the fields in the mask will be modified. If no mask is provided, the
1367
+ # following default mask is used:
1368
+ #
1369
+ # `paths: "bindings, etag"`
1370
+ # @yield [result, operation] Access the result along with the TransportOperation object
1371
+ # @yieldparam result [::Google::Iam::V1::Policy]
1372
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
1373
+ #
1374
+ # @return [::Google::Iam::V1::Policy]
1375
+ #
1376
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
1377
+ def set_iam_policy request, options = nil
1378
+ raise ::ArgumentError, "request must be provided" if request.nil?
1379
+
1380
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Iam::V1::SetIamPolicyRequest
1381
+
1382
+ # Converts hash and nil to an options object
1383
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1384
+
1385
+ # Customize the options with defaults
1386
+ call_metadata = @config.rpcs.set_iam_policy.metadata.to_h
1387
+
1388
+ # Set x-goog-api-client and x-goog-user-project headers
1389
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1390
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1391
+ gapic_version: ::Google::Cloud::ServiceDirectory::V1beta1::VERSION,
1392
+ transports_version_send: [:rest]
1393
+
1394
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1395
+
1396
+ options.apply_defaults timeout: @config.rpcs.set_iam_policy.timeout,
1397
+ metadata: call_metadata,
1398
+ retry_policy: @config.rpcs.set_iam_policy.retry_policy
1399
+
1400
+ options.apply_defaults timeout: @config.timeout,
1401
+ metadata: @config.metadata,
1402
+ retry_policy: @config.retry_policy
1403
+
1404
+ @registration_service_stub.set_iam_policy request, options do |result, operation|
1405
+ yield result, operation if block_given?
1406
+ return result
1407
+ end
1408
+ rescue ::Gapic::Rest::Error => e
1409
+ raise ::Google::Cloud::Error.from_error(e)
1410
+ end
1411
+
1412
+ ##
1413
+ # Tests IAM permissions for a resource (namespace or service only).
1414
+ #
1415
+ # @overload test_iam_permissions(request, options = nil)
1416
+ # Pass arguments to `test_iam_permissions` via a request object, either of type
1417
+ # {::Google::Iam::V1::TestIamPermissionsRequest} or an equivalent Hash.
1418
+ #
1419
+ # @param request [::Google::Iam::V1::TestIamPermissionsRequest, ::Hash]
1420
+ # A request object representing the call parameters. Required. To specify no
1421
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1422
+ # @param options [::Gapic::CallOptions, ::Hash]
1423
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
1424
+ #
1425
+ # @overload test_iam_permissions(resource: nil, permissions: nil)
1426
+ # Pass arguments to `test_iam_permissions` via keyword arguments. Note that at
1427
+ # least one keyword argument is required. To specify no parameters, or to keep all
1428
+ # the default parameter values, pass an empty Hash as a request object (see above).
1429
+ #
1430
+ # @param resource [::String]
1431
+ # REQUIRED: The resource for which the policy detail is being requested.
1432
+ # See the operation documentation for the appropriate value for this field.
1433
+ # @param permissions [::Array<::String>]
1434
+ # The set of permissions to check for the `resource`. Permissions with
1435
+ # wildcards (such as '*' or 'storage.*') are not allowed. For more
1436
+ # information see
1437
+ # [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions).
1438
+ # @yield [result, operation] Access the result along with the TransportOperation object
1439
+ # @yieldparam result [::Google::Iam::V1::TestIamPermissionsResponse]
1440
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
1441
+ #
1442
+ # @return [::Google::Iam::V1::TestIamPermissionsResponse]
1443
+ #
1444
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
1445
+ def test_iam_permissions request, options = nil
1446
+ raise ::ArgumentError, "request must be provided" if request.nil?
1447
+
1448
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Iam::V1::TestIamPermissionsRequest
1449
+
1450
+ # Converts hash and nil to an options object
1451
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1452
+
1453
+ # Customize the options with defaults
1454
+ call_metadata = @config.rpcs.test_iam_permissions.metadata.to_h
1455
+
1456
+ # Set x-goog-api-client and x-goog-user-project headers
1457
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1458
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1459
+ gapic_version: ::Google::Cloud::ServiceDirectory::V1beta1::VERSION,
1460
+ transports_version_send: [:rest]
1461
+
1462
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1463
+
1464
+ options.apply_defaults timeout: @config.rpcs.test_iam_permissions.timeout,
1465
+ metadata: call_metadata,
1466
+ retry_policy: @config.rpcs.test_iam_permissions.retry_policy
1467
+
1468
+ options.apply_defaults timeout: @config.timeout,
1469
+ metadata: @config.metadata,
1470
+ retry_policy: @config.retry_policy
1471
+
1472
+ @registration_service_stub.test_iam_permissions request, options do |result, operation|
1473
+ yield result, operation if block_given?
1474
+ return result
1475
+ end
1476
+ rescue ::Gapic::Rest::Error => e
1477
+ raise ::Google::Cloud::Error.from_error(e)
1478
+ end
1479
+
1480
+ ##
1481
+ # Configuration class for the RegistrationService REST API.
1482
+ #
1483
+ # This class represents the configuration for RegistrationService REST,
1484
+ # providing control over timeouts, retry behavior, logging, transport
1485
+ # parameters, and other low-level controls. Certain parameters can also be
1486
+ # applied individually to specific RPCs. See
1487
+ # {::Google::Cloud::ServiceDirectory::V1beta1::RegistrationService::Rest::Client::Configuration::Rpcs}
1488
+ # for a list of RPCs that can be configured independently.
1489
+ #
1490
+ # Configuration can be applied globally to all clients, or to a single client
1491
+ # on construction.
1492
+ #
1493
+ # @example
1494
+ #
1495
+ # # Modify the global config, setting the timeout for
1496
+ # # create_namespace to 20 seconds,
1497
+ # # and all remaining timeouts to 10 seconds.
1498
+ # ::Google::Cloud::ServiceDirectory::V1beta1::RegistrationService::Rest::Client.configure do |config|
1499
+ # config.timeout = 10.0
1500
+ # config.rpcs.create_namespace.timeout = 20.0
1501
+ # end
1502
+ #
1503
+ # # Apply the above configuration only to a new client.
1504
+ # client = ::Google::Cloud::ServiceDirectory::V1beta1::RegistrationService::Rest::Client.new do |config|
1505
+ # config.timeout = 10.0
1506
+ # config.rpcs.create_namespace.timeout = 20.0
1507
+ # end
1508
+ #
1509
+ # @!attribute [rw] endpoint
1510
+ # The hostname or hostname:port of the service endpoint.
1511
+ # Defaults to `"servicedirectory.googleapis.com"`.
1512
+ # @return [::String]
1513
+ # @!attribute [rw] credentials
1514
+ # Credentials to send with calls. You may provide any of the following types:
1515
+ # * (`String`) The path to a service account key file in JSON format
1516
+ # * (`Hash`) A service account key as a Hash
1517
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
1518
+ # (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
1519
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
1520
+ # (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
1521
+ # * (`nil`) indicating no credentials
1522
+ # @return [::Object]
1523
+ # @!attribute [rw] scope
1524
+ # The OAuth scopes
1525
+ # @return [::Array<::String>]
1526
+ # @!attribute [rw] lib_name
1527
+ # The library name as recorded in instrumentation and logging
1528
+ # @return [::String]
1529
+ # @!attribute [rw] lib_version
1530
+ # The library version as recorded in instrumentation and logging
1531
+ # @return [::String]
1532
+ # @!attribute [rw] timeout
1533
+ # The call timeout in seconds.
1534
+ # @return [::Numeric]
1535
+ # @!attribute [rw] metadata
1536
+ # Additional headers to be sent with the call.
1537
+ # @return [::Hash{::Symbol=>::String}]
1538
+ # @!attribute [rw] retry_policy
1539
+ # The retry policy. The value is a hash with the following keys:
1540
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
1541
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
1542
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
1543
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
1544
+ # trigger a retry.
1545
+ # @return [::Hash]
1546
+ # @!attribute [rw] quota_project
1547
+ # A separate project against which to charge quota.
1548
+ # @return [::String]
1549
+ #
1550
+ class Configuration
1551
+ extend ::Gapic::Config
1552
+
1553
+ config_attr :endpoint, "servicedirectory.googleapis.com", ::String
1554
+ config_attr :credentials, nil do |value|
1555
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
1556
+ allowed.any? { |klass| klass === value }
1557
+ end
1558
+ config_attr :scope, nil, ::String, ::Array, nil
1559
+ config_attr :lib_name, nil, ::String, nil
1560
+ config_attr :lib_version, nil, ::String, nil
1561
+ config_attr :timeout, nil, ::Numeric, nil
1562
+ config_attr :metadata, nil, ::Hash, nil
1563
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
1564
+ config_attr :quota_project, nil, ::String, nil
1565
+
1566
+ # @private
1567
+ def initialize parent_config = nil
1568
+ @parent_config = parent_config unless parent_config.nil?
1569
+
1570
+ yield self if block_given?
1571
+ end
1572
+
1573
+ ##
1574
+ # Configurations for individual RPCs
1575
+ # @return [Rpcs]
1576
+ #
1577
+ def rpcs
1578
+ @rpcs ||= begin
1579
+ parent_rpcs = nil
1580
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
1581
+ Rpcs.new parent_rpcs
1582
+ end
1583
+ end
1584
+
1585
+ ##
1586
+ # Configuration RPC class for the RegistrationService API.
1587
+ #
1588
+ # Includes fields providing the configuration for each RPC in this service.
1589
+ # Each configuration object is of type `Gapic::Config::Method` and includes
1590
+ # the following configuration fields:
1591
+ #
1592
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
1593
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
1594
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
1595
+ # include the following keys:
1596
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
1597
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
1598
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
1599
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
1600
+ # trigger a retry.
1601
+ #
1602
+ class Rpcs
1603
+ ##
1604
+ # RPC-specific configuration for `create_namespace`
1605
+ # @return [::Gapic::Config::Method]
1606
+ #
1607
+ attr_reader :create_namespace
1608
+ ##
1609
+ # RPC-specific configuration for `list_namespaces`
1610
+ # @return [::Gapic::Config::Method]
1611
+ #
1612
+ attr_reader :list_namespaces
1613
+ ##
1614
+ # RPC-specific configuration for `get_namespace`
1615
+ # @return [::Gapic::Config::Method]
1616
+ #
1617
+ attr_reader :get_namespace
1618
+ ##
1619
+ # RPC-specific configuration for `update_namespace`
1620
+ # @return [::Gapic::Config::Method]
1621
+ #
1622
+ attr_reader :update_namespace
1623
+ ##
1624
+ # RPC-specific configuration for `delete_namespace`
1625
+ # @return [::Gapic::Config::Method]
1626
+ #
1627
+ attr_reader :delete_namespace
1628
+ ##
1629
+ # RPC-specific configuration for `create_service`
1630
+ # @return [::Gapic::Config::Method]
1631
+ #
1632
+ attr_reader :create_service
1633
+ ##
1634
+ # RPC-specific configuration for `list_services`
1635
+ # @return [::Gapic::Config::Method]
1636
+ #
1637
+ attr_reader :list_services
1638
+ ##
1639
+ # RPC-specific configuration for `get_service`
1640
+ # @return [::Gapic::Config::Method]
1641
+ #
1642
+ attr_reader :get_service
1643
+ ##
1644
+ # RPC-specific configuration for `update_service`
1645
+ # @return [::Gapic::Config::Method]
1646
+ #
1647
+ attr_reader :update_service
1648
+ ##
1649
+ # RPC-specific configuration for `delete_service`
1650
+ # @return [::Gapic::Config::Method]
1651
+ #
1652
+ attr_reader :delete_service
1653
+ ##
1654
+ # RPC-specific configuration for `create_endpoint`
1655
+ # @return [::Gapic::Config::Method]
1656
+ #
1657
+ attr_reader :create_endpoint
1658
+ ##
1659
+ # RPC-specific configuration for `list_endpoints`
1660
+ # @return [::Gapic::Config::Method]
1661
+ #
1662
+ attr_reader :list_endpoints
1663
+ ##
1664
+ # RPC-specific configuration for `get_endpoint`
1665
+ # @return [::Gapic::Config::Method]
1666
+ #
1667
+ attr_reader :get_endpoint
1668
+ ##
1669
+ # RPC-specific configuration for `update_endpoint`
1670
+ # @return [::Gapic::Config::Method]
1671
+ #
1672
+ attr_reader :update_endpoint
1673
+ ##
1674
+ # RPC-specific configuration for `delete_endpoint`
1675
+ # @return [::Gapic::Config::Method]
1676
+ #
1677
+ attr_reader :delete_endpoint
1678
+ ##
1679
+ # RPC-specific configuration for `get_iam_policy`
1680
+ # @return [::Gapic::Config::Method]
1681
+ #
1682
+ attr_reader :get_iam_policy
1683
+ ##
1684
+ # RPC-specific configuration for `set_iam_policy`
1685
+ # @return [::Gapic::Config::Method]
1686
+ #
1687
+ attr_reader :set_iam_policy
1688
+ ##
1689
+ # RPC-specific configuration for `test_iam_permissions`
1690
+ # @return [::Gapic::Config::Method]
1691
+ #
1692
+ attr_reader :test_iam_permissions
1693
+
1694
+ # @private
1695
+ def initialize parent_rpcs = nil
1696
+ create_namespace_config = parent_rpcs.create_namespace if parent_rpcs.respond_to? :create_namespace
1697
+ @create_namespace = ::Gapic::Config::Method.new create_namespace_config
1698
+ list_namespaces_config = parent_rpcs.list_namespaces if parent_rpcs.respond_to? :list_namespaces
1699
+ @list_namespaces = ::Gapic::Config::Method.new list_namespaces_config
1700
+ get_namespace_config = parent_rpcs.get_namespace if parent_rpcs.respond_to? :get_namespace
1701
+ @get_namespace = ::Gapic::Config::Method.new get_namespace_config
1702
+ update_namespace_config = parent_rpcs.update_namespace if parent_rpcs.respond_to? :update_namespace
1703
+ @update_namespace = ::Gapic::Config::Method.new update_namespace_config
1704
+ delete_namespace_config = parent_rpcs.delete_namespace if parent_rpcs.respond_to? :delete_namespace
1705
+ @delete_namespace = ::Gapic::Config::Method.new delete_namespace_config
1706
+ create_service_config = parent_rpcs.create_service if parent_rpcs.respond_to? :create_service
1707
+ @create_service = ::Gapic::Config::Method.new create_service_config
1708
+ list_services_config = parent_rpcs.list_services if parent_rpcs.respond_to? :list_services
1709
+ @list_services = ::Gapic::Config::Method.new list_services_config
1710
+ get_service_config = parent_rpcs.get_service if parent_rpcs.respond_to? :get_service
1711
+ @get_service = ::Gapic::Config::Method.new get_service_config
1712
+ update_service_config = parent_rpcs.update_service if parent_rpcs.respond_to? :update_service
1713
+ @update_service = ::Gapic::Config::Method.new update_service_config
1714
+ delete_service_config = parent_rpcs.delete_service if parent_rpcs.respond_to? :delete_service
1715
+ @delete_service = ::Gapic::Config::Method.new delete_service_config
1716
+ create_endpoint_config = parent_rpcs.create_endpoint if parent_rpcs.respond_to? :create_endpoint
1717
+ @create_endpoint = ::Gapic::Config::Method.new create_endpoint_config
1718
+ list_endpoints_config = parent_rpcs.list_endpoints if parent_rpcs.respond_to? :list_endpoints
1719
+ @list_endpoints = ::Gapic::Config::Method.new list_endpoints_config
1720
+ get_endpoint_config = parent_rpcs.get_endpoint if parent_rpcs.respond_to? :get_endpoint
1721
+ @get_endpoint = ::Gapic::Config::Method.new get_endpoint_config
1722
+ update_endpoint_config = parent_rpcs.update_endpoint if parent_rpcs.respond_to? :update_endpoint
1723
+ @update_endpoint = ::Gapic::Config::Method.new update_endpoint_config
1724
+ delete_endpoint_config = parent_rpcs.delete_endpoint if parent_rpcs.respond_to? :delete_endpoint
1725
+ @delete_endpoint = ::Gapic::Config::Method.new delete_endpoint_config
1726
+ get_iam_policy_config = parent_rpcs.get_iam_policy if parent_rpcs.respond_to? :get_iam_policy
1727
+ @get_iam_policy = ::Gapic::Config::Method.new get_iam_policy_config
1728
+ set_iam_policy_config = parent_rpcs.set_iam_policy if parent_rpcs.respond_to? :set_iam_policy
1729
+ @set_iam_policy = ::Gapic::Config::Method.new set_iam_policy_config
1730
+ test_iam_permissions_config = parent_rpcs.test_iam_permissions if parent_rpcs.respond_to? :test_iam_permissions
1731
+ @test_iam_permissions = ::Gapic::Config::Method.new test_iam_permissions_config
1732
+
1733
+ yield self if block_given?
1734
+ end
1735
+ end
1736
+ end
1737
+ end
1738
+ end
1739
+ end
1740
+ end
1741
+ end
1742
+ end
1743
+ end