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