google-cloud-resource_manager-v3 0.2.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. checksums.yaml +4 -4
  2. data/AUTHENTICATION.md +1 -1
  3. data/README.md +12 -7
  4. data/lib/google/cloud/resource_manager/v3/folders/client.rb +28 -32
  5. data/lib/google/cloud/resource_manager/v3/folders/operations.rb +15 -14
  6. data/lib/google/cloud/resource_manager/v3/folders/rest/client.rb +1269 -0
  7. data/lib/google/cloud/resource_manager/v3/folders/rest/operations.rb +793 -0
  8. data/lib/google/cloud/resource_manager/v3/folders/rest/service_stub.rb +698 -0
  9. data/lib/google/cloud/resource_manager/v3/folders/rest.rb +55 -0
  10. data/lib/google/cloud/resource_manager/v3/folders.rb +7 -1
  11. data/lib/google/cloud/resource_manager/v3/organizations/client.rb +4 -6
  12. data/lib/google/cloud/resource_manager/v3/organizations/rest/client.rb +702 -0
  13. data/lib/google/cloud/resource_manager/v3/organizations/rest/service_stub.rb +344 -0
  14. data/lib/google/cloud/resource_manager/v3/organizations/rest.rb +52 -0
  15. data/lib/google/cloud/resource_manager/v3/organizations.rb +7 -1
  16. data/lib/google/cloud/resource_manager/v3/projects/client.rb +28 -32
  17. data/lib/google/cloud/resource_manager/v3/projects/operations.rb +15 -14
  18. data/lib/google/cloud/resource_manager/v3/projects/rest/client.rb +1299 -0
  19. data/lib/google/cloud/resource_manager/v3/projects/rest/operations.rb +793 -0
  20. data/lib/google/cloud/resource_manager/v3/projects/rest/service_stub.rb +698 -0
  21. data/lib/google/cloud/resource_manager/v3/projects/rest.rb +53 -0
  22. data/lib/google/cloud/resource_manager/v3/projects.rb +7 -1
  23. data/lib/google/cloud/resource_manager/v3/rest.rb +42 -0
  24. data/lib/google/cloud/resource_manager/v3/tag_bindings/client.rb +12 -14
  25. data/lib/google/cloud/resource_manager/v3/tag_bindings/operations.rb +15 -14
  26. data/lib/google/cloud/resource_manager/v3/tag_bindings/rest/client.rb +527 -0
  27. data/lib/google/cloud/resource_manager/v3/tag_bindings/rest/operations.rb +793 -0
  28. data/lib/google/cloud/resource_manager/v3/tag_bindings/rest/service_stub.rb +222 -0
  29. data/lib/google/cloud/resource_manager/v3/tag_bindings/rest.rb +54 -0
  30. data/lib/google/cloud/resource_manager/v3/tag_bindings.rb +7 -1
  31. data/lib/google/cloud/resource_manager/v3/tag_keys/client.rb +16 -18
  32. data/lib/google/cloud/resource_manager/v3/tag_keys/operations.rb +15 -14
  33. data/lib/google/cloud/resource_manager/v3/tag_keys/rest/client.rb +938 -0
  34. data/lib/google/cloud/resource_manager/v3/tag_keys/rest/operations.rb +793 -0
  35. data/lib/google/cloud/resource_manager/v3/tag_keys/rest/service_stub.rb +521 -0
  36. data/lib/google/cloud/resource_manager/v3/tag_keys/rest.rb +53 -0
  37. data/lib/google/cloud/resource_manager/v3/tag_keys.rb +7 -1
  38. data/lib/google/cloud/resource_manager/v3/tag_values/client.rb +16 -18
  39. data/lib/google/cloud/resource_manager/v3/tag_values/operations.rb +15 -14
  40. data/lib/google/cloud/resource_manager/v3/tag_values/rest/client.rb +934 -0
  41. data/lib/google/cloud/resource_manager/v3/tag_values/rest/operations.rb +793 -0
  42. data/lib/google/cloud/resource_manager/v3/tag_values/rest/service_stub.rb +521 -0
  43. data/lib/google/cloud/resource_manager/v3/tag_values/rest.rb +53 -0
  44. data/lib/google/cloud/resource_manager/v3/tag_values.rb +7 -1
  45. data/lib/google/cloud/resource_manager/v3/version.rb +1 -1
  46. data/lib/google/cloud/resource_manager/v3.rb +7 -2
  47. data/lib/google/cloud/resourcemanager/v3/folders_pb.rb +2 -1
  48. data/lib/google/cloud/resourcemanager/v3/organizations_pb.rb +2 -2
  49. data/lib/google/cloud/resourcemanager/v3/projects_pb.rb +2 -1
  50. data/lib/google/cloud/resourcemanager/v3/tag_bindings_pb.rb +2 -1
  51. data/lib/google/cloud/resourcemanager/v3/tag_keys_pb.rb +2 -1
  52. data/lib/google/cloud/resourcemanager/v3/tag_values_pb.rb +2 -1
  53. data/proto_docs/google/api/client.rb +318 -0
  54. data/proto_docs/google/api/launch_stage.rb +71 -0
  55. data/proto_docs/google/protobuf/any.rb +3 -3
  56. data/proto_docs/google/protobuf/empty.rb +0 -2
  57. data/proto_docs/google/rpc/status.rb +4 -2
  58. metadata +39 -13
