google-cloud-resource_manager-v3 0.3.0 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (79) hide show
  1. checksums.yaml +4 -4
  2. data/AUTHENTICATION.md +1 -1
  3. data/README.md +3 -3
  4. data/lib/google/cloud/resource_manager/v3/folders/client.rb +75 -67
  5. data/lib/google/cloud/resource_manager/v3/folders/operations.rb +14 -16
  6. data/lib/google/cloud/resource_manager/v3/folders/rest/client.rb +1281 -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 +16 -16
  12. data/lib/google/cloud/resource_manager/v3/organizations/rest/client.rb +704 -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 +72 -71
  17. data/lib/google/cloud/resource_manager/v3/projects/operations.rb +14 -16
  18. data/lib/google/cloud/resource_manager/v3/projects/rest/client.rb +1304 -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 +43 -0
  24. data/lib/google/cloud/resource_manager/v3/tag_bindings/client.rb +127 -31
  25. data/lib/google/cloud/resource_manager/v3/tag_bindings/operations.rb +14 -16
  26. data/lib/google/cloud/resource_manager/v3/tag_bindings/rest/client.rb +606 -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 +279 -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 +8 -2
  31. data/lib/google/cloud/resource_manager/v3/tag_holds/client.rb +640 -0
  32. data/lib/google/cloud/resource_manager/v3/tag_holds/credentials.rb +52 -0
  33. data/lib/google/cloud/resource_manager/v3/tag_holds/operations.rb +768 -0
  34. data/lib/google/cloud/resource_manager/v3/tag_holds/paths.rb +64 -0
  35. data/lib/google/cloud/resource_manager/v3/tag_holds/rest/client.rb +533 -0
  36. data/lib/google/cloud/resource_manager/v3/tag_holds/rest/operations.rb +793 -0
  37. data/lib/google/cloud/resource_manager/v3/tag_holds/rest/service_stub.rb +226 -0
  38. data/lib/google/cloud/resource_manager/v3/tag_holds/rest.rb +57 -0
  39. data/lib/google/cloud/resource_manager/v3/tag_holds.rb +60 -0
  40. data/lib/google/cloud/resource_manager/v3/tag_keys/client.rb +127 -40
  41. data/lib/google/cloud/resource_manager/v3/tag_keys/operations.rb +14 -16
  42. data/lib/google/cloud/resource_manager/v3/tag_keys/rest/client.rb +1012 -0
  43. data/lib/google/cloud/resource_manager/v3/tag_keys/rest/operations.rb +793 -0
  44. data/lib/google/cloud/resource_manager/v3/tag_keys/rest/service_stub.rb +578 -0
  45. data/lib/google/cloud/resource_manager/v3/tag_keys/rest.rb +53 -0
  46. data/lib/google/cloud/resource_manager/v3/tag_keys.rb +7 -1
  47. data/lib/google/cloud/resource_manager/v3/tag_values/client.rb +139 -47
  48. data/lib/google/cloud/resource_manager/v3/tag_values/operations.rb +14 -16
  49. data/lib/google/cloud/resource_manager/v3/tag_values/rest/client.rb +1013 -0
  50. data/lib/google/cloud/resource_manager/v3/tag_values/rest/operations.rb +793 -0
  51. data/lib/google/cloud/resource_manager/v3/tag_values/rest/service_stub.rb +578 -0
  52. data/lib/google/cloud/resource_manager/v3/tag_values/rest.rb +53 -0
  53. data/lib/google/cloud/resource_manager/v3/tag_values.rb +7 -1
  54. data/lib/google/cloud/resource_manager/v3/version.rb +1 -1
  55. data/lib/google/cloud/resource_manager/v3.rb +8 -2
  56. data/lib/google/cloud/resourcemanager/v3/folders_services_pb.rb +23 -17
  57. data/lib/google/cloud/resourcemanager/v3/organizations_pb.rb +0 -1
  58. data/lib/google/cloud/resourcemanager/v3/projects_services_pb.rb +16 -13
  59. data/lib/google/cloud/resourcemanager/v3/tag_bindings_pb.rb +22 -0
  60. data/lib/google/cloud/resourcemanager/v3/tag_bindings_services_pb.rb +7 -5
  61. data/lib/google/cloud/resourcemanager/v3/tag_holds_pb.rb +63 -0
  62. data/lib/google/cloud/resourcemanager/v3/tag_holds_services_pb.rb +54 -0
  63. data/lib/google/cloud/resourcemanager/v3/tag_keys_pb.rb +11 -0
  64. data/lib/google/cloud/resourcemanager/v3/tag_keys_services_pb.rb +6 -2
  65. data/lib/google/cloud/resourcemanager/v3/tag_values_pb.rb +4 -0
  66. data/lib/google/cloud/resourcemanager/v3/tag_values_services_pb.rb +7 -4
  67. data/proto_docs/google/api/client.rb +372 -0
  68. data/proto_docs/google/api/launch_stage.rb +71 -0
  69. data/proto_docs/google/cloud/resourcemanager/v3/folders.rb +25 -19
  70. data/proto_docs/google/cloud/resourcemanager/v3/organizations.rb +13 -11
  71. data/proto_docs/google/cloud/resourcemanager/v3/projects.rb +32 -30
  72. data/proto_docs/google/cloud/resourcemanager/v3/tag_bindings.rb +101 -15
  73. data/proto_docs/google/cloud/resourcemanager/v3/tag_holds.rb +161 -0
  74. data/proto_docs/google/cloud/resourcemanager/v3/tag_keys.rb +81 -23
  75. data/proto_docs/google/cloud/resourcemanager/v3/tag_values.rb +52 -29
  76. data/proto_docs/google/iam/v1/policy.rb +8 -4
  77. data/proto_docs/google/protobuf/empty.rb +0 -2
  78. data/proto_docs/google/rpc/status.rb +4 -2
  79. metadata +46 -8
