google-cloud-resource_manager-v3 0.1.0

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