google-cloud-service_directory-v1beta1 0.1.0

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