google-cloud-ids-v1 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.
@@ -0,0 +1,765 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2021 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+ require "google/cloud/errors"
20
+ require "google/cloud/ids/v1/ids_pb"
21
+
22
+ module Google
23
+ module Cloud
24
+ module IDS
25
+ module V1
26
+ module IDS
27
+ ##
28
+ # Client for the IDS service.
29
+ #
30
+ # The IDS Service
31
+ #
32
+ class Client
33
+ include Paths
34
+
35
+ # @private
36
+ attr_reader :ids_stub
37
+
38
+ ##
39
+ # Configure the IDS Client class.
40
+ #
41
+ # See {::Google::Cloud::IDS::V1::IDS::Client::Configuration}
42
+ # for a description of the configuration fields.
43
+ #
44
+ # @example
45
+ #
46
+ # # Modify the configuration for all IDS clients
47
+ # ::Google::Cloud::IDS::V1::IDS::Client.configure do |config|
48
+ # config.timeout = 10.0
49
+ # end
50
+ #
51
+ # @yield [config] Configure the Client client.
52
+ # @yieldparam config [Client::Configuration]
53
+ #
54
+ # @return [Client::Configuration]
55
+ #
56
+ def self.configure
57
+ @configure ||= begin
58
+ namespace = ["Google", "Cloud", "IDS", "V1"]
59
+ parent_config = while namespace.any?
60
+ parent_name = namespace.join "::"
61
+ parent_const = const_get parent_name
62
+ break parent_const.configure if parent_const.respond_to? :configure
63
+ namespace.pop
64
+ end
65
+ default_config = Client::Configuration.new parent_config
66
+
67
+ default_config.rpcs.list_endpoints.timeout = 60.0
68
+ default_config.rpcs.list_endpoints.retry_policy = {
69
+ initial_delay: 0.25, max_delay: 32.0, multiplier: 1.3, retry_codes: [14]
70
+ }
71
+
72
+ default_config.rpcs.get_endpoint.timeout = 60.0
73
+ default_config.rpcs.get_endpoint.retry_policy = {
74
+ initial_delay: 0.25, max_delay: 32.0, multiplier: 1.3, retry_codes: [14]
75
+ }
76
+
77
+ default_config.rpcs.create_endpoint.timeout = 3600.0
78
+
79
+ default_config.rpcs.delete_endpoint.timeout = 3600.0
80
+
81
+ default_config
82
+ end
83
+ yield @configure if block_given?
84
+ @configure
85
+ end
86
+
87
+ ##
88
+ # Configure the IDS Client instance.
89
+ #
90
+ # The configuration is set to the derived mode, meaning that values can be changed,
91
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
92
+ # should be made on {Client.configure}.
93
+ #
94
+ # See {::Google::Cloud::IDS::V1::IDS::Client::Configuration}
95
+ # for a description of the configuration fields.
96
+ #
97
+ # @yield [config] Configure the Client client.
98
+ # @yieldparam config [Client::Configuration]
99
+ #
100
+ # @return [Client::Configuration]
101
+ #
102
+ def configure
103
+ yield @config if block_given?
104
+ @config
105
+ end
106
+
107
+ ##
108
+ # Create a new IDS client object.
109
+ #
110
+ # @example
111
+ #
112
+ # # Create a client using the default configuration
113
+ # client = ::Google::Cloud::IDS::V1::IDS::Client.new
114
+ #
115
+ # # Create a client using a custom configuration
116
+ # client = ::Google::Cloud::IDS::V1::IDS::Client.new do |config|
117
+ # config.timeout = 10.0
118
+ # end
119
+ #
120
+ # @yield [config] Configure the IDS client.
121
+ # @yieldparam config [Client::Configuration]
122
+ #
123
+ def initialize
124
+ # These require statements are intentionally placed here to initialize
125
+ # the gRPC module only when it's required.
126
+ # See https://github.com/googleapis/toolkit/issues/446
127
+ require "gapic/grpc"
128
+ require "google/cloud/ids/v1/ids_services_pb"
129
+
130
+ # Create the configuration object
131
+ @config = Configuration.new Client.configure
132
+
133
+ # Yield the configuration if needed
134
+ yield @config if block_given?
135
+
136
+ # Create credentials
137
+ credentials = @config.credentials
138
+ # Use self-signed JWT if the endpoint is unchanged from default,
139
+ # but only if the default endpoint does not have a region prefix.
140
+ enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
141
+ !@config.endpoint.split(".").first.include?("-")
142
+ credentials ||= Credentials.default scope: @config.scope,
143
+ enable_self_signed_jwt: enable_self_signed_jwt
144
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
145
+ credentials = Credentials.new credentials, scope: @config.scope
146
+ end
147
+ @quota_project_id = @config.quota_project
148
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
149
+
150
+ @operations_client = Operations.new do |config|
151
+ config.credentials = credentials
152
+ config.endpoint = @config.endpoint
153
+ end
154
+
155
+ @ids_stub = ::Gapic::ServiceStub.new(
156
+ ::Google::Cloud::IDS::V1::IDS::Stub,
157
+ credentials: credentials,
158
+ endpoint: @config.endpoint,
159
+ channel_args: @config.channel_args,
160
+ interceptors: @config.interceptors
161
+ )
162
+ end
163
+
164
+ ##
165
+ # Get the associated client for long-running operations.
166
+ #
167
+ # @return [::Google::Cloud::IDS::V1::IDS::Operations]
168
+ #
169
+ attr_reader :operations_client
170
+
171
+ # Service calls
172
+
173
+ ##
174
+ # Lists Endpoints in a given project and location.
175
+ #
176
+ # @overload list_endpoints(request, options = nil)
177
+ # Pass arguments to `list_endpoints` via a request object, either of type
178
+ # {::Google::Cloud::IDS::V1::ListEndpointsRequest} or an equivalent Hash.
179
+ #
180
+ # @param request [::Google::Cloud::IDS::V1::ListEndpointsRequest, ::Hash]
181
+ # A request object representing the call parameters. Required. To specify no
182
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
183
+ # @param options [::Gapic::CallOptions, ::Hash]
184
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
185
+ #
186
+ # @overload list_endpoints(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil)
187
+ # Pass arguments to `list_endpoints` via keyword arguments. Note that at
188
+ # least one keyword argument is required. To specify no parameters, or to keep all
189
+ # the default parameter values, pass an empty Hash as a request object (see above).
190
+ #
191
+ # @param parent [::String]
192
+ # Required. The parent, which owns this collection of endpoints.
193
+ # @param page_size [::Integer]
194
+ # Optional. The maximum number of endpoints to return. The service may return fewer
195
+ # than this value.
196
+ # @param page_token [::String]
197
+ # Optional. A page token, received from a previous `ListEndpoints` call.
198
+ # Provide this to retrieve the subsequent page.
199
+ #
200
+ # When paginating, all other parameters provided to `ListEndpoints` must
201
+ # match the call that provided the page token.
202
+ # @param filter [::String]
203
+ # Optional. The filter expression, following the syntax outlined in
204
+ # https://google.aip.dev/160.
205
+ # @param order_by [::String]
206
+ # Optional. One or more fields to compare and use to sort the output.
207
+ # See https://google.aip.dev/132#ordering.
208
+ #
209
+ # @yield [response, operation] Access the result along with the RPC operation
210
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::IDS::V1::Endpoint>]
211
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
212
+ #
213
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::IDS::V1::Endpoint>]
214
+ #
215
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
216
+ #
217
+ # @example Basic example
218
+ # require "google/cloud/ids/v1"
219
+ #
220
+ # # Create a client object. The client can be reused for multiple calls.
221
+ # client = Google::Cloud::IDS::V1::IDS::Client.new
222
+ #
223
+ # # Create a request. To set request fields, pass in keyword arguments.
224
+ # request = Google::Cloud::IDS::V1::ListEndpointsRequest.new
225
+ #
226
+ # # Call the list_endpoints method.
227
+ # result = client.list_endpoints request
228
+ #
229
+ # # The returned object is of type Gapic::PagedEnumerable. You can
230
+ # # iterate over all elements by calling #each, and the enumerable
231
+ # # will lazily make API calls to fetch subsequent pages. Other
232
+ # # methods are also available for managing paging directly.
233
+ # result.each do |response|
234
+ # # Each element is of type ::Google::Cloud::IDS::V1::Endpoint.
235
+ # p response
236
+ # end
237
+ #
238
+ def list_endpoints request, options = nil
239
+ raise ::ArgumentError, "request must be provided" if request.nil?
240
+
241
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::IDS::V1::ListEndpointsRequest
242
+
243
+ # Converts hash and nil to an options object
244
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
245
+
246
+ # Customize the options with defaults
247
+ metadata = @config.rpcs.list_endpoints.metadata.to_h
248
+
249
+ # Set x-goog-api-client and x-goog-user-project headers
250
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
251
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
252
+ gapic_version: ::Google::Cloud::IDS::V1::VERSION
253
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
254
+
255
+ header_params = {}
256
+ if request.parent
257
+ header_params["parent"] = request.parent
258
+ end
259
+
260
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
261
+ metadata[:"x-goog-request-params"] ||= request_params_header
262
+
263
+ options.apply_defaults timeout: @config.rpcs.list_endpoints.timeout,
264
+ metadata: metadata,
265
+ retry_policy: @config.rpcs.list_endpoints.retry_policy
266
+
267
+ options.apply_defaults timeout: @config.timeout,
268
+ metadata: @config.metadata,
269
+ retry_policy: @config.retry_policy
270
+
271
+ @ids_stub.call_rpc :list_endpoints, request, options: options do |response, operation|
272
+ response = ::Gapic::PagedEnumerable.new @ids_stub, :list_endpoints, request, response, operation, options
273
+ yield response, operation if block_given?
274
+ return response
275
+ end
276
+ rescue ::GRPC::BadStatus => e
277
+ raise ::Google::Cloud::Error.from_error(e)
278
+ end
279
+
280
+ ##
281
+ # Gets details of a single Endpoint.
282
+ #
283
+ # @overload get_endpoint(request, options = nil)
284
+ # Pass arguments to `get_endpoint` via a request object, either of type
285
+ # {::Google::Cloud::IDS::V1::GetEndpointRequest} or an equivalent Hash.
286
+ #
287
+ # @param request [::Google::Cloud::IDS::V1::GetEndpointRequest, ::Hash]
288
+ # A request object representing the call parameters. Required. To specify no
289
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
290
+ # @param options [::Gapic::CallOptions, ::Hash]
291
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
292
+ #
293
+ # @overload get_endpoint(name: nil)
294
+ # Pass arguments to `get_endpoint` via keyword arguments. Note that at
295
+ # least one keyword argument is required. To specify no parameters, or to keep all
296
+ # the default parameter values, pass an empty Hash as a request object (see above).
297
+ #
298
+ # @param name [::String]
299
+ # Required. The name of the endpoint to retrieve.
300
+ # Format: `projects/{project}/locations/{location}/endpoints/{endpoint}`
301
+ #
302
+ # @yield [response, operation] Access the result along with the RPC operation
303
+ # @yieldparam response [::Google::Cloud::IDS::V1::Endpoint]
304
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
305
+ #
306
+ # @return [::Google::Cloud::IDS::V1::Endpoint]
307
+ #
308
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
309
+ #
310
+ # @example Basic example
311
+ # require "google/cloud/ids/v1"
312
+ #
313
+ # # Create a client object. The client can be reused for multiple calls.
314
+ # client = Google::Cloud::IDS::V1::IDS::Client.new
315
+ #
316
+ # # Create a request. To set request fields, pass in keyword arguments.
317
+ # request = Google::Cloud::IDS::V1::GetEndpointRequest.new
318
+ #
319
+ # # Call the get_endpoint method.
320
+ # result = client.get_endpoint request
321
+ #
322
+ # # The returned object is of type Google::Cloud::IDS::V1::Endpoint.
323
+ # p result
324
+ #
325
+ def get_endpoint request, options = nil
326
+ raise ::ArgumentError, "request must be provided" if request.nil?
327
+
328
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::IDS::V1::GetEndpointRequest
329
+
330
+ # Converts hash and nil to an options object
331
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
332
+
333
+ # Customize the options with defaults
334
+ metadata = @config.rpcs.get_endpoint.metadata.to_h
335
+
336
+ # Set x-goog-api-client and x-goog-user-project headers
337
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
338
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
339
+ gapic_version: ::Google::Cloud::IDS::V1::VERSION
340
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
341
+
342
+ header_params = {}
343
+ if request.name
344
+ header_params["name"] = request.name
345
+ end
346
+
347
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
348
+ metadata[:"x-goog-request-params"] ||= request_params_header
349
+
350
+ options.apply_defaults timeout: @config.rpcs.get_endpoint.timeout,
351
+ metadata: metadata,
352
+ retry_policy: @config.rpcs.get_endpoint.retry_policy
353
+
354
+ options.apply_defaults timeout: @config.timeout,
355
+ metadata: @config.metadata,
356
+ retry_policy: @config.retry_policy
357
+
358
+ @ids_stub.call_rpc :get_endpoint, request, options: options do |response, operation|
359
+ yield response, operation if block_given?
360
+ return response
361
+ end
362
+ rescue ::GRPC::BadStatus => e
363
+ raise ::Google::Cloud::Error.from_error(e)
364
+ end
365
+
366
+ ##
367
+ # Creates a new Endpoint in a given project and location.
368
+ #
369
+ # @overload create_endpoint(request, options = nil)
370
+ # Pass arguments to `create_endpoint` via a request object, either of type
371
+ # {::Google::Cloud::IDS::V1::CreateEndpointRequest} or an equivalent Hash.
372
+ #
373
+ # @param request [::Google::Cloud::IDS::V1::CreateEndpointRequest, ::Hash]
374
+ # A request object representing the call parameters. Required. To specify no
375
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
376
+ # @param options [::Gapic::CallOptions, ::Hash]
377
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
378
+ #
379
+ # @overload create_endpoint(parent: nil, endpoint_id: nil, endpoint: nil, request_id: nil)
380
+ # Pass arguments to `create_endpoint` via keyword arguments. Note that at
381
+ # least one keyword argument is required. To specify no parameters, or to keep all
382
+ # the default parameter values, pass an empty Hash as a request object (see above).
383
+ #
384
+ # @param parent [::String]
385
+ # Required. The endpoint's parent.
386
+ # @param endpoint_id [::String]
387
+ # Required. The endpoint identifier. This will be part of the endpoint's
388
+ # resource name.
389
+ # This value must start with a lowercase letter followed by up to 62
390
+ # lowercase letters, numbers, or hyphens, and cannot end with a hyphen.
391
+ # Values that do not match this pattern will trigger an INVALID_ARGUMENT
392
+ # error.
393
+ # @param endpoint [::Google::Cloud::IDS::V1::Endpoint, ::Hash]
394
+ # Required. The endpoint to create.
395
+ # @param request_id [::String]
396
+ # An optional request ID to identify requests. Specify a unique request ID
397
+ # so that if you must retry your request, the server will know to ignore
398
+ # the request if it has already been completed. The server will guarantee
399
+ # that for at least 60 minutes since the first request.
400
+ #
401
+ # For example, consider a situation where you make an initial request and t
402
+ # he request times out. If you make the request again with the same request
403
+ # ID, the server can check if original operation with the same request ID
404
+ # was received, and if so, will ignore the second request. This prevents
405
+ # clients from accidentally creating duplicate commitments.
406
+ #
407
+ # The request ID must be a valid UUID with the exception that zero UUID is
408
+ # not supported (00000000-0000-0000-0000-000000000000).
409
+ #
410
+ # @yield [response, operation] Access the result along with the RPC operation
411
+ # @yieldparam response [::Gapic::Operation]
412
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
413
+ #
414
+ # @return [::Gapic::Operation]
415
+ #
416
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
417
+ #
418
+ # @example Basic example
419
+ # require "google/cloud/ids/v1"
420
+ #
421
+ # # Create a client object. The client can be reused for multiple calls.
422
+ # client = Google::Cloud::IDS::V1::IDS::Client.new
423
+ #
424
+ # # Create a request. To set request fields, pass in keyword arguments.
425
+ # request = Google::Cloud::IDS::V1::CreateEndpointRequest.new
426
+ #
427
+ # # Call the create_endpoint method.
428
+ # result = client.create_endpoint request
429
+ #
430
+ # # The returned object is of type Gapic::Operation. You can use this
431
+ # # object to check the status of an operation, cancel it, or wait
432
+ # # for results. Here is how to block until completion:
433
+ # result.wait_until_done! timeout: 60
434
+ # if result.response?
435
+ # p result.response
436
+ # else
437
+ # puts "Error!"
438
+ # end
439
+ #
440
+ def create_endpoint request, options = nil
441
+ raise ::ArgumentError, "request must be provided" if request.nil?
442
+
443
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::IDS::V1::CreateEndpointRequest
444
+
445
+ # Converts hash and nil to an options object
446
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
447
+
448
+ # Customize the options with defaults
449
+ metadata = @config.rpcs.create_endpoint.metadata.to_h
450
+
451
+ # Set x-goog-api-client and x-goog-user-project headers
452
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
453
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
454
+ gapic_version: ::Google::Cloud::IDS::V1::VERSION
455
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
456
+
457
+ header_params = {}
458
+ if request.parent
459
+ header_params["parent"] = request.parent
460
+ end
461
+
462
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
463
+ metadata[:"x-goog-request-params"] ||= request_params_header
464
+
465
+ options.apply_defaults timeout: @config.rpcs.create_endpoint.timeout,
466
+ metadata: metadata,
467
+ retry_policy: @config.rpcs.create_endpoint.retry_policy
468
+
469
+ options.apply_defaults timeout: @config.timeout,
470
+ metadata: @config.metadata,
471
+ retry_policy: @config.retry_policy
472
+
473
+ @ids_stub.call_rpc :create_endpoint, request, options: options do |response, operation|
474
+ response = ::Gapic::Operation.new response, @operations_client, options: options
475
+ yield response, operation if block_given?
476
+ return response
477
+ end
478
+ rescue ::GRPC::BadStatus => e
479
+ raise ::Google::Cloud::Error.from_error(e)
480
+ end
481
+
482
+ ##
483
+ # Deletes a single Endpoint.
484
+ #
485
+ # @overload delete_endpoint(request, options = nil)
486
+ # Pass arguments to `delete_endpoint` via a request object, either of type
487
+ # {::Google::Cloud::IDS::V1::DeleteEndpointRequest} or an equivalent Hash.
488
+ #
489
+ # @param request [::Google::Cloud::IDS::V1::DeleteEndpointRequest, ::Hash]
490
+ # A request object representing the call parameters. Required. To specify no
491
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
492
+ # @param options [::Gapic::CallOptions, ::Hash]
493
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
494
+ #
495
+ # @overload delete_endpoint(name: nil, request_id: nil)
496
+ # Pass arguments to `delete_endpoint` via keyword arguments. Note that at
497
+ # least one keyword argument is required. To specify no parameters, or to keep all
498
+ # the default parameter values, pass an empty Hash as a request object (see above).
499
+ #
500
+ # @param name [::String]
501
+ # Required. The name of the endpoint to delete.
502
+ # @param request_id [::String]
503
+ # An optional request ID to identify requests. Specify a unique request ID
504
+ # so that if you must retry your request, the server will know to ignore
505
+ # the request if it has already been completed. The server will guarantee
506
+ # that for at least 60 minutes after the first request.
507
+ #
508
+ # For example, consider a situation where you make an initial request and t
509
+ # he request times out. If you make the request again with the same request
510
+ # ID, the server can check if original operation with the same request ID
511
+ # was received, and if so, will ignore the second request. This prevents
512
+ # clients from accidentally creating duplicate commitments.
513
+ #
514
+ # The request ID must be a valid UUID with the exception that zero UUID is
515
+ # not supported (00000000-0000-0000-0000-000000000000).
516
+ #
517
+ # @yield [response, operation] Access the result along with the RPC operation
518
+ # @yieldparam response [::Gapic::Operation]
519
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
520
+ #
521
+ # @return [::Gapic::Operation]
522
+ #
523
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
524
+ #
525
+ # @example Basic example
526
+ # require "google/cloud/ids/v1"
527
+ #
528
+ # # Create a client object. The client can be reused for multiple calls.
529
+ # client = Google::Cloud::IDS::V1::IDS::Client.new
530
+ #
531
+ # # Create a request. To set request fields, pass in keyword arguments.
532
+ # request = Google::Cloud::IDS::V1::DeleteEndpointRequest.new
533
+ #
534
+ # # Call the delete_endpoint method.
535
+ # result = client.delete_endpoint request
536
+ #
537
+ # # The returned object is of type Gapic::Operation. You can use this
538
+ # # object to check the status of an operation, cancel it, or wait
539
+ # # for results. Here is how to block until completion:
540
+ # result.wait_until_done! timeout: 60
541
+ # if result.response?
542
+ # p result.response
543
+ # else
544
+ # puts "Error!"
545
+ # end
546
+ #
547
+ def delete_endpoint request, options = nil
548
+ raise ::ArgumentError, "request must be provided" if request.nil?
549
+
550
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::IDS::V1::DeleteEndpointRequest
551
+
552
+ # Converts hash and nil to an options object
553
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
554
+
555
+ # Customize the options with defaults
556
+ metadata = @config.rpcs.delete_endpoint.metadata.to_h
557
+
558
+ # Set x-goog-api-client and x-goog-user-project headers
559
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
560
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
561
+ gapic_version: ::Google::Cloud::IDS::V1::VERSION
562
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
563
+
564
+ header_params = {}
565
+ if request.name
566
+ header_params["name"] = request.name
567
+ end
568
+
569
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
570
+ metadata[:"x-goog-request-params"] ||= request_params_header
571
+
572
+ options.apply_defaults timeout: @config.rpcs.delete_endpoint.timeout,
573
+ metadata: metadata,
574
+ retry_policy: @config.rpcs.delete_endpoint.retry_policy
575
+
576
+ options.apply_defaults timeout: @config.timeout,
577
+ metadata: @config.metadata,
578
+ retry_policy: @config.retry_policy
579
+
580
+ @ids_stub.call_rpc :delete_endpoint, request, options: options do |response, operation|
581
+ response = ::Gapic::Operation.new response, @operations_client, options: options
582
+ yield response, operation if block_given?
583
+ return response
584
+ end
585
+ rescue ::GRPC::BadStatus => e
586
+ raise ::Google::Cloud::Error.from_error(e)
587
+ end
588
+
589
+ ##
590
+ # Configuration class for the IDS API.
591
+ #
592
+ # This class represents the configuration for IDS,
593
+ # providing control over timeouts, retry behavior, logging, transport
594
+ # parameters, and other low-level controls. Certain parameters can also be
595
+ # applied individually to specific RPCs. See
596
+ # {::Google::Cloud::IDS::V1::IDS::Client::Configuration::Rpcs}
597
+ # for a list of RPCs that can be configured independently.
598
+ #
599
+ # Configuration can be applied globally to all clients, or to a single client
600
+ # on construction.
601
+ #
602
+ # @example
603
+ #
604
+ # # Modify the global config, setting the timeout for
605
+ # # list_endpoints to 20 seconds,
606
+ # # and all remaining timeouts to 10 seconds.
607
+ # ::Google::Cloud::IDS::V1::IDS::Client.configure do |config|
608
+ # config.timeout = 10.0
609
+ # config.rpcs.list_endpoints.timeout = 20.0
610
+ # end
611
+ #
612
+ # # Apply the above configuration only to a new client.
613
+ # client = ::Google::Cloud::IDS::V1::IDS::Client.new do |config|
614
+ # config.timeout = 10.0
615
+ # config.rpcs.list_endpoints.timeout = 20.0
616
+ # end
617
+ #
618
+ # @!attribute [rw] endpoint
619
+ # The hostname or hostname:port of the service endpoint.
620
+ # Defaults to `"ids.googleapis.com"`.
621
+ # @return [::String]
622
+ # @!attribute [rw] credentials
623
+ # Credentials to send with calls. You may provide any of the following types:
624
+ # * (`String`) The path to a service account key file in JSON format
625
+ # * (`Hash`) A service account key as a Hash
626
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
627
+ # (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
628
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
629
+ # (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
630
+ # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
631
+ # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
632
+ # * (`nil`) indicating no credentials
633
+ # @return [::Object]
634
+ # @!attribute [rw] scope
635
+ # The OAuth scopes
636
+ # @return [::Array<::String>]
637
+ # @!attribute [rw] lib_name
638
+ # The library name as recorded in instrumentation and logging
639
+ # @return [::String]
640
+ # @!attribute [rw] lib_version
641
+ # The library version as recorded in instrumentation and logging
642
+ # @return [::String]
643
+ # @!attribute [rw] channel_args
644
+ # Extra parameters passed to the gRPC channel. Note: this is ignored if a
645
+ # `GRPC::Core::Channel` object is provided as the credential.
646
+ # @return [::Hash]
647
+ # @!attribute [rw] interceptors
648
+ # An array of interceptors that are run before calls are executed.
649
+ # @return [::Array<::GRPC::ClientInterceptor>]
650
+ # @!attribute [rw] timeout
651
+ # The call timeout in seconds.
652
+ # @return [::Numeric]
653
+ # @!attribute [rw] metadata
654
+ # Additional gRPC headers to be sent with the call.
655
+ # @return [::Hash{::Symbol=>::String}]
656
+ # @!attribute [rw] retry_policy
657
+ # The retry policy. The value is a hash with the following keys:
658
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
659
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
660
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
661
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
662
+ # trigger a retry.
663
+ # @return [::Hash]
664
+ # @!attribute [rw] quota_project
665
+ # A separate project against which to charge quota.
666
+ # @return [::String]
667
+ #
668
+ class Configuration
669
+ extend ::Gapic::Config
670
+
671
+ config_attr :endpoint, "ids.googleapis.com", ::String
672
+ config_attr :credentials, nil do |value|
673
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
674
+ allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
675
+ allowed.any? { |klass| klass === value }
676
+ end
677
+ config_attr :scope, nil, ::String, ::Array, nil
678
+ config_attr :lib_name, nil, ::String, nil
679
+ config_attr :lib_version, nil, ::String, nil
680
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
681
+ config_attr :interceptors, nil, ::Array, nil
682
+ config_attr :timeout, nil, ::Numeric, nil
683
+ config_attr :metadata, nil, ::Hash, nil
684
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
685
+ config_attr :quota_project, nil, ::String, nil
686
+
687
+ # @private
688
+ def initialize parent_config = nil
689
+ @parent_config = parent_config unless parent_config.nil?
690
+
691
+ yield self if block_given?
692
+ end
693
+
694
+ ##
695
+ # Configurations for individual RPCs
696
+ # @return [Rpcs]
697
+ #
698
+ def rpcs
699
+ @rpcs ||= begin
700
+ parent_rpcs = nil
701
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
702
+ Rpcs.new parent_rpcs
703
+ end
704
+ end
705
+
706
+ ##
707
+ # Configuration RPC class for the IDS API.
708
+ #
709
+ # Includes fields providing the configuration for each RPC in this service.
710
+ # Each configuration object is of type `Gapic::Config::Method` and includes
711
+ # the following configuration fields:
712
+ #
713
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
714
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
715
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
716
+ # include the following keys:
717
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
718
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
719
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
720
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
721
+ # trigger a retry.
722
+ #
723
+ class Rpcs
724
+ ##
725
+ # RPC-specific configuration for `list_endpoints`
726
+ # @return [::Gapic::Config::Method]
727
+ #
728
+ attr_reader :list_endpoints
729
+ ##
730
+ # RPC-specific configuration for `get_endpoint`
731
+ # @return [::Gapic::Config::Method]
732
+ #
733
+ attr_reader :get_endpoint
734
+ ##
735
+ # RPC-specific configuration for `create_endpoint`
736
+ # @return [::Gapic::Config::Method]
737
+ #
738
+ attr_reader :create_endpoint
739
+ ##
740
+ # RPC-specific configuration for `delete_endpoint`
741
+ # @return [::Gapic::Config::Method]
742
+ #
743
+ attr_reader :delete_endpoint
744
+
745
+ # @private
746
+ def initialize parent_rpcs = nil
747
+ list_endpoints_config = parent_rpcs.list_endpoints if parent_rpcs.respond_to? :list_endpoints
748
+ @list_endpoints = ::Gapic::Config::Method.new list_endpoints_config
749
+ get_endpoint_config = parent_rpcs.get_endpoint if parent_rpcs.respond_to? :get_endpoint
750
+ @get_endpoint = ::Gapic::Config::Method.new get_endpoint_config
751
+ create_endpoint_config = parent_rpcs.create_endpoint if parent_rpcs.respond_to? :create_endpoint
752
+ @create_endpoint = ::Gapic::Config::Method.new create_endpoint_config
753
+ delete_endpoint_config = parent_rpcs.delete_endpoint if parent_rpcs.respond_to? :delete_endpoint
754
+ @delete_endpoint = ::Gapic::Config::Method.new delete_endpoint_config
755
+
756
+ yield self if block_given?
757
+ end
758
+ end
759
+ end
760
+ end
761
+ end
762
+ end
763
+ end
764
+ end
765
+ end