google-cloud-iap-v1 0.4.0 → 0.6.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,872 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2023 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+ require "google/cloud/errors"
20
+ require "google/cloud/iap/v1/service_pb"
21
+ require "google/cloud/iap/v1/identity_aware_proxy_o_auth_service/rest/service_stub"
22
+
23
+ module Google
24
+ module Cloud
25
+ module Iap
26
+ module V1
27
+ module IdentityAwareProxyOAuthService
28
+ module Rest
29
+ ##
30
+ # REST client for the IdentityAwareProxyOAuthService service.
31
+ #
32
+ # API to programmatically create, list and retrieve Identity Aware Proxy (IAP)
33
+ # OAuth brands; and create, retrieve, delete and reset-secret of IAP OAuth
34
+ # clients.
35
+ #
36
+ class Client
37
+ # @private
38
+ attr_reader :identity_aware_proxy_o_auth_service_stub
39
+
40
+ ##
41
+ # Configure the IdentityAwareProxyOAuthService Client class.
42
+ #
43
+ # See {::Google::Cloud::Iap::V1::IdentityAwareProxyOAuthService::Rest::Client::Configuration}
44
+ # for a description of the configuration fields.
45
+ #
46
+ # @example
47
+ #
48
+ # # Modify the configuration for all IdentityAwareProxyOAuthService clients
49
+ # ::Google::Cloud::Iap::V1::IdentityAwareProxyOAuthService::Rest::Client.configure do |config|
50
+ # config.timeout = 10.0
51
+ # end
52
+ #
53
+ # @yield [config] Configure the Client client.
54
+ # @yieldparam config [Client::Configuration]
55
+ #
56
+ # @return [Client::Configuration]
57
+ #
58
+ def self.configure
59
+ @configure ||= begin
60
+ namespace = ["Google", "Cloud", "Iap", "V1"]
61
+ parent_config = while namespace.any?
62
+ parent_name = namespace.join "::"
63
+ parent_const = const_get parent_name
64
+ break parent_const.configure if parent_const.respond_to? :configure
65
+ namespace.pop
66
+ end
67
+ default_config = Client::Configuration.new parent_config
68
+
69
+ default_config.timeout = 60.0
70
+
71
+ default_config
72
+ end
73
+ yield @configure if block_given?
74
+ @configure
75
+ end
76
+
77
+ ##
78
+ # Configure the IdentityAwareProxyOAuthService Client instance.
79
+ #
80
+ # The configuration is set to the derived mode, meaning that values can be changed,
81
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
82
+ # should be made on {Client.configure}.
83
+ #
84
+ # See {::Google::Cloud::Iap::V1::IdentityAwareProxyOAuthService::Rest::Client::Configuration}
85
+ # for a description of the configuration fields.
86
+ #
87
+ # @yield [config] Configure the Client client.
88
+ # @yieldparam config [Client::Configuration]
89
+ #
90
+ # @return [Client::Configuration]
91
+ #
92
+ def configure
93
+ yield @config if block_given?
94
+ @config
95
+ end
96
+
97
+ ##
98
+ # Create a new IdentityAwareProxyOAuthService REST client object.
99
+ #
100
+ # @example
101
+ #
102
+ # # Create a client using the default configuration
103
+ # client = ::Google::Cloud::Iap::V1::IdentityAwareProxyOAuthService::Rest::Client.new
104
+ #
105
+ # # Create a client using a custom configuration
106
+ # client = ::Google::Cloud::Iap::V1::IdentityAwareProxyOAuthService::Rest::Client.new do |config|
107
+ # config.timeout = 10.0
108
+ # end
109
+ #
110
+ # @yield [config] Configure the IdentityAwareProxyOAuthService client.
111
+ # @yieldparam config [Client::Configuration]
112
+ #
113
+ def initialize
114
+ # Create the configuration object
115
+ @config = Configuration.new Client.configure
116
+
117
+ # Yield the configuration if needed
118
+ yield @config if block_given?
119
+
120
+ # Create credentials
121
+ credentials = @config.credentials
122
+ # Use self-signed JWT if the endpoint is unchanged from default,
123
+ # but only if the default endpoint does not have a region prefix.
124
+ enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
125
+ !@config.endpoint.split(".").first.include?("-")
126
+ credentials ||= Credentials.default scope: @config.scope,
127
+ enable_self_signed_jwt: enable_self_signed_jwt
128
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
129
+ credentials = Credentials.new credentials, scope: @config.scope
130
+ end
131
+
132
+ @quota_project_id = @config.quota_project
133
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
134
+
135
+ @identity_aware_proxy_o_auth_service_stub = ::Google::Cloud::Iap::V1::IdentityAwareProxyOAuthService::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials
136
+ end
137
+
138
+ # Service calls
139
+
140
+ ##
141
+ # Lists the existing brands for the project.
142
+ #
143
+ # @overload list_brands(request, options = nil)
144
+ # Pass arguments to `list_brands` via a request object, either of type
145
+ # {::Google::Cloud::Iap::V1::ListBrandsRequest} or an equivalent Hash.
146
+ #
147
+ # @param request [::Google::Cloud::Iap::V1::ListBrandsRequest, ::Hash]
148
+ # A request object representing the call parameters. Required. To specify no
149
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
150
+ # @param options [::Gapic::CallOptions, ::Hash]
151
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
152
+ #
153
+ # @overload list_brands(parent: nil)
154
+ # Pass arguments to `list_brands` via keyword arguments. Note that at
155
+ # least one keyword argument is required. To specify no parameters, or to keep all
156
+ # the default parameter values, pass an empty Hash as a request object (see above).
157
+ #
158
+ # @param parent [::String]
159
+ # Required. GCP Project number/id.
160
+ # In the following format: projects/\\{project_number/id}.
161
+ # @yield [result, operation] Access the result along with the TransportOperation object
162
+ # @yieldparam result [::Google::Cloud::Iap::V1::ListBrandsResponse]
163
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
164
+ #
165
+ # @return [::Google::Cloud::Iap::V1::ListBrandsResponse]
166
+ #
167
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
168
+ def list_brands request, options = nil
169
+ raise ::ArgumentError, "request must be provided" if request.nil?
170
+
171
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Iap::V1::ListBrandsRequest
172
+
173
+ # Converts hash and nil to an options object
174
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
175
+
176
+ # Customize the options with defaults
177
+ call_metadata = @config.rpcs.list_brands.metadata.to_h
178
+
179
+ # Set x-goog-api-client and x-goog-user-project headers
180
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
181
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
182
+ gapic_version: ::Google::Cloud::Iap::V1::VERSION,
183
+ transports_version_send: [:rest]
184
+
185
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
186
+
187
+ options.apply_defaults timeout: @config.rpcs.list_brands.timeout,
188
+ metadata: call_metadata,
189
+ retry_policy: @config.rpcs.list_brands.retry_policy
190
+
191
+ options.apply_defaults timeout: @config.timeout,
192
+ metadata: @config.metadata,
193
+ retry_policy: @config.retry_policy
194
+
195
+ @identity_aware_proxy_o_auth_service_stub.list_brands request, options do |result, operation|
196
+ yield result, operation if block_given?
197
+ return result
198
+ end
199
+ rescue ::Gapic::Rest::Error => e
200
+ raise ::Google::Cloud::Error.from_error(e)
201
+ end
202
+
203
+ ##
204
+ # Constructs a new OAuth brand for the project if one does not exist.
205
+ # The created brand is "internal only", meaning that OAuth clients created
206
+ # under it only accept requests from users who belong to the same Google
207
+ # Workspace organization as the project. The brand is created in an
208
+ # un-reviewed status. NOTE: The "internal only" status can be manually
209
+ # changed in the Google Cloud Console. Requires that a brand does not already
210
+ # exist for the project, and that the specified support email is owned by the
211
+ # caller.
212
+ #
213
+ # @overload create_brand(request, options = nil)
214
+ # Pass arguments to `create_brand` via a request object, either of type
215
+ # {::Google::Cloud::Iap::V1::CreateBrandRequest} or an equivalent Hash.
216
+ #
217
+ # @param request [::Google::Cloud::Iap::V1::CreateBrandRequest, ::Hash]
218
+ # A request object representing the call parameters. Required. To specify no
219
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
220
+ # @param options [::Gapic::CallOptions, ::Hash]
221
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
222
+ #
223
+ # @overload create_brand(parent: nil, brand: nil)
224
+ # Pass arguments to `create_brand` via keyword arguments. Note that at
225
+ # least one keyword argument is required. To specify no parameters, or to keep all
226
+ # the default parameter values, pass an empty Hash as a request object (see above).
227
+ #
228
+ # @param parent [::String]
229
+ # Required. GCP Project number/id under which the brand is to be created.
230
+ # In the following format: projects/\\{project_number/id}.
231
+ # @param brand [::Google::Cloud::Iap::V1::Brand, ::Hash]
232
+ # Required. The brand to be created.
233
+ # @yield [result, operation] Access the result along with the TransportOperation object
234
+ # @yieldparam result [::Google::Cloud::Iap::V1::Brand]
235
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
236
+ #
237
+ # @return [::Google::Cloud::Iap::V1::Brand]
238
+ #
239
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
240
+ def create_brand request, options = nil
241
+ raise ::ArgumentError, "request must be provided" if request.nil?
242
+
243
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Iap::V1::CreateBrandRequest
244
+
245
+ # Converts hash and nil to an options object
246
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
247
+
248
+ # Customize the options with defaults
249
+ call_metadata = @config.rpcs.create_brand.metadata.to_h
250
+
251
+ # Set x-goog-api-client and x-goog-user-project headers
252
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
253
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
254
+ gapic_version: ::Google::Cloud::Iap::V1::VERSION,
255
+ transports_version_send: [:rest]
256
+
257
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
258
+
259
+ options.apply_defaults timeout: @config.rpcs.create_brand.timeout,
260
+ metadata: call_metadata,
261
+ retry_policy: @config.rpcs.create_brand.retry_policy
262
+
263
+ options.apply_defaults timeout: @config.timeout,
264
+ metadata: @config.metadata,
265
+ retry_policy: @config.retry_policy
266
+
267
+ @identity_aware_proxy_o_auth_service_stub.create_brand request, options do |result, operation|
268
+ yield result, operation if block_given?
269
+ return result
270
+ end
271
+ rescue ::Gapic::Rest::Error => e
272
+ raise ::Google::Cloud::Error.from_error(e)
273
+ end
274
+
275
+ ##
276
+ # Retrieves the OAuth brand of the project.
277
+ #
278
+ # @overload get_brand(request, options = nil)
279
+ # Pass arguments to `get_brand` via a request object, either of type
280
+ # {::Google::Cloud::Iap::V1::GetBrandRequest} or an equivalent Hash.
281
+ #
282
+ # @param request [::Google::Cloud::Iap::V1::GetBrandRequest, ::Hash]
283
+ # A request object representing the call parameters. Required. To specify no
284
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
285
+ # @param options [::Gapic::CallOptions, ::Hash]
286
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
287
+ #
288
+ # @overload get_brand(name: nil)
289
+ # Pass arguments to `get_brand` via keyword arguments. Note that at
290
+ # least one keyword argument is required. To specify no parameters, or to keep all
291
+ # the default parameter values, pass an empty Hash as a request object (see above).
292
+ #
293
+ # @param name [::String]
294
+ # Required. Name of the brand to be fetched.
295
+ # In the following format: projects/\\{project_number/id}/brands/\\{brand}.
296
+ # @yield [result, operation] Access the result along with the TransportOperation object
297
+ # @yieldparam result [::Google::Cloud::Iap::V1::Brand]
298
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
299
+ #
300
+ # @return [::Google::Cloud::Iap::V1::Brand]
301
+ #
302
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
303
+ def get_brand request, options = nil
304
+ raise ::ArgumentError, "request must be provided" if request.nil?
305
+
306
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Iap::V1::GetBrandRequest
307
+
308
+ # Converts hash and nil to an options object
309
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
310
+
311
+ # Customize the options with defaults
312
+ call_metadata = @config.rpcs.get_brand.metadata.to_h
313
+
314
+ # Set x-goog-api-client and x-goog-user-project headers
315
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
316
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
317
+ gapic_version: ::Google::Cloud::Iap::V1::VERSION,
318
+ transports_version_send: [:rest]
319
+
320
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
321
+
322
+ options.apply_defaults timeout: @config.rpcs.get_brand.timeout,
323
+ metadata: call_metadata,
324
+ retry_policy: @config.rpcs.get_brand.retry_policy
325
+
326
+ options.apply_defaults timeout: @config.timeout,
327
+ metadata: @config.metadata,
328
+ retry_policy: @config.retry_policy
329
+
330
+ @identity_aware_proxy_o_auth_service_stub.get_brand request, options do |result, operation|
331
+ yield result, operation if block_given?
332
+ return result
333
+ end
334
+ rescue ::Gapic::Rest::Error => e
335
+ raise ::Google::Cloud::Error.from_error(e)
336
+ end
337
+
338
+ ##
339
+ # Creates an Identity Aware Proxy (IAP) OAuth client. The client is owned
340
+ # by IAP. Requires that the brand for the project exists and that it is
341
+ # set for internal-only use.
342
+ #
343
+ # @overload create_identity_aware_proxy_client(request, options = nil)
344
+ # Pass arguments to `create_identity_aware_proxy_client` via a request object, either of type
345
+ # {::Google::Cloud::Iap::V1::CreateIdentityAwareProxyClientRequest} or an equivalent Hash.
346
+ #
347
+ # @param request [::Google::Cloud::Iap::V1::CreateIdentityAwareProxyClientRequest, ::Hash]
348
+ # A request object representing the call parameters. Required. To specify no
349
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
350
+ # @param options [::Gapic::CallOptions, ::Hash]
351
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
352
+ #
353
+ # @overload create_identity_aware_proxy_client(parent: nil, identity_aware_proxy_client: nil)
354
+ # Pass arguments to `create_identity_aware_proxy_client` via keyword arguments. Note that at
355
+ # least one keyword argument is required. To specify no parameters, or to keep all
356
+ # the default parameter values, pass an empty Hash as a request object (see above).
357
+ #
358
+ # @param parent [::String]
359
+ # Required. Path to create the client in.
360
+ # In the following format:
361
+ # projects/\\{project_number/id}/brands/\\{brand}.
362
+ # The project must belong to a G Suite account.
363
+ # @param identity_aware_proxy_client [::Google::Cloud::Iap::V1::IdentityAwareProxyClient, ::Hash]
364
+ # Required. Identity Aware Proxy Client to be created.
365
+ # @yield [result, operation] Access the result along with the TransportOperation object
366
+ # @yieldparam result [::Google::Cloud::Iap::V1::IdentityAwareProxyClient]
367
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
368
+ #
369
+ # @return [::Google::Cloud::Iap::V1::IdentityAwareProxyClient]
370
+ #
371
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
372
+ def create_identity_aware_proxy_client request, options = nil
373
+ raise ::ArgumentError, "request must be provided" if request.nil?
374
+
375
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Iap::V1::CreateIdentityAwareProxyClientRequest
376
+
377
+ # Converts hash and nil to an options object
378
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
379
+
380
+ # Customize the options with defaults
381
+ call_metadata = @config.rpcs.create_identity_aware_proxy_client.metadata.to_h
382
+
383
+ # Set x-goog-api-client and x-goog-user-project headers
384
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
385
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
386
+ gapic_version: ::Google::Cloud::Iap::V1::VERSION,
387
+ transports_version_send: [:rest]
388
+
389
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
390
+
391
+ options.apply_defaults timeout: @config.rpcs.create_identity_aware_proxy_client.timeout,
392
+ metadata: call_metadata,
393
+ retry_policy: @config.rpcs.create_identity_aware_proxy_client.retry_policy
394
+
395
+ options.apply_defaults timeout: @config.timeout,
396
+ metadata: @config.metadata,
397
+ retry_policy: @config.retry_policy
398
+
399
+ @identity_aware_proxy_o_auth_service_stub.create_identity_aware_proxy_client request, options do |result, operation|
400
+ yield result, operation if block_given?
401
+ return result
402
+ end
403
+ rescue ::Gapic::Rest::Error => e
404
+ raise ::Google::Cloud::Error.from_error(e)
405
+ end
406
+
407
+ ##
408
+ # Lists the existing clients for the brand.
409
+ #
410
+ # @overload list_identity_aware_proxy_clients(request, options = nil)
411
+ # Pass arguments to `list_identity_aware_proxy_clients` via a request object, either of type
412
+ # {::Google::Cloud::Iap::V1::ListIdentityAwareProxyClientsRequest} or an equivalent Hash.
413
+ #
414
+ # @param request [::Google::Cloud::Iap::V1::ListIdentityAwareProxyClientsRequest, ::Hash]
415
+ # A request object representing the call parameters. Required. To specify no
416
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
417
+ # @param options [::Gapic::CallOptions, ::Hash]
418
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
419
+ #
420
+ # @overload list_identity_aware_proxy_clients(parent: nil, page_size: nil, page_token: nil)
421
+ # Pass arguments to `list_identity_aware_proxy_clients` via keyword arguments. Note that at
422
+ # least one keyword argument is required. To specify no parameters, or to keep all
423
+ # the default parameter values, pass an empty Hash as a request object (see above).
424
+ #
425
+ # @param parent [::String]
426
+ # Required. Full brand path.
427
+ # In the following format: projects/\\{project_number/id}/brands/\\{brand}.
428
+ # @param page_size [::Integer]
429
+ # The maximum number of clients to return. The service may return fewer than
430
+ # this value.
431
+ # If unspecified, at most 100 clients will be returned.
432
+ # The maximum value is 1000; values above 1000 will be coerced to 1000.
433
+ # @param page_token [::String]
434
+ # A page token, received from a previous `ListIdentityAwareProxyClients`
435
+ # call. Provide this to retrieve the subsequent page.
436
+ #
437
+ # When paginating, all other parameters provided to
438
+ # `ListIdentityAwareProxyClients` must match the call that provided the page
439
+ # token.
440
+ # @yield [result, operation] Access the result along with the TransportOperation object
441
+ # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Iap::V1::IdentityAwareProxyClient>]
442
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
443
+ #
444
+ # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Iap::V1::IdentityAwareProxyClient>]
445
+ #
446
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
447
+ def list_identity_aware_proxy_clients request, options = nil
448
+ raise ::ArgumentError, "request must be provided" if request.nil?
449
+
450
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Iap::V1::ListIdentityAwareProxyClientsRequest
451
+
452
+ # Converts hash and nil to an options object
453
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
454
+
455
+ # Customize the options with defaults
456
+ call_metadata = @config.rpcs.list_identity_aware_proxy_clients.metadata.to_h
457
+
458
+ # Set x-goog-api-client and x-goog-user-project headers
459
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
460
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
461
+ gapic_version: ::Google::Cloud::Iap::V1::VERSION,
462
+ transports_version_send: [:rest]
463
+
464
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
465
+
466
+ options.apply_defaults timeout: @config.rpcs.list_identity_aware_proxy_clients.timeout,
467
+ metadata: call_metadata,
468
+ retry_policy: @config.rpcs.list_identity_aware_proxy_clients.retry_policy
469
+
470
+ options.apply_defaults timeout: @config.timeout,
471
+ metadata: @config.metadata,
472
+ retry_policy: @config.retry_policy
473
+
474
+ @identity_aware_proxy_o_auth_service_stub.list_identity_aware_proxy_clients request, options do |result, operation|
475
+ result = ::Gapic::Rest::PagedEnumerable.new @identity_aware_proxy_o_auth_service_stub, :list_identity_aware_proxy_clients, "identity_aware_proxy_clients", request, result, options
476
+ yield result, operation if block_given?
477
+ return result
478
+ end
479
+ rescue ::Gapic::Rest::Error => e
480
+ raise ::Google::Cloud::Error.from_error(e)
481
+ end
482
+
483
+ ##
484
+ # Retrieves an Identity Aware Proxy (IAP) OAuth client.
485
+ # Requires that the client is owned by IAP.
486
+ #
487
+ # @overload get_identity_aware_proxy_client(request, options = nil)
488
+ # Pass arguments to `get_identity_aware_proxy_client` via a request object, either of type
489
+ # {::Google::Cloud::Iap::V1::GetIdentityAwareProxyClientRequest} or an equivalent Hash.
490
+ #
491
+ # @param request [::Google::Cloud::Iap::V1::GetIdentityAwareProxyClientRequest, ::Hash]
492
+ # A request object representing the call parameters. Required. To specify no
493
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
494
+ # @param options [::Gapic::CallOptions, ::Hash]
495
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
496
+ #
497
+ # @overload get_identity_aware_proxy_client(name: nil)
498
+ # Pass arguments to `get_identity_aware_proxy_client` via keyword arguments. Note that at
499
+ # least one keyword argument is required. To specify no parameters, or to keep all
500
+ # the default parameter values, pass an empty Hash as a request object (see above).
501
+ #
502
+ # @param name [::String]
503
+ # Required. Name of the Identity Aware Proxy client to be fetched.
504
+ # In the following format:
505
+ # projects/\\{project_number/id}/brands/\\{brand}/identityAwareProxyClients/\\{client_id}.
506
+ # @yield [result, operation] Access the result along with the TransportOperation object
507
+ # @yieldparam result [::Google::Cloud::Iap::V1::IdentityAwareProxyClient]
508
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
509
+ #
510
+ # @return [::Google::Cloud::Iap::V1::IdentityAwareProxyClient]
511
+ #
512
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
513
+ def get_identity_aware_proxy_client request, options = nil
514
+ raise ::ArgumentError, "request must be provided" if request.nil?
515
+
516
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Iap::V1::GetIdentityAwareProxyClientRequest
517
+
518
+ # Converts hash and nil to an options object
519
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
520
+
521
+ # Customize the options with defaults
522
+ call_metadata = @config.rpcs.get_identity_aware_proxy_client.metadata.to_h
523
+
524
+ # Set x-goog-api-client and x-goog-user-project headers
525
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
526
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
527
+ gapic_version: ::Google::Cloud::Iap::V1::VERSION,
528
+ transports_version_send: [:rest]
529
+
530
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
531
+
532
+ options.apply_defaults timeout: @config.rpcs.get_identity_aware_proxy_client.timeout,
533
+ metadata: call_metadata,
534
+ retry_policy: @config.rpcs.get_identity_aware_proxy_client.retry_policy
535
+
536
+ options.apply_defaults timeout: @config.timeout,
537
+ metadata: @config.metadata,
538
+ retry_policy: @config.retry_policy
539
+
540
+ @identity_aware_proxy_o_auth_service_stub.get_identity_aware_proxy_client request, options do |result, operation|
541
+ yield result, operation if block_given?
542
+ return result
543
+ end
544
+ rescue ::Gapic::Rest::Error => e
545
+ raise ::Google::Cloud::Error.from_error(e)
546
+ end
547
+
548
+ ##
549
+ # Resets an Identity Aware Proxy (IAP) OAuth client secret. Useful if the
550
+ # secret was compromised. Requires that the client is owned by IAP.
551
+ #
552
+ # @overload reset_identity_aware_proxy_client_secret(request, options = nil)
553
+ # Pass arguments to `reset_identity_aware_proxy_client_secret` via a request object, either of type
554
+ # {::Google::Cloud::Iap::V1::ResetIdentityAwareProxyClientSecretRequest} or an equivalent Hash.
555
+ #
556
+ # @param request [::Google::Cloud::Iap::V1::ResetIdentityAwareProxyClientSecretRequest, ::Hash]
557
+ # A request object representing the call parameters. Required. To specify no
558
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
559
+ # @param options [::Gapic::CallOptions, ::Hash]
560
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
561
+ #
562
+ # @overload reset_identity_aware_proxy_client_secret(name: nil)
563
+ # Pass arguments to `reset_identity_aware_proxy_client_secret` via keyword arguments. Note that at
564
+ # least one keyword argument is required. To specify no parameters, or to keep all
565
+ # the default parameter values, pass an empty Hash as a request object (see above).
566
+ #
567
+ # @param name [::String]
568
+ # Required. Name of the Identity Aware Proxy client to that will have its
569
+ # secret reset. In the following format:
570
+ # projects/\\{project_number/id}/brands/\\{brand}/identityAwareProxyClients/\\{client_id}.
571
+ # @yield [result, operation] Access the result along with the TransportOperation object
572
+ # @yieldparam result [::Google::Cloud::Iap::V1::IdentityAwareProxyClient]
573
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
574
+ #
575
+ # @return [::Google::Cloud::Iap::V1::IdentityAwareProxyClient]
576
+ #
577
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
578
+ def reset_identity_aware_proxy_client_secret request, options = nil
579
+ raise ::ArgumentError, "request must be provided" if request.nil?
580
+
581
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Iap::V1::ResetIdentityAwareProxyClientSecretRequest
582
+
583
+ # Converts hash and nil to an options object
584
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
585
+
586
+ # Customize the options with defaults
587
+ call_metadata = @config.rpcs.reset_identity_aware_proxy_client_secret.metadata.to_h
588
+
589
+ # Set x-goog-api-client and x-goog-user-project headers
590
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
591
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
592
+ gapic_version: ::Google::Cloud::Iap::V1::VERSION,
593
+ transports_version_send: [:rest]
594
+
595
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
596
+
597
+ options.apply_defaults timeout: @config.rpcs.reset_identity_aware_proxy_client_secret.timeout,
598
+ metadata: call_metadata,
599
+ retry_policy: @config.rpcs.reset_identity_aware_proxy_client_secret.retry_policy
600
+
601
+ options.apply_defaults timeout: @config.timeout,
602
+ metadata: @config.metadata,
603
+ retry_policy: @config.retry_policy
604
+
605
+ @identity_aware_proxy_o_auth_service_stub.reset_identity_aware_proxy_client_secret request, options do |result, operation|
606
+ yield result, operation if block_given?
607
+ return result
608
+ end
609
+ rescue ::Gapic::Rest::Error => e
610
+ raise ::Google::Cloud::Error.from_error(e)
611
+ end
612
+
613
+ ##
614
+ # Deletes an Identity Aware Proxy (IAP) OAuth client. Useful for removing
615
+ # obsolete clients, managing the number of clients in a given project, and
616
+ # cleaning up after tests. Requires that the client is owned by IAP.
617
+ #
618
+ # @overload delete_identity_aware_proxy_client(request, options = nil)
619
+ # Pass arguments to `delete_identity_aware_proxy_client` via a request object, either of type
620
+ # {::Google::Cloud::Iap::V1::DeleteIdentityAwareProxyClientRequest} or an equivalent Hash.
621
+ #
622
+ # @param request [::Google::Cloud::Iap::V1::DeleteIdentityAwareProxyClientRequest, ::Hash]
623
+ # A request object representing the call parameters. Required. To specify no
624
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
625
+ # @param options [::Gapic::CallOptions, ::Hash]
626
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
627
+ #
628
+ # @overload delete_identity_aware_proxy_client(name: nil)
629
+ # Pass arguments to `delete_identity_aware_proxy_client` via keyword arguments. Note that at
630
+ # least one keyword argument is required. To specify no parameters, or to keep all
631
+ # the default parameter values, pass an empty Hash as a request object (see above).
632
+ #
633
+ # @param name [::String]
634
+ # Required. Name of the Identity Aware Proxy client to be deleted.
635
+ # In the following format:
636
+ # projects/\\{project_number/id}/brands/\\{brand}/identityAwareProxyClients/\\{client_id}.
637
+ # @yield [result, operation] Access the result along with the TransportOperation object
638
+ # @yieldparam result [::Google::Protobuf::Empty]
639
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
640
+ #
641
+ # @return [::Google::Protobuf::Empty]
642
+ #
643
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
644
+ def delete_identity_aware_proxy_client request, options = nil
645
+ raise ::ArgumentError, "request must be provided" if request.nil?
646
+
647
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Iap::V1::DeleteIdentityAwareProxyClientRequest
648
+
649
+ # Converts hash and nil to an options object
650
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
651
+
652
+ # Customize the options with defaults
653
+ call_metadata = @config.rpcs.delete_identity_aware_proxy_client.metadata.to_h
654
+
655
+ # Set x-goog-api-client and x-goog-user-project headers
656
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
657
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
658
+ gapic_version: ::Google::Cloud::Iap::V1::VERSION,
659
+ transports_version_send: [:rest]
660
+
661
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
662
+
663
+ options.apply_defaults timeout: @config.rpcs.delete_identity_aware_proxy_client.timeout,
664
+ metadata: call_metadata,
665
+ retry_policy: @config.rpcs.delete_identity_aware_proxy_client.retry_policy
666
+
667
+ options.apply_defaults timeout: @config.timeout,
668
+ metadata: @config.metadata,
669
+ retry_policy: @config.retry_policy
670
+
671
+ @identity_aware_proxy_o_auth_service_stub.delete_identity_aware_proxy_client request, options do |result, operation|
672
+ yield result, operation if block_given?
673
+ return result
674
+ end
675
+ rescue ::Gapic::Rest::Error => e
676
+ raise ::Google::Cloud::Error.from_error(e)
677
+ end
678
+
679
+ ##
680
+ # Configuration class for the IdentityAwareProxyOAuthService REST API.
681
+ #
682
+ # This class represents the configuration for IdentityAwareProxyOAuthService REST,
683
+ # providing control over timeouts, retry behavior, logging, transport
684
+ # parameters, and other low-level controls. Certain parameters can also be
685
+ # applied individually to specific RPCs. See
686
+ # {::Google::Cloud::Iap::V1::IdentityAwareProxyOAuthService::Rest::Client::Configuration::Rpcs}
687
+ # for a list of RPCs that can be configured independently.
688
+ #
689
+ # Configuration can be applied globally to all clients, or to a single client
690
+ # on construction.
691
+ #
692
+ # @example
693
+ #
694
+ # # Modify the global config, setting the timeout for
695
+ # # list_brands to 20 seconds,
696
+ # # and all remaining timeouts to 10 seconds.
697
+ # ::Google::Cloud::Iap::V1::IdentityAwareProxyOAuthService::Rest::Client.configure do |config|
698
+ # config.timeout = 10.0
699
+ # config.rpcs.list_brands.timeout = 20.0
700
+ # end
701
+ #
702
+ # # Apply the above configuration only to a new client.
703
+ # client = ::Google::Cloud::Iap::V1::IdentityAwareProxyOAuthService::Rest::Client.new do |config|
704
+ # config.timeout = 10.0
705
+ # config.rpcs.list_brands.timeout = 20.0
706
+ # end
707
+ #
708
+ # @!attribute [rw] endpoint
709
+ # The hostname or hostname:port of the service endpoint.
710
+ # Defaults to `"iap.googleapis.com"`.
711
+ # @return [::String]
712
+ # @!attribute [rw] credentials
713
+ # Credentials to send with calls. You may provide any of the following types:
714
+ # * (`String`) The path to a service account key file in JSON format
715
+ # * (`Hash`) A service account key as a Hash
716
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
717
+ # (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
718
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
719
+ # (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
720
+ # * (`nil`) indicating no credentials
721
+ # @return [::Object]
722
+ # @!attribute [rw] scope
723
+ # The OAuth scopes
724
+ # @return [::Array<::String>]
725
+ # @!attribute [rw] lib_name
726
+ # The library name as recorded in instrumentation and logging
727
+ # @return [::String]
728
+ # @!attribute [rw] lib_version
729
+ # The library version as recorded in instrumentation and logging
730
+ # @return [::String]
731
+ # @!attribute [rw] timeout
732
+ # The call timeout in seconds.
733
+ # @return [::Numeric]
734
+ # @!attribute [rw] metadata
735
+ # Additional headers to be sent with the call.
736
+ # @return [::Hash{::Symbol=>::String}]
737
+ # @!attribute [rw] retry_policy
738
+ # The retry policy. The value is a hash with the following keys:
739
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
740
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
741
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
742
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
743
+ # trigger a retry.
744
+ # @return [::Hash]
745
+ # @!attribute [rw] quota_project
746
+ # A separate project against which to charge quota.
747
+ # @return [::String]
748
+ #
749
+ class Configuration
750
+ extend ::Gapic::Config
751
+
752
+ config_attr :endpoint, "iap.googleapis.com", ::String
753
+ config_attr :credentials, nil do |value|
754
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
755
+ allowed.any? { |klass| klass === value }
756
+ end
757
+ config_attr :scope, nil, ::String, ::Array, nil
758
+ config_attr :lib_name, nil, ::String, nil
759
+ config_attr :lib_version, nil, ::String, nil
760
+ config_attr :timeout, nil, ::Numeric, nil
761
+ config_attr :metadata, nil, ::Hash, nil
762
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
763
+ config_attr :quota_project, nil, ::String, nil
764
+
765
+ # @private
766
+ def initialize parent_config = nil
767
+ @parent_config = parent_config unless parent_config.nil?
768
+
769
+ yield self if block_given?
770
+ end
771
+
772
+ ##
773
+ # Configurations for individual RPCs
774
+ # @return [Rpcs]
775
+ #
776
+ def rpcs
777
+ @rpcs ||= begin
778
+ parent_rpcs = nil
779
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
780
+ Rpcs.new parent_rpcs
781
+ end
782
+ end
783
+
784
+ ##
785
+ # Configuration RPC class for the IdentityAwareProxyOAuthService API.
786
+ #
787
+ # Includes fields providing the configuration for each RPC in this service.
788
+ # Each configuration object is of type `Gapic::Config::Method` and includes
789
+ # the following configuration fields:
790
+ #
791
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
792
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
793
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
794
+ # include the following keys:
795
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
796
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
797
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
798
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
799
+ # trigger a retry.
800
+ #
801
+ class Rpcs
802
+ ##
803
+ # RPC-specific configuration for `list_brands`
804
+ # @return [::Gapic::Config::Method]
805
+ #
806
+ attr_reader :list_brands
807
+ ##
808
+ # RPC-specific configuration for `create_brand`
809
+ # @return [::Gapic::Config::Method]
810
+ #
811
+ attr_reader :create_brand
812
+ ##
813
+ # RPC-specific configuration for `get_brand`
814
+ # @return [::Gapic::Config::Method]
815
+ #
816
+ attr_reader :get_brand
817
+ ##
818
+ # RPC-specific configuration for `create_identity_aware_proxy_client`
819
+ # @return [::Gapic::Config::Method]
820
+ #
821
+ attr_reader :create_identity_aware_proxy_client
822
+ ##
823
+ # RPC-specific configuration for `list_identity_aware_proxy_clients`
824
+ # @return [::Gapic::Config::Method]
825
+ #
826
+ attr_reader :list_identity_aware_proxy_clients
827
+ ##
828
+ # RPC-specific configuration for `get_identity_aware_proxy_client`
829
+ # @return [::Gapic::Config::Method]
830
+ #
831
+ attr_reader :get_identity_aware_proxy_client
832
+ ##
833
+ # RPC-specific configuration for `reset_identity_aware_proxy_client_secret`
834
+ # @return [::Gapic::Config::Method]
835
+ #
836
+ attr_reader :reset_identity_aware_proxy_client_secret
837
+ ##
838
+ # RPC-specific configuration for `delete_identity_aware_proxy_client`
839
+ # @return [::Gapic::Config::Method]
840
+ #
841
+ attr_reader :delete_identity_aware_proxy_client
842
+
843
+ # @private
844
+ def initialize parent_rpcs = nil
845
+ list_brands_config = parent_rpcs.list_brands if parent_rpcs.respond_to? :list_brands
846
+ @list_brands = ::Gapic::Config::Method.new list_brands_config
847
+ create_brand_config = parent_rpcs.create_brand if parent_rpcs.respond_to? :create_brand
848
+ @create_brand = ::Gapic::Config::Method.new create_brand_config
849
+ get_brand_config = parent_rpcs.get_brand if parent_rpcs.respond_to? :get_brand
850
+ @get_brand = ::Gapic::Config::Method.new get_brand_config
851
+ create_identity_aware_proxy_client_config = parent_rpcs.create_identity_aware_proxy_client if parent_rpcs.respond_to? :create_identity_aware_proxy_client
852
+ @create_identity_aware_proxy_client = ::Gapic::Config::Method.new create_identity_aware_proxy_client_config
853
+ list_identity_aware_proxy_clients_config = parent_rpcs.list_identity_aware_proxy_clients if parent_rpcs.respond_to? :list_identity_aware_proxy_clients
854
+ @list_identity_aware_proxy_clients = ::Gapic::Config::Method.new list_identity_aware_proxy_clients_config
855
+ get_identity_aware_proxy_client_config = parent_rpcs.get_identity_aware_proxy_client if parent_rpcs.respond_to? :get_identity_aware_proxy_client
856
+ @get_identity_aware_proxy_client = ::Gapic::Config::Method.new get_identity_aware_proxy_client_config
857
+ reset_identity_aware_proxy_client_secret_config = parent_rpcs.reset_identity_aware_proxy_client_secret if parent_rpcs.respond_to? :reset_identity_aware_proxy_client_secret
858
+ @reset_identity_aware_proxy_client_secret = ::Gapic::Config::Method.new reset_identity_aware_proxy_client_secret_config
859
+ delete_identity_aware_proxy_client_config = parent_rpcs.delete_identity_aware_proxy_client if parent_rpcs.respond_to? :delete_identity_aware_proxy_client
860
+ @delete_identity_aware_proxy_client = ::Gapic::Config::Method.new delete_identity_aware_proxy_client_config
861
+
862
+ yield self if block_given?
863
+ end
864
+ end
865
+ end
866
+ end
867
+ end
868
+ end
869
+ end
870
+ end
871
+ end
872
+ end