google-cloud-service_directory-v1 0.5.0 → 0.7.0

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