google-cloud-iap-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,21 @@
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
+ # This gem does not autoload during Bundler.require. To load this gem,
20
+ # issue explicit require statements for the packages desired, e.g.:
21
+ # require "google/cloud/iap/v1"
@@ -0,0 +1,39 @@
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/iap/v1/identity_aware_proxy_admin_service"
20
+ require "google/cloud/iap/v1/identity_aware_proxy_o_auth_service"
21
+ require "google/cloud/iap/v1/version"
22
+
23
+ module Google
24
+ module Cloud
25
+ module Iap
26
+ ##
27
+ # To load this package, including all its services, and instantiate a client:
28
+ #
29
+ # require "google/cloud/iap/v1"
30
+ # client = ::Google::Cloud::Iap::V1::IdentityAwareProxyAdminService::Client.new
31
+ #
32
+ module V1
33
+ end
34
+ end
35
+ end
36
+ end
37
+
38
+ helper_path = ::File.join __dir__, "v1", "_helpers.rb"
39
+ require "google/cloud/iap/v1/_helpers" if ::File.file? helper_path
@@ -0,0 +1,48 @@
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 "gapic/common"
20
+ require "gapic/config"
21
+ require "gapic/config/method"
22
+
23
+ require "google/cloud/iap/v1/version"
24
+
25
+ require "google/cloud/iap/v1/identity_aware_proxy_admin_service/credentials"
26
+ require "google/cloud/iap/v1/identity_aware_proxy_admin_service/client"
27
+
28
+ module Google
29
+ module Cloud
30
+ module Iap
31
+ module V1
32
+ ##
33
+ # APIs for Identity-Aware Proxy Admin configurations.
34
+ #
35
+ # To load this service and instantiate a client:
36
+ #
37
+ # require "google/cloud/iap/v1/identity_aware_proxy_admin_service"
38
+ # client = ::Google::Cloud::Iap::V1::IdentityAwareProxyAdminService::Client.new
39
+ #
40
+ module IdentityAwareProxyAdminService
41
+ end
42
+ end
43
+ end
44
+ end
45
+ end
46
+
47
+ helper_path = ::File.join __dir__, "identity_aware_proxy_admin_service", "helpers.rb"
48
+ require "google/cloud/iap/v1/identity_aware_proxy_admin_service/helpers" if ::File.file? helper_path
@@ -0,0 +1,701 @@
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/iap/v1/service_pb"
21
+
22
+ module Google
23
+ module Cloud
24
+ module Iap
25
+ module V1
26
+ module IdentityAwareProxyAdminService
27
+ ##
28
+ # Client for the IdentityAwareProxyAdminService service.
29
+ #
30
+ # APIs for Identity-Aware Proxy Admin configurations.
31
+ #
32
+ class Client
33
+ # @private
34
+ attr_reader :identity_aware_proxy_admin_service_stub
35
+
36
+ ##
37
+ # Configure the IdentityAwareProxyAdminService Client class.
38
+ #
39
+ # See {::Google::Cloud::Iap::V1::IdentityAwareProxyAdminService::Client::Configuration}
40
+ # for a description of the configuration fields.
41
+ #
42
+ # ## Example
43
+ #
44
+ # To modify the configuration for all IdentityAwareProxyAdminService clients:
45
+ #
46
+ # ::Google::Cloud::Iap::V1::IdentityAwareProxyAdminService::Client.configure do |config|
47
+ # config.timeout = 10.0
48
+ # end
49
+ #
50
+ # @yield [config] Configure the Client client.
51
+ # @yieldparam config [Client::Configuration]
52
+ #
53
+ # @return [Client::Configuration]
54
+ #
55
+ def self.configure
56
+ @configure ||= begin
57
+ namespace = ["Google", "Cloud", "Iap", "V1"]
58
+ parent_config = while namespace.any?
59
+ parent_name = namespace.join "::"
60
+ parent_const = const_get parent_name
61
+ break parent_const.configure if parent_const.respond_to? :configure
62
+ namespace.pop
63
+ end
64
+ default_config = Client::Configuration.new parent_config
65
+
66
+ default_config.timeout = 60.0
67
+
68
+ default_config
69
+ end
70
+ yield @configure if block_given?
71
+ @configure
72
+ end
73
+
74
+ ##
75
+ # Configure the IdentityAwareProxyAdminService Client instance.
76
+ #
77
+ # The configuration is set to the derived mode, meaning that values can be changed,
78
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
79
+ # should be made on {Client.configure}.
80
+ #
81
+ # See {::Google::Cloud::Iap::V1::IdentityAwareProxyAdminService::Client::Configuration}
82
+ # for a description of the configuration fields.
83
+ #
84
+ # @yield [config] Configure the Client client.
85
+ # @yieldparam config [Client::Configuration]
86
+ #
87
+ # @return [Client::Configuration]
88
+ #
89
+ def configure
90
+ yield @config if block_given?
91
+ @config
92
+ end
93
+
94
+ ##
95
+ # Create a new IdentityAwareProxyAdminService client object.
96
+ #
97
+ # ## Examples
98
+ #
99
+ # To create a new IdentityAwareProxyAdminService client with the default
100
+ # configuration:
101
+ #
102
+ # client = ::Google::Cloud::Iap::V1::IdentityAwareProxyAdminService::Client.new
103
+ #
104
+ # To create a new IdentityAwareProxyAdminService client with a custom
105
+ # configuration:
106
+ #
107
+ # client = ::Google::Cloud::Iap::V1::IdentityAwareProxyAdminService::Client.new do |config|
108
+ # config.timeout = 10.0
109
+ # end
110
+ #
111
+ # @yield [config] Configure the IdentityAwareProxyAdminService client.
112
+ # @yieldparam config [Client::Configuration]
113
+ #
114
+ def initialize
115
+ # These require statements are intentionally placed here to initialize
116
+ # the gRPC module only when it's required.
117
+ # See https://github.com/googleapis/toolkit/issues/446
118
+ require "gapic/grpc"
119
+ require "google/cloud/iap/v1/service_services_pb"
120
+
121
+ # Create the configuration object
122
+ @config = Configuration.new Client.configure
123
+
124
+ # Yield the configuration if needed
125
+ yield @config if block_given?
126
+
127
+ # Create credentials
128
+ credentials = @config.credentials
129
+ # Use self-signed JWT if the scope and endpoint are unchanged from default,
130
+ # but only if the default endpoint does not have a region prefix.
131
+ enable_self_signed_jwt = @config.scope == Client.configure.scope &&
132
+ @config.endpoint == Client.configure.endpoint &&
133
+ !@config.endpoint.split(".").first.include?("-")
134
+ credentials ||= Credentials.default scope: @config.scope,
135
+ enable_self_signed_jwt: enable_self_signed_jwt
136
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
137
+ credentials = Credentials.new credentials, scope: @config.scope
138
+ end
139
+ @quota_project_id = @config.quota_project
140
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
141
+
142
+ @identity_aware_proxy_admin_service_stub = ::Gapic::ServiceStub.new(
143
+ ::Google::Cloud::Iap::V1::IdentityAwareProxyAdminService::Stub,
144
+ credentials: credentials,
145
+ endpoint: @config.endpoint,
146
+ channel_args: @config.channel_args,
147
+ interceptors: @config.interceptors
148
+ )
149
+ end
150
+
151
+ # Service calls
152
+
153
+ ##
154
+ # Sets the access control policy for an Identity-Aware Proxy protected
155
+ # resource. Replaces any existing policy.
156
+ # More information about managing access via IAP can be found at:
157
+ # https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api
158
+ #
159
+ # @overload set_iam_policy(request, options = nil)
160
+ # Pass arguments to `set_iam_policy` via a request object, either of type
161
+ # {::Google::Iam::V1::SetIamPolicyRequest} or an equivalent Hash.
162
+ #
163
+ # @param request [::Google::Iam::V1::SetIamPolicyRequest, ::Hash]
164
+ # A request object representing the call parameters. Required. To specify no
165
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
166
+ # @param options [::Gapic::CallOptions, ::Hash]
167
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
168
+ #
169
+ # @overload set_iam_policy(resource: nil, policy: nil)
170
+ # Pass arguments to `set_iam_policy` via keyword arguments. Note that at
171
+ # least one keyword argument is required. To specify no parameters, or to keep all
172
+ # the default parameter values, pass an empty Hash as a request object (see above).
173
+ #
174
+ # @param resource [::String]
175
+ # REQUIRED: The resource for which the policy is being specified.
176
+ # See the operation documentation for the appropriate value for this field.
177
+ # @param policy [::Google::Iam::V1::Policy, ::Hash]
178
+ # REQUIRED: The complete policy to be applied to the `resource`. The size of
179
+ # the policy is limited to a few 10s of KB. An empty policy is a
180
+ # valid policy but certain Cloud Platform services (such as Projects)
181
+ # might reject them.
182
+ #
183
+ # @yield [response, operation] Access the result along with the RPC operation
184
+ # @yieldparam response [::Google::Iam::V1::Policy]
185
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
186
+ #
187
+ # @return [::Google::Iam::V1::Policy]
188
+ #
189
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
190
+ #
191
+ def set_iam_policy request, options = nil
192
+ raise ::ArgumentError, "request must be provided" if request.nil?
193
+
194
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Iam::V1::SetIamPolicyRequest
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.set_iam_policy.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::Iap::V1::VERSION
206
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
207
+
208
+ header_params = {
209
+ "resource" => request.resource
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.set_iam_policy.timeout,
215
+ metadata: metadata,
216
+ retry_policy: @config.rpcs.set_iam_policy.retry_policy
217
+ options.apply_defaults metadata: @config.metadata,
218
+ retry_policy: @config.retry_policy
219
+
220
+ @identity_aware_proxy_admin_service_stub.call_rpc :set_iam_policy, 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
+ # Gets the access control policy for an Identity-Aware Proxy protected
230
+ # resource.
231
+ # More information about managing access via IAP can be found at:
232
+ # https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api
233
+ #
234
+ # @overload get_iam_policy(request, options = nil)
235
+ # Pass arguments to `get_iam_policy` via a request object, either of type
236
+ # {::Google::Iam::V1::GetIamPolicyRequest} or an equivalent Hash.
237
+ #
238
+ # @param request [::Google::Iam::V1::GetIamPolicyRequest, ::Hash]
239
+ # A request object representing the call parameters. Required. To specify no
240
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
241
+ # @param options [::Gapic::CallOptions, ::Hash]
242
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
243
+ #
244
+ # @overload get_iam_policy(resource: nil, options: nil)
245
+ # Pass arguments to `get_iam_policy` via keyword arguments. Note that at
246
+ # least one keyword argument is required. To specify no parameters, or to keep all
247
+ # the default parameter values, pass an empty Hash as a request object (see above).
248
+ #
249
+ # @param resource [::String]
250
+ # REQUIRED: The resource for which the policy is being requested.
251
+ # See the operation documentation for the appropriate value for this field.
252
+ # @param options [::Google::Iam::V1::GetPolicyOptions, ::Hash]
253
+ # OPTIONAL: A `GetPolicyOptions` object for specifying options to
254
+ # `GetIamPolicy`. This field is only used by Cloud IAM.
255
+ #
256
+ # @yield [response, operation] Access the result along with the RPC operation
257
+ # @yieldparam response [::Google::Iam::V1::Policy]
258
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
259
+ #
260
+ # @return [::Google::Iam::V1::Policy]
261
+ #
262
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
263
+ #
264
+ def get_iam_policy request, options = nil
265
+ raise ::ArgumentError, "request must be provided" if request.nil?
266
+
267
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Iam::V1::GetIamPolicyRequest
268
+
269
+ # Converts hash and nil to an options object
270
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
271
+
272
+ # Customize the options with defaults
273
+ metadata = @config.rpcs.get_iam_policy.metadata.to_h
274
+
275
+ # Set x-goog-api-client and x-goog-user-project headers
276
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
277
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
278
+ gapic_version: ::Google::Cloud::Iap::V1::VERSION
279
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
280
+
281
+ header_params = {
282
+ "resource" => request.resource
283
+ }
284
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
285
+ metadata[:"x-goog-request-params"] ||= request_params_header
286
+
287
+ options.apply_defaults timeout: @config.rpcs.get_iam_policy.timeout,
288
+ metadata: metadata,
289
+ retry_policy: @config.rpcs.get_iam_policy.retry_policy
290
+ options.apply_defaults metadata: @config.metadata,
291
+ retry_policy: @config.retry_policy
292
+
293
+ @identity_aware_proxy_admin_service_stub.call_rpc :get_iam_policy, request, options: options do |response, operation|
294
+ yield response, operation if block_given?
295
+ return response
296
+ end
297
+ rescue ::GRPC::BadStatus => e
298
+ raise ::Google::Cloud::Error.from_error(e)
299
+ end
300
+
301
+ ##
302
+ # Returns permissions that a caller has on the Identity-Aware Proxy protected
303
+ # resource.
304
+ # More information about managing access via IAP can be found at:
305
+ # https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api
306
+ #
307
+ # @overload test_iam_permissions(request, options = nil)
308
+ # Pass arguments to `test_iam_permissions` via a request object, either of type
309
+ # {::Google::Iam::V1::TestIamPermissionsRequest} or an equivalent Hash.
310
+ #
311
+ # @param request [::Google::Iam::V1::TestIamPermissionsRequest, ::Hash]
312
+ # A request object representing the call parameters. Required. To specify no
313
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
314
+ # @param options [::Gapic::CallOptions, ::Hash]
315
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
316
+ #
317
+ # @overload test_iam_permissions(resource: nil, permissions: nil)
318
+ # Pass arguments to `test_iam_permissions` via keyword arguments. Note that at
319
+ # least one keyword argument is required. To specify no parameters, or to keep all
320
+ # the default parameter values, pass an empty Hash as a request object (see above).
321
+ #
322
+ # @param resource [::String]
323
+ # REQUIRED: The resource for which the policy detail is being requested.
324
+ # See the operation documentation for the appropriate value for this field.
325
+ # @param permissions [::Array<::String>]
326
+ # The set of permissions to check for the `resource`. Permissions with
327
+ # wildcards (such as '*' or 'storage.*') are not allowed. For more
328
+ # information see
329
+ # [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions).
330
+ #
331
+ # @yield [response, operation] Access the result along with the RPC operation
332
+ # @yieldparam response [::Google::Iam::V1::TestIamPermissionsResponse]
333
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
334
+ #
335
+ # @return [::Google::Iam::V1::TestIamPermissionsResponse]
336
+ #
337
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
338
+ #
339
+ def test_iam_permissions request, options = nil
340
+ raise ::ArgumentError, "request must be provided" if request.nil?
341
+
342
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Iam::V1::TestIamPermissionsRequest
343
+
344
+ # Converts hash and nil to an options object
345
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
346
+
347
+ # Customize the options with defaults
348
+ metadata = @config.rpcs.test_iam_permissions.metadata.to_h
349
+
350
+ # Set x-goog-api-client and x-goog-user-project headers
351
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
352
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
353
+ gapic_version: ::Google::Cloud::Iap::V1::VERSION
354
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
355
+
356
+ header_params = {
357
+ "resource" => request.resource
358
+ }
359
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
360
+ metadata[:"x-goog-request-params"] ||= request_params_header
361
+
362
+ options.apply_defaults timeout: @config.rpcs.test_iam_permissions.timeout,
363
+ metadata: metadata,
364
+ retry_policy: @config.rpcs.test_iam_permissions.retry_policy
365
+ options.apply_defaults metadata: @config.metadata,
366
+ retry_policy: @config.retry_policy
367
+
368
+ @identity_aware_proxy_admin_service_stub.call_rpc :test_iam_permissions, request, options: options do |response, operation|
369
+ yield response, operation if block_given?
370
+ return response
371
+ end
372
+ rescue ::GRPC::BadStatus => e
373
+ raise ::Google::Cloud::Error.from_error(e)
374
+ end
375
+
376
+ ##
377
+ # Gets the IAP settings on a particular IAP protected resource.
378
+ #
379
+ # @overload get_iap_settings(request, options = nil)
380
+ # Pass arguments to `get_iap_settings` via a request object, either of type
381
+ # {::Google::Cloud::Iap::V1::GetIapSettingsRequest} or an equivalent Hash.
382
+ #
383
+ # @param request [::Google::Cloud::Iap::V1::GetIapSettingsRequest, ::Hash]
384
+ # A request object representing the call parameters. Required. To specify no
385
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
386
+ # @param options [::Gapic::CallOptions, ::Hash]
387
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
388
+ #
389
+ # @overload get_iap_settings(name: nil)
390
+ # Pass arguments to `get_iap_settings` via keyword arguments. Note that at
391
+ # least one keyword argument is required. To specify no parameters, or to keep all
392
+ # the default parameter values, pass an empty Hash as a request object (see above).
393
+ #
394
+ # @param name [::String]
395
+ # Required. The resource name for which to retrieve the settings.
396
+ # Authorization: Requires the `getSettings` permission for the associated
397
+ # resource.
398
+ #
399
+ # @yield [response, operation] Access the result along with the RPC operation
400
+ # @yieldparam response [::Google::Cloud::Iap::V1::IapSettings]
401
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
402
+ #
403
+ # @return [::Google::Cloud::Iap::V1::IapSettings]
404
+ #
405
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
406
+ #
407
+ def get_iap_settings request, options = nil
408
+ raise ::ArgumentError, "request must be provided" if request.nil?
409
+
410
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Iap::V1::GetIapSettingsRequest
411
+
412
+ # Converts hash and nil to an options object
413
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
414
+
415
+ # Customize the options with defaults
416
+ metadata = @config.rpcs.get_iap_settings.metadata.to_h
417
+
418
+ # Set x-goog-api-client and x-goog-user-project headers
419
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
420
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
421
+ gapic_version: ::Google::Cloud::Iap::V1::VERSION
422
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
423
+
424
+ header_params = {
425
+ "name" => request.name
426
+ }
427
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
428
+ metadata[:"x-goog-request-params"] ||= request_params_header
429
+
430
+ options.apply_defaults timeout: @config.rpcs.get_iap_settings.timeout,
431
+ metadata: metadata,
432
+ retry_policy: @config.rpcs.get_iap_settings.retry_policy
433
+ options.apply_defaults metadata: @config.metadata,
434
+ retry_policy: @config.retry_policy
435
+
436
+ @identity_aware_proxy_admin_service_stub.call_rpc :get_iap_settings, request, options: options do |response, operation|
437
+ yield response, operation if block_given?
438
+ return response
439
+ end
440
+ rescue ::GRPC::BadStatus => e
441
+ raise ::Google::Cloud::Error.from_error(e)
442
+ end
443
+
444
+ ##
445
+ # Updates the IAP settings on a particular IAP protected resource. It
446
+ # replaces all fields unless the `update_mask` is set.
447
+ #
448
+ # @overload update_iap_settings(request, options = nil)
449
+ # Pass arguments to `update_iap_settings` via a request object, either of type
450
+ # {::Google::Cloud::Iap::V1::UpdateIapSettingsRequest} or an equivalent Hash.
451
+ #
452
+ # @param request [::Google::Cloud::Iap::V1::UpdateIapSettingsRequest, ::Hash]
453
+ # A request object representing the call parameters. Required. To specify no
454
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
455
+ # @param options [::Gapic::CallOptions, ::Hash]
456
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
457
+ #
458
+ # @overload update_iap_settings(iap_settings: nil, update_mask: nil)
459
+ # Pass arguments to `update_iap_settings` via keyword arguments. Note that at
460
+ # least one keyword argument is required. To specify no parameters, or to keep all
461
+ # the default parameter values, pass an empty Hash as a request object (see above).
462
+ #
463
+ # @param iap_settings [::Google::Cloud::Iap::V1::IapSettings, ::Hash]
464
+ # Required. The new values for the IAP settings to be updated.
465
+ # Authorization: Requires the `updateSettings` permission for the associated
466
+ # resource.
467
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
468
+ # The field mask specifying which IAP settings should be updated.
469
+ # If omitted, the all of the settings are updated. See
470
+ # https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask
471
+ #
472
+ # @yield [response, operation] Access the result along with the RPC operation
473
+ # @yieldparam response [::Google::Cloud::Iap::V1::IapSettings]
474
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
475
+ #
476
+ # @return [::Google::Cloud::Iap::V1::IapSettings]
477
+ #
478
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
479
+ #
480
+ def update_iap_settings request, options = nil
481
+ raise ::ArgumentError, "request must be provided" if request.nil?
482
+
483
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Iap::V1::UpdateIapSettingsRequest
484
+
485
+ # Converts hash and nil to an options object
486
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
487
+
488
+ # Customize the options with defaults
489
+ metadata = @config.rpcs.update_iap_settings.metadata.to_h
490
+
491
+ # Set x-goog-api-client and x-goog-user-project headers
492
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
493
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
494
+ gapic_version: ::Google::Cloud::Iap::V1::VERSION
495
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
496
+
497
+ header_params = {
498
+ "iap_settings.name" => request.iap_settings.name
499
+ }
500
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
501
+ metadata[:"x-goog-request-params"] ||= request_params_header
502
+
503
+ options.apply_defaults timeout: @config.rpcs.update_iap_settings.timeout,
504
+ metadata: metadata,
505
+ retry_policy: @config.rpcs.update_iap_settings.retry_policy
506
+ options.apply_defaults metadata: @config.metadata,
507
+ retry_policy: @config.retry_policy
508
+
509
+ @identity_aware_proxy_admin_service_stub.call_rpc :update_iap_settings, request, options: options do |response, operation|
510
+ yield response, operation if block_given?
511
+ return response
512
+ end
513
+ rescue ::GRPC::BadStatus => e
514
+ raise ::Google::Cloud::Error.from_error(e)
515
+ end
516
+
517
+ ##
518
+ # Configuration class for the IdentityAwareProxyAdminService API.
519
+ #
520
+ # This class represents the configuration for IdentityAwareProxyAdminService,
521
+ # providing control over timeouts, retry behavior, logging, transport
522
+ # parameters, and other low-level controls. Certain parameters can also be
523
+ # applied individually to specific RPCs. See
524
+ # {::Google::Cloud::Iap::V1::IdentityAwareProxyAdminService::Client::Configuration::Rpcs}
525
+ # for a list of RPCs that can be configured independently.
526
+ #
527
+ # Configuration can be applied globally to all clients, or to a single client
528
+ # on construction.
529
+ #
530
+ # # Examples
531
+ #
532
+ # To modify the global config, setting the timeout for set_iam_policy
533
+ # to 20 seconds, and all remaining timeouts to 10 seconds:
534
+ #
535
+ # ::Google::Cloud::Iap::V1::IdentityAwareProxyAdminService::Client.configure do |config|
536
+ # config.timeout = 10.0
537
+ # config.rpcs.set_iam_policy.timeout = 20.0
538
+ # end
539
+ #
540
+ # To apply the above configuration only to a new client:
541
+ #
542
+ # client = ::Google::Cloud::Iap::V1::IdentityAwareProxyAdminService::Client.new do |config|
543
+ # config.timeout = 10.0
544
+ # config.rpcs.set_iam_policy.timeout = 20.0
545
+ # end
546
+ #
547
+ # @!attribute [rw] endpoint
548
+ # The hostname or hostname:port of the service endpoint.
549
+ # Defaults to `"iap.googleapis.com"`.
550
+ # @return [::String]
551
+ # @!attribute [rw] credentials
552
+ # Credentials to send with calls. You may provide any of the following types:
553
+ # * (`String`) The path to a service account key file in JSON format
554
+ # * (`Hash`) A service account key as a Hash
555
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
556
+ # (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
557
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
558
+ # (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
559
+ # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
560
+ # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
561
+ # * (`nil`) indicating no credentials
562
+ # @return [::Object]
563
+ # @!attribute [rw] scope
564
+ # The OAuth scopes
565
+ # @return [::Array<::String>]
566
+ # @!attribute [rw] lib_name
567
+ # The library name as recorded in instrumentation and logging
568
+ # @return [::String]
569
+ # @!attribute [rw] lib_version
570
+ # The library version as recorded in instrumentation and logging
571
+ # @return [::String]
572
+ # @!attribute [rw] channel_args
573
+ # Extra parameters passed to the gRPC channel. Note: this is ignored if a
574
+ # `GRPC::Core::Channel` object is provided as the credential.
575
+ # @return [::Hash]
576
+ # @!attribute [rw] interceptors
577
+ # An array of interceptors that are run before calls are executed.
578
+ # @return [::Array<::GRPC::ClientInterceptor>]
579
+ # @!attribute [rw] timeout
580
+ # The call timeout in seconds.
581
+ # @return [::Numeric]
582
+ # @!attribute [rw] metadata
583
+ # Additional gRPC headers to be sent with the call.
584
+ # @return [::Hash{::Symbol=>::String}]
585
+ # @!attribute [rw] retry_policy
586
+ # The retry policy. The value is a hash with the following keys:
587
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
588
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
589
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
590
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
591
+ # trigger a retry.
592
+ # @return [::Hash]
593
+ # @!attribute [rw] quota_project
594
+ # A separate project against which to charge quota.
595
+ # @return [::String]
596
+ #
597
+ class Configuration
598
+ extend ::Gapic::Config
599
+
600
+ config_attr :endpoint, "iap.googleapis.com", ::String
601
+ config_attr :credentials, nil do |value|
602
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
603
+ allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
604
+ allowed.any? { |klass| klass === value }
605
+ end
606
+ config_attr :scope, nil, ::String, ::Array, nil
607
+ config_attr :lib_name, nil, ::String, nil
608
+ config_attr :lib_version, nil, ::String, nil
609
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
610
+ config_attr :interceptors, nil, ::Array, nil
611
+ config_attr :timeout, nil, ::Numeric, nil
612
+ config_attr :metadata, nil, ::Hash, nil
613
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
614
+ config_attr :quota_project, nil, ::String, nil
615
+
616
+ # @private
617
+ def initialize parent_config = nil
618
+ @parent_config = parent_config unless parent_config.nil?
619
+
620
+ yield self if block_given?
621
+ end
622
+
623
+ ##
624
+ # Configurations for individual RPCs
625
+ # @return [Rpcs]
626
+ #
627
+ def rpcs
628
+ @rpcs ||= begin
629
+ parent_rpcs = nil
630
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
631
+ Rpcs.new parent_rpcs
632
+ end
633
+ end
634
+
635
+ ##
636
+ # Configuration RPC class for the IdentityAwareProxyAdminService API.
637
+ #
638
+ # Includes fields providing the configuration for each RPC in this service.
639
+ # Each configuration object is of type `Gapic::Config::Method` and includes
640
+ # the following configuration fields:
641
+ #
642
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
643
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
644
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
645
+ # include the following keys:
646
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
647
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
648
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
649
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
650
+ # trigger a retry.
651
+ #
652
+ class Rpcs
653
+ ##
654
+ # RPC-specific configuration for `set_iam_policy`
655
+ # @return [::Gapic::Config::Method]
656
+ #
657
+ attr_reader :set_iam_policy
658
+ ##
659
+ # RPC-specific configuration for `get_iam_policy`
660
+ # @return [::Gapic::Config::Method]
661
+ #
662
+ attr_reader :get_iam_policy
663
+ ##
664
+ # RPC-specific configuration for `test_iam_permissions`
665
+ # @return [::Gapic::Config::Method]
666
+ #
667
+ attr_reader :test_iam_permissions
668
+ ##
669
+ # RPC-specific configuration for `get_iap_settings`
670
+ # @return [::Gapic::Config::Method]
671
+ #
672
+ attr_reader :get_iap_settings
673
+ ##
674
+ # RPC-specific configuration for `update_iap_settings`
675
+ # @return [::Gapic::Config::Method]
676
+ #
677
+ attr_reader :update_iap_settings
678
+
679
+ # @private
680
+ def initialize parent_rpcs = nil
681
+ set_iam_policy_config = parent_rpcs.set_iam_policy if parent_rpcs.respond_to? :set_iam_policy
682
+ @set_iam_policy = ::Gapic::Config::Method.new set_iam_policy_config
683
+ get_iam_policy_config = parent_rpcs.get_iam_policy if parent_rpcs.respond_to? :get_iam_policy
684
+ @get_iam_policy = ::Gapic::Config::Method.new get_iam_policy_config
685
+ test_iam_permissions_config = parent_rpcs.test_iam_permissions if parent_rpcs.respond_to? :test_iam_permissions
686
+ @test_iam_permissions = ::Gapic::Config::Method.new test_iam_permissions_config
687
+ get_iap_settings_config = parent_rpcs.get_iap_settings if parent_rpcs.respond_to? :get_iap_settings
688
+ @get_iap_settings = ::Gapic::Config::Method.new get_iap_settings_config
689
+ update_iap_settings_config = parent_rpcs.update_iap_settings if parent_rpcs.respond_to? :update_iap_settings
690
+ @update_iap_settings = ::Gapic::Config::Method.new update_iap_settings_config
691
+
692
+ yield self if block_given?
693
+ end
694
+ end
695
+ end
696
+ end
697
+ end
698
+ end
699
+ end
700
+ end
701
+ end