google-cloud-resource_manager-v3 0.3.0 → 0.5.0

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