google-iam-v1 0.2.0 → 0.3.beta.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/google/iam/v1/iam_policy/rest/client.rb +548 -0
- data/lib/google/iam/v1/iam_policy/rest/service_stub.rb +221 -0
- data/lib/google/iam/v1/iam_policy/rest.rb +74 -0
- data/lib/google/iam/v1/iam_policy.rb +7 -1
- data/lib/google/iam/v1/logging/audit_data_pb.rb +0 -1
- data/lib/google/iam/v1/rest.rb +35 -0
- data/lib/google/iam/v1/version.rb +1 -1
- data/lib/google/iam/v1.rb +9 -1
- data/proto_docs/google/api/client.rb +318 -0
- data/proto_docs/google/api/launch_stage.rb +71 -0
- data/proto_docs/google/protobuf/duration.rb +98 -0
- metadata +17 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '0208d232d05d383c20892f9525be07737ea6fd36054f85c88acd5cca7f2f8c3a'
|
4
|
+
data.tar.gz: f3a9227c16050722e560c02172aee7e3273d1b3a883dc520b8494a50c6597263
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2fa9c5d718e270132b34a11b67aacb8c81a64dd134363705fe5228d9041f5e8e37439dccb360174938909881be1ffb44dac29b9fddb1db2c5846c5261563c13b
|
7
|
+
data.tar.gz: b9d57d064deddeccc5ad0bfd3745fd97b8dbf0695220f47aa7aab0d906c91c50b2e9a9b92c028039b066a6e417c0d5ed7b9b00a2f1045b45be2ac56b9d6f2f1c
|
@@ -0,0 +1,548 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2022 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/iam/v1/iam_policy_pb"
|
21
|
+
require "google/iam/v1/iam_policy/rest/service_stub"
|
22
|
+
|
23
|
+
module Google
|
24
|
+
module Iam
|
25
|
+
module V1
|
26
|
+
module IAMPolicy
|
27
|
+
module Rest
|
28
|
+
##
|
29
|
+
# REST client for the IAMPolicy service.
|
30
|
+
#
|
31
|
+
# API Overview
|
32
|
+
#
|
33
|
+
#
|
34
|
+
# Manages Identity and Access Management (IAM) policies.
|
35
|
+
#
|
36
|
+
# Any implementation of an API that offers access control features
|
37
|
+
# implements the google.iam.v1.IAMPolicy interface.
|
38
|
+
#
|
39
|
+
# ## Data model
|
40
|
+
#
|
41
|
+
# Access control is applied when a principal (user or service account), takes
|
42
|
+
# some action on a resource exposed by a service. Resources, identified by
|
43
|
+
# URI-like names, are the unit of access control specification. Service
|
44
|
+
# implementations can choose the granularity of access control and the
|
45
|
+
# supported permissions for their resources.
|
46
|
+
# For example one database service may allow access control to be
|
47
|
+
# specified only at the Table level, whereas another might allow access control
|
48
|
+
# to also be specified at the Column level.
|
49
|
+
#
|
50
|
+
# ## Policy Structure
|
51
|
+
#
|
52
|
+
# See google.iam.v1.Policy
|
53
|
+
#
|
54
|
+
# This is intentionally not a CRUD style API because access control policies
|
55
|
+
# are created and deleted implicitly with the resources to which they are
|
56
|
+
# attached.
|
57
|
+
#
|
58
|
+
class Client
|
59
|
+
# @private
|
60
|
+
attr_reader :iam_policy_stub
|
61
|
+
|
62
|
+
##
|
63
|
+
# Configure the IAMPolicy Client class.
|
64
|
+
#
|
65
|
+
# See {::Google::Iam::V1::IAMPolicy::Rest::Client::Configuration}
|
66
|
+
# for a description of the configuration fields.
|
67
|
+
#
|
68
|
+
# @example
|
69
|
+
#
|
70
|
+
# # Modify the configuration for all IAMPolicy clients
|
71
|
+
# ::Google::Iam::V1::IAMPolicy::Rest::Client.configure do |config|
|
72
|
+
# config.timeout = 10.0
|
73
|
+
# end
|
74
|
+
#
|
75
|
+
# @yield [config] Configure the Client client.
|
76
|
+
# @yieldparam config [Client::Configuration]
|
77
|
+
#
|
78
|
+
# @return [Client::Configuration]
|
79
|
+
#
|
80
|
+
def self.configure
|
81
|
+
@configure ||= begin
|
82
|
+
namespace = ["Google", "Iam", "V1"]
|
83
|
+
parent_config = while namespace.any?
|
84
|
+
parent_name = namespace.join "::"
|
85
|
+
parent_const = const_get parent_name
|
86
|
+
break parent_const.configure if parent_const.respond_to? :configure
|
87
|
+
namespace.pop
|
88
|
+
end
|
89
|
+
default_config = Client::Configuration.new parent_config
|
90
|
+
|
91
|
+
default_config
|
92
|
+
end
|
93
|
+
yield @configure if block_given?
|
94
|
+
@configure
|
95
|
+
end
|
96
|
+
|
97
|
+
##
|
98
|
+
# Configure the IAMPolicy Client instance.
|
99
|
+
#
|
100
|
+
# The configuration is set to the derived mode, meaning that values can be changed,
|
101
|
+
# but structural changes (adding new fields, etc.) are not allowed. Structural changes
|
102
|
+
# should be made on {Client.configure}.
|
103
|
+
#
|
104
|
+
# See {::Google::Iam::V1::IAMPolicy::Rest::Client::Configuration}
|
105
|
+
# for a description of the configuration fields.
|
106
|
+
#
|
107
|
+
# @yield [config] Configure the Client client.
|
108
|
+
# @yieldparam config [Client::Configuration]
|
109
|
+
#
|
110
|
+
# @return [Client::Configuration]
|
111
|
+
#
|
112
|
+
def configure
|
113
|
+
yield @config if block_given?
|
114
|
+
@config
|
115
|
+
end
|
116
|
+
|
117
|
+
##
|
118
|
+
# Create a new IAMPolicy REST client object.
|
119
|
+
#
|
120
|
+
# @example
|
121
|
+
#
|
122
|
+
# # Create a client using the default configuration
|
123
|
+
# client = ::Google::Iam::V1::IAMPolicy::Rest::Client.new
|
124
|
+
#
|
125
|
+
# # Create a client using a custom configuration
|
126
|
+
# client = ::Google::Iam::V1::IAMPolicy::Rest::Client.new do |config|
|
127
|
+
# config.timeout = 10.0
|
128
|
+
# end
|
129
|
+
#
|
130
|
+
# @yield [config] Configure the IAMPolicy client.
|
131
|
+
# @yieldparam config [Client::Configuration]
|
132
|
+
#
|
133
|
+
def initialize
|
134
|
+
# Create the configuration object
|
135
|
+
@config = Configuration.new Client.configure
|
136
|
+
|
137
|
+
# Yield the configuration if needed
|
138
|
+
yield @config if block_given?
|
139
|
+
|
140
|
+
# Create credentials
|
141
|
+
credentials = @config.credentials
|
142
|
+
# Use self-signed JWT if the endpoint is unchanged from default,
|
143
|
+
# but only if the default endpoint does not have a region prefix.
|
144
|
+
enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
|
145
|
+
!@config.endpoint.split(".").first.include?("-")
|
146
|
+
credentials ||= Credentials.default scope: @config.scope,
|
147
|
+
enable_self_signed_jwt: enable_self_signed_jwt
|
148
|
+
if credentials.is_a?(::String) || credentials.is_a?(::Hash)
|
149
|
+
credentials = Credentials.new credentials, scope: @config.scope
|
150
|
+
end
|
151
|
+
|
152
|
+
@quota_project_id = @config.quota_project
|
153
|
+
@quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
|
154
|
+
|
155
|
+
@iam_policy_stub = ::Google::Iam::V1::IAMPolicy::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials
|
156
|
+
end
|
157
|
+
|
158
|
+
# Service calls
|
159
|
+
|
160
|
+
##
|
161
|
+
# Sets the access control policy on the specified resource. Replaces any
|
162
|
+
# existing policy.
|
163
|
+
#
|
164
|
+
# Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
|
165
|
+
#
|
166
|
+
# @overload set_iam_policy(request, options = nil)
|
167
|
+
# Pass arguments to `set_iam_policy` via a request object, either of type
|
168
|
+
# {::Google::Iam::V1::SetIamPolicyRequest} or an equivalent Hash.
|
169
|
+
#
|
170
|
+
# @param request [::Google::Iam::V1::SetIamPolicyRequest, ::Hash]
|
171
|
+
# A request object representing the call parameters. Required. To specify no
|
172
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
173
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
174
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
175
|
+
#
|
176
|
+
# @overload set_iam_policy(resource: nil, policy: nil, update_mask: nil)
|
177
|
+
# Pass arguments to `set_iam_policy` via keyword arguments. Note that at
|
178
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
179
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
180
|
+
#
|
181
|
+
# @param resource [::String]
|
182
|
+
# REQUIRED: The resource for which the policy is being specified.
|
183
|
+
# See the operation documentation for the appropriate value for this field.
|
184
|
+
# @param policy [::Google::Iam::V1::Policy, ::Hash]
|
185
|
+
# REQUIRED: The complete policy to be applied to the `resource`. The size of
|
186
|
+
# the policy is limited to a few 10s of KB. An empty policy is a
|
187
|
+
# valid policy but certain Cloud Platform services (such as Projects)
|
188
|
+
# might reject them.
|
189
|
+
# @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
|
190
|
+
# OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only
|
191
|
+
# the fields in the mask will be modified. If no mask is provided, the
|
192
|
+
# following default mask is used:
|
193
|
+
#
|
194
|
+
# `paths: "bindings, etag"`
|
195
|
+
# @yield [result, response] Access the result along with the Faraday response object
|
196
|
+
# @yieldparam result [::Google::Iam::V1::Policy]
|
197
|
+
# @yieldparam response [::Faraday::Response]
|
198
|
+
#
|
199
|
+
# @return [::Google::Iam::V1::Policy]
|
200
|
+
#
|
201
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
202
|
+
def set_iam_policy request, options = nil
|
203
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
204
|
+
|
205
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Iam::V1::SetIamPolicyRequest
|
206
|
+
|
207
|
+
# Converts hash and nil to an options object
|
208
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
209
|
+
|
210
|
+
# Customize the options with defaults
|
211
|
+
call_metadata = @config.rpcs.set_iam_policy.metadata.to_h
|
212
|
+
|
213
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
214
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
215
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
216
|
+
gapic_version: ::Google::Iam::V1::VERSION,
|
217
|
+
transports_version_send: [:rest]
|
218
|
+
|
219
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
220
|
+
|
221
|
+
options.apply_defaults timeout: @config.rpcs.set_iam_policy.timeout,
|
222
|
+
metadata: call_metadata,
|
223
|
+
retry_policy: @config.rpcs.set_iam_policy.retry_policy
|
224
|
+
|
225
|
+
options.apply_defaults timeout: @config.timeout,
|
226
|
+
metadata: @config.metadata,
|
227
|
+
retry_policy: @config.retry_policy
|
228
|
+
|
229
|
+
@iam_policy_stub.set_iam_policy request, options do |result, response|
|
230
|
+
yield result, response if block_given?
|
231
|
+
return result
|
232
|
+
end
|
233
|
+
rescue ::Faraday::Error => e
|
234
|
+
begin
|
235
|
+
raise ::Gapic::Rest::Error.wrap_faraday_error e
|
236
|
+
rescue ::Gapic::Rest::Error => gapic_error
|
237
|
+
raise ::Google::Cloud::Error.from_error gapic_error
|
238
|
+
end
|
239
|
+
end
|
240
|
+
|
241
|
+
##
|
242
|
+
# Gets the access control policy for a resource.
|
243
|
+
# Returns an empty policy if the resource exists and does not have a policy
|
244
|
+
# set.
|
245
|
+
#
|
246
|
+
# @overload get_iam_policy(request, options = nil)
|
247
|
+
# Pass arguments to `get_iam_policy` via a request object, either of type
|
248
|
+
# {::Google::Iam::V1::GetIamPolicyRequest} or an equivalent Hash.
|
249
|
+
#
|
250
|
+
# @param request [::Google::Iam::V1::GetIamPolicyRequest, ::Hash]
|
251
|
+
# A request object representing the call parameters. Required. To specify no
|
252
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
253
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
254
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
255
|
+
#
|
256
|
+
# @overload get_iam_policy(resource: nil, options: nil)
|
257
|
+
# Pass arguments to `get_iam_policy` via keyword arguments. Note that at
|
258
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
259
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
260
|
+
#
|
261
|
+
# @param resource [::String]
|
262
|
+
# REQUIRED: The resource for which the policy is being requested.
|
263
|
+
# See the operation documentation for the appropriate value for this field.
|
264
|
+
# @param options [::Google::Iam::V1::GetPolicyOptions, ::Hash]
|
265
|
+
# OPTIONAL: A `GetPolicyOptions` object for specifying options to
|
266
|
+
# `GetIamPolicy`.
|
267
|
+
# @yield [result, response] Access the result along with the Faraday response object
|
268
|
+
# @yieldparam result [::Google::Iam::V1::Policy]
|
269
|
+
# @yieldparam response [::Faraday::Response]
|
270
|
+
#
|
271
|
+
# @return [::Google::Iam::V1::Policy]
|
272
|
+
#
|
273
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
274
|
+
def get_iam_policy request, options = nil
|
275
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
276
|
+
|
277
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Iam::V1::GetIamPolicyRequest
|
278
|
+
|
279
|
+
# Converts hash and nil to an options object
|
280
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
281
|
+
|
282
|
+
# Customize the options with defaults
|
283
|
+
call_metadata = @config.rpcs.get_iam_policy.metadata.to_h
|
284
|
+
|
285
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
286
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
287
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
288
|
+
gapic_version: ::Google::Iam::V1::VERSION,
|
289
|
+
transports_version_send: [:rest]
|
290
|
+
|
291
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
292
|
+
|
293
|
+
options.apply_defaults timeout: @config.rpcs.get_iam_policy.timeout,
|
294
|
+
metadata: call_metadata,
|
295
|
+
retry_policy: @config.rpcs.get_iam_policy.retry_policy
|
296
|
+
|
297
|
+
options.apply_defaults timeout: @config.timeout,
|
298
|
+
metadata: @config.metadata,
|
299
|
+
retry_policy: @config.retry_policy
|
300
|
+
|
301
|
+
@iam_policy_stub.get_iam_policy request, options do |result, response|
|
302
|
+
yield result, response if block_given?
|
303
|
+
return result
|
304
|
+
end
|
305
|
+
rescue ::Faraday::Error => e
|
306
|
+
begin
|
307
|
+
raise ::Gapic::Rest::Error.wrap_faraday_error e
|
308
|
+
rescue ::Gapic::Rest::Error => gapic_error
|
309
|
+
raise ::Google::Cloud::Error.from_error gapic_error
|
310
|
+
end
|
311
|
+
end
|
312
|
+
|
313
|
+
##
|
314
|
+
# Returns permissions that a caller has on the specified resource.
|
315
|
+
# If the resource does not exist, this will return an empty set of
|
316
|
+
# permissions, not a `NOT_FOUND` error.
|
317
|
+
#
|
318
|
+
# Note: This operation is designed to be used for building permission-aware
|
319
|
+
# UIs and command-line tools, not for authorization checking. This operation
|
320
|
+
# may "fail open" without warning.
|
321
|
+
#
|
322
|
+
# @overload test_iam_permissions(request, options = nil)
|
323
|
+
# Pass arguments to `test_iam_permissions` via a request object, either of type
|
324
|
+
# {::Google::Iam::V1::TestIamPermissionsRequest} or an equivalent Hash.
|
325
|
+
#
|
326
|
+
# @param request [::Google::Iam::V1::TestIamPermissionsRequest, ::Hash]
|
327
|
+
# A request object representing the call parameters. Required. To specify no
|
328
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
329
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
330
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
331
|
+
#
|
332
|
+
# @overload test_iam_permissions(resource: nil, permissions: nil)
|
333
|
+
# Pass arguments to `test_iam_permissions` via keyword arguments. Note that at
|
334
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
335
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
336
|
+
#
|
337
|
+
# @param resource [::String]
|
338
|
+
# REQUIRED: The resource for which the policy detail is being requested.
|
339
|
+
# See the operation documentation for the appropriate value for this field.
|
340
|
+
# @param permissions [::Array<::String>]
|
341
|
+
# The set of permissions to check for the `resource`. Permissions with
|
342
|
+
# wildcards (such as '*' or 'storage.*') are not allowed. For more
|
343
|
+
# information see
|
344
|
+
# [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions).
|
345
|
+
# @yield [result, response] Access the result along with the Faraday response object
|
346
|
+
# @yieldparam result [::Google::Iam::V1::TestIamPermissionsResponse]
|
347
|
+
# @yieldparam response [::Faraday::Response]
|
348
|
+
#
|
349
|
+
# @return [::Google::Iam::V1::TestIamPermissionsResponse]
|
350
|
+
#
|
351
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
352
|
+
def test_iam_permissions request, options = nil
|
353
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
354
|
+
|
355
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Iam::V1::TestIamPermissionsRequest
|
356
|
+
|
357
|
+
# Converts hash and nil to an options object
|
358
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
359
|
+
|
360
|
+
# Customize the options with defaults
|
361
|
+
call_metadata = @config.rpcs.test_iam_permissions.metadata.to_h
|
362
|
+
|
363
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
364
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
365
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
366
|
+
gapic_version: ::Google::Iam::V1::VERSION,
|
367
|
+
transports_version_send: [:rest]
|
368
|
+
|
369
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
370
|
+
|
371
|
+
options.apply_defaults timeout: @config.rpcs.test_iam_permissions.timeout,
|
372
|
+
metadata: call_metadata,
|
373
|
+
retry_policy: @config.rpcs.test_iam_permissions.retry_policy
|
374
|
+
|
375
|
+
options.apply_defaults timeout: @config.timeout,
|
376
|
+
metadata: @config.metadata,
|
377
|
+
retry_policy: @config.retry_policy
|
378
|
+
|
379
|
+
@iam_policy_stub.test_iam_permissions request, options do |result, response|
|
380
|
+
yield result, response if block_given?
|
381
|
+
return result
|
382
|
+
end
|
383
|
+
rescue ::Faraday::Error => e
|
384
|
+
begin
|
385
|
+
raise ::Gapic::Rest::Error.wrap_faraday_error e
|
386
|
+
rescue ::Gapic::Rest::Error => gapic_error
|
387
|
+
raise ::Google::Cloud::Error.from_error gapic_error
|
388
|
+
end
|
389
|
+
end
|
390
|
+
|
391
|
+
##
|
392
|
+
# Configuration class for the IAMPolicy REST API.
|
393
|
+
#
|
394
|
+
# This class represents the configuration for IAMPolicy REST,
|
395
|
+
# providing control over timeouts, retry behavior, logging, transport
|
396
|
+
# parameters, and other low-level controls. Certain parameters can also be
|
397
|
+
# applied individually to specific RPCs. See
|
398
|
+
# {::Google::Iam::V1::IAMPolicy::Rest::Client::Configuration::Rpcs}
|
399
|
+
# for a list of RPCs that can be configured independently.
|
400
|
+
#
|
401
|
+
# Configuration can be applied globally to all clients, or to a single client
|
402
|
+
# on construction.
|
403
|
+
#
|
404
|
+
# @example
|
405
|
+
#
|
406
|
+
# # Modify the global config, setting the timeout for
|
407
|
+
# # set_iam_policy to 20 seconds,
|
408
|
+
# # and all remaining timeouts to 10 seconds.
|
409
|
+
# ::Google::Iam::V1::IAMPolicy::Rest::Client.configure do |config|
|
410
|
+
# config.timeout = 10.0
|
411
|
+
# config.rpcs.set_iam_policy.timeout = 20.0
|
412
|
+
# end
|
413
|
+
#
|
414
|
+
# # Apply the above configuration only to a new client.
|
415
|
+
# client = ::Google::Iam::V1::IAMPolicy::Rest::Client.new do |config|
|
416
|
+
# config.timeout = 10.0
|
417
|
+
# config.rpcs.set_iam_policy.timeout = 20.0
|
418
|
+
# end
|
419
|
+
#
|
420
|
+
# @!attribute [rw] endpoint
|
421
|
+
# The hostname or hostname:port of the service endpoint.
|
422
|
+
# Defaults to `"iam-meta-api.googleapis.com"`.
|
423
|
+
# @return [::String]
|
424
|
+
# @!attribute [rw] credentials
|
425
|
+
# Credentials to send with calls. You may provide any of the following types:
|
426
|
+
# * (`String`) The path to a service account key file in JSON format
|
427
|
+
# * (`Hash`) A service account key as a Hash
|
428
|
+
# * (`Google::Auth::Credentials`) A googleauth credentials object
|
429
|
+
# (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
|
430
|
+
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
431
|
+
# (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
|
432
|
+
# * (`nil`) indicating no credentials
|
433
|
+
# @return [::Object]
|
434
|
+
# @!attribute [rw] scope
|
435
|
+
# The OAuth scopes
|
436
|
+
# @return [::Array<::String>]
|
437
|
+
# @!attribute [rw] lib_name
|
438
|
+
# The library name as recorded in instrumentation and logging
|
439
|
+
# @return [::String]
|
440
|
+
# @!attribute [rw] lib_version
|
441
|
+
# The library version as recorded in instrumentation and logging
|
442
|
+
# @return [::String]
|
443
|
+
# @!attribute [rw] timeout
|
444
|
+
# The call timeout in seconds.
|
445
|
+
# @return [::Numeric]
|
446
|
+
# @!attribute [rw] metadata
|
447
|
+
# Additional headers to be sent with the call.
|
448
|
+
# @return [::Hash{::Symbol=>::String}]
|
449
|
+
# @!attribute [rw] retry_policy
|
450
|
+
# The retry policy. The value is a hash with the following keys:
|
451
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
452
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
453
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
454
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
455
|
+
# trigger a retry.
|
456
|
+
# @return [::Hash]
|
457
|
+
# @!attribute [rw] quota_project
|
458
|
+
# A separate project against which to charge quota.
|
459
|
+
# @return [::String]
|
460
|
+
#
|
461
|
+
class Configuration
|
462
|
+
extend ::Gapic::Config
|
463
|
+
|
464
|
+
config_attr :endpoint, "iam-meta-api.googleapis.com", ::String
|
465
|
+
config_attr :credentials, nil do |value|
|
466
|
+
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
467
|
+
allowed.any? { |klass| klass === value }
|
468
|
+
end
|
469
|
+
config_attr :scope, nil, ::String, ::Array, nil
|
470
|
+
config_attr :lib_name, nil, ::String, nil
|
471
|
+
config_attr :lib_version, nil, ::String, nil
|
472
|
+
config_attr :timeout, nil, ::Numeric, nil
|
473
|
+
config_attr :metadata, nil, ::Hash, nil
|
474
|
+
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
475
|
+
config_attr :quota_project, nil, ::String, nil
|
476
|
+
|
477
|
+
# @private
|
478
|
+
def initialize parent_config = nil
|
479
|
+
@parent_config = parent_config unless parent_config.nil?
|
480
|
+
|
481
|
+
yield self if block_given?
|
482
|
+
end
|
483
|
+
|
484
|
+
##
|
485
|
+
# Configurations for individual RPCs
|
486
|
+
# @return [Rpcs]
|
487
|
+
#
|
488
|
+
def rpcs
|
489
|
+
@rpcs ||= begin
|
490
|
+
parent_rpcs = nil
|
491
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
|
492
|
+
Rpcs.new parent_rpcs
|
493
|
+
end
|
494
|
+
end
|
495
|
+
|
496
|
+
##
|
497
|
+
# Configuration RPC class for the IAMPolicy API.
|
498
|
+
#
|
499
|
+
# Includes fields providing the configuration for each RPC in this service.
|
500
|
+
# Each configuration object is of type `Gapic::Config::Method` and includes
|
501
|
+
# the following configuration fields:
|
502
|
+
#
|
503
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in seconds
|
504
|
+
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
|
505
|
+
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
506
|
+
# include the following keys:
|
507
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
508
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
509
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
510
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
511
|
+
# trigger a retry.
|
512
|
+
#
|
513
|
+
class Rpcs
|
514
|
+
##
|
515
|
+
# RPC-specific configuration for `set_iam_policy`
|
516
|
+
# @return [::Gapic::Config::Method]
|
517
|
+
#
|
518
|
+
attr_reader :set_iam_policy
|
519
|
+
##
|
520
|
+
# RPC-specific configuration for `get_iam_policy`
|
521
|
+
# @return [::Gapic::Config::Method]
|
522
|
+
#
|
523
|
+
attr_reader :get_iam_policy
|
524
|
+
##
|
525
|
+
# RPC-specific configuration for `test_iam_permissions`
|
526
|
+
# @return [::Gapic::Config::Method]
|
527
|
+
#
|
528
|
+
attr_reader :test_iam_permissions
|
529
|
+
|
530
|
+
# @private
|
531
|
+
def initialize parent_rpcs = nil
|
532
|
+
set_iam_policy_config = parent_rpcs.set_iam_policy if parent_rpcs.respond_to? :set_iam_policy
|
533
|
+
@set_iam_policy = ::Gapic::Config::Method.new set_iam_policy_config
|
534
|
+
get_iam_policy_config = parent_rpcs.get_iam_policy if parent_rpcs.respond_to? :get_iam_policy
|
535
|
+
@get_iam_policy = ::Gapic::Config::Method.new get_iam_policy_config
|
536
|
+
test_iam_permissions_config = parent_rpcs.test_iam_permissions if parent_rpcs.respond_to? :test_iam_permissions
|
537
|
+
@test_iam_permissions = ::Gapic::Config::Method.new test_iam_permissions_config
|
538
|
+
|
539
|
+
yield self if block_given?
|
540
|
+
end
|
541
|
+
end
|
542
|
+
end
|
543
|
+
end
|
544
|
+
end
|
545
|
+
end
|
546
|
+
end
|
547
|
+
end
|
548
|
+
end
|