google-iam-v3beta 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.
- checksums.yaml +4 -4
- data/AUTHENTICATION.md +4 -4
- data/README.md +4 -4
- data/lib/google/iam/v3beta/access_policies/client.rb +1111 -0
- data/lib/google/iam/v3beta/access_policies/credentials.rb +45 -0
- data/lib/google/iam/v3beta/access_policies/operations.rb +839 -0
- data/lib/google/iam/v3beta/access_policies/paths.rb +140 -0
- data/lib/google/iam/v3beta/access_policies/rest/client.rb +1026 -0
- data/lib/google/iam/v3beta/access_policies/rest/operations.rb +937 -0
- data/lib/google/iam/v3beta/access_policies/rest/service_stub.rb +535 -0
- data/lib/google/iam/v3beta/access_policies/rest.rb +51 -0
- data/lib/google/iam/v3beta/access_policies.rb +54 -0
- data/lib/google/iam/v3beta/access_policies_service_pb.rb +36 -0
- data/lib/google/iam/v3beta/access_policies_service_services_pb.rb +54 -0
- data/lib/google/iam/v3beta/access_policy_resources_pb.rb +29 -0
- data/lib/google/iam/v3beta/policy_binding_resources_pb.rb +1 -1
- data/lib/google/iam/v3beta/policy_bindings/client.rb +19 -11
- data/lib/google/iam/v3beta/policy_bindings/rest/client.rb +19 -11
- data/lib/google/iam/v3beta/policy_bindings_service_pb.rb +1 -1
- data/lib/google/iam/v3beta/policy_bindings_service_services_pb.rb +3 -5
- data/lib/google/iam/v3beta/rest.rb +2 -1
- data/lib/google/iam/v3beta/version.rb +1 -1
- data/lib/google/iam/v3beta.rb +3 -2
- data/lib/google-iam-v3beta.rb +1 -1
- data/proto_docs/google/api/client.rb +4 -0
- data/proto_docs/google/iam/v3beta/access_policies_service.rb +203 -0
- data/proto_docs/google/iam/v3beta/access_policy_resources.rb +223 -0
- data/proto_docs/google/iam/v3beta/policy_binding_resources.rb +50 -28
- data/proto_docs/google/iam/v3beta/policy_bindings_service.rb +16 -5
- metadata +15 -1
|
@@ -0,0 +1,1111 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Copyright 2026 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/v3beta/access_policies_service_pb"
|
|
21
|
+
require "google/cloud/location"
|
|
22
|
+
|
|
23
|
+
module Google
|
|
24
|
+
module Iam
|
|
25
|
+
module V3beta
|
|
26
|
+
module AccessPolicies
|
|
27
|
+
##
|
|
28
|
+
# Client for the AccessPolicies service.
|
|
29
|
+
#
|
|
30
|
+
# Manages Identity and Access Management (IAM) access policies.
|
|
31
|
+
#
|
|
32
|
+
class Client
|
|
33
|
+
# @private
|
|
34
|
+
API_VERSION = ""
|
|
35
|
+
|
|
36
|
+
# @private
|
|
37
|
+
DEFAULT_ENDPOINT_TEMPLATE = "iam.$UNIVERSE_DOMAIN$"
|
|
38
|
+
|
|
39
|
+
include Paths
|
|
40
|
+
|
|
41
|
+
# @private
|
|
42
|
+
attr_reader :access_policies_stub
|
|
43
|
+
|
|
44
|
+
##
|
|
45
|
+
# Configure the AccessPolicies Client class.
|
|
46
|
+
#
|
|
47
|
+
# See {::Google::Iam::V3beta::AccessPolicies::Client::Configuration}
|
|
48
|
+
# for a description of the configuration fields.
|
|
49
|
+
#
|
|
50
|
+
# @example
|
|
51
|
+
#
|
|
52
|
+
# # Modify the configuration for all AccessPolicies clients
|
|
53
|
+
# ::Google::Iam::V3beta::AccessPolicies::Client.configure do |config|
|
|
54
|
+
# config.timeout = 10.0
|
|
55
|
+
# end
|
|
56
|
+
#
|
|
57
|
+
# @yield [config] Configure the Client client.
|
|
58
|
+
# @yieldparam config [Client::Configuration]
|
|
59
|
+
#
|
|
60
|
+
# @return [Client::Configuration]
|
|
61
|
+
#
|
|
62
|
+
def self.configure
|
|
63
|
+
@configure ||= begin
|
|
64
|
+
namespace = ["Google", "Iam", "V3beta"]
|
|
65
|
+
parent_config = while namespace.any?
|
|
66
|
+
parent_name = namespace.join "::"
|
|
67
|
+
parent_const = const_get parent_name
|
|
68
|
+
break parent_const.configure if parent_const.respond_to? :configure
|
|
69
|
+
namespace.pop
|
|
70
|
+
end
|
|
71
|
+
default_config = Client::Configuration.new parent_config
|
|
72
|
+
|
|
73
|
+
default_config.rpcs.create_access_policy.timeout = 30.0
|
|
74
|
+
|
|
75
|
+
default_config.rpcs.get_access_policy.timeout = 60.0
|
|
76
|
+
default_config.rpcs.get_access_policy.retry_policy = {
|
|
77
|
+
initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
default_config.rpcs.update_access_policy.timeout = 30.0
|
|
81
|
+
|
|
82
|
+
default_config.rpcs.delete_access_policy.timeout = 30.0
|
|
83
|
+
|
|
84
|
+
default_config.rpcs.list_access_policies.timeout = 60.0
|
|
85
|
+
default_config.rpcs.list_access_policies.retry_policy = {
|
|
86
|
+
initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
default_config.rpcs.search_access_policy_bindings.timeout = 60.0
|
|
90
|
+
default_config.rpcs.search_access_policy_bindings.retry_policy = {
|
|
91
|
+
initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
default_config
|
|
95
|
+
end
|
|
96
|
+
yield @configure if block_given?
|
|
97
|
+
@configure
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
##
|
|
101
|
+
# Configure the AccessPolicies Client instance.
|
|
102
|
+
#
|
|
103
|
+
# The configuration is set to the derived mode, meaning that values can be changed,
|
|
104
|
+
# but structural changes (adding new fields, etc.) are not allowed. Structural changes
|
|
105
|
+
# should be made on {Client.configure}.
|
|
106
|
+
#
|
|
107
|
+
# See {::Google::Iam::V3beta::AccessPolicies::Client::Configuration}
|
|
108
|
+
# for a description of the configuration fields.
|
|
109
|
+
#
|
|
110
|
+
# @yield [config] Configure the Client client.
|
|
111
|
+
# @yieldparam config [Client::Configuration]
|
|
112
|
+
#
|
|
113
|
+
# @return [Client::Configuration]
|
|
114
|
+
#
|
|
115
|
+
def configure
|
|
116
|
+
yield @config if block_given?
|
|
117
|
+
@config
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
##
|
|
121
|
+
# The effective universe domain
|
|
122
|
+
#
|
|
123
|
+
# @return [String]
|
|
124
|
+
#
|
|
125
|
+
def universe_domain
|
|
126
|
+
@access_policies_stub.universe_domain
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
##
|
|
130
|
+
# Create a new AccessPolicies client object.
|
|
131
|
+
#
|
|
132
|
+
# @example
|
|
133
|
+
#
|
|
134
|
+
# # Create a client using the default configuration
|
|
135
|
+
# client = ::Google::Iam::V3beta::AccessPolicies::Client.new
|
|
136
|
+
#
|
|
137
|
+
# # Create a client using a custom configuration
|
|
138
|
+
# client = ::Google::Iam::V3beta::AccessPolicies::Client.new do |config|
|
|
139
|
+
# config.timeout = 10.0
|
|
140
|
+
# end
|
|
141
|
+
#
|
|
142
|
+
# @yield [config] Configure the AccessPolicies client.
|
|
143
|
+
# @yieldparam config [Client::Configuration]
|
|
144
|
+
#
|
|
145
|
+
def initialize
|
|
146
|
+
# These require statements are intentionally placed here to initialize
|
|
147
|
+
# the gRPC module only when it's required.
|
|
148
|
+
# See https://github.com/googleapis/toolkit/issues/446
|
|
149
|
+
require "gapic/grpc"
|
|
150
|
+
require "google/iam/v3beta/access_policies_service_services_pb"
|
|
151
|
+
|
|
152
|
+
# Create the configuration object
|
|
153
|
+
@config = Configuration.new Client.configure
|
|
154
|
+
|
|
155
|
+
# Yield the configuration if needed
|
|
156
|
+
yield @config if block_given?
|
|
157
|
+
|
|
158
|
+
# Create credentials
|
|
159
|
+
credentials = @config.credentials
|
|
160
|
+
# Use self-signed JWT if the endpoint is unchanged from default,
|
|
161
|
+
# but only if the default endpoint does not have a region prefix.
|
|
162
|
+
enable_self_signed_jwt = @config.endpoint.nil? ||
|
|
163
|
+
(@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
|
|
164
|
+
!@config.endpoint.split(".").first.include?("-"))
|
|
165
|
+
credentials ||= Credentials.default scope: @config.scope,
|
|
166
|
+
enable_self_signed_jwt: enable_self_signed_jwt
|
|
167
|
+
if credentials.is_a?(::String) || credentials.is_a?(::Hash)
|
|
168
|
+
credentials = Credentials.new credentials, scope: @config.scope
|
|
169
|
+
end
|
|
170
|
+
@quota_project_id = @config.quota_project
|
|
171
|
+
@quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
|
|
172
|
+
|
|
173
|
+
@operations_client = Operations.new do |config|
|
|
174
|
+
config.credentials = credentials
|
|
175
|
+
config.quota_project = @quota_project_id
|
|
176
|
+
config.endpoint = @config.endpoint
|
|
177
|
+
config.universe_domain = @config.universe_domain
|
|
178
|
+
end
|
|
179
|
+
|
|
180
|
+
@access_policies_stub = ::Gapic::ServiceStub.new(
|
|
181
|
+
::Google::Iam::V3beta::AccessPolicies::Stub,
|
|
182
|
+
credentials: credentials,
|
|
183
|
+
endpoint: @config.endpoint,
|
|
184
|
+
endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
|
|
185
|
+
universe_domain: @config.universe_domain,
|
|
186
|
+
channel_args: @config.channel_args,
|
|
187
|
+
interceptors: @config.interceptors,
|
|
188
|
+
channel_pool_config: @config.channel_pool,
|
|
189
|
+
logger: @config.logger
|
|
190
|
+
)
|
|
191
|
+
|
|
192
|
+
@access_policies_stub.stub_logger&.info do |entry|
|
|
193
|
+
entry.set_system_name
|
|
194
|
+
entry.set_service
|
|
195
|
+
entry.message = "Created client for #{entry.service}"
|
|
196
|
+
entry.set_credentials_fields credentials
|
|
197
|
+
entry.set "customEndpoint", @config.endpoint if @config.endpoint
|
|
198
|
+
entry.set "defaultTimeout", @config.timeout if @config.timeout
|
|
199
|
+
entry.set "quotaProject", @quota_project_id if @quota_project_id
|
|
200
|
+
end
|
|
201
|
+
|
|
202
|
+
@location_client = Google::Cloud::Location::Locations::Client.new do |config|
|
|
203
|
+
config.credentials = credentials
|
|
204
|
+
config.quota_project = @quota_project_id
|
|
205
|
+
config.endpoint = @access_policies_stub.endpoint
|
|
206
|
+
config.universe_domain = @access_policies_stub.universe_domain
|
|
207
|
+
config.logger = @access_policies_stub.logger if config.respond_to? :logger=
|
|
208
|
+
end
|
|
209
|
+
end
|
|
210
|
+
|
|
211
|
+
##
|
|
212
|
+
# Get the associated client for long-running operations.
|
|
213
|
+
#
|
|
214
|
+
# @return [::Google::Iam::V3beta::AccessPolicies::Operations]
|
|
215
|
+
#
|
|
216
|
+
attr_reader :operations_client
|
|
217
|
+
|
|
218
|
+
##
|
|
219
|
+
# Get the associated client for mix-in of the Locations.
|
|
220
|
+
#
|
|
221
|
+
# @return [Google::Cloud::Location::Locations::Client]
|
|
222
|
+
#
|
|
223
|
+
attr_reader :location_client
|
|
224
|
+
|
|
225
|
+
##
|
|
226
|
+
# The logger used for request/response debug logging.
|
|
227
|
+
#
|
|
228
|
+
# @return [Logger]
|
|
229
|
+
#
|
|
230
|
+
def logger
|
|
231
|
+
@access_policies_stub.logger
|
|
232
|
+
end
|
|
233
|
+
|
|
234
|
+
# Service calls
|
|
235
|
+
|
|
236
|
+
##
|
|
237
|
+
# Creates an access policy, and returns a long running operation.
|
|
238
|
+
#
|
|
239
|
+
# @overload create_access_policy(request, options = nil)
|
|
240
|
+
# Pass arguments to `create_access_policy` via a request object, either of type
|
|
241
|
+
# {::Google::Iam::V3beta::CreateAccessPolicyRequest} or an equivalent Hash.
|
|
242
|
+
#
|
|
243
|
+
# @param request [::Google::Iam::V3beta::CreateAccessPolicyRequest, ::Hash]
|
|
244
|
+
# A request object representing the call parameters. Required. To specify no
|
|
245
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
|
246
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
|
247
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
|
248
|
+
#
|
|
249
|
+
# @overload create_access_policy(parent: nil, access_policy_id: nil, access_policy: nil, validate_only: nil)
|
|
250
|
+
# Pass arguments to `create_access_policy` via keyword arguments. Note that at
|
|
251
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
|
252
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
|
253
|
+
#
|
|
254
|
+
# @param parent [::String]
|
|
255
|
+
# Required. The parent resource where this access policy will be created.
|
|
256
|
+
#
|
|
257
|
+
# Format:
|
|
258
|
+
# `projects/{project_id}/locations/{location}`
|
|
259
|
+
# `projects/{project_number}/locations/{location}`
|
|
260
|
+
# `folders/{folder_id}/locations/{location}`
|
|
261
|
+
# `organizations/{organization_id}/locations/{location}`
|
|
262
|
+
# @param access_policy_id [::String]
|
|
263
|
+
# Required. The ID to use for the access policy, which
|
|
264
|
+
# will become the final component of the access policy's
|
|
265
|
+
# resource name.
|
|
266
|
+
#
|
|
267
|
+
# This value must start with a lowercase letter followed by up to 62
|
|
268
|
+
# lowercase letters, numbers, hyphens, or dots. Pattern,
|
|
269
|
+
# /[a-z][a-z0-9-\.]\\{2,62}/.
|
|
270
|
+
#
|
|
271
|
+
# This value must be unique among all access policies with the same parent.
|
|
272
|
+
# @param access_policy [::Google::Iam::V3beta::AccessPolicy, ::Hash]
|
|
273
|
+
# Required. The access policy to create.
|
|
274
|
+
# @param validate_only [::Boolean]
|
|
275
|
+
# Optional. If set, validate the request and preview the creation, but do not
|
|
276
|
+
# actually post it.
|
|
277
|
+
#
|
|
278
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
|
279
|
+
# @yieldparam response [::Gapic::Operation]
|
|
280
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
|
281
|
+
#
|
|
282
|
+
# @return [::Gapic::Operation]
|
|
283
|
+
#
|
|
284
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
|
285
|
+
#
|
|
286
|
+
# @example Basic example
|
|
287
|
+
# require "google/iam/v3beta"
|
|
288
|
+
#
|
|
289
|
+
# # Create a client object. The client can be reused for multiple calls.
|
|
290
|
+
# client = Google::Iam::V3beta::AccessPolicies::Client.new
|
|
291
|
+
#
|
|
292
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
|
293
|
+
# request = Google::Iam::V3beta::CreateAccessPolicyRequest.new
|
|
294
|
+
#
|
|
295
|
+
# # Call the create_access_policy method.
|
|
296
|
+
# result = client.create_access_policy request
|
|
297
|
+
#
|
|
298
|
+
# # The returned object is of type Gapic::Operation. You can use it to
|
|
299
|
+
# # check the status of an operation, cancel it, or wait for results.
|
|
300
|
+
# # Here is how to wait for a response.
|
|
301
|
+
# result.wait_until_done! timeout: 60
|
|
302
|
+
# if result.response?
|
|
303
|
+
# p result.response
|
|
304
|
+
# else
|
|
305
|
+
# puts "No response received."
|
|
306
|
+
# end
|
|
307
|
+
#
|
|
308
|
+
def create_access_policy request, options = nil
|
|
309
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
|
310
|
+
|
|
311
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Iam::V3beta::CreateAccessPolicyRequest
|
|
312
|
+
|
|
313
|
+
# Converts hash and nil to an options object
|
|
314
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
|
315
|
+
|
|
316
|
+
# Customize the options with defaults
|
|
317
|
+
metadata = @config.rpcs.create_access_policy.metadata.to_h
|
|
318
|
+
|
|
319
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
|
320
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
|
321
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
|
322
|
+
gapic_version: ::Google::Iam::V3beta::VERSION
|
|
323
|
+
metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
|
324
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
|
325
|
+
|
|
326
|
+
header_params = {}
|
|
327
|
+
if request.parent
|
|
328
|
+
header_params["parent"] = request.parent
|
|
329
|
+
end
|
|
330
|
+
|
|
331
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
|
332
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
|
333
|
+
|
|
334
|
+
options.apply_defaults timeout: @config.rpcs.create_access_policy.timeout,
|
|
335
|
+
metadata: metadata,
|
|
336
|
+
retry_policy: @config.rpcs.create_access_policy.retry_policy
|
|
337
|
+
|
|
338
|
+
options.apply_defaults timeout: @config.timeout,
|
|
339
|
+
metadata: @config.metadata,
|
|
340
|
+
retry_policy: @config.retry_policy
|
|
341
|
+
|
|
342
|
+
@access_policies_stub.call_rpc :create_access_policy, request, options: options do |response, operation|
|
|
343
|
+
response = ::Gapic::Operation.new response, @operations_client, options: options
|
|
344
|
+
yield response, operation if block_given?
|
|
345
|
+
throw :response, response
|
|
346
|
+
end
|
|
347
|
+
rescue ::GRPC::BadStatus => e
|
|
348
|
+
raise ::Google::Cloud::Error.from_error(e)
|
|
349
|
+
end
|
|
350
|
+
|
|
351
|
+
##
|
|
352
|
+
# Gets an access policy.
|
|
353
|
+
#
|
|
354
|
+
# @overload get_access_policy(request, options = nil)
|
|
355
|
+
# Pass arguments to `get_access_policy` via a request object, either of type
|
|
356
|
+
# {::Google::Iam::V3beta::GetAccessPolicyRequest} or an equivalent Hash.
|
|
357
|
+
#
|
|
358
|
+
# @param request [::Google::Iam::V3beta::GetAccessPolicyRequest, ::Hash]
|
|
359
|
+
# A request object representing the call parameters. Required. To specify no
|
|
360
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
|
361
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
|
362
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
|
363
|
+
#
|
|
364
|
+
# @overload get_access_policy(name: nil)
|
|
365
|
+
# Pass arguments to `get_access_policy` via keyword arguments. Note that at
|
|
366
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
|
367
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
|
368
|
+
#
|
|
369
|
+
# @param name [::String]
|
|
370
|
+
# Required. The name of the access policy to retrieve.
|
|
371
|
+
#
|
|
372
|
+
# Format:
|
|
373
|
+
# `projects/{project_id}/locations/{location}/accessPolicies/{access_policy_id}`
|
|
374
|
+
# `projects/{project_number}/locations/{location}/accessPolicies/{access_policy_id}`
|
|
375
|
+
# `folders/{folder_id}/locations/{location}/accessPolicies/{access_policy_id}`
|
|
376
|
+
# `organizations/{organization_id}/locations/{location}/accessPolicies/{access_policy_id}`
|
|
377
|
+
#
|
|
378
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
|
379
|
+
# @yieldparam response [::Google::Iam::V3beta::AccessPolicy]
|
|
380
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
|
381
|
+
#
|
|
382
|
+
# @return [::Google::Iam::V3beta::AccessPolicy]
|
|
383
|
+
#
|
|
384
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
|
385
|
+
#
|
|
386
|
+
# @example Basic example
|
|
387
|
+
# require "google/iam/v3beta"
|
|
388
|
+
#
|
|
389
|
+
# # Create a client object. The client can be reused for multiple calls.
|
|
390
|
+
# client = Google::Iam::V3beta::AccessPolicies::Client.new
|
|
391
|
+
#
|
|
392
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
|
393
|
+
# request = Google::Iam::V3beta::GetAccessPolicyRequest.new
|
|
394
|
+
#
|
|
395
|
+
# # Call the get_access_policy method.
|
|
396
|
+
# result = client.get_access_policy request
|
|
397
|
+
#
|
|
398
|
+
# # The returned object is of type Google::Iam::V3beta::AccessPolicy.
|
|
399
|
+
# p result
|
|
400
|
+
#
|
|
401
|
+
def get_access_policy request, options = nil
|
|
402
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
|
403
|
+
|
|
404
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Iam::V3beta::GetAccessPolicyRequest
|
|
405
|
+
|
|
406
|
+
# Converts hash and nil to an options object
|
|
407
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
|
408
|
+
|
|
409
|
+
# Customize the options with defaults
|
|
410
|
+
metadata = @config.rpcs.get_access_policy.metadata.to_h
|
|
411
|
+
|
|
412
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
|
413
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
|
414
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
|
415
|
+
gapic_version: ::Google::Iam::V3beta::VERSION
|
|
416
|
+
metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
|
417
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
|
418
|
+
|
|
419
|
+
header_params = {}
|
|
420
|
+
if request.name
|
|
421
|
+
header_params["name"] = request.name
|
|
422
|
+
end
|
|
423
|
+
|
|
424
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
|
425
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
|
426
|
+
|
|
427
|
+
options.apply_defaults timeout: @config.rpcs.get_access_policy.timeout,
|
|
428
|
+
metadata: metadata,
|
|
429
|
+
retry_policy: @config.rpcs.get_access_policy.retry_policy
|
|
430
|
+
|
|
431
|
+
options.apply_defaults timeout: @config.timeout,
|
|
432
|
+
metadata: @config.metadata,
|
|
433
|
+
retry_policy: @config.retry_policy
|
|
434
|
+
|
|
435
|
+
@access_policies_stub.call_rpc :get_access_policy, request, options: options do |response, operation|
|
|
436
|
+
yield response, operation if block_given?
|
|
437
|
+
end
|
|
438
|
+
rescue ::GRPC::BadStatus => e
|
|
439
|
+
raise ::Google::Cloud::Error.from_error(e)
|
|
440
|
+
end
|
|
441
|
+
|
|
442
|
+
##
|
|
443
|
+
# Updates an access policy.
|
|
444
|
+
#
|
|
445
|
+
# @overload update_access_policy(request, options = nil)
|
|
446
|
+
# Pass arguments to `update_access_policy` via a request object, either of type
|
|
447
|
+
# {::Google::Iam::V3beta::UpdateAccessPolicyRequest} or an equivalent Hash.
|
|
448
|
+
#
|
|
449
|
+
# @param request [::Google::Iam::V3beta::UpdateAccessPolicyRequest, ::Hash]
|
|
450
|
+
# A request object representing the call parameters. Required. To specify no
|
|
451
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
|
452
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
|
453
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
|
454
|
+
#
|
|
455
|
+
# @overload update_access_policy(access_policy: nil, validate_only: nil)
|
|
456
|
+
# Pass arguments to `update_access_policy` via keyword arguments. Note that at
|
|
457
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
|
458
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
|
459
|
+
#
|
|
460
|
+
# @param access_policy [::Google::Iam::V3beta::AccessPolicy, ::Hash]
|
|
461
|
+
# Required. The access policy to update.
|
|
462
|
+
#
|
|
463
|
+
# The access policy's `name` field is used to identify the
|
|
464
|
+
# policy to update.
|
|
465
|
+
# @param validate_only [::Boolean]
|
|
466
|
+
# Optional. If set, validate the request and preview the update, but do not
|
|
467
|
+
# actually post it.
|
|
468
|
+
#
|
|
469
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
|
470
|
+
# @yieldparam response [::Gapic::Operation]
|
|
471
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
|
472
|
+
#
|
|
473
|
+
# @return [::Gapic::Operation]
|
|
474
|
+
#
|
|
475
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
|
476
|
+
#
|
|
477
|
+
# @example Basic example
|
|
478
|
+
# require "google/iam/v3beta"
|
|
479
|
+
#
|
|
480
|
+
# # Create a client object. The client can be reused for multiple calls.
|
|
481
|
+
# client = Google::Iam::V3beta::AccessPolicies::Client.new
|
|
482
|
+
#
|
|
483
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
|
484
|
+
# request = Google::Iam::V3beta::UpdateAccessPolicyRequest.new
|
|
485
|
+
#
|
|
486
|
+
# # Call the update_access_policy method.
|
|
487
|
+
# result = client.update_access_policy request
|
|
488
|
+
#
|
|
489
|
+
# # The returned object is of type Gapic::Operation. You can use it to
|
|
490
|
+
# # check the status of an operation, cancel it, or wait for results.
|
|
491
|
+
# # Here is how to wait for a response.
|
|
492
|
+
# result.wait_until_done! timeout: 60
|
|
493
|
+
# if result.response?
|
|
494
|
+
# p result.response
|
|
495
|
+
# else
|
|
496
|
+
# puts "No response received."
|
|
497
|
+
# end
|
|
498
|
+
#
|
|
499
|
+
def update_access_policy request, options = nil
|
|
500
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
|
501
|
+
|
|
502
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Iam::V3beta::UpdateAccessPolicyRequest
|
|
503
|
+
|
|
504
|
+
# Converts hash and nil to an options object
|
|
505
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
|
506
|
+
|
|
507
|
+
# Customize the options with defaults
|
|
508
|
+
metadata = @config.rpcs.update_access_policy.metadata.to_h
|
|
509
|
+
|
|
510
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
|
511
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
|
512
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
|
513
|
+
gapic_version: ::Google::Iam::V3beta::VERSION
|
|
514
|
+
metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
|
515
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
|
516
|
+
|
|
517
|
+
header_params = {}
|
|
518
|
+
if request.access_policy&.name
|
|
519
|
+
header_params["access_policy.name"] = request.access_policy.name
|
|
520
|
+
end
|
|
521
|
+
|
|
522
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
|
523
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
|
524
|
+
|
|
525
|
+
options.apply_defaults timeout: @config.rpcs.update_access_policy.timeout,
|
|
526
|
+
metadata: metadata,
|
|
527
|
+
retry_policy: @config.rpcs.update_access_policy.retry_policy
|
|
528
|
+
|
|
529
|
+
options.apply_defaults timeout: @config.timeout,
|
|
530
|
+
metadata: @config.metadata,
|
|
531
|
+
retry_policy: @config.retry_policy
|
|
532
|
+
|
|
533
|
+
@access_policies_stub.call_rpc :update_access_policy, request, options: options do |response, operation|
|
|
534
|
+
response = ::Gapic::Operation.new response, @operations_client, options: options
|
|
535
|
+
yield response, operation if block_given?
|
|
536
|
+
throw :response, response
|
|
537
|
+
end
|
|
538
|
+
rescue ::GRPC::BadStatus => e
|
|
539
|
+
raise ::Google::Cloud::Error.from_error(e)
|
|
540
|
+
end
|
|
541
|
+
|
|
542
|
+
##
|
|
543
|
+
# Deletes an access policy.
|
|
544
|
+
#
|
|
545
|
+
# @overload delete_access_policy(request, options = nil)
|
|
546
|
+
# Pass arguments to `delete_access_policy` via a request object, either of type
|
|
547
|
+
# {::Google::Iam::V3beta::DeleteAccessPolicyRequest} or an equivalent Hash.
|
|
548
|
+
#
|
|
549
|
+
# @param request [::Google::Iam::V3beta::DeleteAccessPolicyRequest, ::Hash]
|
|
550
|
+
# A request object representing the call parameters. Required. To specify no
|
|
551
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
|
552
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
|
553
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
|
554
|
+
#
|
|
555
|
+
# @overload delete_access_policy(name: nil, etag: nil, validate_only: nil, force: nil)
|
|
556
|
+
# Pass arguments to `delete_access_policy` via keyword arguments. Note that at
|
|
557
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
|
558
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
|
559
|
+
#
|
|
560
|
+
# @param name [::String]
|
|
561
|
+
# Required. The name of the access policy to delete.
|
|
562
|
+
#
|
|
563
|
+
# Format:
|
|
564
|
+
# `projects/{project_id}/locations/{location}/accessPolicies/{access_policy_id}`
|
|
565
|
+
# `projects/{project_number}/locations/{location}/accessPolicies/{access_policy_id}`
|
|
566
|
+
# `folders/{folder_id}/locations/{location}/accessPolicies/{access_policy_id}`
|
|
567
|
+
# `organizations/{organization_id}/locations/{location}/accessPolicies/{access_policy_id}`
|
|
568
|
+
# @param etag [::String]
|
|
569
|
+
# Optional. The etag of the access policy. If this is provided, it must match
|
|
570
|
+
# the server's etag.
|
|
571
|
+
# @param validate_only [::Boolean]
|
|
572
|
+
# Optional. If set, validate the request and preview the deletion, but do not
|
|
573
|
+
# actually post it.
|
|
574
|
+
# @param force [::Boolean]
|
|
575
|
+
# Optional. If set to true, the request will force the deletion of the Policy
|
|
576
|
+
# even if the Policy references PolicyBindings.
|
|
577
|
+
#
|
|
578
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
|
579
|
+
# @yieldparam response [::Gapic::Operation]
|
|
580
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
|
581
|
+
#
|
|
582
|
+
# @return [::Gapic::Operation]
|
|
583
|
+
#
|
|
584
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
|
585
|
+
#
|
|
586
|
+
# @example Basic example
|
|
587
|
+
# require "google/iam/v3beta"
|
|
588
|
+
#
|
|
589
|
+
# # Create a client object. The client can be reused for multiple calls.
|
|
590
|
+
# client = Google::Iam::V3beta::AccessPolicies::Client.new
|
|
591
|
+
#
|
|
592
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
|
593
|
+
# request = Google::Iam::V3beta::DeleteAccessPolicyRequest.new
|
|
594
|
+
#
|
|
595
|
+
# # Call the delete_access_policy method.
|
|
596
|
+
# result = client.delete_access_policy request
|
|
597
|
+
#
|
|
598
|
+
# # The returned object is of type Gapic::Operation. You can use it to
|
|
599
|
+
# # check the status of an operation, cancel it, or wait for results.
|
|
600
|
+
# # Here is how to wait for a response.
|
|
601
|
+
# result.wait_until_done! timeout: 60
|
|
602
|
+
# if result.response?
|
|
603
|
+
# p result.response
|
|
604
|
+
# else
|
|
605
|
+
# puts "No response received."
|
|
606
|
+
# end
|
|
607
|
+
#
|
|
608
|
+
def delete_access_policy request, options = nil
|
|
609
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
|
610
|
+
|
|
611
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Iam::V3beta::DeleteAccessPolicyRequest
|
|
612
|
+
|
|
613
|
+
# Converts hash and nil to an options object
|
|
614
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
|
615
|
+
|
|
616
|
+
# Customize the options with defaults
|
|
617
|
+
metadata = @config.rpcs.delete_access_policy.metadata.to_h
|
|
618
|
+
|
|
619
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
|
620
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
|
621
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
|
622
|
+
gapic_version: ::Google::Iam::V3beta::VERSION
|
|
623
|
+
metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
|
624
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
|
625
|
+
|
|
626
|
+
header_params = {}
|
|
627
|
+
if request.name
|
|
628
|
+
header_params["name"] = request.name
|
|
629
|
+
end
|
|
630
|
+
|
|
631
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
|
632
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
|
633
|
+
|
|
634
|
+
options.apply_defaults timeout: @config.rpcs.delete_access_policy.timeout,
|
|
635
|
+
metadata: metadata,
|
|
636
|
+
retry_policy: @config.rpcs.delete_access_policy.retry_policy
|
|
637
|
+
|
|
638
|
+
options.apply_defaults timeout: @config.timeout,
|
|
639
|
+
metadata: @config.metadata,
|
|
640
|
+
retry_policy: @config.retry_policy
|
|
641
|
+
|
|
642
|
+
@access_policies_stub.call_rpc :delete_access_policy, request, options: options do |response, operation|
|
|
643
|
+
response = ::Gapic::Operation.new response, @operations_client, options: options
|
|
644
|
+
yield response, operation if block_given?
|
|
645
|
+
throw :response, response
|
|
646
|
+
end
|
|
647
|
+
rescue ::GRPC::BadStatus => e
|
|
648
|
+
raise ::Google::Cloud::Error.from_error(e)
|
|
649
|
+
end
|
|
650
|
+
|
|
651
|
+
##
|
|
652
|
+
# Lists access policies.
|
|
653
|
+
#
|
|
654
|
+
# @overload list_access_policies(request, options = nil)
|
|
655
|
+
# Pass arguments to `list_access_policies` via a request object, either of type
|
|
656
|
+
# {::Google::Iam::V3beta::ListAccessPoliciesRequest} or an equivalent Hash.
|
|
657
|
+
#
|
|
658
|
+
# @param request [::Google::Iam::V3beta::ListAccessPoliciesRequest, ::Hash]
|
|
659
|
+
# A request object representing the call parameters. Required. To specify no
|
|
660
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
|
661
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
|
662
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
|
663
|
+
#
|
|
664
|
+
# @overload list_access_policies(parent: nil, page_size: nil, page_token: nil)
|
|
665
|
+
# Pass arguments to `list_access_policies` via keyword arguments. Note that at
|
|
666
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
|
667
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
|
668
|
+
#
|
|
669
|
+
# @param parent [::String]
|
|
670
|
+
# Required. The parent resource, which owns the collection of access policy
|
|
671
|
+
# resources.
|
|
672
|
+
#
|
|
673
|
+
# Format:
|
|
674
|
+
# `projects/{project_id}/locations/{location}`
|
|
675
|
+
# `projects/{project_number}/locations/{location}`
|
|
676
|
+
# `folders/{folder_id}/locations/{location}`
|
|
677
|
+
# `organizations/{organization_id}/locations/{location}`
|
|
678
|
+
# @param page_size [::Integer]
|
|
679
|
+
# Optional. The maximum number of access policies to return. The
|
|
680
|
+
# service may return fewer than this value.
|
|
681
|
+
#
|
|
682
|
+
# If unspecified, at most 50 access policies will be returned. Valid value
|
|
683
|
+
# ranges from 1 to 1000; values above 1000 will be coerced to 1000.
|
|
684
|
+
# @param page_token [::String]
|
|
685
|
+
# Optional. A page token, received from a previous
|
|
686
|
+
# `ListAccessPolicies` call. Provide this to retrieve the
|
|
687
|
+
# subsequent page.
|
|
688
|
+
#
|
|
689
|
+
# When paginating, all other parameters provided to
|
|
690
|
+
# `ListAccessPolicies` must match the call that provided the
|
|
691
|
+
# page token.
|
|
692
|
+
#
|
|
693
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
|
694
|
+
# @yieldparam response [::Gapic::PagedEnumerable<::Google::Iam::V3beta::AccessPolicy>]
|
|
695
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
|
696
|
+
#
|
|
697
|
+
# @return [::Gapic::PagedEnumerable<::Google::Iam::V3beta::AccessPolicy>]
|
|
698
|
+
#
|
|
699
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
|
700
|
+
#
|
|
701
|
+
# @example Basic example
|
|
702
|
+
# require "google/iam/v3beta"
|
|
703
|
+
#
|
|
704
|
+
# # Create a client object. The client can be reused for multiple calls.
|
|
705
|
+
# client = Google::Iam::V3beta::AccessPolicies::Client.new
|
|
706
|
+
#
|
|
707
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
|
708
|
+
# request = Google::Iam::V3beta::ListAccessPoliciesRequest.new
|
|
709
|
+
#
|
|
710
|
+
# # Call the list_access_policies method.
|
|
711
|
+
# result = client.list_access_policies request
|
|
712
|
+
#
|
|
713
|
+
# # The returned object is of type Gapic::PagedEnumerable. You can iterate
|
|
714
|
+
# # over elements, and API calls will be issued to fetch pages as needed.
|
|
715
|
+
# result.each do |item|
|
|
716
|
+
# # Each element is of type ::Google::Iam::V3beta::AccessPolicy.
|
|
717
|
+
# p item
|
|
718
|
+
# end
|
|
719
|
+
#
|
|
720
|
+
def list_access_policies request, options = nil
|
|
721
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
|
722
|
+
|
|
723
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Iam::V3beta::ListAccessPoliciesRequest
|
|
724
|
+
|
|
725
|
+
# Converts hash and nil to an options object
|
|
726
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
|
727
|
+
|
|
728
|
+
# Customize the options with defaults
|
|
729
|
+
metadata = @config.rpcs.list_access_policies.metadata.to_h
|
|
730
|
+
|
|
731
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
|
732
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
|
733
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
|
734
|
+
gapic_version: ::Google::Iam::V3beta::VERSION
|
|
735
|
+
metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
|
736
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
|
737
|
+
|
|
738
|
+
header_params = {}
|
|
739
|
+
if request.parent
|
|
740
|
+
header_params["parent"] = request.parent
|
|
741
|
+
end
|
|
742
|
+
|
|
743
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
|
744
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
|
745
|
+
|
|
746
|
+
options.apply_defaults timeout: @config.rpcs.list_access_policies.timeout,
|
|
747
|
+
metadata: metadata,
|
|
748
|
+
retry_policy: @config.rpcs.list_access_policies.retry_policy
|
|
749
|
+
|
|
750
|
+
options.apply_defaults timeout: @config.timeout,
|
|
751
|
+
metadata: @config.metadata,
|
|
752
|
+
retry_policy: @config.retry_policy
|
|
753
|
+
|
|
754
|
+
@access_policies_stub.call_rpc :list_access_policies, request, options: options do |response, operation|
|
|
755
|
+
response = ::Gapic::PagedEnumerable.new @access_policies_stub, :list_access_policies, request, response, operation, options
|
|
756
|
+
yield response, operation if block_given?
|
|
757
|
+
throw :response, response
|
|
758
|
+
end
|
|
759
|
+
rescue ::GRPC::BadStatus => e
|
|
760
|
+
raise ::Google::Cloud::Error.from_error(e)
|
|
761
|
+
end
|
|
762
|
+
|
|
763
|
+
##
|
|
764
|
+
# Returns all policy bindings that bind a specific policy if a user has
|
|
765
|
+
# searchPolicyBindings permission on that policy.
|
|
766
|
+
#
|
|
767
|
+
# @overload search_access_policy_bindings(request, options = nil)
|
|
768
|
+
# Pass arguments to `search_access_policy_bindings` via a request object, either of type
|
|
769
|
+
# {::Google::Iam::V3beta::SearchAccessPolicyBindingsRequest} or an equivalent Hash.
|
|
770
|
+
#
|
|
771
|
+
# @param request [::Google::Iam::V3beta::SearchAccessPolicyBindingsRequest, ::Hash]
|
|
772
|
+
# A request object representing the call parameters. Required. To specify no
|
|
773
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
|
774
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
|
775
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
|
776
|
+
#
|
|
777
|
+
# @overload search_access_policy_bindings(name: nil, page_size: nil, page_token: nil)
|
|
778
|
+
# Pass arguments to `search_access_policy_bindings` via keyword arguments. Note that at
|
|
779
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
|
780
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
|
781
|
+
#
|
|
782
|
+
# @param name [::String]
|
|
783
|
+
# Required. The name of the access policy.
|
|
784
|
+
# Format:
|
|
785
|
+
# `organizations/{organization_id}/locations/{location}/accessPolicies/{access_policy_id}`
|
|
786
|
+
# `folders/{folder_id}/locations/{location}/accessPolicies/{access_policy_id}`
|
|
787
|
+
# `projects/{project_id}/locations/{location}/accessPolicies/{access_policy_id}`
|
|
788
|
+
# `projects/{project_number}/locations/{location}/accessPolicies/{access_policy_id}`
|
|
789
|
+
# @param page_size [::Integer]
|
|
790
|
+
# Optional. The maximum number of policy bindings to return. The service may
|
|
791
|
+
# return fewer than this value.
|
|
792
|
+
#
|
|
793
|
+
# If unspecified, at most 50 policy bindings will be returned.
|
|
794
|
+
# The maximum value is 1000; values above 1000 will be coerced to 1000.
|
|
795
|
+
# @param page_token [::String]
|
|
796
|
+
# Optional. A page token, received from a previous
|
|
797
|
+
# `SearchAccessPolicyBindingsRequest` call. Provide this to
|
|
798
|
+
# retrieve the subsequent page.
|
|
799
|
+
#
|
|
800
|
+
# When paginating, all other parameters provided to
|
|
801
|
+
# `SearchAccessPolicyBindingsRequest` must match the call
|
|
802
|
+
# that provided the page token.
|
|
803
|
+
#
|
|
804
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
|
805
|
+
# @yieldparam response [::Gapic::PagedEnumerable<::Google::Iam::V3beta::PolicyBinding>]
|
|
806
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
|
807
|
+
#
|
|
808
|
+
# @return [::Gapic::PagedEnumerable<::Google::Iam::V3beta::PolicyBinding>]
|
|
809
|
+
#
|
|
810
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
|
811
|
+
#
|
|
812
|
+
# @example Basic example
|
|
813
|
+
# require "google/iam/v3beta"
|
|
814
|
+
#
|
|
815
|
+
# # Create a client object. The client can be reused for multiple calls.
|
|
816
|
+
# client = Google::Iam::V3beta::AccessPolicies::Client.new
|
|
817
|
+
#
|
|
818
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
|
819
|
+
# request = Google::Iam::V3beta::SearchAccessPolicyBindingsRequest.new
|
|
820
|
+
#
|
|
821
|
+
# # Call the search_access_policy_bindings method.
|
|
822
|
+
# result = client.search_access_policy_bindings request
|
|
823
|
+
#
|
|
824
|
+
# # The returned object is of type Gapic::PagedEnumerable. You can iterate
|
|
825
|
+
# # over elements, and API calls will be issued to fetch pages as needed.
|
|
826
|
+
# result.each do |item|
|
|
827
|
+
# # Each element is of type ::Google::Iam::V3beta::PolicyBinding.
|
|
828
|
+
# p item
|
|
829
|
+
# end
|
|
830
|
+
#
|
|
831
|
+
def search_access_policy_bindings request, options = nil
|
|
832
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
|
833
|
+
|
|
834
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Iam::V3beta::SearchAccessPolicyBindingsRequest
|
|
835
|
+
|
|
836
|
+
# Converts hash and nil to an options object
|
|
837
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
|
838
|
+
|
|
839
|
+
# Customize the options with defaults
|
|
840
|
+
metadata = @config.rpcs.search_access_policy_bindings.metadata.to_h
|
|
841
|
+
|
|
842
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
|
843
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
|
844
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
|
845
|
+
gapic_version: ::Google::Iam::V3beta::VERSION
|
|
846
|
+
metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
|
847
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
|
848
|
+
|
|
849
|
+
header_params = {}
|
|
850
|
+
if request.name
|
|
851
|
+
header_params["name"] = request.name
|
|
852
|
+
end
|
|
853
|
+
|
|
854
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
|
855
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
|
856
|
+
|
|
857
|
+
options.apply_defaults timeout: @config.rpcs.search_access_policy_bindings.timeout,
|
|
858
|
+
metadata: metadata,
|
|
859
|
+
retry_policy: @config.rpcs.search_access_policy_bindings.retry_policy
|
|
860
|
+
|
|
861
|
+
options.apply_defaults timeout: @config.timeout,
|
|
862
|
+
metadata: @config.metadata,
|
|
863
|
+
retry_policy: @config.retry_policy
|
|
864
|
+
|
|
865
|
+
@access_policies_stub.call_rpc :search_access_policy_bindings, request, options: options do |response, operation|
|
|
866
|
+
response = ::Gapic::PagedEnumerable.new @access_policies_stub, :search_access_policy_bindings, request, response, operation, options
|
|
867
|
+
yield response, operation if block_given?
|
|
868
|
+
throw :response, response
|
|
869
|
+
end
|
|
870
|
+
rescue ::GRPC::BadStatus => e
|
|
871
|
+
raise ::Google::Cloud::Error.from_error(e)
|
|
872
|
+
end
|
|
873
|
+
|
|
874
|
+
##
|
|
875
|
+
# Configuration class for the AccessPolicies API.
|
|
876
|
+
#
|
|
877
|
+
# This class represents the configuration for AccessPolicies,
|
|
878
|
+
# providing control over timeouts, retry behavior, logging, transport
|
|
879
|
+
# parameters, and other low-level controls. Certain parameters can also be
|
|
880
|
+
# applied individually to specific RPCs. See
|
|
881
|
+
# {::Google::Iam::V3beta::AccessPolicies::Client::Configuration::Rpcs}
|
|
882
|
+
# for a list of RPCs that can be configured independently.
|
|
883
|
+
#
|
|
884
|
+
# Configuration can be applied globally to all clients, or to a single client
|
|
885
|
+
# on construction.
|
|
886
|
+
#
|
|
887
|
+
# @example
|
|
888
|
+
#
|
|
889
|
+
# # Modify the global config, setting the timeout for
|
|
890
|
+
# # create_access_policy to 20 seconds,
|
|
891
|
+
# # and all remaining timeouts to 10 seconds.
|
|
892
|
+
# ::Google::Iam::V3beta::AccessPolicies::Client.configure do |config|
|
|
893
|
+
# config.timeout = 10.0
|
|
894
|
+
# config.rpcs.create_access_policy.timeout = 20.0
|
|
895
|
+
# end
|
|
896
|
+
#
|
|
897
|
+
# # Apply the above configuration only to a new client.
|
|
898
|
+
# client = ::Google::Iam::V3beta::AccessPolicies::Client.new do |config|
|
|
899
|
+
# config.timeout = 10.0
|
|
900
|
+
# config.rpcs.create_access_policy.timeout = 20.0
|
|
901
|
+
# end
|
|
902
|
+
#
|
|
903
|
+
# @!attribute [rw] endpoint
|
|
904
|
+
# A custom service endpoint, as a hostname or hostname:port. The default is
|
|
905
|
+
# nil, indicating to use the default endpoint in the current universe domain.
|
|
906
|
+
# @return [::String,nil]
|
|
907
|
+
# @!attribute [rw] credentials
|
|
908
|
+
# Credentials to send with calls. You may provide any of the following types:
|
|
909
|
+
# * (`Google::Auth::Credentials`) A googleauth credentials object
|
|
910
|
+
# (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
|
|
911
|
+
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
|
912
|
+
# (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
|
|
913
|
+
# * (`GRPC::Core::Channel`) a gRPC channel with included credentials
|
|
914
|
+
# * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
|
|
915
|
+
# * (`nil`) indicating no credentials
|
|
916
|
+
#
|
|
917
|
+
# @note Warning: Passing a `String` to a keyfile path or a `Hash` of credentials
|
|
918
|
+
# is deprecated. Providing an unvalidated credential configuration to
|
|
919
|
+
# Google APIs can compromise the security of your systems and data.
|
|
920
|
+
#
|
|
921
|
+
# @example
|
|
922
|
+
#
|
|
923
|
+
# # The recommended way to provide credentials is to use the `make_creds` method
|
|
924
|
+
# # on the appropriate credentials class for your environment.
|
|
925
|
+
#
|
|
926
|
+
# require "googleauth"
|
|
927
|
+
#
|
|
928
|
+
# credentials = ::Google::Auth::ServiceAccountCredentials.make_creds(
|
|
929
|
+
# json_key_io: ::File.open("/path/to/keyfile.json")
|
|
930
|
+
# )
|
|
931
|
+
#
|
|
932
|
+
# client = ::Google::Iam::V3beta::AccessPolicies::Client.new do |config|
|
|
933
|
+
# config.credentials = credentials
|
|
934
|
+
# end
|
|
935
|
+
#
|
|
936
|
+
# @note Warning: If you accept a credential configuration (JSON file or Hash) from an
|
|
937
|
+
# external source for authentication to Google Cloud, you must validate it before
|
|
938
|
+
# providing it to a Google API client library. Providing an unvalidated credential
|
|
939
|
+
# configuration to Google APIs can compromise the security of your systems and data.
|
|
940
|
+
# For more information, refer to [Validate credential configurations from external
|
|
941
|
+
# sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
|
|
942
|
+
# @return [::Object]
|
|
943
|
+
# @!attribute [rw] scope
|
|
944
|
+
# The OAuth scopes
|
|
945
|
+
# @return [::Array<::String>]
|
|
946
|
+
# @!attribute [rw] lib_name
|
|
947
|
+
# The library name as recorded in instrumentation and logging
|
|
948
|
+
# @return [::String]
|
|
949
|
+
# @!attribute [rw] lib_version
|
|
950
|
+
# The library version as recorded in instrumentation and logging
|
|
951
|
+
# @return [::String]
|
|
952
|
+
# @!attribute [rw] channel_args
|
|
953
|
+
# Extra parameters passed to the gRPC channel. Note: this is ignored if a
|
|
954
|
+
# `GRPC::Core::Channel` object is provided as the credential.
|
|
955
|
+
# @return [::Hash]
|
|
956
|
+
# @!attribute [rw] interceptors
|
|
957
|
+
# An array of interceptors that are run before calls are executed.
|
|
958
|
+
# @return [::Array<::GRPC::ClientInterceptor>]
|
|
959
|
+
# @!attribute [rw] timeout
|
|
960
|
+
# The call timeout in seconds.
|
|
961
|
+
# @return [::Numeric]
|
|
962
|
+
# @!attribute [rw] metadata
|
|
963
|
+
# Additional gRPC headers to be sent with the call.
|
|
964
|
+
# @return [::Hash{::Symbol=>::String}]
|
|
965
|
+
# @!attribute [rw] retry_policy
|
|
966
|
+
# The retry policy. The value is a hash with the following keys:
|
|
967
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
|
968
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
|
969
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
|
970
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
|
971
|
+
# trigger a retry.
|
|
972
|
+
# @return [::Hash]
|
|
973
|
+
# @!attribute [rw] quota_project
|
|
974
|
+
# A separate project against which to charge quota.
|
|
975
|
+
# @return [::String]
|
|
976
|
+
# @!attribute [rw] universe_domain
|
|
977
|
+
# The universe domain within which to make requests. This determines the
|
|
978
|
+
# default endpoint URL. The default value of nil uses the environment
|
|
979
|
+
# universe (usually the default "googleapis.com" universe).
|
|
980
|
+
# @return [::String,nil]
|
|
981
|
+
# @!attribute [rw] logger
|
|
982
|
+
# A custom logger to use for request/response debug logging, or the value
|
|
983
|
+
# `:default` (the default) to construct a default logger, or `nil` to
|
|
984
|
+
# explicitly disable logging.
|
|
985
|
+
# @return [::Logger,:default,nil]
|
|
986
|
+
#
|
|
987
|
+
class Configuration
|
|
988
|
+
extend ::Gapic::Config
|
|
989
|
+
|
|
990
|
+
# @private
|
|
991
|
+
# The endpoint specific to the default "googleapis.com" universe. Deprecated.
|
|
992
|
+
DEFAULT_ENDPOINT = "iam.googleapis.com"
|
|
993
|
+
|
|
994
|
+
config_attr :endpoint, nil, ::String, nil
|
|
995
|
+
config_attr :credentials, nil do |value|
|
|
996
|
+
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil]
|
|
997
|
+
allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC::Core::Channel
|
|
998
|
+
allowed.any? { |klass| klass === value }
|
|
999
|
+
end
|
|
1000
|
+
config_attr :scope, nil, ::String, ::Array, nil
|
|
1001
|
+
config_attr :lib_name, nil, ::String, nil
|
|
1002
|
+
config_attr :lib_version, nil, ::String, nil
|
|
1003
|
+
config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
|
|
1004
|
+
config_attr :interceptors, nil, ::Array, nil
|
|
1005
|
+
config_attr :timeout, nil, ::Numeric, nil
|
|
1006
|
+
config_attr :metadata, nil, ::Hash, nil
|
|
1007
|
+
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
|
1008
|
+
config_attr :quota_project, nil, ::String, nil
|
|
1009
|
+
config_attr :universe_domain, nil, ::String, nil
|
|
1010
|
+
config_attr :logger, :default, ::Logger, nil, :default
|
|
1011
|
+
|
|
1012
|
+
# @private
|
|
1013
|
+
def initialize parent_config = nil
|
|
1014
|
+
@parent_config = parent_config unless parent_config.nil?
|
|
1015
|
+
|
|
1016
|
+
yield self if block_given?
|
|
1017
|
+
end
|
|
1018
|
+
|
|
1019
|
+
##
|
|
1020
|
+
# Configurations for individual RPCs
|
|
1021
|
+
# @return [Rpcs]
|
|
1022
|
+
#
|
|
1023
|
+
def rpcs
|
|
1024
|
+
@rpcs ||= begin
|
|
1025
|
+
parent_rpcs = nil
|
|
1026
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
|
|
1027
|
+
Rpcs.new parent_rpcs
|
|
1028
|
+
end
|
|
1029
|
+
end
|
|
1030
|
+
|
|
1031
|
+
##
|
|
1032
|
+
# Configuration for the channel pool
|
|
1033
|
+
# @return [::Gapic::ServiceStub::ChannelPool::Configuration]
|
|
1034
|
+
#
|
|
1035
|
+
def channel_pool
|
|
1036
|
+
@channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new
|
|
1037
|
+
end
|
|
1038
|
+
|
|
1039
|
+
##
|
|
1040
|
+
# Configuration RPC class for the AccessPolicies API.
|
|
1041
|
+
#
|
|
1042
|
+
# Includes fields providing the configuration for each RPC in this service.
|
|
1043
|
+
# Each configuration object is of type `Gapic::Config::Method` and includes
|
|
1044
|
+
# the following configuration fields:
|
|
1045
|
+
#
|
|
1046
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in seconds
|
|
1047
|
+
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
|
|
1048
|
+
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
|
1049
|
+
# include the following keys:
|
|
1050
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
|
1051
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
|
1052
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
|
1053
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
|
1054
|
+
# trigger a retry.
|
|
1055
|
+
#
|
|
1056
|
+
class Rpcs
|
|
1057
|
+
##
|
|
1058
|
+
# RPC-specific configuration for `create_access_policy`
|
|
1059
|
+
# @return [::Gapic::Config::Method]
|
|
1060
|
+
#
|
|
1061
|
+
attr_reader :create_access_policy
|
|
1062
|
+
##
|
|
1063
|
+
# RPC-specific configuration for `get_access_policy`
|
|
1064
|
+
# @return [::Gapic::Config::Method]
|
|
1065
|
+
#
|
|
1066
|
+
attr_reader :get_access_policy
|
|
1067
|
+
##
|
|
1068
|
+
# RPC-specific configuration for `update_access_policy`
|
|
1069
|
+
# @return [::Gapic::Config::Method]
|
|
1070
|
+
#
|
|
1071
|
+
attr_reader :update_access_policy
|
|
1072
|
+
##
|
|
1073
|
+
# RPC-specific configuration for `delete_access_policy`
|
|
1074
|
+
# @return [::Gapic::Config::Method]
|
|
1075
|
+
#
|
|
1076
|
+
attr_reader :delete_access_policy
|
|
1077
|
+
##
|
|
1078
|
+
# RPC-specific configuration for `list_access_policies`
|
|
1079
|
+
# @return [::Gapic::Config::Method]
|
|
1080
|
+
#
|
|
1081
|
+
attr_reader :list_access_policies
|
|
1082
|
+
##
|
|
1083
|
+
# RPC-specific configuration for `search_access_policy_bindings`
|
|
1084
|
+
# @return [::Gapic::Config::Method]
|
|
1085
|
+
#
|
|
1086
|
+
attr_reader :search_access_policy_bindings
|
|
1087
|
+
|
|
1088
|
+
# @private
|
|
1089
|
+
def initialize parent_rpcs = nil
|
|
1090
|
+
create_access_policy_config = parent_rpcs.create_access_policy if parent_rpcs.respond_to? :create_access_policy
|
|
1091
|
+
@create_access_policy = ::Gapic::Config::Method.new create_access_policy_config
|
|
1092
|
+
get_access_policy_config = parent_rpcs.get_access_policy if parent_rpcs.respond_to? :get_access_policy
|
|
1093
|
+
@get_access_policy = ::Gapic::Config::Method.new get_access_policy_config
|
|
1094
|
+
update_access_policy_config = parent_rpcs.update_access_policy if parent_rpcs.respond_to? :update_access_policy
|
|
1095
|
+
@update_access_policy = ::Gapic::Config::Method.new update_access_policy_config
|
|
1096
|
+
delete_access_policy_config = parent_rpcs.delete_access_policy if parent_rpcs.respond_to? :delete_access_policy
|
|
1097
|
+
@delete_access_policy = ::Gapic::Config::Method.new delete_access_policy_config
|
|
1098
|
+
list_access_policies_config = parent_rpcs.list_access_policies if parent_rpcs.respond_to? :list_access_policies
|
|
1099
|
+
@list_access_policies = ::Gapic::Config::Method.new list_access_policies_config
|
|
1100
|
+
search_access_policy_bindings_config = parent_rpcs.search_access_policy_bindings if parent_rpcs.respond_to? :search_access_policy_bindings
|
|
1101
|
+
@search_access_policy_bindings = ::Gapic::Config::Method.new search_access_policy_bindings_config
|
|
1102
|
+
|
|
1103
|
+
yield self if block_given?
|
|
1104
|
+
end
|
|
1105
|
+
end
|
|
1106
|
+
end
|
|
1107
|
+
end
|
|
1108
|
+
end
|
|
1109
|
+
end
|
|
1110
|
+
end
|
|
1111
|
+
end
|