google-cloud-batch-v1 0.6.0 → 0.7.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/README.md +1 -1
- data/lib/google/cloud/batch/v1/batch_pb.rb +1 -0
- data/lib/google/cloud/batch/v1/batch_service/client.rb +16 -34
- data/lib/google/cloud/batch/v1/batch_service/operations.rb +12 -14
- data/lib/google/cloud/batch/v1/batch_service/rest/client.rb +810 -0
- data/lib/google/cloud/batch/v1/batch_service/rest/operations.rb +793 -0
- data/lib/google/cloud/batch/v1/batch_service/rest/service_stub.rb +403 -0
- data/lib/google/cloud/batch/v1/batch_service/rest.rb +56 -0
- data/lib/google/cloud/batch/v1/batch_service.rb +6 -0
- data/lib/google/cloud/batch/v1/bindings_override.rb +102 -0
- data/lib/google/cloud/batch/v1/rest.rb +38 -0
- data/lib/google/cloud/batch/v1/task_pb.rb +1 -0
- data/lib/google/cloud/batch/v1/version.rb +1 -1
- data/lib/google/cloud/batch/v1.rb +5 -0
- data/lib/google/iam/v1/bindings_override.rb +100 -0
- data/lib/google/iam/v1/iam_policy/client.rb +639 -0
- data/lib/google/iam/v1/iam_policy/credentials.rb +42 -0
- data/lib/google/iam/v1/iam_policy/rest/client.rb +558 -0
- data/lib/google/iam/v1/iam_policy/rest/service_stub.rb +226 -0
- data/lib/google/iam/v1/iam_policy/rest.rb +75 -0
- data/lib/google/iam/v1/iam_policy.rb +77 -0
- data/lib/google/iam/v1/rest.rb +36 -0
- data/lib/google/iam/v1.rb +43 -0
- data/lib/google-cloud-batch-v1.rb +1 -0
- data/proto_docs/google/cloud/batch/v1/batch.rb +4 -4
- data/proto_docs/google/cloud/batch/v1/job.rb +2 -1
- data/proto_docs/google/cloud/batch/v1/task.rb +27 -7
- data/proto_docs/google/iam/v1/iam_policy.rb +87 -0
- data/proto_docs/google/iam/v1/options.rb +50 -0
- data/proto_docs/google/iam/v1/policy.rb +418 -0
- metadata +32 -20
@@ -0,0 +1,639 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2023 Google LLC
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
# Auto-generated by gapic-generator-ruby. DO NOT EDIT!
|
18
|
+
|
19
|
+
require "google/cloud/errors"
|
20
|
+
require "google/iam/v1/iam_policy_pb"
|
21
|
+
require "google/cloud/location"
|
22
|
+
|
23
|
+
module Google
|
24
|
+
module Iam
|
25
|
+
module V1
|
26
|
+
module IAMPolicy
|
27
|
+
##
|
28
|
+
# Client for the IAMPolicy service.
|
29
|
+
#
|
30
|
+
# API Overview
|
31
|
+
#
|
32
|
+
#
|
33
|
+
# Manages Identity and Access Management (IAM) policies.
|
34
|
+
#
|
35
|
+
# Any implementation of an API that offers access control features
|
36
|
+
# implements the google.iam.v1.IAMPolicy interface.
|
37
|
+
#
|
38
|
+
# ## Data model
|
39
|
+
#
|
40
|
+
# Access control is applied when a principal (user or service account), takes
|
41
|
+
# some action on a resource exposed by a service. Resources, identified by
|
42
|
+
# URI-like names, are the unit of access control specification. Service
|
43
|
+
# implementations can choose the granularity of access control and the
|
44
|
+
# supported permissions for their resources.
|
45
|
+
# For example one database service may allow access control to be
|
46
|
+
# specified only at the Table level, whereas another might allow access control
|
47
|
+
# to also be specified at the Column level.
|
48
|
+
#
|
49
|
+
# ## Policy Structure
|
50
|
+
#
|
51
|
+
# See google.iam.v1.Policy
|
52
|
+
#
|
53
|
+
# This is intentionally not a CRUD style API because access control policies
|
54
|
+
# are created and deleted implicitly with the resources to which they are
|
55
|
+
# attached.
|
56
|
+
#
|
57
|
+
class Client
|
58
|
+
# @private
|
59
|
+
attr_reader :iam_policy_stub
|
60
|
+
|
61
|
+
##
|
62
|
+
# Configure the IAMPolicy Client class.
|
63
|
+
#
|
64
|
+
# See {::Google::Iam::V1::IAMPolicy::Client::Configuration}
|
65
|
+
# for a description of the configuration fields.
|
66
|
+
#
|
67
|
+
# @example
|
68
|
+
#
|
69
|
+
# # Modify the configuration for all IAMPolicy clients
|
70
|
+
# ::Google::Iam::V1::IAMPolicy::Client.configure do |config|
|
71
|
+
# config.timeout = 10.0
|
72
|
+
# end
|
73
|
+
#
|
74
|
+
# @yield [config] Configure the Client client.
|
75
|
+
# @yieldparam config [Client::Configuration]
|
76
|
+
#
|
77
|
+
# @return [Client::Configuration]
|
78
|
+
#
|
79
|
+
def self.configure
|
80
|
+
@configure ||= begin
|
81
|
+
namespace = ["Google", "Iam", "V1"]
|
82
|
+
parent_config = while namespace.any?
|
83
|
+
parent_name = namespace.join "::"
|
84
|
+
parent_const = const_get parent_name
|
85
|
+
break parent_const.configure if parent_const.respond_to? :configure
|
86
|
+
namespace.pop
|
87
|
+
end
|
88
|
+
default_config = Client::Configuration.new parent_config
|
89
|
+
|
90
|
+
default_config
|
91
|
+
end
|
92
|
+
yield @configure if block_given?
|
93
|
+
@configure
|
94
|
+
end
|
95
|
+
|
96
|
+
##
|
97
|
+
# Configure the IAMPolicy Client instance.
|
98
|
+
#
|
99
|
+
# The configuration is set to the derived mode, meaning that values can be changed,
|
100
|
+
# but structural changes (adding new fields, etc.) are not allowed. Structural changes
|
101
|
+
# should be made on {Client.configure}.
|
102
|
+
#
|
103
|
+
# See {::Google::Iam::V1::IAMPolicy::Client::Configuration}
|
104
|
+
# for a description of the configuration fields.
|
105
|
+
#
|
106
|
+
# @yield [config] Configure the Client client.
|
107
|
+
# @yieldparam config [Client::Configuration]
|
108
|
+
#
|
109
|
+
# @return [Client::Configuration]
|
110
|
+
#
|
111
|
+
def configure
|
112
|
+
yield @config if block_given?
|
113
|
+
@config
|
114
|
+
end
|
115
|
+
|
116
|
+
##
|
117
|
+
# Create a new IAMPolicy client object.
|
118
|
+
#
|
119
|
+
# @example
|
120
|
+
#
|
121
|
+
# # Create a client using the default configuration
|
122
|
+
# client = ::Google::Iam::V1::IAMPolicy::Client.new
|
123
|
+
#
|
124
|
+
# # Create a client using a custom configuration
|
125
|
+
# client = ::Google::Iam::V1::IAMPolicy::Client.new do |config|
|
126
|
+
# config.timeout = 10.0
|
127
|
+
# end
|
128
|
+
#
|
129
|
+
# @yield [config] Configure the IAMPolicy client.
|
130
|
+
# @yieldparam config [Client::Configuration]
|
131
|
+
#
|
132
|
+
def initialize
|
133
|
+
# These require statements are intentionally placed here to initialize
|
134
|
+
# the gRPC module only when it's required.
|
135
|
+
# See https://github.com/googleapis/toolkit/issues/446
|
136
|
+
require "gapic/grpc"
|
137
|
+
require "google/iam/v1/iam_policy_services_pb"
|
138
|
+
|
139
|
+
# Create the configuration object
|
140
|
+
@config = Configuration.new Client.configure
|
141
|
+
|
142
|
+
# Yield the configuration if needed
|
143
|
+
yield @config if block_given?
|
144
|
+
|
145
|
+
# Create credentials
|
146
|
+
credentials = @config.credentials
|
147
|
+
# Use self-signed JWT if the endpoint is unchanged from default,
|
148
|
+
# but only if the default endpoint does not have a region prefix.
|
149
|
+
enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
|
150
|
+
!@config.endpoint.split(".").first.include?("-")
|
151
|
+
credentials ||= Credentials.default scope: @config.scope,
|
152
|
+
enable_self_signed_jwt: enable_self_signed_jwt
|
153
|
+
if credentials.is_a?(::String) || credentials.is_a?(::Hash)
|
154
|
+
credentials = Credentials.new credentials, scope: @config.scope
|
155
|
+
end
|
156
|
+
@quota_project_id = @config.quota_project
|
157
|
+
@quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
|
158
|
+
|
159
|
+
@location_client = Google::Cloud::Location::Locations::Client.new do |config|
|
160
|
+
config.credentials = credentials
|
161
|
+
config.quota_project = @quota_project_id
|
162
|
+
config.endpoint = @config.endpoint
|
163
|
+
end
|
164
|
+
|
165
|
+
@iam_policy_stub = ::Gapic::ServiceStub.new(
|
166
|
+
::Google::Iam::V1::IAMPolicy::Stub,
|
167
|
+
credentials: credentials,
|
168
|
+
endpoint: @config.endpoint,
|
169
|
+
channel_args: @config.channel_args,
|
170
|
+
interceptors: @config.interceptors
|
171
|
+
)
|
172
|
+
end
|
173
|
+
|
174
|
+
##
|
175
|
+
# Get the associated client for mix-in of the Locations.
|
176
|
+
#
|
177
|
+
# @return [Google::Cloud::Location::Locations::Client]
|
178
|
+
#
|
179
|
+
attr_reader :location_client
|
180
|
+
|
181
|
+
# Service calls
|
182
|
+
|
183
|
+
##
|
184
|
+
# Sets the access control policy on the specified resource. Replaces any
|
185
|
+
# existing policy.
|
186
|
+
#
|
187
|
+
# Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
|
188
|
+
#
|
189
|
+
# @overload set_iam_policy(request, options = nil)
|
190
|
+
# Pass arguments to `set_iam_policy` via a request object, either of type
|
191
|
+
# {::Google::Iam::V1::SetIamPolicyRequest} or an equivalent Hash.
|
192
|
+
#
|
193
|
+
# @param request [::Google::Iam::V1::SetIamPolicyRequest, ::Hash]
|
194
|
+
# A request object representing the call parameters. Required. To specify no
|
195
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
196
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
197
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
198
|
+
#
|
199
|
+
# @overload set_iam_policy(resource: nil, policy: nil, update_mask: nil)
|
200
|
+
# Pass arguments to `set_iam_policy` via keyword arguments. Note that at
|
201
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
202
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
203
|
+
#
|
204
|
+
# @param resource [::String]
|
205
|
+
# REQUIRED: The resource for which the policy is being specified.
|
206
|
+
# See the operation documentation for the appropriate value for this field.
|
207
|
+
# @param policy [::Google::Iam::V1::Policy, ::Hash]
|
208
|
+
# REQUIRED: The complete policy to be applied to the `resource`. The size of
|
209
|
+
# the policy is limited to a few 10s of KB. An empty policy is a
|
210
|
+
# valid policy but certain Cloud Platform services (such as Projects)
|
211
|
+
# might reject them.
|
212
|
+
# @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
|
213
|
+
# OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only
|
214
|
+
# the fields in the mask will be modified. If no mask is provided, the
|
215
|
+
# following default mask is used:
|
216
|
+
#
|
217
|
+
# `paths: "bindings, etag"`
|
218
|
+
#
|
219
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
220
|
+
# @yieldparam response [::Google::Iam::V1::Policy]
|
221
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
222
|
+
#
|
223
|
+
# @return [::Google::Iam::V1::Policy]
|
224
|
+
#
|
225
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
226
|
+
#
|
227
|
+
# @example Basic example
|
228
|
+
# require "google/iam/v1"
|
229
|
+
#
|
230
|
+
# # Create a client object. The client can be reused for multiple calls.
|
231
|
+
# client = Google::Iam::V1::IAMPolicy::Client.new
|
232
|
+
#
|
233
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
234
|
+
# request = Google::Iam::V1::SetIamPolicyRequest.new
|
235
|
+
#
|
236
|
+
# # Call the set_iam_policy method.
|
237
|
+
# result = client.set_iam_policy request
|
238
|
+
#
|
239
|
+
# # The returned object is of type Google::Iam::V1::Policy.
|
240
|
+
# p result
|
241
|
+
#
|
242
|
+
def set_iam_policy request, options = nil
|
243
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
244
|
+
|
245
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Iam::V1::SetIamPolicyRequest
|
246
|
+
|
247
|
+
# Converts hash and nil to an options object
|
248
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
249
|
+
|
250
|
+
# Customize the options with defaults
|
251
|
+
metadata = @config.rpcs.set_iam_policy.metadata.to_h
|
252
|
+
|
253
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
254
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
255
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
256
|
+
gapic_version: ::Google::Cloud::Batch::V1::VERSION
|
257
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
258
|
+
|
259
|
+
header_params = {}
|
260
|
+
if request.resource
|
261
|
+
header_params["resource"] = request.resource
|
262
|
+
end
|
263
|
+
|
264
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
265
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
266
|
+
|
267
|
+
options.apply_defaults timeout: @config.rpcs.set_iam_policy.timeout,
|
268
|
+
metadata: metadata,
|
269
|
+
retry_policy: @config.rpcs.set_iam_policy.retry_policy
|
270
|
+
|
271
|
+
options.apply_defaults timeout: @config.timeout,
|
272
|
+
metadata: @config.metadata,
|
273
|
+
retry_policy: @config.retry_policy
|
274
|
+
|
275
|
+
@iam_policy_stub.call_rpc :set_iam_policy, request, options: options do |response, operation|
|
276
|
+
yield response, operation if block_given?
|
277
|
+
return response
|
278
|
+
end
|
279
|
+
rescue ::GRPC::BadStatus => e
|
280
|
+
raise ::Google::Cloud::Error.from_error(e)
|
281
|
+
end
|
282
|
+
|
283
|
+
##
|
284
|
+
# Gets the access control policy for a resource.
|
285
|
+
# Returns an empty policy if the resource exists and does not have a policy
|
286
|
+
# set.
|
287
|
+
#
|
288
|
+
# @overload get_iam_policy(request, options = nil)
|
289
|
+
# Pass arguments to `get_iam_policy` via a request object, either of type
|
290
|
+
# {::Google::Iam::V1::GetIamPolicyRequest} or an equivalent Hash.
|
291
|
+
#
|
292
|
+
# @param request [::Google::Iam::V1::GetIamPolicyRequest, ::Hash]
|
293
|
+
# A request object representing the call parameters. Required. To specify no
|
294
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
295
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
296
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
297
|
+
#
|
298
|
+
# @overload get_iam_policy(resource: nil, options: nil)
|
299
|
+
# Pass arguments to `get_iam_policy` via keyword arguments. Note that at
|
300
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
301
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
302
|
+
#
|
303
|
+
# @param resource [::String]
|
304
|
+
# REQUIRED: The resource for which the policy is being requested.
|
305
|
+
# See the operation documentation for the appropriate value for this field.
|
306
|
+
# @param options [::Google::Iam::V1::GetPolicyOptions, ::Hash]
|
307
|
+
# OPTIONAL: A `GetPolicyOptions` object for specifying options to
|
308
|
+
# `GetIamPolicy`.
|
309
|
+
#
|
310
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
311
|
+
# @yieldparam response [::Google::Iam::V1::Policy]
|
312
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
313
|
+
#
|
314
|
+
# @return [::Google::Iam::V1::Policy]
|
315
|
+
#
|
316
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
317
|
+
#
|
318
|
+
# @example Basic example
|
319
|
+
# require "google/iam/v1"
|
320
|
+
#
|
321
|
+
# # Create a client object. The client can be reused for multiple calls.
|
322
|
+
# client = Google::Iam::V1::IAMPolicy::Client.new
|
323
|
+
#
|
324
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
325
|
+
# request = Google::Iam::V1::GetIamPolicyRequest.new
|
326
|
+
#
|
327
|
+
# # Call the get_iam_policy method.
|
328
|
+
# result = client.get_iam_policy request
|
329
|
+
#
|
330
|
+
# # The returned object is of type Google::Iam::V1::Policy.
|
331
|
+
# p result
|
332
|
+
#
|
333
|
+
def get_iam_policy request, options = nil
|
334
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
335
|
+
|
336
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Iam::V1::GetIamPolicyRequest
|
337
|
+
|
338
|
+
# Converts hash and nil to an options object
|
339
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
340
|
+
|
341
|
+
# Customize the options with defaults
|
342
|
+
metadata = @config.rpcs.get_iam_policy.metadata.to_h
|
343
|
+
|
344
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
345
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
346
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
347
|
+
gapic_version: ::Google::Cloud::Batch::V1::VERSION
|
348
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
349
|
+
|
350
|
+
header_params = {}
|
351
|
+
if request.resource
|
352
|
+
header_params["resource"] = request.resource
|
353
|
+
end
|
354
|
+
|
355
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
356
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
357
|
+
|
358
|
+
options.apply_defaults timeout: @config.rpcs.get_iam_policy.timeout,
|
359
|
+
metadata: metadata,
|
360
|
+
retry_policy: @config.rpcs.get_iam_policy.retry_policy
|
361
|
+
|
362
|
+
options.apply_defaults timeout: @config.timeout,
|
363
|
+
metadata: @config.metadata,
|
364
|
+
retry_policy: @config.retry_policy
|
365
|
+
|
366
|
+
@iam_policy_stub.call_rpc :get_iam_policy, request, options: options do |response, operation|
|
367
|
+
yield response, operation if block_given?
|
368
|
+
return response
|
369
|
+
end
|
370
|
+
rescue ::GRPC::BadStatus => e
|
371
|
+
raise ::Google::Cloud::Error.from_error(e)
|
372
|
+
end
|
373
|
+
|
374
|
+
##
|
375
|
+
# Returns permissions that a caller has on the specified resource.
|
376
|
+
# If the resource does not exist, this will return an empty set of
|
377
|
+
# permissions, not a `NOT_FOUND` error.
|
378
|
+
#
|
379
|
+
# Note: This operation is designed to be used for building permission-aware
|
380
|
+
# UIs and command-line tools, not for authorization checking. This operation
|
381
|
+
# may "fail open" without warning.
|
382
|
+
#
|
383
|
+
# @overload test_iam_permissions(request, options = nil)
|
384
|
+
# Pass arguments to `test_iam_permissions` via a request object, either of type
|
385
|
+
# {::Google::Iam::V1::TestIamPermissionsRequest} or an equivalent Hash.
|
386
|
+
#
|
387
|
+
# @param request [::Google::Iam::V1::TestIamPermissionsRequest, ::Hash]
|
388
|
+
# A request object representing the call parameters. Required. To specify no
|
389
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
390
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
391
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
392
|
+
#
|
393
|
+
# @overload test_iam_permissions(resource: nil, permissions: nil)
|
394
|
+
# Pass arguments to `test_iam_permissions` via keyword arguments. Note that at
|
395
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
396
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
397
|
+
#
|
398
|
+
# @param resource [::String]
|
399
|
+
# REQUIRED: The resource for which the policy detail is being requested.
|
400
|
+
# See the operation documentation for the appropriate value for this field.
|
401
|
+
# @param permissions [::Array<::String>]
|
402
|
+
# The set of permissions to check for the `resource`. Permissions with
|
403
|
+
# wildcards (such as '*' or 'storage.*') are not allowed. For more
|
404
|
+
# information see
|
405
|
+
# [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions).
|
406
|
+
#
|
407
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
408
|
+
# @yieldparam response [::Google::Iam::V1::TestIamPermissionsResponse]
|
409
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
410
|
+
#
|
411
|
+
# @return [::Google::Iam::V1::TestIamPermissionsResponse]
|
412
|
+
#
|
413
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
414
|
+
#
|
415
|
+
# @example Basic example
|
416
|
+
# require "google/iam/v1"
|
417
|
+
#
|
418
|
+
# # Create a client object. The client can be reused for multiple calls.
|
419
|
+
# client = Google::Iam::V1::IAMPolicy::Client.new
|
420
|
+
#
|
421
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
422
|
+
# request = Google::Iam::V1::TestIamPermissionsRequest.new
|
423
|
+
#
|
424
|
+
# # Call the test_iam_permissions method.
|
425
|
+
# result = client.test_iam_permissions request
|
426
|
+
#
|
427
|
+
# # The returned object is of type Google::Iam::V1::TestIamPermissionsResponse.
|
428
|
+
# p result
|
429
|
+
#
|
430
|
+
def test_iam_permissions request, options = nil
|
431
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
432
|
+
|
433
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Iam::V1::TestIamPermissionsRequest
|
434
|
+
|
435
|
+
# Converts hash and nil to an options object
|
436
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
437
|
+
|
438
|
+
# Customize the options with defaults
|
439
|
+
metadata = @config.rpcs.test_iam_permissions.metadata.to_h
|
440
|
+
|
441
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
442
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
443
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
444
|
+
gapic_version: ::Google::Cloud::Batch::V1::VERSION
|
445
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
446
|
+
|
447
|
+
header_params = {}
|
448
|
+
if request.resource
|
449
|
+
header_params["resource"] = request.resource
|
450
|
+
end
|
451
|
+
|
452
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
453
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
454
|
+
|
455
|
+
options.apply_defaults timeout: @config.rpcs.test_iam_permissions.timeout,
|
456
|
+
metadata: metadata,
|
457
|
+
retry_policy: @config.rpcs.test_iam_permissions.retry_policy
|
458
|
+
|
459
|
+
options.apply_defaults timeout: @config.timeout,
|
460
|
+
metadata: @config.metadata,
|
461
|
+
retry_policy: @config.retry_policy
|
462
|
+
|
463
|
+
@iam_policy_stub.call_rpc :test_iam_permissions, request, options: options do |response, operation|
|
464
|
+
yield response, operation if block_given?
|
465
|
+
return response
|
466
|
+
end
|
467
|
+
rescue ::GRPC::BadStatus => e
|
468
|
+
raise ::Google::Cloud::Error.from_error(e)
|
469
|
+
end
|
470
|
+
|
471
|
+
##
|
472
|
+
# Configuration class for the IAMPolicy API.
|
473
|
+
#
|
474
|
+
# This class represents the configuration for IAMPolicy,
|
475
|
+
# providing control over timeouts, retry behavior, logging, transport
|
476
|
+
# parameters, and other low-level controls. Certain parameters can also be
|
477
|
+
# applied individually to specific RPCs. See
|
478
|
+
# {::Google::Iam::V1::IAMPolicy::Client::Configuration::Rpcs}
|
479
|
+
# for a list of RPCs that can be configured independently.
|
480
|
+
#
|
481
|
+
# Configuration can be applied globally to all clients, or to a single client
|
482
|
+
# on construction.
|
483
|
+
#
|
484
|
+
# @example
|
485
|
+
#
|
486
|
+
# # Modify the global config, setting the timeout for
|
487
|
+
# # set_iam_policy to 20 seconds,
|
488
|
+
# # and all remaining timeouts to 10 seconds.
|
489
|
+
# ::Google::Iam::V1::IAMPolicy::Client.configure do |config|
|
490
|
+
# config.timeout = 10.0
|
491
|
+
# config.rpcs.set_iam_policy.timeout = 20.0
|
492
|
+
# end
|
493
|
+
#
|
494
|
+
# # Apply the above configuration only to a new client.
|
495
|
+
# client = ::Google::Iam::V1::IAMPolicy::Client.new do |config|
|
496
|
+
# config.timeout = 10.0
|
497
|
+
# config.rpcs.set_iam_policy.timeout = 20.0
|
498
|
+
# end
|
499
|
+
#
|
500
|
+
# @!attribute [rw] endpoint
|
501
|
+
# The hostname or hostname:port of the service endpoint.
|
502
|
+
# Defaults to `"iam-meta-api.googleapis.com"`.
|
503
|
+
# @return [::String]
|
504
|
+
# @!attribute [rw] credentials
|
505
|
+
# Credentials to send with calls. You may provide any of the following types:
|
506
|
+
# * (`String`) The path to a service account key file in JSON format
|
507
|
+
# * (`Hash`) A service account key as a Hash
|
508
|
+
# * (`Google::Auth::Credentials`) A googleauth credentials object
|
509
|
+
# (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
|
510
|
+
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
511
|
+
# (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
|
512
|
+
# * (`GRPC::Core::Channel`) a gRPC channel with included credentials
|
513
|
+
# * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
|
514
|
+
# * (`nil`) indicating no credentials
|
515
|
+
# @return [::Object]
|
516
|
+
# @!attribute [rw] scope
|
517
|
+
# The OAuth scopes
|
518
|
+
# @return [::Array<::String>]
|
519
|
+
# @!attribute [rw] lib_name
|
520
|
+
# The library name as recorded in instrumentation and logging
|
521
|
+
# @return [::String]
|
522
|
+
# @!attribute [rw] lib_version
|
523
|
+
# The library version as recorded in instrumentation and logging
|
524
|
+
# @return [::String]
|
525
|
+
# @!attribute [rw] channel_args
|
526
|
+
# Extra parameters passed to the gRPC channel. Note: this is ignored if a
|
527
|
+
# `GRPC::Core::Channel` object is provided as the credential.
|
528
|
+
# @return [::Hash]
|
529
|
+
# @!attribute [rw] interceptors
|
530
|
+
# An array of interceptors that are run before calls are executed.
|
531
|
+
# @return [::Array<::GRPC::ClientInterceptor>]
|
532
|
+
# @!attribute [rw] timeout
|
533
|
+
# The call timeout in seconds.
|
534
|
+
# @return [::Numeric]
|
535
|
+
# @!attribute [rw] metadata
|
536
|
+
# Additional gRPC headers to be sent with the call.
|
537
|
+
# @return [::Hash{::Symbol=>::String}]
|
538
|
+
# @!attribute [rw] retry_policy
|
539
|
+
# The retry policy. The value is a hash with the following keys:
|
540
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
541
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
542
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
543
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
544
|
+
# trigger a retry.
|
545
|
+
# @return [::Hash]
|
546
|
+
# @!attribute [rw] quota_project
|
547
|
+
# A separate project against which to charge quota.
|
548
|
+
# @return [::String]
|
549
|
+
#
|
550
|
+
class Configuration
|
551
|
+
extend ::Gapic::Config
|
552
|
+
|
553
|
+
config_attr :endpoint, "iam-meta-api.googleapis.com", ::String
|
554
|
+
config_attr :credentials, nil do |value|
|
555
|
+
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
556
|
+
allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
|
557
|
+
allowed.any? { |klass| klass === value }
|
558
|
+
end
|
559
|
+
config_attr :scope, nil, ::String, ::Array, nil
|
560
|
+
config_attr :lib_name, nil, ::String, nil
|
561
|
+
config_attr :lib_version, nil, ::String, nil
|
562
|
+
config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
|
563
|
+
config_attr :interceptors, nil, ::Array, nil
|
564
|
+
config_attr :timeout, nil, ::Numeric, nil
|
565
|
+
config_attr :metadata, nil, ::Hash, nil
|
566
|
+
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
567
|
+
config_attr :quota_project, nil, ::String, nil
|
568
|
+
|
569
|
+
# @private
|
570
|
+
def initialize parent_config = nil
|
571
|
+
@parent_config = parent_config unless parent_config.nil?
|
572
|
+
|
573
|
+
yield self if block_given?
|
574
|
+
end
|
575
|
+
|
576
|
+
##
|
577
|
+
# Configurations for individual RPCs
|
578
|
+
# @return [Rpcs]
|
579
|
+
#
|
580
|
+
def rpcs
|
581
|
+
@rpcs ||= begin
|
582
|
+
parent_rpcs = nil
|
583
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
|
584
|
+
Rpcs.new parent_rpcs
|
585
|
+
end
|
586
|
+
end
|
587
|
+
|
588
|
+
##
|
589
|
+
# Configuration RPC class for the IAMPolicy API.
|
590
|
+
#
|
591
|
+
# Includes fields providing the configuration for each RPC in this service.
|
592
|
+
# Each configuration object is of type `Gapic::Config::Method` and includes
|
593
|
+
# the following configuration fields:
|
594
|
+
#
|
595
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in seconds
|
596
|
+
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
|
597
|
+
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
598
|
+
# include the following keys:
|
599
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
600
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
601
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
602
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
603
|
+
# trigger a retry.
|
604
|
+
#
|
605
|
+
class Rpcs
|
606
|
+
##
|
607
|
+
# RPC-specific configuration for `set_iam_policy`
|
608
|
+
# @return [::Gapic::Config::Method]
|
609
|
+
#
|
610
|
+
attr_reader :set_iam_policy
|
611
|
+
##
|
612
|
+
# RPC-specific configuration for `get_iam_policy`
|
613
|
+
# @return [::Gapic::Config::Method]
|
614
|
+
#
|
615
|
+
attr_reader :get_iam_policy
|
616
|
+
##
|
617
|
+
# RPC-specific configuration for `test_iam_permissions`
|
618
|
+
# @return [::Gapic::Config::Method]
|
619
|
+
#
|
620
|
+
attr_reader :test_iam_permissions
|
621
|
+
|
622
|
+
# @private
|
623
|
+
def initialize parent_rpcs = nil
|
624
|
+
set_iam_policy_config = parent_rpcs.set_iam_policy if parent_rpcs.respond_to? :set_iam_policy
|
625
|
+
@set_iam_policy = ::Gapic::Config::Method.new set_iam_policy_config
|
626
|
+
get_iam_policy_config = parent_rpcs.get_iam_policy if parent_rpcs.respond_to? :get_iam_policy
|
627
|
+
@get_iam_policy = ::Gapic::Config::Method.new get_iam_policy_config
|
628
|
+
test_iam_permissions_config = parent_rpcs.test_iam_permissions if parent_rpcs.respond_to? :test_iam_permissions
|
629
|
+
@test_iam_permissions = ::Gapic::Config::Method.new test_iam_permissions_config
|
630
|
+
|
631
|
+
yield self if block_given?
|
632
|
+
end
|
633
|
+
end
|
634
|
+
end
|
635
|
+
end
|
636
|
+
end
|
637
|
+
end
|
638
|
+
end
|
639
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2023 Google LLC
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
# Auto-generated by gapic-generator-ruby. DO NOT EDIT!
|
18
|
+
|
19
|
+
require "googleauth"
|
20
|
+
|
21
|
+
module Google
|
22
|
+
module Iam
|
23
|
+
module V1
|
24
|
+
module IAMPolicy
|
25
|
+
# Credentials for the IAMPolicy API.
|
26
|
+
class Credentials < ::Google::Auth::Credentials
|
27
|
+
self.env_vars = [
|
28
|
+
"GOOGLE_CLOUD_CREDENTIALS",
|
29
|
+
"GOOGLE_CLOUD_KEYFILE",
|
30
|
+
"GCLOUD_KEYFILE",
|
31
|
+
"GOOGLE_CLOUD_CREDENTIALS_JSON",
|
32
|
+
"GOOGLE_CLOUD_KEYFILE_JSON",
|
33
|
+
"GCLOUD_KEYFILE_JSON"
|
34
|
+
]
|
35
|
+
self.paths = [
|
36
|
+
"~/.config/google_cloud/application_default_credentials.json"
|
37
|
+
]
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|