@@ -0,0 +1,702 @@
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/cloud/resourcemanager/v3/organizations_pb"
21
+ require "google/cloud/resource_manager/v3/organizations/rest/service_stub"
22
+
23
+ module Google
24
+ module Cloud
25
+ module ResourceManager
26
+ module V3
27
+ module Organizations
28
+ module Rest
29
+ ##
30
+ # REST client for the Organizations service.
31
+ #
32
+ # Allows users to manage their organization resources.
33
+ #
34
+ class Client
35
+ include Paths
36
+
37
+ # @private
38
+ attr_reader :organizations_stub
39
+
40
+ ##
41
+ # Configure the Organizations Client class.
42
+ #
43
+ # See {::Google::Cloud::ResourceManager::V3::Organizations::Rest::Client::Configuration}
44
+ # for a description of the configuration fields.
45
+ #
46
+ # @example
47
+ #
48
+ # # Modify the configuration for all Organizations clients
49
+ # ::Google::Cloud::ResourceManager::V3::Organizations::Rest::Client.configure do |config|
50
+ # config.timeout = 10.0
51
+ # end
52
+ #
53
+ # @yield [config] Configure the Client client.
54
+ # @yieldparam config [Client::Configuration]
55
+ #
56
+ # @return [Client::Configuration]
57
+ #
58
+ def self.configure
59
+ @configure ||= begin
60
+ namespace = ["Google", "Cloud", "ResourceManager", "V3"]
61
+ parent_config = while namespace.any?
62
+ parent_name = namespace.join "::"
63
+ parent_const = const_get parent_name
64
+ break parent_const.configure if parent_const.respond_to? :configure
65
+ namespace.pop
66
+ end
67
+ default_config = Client::Configuration.new parent_config
68
+
69
+ default_config.rpcs.get_organization.timeout = 60.0
70
+ default_config.rpcs.get_organization.retry_policy = {
71
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14]
72
+ }
73
+
74
+ default_config.rpcs.search_organizations.timeout = 60.0
75
+
76
+ default_config.rpcs.get_iam_policy.timeout = 60.0
77
+ default_config.rpcs.get_iam_policy.retry_policy = {
78
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14]
79
+ }
80
+
81
+ default_config.rpcs.set_iam_policy.timeout = 60.0
82
+
83
+ default_config
84
+ end
85
+ yield @configure if block_given?
86
+ @configure
87
+ end
88
+
89
+ ##
90
+ # Configure the Organizations Client instance.
91
+ #
92
+ # The configuration is set to the derived mode, meaning that values can be changed,
93
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
94
+ # should be made on {Client.configure}.
95
+ #
96
+ # See {::Google::Cloud::ResourceManager::V3::Organizations::Rest::Client::Configuration}
97
+ # for a description of the configuration fields.
98
+ #
99
+ # @yield [config] Configure the Client client.
100
+ # @yieldparam config [Client::Configuration]
101
+ #
102
+ # @return [Client::Configuration]
103
+ #
104
+ def configure
105
+ yield @config if block_given?
106
+ @config
107
+ end
108
+
109
+ ##
110
+ # Create a new Organizations REST client object.
111
+ #
112
+ # @example
113
+ #
114
+ # # Create a client using the default configuration
115
+ # client = ::Google::Cloud::ResourceManager::V3::Organizations::Rest::Client.new
116
+ #
117
+ # # Create a client using a custom configuration
118
+ # client = ::Google::Cloud::ResourceManager::V3::Organizations::Rest::Client.new do |config|
119
+ # config.timeout = 10.0
120
+ # end
121
+ #
122
+ # @yield [config] Configure the Organizations client.
123
+ # @yieldparam config [Client::Configuration]
124
+ #
125
+ def initialize
126
+ # Create the configuration object
127
+ @config = Configuration.new Client.configure
128
+
129
+ # Yield the configuration if needed
130
+ yield @config if block_given?
131
+
132
+ # Create credentials
133
+ credentials = @config.credentials
134
+ # Use self-signed JWT if the endpoint is unchanged from default,
135
+ # but only if the default endpoint does not have a region prefix.
136
+ enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
137
+ !@config.endpoint.split(".").first.include?("-")
138
+ credentials ||= Credentials.default scope: @config.scope,
139
+ enable_self_signed_jwt: enable_self_signed_jwt
140
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
141
+ credentials = Credentials.new credentials, scope: @config.scope
142
+ end
143
+
144
+ @quota_project_id = @config.quota_project
145
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
146
+
147
+ @organizations_stub = ::Google::Cloud::ResourceManager::V3::Organizations::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials
148
+ end
149
+
150
+ # Service calls
151
+
152
+ ##
153
+ # Fetches an organization resource identified by the specified resource name.
154
+ #
155
+ # @overload get_organization(request, options = nil)
156
+ # Pass arguments to `get_organization` via a request object, either of type
157
+ # {::Google::Cloud::ResourceManager::V3::GetOrganizationRequest} or an equivalent Hash.
158
+ #
159
+ # @param request [::Google::Cloud::ResourceManager::V3::GetOrganizationRequest, ::Hash]
160
+ # A request object representing the call parameters. Required. To specify no
161
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
162
+ # @param options [::Gapic::CallOptions, ::Hash]
163
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
164
+ #
165
+ # @overload get_organization(name: nil)
166
+ # Pass arguments to `get_organization` via keyword arguments. Note that at
167
+ # least one keyword argument is required. To specify no parameters, or to keep all
168
+ # the default parameter values, pass an empty Hash as a request object (see above).
169
+ #
170
+ # @param name [::String]
171
+ # Required. The resource name of the Organization to fetch. This is the organization's
172
+ # relative path in the API, formatted as "organizations/[organizationId]".
173
+ # For example, "organizations/1234".
174
+ # @yield [result, operation] Access the result along with the TransportOperation object
175
+ # @yieldparam result [::Google::Cloud::ResourceManager::V3::Organization]
176
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
177
+ #
178
+ # @return [::Google::Cloud::ResourceManager::V3::Organization]
179
+ #
180
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
181
+ def get_organization request, options = nil
182
+ raise ::ArgumentError, "request must be provided" if request.nil?
183
+
184
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::ResourceManager::V3::GetOrganizationRequest
185
+
186
+ # Converts hash and nil to an options object
187
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
188
+
189
+ # Customize the options with defaults
190
+ call_metadata = @config.rpcs.get_organization.metadata.to_h
191
+
192
+ # Set x-goog-api-client and x-goog-user-project headers
193
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
194
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
195
+ gapic_version: ::Google::Cloud::ResourceManager::V3::VERSION,
196
+ transports_version_send: [:rest]
197
+
198
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
199
+
200
+ options.apply_defaults timeout: @config.rpcs.get_organization.timeout,
201
+ metadata: call_metadata,
202
+ retry_policy: @config.rpcs.get_organization.retry_policy
203
+
204
+ options.apply_defaults timeout: @config.timeout,
205
+ metadata: @config.metadata,
206
+ retry_policy: @config.retry_policy
207
+
208
+ @organizations_stub.get_organization request, options do |result, operation|
209
+ yield result, operation if block_given?
210
+ return result
211
+ end
212
+ rescue ::Gapic::Rest::Error => e
213
+ raise ::Google::Cloud::Error.from_error(e)
214
+ end
215
+
216
+ ##
217
+ # Searches organization resources that are visible to the user and satisfy
218
+ # the specified filter. This method returns organizations in an unspecified
219
+ # order. New organizations do not necessarily appear at the end of the
220
+ # results, and may take a small amount of time to appear.
221
+ #
222
+ # Search will only return organizations on which the user has the permission
223
+ # `resourcemanager.organizations.get`
224
+ #
225
+ # @overload search_organizations(request, options = nil)
226
+ # Pass arguments to `search_organizations` via a request object, either of type
227
+ # {::Google::Cloud::ResourceManager::V3::SearchOrganizationsRequest} or an equivalent Hash.
228
+ #
229
+ # @param request [::Google::Cloud::ResourceManager::V3::SearchOrganizationsRequest, ::Hash]
230
+ # A request object representing the call parameters. Required. To specify no
231
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
232
+ # @param options [::Gapic::CallOptions, ::Hash]
233
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
234
+ #
235
+ # @overload search_organizations(page_size: nil, page_token: nil, query: nil)
236
+ # Pass arguments to `search_organizations` via keyword arguments. Note that at
237
+ # least one keyword argument is required. To specify no parameters, or to keep all
238
+ # the default parameter values, pass an empty Hash as a request object (see above).
239
+ #
240
+ # @param page_size [::Integer]
241
+ # Optional. The maximum number of organizations to return in the response.
242
+ # If unspecified, server picks an appropriate default.
243
+ # @param page_token [::String]
244
+ # Optional. A pagination token returned from a previous call to `SearchOrganizations`
245
+ # that indicates from where listing should continue.
246
+ # @param query [::String]
247
+ # Optional. An optional query string used to filter the Organizations to return in
248
+ # the response. Query rules are case-insensitive.
249
+ #
250
+ # ```
251
+ # | Field | Description |
252
+ # |------------------|--------------------------------------------|
253
+ # | directoryCustomerId, owner.directoryCustomerId | Filters by directory
254
+ # customer id. |
255
+ # | domain | Filters by domain. |
256
+ # ```
257
+ #
258
+ # Organizations may be queried by `directoryCustomerId` or by
259
+ # `domain`, where the domain is a G Suite domain, for example:
260
+ #
261
+ # * Query `directorycustomerid:123456789` returns Organization
262
+ # resources with `owner.directory_customer_id` equal to `123456789`.
263
+ # * Query `domain:google.com` returns Organization resources corresponding
264
+ # to the domain `google.com`.
265
+ # @yield [result, operation] Access the result along with the TransportOperation object
266
+ # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::ResourceManager::V3::Organization>]
267
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
268
+ #
269
+ # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::ResourceManager::V3::Organization>]
270
+ #
271
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
272
+ def search_organizations request, options = nil
273
+ raise ::ArgumentError, "request must be provided" if request.nil?
274
+
275
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::ResourceManager::V3::SearchOrganizationsRequest
276
+
277
+ # Converts hash and nil to an options object
278
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
279
+
280
+ # Customize the options with defaults
281
+ call_metadata = @config.rpcs.search_organizations.metadata.to_h
282
+
283
+ # Set x-goog-api-client and x-goog-user-project headers
284
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
285
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
286
+ gapic_version: ::Google::Cloud::ResourceManager::V3::VERSION,
287
+ transports_version_send: [:rest]
288
+
289
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
290
+
291
+ options.apply_defaults timeout: @config.rpcs.search_organizations.timeout,
292
+ metadata: call_metadata,
293
+ retry_policy: @config.rpcs.search_organizations.retry_policy
294
+
295
+ options.apply_defaults timeout: @config.timeout,
296
+ metadata: @config.metadata,
297
+ retry_policy: @config.retry_policy
298
+
299
+ @organizations_stub.search_organizations request, options do |result, operation|
300
+ result = ::Gapic::Rest::PagedEnumerable.new @organizations_stub, :search_organizations, "organizations", request, result, options
301
+ yield result, operation if block_given?
302
+ return result
303
+ end
304
+ rescue ::Gapic::Rest::Error => e
305
+ raise ::Google::Cloud::Error.from_error(e)
306
+ end
307
+
308
+ ##
309
+ # Gets the access control policy for an organization resource. The policy may
310
+ # be empty if no such policy or resource exists. The `resource` field should
311
+ # be the organization's resource name, for example: "organizations/123".
312
+ #
313
+ # Authorization requires the IAM permission
314
+ # `resourcemanager.organizations.getIamPolicy` on the specified organization.
315
+ #
316
+ # @overload get_iam_policy(request, options = nil)
317
+ # Pass arguments to `get_iam_policy` via a request object, either of type
318
+ # {::Google::Iam::V1::GetIamPolicyRequest} or an equivalent Hash.
319
+ #
320
+ # @param request [::Google::Iam::V1::GetIamPolicyRequest, ::Hash]
321
+ # A request object representing the call parameters. Required. To specify no
322
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
323
+ # @param options [::Gapic::CallOptions, ::Hash]
324
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
325
+ #
326
+ # @overload get_iam_policy(resource: nil, options: nil)
327
+ # Pass arguments to `get_iam_policy` via keyword arguments. Note that at
328
+ # least one keyword argument is required. To specify no parameters, or to keep all
329
+ # the default parameter values, pass an empty Hash as a request object (see above).
330
+ #
331
+ # @param resource [::String]
332
+ # REQUIRED: The resource for which the policy is being requested.
333
+ # See the operation documentation for the appropriate value for this field.
334
+ # @param options [::Google::Iam::V1::GetPolicyOptions, ::Hash]
335
+ # OPTIONAL: A `GetPolicyOptions` object for specifying options to
336
+ # `GetIamPolicy`.
337
+ # @yield [result, operation] Access the result along with the TransportOperation object
338
+ # @yieldparam result [::Google::Iam::V1::Policy]
339
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
340
+ #
341
+ # @return [::Google::Iam::V1::Policy]
342
+ #
343
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
344
+ def get_iam_policy request, options = nil
345
+ raise ::ArgumentError, "request must be provided" if request.nil?
346
+
347
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Iam::V1::GetIamPolicyRequest
348
+
349
+ # Converts hash and nil to an options object
350
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
351
+
352
+ # Customize the options with defaults
353
+ call_metadata = @config.rpcs.get_iam_policy.metadata.to_h
354
+
355
+ # Set x-goog-api-client and x-goog-user-project headers
356
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
357
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
358
+ gapic_version: ::Google::Cloud::ResourceManager::V3::VERSION,
359
+ transports_version_send: [:rest]
360
+
361
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
362
+
363
+ options.apply_defaults timeout: @config.rpcs.get_iam_policy.timeout,
364
+ metadata: call_metadata,
365
+ retry_policy: @config.rpcs.get_iam_policy.retry_policy
366
+
367
+ options.apply_defaults timeout: @config.timeout,
368
+ metadata: @config.metadata,
369
+ retry_policy: @config.retry_policy
370
+
371
+ @organizations_stub.get_iam_policy request, options do |result, operation|
372
+ yield result, operation if block_given?
373
+ return result
374
+ end
375
+ rescue ::Gapic::Rest::Error => e
376
+ raise ::Google::Cloud::Error.from_error(e)
377
+ end
378
+
379
+ ##
380
+ # Sets the access control policy on an organization resource. Replaces any
381
+ # existing policy. The `resource` field should be the organization's resource
382
+ # name, for example: "organizations/123".
383
+ #
384
+ # Authorization requires the IAM permission
385
+ # `resourcemanager.organizations.setIamPolicy` on the specified organization.
386
+ #
387
+ # @overload set_iam_policy(request, options = nil)
388
+ # Pass arguments to `set_iam_policy` via a request object, either of type
389
+ # {::Google::Iam::V1::SetIamPolicyRequest} or an equivalent Hash.
390
+ #
391
+ # @param request [::Google::Iam::V1::SetIamPolicyRequest, ::Hash]
392
+ # A request object representing the call parameters. Required. To specify no
393
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
394
+ # @param options [::Gapic::CallOptions, ::Hash]
395
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
396
+ #
397
+ # @overload set_iam_policy(resource: nil, policy: nil, update_mask: nil)
398
+ # Pass arguments to `set_iam_policy` via keyword arguments. Note that at
399
+ # least one keyword argument is required. To specify no parameters, or to keep all
400
+ # the default parameter values, pass an empty Hash as a request object (see above).
401
+ #
402
+ # @param resource [::String]
403
+ # REQUIRED: The resource for which the policy is being specified.
404
+ # See the operation documentation for the appropriate value for this field.
405
+ # @param policy [::Google::Iam::V1::Policy, ::Hash]
406
+ # REQUIRED: The complete policy to be applied to the `resource`. The size of
407
+ # the policy is limited to a few 10s of KB. An empty policy is a
408
+ # valid policy but certain Cloud Platform services (such as Projects)
409
+ # might reject them.
410
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
411
+ # OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only
412
+ # the fields in the mask will be modified. If no mask is provided, the
413
+ # following default mask is used:
414
+ #
415
+ # `paths: "bindings, etag"`
416
+ # @yield [result, operation] Access the result along with the TransportOperation object
417
+ # @yieldparam result [::Google::Iam::V1::Policy]
418
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
419
+ #
420
+ # @return [::Google::Iam::V1::Policy]
421
+ #
422
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
423
+ def set_iam_policy request, options = nil
424
+ raise ::ArgumentError, "request must be provided" if request.nil?
425
+
426
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Iam::V1::SetIamPolicyRequest
427
+
428
+ # Converts hash and nil to an options object
429
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
430
+
431
+ # Customize the options with defaults
432
+ call_metadata = @config.rpcs.set_iam_policy.metadata.to_h
433
+
434
+ # Set x-goog-api-client and x-goog-user-project headers
435
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
436
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
437
+ gapic_version: ::Google::Cloud::ResourceManager::V3::VERSION,
438
+ transports_version_send: [:rest]
439
+
440
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
441
+
442
+ options.apply_defaults timeout: @config.rpcs.set_iam_policy.timeout,
443
+ metadata: call_metadata,
444
+ retry_policy: @config.rpcs.set_iam_policy.retry_policy
445
+
446
+ options.apply_defaults timeout: @config.timeout,
447
+ metadata: @config.metadata,
448
+ retry_policy: @config.retry_policy
449
+
450
+ @organizations_stub.set_iam_policy request, options do |result, operation|
451
+ yield result, operation if block_given?
452
+ return result
453
+ end
454
+ rescue ::Gapic::Rest::Error => e
455
+ raise ::Google::Cloud::Error.from_error(e)
456
+ end
457
+
458
+ ##
459
+ # Returns the permissions that a caller has on the specified organization.
460
+ # The `resource` field should be the organization's resource name,
461
+ # for example: "organizations/123".
462
+ #
463
+ # There are no permissions required for making this API call.
464
+ #
465
+ # @overload test_iam_permissions(request, options = nil)
466
+ # Pass arguments to `test_iam_permissions` via a request object, either of type
467
+ # {::Google::Iam::V1::TestIamPermissionsRequest} or an equivalent Hash.
468
+ #
469
+ # @param request [::Google::Iam::V1::TestIamPermissionsRequest, ::Hash]
470
+ # A request object representing the call parameters. Required. To specify no
471
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
472
+ # @param options [::Gapic::CallOptions, ::Hash]
473
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
474
+ #
475
+ # @overload test_iam_permissions(resource: nil, permissions: nil)
476
+ # Pass arguments to `test_iam_permissions` via keyword arguments. Note that at
477
+ # least one keyword argument is required. To specify no parameters, or to keep all
478
+ # the default parameter values, pass an empty Hash as a request object (see above).
479
+ #
480
+ # @param resource [::String]
481
+ # REQUIRED: The resource for which the policy detail is being requested.
482
+ # See the operation documentation for the appropriate value for this field.
483
+ # @param permissions [::Array<::String>]
484
+ # The set of permissions to check for the `resource`. Permissions with
485
+ # wildcards (such as '*' or 'storage.*') are not allowed. For more
486
+ # information see
487
+ # [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions).
488
+ # @yield [result, operation] Access the result along with the TransportOperation object
489
+ # @yieldparam result [::Google::Iam::V1::TestIamPermissionsResponse]
490
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
491
+ #
492
+ # @return [::Google::Iam::V1::TestIamPermissionsResponse]
493
+ #
494
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
495
+ def test_iam_permissions request, options = nil
496
+ raise ::ArgumentError, "request must be provided" if request.nil?
497
+
498
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Iam::V1::TestIamPermissionsRequest
499
+
500
+ # Converts hash and nil to an options object
501
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
502
+
503
+ # Customize the options with defaults
504
+ call_metadata = @config.rpcs.test_iam_permissions.metadata.to_h
505
+
506
+ # Set x-goog-api-client and x-goog-user-project headers
507
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
508
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
509
+ gapic_version: ::Google::Cloud::ResourceManager::V3::VERSION,
510
+ transports_version_send: [:rest]
511
+
512
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
513
+
514
+ options.apply_defaults timeout: @config.rpcs.test_iam_permissions.timeout,
515
+ metadata: call_metadata,
516
+ retry_policy: @config.rpcs.test_iam_permissions.retry_policy
517
+
518
+ options.apply_defaults timeout: @config.timeout,
519
+ metadata: @config.metadata,
520
+ retry_policy: @config.retry_policy
521
+
522
+ @organizations_stub.test_iam_permissions request, options do |result, operation|
523
+ yield result, operation if block_given?
524
+ return result
525
+ end
526
+ rescue ::Gapic::Rest::Error => e
527
+ raise ::Google::Cloud::Error.from_error(e)
528
+ end
529
+
530
+ ##
531
+ # Configuration class for the Organizations REST API.
532
+ #
533
+ # This class represents the configuration for Organizations REST,
534
+ # providing control over timeouts, retry behavior, logging, transport
535
+ # parameters, and other low-level controls. Certain parameters can also be
536
+ # applied individually to specific RPCs. See
537
+ # {::Google::Cloud::ResourceManager::V3::Organizations::Rest::Client::Configuration::Rpcs}
538
+ # for a list of RPCs that can be configured independently.
539
+ #
540
+ # Configuration can be applied globally to all clients, or to a single client
541
+ # on construction.
542
+ #
543
+ # @example
544
+ #
545
+ # # Modify the global config, setting the timeout for
546
+ # # get_organization to 20 seconds,
547
+ # # and all remaining timeouts to 10 seconds.
548
+ # ::Google::Cloud::ResourceManager::V3::Organizations::Rest::Client.configure do |config|
549
+ # config.timeout = 10.0
550
+ # config.rpcs.get_organization.timeout = 20.0
551
+ # end
552
+ #
553
+ # # Apply the above configuration only to a new client.
554
+ # client = ::Google::Cloud::ResourceManager::V3::Organizations::Rest::Client.new do |config|
555
+ # config.timeout = 10.0
556
+ # config.rpcs.get_organization.timeout = 20.0
557
+ # end
558
+ #
559
+ # @!attribute [rw] endpoint
560
+ # The hostname or hostname:port of the service endpoint.
561
+ # Defaults to `"cloudresourcemanager.googleapis.com"`.
562
+ # @return [::String]
563
+ # @!attribute [rw] credentials
564
+ # Credentials to send with calls. You may provide any of the following types:
565
+ # * (`String`) The path to a service account key file in JSON format
566
+ # * (`Hash`) A service account key as a Hash
567
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
568
+ # (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
569
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
570
+ # (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
571
+ # * (`nil`) indicating no credentials
572
+ # @return [::Object]
573
+ # @!attribute [rw] scope
574
+ # The OAuth scopes
575
+ # @return [::Array<::String>]
576
+ # @!attribute [rw] lib_name
577
+ # The library name as recorded in instrumentation and logging
578
+ # @return [::String]
579
+ # @!attribute [rw] lib_version
580
+ # The library version as recorded in instrumentation and logging
581
+ # @return [::String]
582
+ # @!attribute [rw] timeout
583
+ # The call timeout in seconds.
584
+ # @return [::Numeric]
585
+ # @!attribute [rw] metadata
586
+ # Additional headers to be sent with the call.
587
+ # @return [::Hash{::Symbol=>::String}]
588
+ # @!attribute [rw] retry_policy
589
+ # The retry policy. The value is a hash with the following keys:
590
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
591
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
592
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
593
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
594
+ # trigger a retry.
595
+ # @return [::Hash]
596
+ # @!attribute [rw] quota_project
597
+ # A separate project against which to charge quota.
598
+ # @return [::String]
599
+ #
600
+ class Configuration
601
+ extend ::Gapic::Config
602
+
603
+ config_attr :endpoint, "cloudresourcemanager.googleapis.com", ::String
604
+ config_attr :credentials, nil do |value|
605
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
606
+ allowed.any? { |klass| klass === value }
607
+ end
608
+ config_attr :scope, nil, ::String, ::Array, nil
609
+ config_attr :lib_name, nil, ::String, nil
610
+ config_attr :lib_version, nil, ::String, nil
611
+ config_attr :timeout, nil, ::Numeric, nil
612
+ config_attr :metadata, nil, ::Hash, nil
613
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
614
+ config_attr :quota_project, nil, ::String, nil
615
+
616
+ # @private
617
+ def initialize parent_config = nil
618
+ @parent_config = parent_config unless parent_config.nil?
619
+
620
+ yield self if block_given?
621
+ end
622
+
623
+ ##
624
+ # Configurations for individual RPCs
625
+ # @return [Rpcs]
626
+ #
627
+ def rpcs
628
+ @rpcs ||= begin
629
+ parent_rpcs = nil
630
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
631
+ Rpcs.new parent_rpcs
632
+ end
633
+ end
634
+
635
+ ##
636
+ # Configuration RPC class for the Organizations API.
637
+ #
638
+ # Includes fields providing the configuration for each RPC in this service.
639
+ # Each configuration object is of type `Gapic::Config::Method` and includes
640
+ # the following configuration fields:
641
+ #
642
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
643
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
644
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
645
+ # include the following keys:
646
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
647
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
648
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
649
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
650
+ # trigger a retry.
651
+ #
652
+ class Rpcs
653
+ ##
654
+ # RPC-specific configuration for `get_organization`
655
+ # @return [::Gapic::Config::Method]
656
+ #
657
+ attr_reader :get_organization
658
+ ##
659
+ # RPC-specific configuration for `search_organizations`
660
+ # @return [::Gapic::Config::Method]
661
+ #
662
+ attr_reader :search_organizations
663
+ ##
664
+ # RPC-specific configuration for `get_iam_policy`
665
+ # @return [::Gapic::Config::Method]
666
+ #
667
+ attr_reader :get_iam_policy
668
+ ##
669
+ # RPC-specific configuration for `set_iam_policy`
670
+ # @return [::Gapic::Config::Method]
671
+ #
672
+ attr_reader :set_iam_policy
673
+ ##
674
+ # RPC-specific configuration for `test_iam_permissions`
675
+ # @return [::Gapic::Config::Method]
676
+ #
677
+ attr_reader :test_iam_permissions
678
+
679
+ # @private
680
+ def initialize parent_rpcs = nil
681
+ get_organization_config = parent_rpcs.get_organization if parent_rpcs.respond_to? :get_organization
682
+ @get_organization = ::Gapic::Config::Method.new get_organization_config
683
+ search_organizations_config = parent_rpcs.search_organizations if parent_rpcs.respond_to? :search_organizations
684
+ @search_organizations = ::Gapic::Config::Method.new search_organizations_config
685
+ get_iam_policy_config = parent_rpcs.get_iam_policy if parent_rpcs.respond_to? :get_iam_policy
686
+ @get_iam_policy = ::Gapic::Config::Method.new get_iam_policy_config
687
+ set_iam_policy_config = parent_rpcs.set_iam_policy if parent_rpcs.respond_to? :set_iam_policy
688
+ @set_iam_policy = ::Gapic::Config::Method.new set_iam_policy_config
689
+ test_iam_permissions_config = parent_rpcs.test_iam_permissions if parent_rpcs.respond_to? :test_iam_permissions
690
+ @test_iam_permissions = ::Gapic::Config::Method.new test_iam_permissions_config
691
+
692
+ yield self if block_given?
693
+ end
694
+ end
695
+ end
696
+ end
697
+ end
698
+ end
699
+ end
700
+ end
701
+ end
702
+ end