google-cloud-resource_manager-v3 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. checksums.yaml +4 -4
  2. data/AUTHENTICATION.md +1 -1
  3. data/README.md +2 -2
  4. data/lib/google/cloud/resource_manager/v3/folders/client.rb +28 -32
  5. data/lib/google/cloud/resource_manager/v3/folders/operations.rb +12 -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 +12 -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 +12 -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 +12 -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 +12 -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/organizations_pb.rb +0 -1
  48. data/proto_docs/google/api/client.rb +318 -0
  49. data/proto_docs/google/api/launch_stage.rb +71 -0
  50. data/proto_docs/google/protobuf/empty.rb +0 -2
  51. data/proto_docs/google/rpc/status.rb +4 -2
  52. metadata +34 -8
@@ -0,0 +1,1269 @@
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/folders_pb"
21
+ require "google/cloud/resource_manager/v3/folders/rest/service_stub"
22
+
23
+ module Google
24
+ module Cloud
25
+ module ResourceManager
26
+ module V3
27
+ module Folders
28
+ module Rest
29
+ ##
30
+ # REST client for the Folders service.
31
+ #
32
+ # Manages Cloud Platform folder resources.
33
+ # Folders can be used to organize the resources under an
34
+ # organization and to control the policies applied to groups of resources.
35
+ #
36
+ class Client
37
+ include Paths
38
+
39
+ # @private
40
+ attr_reader :folders_stub
41
+
42
+ ##
43
+ # Configure the Folders Client class.
44
+ #
45
+ # See {::Google::Cloud::ResourceManager::V3::Folders::Rest::Client::Configuration}
46
+ # for a description of the configuration fields.
47
+ #
48
+ # @example
49
+ #
50
+ # # Modify the configuration for all Folders clients
51
+ # ::Google::Cloud::ResourceManager::V3::Folders::Rest::Client.configure do |config|
52
+ # config.timeout = 10.0
53
+ # end
54
+ #
55
+ # @yield [config] Configure the Client client.
56
+ # @yieldparam config [Client::Configuration]
57
+ #
58
+ # @return [Client::Configuration]
59
+ #
60
+ def self.configure
61
+ @configure ||= begin
62
+ namespace = ["Google", "Cloud", "ResourceManager", "V3"]
63
+ parent_config = while namespace.any?
64
+ parent_name = namespace.join "::"
65
+ parent_const = const_get parent_name
66
+ break parent_const.configure if parent_const.respond_to? :configure
67
+ namespace.pop
68
+ end
69
+ default_config = Client::Configuration.new parent_config
70
+
71
+ default_config.rpcs.get_folder.timeout = 60.0
72
+ default_config.rpcs.get_folder.retry_policy = {
73
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14]
74
+ }
75
+
76
+ default_config.rpcs.list_folders.timeout = 60.0
77
+ default_config.rpcs.list_folders.retry_policy = {
78
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14]
79
+ }
80
+
81
+ default_config.rpcs.search_folders.timeout = 60.0
82
+
83
+ default_config.rpcs.create_folder.timeout = 60.0
84
+
85
+ default_config.rpcs.update_folder.timeout = 60.0
86
+
87
+ default_config.rpcs.move_folder.timeout = 60.0
88
+
89
+ default_config.rpcs.delete_folder.timeout = 60.0
90
+
91
+ default_config.rpcs.undelete_folder.timeout = 60.0
92
+
93
+ default_config.rpcs.get_iam_policy.timeout = 60.0
94
+ default_config.rpcs.get_iam_policy.retry_policy = {
95
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14]
96
+ }
97
+
98
+ default_config.rpcs.set_iam_policy.timeout = 60.0
99
+
100
+ default_config
101
+ end
102
+ yield @configure if block_given?
103
+ @configure
104
+ end
105
+
106
+ ##
107
+ # Configure the Folders Client instance.
108
+ #
109
+ # The configuration is set to the derived mode, meaning that values can be changed,
110
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
111
+ # should be made on {Client.configure}.
112
+ #
113
+ # See {::Google::Cloud::ResourceManager::V3::Folders::Rest::Client::Configuration}
114
+ # for a description of the configuration fields.
115
+ #
116
+ # @yield [config] Configure the Client client.
117
+ # @yieldparam config [Client::Configuration]
118
+ #
119
+ # @return [Client::Configuration]
120
+ #
121
+ def configure
122
+ yield @config if block_given?
123
+ @config
124
+ end
125
+
126
+ ##
127
+ # Create a new Folders REST client object.
128
+ #
129
+ # @example
130
+ #
131
+ # # Create a client using the default configuration
132
+ # client = ::Google::Cloud::ResourceManager::V3::Folders::Rest::Client.new
133
+ #
134
+ # # Create a client using a custom configuration
135
+ # client = ::Google::Cloud::ResourceManager::V3::Folders::Rest::Client.new do |config|
136
+ # config.timeout = 10.0
137
+ # end
138
+ #
139
+ # @yield [config] Configure the Folders client.
140
+ # @yieldparam config [Client::Configuration]
141
+ #
142
+ def initialize
143
+ # Create the configuration object
144
+ @config = Configuration.new Client.configure
145
+
146
+ # Yield the configuration if needed
147
+ yield @config if block_given?
148
+
149
+ # Create credentials
150
+ credentials = @config.credentials
151
+ # Use self-signed JWT if the endpoint is unchanged from default,
152
+ # but only if the default endpoint does not have a region prefix.
153
+ enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
154
+ !@config.endpoint.split(".").first.include?("-")
155
+ credentials ||= Credentials.default scope: @config.scope,
156
+ enable_self_signed_jwt: enable_self_signed_jwt
157
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
158
+ credentials = Credentials.new credentials, scope: @config.scope
159
+ end
160
+
161
+ @quota_project_id = @config.quota_project
162
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
163
+
164
+ @operations_client = ::Google::Cloud::ResourceManager::V3::Folders::Rest::Operations.new do |config|
165
+ config.credentials = credentials
166
+ config.quota_project = @quota_project_id
167
+ config.endpoint = @config.endpoint
168
+ end
169
+
170
+ @folders_stub = ::Google::Cloud::ResourceManager::V3::Folders::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials
171
+ end
172
+
173
+ ##
174
+ # Get the associated client for long-running operations.
175
+ #
176
+ # @return [::Google::Cloud::ResourceManager::V3::Folders::Rest::Operations]
177
+ #
178
+ attr_reader :operations_client
179
+
180
+ # Service calls
181
+
182
+ ##
183
+ # Retrieves a folder identified by the supplied resource name.
184
+ # Valid folder resource names have the format `folders/{folder_id}`
185
+ # (for example, `folders/1234`).
186
+ # The caller must have `resourcemanager.folders.get` permission on the
187
+ # identified folder.
188
+ #
189
+ # @overload get_folder(request, options = nil)
190
+ # Pass arguments to `get_folder` via a request object, either of type
191
+ # {::Google::Cloud::ResourceManager::V3::GetFolderRequest} or an equivalent Hash.
192
+ #
193
+ # @param request [::Google::Cloud::ResourceManager::V3::GetFolderRequest, ::Hash]
194
+ # A request object representing the call parameters. Required. To specify no
195
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
196
+ # @param options [::Gapic::CallOptions, ::Hash]
197
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
198
+ #
199
+ # @overload get_folder(name: nil)
200
+ # Pass arguments to `get_folder` via keyword arguments. Note that at
201
+ # least one keyword argument is required. To specify no parameters, or to keep all
202
+ # the default parameter values, pass an empty Hash as a request object (see above).
203
+ #
204
+ # @param name [::String]
205
+ # Required. The resource name of the folder to retrieve.
206
+ # Must be of the form `folders/{folder_id}`.
207
+ # @yield [result, operation] Access the result along with the TransportOperation object
208
+ # @yieldparam result [::Google::Cloud::ResourceManager::V3::Folder]
209
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
210
+ #
211
+ # @return [::Google::Cloud::ResourceManager::V3::Folder]
212
+ #
213
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
214
+ def get_folder request, options = nil
215
+ raise ::ArgumentError, "request must be provided" if request.nil?
216
+
217
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::ResourceManager::V3::GetFolderRequest
218
+
219
+ # Converts hash and nil to an options object
220
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
221
+
222
+ # Customize the options with defaults
223
+ call_metadata = @config.rpcs.get_folder.metadata.to_h
224
+
225
+ # Set x-goog-api-client and x-goog-user-project headers
226
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
227
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
228
+ gapic_version: ::Google::Cloud::ResourceManager::V3::VERSION,
229
+ transports_version_send: [:rest]
230
+
231
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
232
+
233
+ options.apply_defaults timeout: @config.rpcs.get_folder.timeout,
234
+ metadata: call_metadata,
235
+ retry_policy: @config.rpcs.get_folder.retry_policy
236
+
237
+ options.apply_defaults timeout: @config.timeout,
238
+ metadata: @config.metadata,
239
+ retry_policy: @config.retry_policy
240
+
241
+ @folders_stub.get_folder request, options do |result, operation|
242
+ yield result, operation if block_given?
243
+ return result
244
+ end
245
+ rescue ::Gapic::Rest::Error => e
246
+ raise ::Google::Cloud::Error.from_error(e)
247
+ end
248
+
249
+ ##
250
+ # Lists the folders that are direct descendants of supplied parent resource.
251
+ # `list()` provides a strongly consistent view of the folders underneath
252
+ # the specified parent resource.
253
+ # `list()` returns folders sorted based upon the (ascending) lexical ordering
254
+ # of their display_name.
255
+ # The caller must have `resourcemanager.folders.list` permission on the
256
+ # identified parent.
257
+ #
258
+ # @overload list_folders(request, options = nil)
259
+ # Pass arguments to `list_folders` via a request object, either of type
260
+ # {::Google::Cloud::ResourceManager::V3::ListFoldersRequest} or an equivalent Hash.
261
+ #
262
+ # @param request [::Google::Cloud::ResourceManager::V3::ListFoldersRequest, ::Hash]
263
+ # A request object representing the call parameters. Required. To specify no
264
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
265
+ # @param options [::Gapic::CallOptions, ::Hash]
266
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
267
+ #
268
+ # @overload list_folders(parent: nil, page_size: nil, page_token: nil, show_deleted: nil)
269
+ # Pass arguments to `list_folders` via keyword arguments. Note that at
270
+ # least one keyword argument is required. To specify no parameters, or to keep all
271
+ # the default parameter values, pass an empty Hash as a request object (see above).
272
+ #
273
+ # @param parent [::String]
274
+ # Required. The resource name of the organization or folder whose folders are
275
+ # being listed.
276
+ # Must be of the form `folders/{folder_id}` or `organizations/{org_id}`.
277
+ # Access to this method is controlled by checking the
278
+ # `resourcemanager.folders.list` permission on the `parent`.
279
+ # @param page_size [::Integer]
280
+ # Optional. The maximum number of folders to return in the response.
281
+ # If unspecified, server picks an appropriate default.
282
+ # @param page_token [::String]
283
+ # Optional. A pagination token returned from a previous call to `ListFolders`
284
+ # that indicates where this listing should continue from.
285
+ # @param show_deleted [::Boolean]
286
+ # Optional. Controls whether folders in the
287
+ # {::Google::Cloud::ResourceManager::V3::Folder::State::DELETE_REQUESTED DELETE_REQUESTED}
288
+ # state should be returned. Defaults to false.
289
+ # @yield [result, operation] Access the result along with the TransportOperation object
290
+ # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::ResourceManager::V3::Folder>]
291
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
292
+ #
293
+ # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::ResourceManager::V3::Folder>]
294
+ #
295
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
296
+ def list_folders request, options = nil
297
+ raise ::ArgumentError, "request must be provided" if request.nil?
298
+
299
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::ResourceManager::V3::ListFoldersRequest
300
+
301
+ # Converts hash and nil to an options object
302
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
303
+
304
+ # Customize the options with defaults
305
+ call_metadata = @config.rpcs.list_folders.metadata.to_h
306
+
307
+ # Set x-goog-api-client and x-goog-user-project headers
308
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
309
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
310
+ gapic_version: ::Google::Cloud::ResourceManager::V3::VERSION,
311
+ transports_version_send: [:rest]
312
+
313
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
314
+
315
+ options.apply_defaults timeout: @config.rpcs.list_folders.timeout,
316
+ metadata: call_metadata,
317
+ retry_policy: @config.rpcs.list_folders.retry_policy
318
+
319
+ options.apply_defaults timeout: @config.timeout,
320
+ metadata: @config.metadata,
321
+ retry_policy: @config.retry_policy
322
+
323
+ @folders_stub.list_folders request, options do |result, operation|
324
+ result = ::Gapic::Rest::PagedEnumerable.new @folders_stub, :list_folders, "folders", request, result, options
325
+ yield result, operation if block_given?
326
+ return result
327
+ end
328
+ rescue ::Gapic::Rest::Error => e
329
+ raise ::Google::Cloud::Error.from_error(e)
330
+ end
331
+
332
+ ##
333
+ # Search for folders that match specific filter criteria.
334
+ # `search()` provides an eventually consistent view of the folders a user has
335
+ # access to which meet the specified filter criteria.
336
+ #
337
+ # This will only return folders on which the caller has the
338
+ # permission `resourcemanager.folders.get`.
339
+ #
340
+ # @overload search_folders(request, options = nil)
341
+ # Pass arguments to `search_folders` via a request object, either of type
342
+ # {::Google::Cloud::ResourceManager::V3::SearchFoldersRequest} or an equivalent Hash.
343
+ #
344
+ # @param request [::Google::Cloud::ResourceManager::V3::SearchFoldersRequest, ::Hash]
345
+ # A request object representing the call parameters. Required. To specify no
346
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
347
+ # @param options [::Gapic::CallOptions, ::Hash]
348
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
349
+ #
350
+ # @overload search_folders(page_size: nil, page_token: nil, query: nil)
351
+ # Pass arguments to `search_folders` via keyword arguments. Note that at
352
+ # least one keyword argument is required. To specify no parameters, or to keep all
353
+ # the default parameter values, pass an empty Hash as a request object (see above).
354
+ #
355
+ # @param page_size [::Integer]
356
+ # Optional. The maximum number of folders to return in the response.
357
+ # If unspecified, server picks an appropriate default.
358
+ # @param page_token [::String]
359
+ # Optional. A pagination token returned from a previous call to `SearchFolders`
360
+ # that indicates from where search should continue.
361
+ # @param query [::String]
362
+ # Optional. Search criteria used to select the folders to return.
363
+ # If no search criteria is specified then all accessible folders will be
364
+ # returned.
365
+ #
366
+ # Query expressions can be used to restrict results based upon displayName,
367
+ # state and parent, where the operators `=` (`:`) `NOT`, `AND` and `OR`
368
+ # can be used along with the suffix wildcard symbol `*`.
369
+ #
370
+ # The `displayName` field in a query expression should use escaped quotes
371
+ # for values that include whitespace to prevent unexpected behavior.
372
+ #
373
+ # ```
374
+ # | Field | Description |
375
+ # |-------------------------|----------------------------------------|
376
+ # | displayName | Filters by displayName. |
377
+ # | parent | Filters by parent (for example: folders/123). |
378
+ # | state, lifecycleState | Filters by state. |
379
+ # ```
380
+ #
381
+ # Some example queries are:
382
+ #
383
+ # * Query `displayName=Test*` returns Folder resources whose display name
384
+ # starts with "Test".
385
+ # * Query `state=ACTIVE` returns Folder resources with
386
+ # `state` set to `ACTIVE`.
387
+ # * Query `parent=folders/123` returns Folder resources that have
388
+ # `folders/123` as a parent resource.
389
+ # * Query `parent=folders/123 AND state=ACTIVE` returns active
390
+ # Folder resources that have `folders/123` as a parent resource.
391
+ # * Query `displayName=\\"Test String\\"` returns Folder resources with
392
+ # display names that include both "Test" and "String".
393
+ # @yield [result, operation] Access the result along with the TransportOperation object
394
+ # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::ResourceManager::V3::Folder>]
395
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
396
+ #
397
+ # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::ResourceManager::V3::Folder>]
398
+ #
399
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
400
+ def search_folders request, options = nil
401
+ raise ::ArgumentError, "request must be provided" if request.nil?
402
+
403
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::ResourceManager::V3::SearchFoldersRequest
404
+
405
+ # Converts hash and nil to an options object
406
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
407
+
408
+ # Customize the options with defaults
409
+ call_metadata = @config.rpcs.search_folders.metadata.to_h
410
+
411
+ # Set x-goog-api-client and x-goog-user-project headers
412
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
413
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
414
+ gapic_version: ::Google::Cloud::ResourceManager::V3::VERSION,
415
+ transports_version_send: [:rest]
416
+
417
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
418
+
419
+ options.apply_defaults timeout: @config.rpcs.search_folders.timeout,
420
+ metadata: call_metadata,
421
+ retry_policy: @config.rpcs.search_folders.retry_policy
422
+
423
+ options.apply_defaults timeout: @config.timeout,
424
+ metadata: @config.metadata,
425
+ retry_policy: @config.retry_policy
426
+
427
+ @folders_stub.search_folders request, options do |result, operation|
428
+ result = ::Gapic::Rest::PagedEnumerable.new @folders_stub, :search_folders, "folders", request, result, options
429
+ yield result, operation if block_given?
430
+ return result
431
+ end
432
+ rescue ::Gapic::Rest::Error => e
433
+ raise ::Google::Cloud::Error.from_error(e)
434
+ end
435
+
436
+ ##
437
+ # Creates a folder in the resource hierarchy.
438
+ # Returns an `Operation` which can be used to track the progress of the
439
+ # folder creation workflow.
440
+ # Upon success, the `Operation.response` field will be populated with the
441
+ # created Folder.
442
+ #
443
+ # In order to succeed, the addition of this new folder must not violate
444
+ # the folder naming, height, or fanout constraints.
445
+ #
446
+ # + The folder's `display_name` must be distinct from all other folders that
447
+ # share its parent.
448
+ # + The addition of the folder must not cause the active folder hierarchy
449
+ # to exceed a height of 10. Note, the full active + deleted folder hierarchy
450
+ # is allowed to reach a height of 20; this provides additional headroom when
451
+ # moving folders that contain deleted folders.
452
+ # + The addition of the folder must not cause the total number of folders
453
+ # under its parent to exceed 300.
454
+ #
455
+ # If the operation fails due to a folder constraint violation, some errors
456
+ # may be returned by the `CreateFolder` request, with status code
457
+ # `FAILED_PRECONDITION` and an error description. Other folder constraint
458
+ # violations will be communicated in the `Operation`, with the specific
459
+ # `PreconditionFailure` returned in the details list in the `Operation.error`
460
+ # field.
461
+ #
462
+ # The caller must have `resourcemanager.folders.create` permission on the
463
+ # identified parent.
464
+ #
465
+ # @overload create_folder(request, options = nil)
466
+ # Pass arguments to `create_folder` via a request object, either of type
467
+ # {::Google::Cloud::ResourceManager::V3::CreateFolderRequest} or an equivalent Hash.
468
+ #
469
+ # @param request [::Google::Cloud::ResourceManager::V3::CreateFolderRequest, ::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 create_folder(folder: nil)
476
+ # Pass arguments to `create_folder` 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 folder [::Google::Cloud::ResourceManager::V3::Folder, ::Hash]
481
+ # Required. The folder being created, only the display name and parent will be
482
+ # consulted. All other fields will be ignored.
483
+ # @yield [result, operation] Access the result along with the TransportOperation object
484
+ # @yieldparam result [::Gapic::Operation]
485
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
486
+ #
487
+ # @return [::Gapic::Operation]
488
+ #
489
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
490
+ def create_folder request, options = nil
491
+ raise ::ArgumentError, "request must be provided" if request.nil?
492
+
493
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::ResourceManager::V3::CreateFolderRequest
494
+
495
+ # Converts hash and nil to an options object
496
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
497
+
498
+ # Customize the options with defaults
499
+ call_metadata = @config.rpcs.create_folder.metadata.to_h
500
+
501
+ # Set x-goog-api-client and x-goog-user-project headers
502
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
503
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
504
+ gapic_version: ::Google::Cloud::ResourceManager::V3::VERSION,
505
+ transports_version_send: [:rest]
506
+
507
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
508
+
509
+ options.apply_defaults timeout: @config.rpcs.create_folder.timeout,
510
+ metadata: call_metadata,
511
+ retry_policy: @config.rpcs.create_folder.retry_policy
512
+
513
+ options.apply_defaults timeout: @config.timeout,
514
+ metadata: @config.metadata,
515
+ retry_policy: @config.retry_policy
516
+
517
+ @folders_stub.create_folder request, options do |result, operation|
518
+ result = ::Gapic::Operation.new result, @operations_client, options: options
519
+ yield result, operation if block_given?
520
+ return result
521
+ end
522
+ rescue ::Gapic::Rest::Error => e
523
+ raise ::Google::Cloud::Error.from_error(e)
524
+ end
525
+
526
+ ##
527
+ # Updates a folder, changing its `display_name`.
528
+ # Changes to the folder `display_name` will be rejected if they violate
529
+ # either the `display_name` formatting rules or the naming constraints
530
+ # described in the {::Google::Cloud::ResourceManager::V3::Folders::Rest::Client#create_folder CreateFolder} documentation.
531
+ #
532
+ # The folder's `display_name` must start and end with a letter or digit,
533
+ # may contain letters, digits, spaces, hyphens and underscores and can be
534
+ # between 3 and 30 characters. This is captured by the regular expression:
535
+ # `[\p{L}\p{N}][\p{L}\p{N}_- ]{1,28}[\p{L}\p{N}]`.
536
+ # The caller must have `resourcemanager.folders.update` permission on the
537
+ # identified folder.
538
+ #
539
+ # If the update fails due to the unique name constraint then a
540
+ # `PreconditionFailure` explaining this violation will be returned
541
+ # in the Status.details field.
542
+ #
543
+ # @overload update_folder(request, options = nil)
544
+ # Pass arguments to `update_folder` via a request object, either of type
545
+ # {::Google::Cloud::ResourceManager::V3::UpdateFolderRequest} or an equivalent Hash.
546
+ #
547
+ # @param request [::Google::Cloud::ResourceManager::V3::UpdateFolderRequest, ::Hash]
548
+ # A request object representing the call parameters. Required. To specify no
549
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
550
+ # @param options [::Gapic::CallOptions, ::Hash]
551
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
552
+ #
553
+ # @overload update_folder(folder: nil, update_mask: nil)
554
+ # Pass arguments to `update_folder` via keyword arguments. Note that at
555
+ # least one keyword argument is required. To specify no parameters, or to keep all
556
+ # the default parameter values, pass an empty Hash as a request object (see above).
557
+ #
558
+ # @param folder [::Google::Cloud::ResourceManager::V3::Folder, ::Hash]
559
+ # Required. The new definition of the Folder. It must include the `name` field, which
560
+ # cannot be changed.
561
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
562
+ # Required. Fields to be updated.
563
+ # Only the `display_name` can be updated.
564
+ # @yield [result, operation] Access the result along with the TransportOperation object
565
+ # @yieldparam result [::Gapic::Operation]
566
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
567
+ #
568
+ # @return [::Gapic::Operation]
569
+ #
570
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
571
+ def update_folder request, options = nil
572
+ raise ::ArgumentError, "request must be provided" if request.nil?
573
+
574
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::ResourceManager::V3::UpdateFolderRequest
575
+
576
+ # Converts hash and nil to an options object
577
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
578
+
579
+ # Customize the options with defaults
580
+ call_metadata = @config.rpcs.update_folder.metadata.to_h
581
+
582
+ # Set x-goog-api-client and x-goog-user-project headers
583
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
584
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
585
+ gapic_version: ::Google::Cloud::ResourceManager::V3::VERSION,
586
+ transports_version_send: [:rest]
587
+
588
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
589
+
590
+ options.apply_defaults timeout: @config.rpcs.update_folder.timeout,
591
+ metadata: call_metadata,
592
+ retry_policy: @config.rpcs.update_folder.retry_policy
593
+
594
+ options.apply_defaults timeout: @config.timeout,
595
+ metadata: @config.metadata,
596
+ retry_policy: @config.retry_policy
597
+
598
+ @folders_stub.update_folder request, options do |result, operation|
599
+ result = ::Gapic::Operation.new result, @operations_client, options: options
600
+ yield result, operation if block_given?
601
+ return result
602
+ end
603
+ rescue ::Gapic::Rest::Error => e
604
+ raise ::Google::Cloud::Error.from_error(e)
605
+ end
606
+
607
+ ##
608
+ # Moves a folder under a new resource parent.
609
+ # Returns an `Operation` which can be used to track the progress of the
610
+ # folder move workflow.
611
+ # Upon success, the `Operation.response` field will be populated with the
612
+ # moved folder.
613
+ # Upon failure, a `FolderOperationError` categorizing the failure cause will
614
+ # be returned - if the failure occurs synchronously then the
615
+ # `FolderOperationError` will be returned in the `Status.details` field.
616
+ # If it occurs asynchronously, then the FolderOperation will be returned
617
+ # in the `Operation.error` field.
618
+ # In addition, the `Operation.metadata` field will be populated with a
619
+ # `FolderOperation` message as an aid to stateless clients.
620
+ # Folder moves will be rejected if they violate either the naming, height,
621
+ # or fanout constraints described in the
622
+ # {::Google::Cloud::ResourceManager::V3::Folders::Rest::Client#create_folder CreateFolder} documentation.
623
+ # The caller must have `resourcemanager.folders.move` permission on the
624
+ # folder's current and proposed new parent.
625
+ #
626
+ # @overload move_folder(request, options = nil)
627
+ # Pass arguments to `move_folder` via a request object, either of type
628
+ # {::Google::Cloud::ResourceManager::V3::MoveFolderRequest} or an equivalent Hash.
629
+ #
630
+ # @param request [::Google::Cloud::ResourceManager::V3::MoveFolderRequest, ::Hash]
631
+ # A request object representing the call parameters. Required. To specify no
632
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
633
+ # @param options [::Gapic::CallOptions, ::Hash]
634
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
635
+ #
636
+ # @overload move_folder(name: nil, destination_parent: nil)
637
+ # Pass arguments to `move_folder` via keyword arguments. Note that at
638
+ # least one keyword argument is required. To specify no parameters, or to keep all
639
+ # the default parameter values, pass an empty Hash as a request object (see above).
640
+ #
641
+ # @param name [::String]
642
+ # Required. The resource name of the Folder to move.
643
+ # Must be of the form folders/\\{folder_id}
644
+ # @param destination_parent [::String]
645
+ # Required. The resource name of the folder or organization which should be the
646
+ # folder's new parent.
647
+ # Must be of the form `folders/{folder_id}` or `organizations/{org_id}`.
648
+ # @yield [result, operation] Access the result along with the TransportOperation object
649
+ # @yieldparam result [::Gapic::Operation]
650
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
651
+ #
652
+ # @return [::Gapic::Operation]
653
+ #
654
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
655
+ def move_folder request, options = nil
656
+ raise ::ArgumentError, "request must be provided" if request.nil?
657
+
658
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::ResourceManager::V3::MoveFolderRequest
659
+
660
+ # Converts hash and nil to an options object
661
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
662
+
663
+ # Customize the options with defaults
664
+ call_metadata = @config.rpcs.move_folder.metadata.to_h
665
+
666
+ # Set x-goog-api-client and x-goog-user-project headers
667
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
668
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
669
+ gapic_version: ::Google::Cloud::ResourceManager::V3::VERSION,
670
+ transports_version_send: [:rest]
671
+
672
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
673
+
674
+ options.apply_defaults timeout: @config.rpcs.move_folder.timeout,
675
+ metadata: call_metadata,
676
+ retry_policy: @config.rpcs.move_folder.retry_policy
677
+
678
+ options.apply_defaults timeout: @config.timeout,
679
+ metadata: @config.metadata,
680
+ retry_policy: @config.retry_policy
681
+
682
+ @folders_stub.move_folder request, options do |result, operation|
683
+ result = ::Gapic::Operation.new result, @operations_client, options: options
684
+ yield result, operation if block_given?
685
+ return result
686
+ end
687
+ rescue ::Gapic::Rest::Error => e
688
+ raise ::Google::Cloud::Error.from_error(e)
689
+ end
690
+
691
+ ##
692
+ # Requests deletion of a folder. The folder is moved into the
693
+ # {::Google::Cloud::ResourceManager::V3::Folder::State::DELETE_REQUESTED DELETE_REQUESTED} state
694
+ # immediately, and is deleted approximately 30 days later. This method may
695
+ # only be called on an empty folder, where a folder is empty if it doesn't
696
+ # contain any folders or projects in the {::Google::Cloud::ResourceManager::V3::Folder::State::ACTIVE ACTIVE} state.
697
+ # If called on a folder in {::Google::Cloud::ResourceManager::V3::Folder::State::DELETE_REQUESTED DELETE_REQUESTED}
698
+ # state the operation will result in a no-op success.
699
+ # The caller must have `resourcemanager.folders.delete` permission on the
700
+ # identified folder.
701
+ #
702
+ # @overload delete_folder(request, options = nil)
703
+ # Pass arguments to `delete_folder` via a request object, either of type
704
+ # {::Google::Cloud::ResourceManager::V3::DeleteFolderRequest} or an equivalent Hash.
705
+ #
706
+ # @param request [::Google::Cloud::ResourceManager::V3::DeleteFolderRequest, ::Hash]
707
+ # A request object representing the call parameters. Required. To specify no
708
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
709
+ # @param options [::Gapic::CallOptions, ::Hash]
710
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
711
+ #
712
+ # @overload delete_folder(name: nil)
713
+ # Pass arguments to `delete_folder` via keyword arguments. Note that at
714
+ # least one keyword argument is required. To specify no parameters, or to keep all
715
+ # the default parameter values, pass an empty Hash as a request object (see above).
716
+ #
717
+ # @param name [::String]
718
+ # Required. The resource name of the folder to be deleted.
719
+ # Must be of the form `folders/{folder_id}`.
720
+ # @yield [result, operation] Access the result along with the TransportOperation object
721
+ # @yieldparam result [::Gapic::Operation]
722
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
723
+ #
724
+ # @return [::Gapic::Operation]
725
+ #
726
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
727
+ def delete_folder request, options = nil
728
+ raise ::ArgumentError, "request must be provided" if request.nil?
729
+
730
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::ResourceManager::V3::DeleteFolderRequest
731
+
732
+ # Converts hash and nil to an options object
733
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
734
+
735
+ # Customize the options with defaults
736
+ call_metadata = @config.rpcs.delete_folder.metadata.to_h
737
+
738
+ # Set x-goog-api-client and x-goog-user-project headers
739
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
740
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
741
+ gapic_version: ::Google::Cloud::ResourceManager::V3::VERSION,
742
+ transports_version_send: [:rest]
743
+
744
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
745
+
746
+ options.apply_defaults timeout: @config.rpcs.delete_folder.timeout,
747
+ metadata: call_metadata,
748
+ retry_policy: @config.rpcs.delete_folder.retry_policy
749
+
750
+ options.apply_defaults timeout: @config.timeout,
751
+ metadata: @config.metadata,
752
+ retry_policy: @config.retry_policy
753
+
754
+ @folders_stub.delete_folder request, options do |result, operation|
755
+ result = ::Gapic::Operation.new result, @operations_client, options: options
756
+ yield result, operation if block_given?
757
+ return result
758
+ end
759
+ rescue ::Gapic::Rest::Error => e
760
+ raise ::Google::Cloud::Error.from_error(e)
761
+ end
762
+
763
+ ##
764
+ # Cancels the deletion request for a folder. This method may be called on a
765
+ # folder in any state. If the folder is in the {::Google::Cloud::ResourceManager::V3::Folder::State::ACTIVE ACTIVE}
766
+ # state the result will be a no-op success. In order to succeed, the folder's
767
+ # parent must be in the {::Google::Cloud::ResourceManager::V3::Folder::State::ACTIVE ACTIVE} state. In addition,
768
+ # reintroducing the folder into the tree must not violate folder naming,
769
+ # height, and fanout constraints described in the
770
+ # {::Google::Cloud::ResourceManager::V3::Folders::Rest::Client#create_folder CreateFolder} documentation.
771
+ # The caller must have `resourcemanager.folders.undelete` permission on the
772
+ # identified folder.
773
+ #
774
+ # @overload undelete_folder(request, options = nil)
775
+ # Pass arguments to `undelete_folder` via a request object, either of type
776
+ # {::Google::Cloud::ResourceManager::V3::UndeleteFolderRequest} or an equivalent Hash.
777
+ #
778
+ # @param request [::Google::Cloud::ResourceManager::V3::UndeleteFolderRequest, ::Hash]
779
+ # A request object representing the call parameters. Required. To specify no
780
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
781
+ # @param options [::Gapic::CallOptions, ::Hash]
782
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
783
+ #
784
+ # @overload undelete_folder(name: nil)
785
+ # Pass arguments to `undelete_folder` via keyword arguments. Note that at
786
+ # least one keyword argument is required. To specify no parameters, or to keep all
787
+ # the default parameter values, pass an empty Hash as a request object (see above).
788
+ #
789
+ # @param name [::String]
790
+ # Required. The resource name of the folder to undelete.
791
+ # Must be of the form `folders/{folder_id}`.
792
+ # @yield [result, operation] Access the result along with the TransportOperation object
793
+ # @yieldparam result [::Gapic::Operation]
794
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
795
+ #
796
+ # @return [::Gapic::Operation]
797
+ #
798
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
799
+ def undelete_folder request, options = nil
800
+ raise ::ArgumentError, "request must be provided" if request.nil?
801
+
802
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::ResourceManager::V3::UndeleteFolderRequest
803
+
804
+ # Converts hash and nil to an options object
805
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
806
+
807
+ # Customize the options with defaults
808
+ call_metadata = @config.rpcs.undelete_folder.metadata.to_h
809
+
810
+ # Set x-goog-api-client and x-goog-user-project headers
811
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
812
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
813
+ gapic_version: ::Google::Cloud::ResourceManager::V3::VERSION,
814
+ transports_version_send: [:rest]
815
+
816
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
817
+
818
+ options.apply_defaults timeout: @config.rpcs.undelete_folder.timeout,
819
+ metadata: call_metadata,
820
+ retry_policy: @config.rpcs.undelete_folder.retry_policy
821
+
822
+ options.apply_defaults timeout: @config.timeout,
823
+ metadata: @config.metadata,
824
+ retry_policy: @config.retry_policy
825
+
826
+ @folders_stub.undelete_folder request, options do |result, operation|
827
+ result = ::Gapic::Operation.new result, @operations_client, options: options
828
+ yield result, operation if block_given?
829
+ return result
830
+ end
831
+ rescue ::Gapic::Rest::Error => e
832
+ raise ::Google::Cloud::Error.from_error(e)
833
+ end
834
+
835
+ ##
836
+ # Gets the access control policy for a folder. The returned policy may be
837
+ # empty if no such policy or resource exists. The `resource` field should
838
+ # be the folder's resource name, for example: "folders/1234".
839
+ # The caller must have `resourcemanager.folders.getIamPolicy` permission
840
+ # on the identified folder.
841
+ #
842
+ # @overload get_iam_policy(request, options = nil)
843
+ # Pass arguments to `get_iam_policy` via a request object, either of type
844
+ # {::Google::Iam::V1::GetIamPolicyRequest} or an equivalent Hash.
845
+ #
846
+ # @param request [::Google::Iam::V1::GetIamPolicyRequest, ::Hash]
847
+ # A request object representing the call parameters. Required. To specify no
848
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
849
+ # @param options [::Gapic::CallOptions, ::Hash]
850
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
851
+ #
852
+ # @overload get_iam_policy(resource: nil, options: nil)
853
+ # Pass arguments to `get_iam_policy` via keyword arguments. Note that at
854
+ # least one keyword argument is required. To specify no parameters, or to keep all
855
+ # the default parameter values, pass an empty Hash as a request object (see above).
856
+ #
857
+ # @param resource [::String]
858
+ # REQUIRED: The resource for which the policy is being requested.
859
+ # See the operation documentation for the appropriate value for this field.
860
+ # @param options [::Google::Iam::V1::GetPolicyOptions, ::Hash]
861
+ # OPTIONAL: A `GetPolicyOptions` object for specifying options to
862
+ # `GetIamPolicy`.
863
+ # @yield [result, operation] Access the result along with the TransportOperation object
864
+ # @yieldparam result [::Google::Iam::V1::Policy]
865
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
866
+ #
867
+ # @return [::Google::Iam::V1::Policy]
868
+ #
869
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
870
+ def get_iam_policy request, options = nil
871
+ raise ::ArgumentError, "request must be provided" if request.nil?
872
+
873
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Iam::V1::GetIamPolicyRequest
874
+
875
+ # Converts hash and nil to an options object
876
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
877
+
878
+ # Customize the options with defaults
879
+ call_metadata = @config.rpcs.get_iam_policy.metadata.to_h
880
+
881
+ # Set x-goog-api-client and x-goog-user-project headers
882
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
883
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
884
+ gapic_version: ::Google::Cloud::ResourceManager::V3::VERSION,
885
+ transports_version_send: [:rest]
886
+
887
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
888
+
889
+ options.apply_defaults timeout: @config.rpcs.get_iam_policy.timeout,
890
+ metadata: call_metadata,
891
+ retry_policy: @config.rpcs.get_iam_policy.retry_policy
892
+
893
+ options.apply_defaults timeout: @config.timeout,
894
+ metadata: @config.metadata,
895
+ retry_policy: @config.retry_policy
896
+
897
+ @folders_stub.get_iam_policy request, options do |result, operation|
898
+ yield result, operation if block_given?
899
+ return result
900
+ end
901
+ rescue ::Gapic::Rest::Error => e
902
+ raise ::Google::Cloud::Error.from_error(e)
903
+ end
904
+
905
+ ##
906
+ # Sets the access control policy on a folder, replacing any existing policy.
907
+ # The `resource` field should be the folder's resource name, for example:
908
+ # "folders/1234".
909
+ # The caller must have `resourcemanager.folders.setIamPolicy` permission
910
+ # on the identified folder.
911
+ #
912
+ # @overload set_iam_policy(request, options = nil)
913
+ # Pass arguments to `set_iam_policy` via a request object, either of type
914
+ # {::Google::Iam::V1::SetIamPolicyRequest} or an equivalent Hash.
915
+ #
916
+ # @param request [::Google::Iam::V1::SetIamPolicyRequest, ::Hash]
917
+ # A request object representing the call parameters. Required. To specify no
918
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
919
+ # @param options [::Gapic::CallOptions, ::Hash]
920
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
921
+ #
922
+ # @overload set_iam_policy(resource: nil, policy: nil, update_mask: nil)
923
+ # Pass arguments to `set_iam_policy` via keyword arguments. Note that at
924
+ # least one keyword argument is required. To specify no parameters, or to keep all
925
+ # the default parameter values, pass an empty Hash as a request object (see above).
926
+ #
927
+ # @param resource [::String]
928
+ # REQUIRED: The resource for which the policy is being specified.
929
+ # See the operation documentation for the appropriate value for this field.
930
+ # @param policy [::Google::Iam::V1::Policy, ::Hash]
931
+ # REQUIRED: The complete policy to be applied to the `resource`. The size of
932
+ # the policy is limited to a few 10s of KB. An empty policy is a
933
+ # valid policy but certain Cloud Platform services (such as Projects)
934
+ # might reject them.
935
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
936
+ # OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only
937
+ # the fields in the mask will be modified. If no mask is provided, the
938
+ # following default mask is used:
939
+ #
940
+ # `paths: "bindings, etag"`
941
+ # @yield [result, operation] Access the result along with the TransportOperation object
942
+ # @yieldparam result [::Google::Iam::V1::Policy]
943
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
944
+ #
945
+ # @return [::Google::Iam::V1::Policy]
946
+ #
947
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
948
+ def set_iam_policy request, options = nil
949
+ raise ::ArgumentError, "request must be provided" if request.nil?
950
+
951
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Iam::V1::SetIamPolicyRequest
952
+
953
+ # Converts hash and nil to an options object
954
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
955
+
956
+ # Customize the options with defaults
957
+ call_metadata = @config.rpcs.set_iam_policy.metadata.to_h
958
+
959
+ # Set x-goog-api-client and x-goog-user-project headers
960
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
961
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
962
+ gapic_version: ::Google::Cloud::ResourceManager::V3::VERSION,
963
+ transports_version_send: [:rest]
964
+
965
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
966
+
967
+ options.apply_defaults timeout: @config.rpcs.set_iam_policy.timeout,
968
+ metadata: call_metadata,
969
+ retry_policy: @config.rpcs.set_iam_policy.retry_policy
970
+
971
+ options.apply_defaults timeout: @config.timeout,
972
+ metadata: @config.metadata,
973
+ retry_policy: @config.retry_policy
974
+
975
+ @folders_stub.set_iam_policy request, options do |result, operation|
976
+ yield result, operation if block_given?
977
+ return result
978
+ end
979
+ rescue ::Gapic::Rest::Error => e
980
+ raise ::Google::Cloud::Error.from_error(e)
981
+ end
982
+
983
+ ##
984
+ # Returns permissions that a caller has on the specified folder.
985
+ # The `resource` field should be the folder's resource name,
986
+ # for example: "folders/1234".
987
+ #
988
+ # There are no permissions required for making this API call.
989
+ #
990
+ # @overload test_iam_permissions(request, options = nil)
991
+ # Pass arguments to `test_iam_permissions` via a request object, either of type
992
+ # {::Google::Iam::V1::TestIamPermissionsRequest} or an equivalent Hash.
993
+ #
994
+ # @param request [::Google::Iam::V1::TestIamPermissionsRequest, ::Hash]
995
+ # A request object representing the call parameters. Required. To specify no
996
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
997
+ # @param options [::Gapic::CallOptions, ::Hash]
998
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
999
+ #
1000
+ # @overload test_iam_permissions(resource: nil, permissions: nil)
1001
+ # Pass arguments to `test_iam_permissions` via keyword arguments. Note that at
1002
+ # least one keyword argument is required. To specify no parameters, or to keep all
1003
+ # the default parameter values, pass an empty Hash as a request object (see above).
1004
+ #
1005
+ # @param resource [::String]
1006
+ # REQUIRED: The resource for which the policy detail is being requested.
1007
+ # See the operation documentation for the appropriate value for this field.
1008
+ # @param permissions [::Array<::String>]
1009
+ # The set of permissions to check for the `resource`. Permissions with
1010
+ # wildcards (such as '*' or 'storage.*') are not allowed. For more
1011
+ # information see
1012
+ # [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions).
1013
+ # @yield [result, operation] Access the result along with the TransportOperation object
1014
+ # @yieldparam result [::Google::Iam::V1::TestIamPermissionsResponse]
1015
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
1016
+ #
1017
+ # @return [::Google::Iam::V1::TestIamPermissionsResponse]
1018
+ #
1019
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
1020
+ def test_iam_permissions request, options = nil
1021
+ raise ::ArgumentError, "request must be provided" if request.nil?
1022
+
1023
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Iam::V1::TestIamPermissionsRequest
1024
+
1025
+ # Converts hash and nil to an options object
1026
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1027
+
1028
+ # Customize the options with defaults
1029
+ call_metadata = @config.rpcs.test_iam_permissions.metadata.to_h
1030
+
1031
+ # Set x-goog-api-client and x-goog-user-project headers
1032
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1033
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1034
+ gapic_version: ::Google::Cloud::ResourceManager::V3::VERSION,
1035
+ transports_version_send: [:rest]
1036
+
1037
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1038
+
1039
+ options.apply_defaults timeout: @config.rpcs.test_iam_permissions.timeout,
1040
+ metadata: call_metadata,
1041
+ retry_policy: @config.rpcs.test_iam_permissions.retry_policy
1042
+
1043
+ options.apply_defaults timeout: @config.timeout,
1044
+ metadata: @config.metadata,
1045
+ retry_policy: @config.retry_policy
1046
+
1047
+ @folders_stub.test_iam_permissions request, options do |result, operation|
1048
+ yield result, operation if block_given?
1049
+ return result
1050
+ end
1051
+ rescue ::Gapic::Rest::Error => e
1052
+ raise ::Google::Cloud::Error.from_error(e)
1053
+ end
1054
+
1055
+ ##
1056
+ # Configuration class for the Folders REST API.
1057
+ #
1058
+ # This class represents the configuration for Folders REST,
1059
+ # providing control over timeouts, retry behavior, logging, transport
1060
+ # parameters, and other low-level controls. Certain parameters can also be
1061
+ # applied individually to specific RPCs. See
1062
+ # {::Google::Cloud::ResourceManager::V3::Folders::Rest::Client::Configuration::Rpcs}
1063
+ # for a list of RPCs that can be configured independently.
1064
+ #
1065
+ # Configuration can be applied globally to all clients, or to a single client
1066
+ # on construction.
1067
+ #
1068
+ # @example
1069
+ #
1070
+ # # Modify the global config, setting the timeout for
1071
+ # # get_folder to 20 seconds,
1072
+ # # and all remaining timeouts to 10 seconds.
1073
+ # ::Google::Cloud::ResourceManager::V3::Folders::Rest::Client.configure do |config|
1074
+ # config.timeout = 10.0
1075
+ # config.rpcs.get_folder.timeout = 20.0
1076
+ # end
1077
+ #
1078
+ # # Apply the above configuration only to a new client.
1079
+ # client = ::Google::Cloud::ResourceManager::V3::Folders::Rest::Client.new do |config|
1080
+ # config.timeout = 10.0
1081
+ # config.rpcs.get_folder.timeout = 20.0
1082
+ # end
1083
+ #
1084
+ # @!attribute [rw] endpoint
1085
+ # The hostname or hostname:port of the service endpoint.
1086
+ # Defaults to `"cloudresourcemanager.googleapis.com"`.
1087
+ # @return [::String]
1088
+ # @!attribute [rw] credentials
1089
+ # Credentials to send with calls. You may provide any of the following types:
1090
+ # * (`String`) The path to a service account key file in JSON format
1091
+ # * (`Hash`) A service account key as a Hash
1092
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
1093
+ # (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
1094
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
1095
+ # (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
1096
+ # * (`nil`) indicating no credentials
1097
+ # @return [::Object]
1098
+ # @!attribute [rw] scope
1099
+ # The OAuth scopes
1100
+ # @return [::Array<::String>]
1101
+ # @!attribute [rw] lib_name
1102
+ # The library name as recorded in instrumentation and logging
1103
+ # @return [::String]
1104
+ # @!attribute [rw] lib_version
1105
+ # The library version as recorded in instrumentation and logging
1106
+ # @return [::String]
1107
+ # @!attribute [rw] timeout
1108
+ # The call timeout in seconds.
1109
+ # @return [::Numeric]
1110
+ # @!attribute [rw] metadata
1111
+ # Additional headers to be sent with the call.
1112
+ # @return [::Hash{::Symbol=>::String}]
1113
+ # @!attribute [rw] retry_policy
1114
+ # The retry policy. The value is a hash with the following keys:
1115
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
1116
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
1117
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
1118
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
1119
+ # trigger a retry.
1120
+ # @return [::Hash]
1121
+ # @!attribute [rw] quota_project
1122
+ # A separate project against which to charge quota.
1123
+ # @return [::String]
1124
+ #
1125
+ class Configuration
1126
+ extend ::Gapic::Config
1127
+
1128
+ config_attr :endpoint, "cloudresourcemanager.googleapis.com", ::String
1129
+ config_attr :credentials, nil do |value|
1130
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
1131
+ allowed.any? { |klass| klass === value }
1132
+ end
1133
+ config_attr :scope, nil, ::String, ::Array, nil
1134
+ config_attr :lib_name, nil, ::String, nil
1135
+ config_attr :lib_version, nil, ::String, nil
1136
+ config_attr :timeout, nil, ::Numeric, nil
1137
+ config_attr :metadata, nil, ::Hash, nil
1138
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
1139
+ config_attr :quota_project, nil, ::String, nil
1140
+
1141
+ # @private
1142
+ def initialize parent_config = nil
1143
+ @parent_config = parent_config unless parent_config.nil?
1144
+
1145
+ yield self if block_given?
1146
+ end
1147
+
1148
+ ##
1149
+ # Configurations for individual RPCs
1150
+ # @return [Rpcs]
1151
+ #
1152
+ def rpcs
1153
+ @rpcs ||= begin
1154
+ parent_rpcs = nil
1155
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
1156
+ Rpcs.new parent_rpcs
1157
+ end
1158
+ end
1159
+
1160
+ ##
1161
+ # Configuration RPC class for the Folders API.
1162
+ #
1163
+ # Includes fields providing the configuration for each RPC in this service.
1164
+ # Each configuration object is of type `Gapic::Config::Method` and includes
1165
+ # the following configuration fields:
1166
+ #
1167
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
1168
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
1169
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
1170
+ # include the following keys:
1171
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
1172
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
1173
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
1174
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
1175
+ # trigger a retry.
1176
+ #
1177
+ class Rpcs
1178
+ ##
1179
+ # RPC-specific configuration for `get_folder`
1180
+ # @return [::Gapic::Config::Method]
1181
+ #
1182
+ attr_reader :get_folder
1183
+ ##
1184
+ # RPC-specific configuration for `list_folders`
1185
+ # @return [::Gapic::Config::Method]
1186
+ #
1187
+ attr_reader :list_folders
1188
+ ##
1189
+ # RPC-specific configuration for `search_folders`
1190
+ # @return [::Gapic::Config::Method]
1191
+ #
1192
+ attr_reader :search_folders
1193
+ ##
1194
+ # RPC-specific configuration for `create_folder`
1195
+ # @return [::Gapic::Config::Method]
1196
+ #
1197
+ attr_reader :create_folder
1198
+ ##
1199
+ # RPC-specific configuration for `update_folder`
1200
+ # @return [::Gapic::Config::Method]
1201
+ #
1202
+ attr_reader :update_folder
1203
+ ##
1204
+ # RPC-specific configuration for `move_folder`
1205
+ # @return [::Gapic::Config::Method]
1206
+ #
1207
+ attr_reader :move_folder
1208
+ ##
1209
+ # RPC-specific configuration for `delete_folder`
1210
+ # @return [::Gapic::Config::Method]
1211
+ #
1212
+ attr_reader :delete_folder
1213
+ ##
1214
+ # RPC-specific configuration for `undelete_folder`
1215
+ # @return [::Gapic::Config::Method]
1216
+ #
1217
+ attr_reader :undelete_folder
1218
+ ##
1219
+ # RPC-specific configuration for `get_iam_policy`
1220
+ # @return [::Gapic::Config::Method]
1221
+ #
1222
+ attr_reader :get_iam_policy
1223
+ ##
1224
+ # RPC-specific configuration for `set_iam_policy`
1225
+ # @return [::Gapic::Config::Method]
1226
+ #
1227
+ attr_reader :set_iam_policy
1228
+ ##
1229
+ # RPC-specific configuration for `test_iam_permissions`
1230
+ # @return [::Gapic::Config::Method]
1231
+ #
1232
+ attr_reader :test_iam_permissions
1233
+
1234
+ # @private
1235
+ def initialize parent_rpcs = nil
1236
+ get_folder_config = parent_rpcs.get_folder if parent_rpcs.respond_to? :get_folder
1237
+ @get_folder = ::Gapic::Config::Method.new get_folder_config
1238
+ list_folders_config = parent_rpcs.list_folders if parent_rpcs.respond_to? :list_folders
1239
+ @list_folders = ::Gapic::Config::Method.new list_folders_config
1240
+ search_folders_config = parent_rpcs.search_folders if parent_rpcs.respond_to? :search_folders
1241
+ @search_folders = ::Gapic::Config::Method.new search_folders_config
1242
+ create_folder_config = parent_rpcs.create_folder if parent_rpcs.respond_to? :create_folder
1243
+ @create_folder = ::Gapic::Config::Method.new create_folder_config
1244
+ update_folder_config = parent_rpcs.update_folder if parent_rpcs.respond_to? :update_folder
1245
+ @update_folder = ::Gapic::Config::Method.new update_folder_config
1246
+ move_folder_config = parent_rpcs.move_folder if parent_rpcs.respond_to? :move_folder
1247
+ @move_folder = ::Gapic::Config::Method.new move_folder_config
1248
+ delete_folder_config = parent_rpcs.delete_folder if parent_rpcs.respond_to? :delete_folder
1249
+ @delete_folder = ::Gapic::Config::Method.new delete_folder_config
1250
+ undelete_folder_config = parent_rpcs.undelete_folder if parent_rpcs.respond_to? :undelete_folder
1251
+ @undelete_folder = ::Gapic::Config::Method.new undelete_folder_config
1252
+ get_iam_policy_config = parent_rpcs.get_iam_policy if parent_rpcs.respond_to? :get_iam_policy
1253
+ @get_iam_policy = ::Gapic::Config::Method.new get_iam_policy_config
1254
+ set_iam_policy_config = parent_rpcs.set_iam_policy if parent_rpcs.respond_to? :set_iam_policy
1255
+ @set_iam_policy = ::Gapic::Config::Method.new set_iam_policy_config
1256
+ test_iam_permissions_config = parent_rpcs.test_iam_permissions if parent_rpcs.respond_to? :test_iam_permissions
1257
+ @test_iam_permissions = ::Gapic::Config::Method.new test_iam_permissions_config
1258
+
1259
+ yield self if block_given?
1260
+ end
1261
+ end
1262
+ end
1263
+ end
1264
+ end
1265
+ end
1266
+ end
1267
+ end
1268
+ end
1269
+ end