@@ -0,0 +1,704 @@
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
172
+ # organization's relative path in the API, formatted as
173
+ # "organizations/[organizationId]". 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
+ # The server can return fewer organizations than requested. If unspecified,
243
+ # server picks an appropriate default.
244
+ # @param page_token [::String]
245
+ # Optional. A pagination token returned from a previous call to
246
+ # `SearchOrganizations` that indicates from where listing should continue.
247
+ # @param query [::String]
248
+ # Optional. An optional query string used to filter the Organizations to
249
+ # return in the response. Query rules are case-insensitive.
250
+ #
251
+ #
252
+ # ```
253
+ # | Field | Description |
254
+ # |------------------|--------------------------------------------|
255
+ # | directoryCustomerId, owner.directoryCustomerId | Filters by directory
256
+ # customer id. |
257
+ # | domain | Filters by domain. |
258
+ # ```
259
+ #
260
+ # Organizations may be queried by `directoryCustomerId` or by
261
+ # `domain`, where the domain is a G Suite domain, for example:
262
+ #
263
+ # * Query `directorycustomerid:123456789` returns Organization
264
+ # resources with `owner.directory_customer_id` equal to `123456789`.
265
+ # * Query `domain:google.com` returns Organization resources corresponding
266
+ # to the domain `google.com`.
267
+ # @yield [result, operation] Access the result along with the TransportOperation object
268
+ # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::ResourceManager::V3::Organization>]
269
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
270
+ #
271
+ # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::ResourceManager::V3::Organization>]
272
+ #
273
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
274
+ def search_organizations request, options = nil
275
+ raise ::ArgumentError, "request must be provided" if request.nil?
276
+
277
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::ResourceManager::V3::SearchOrganizationsRequest
278
+
279
+ # Converts hash and nil to an options object
280
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
281
+
282
+ # Customize the options with defaults
283
+ call_metadata = @config.rpcs.search_organizations.metadata.to_h
284
+
285
+ # Set x-goog-api-client and x-goog-user-project headers
286
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
287
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
288
+ gapic_version: ::Google::Cloud::ResourceManager::V3::VERSION,
289
+ transports_version_send: [:rest]
290
+
291
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
292
+
293
+ options.apply_defaults timeout: @config.rpcs.search_organizations.timeout,
294
+ metadata: call_metadata,
295
+ retry_policy: @config.rpcs.search_organizations.retry_policy
296
+
297
+ options.apply_defaults timeout: @config.timeout,
298
+ metadata: @config.metadata,
299
+ retry_policy: @config.retry_policy
300
+
301
+ @organizations_stub.search_organizations request, options do |result, operation|
302
+ result = ::Gapic::Rest::PagedEnumerable.new @organizations_stub, :search_organizations, "organizations", request, result, options
303
+ yield result, operation if block_given?
304
+ return result
305
+ end
306
+ rescue ::Gapic::Rest::Error => e
307
+ raise ::Google::Cloud::Error.from_error(e)
308
+ end
309
+
310
+ ##
311
+ # Gets the access control policy for an organization resource. The policy may
312
+ # be empty if no such policy or resource exists. The `resource` field should
313
+ # be the organization's resource name, for example: "organizations/123".
314
+ #
315
+ # Authorization requires the IAM permission
316
+ # `resourcemanager.organizations.getIamPolicy` on the specified organization.
317
+ #
318
+ # @overload get_iam_policy(request, options = nil)
319
+ # Pass arguments to `get_iam_policy` via a request object, either of type
320
+ # {::Google::Iam::V1::GetIamPolicyRequest} or an equivalent Hash.
321
+ #
322
+ # @param request [::Google::Iam::V1::GetIamPolicyRequest, ::Hash]
323
+ # A request object representing the call parameters. Required. To specify no
324
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
325
+ # @param options [::Gapic::CallOptions, ::Hash]
326
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
327
+ #
328
+ # @overload get_iam_policy(resource: nil, options: nil)
329
+ # Pass arguments to `get_iam_policy` via keyword arguments. Note that at
330
+ # least one keyword argument is required. To specify no parameters, or to keep all
331
+ # the default parameter values, pass an empty Hash as a request object (see above).
332
+ #
333
+ # @param resource [::String]
334
+ # REQUIRED: The resource for which the policy is being requested.
335
+ # See the operation documentation for the appropriate value for this field.
336
+ # @param options [::Google::Iam::V1::GetPolicyOptions, ::Hash]
337
+ # OPTIONAL: A `GetPolicyOptions` object for specifying options to
338
+ # `GetIamPolicy`.
339
+ # @yield [result, operation] Access the result along with the TransportOperation object
340
+ # @yieldparam result [::Google::Iam::V1::Policy]
341
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
342
+ #
343
+ # @return [::Google::Iam::V1::Policy]
344
+ #
345
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
346
+ def get_iam_policy request, options = nil
347
+ raise ::ArgumentError, "request must be provided" if request.nil?
348
+
349
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Iam::V1::GetIamPolicyRequest
350
+
351
+ # Converts hash and nil to an options object
352
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
353
+
354
+ # Customize the options with defaults
355
+ call_metadata = @config.rpcs.get_iam_policy.metadata.to_h
356
+
357
+ # Set x-goog-api-client and x-goog-user-project headers
358
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
359
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
360
+ gapic_version: ::Google::Cloud::ResourceManager::V3::VERSION,
361
+ transports_version_send: [:rest]
362
+
363
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
364
+
365
+ options.apply_defaults timeout: @config.rpcs.get_iam_policy.timeout,
366
+ metadata: call_metadata,
367
+ retry_policy: @config.rpcs.get_iam_policy.retry_policy
368
+
369
+ options.apply_defaults timeout: @config.timeout,
370
+ metadata: @config.metadata,
371
+ retry_policy: @config.retry_policy
372
+
373
+ @organizations_stub.get_iam_policy request, options do |result, operation|
374
+ yield result, operation if block_given?
375
+ return result
376
+ end
377
+ rescue ::Gapic::Rest::Error => e
378
+ raise ::Google::Cloud::Error.from_error(e)
379
+ end
380
+
381
+ ##
382
+ # Sets the access control policy on an organization resource. Replaces any
383
+ # existing policy. The `resource` field should be the organization's resource
384
+ # name, for example: "organizations/123".
385
+ #
386
+ # Authorization requires the IAM permission
387
+ # `resourcemanager.organizations.setIamPolicy` on the specified organization.
388
+ #
389
+ # @overload set_iam_policy(request, options = nil)
390
+ # Pass arguments to `set_iam_policy` via a request object, either of type
391
+ # {::Google::Iam::V1::SetIamPolicyRequest} or an equivalent Hash.
392
+ #
393
+ # @param request [::Google::Iam::V1::SetIamPolicyRequest, ::Hash]
394
+ # A request object representing the call parameters. Required. To specify no
395
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
396
+ # @param options [::Gapic::CallOptions, ::Hash]
397
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
398
+ #
399
+ # @overload set_iam_policy(resource: nil, policy: nil, update_mask: nil)
400
+ # Pass arguments to `set_iam_policy` via keyword arguments. Note that at
401
+ # least one keyword argument is required. To specify no parameters, or to keep all
402
+ # the default parameter values, pass an empty Hash as a request object (see above).
403
+ #
404
+ # @param resource [::String]
405
+ # REQUIRED: The resource for which the policy is being specified.
406
+ # See the operation documentation for the appropriate value for this field.
407
+ # @param policy [::Google::Iam::V1::Policy, ::Hash]
408
+ # REQUIRED: The complete policy to be applied to the `resource`. The size of
409
+ # the policy is limited to a few 10s of KB. An empty policy is a
410
+ # valid policy but certain Cloud Platform services (such as Projects)
411
+ # might reject them.
412
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
413
+ # OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only
414
+ # the fields in the mask will be modified. If no mask is provided, the
415
+ # following default mask is used:
416
+ #
417
+ # `paths: "bindings, etag"`
418
+ # @yield [result, operation] Access the result along with the TransportOperation object
419
+ # @yieldparam result [::Google::Iam::V1::Policy]
420
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
421
+ #
422
+ # @return [::Google::Iam::V1::Policy]
423
+ #
424
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
425
+ def set_iam_policy request, options = nil
426
+ raise ::ArgumentError, "request must be provided" if request.nil?
427
+
428
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Iam::V1::SetIamPolicyRequest
429
+
430
+ # Converts hash and nil to an options object
431
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
432
+
433
+ # Customize the options with defaults
434
+ call_metadata = @config.rpcs.set_iam_policy.metadata.to_h
435
+
436
+ # Set x-goog-api-client and x-goog-user-project headers
437
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
438
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
439
+ gapic_version: ::Google::Cloud::ResourceManager::V3::VERSION,
440
+ transports_version_send: [:rest]
441
+
442
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
443
+
444
+ options.apply_defaults timeout: @config.rpcs.set_iam_policy.timeout,
445
+ metadata: call_metadata,
446
+ retry_policy: @config.rpcs.set_iam_policy.retry_policy
447
+
448
+ options.apply_defaults timeout: @config.timeout,
449
+ metadata: @config.metadata,
450
+ retry_policy: @config.retry_policy
451
+
452
+ @organizations_stub.set_iam_policy request, options do |result, operation|
453
+ yield result, operation if block_given?
454
+ return result
455
+ end
456
+ rescue ::Gapic::Rest::Error => e
457
+ raise ::Google::Cloud::Error.from_error(e)
458
+ end
459
+
460
+ ##
461
+ # Returns the permissions that a caller has on the specified organization.
462
+ # The `resource` field should be the organization's resource name,
463
+ # for example: "organizations/123".
464
+ #
465
+ # There are no permissions required for making this API call.
466
+ #
467
+ # @overload test_iam_permissions(request, options = nil)
468
+ # Pass arguments to `test_iam_permissions` via a request object, either of type
469
+ # {::Google::Iam::V1::TestIamPermissionsRequest} or an equivalent Hash.
470
+ #
471
+ # @param request [::Google::Iam::V1::TestIamPermissionsRequest, ::Hash]
472
+ # A request object representing the call parameters. Required. To specify no
473
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
474
+ # @param options [::Gapic::CallOptions, ::Hash]
475
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
476
+ #
477
+ # @overload test_iam_permissions(resource: nil, permissions: nil)
478
+ # Pass arguments to `test_iam_permissions` via keyword arguments. Note that at
479
+ # least one keyword argument is required. To specify no parameters, or to keep all
480
+ # the default parameter values, pass an empty Hash as a request object (see above).
481
+ #
482
+ # @param resource [::String]
483
+ # REQUIRED: The resource for which the policy detail is being requested.
484
+ # See the operation documentation for the appropriate value for this field.
485
+ # @param permissions [::Array<::String>]
486
+ # The set of permissions to check for the `resource`. Permissions with
487
+ # wildcards (such as '*' or 'storage.*') are not allowed. For more
488
+ # information see
489
+ # [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions).
490
+ # @yield [result, operation] Access the result along with the TransportOperation object
491
+ # @yieldparam result [::Google::Iam::V1::TestIamPermissionsResponse]
492
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
493
+ #
494
+ # @return [::Google::Iam::V1::TestIamPermissionsResponse]
495
+ #
496
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
497
+ def test_iam_permissions request, options = nil
498
+ raise ::ArgumentError, "request must be provided" if request.nil?
499
+
500
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Iam::V1::TestIamPermissionsRequest
501
+
502
+ # Converts hash and nil to an options object
503
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
504
+
505
+ # Customize the options with defaults
506
+ call_metadata = @config.rpcs.test_iam_permissions.metadata.to_h
507
+
508
+ # Set x-goog-api-client and x-goog-user-project headers
509
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
510
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
511
+ gapic_version: ::Google::Cloud::ResourceManager::V3::VERSION,
512
+ transports_version_send: [:rest]
513
+
514
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
515
+
516
+ options.apply_defaults timeout: @config.rpcs.test_iam_permissions.timeout,
517
+ metadata: call_metadata,
518
+ retry_policy: @config.rpcs.test_iam_permissions.retry_policy
519
+
520
+ options.apply_defaults timeout: @config.timeout,
521
+ metadata: @config.metadata,
522
+ retry_policy: @config.retry_policy
523
+
524
+ @organizations_stub.test_iam_permissions request, options do |result, operation|
525
+ yield result, operation if block_given?
526
+ return result
527
+ end
528
+ rescue ::Gapic::Rest::Error => e
529
+ raise ::Google::Cloud::Error.from_error(e)
530
+ end
531
+
532
+ ##
533
+ # Configuration class for the Organizations REST API.
534
+ #
535
+ # This class represents the configuration for Organizations REST,
536
+ # providing control over timeouts, retry behavior, logging, transport
537
+ # parameters, and other low-level controls. Certain parameters can also be
538
+ # applied individually to specific RPCs. See
539
+ # {::Google::Cloud::ResourceManager::V3::Organizations::Rest::Client::Configuration::Rpcs}
540
+ # for a list of RPCs that can be configured independently.
541
+ #
542
+ # Configuration can be applied globally to all clients, or to a single client
543
+ # on construction.
544
+ #
545
+ # @example
546
+ #
547
+ # # Modify the global config, setting the timeout for
548
+ # # get_organization to 20 seconds,
549
+ # # and all remaining timeouts to 10 seconds.
550
+ # ::Google::Cloud::ResourceManager::V3::Organizations::Rest::Client.configure do |config|
551
+ # config.timeout = 10.0
552
+ # config.rpcs.get_organization.timeout = 20.0
553
+ # end
554
+ #
555
+ # # Apply the above configuration only to a new client.
556
+ # client = ::Google::Cloud::ResourceManager::V3::Organizations::Rest::Client.new do |config|
557
+ # config.timeout = 10.0
558
+ # config.rpcs.get_organization.timeout = 20.0
559
+ # end
560
+ #
561
+ # @!attribute [rw] endpoint
562
+ # The hostname or hostname:port of the service endpoint.
563
+ # Defaults to `"cloudresourcemanager.googleapis.com"`.
564
+ # @return [::String]
565
+ # @!attribute [rw] credentials
566
+ # Credentials to send with calls. You may provide any of the following types:
567
+ # * (`String`) The path to a service account key file in JSON format
568
+ # * (`Hash`) A service account key as a Hash
569
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
570
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
571
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
572
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
573
+ # * (`nil`) indicating no credentials
574
+ # @return [::Object]
575
+ # @!attribute [rw] scope
576
+ # The OAuth scopes
577
+ # @return [::Array<::String>]
578
+ # @!attribute [rw] lib_name
579
+ # The library name as recorded in instrumentation and logging
580
+ # @return [::String]
581
+ # @!attribute [rw] lib_version
582
+ # The library version as recorded in instrumentation and logging
583
+ # @return [::String]
584
+ # @!attribute [rw] timeout
585
+ # The call timeout in seconds.
586
+ # @return [::Numeric]
587
+ # @!attribute [rw] metadata
588
+ # Additional headers to be sent with the call.
589
+ # @return [::Hash{::Symbol=>::String}]
590
+ # @!attribute [rw] retry_policy
591
+ # The retry policy. The value is a hash with the following keys:
592
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
593
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
594
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
595
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
596
+ # trigger a retry.
597
+ # @return [::Hash]
598
+ # @!attribute [rw] quota_project
599
+ # A separate project against which to charge quota.
600
+ # @return [::String]
601
+ #
602
+ class Configuration
603
+ extend ::Gapic::Config
604
+
605
+ config_attr :endpoint, "cloudresourcemanager.googleapis.com", ::String
606
+ config_attr :credentials, nil do |value|
607
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
608
+ allowed.any? { |klass| klass === value }
609
+ end
610
+ config_attr :scope, nil, ::String, ::Array, nil
611
+ config_attr :lib_name, nil, ::String, nil
612
+ config_attr :lib_version, nil, ::String, nil
613
+ config_attr :timeout, nil, ::Numeric, nil
614
+ config_attr :metadata, nil, ::Hash, nil
615
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
616
+ config_attr :quota_project, nil, ::String, nil
617
+
618
+ # @private
619
+ def initialize parent_config = nil
620
+ @parent_config = parent_config unless parent_config.nil?
621
+
622
+ yield self if block_given?
623
+ end
624
+
625
+ ##
626
+ # Configurations for individual RPCs
627
+ # @return [Rpcs]
628
+ #
629
+ def rpcs
630
+ @rpcs ||= begin
631
+ parent_rpcs = nil
632
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
633
+ Rpcs.new parent_rpcs
634
+ end
635
+ end
636
+
637
+ ##
638
+ # Configuration RPC class for the Organizations API.
639
+ #
640
+ # Includes fields providing the configuration for each RPC in this service.
641
+ # Each configuration object is of type `Gapic::Config::Method` and includes
642
+ # the following configuration fields:
643
+ #
644
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
645
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
646
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
647
+ # include the following keys:
648
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
649
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
650
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
651
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
652
+ # trigger a retry.
653
+ #
654
+ class Rpcs
655
+ ##
656
+ # RPC-specific configuration for `get_organization`
657
+ # @return [::Gapic::Config::Method]
658
+ #
659
+ attr_reader :get_organization
660
+ ##
661
+ # RPC-specific configuration for `search_organizations`
662
+ # @return [::Gapic::Config::Method]
663
+ #
664
+ attr_reader :search_organizations
665
+ ##
666
+ # RPC-specific configuration for `get_iam_policy`
667
+ # @return [::Gapic::Config::Method]
668
+ #
669
+ attr_reader :get_iam_policy
670
+ ##
671
+ # RPC-specific configuration for `set_iam_policy`
672
+ # @return [::Gapic::Config::Method]
673
+ #
674
+ attr_reader :set_iam_policy
675
+ ##
676
+ # RPC-specific configuration for `test_iam_permissions`
677
+ # @return [::Gapic::Config::Method]
678
+ #
679
+ attr_reader :test_iam_permissions
680
+
681
+ # @private
682
+ def initialize parent_rpcs = nil
683
+ get_organization_config = parent_rpcs.get_organization if parent_rpcs.respond_to? :get_organization
684
+ @get_organization = ::Gapic::Config::Method.new get_organization_config
685
+ search_organizations_config = parent_rpcs.search_organizations if parent_rpcs.respond_to? :search_organizations
686
+ @search_organizations = ::Gapic::Config::Method.new search_organizations_config
687
+ get_iam_policy_config = parent_rpcs.get_iam_policy if parent_rpcs.respond_to? :get_iam_policy
688
+ @get_iam_policy = ::Gapic::Config::Method.new get_iam_policy_config
689
+ set_iam_policy_config = parent_rpcs.set_iam_policy if parent_rpcs.respond_to? :set_iam_policy
690
+ @set_iam_policy = ::Gapic::Config::Method.new set_iam_policy_config
691
+ test_iam_permissions_config = parent_rpcs.test_iam_permissions if parent_rpcs.respond_to? :test_iam_permissions
692
+ @test_iam_permissions = ::Gapic::Config::Method.new test_iam_permissions_config
693
+
694
+ yield self if block_given?
695
+ end
696
+ end
697
+ end
698
+ end
699
+ end
700
+ end
701
+ end
702
+ end
703
+ end
704
+ end