google-apis-cloudresourcemanager_v2 0.1.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.
@@ -0,0 +1,533 @@
1
+ # Copyright 2020 Google LLC
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ require 'google/apis/core/base_service'
16
+ require 'google/apis/core/json_representation'
17
+ require 'google/apis/core/hashable'
18
+ require 'google/apis/errors'
19
+
20
+ module Google
21
+ module Apis
22
+ module CloudresourcemanagerV2
23
+ # Cloud Resource Manager API
24
+ #
25
+ # Creates, reads, and updates metadata for Google Cloud Platform resource
26
+ # containers.
27
+ #
28
+ # @example
29
+ # require 'google/apis/cloudresourcemanager_v2'
30
+ #
31
+ # Cloudresourcemanager = Google::Apis::CloudresourcemanagerV2 # Alias the module
32
+ # service = Cloudresourcemanager::CloudResourceManagerService.new
33
+ #
34
+ # @see https://cloud.google.com/resource-manager
35
+ class CloudResourceManagerService < Google::Apis::Core::BaseService
36
+ # @return [String]
37
+ # API key. Your API key identifies your project and provides you with API access,
38
+ # quota, and reports. Required unless you provide an OAuth 2.0 token.
39
+ attr_accessor :key
40
+
41
+ # @return [String]
42
+ # Available to use for quota purposes for server-side applications. Can be any
43
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
44
+ attr_accessor :quota_user
45
+
46
+ def initialize
47
+ super('https://cloudresourcemanager.googleapis.com/', '',
48
+ client_name: 'google-apis-cloudresourcemanager_v2',
49
+ client_version: Google::Apis::CloudresourcemanagerV2::GEM_VERSION)
50
+ @batch_path = 'batch'
51
+ end
52
+
53
+ # Creates a Folder in the resource hierarchy. Returns an Operation which can be
54
+ # used to track the progress of the folder creation workflow. Upon success the
55
+ # Operation.response field will be populated with the created Folder. In order
56
+ # to succeed, the addition of this new Folder must not violate the Folder naming,
57
+ # height or fanout constraints. + The Folder's display_name must be distinct
58
+ # from all other Folders that share its parent. + The addition of the Folder
59
+ # must not cause the active Folder hierarchy to exceed a height of 10. Note, the
60
+ # full active + deleted Folder hierarchy is allowed to reach a height of 20;
61
+ # this provides additional headroom when moving folders that contain deleted
62
+ # folders. + The addition of the Folder must not cause the total number of
63
+ # Folders under its parent to exceed 300. If the operation fails due to a folder
64
+ # constraint violation, some errors may be returned by the CreateFolder request,
65
+ # with status code FAILED_PRECONDITION and an error description. Other folder
66
+ # constraint violations will be communicated in the Operation, with the specific
67
+ # PreconditionFailure returned via the details list in the Operation.error field.
68
+ # The caller must have `resourcemanager.folders.create` permission on the
69
+ # identified parent.
70
+ # @param [Google::Apis::CloudresourcemanagerV2::Folder] folder_object
71
+ # @param [String] parent
72
+ # Required. The resource name of the new Folder's parent. Must be of the form `
73
+ # folders/`folder_id`` or `organizations/`org_id``.
74
+ # @param [String] fields
75
+ # Selector specifying which fields to include in a partial response.
76
+ # @param [String] quota_user
77
+ # Available to use for quota purposes for server-side applications. Can be any
78
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
79
+ # @param [Google::Apis::RequestOptions] options
80
+ # Request-specific options
81
+ #
82
+ # @yield [result, err] Result & error if block supplied
83
+ # @yieldparam result [Google::Apis::CloudresourcemanagerV2::Operation] parsed result object
84
+ # @yieldparam err [StandardError] error object if request failed
85
+ #
86
+ # @return [Google::Apis::CloudresourcemanagerV2::Operation]
87
+ #
88
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
89
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
90
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
91
+ def create_folder(folder_object = nil, parent: nil, fields: nil, quota_user: nil, options: nil, &block)
92
+ command = make_simple_command(:post, 'v2/folders', options)
93
+ command.request_representation = Google::Apis::CloudresourcemanagerV2::Folder::Representation
94
+ command.request_object = folder_object
95
+ command.response_representation = Google::Apis::CloudresourcemanagerV2::Operation::Representation
96
+ command.response_class = Google::Apis::CloudresourcemanagerV2::Operation
97
+ command.query['parent'] = parent unless parent.nil?
98
+ command.query['fields'] = fields unless fields.nil?
99
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
100
+ execute_or_queue_command(command, &block)
101
+ end
102
+
103
+ # Requests deletion of a Folder. The Folder is moved into the DELETE_REQUESTED
104
+ # state immediately, and is deleted approximately 30 days later. This method may
105
+ # only be called on an empty Folder in the ACTIVE state, where a Folder is empty
106
+ # if it doesn't contain any Folders or Projects in the ACTIVE state. The caller
107
+ # must have `resourcemanager.folders.delete` permission on the identified folder.
108
+ # @param [String] name
109
+ # Required. the resource name of the Folder to be deleted. Must be of the form `
110
+ # folders/`folder_id``.
111
+ # @param [String] fields
112
+ # Selector specifying which fields to include in a partial response.
113
+ # @param [String] quota_user
114
+ # Available to use for quota purposes for server-side applications. Can be any
115
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
116
+ # @param [Google::Apis::RequestOptions] options
117
+ # Request-specific options
118
+ #
119
+ # @yield [result, err] Result & error if block supplied
120
+ # @yieldparam result [Google::Apis::CloudresourcemanagerV2::Folder] parsed result object
121
+ # @yieldparam err [StandardError] error object if request failed
122
+ #
123
+ # @return [Google::Apis::CloudresourcemanagerV2::Folder]
124
+ #
125
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
126
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
127
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
128
+ def delete_folder(name, fields: nil, quota_user: nil, options: nil, &block)
129
+ command = make_simple_command(:delete, 'v2/{+name}', options)
130
+ command.response_representation = Google::Apis::CloudresourcemanagerV2::Folder::Representation
131
+ command.response_class = Google::Apis::CloudresourcemanagerV2::Folder
132
+ command.params['name'] = name unless name.nil?
133
+ command.query['fields'] = fields unless fields.nil?
134
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
135
+ execute_or_queue_command(command, &block)
136
+ end
137
+
138
+ # Retrieves a Folder identified by the supplied resource name. Valid Folder
139
+ # resource names have the format `folders/`folder_id`` (for example, `folders/
140
+ # 1234`). The caller must have `resourcemanager.folders.get` permission on the
141
+ # identified folder.
142
+ # @param [String] name
143
+ # Required. The resource name of the Folder to retrieve. Must be of the form `
144
+ # folders/`folder_id``.
145
+ # @param [String] fields
146
+ # Selector specifying which fields to include in a partial response.
147
+ # @param [String] quota_user
148
+ # Available to use for quota purposes for server-side applications. Can be any
149
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
150
+ # @param [Google::Apis::RequestOptions] options
151
+ # Request-specific options
152
+ #
153
+ # @yield [result, err] Result & error if block supplied
154
+ # @yieldparam result [Google::Apis::CloudresourcemanagerV2::Folder] parsed result object
155
+ # @yieldparam err [StandardError] error object if request failed
156
+ #
157
+ # @return [Google::Apis::CloudresourcemanagerV2::Folder]
158
+ #
159
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
160
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
161
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
162
+ def get_folder(name, fields: nil, quota_user: nil, options: nil, &block)
163
+ command = make_simple_command(:get, 'v2/{+name}', options)
164
+ command.response_representation = Google::Apis::CloudresourcemanagerV2::Folder::Representation
165
+ command.response_class = Google::Apis::CloudresourcemanagerV2::Folder
166
+ command.params['name'] = name unless name.nil?
167
+ command.query['fields'] = fields unless fields.nil?
168
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
169
+ execute_or_queue_command(command, &block)
170
+ end
171
+
172
+ # Gets the access control policy for a Folder. The returned policy may be empty
173
+ # if no such policy or resource exists. The `resource` field should be the
174
+ # Folder's resource name, e.g. "folders/1234". The caller must have `
175
+ # resourcemanager.folders.getIamPolicy` permission on the identified folder.
176
+ # @param [String] resource
177
+ # REQUIRED: The resource for which the policy is being requested. See the
178
+ # operation documentation for the appropriate value for this field.
179
+ # @param [Google::Apis::CloudresourcemanagerV2::GetIamPolicyRequest] get_iam_policy_request_object
180
+ # @param [String] fields
181
+ # Selector specifying which fields to include in a partial response.
182
+ # @param [String] quota_user
183
+ # Available to use for quota purposes for server-side applications. Can be any
184
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
185
+ # @param [Google::Apis::RequestOptions] options
186
+ # Request-specific options
187
+ #
188
+ # @yield [result, err] Result & error if block supplied
189
+ # @yieldparam result [Google::Apis::CloudresourcemanagerV2::Policy] parsed result object
190
+ # @yieldparam err [StandardError] error object if request failed
191
+ #
192
+ # @return [Google::Apis::CloudresourcemanagerV2::Policy]
193
+ #
194
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
195
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
196
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
197
+ def get_folder_iam_policy(resource, get_iam_policy_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
198
+ command = make_simple_command(:post, 'v2/{+resource}:getIamPolicy', options)
199
+ command.request_representation = Google::Apis::CloudresourcemanagerV2::GetIamPolicyRequest::Representation
200
+ command.request_object = get_iam_policy_request_object
201
+ command.response_representation = Google::Apis::CloudresourcemanagerV2::Policy::Representation
202
+ command.response_class = Google::Apis::CloudresourcemanagerV2::Policy
203
+ command.params['resource'] = resource unless resource.nil?
204
+ command.query['fields'] = fields unless fields.nil?
205
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
206
+ execute_or_queue_command(command, &block)
207
+ end
208
+
209
+ # Lists the Folders that are direct descendants of supplied parent resource.
210
+ # List provides a strongly consistent view of the Folders underneath the
211
+ # specified parent resource. List returns Folders sorted based upon the (
212
+ # ascending) lexical ordering of their display_name. The caller must have `
213
+ # resourcemanager.folders.list` permission on the identified parent.
214
+ # @param [Fixnum] page_size
215
+ # Optional. The maximum number of Folders to return in the response.
216
+ # @param [String] page_token
217
+ # Optional. A pagination token returned from a previous call to `ListFolders`
218
+ # that indicates where this listing should continue from.
219
+ # @param [String] parent
220
+ # Required. The resource name of the Organization or Folder whose Folders are
221
+ # being listed. Must be of the form `folders/`folder_id`` or `organizations/`
222
+ # org_id``. Access to this method is controlled by checking the `resourcemanager.
223
+ # folders.list` permission on the `parent`.
224
+ # @param [Boolean] show_deleted
225
+ # Optional. Controls whether Folders in the DELETE_REQUESTED state should be
226
+ # returned. Defaults to false.
227
+ # @param [String] fields
228
+ # Selector specifying which fields to include in a partial response.
229
+ # @param [String] quota_user
230
+ # Available to use for quota purposes for server-side applications. Can be any
231
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
232
+ # @param [Google::Apis::RequestOptions] options
233
+ # Request-specific options
234
+ #
235
+ # @yield [result, err] Result & error if block supplied
236
+ # @yieldparam result [Google::Apis::CloudresourcemanagerV2::ListFoldersResponse] parsed result object
237
+ # @yieldparam err [StandardError] error object if request failed
238
+ #
239
+ # @return [Google::Apis::CloudresourcemanagerV2::ListFoldersResponse]
240
+ #
241
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
242
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
243
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
244
+ def list_folders(page_size: nil, page_token: nil, parent: nil, show_deleted: nil, fields: nil, quota_user: nil, options: nil, &block)
245
+ command = make_simple_command(:get, 'v2/folders', options)
246
+ command.response_representation = Google::Apis::CloudresourcemanagerV2::ListFoldersResponse::Representation
247
+ command.response_class = Google::Apis::CloudresourcemanagerV2::ListFoldersResponse
248
+ command.query['pageSize'] = page_size unless page_size.nil?
249
+ command.query['pageToken'] = page_token unless page_token.nil?
250
+ command.query['parent'] = parent unless parent.nil?
251
+ command.query['showDeleted'] = show_deleted unless show_deleted.nil?
252
+ command.query['fields'] = fields unless fields.nil?
253
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
254
+ execute_or_queue_command(command, &block)
255
+ end
256
+
257
+ # Moves a Folder under a new resource parent. Returns an Operation which can be
258
+ # used to track the progress of the folder move workflow. Upon success the
259
+ # Operation.response field will be populated with the moved Folder. Upon failure,
260
+ # a FolderOperationError categorizing the failure cause will be returned - if
261
+ # the failure occurs synchronously then the FolderOperationError will be
262
+ # returned via the Status.details field and if it occurs asynchronously then the
263
+ # FolderOperation will be returned via the Operation.error field. In addition,
264
+ # the Operation.metadata field will be populated with a FolderOperation message
265
+ # as an aid to stateless clients. Folder moves will be rejected if they violate
266
+ # either the naming, height or fanout constraints described in the CreateFolder
267
+ # documentation. The caller must have `resourcemanager.folders.move` permission
268
+ # on the folder's current and proposed new parent.
269
+ # @param [String] name
270
+ # Required. The resource name of the Folder to move. Must be of the form folders/
271
+ # `folder_id`
272
+ # @param [Google::Apis::CloudresourcemanagerV2::MoveFolderRequest] move_folder_request_object
273
+ # @param [String] fields
274
+ # Selector specifying which fields to include in a partial response.
275
+ # @param [String] quota_user
276
+ # Available to use for quota purposes for server-side applications. Can be any
277
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
278
+ # @param [Google::Apis::RequestOptions] options
279
+ # Request-specific options
280
+ #
281
+ # @yield [result, err] Result & error if block supplied
282
+ # @yieldparam result [Google::Apis::CloudresourcemanagerV2::Operation] parsed result object
283
+ # @yieldparam err [StandardError] error object if request failed
284
+ #
285
+ # @return [Google::Apis::CloudresourcemanagerV2::Operation]
286
+ #
287
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
288
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
289
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
290
+ def move_folder(name, move_folder_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
291
+ command = make_simple_command(:post, 'v2/{+name}:move', options)
292
+ command.request_representation = Google::Apis::CloudresourcemanagerV2::MoveFolderRequest::Representation
293
+ command.request_object = move_folder_request_object
294
+ command.response_representation = Google::Apis::CloudresourcemanagerV2::Operation::Representation
295
+ command.response_class = Google::Apis::CloudresourcemanagerV2::Operation
296
+ command.params['name'] = name unless name.nil?
297
+ command.query['fields'] = fields unless fields.nil?
298
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
299
+ execute_or_queue_command(command, &block)
300
+ end
301
+
302
+ # Updates a Folder, changing its display_name. Changes to the folder
303
+ # display_name will be rejected if they violate either the display_name
304
+ # formatting rules or naming constraints described in the CreateFolder
305
+ # documentation. The Folder's display name must start and end with a letter or
306
+ # digit, may contain letters, digits, spaces, hyphens and underscores and can be
307
+ # between 3 and 30 characters. This is captured by the regular expression: `\p`L`
308
+ # \p`N``1,28`[\p`L`\p`N`]`. The caller must have `resourcemanager.folders.update`
309
+ # permission on the identified folder. If the update fails due to the unique
310
+ # name constraint then a PreconditionFailure explaining this violation will be
311
+ # returned in the Status.details field.
312
+ # @param [String] name
313
+ # Output only. The resource name of the Folder. Its format is `folders/`
314
+ # folder_id``, for example: "folders/1234".
315
+ # @param [Google::Apis::CloudresourcemanagerV2::Folder] folder_object
316
+ # @param [String] update_mask
317
+ # Required. Fields to be updated. Only the `display_name` can be updated.
318
+ # @param [String] fields
319
+ # Selector specifying which fields to include in a partial response.
320
+ # @param [String] quota_user
321
+ # Available to use for quota purposes for server-side applications. Can be any
322
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
323
+ # @param [Google::Apis::RequestOptions] options
324
+ # Request-specific options
325
+ #
326
+ # @yield [result, err] Result & error if block supplied
327
+ # @yieldparam result [Google::Apis::CloudresourcemanagerV2::Folder] parsed result object
328
+ # @yieldparam err [StandardError] error object if request failed
329
+ #
330
+ # @return [Google::Apis::CloudresourcemanagerV2::Folder]
331
+ #
332
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
333
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
334
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
335
+ def patch_folder(name, folder_object = nil, update_mask: nil, fields: nil, quota_user: nil, options: nil, &block)
336
+ command = make_simple_command(:patch, 'v2/{+name}', options)
337
+ command.request_representation = Google::Apis::CloudresourcemanagerV2::Folder::Representation
338
+ command.request_object = folder_object
339
+ command.response_representation = Google::Apis::CloudresourcemanagerV2::Folder::Representation
340
+ command.response_class = Google::Apis::CloudresourcemanagerV2::Folder
341
+ command.params['name'] = name unless name.nil?
342
+ command.query['updateMask'] = update_mask unless update_mask.nil?
343
+ command.query['fields'] = fields unless fields.nil?
344
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
345
+ execute_or_queue_command(command, &block)
346
+ end
347
+
348
+ # Search for folders that match specific filter criteria. Search provides an
349
+ # eventually consistent view of the folders a user has access to which meet the
350
+ # specified filter criteria. This will only return folders on which the caller
351
+ # has the permission `resourcemanager.folders.get`.
352
+ # @param [Google::Apis::CloudresourcemanagerV2::SearchFoldersRequest] search_folders_request_object
353
+ # @param [String] fields
354
+ # Selector specifying which fields to include in a partial response.
355
+ # @param [String] quota_user
356
+ # Available to use for quota purposes for server-side applications. Can be any
357
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
358
+ # @param [Google::Apis::RequestOptions] options
359
+ # Request-specific options
360
+ #
361
+ # @yield [result, err] Result & error if block supplied
362
+ # @yieldparam result [Google::Apis::CloudresourcemanagerV2::SearchFoldersResponse] parsed result object
363
+ # @yieldparam err [StandardError] error object if request failed
364
+ #
365
+ # @return [Google::Apis::CloudresourcemanagerV2::SearchFoldersResponse]
366
+ #
367
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
368
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
369
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
370
+ def search_folders(search_folders_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
371
+ command = make_simple_command(:post, 'v2/folders:search', options)
372
+ command.request_representation = Google::Apis::CloudresourcemanagerV2::SearchFoldersRequest::Representation
373
+ command.request_object = search_folders_request_object
374
+ command.response_representation = Google::Apis::CloudresourcemanagerV2::SearchFoldersResponse::Representation
375
+ command.response_class = Google::Apis::CloudresourcemanagerV2::SearchFoldersResponse
376
+ command.query['fields'] = fields unless fields.nil?
377
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
378
+ execute_or_queue_command(command, &block)
379
+ end
380
+
381
+ # Sets the access control policy on a Folder, replacing any existing policy. The
382
+ # `resource` field should be the Folder's resource name, e.g. "folders/1234".
383
+ # The caller must have `resourcemanager.folders.setIamPolicy` permission on the
384
+ # identified folder.
385
+ # @param [String] resource
386
+ # REQUIRED: The resource for which the policy is being specified. See the
387
+ # operation documentation for the appropriate value for this field.
388
+ # @param [Google::Apis::CloudresourcemanagerV2::SetIamPolicyRequest] set_iam_policy_request_object
389
+ # @param [String] fields
390
+ # Selector specifying which fields to include in a partial response.
391
+ # @param [String] quota_user
392
+ # Available to use for quota purposes for server-side applications. Can be any
393
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
394
+ # @param [Google::Apis::RequestOptions] options
395
+ # Request-specific options
396
+ #
397
+ # @yield [result, err] Result & error if block supplied
398
+ # @yieldparam result [Google::Apis::CloudresourcemanagerV2::Policy] parsed result object
399
+ # @yieldparam err [StandardError] error object if request failed
400
+ #
401
+ # @return [Google::Apis::CloudresourcemanagerV2::Policy]
402
+ #
403
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
404
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
405
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
406
+ def set_folder_iam_policy(resource, set_iam_policy_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
407
+ command = make_simple_command(:post, 'v2/{+resource}:setIamPolicy', options)
408
+ command.request_representation = Google::Apis::CloudresourcemanagerV2::SetIamPolicyRequest::Representation
409
+ command.request_object = set_iam_policy_request_object
410
+ command.response_representation = Google::Apis::CloudresourcemanagerV2::Policy::Representation
411
+ command.response_class = Google::Apis::CloudresourcemanagerV2::Policy
412
+ command.params['resource'] = resource unless resource.nil?
413
+ command.query['fields'] = fields unless fields.nil?
414
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
415
+ execute_or_queue_command(command, &block)
416
+ end
417
+
418
+ # Returns permissions that a caller has on the specified Folder. The `resource`
419
+ # field should be the Folder's resource name, e.g. "folders/1234". There are no
420
+ # permissions required for making this API call.
421
+ # @param [String] resource
422
+ # REQUIRED: The resource for which the policy detail is being requested. See the
423
+ # operation documentation for the appropriate value for this field.
424
+ # @param [Google::Apis::CloudresourcemanagerV2::TestIamPermissionsRequest] test_iam_permissions_request_object
425
+ # @param [String] fields
426
+ # Selector specifying which fields to include in a partial response.
427
+ # @param [String] quota_user
428
+ # Available to use for quota purposes for server-side applications. Can be any
429
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
430
+ # @param [Google::Apis::RequestOptions] options
431
+ # Request-specific options
432
+ #
433
+ # @yield [result, err] Result & error if block supplied
434
+ # @yieldparam result [Google::Apis::CloudresourcemanagerV2::TestIamPermissionsResponse] parsed result object
435
+ # @yieldparam err [StandardError] error object if request failed
436
+ #
437
+ # @return [Google::Apis::CloudresourcemanagerV2::TestIamPermissionsResponse]
438
+ #
439
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
440
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
441
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
442
+ def test_folder_iam_permissions(resource, test_iam_permissions_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
443
+ command = make_simple_command(:post, 'v2/{+resource}:testIamPermissions', options)
444
+ command.request_representation = Google::Apis::CloudresourcemanagerV2::TestIamPermissionsRequest::Representation
445
+ command.request_object = test_iam_permissions_request_object
446
+ command.response_representation = Google::Apis::CloudresourcemanagerV2::TestIamPermissionsResponse::Representation
447
+ command.response_class = Google::Apis::CloudresourcemanagerV2::TestIamPermissionsResponse
448
+ command.params['resource'] = resource unless resource.nil?
449
+ command.query['fields'] = fields unless fields.nil?
450
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
451
+ execute_or_queue_command(command, &block)
452
+ end
453
+
454
+ # Cancels the deletion request for a Folder. This method may only be called on a
455
+ # Folder in the DELETE_REQUESTED state. In order to succeed, the Folder's parent
456
+ # must be in the ACTIVE state. In addition, reintroducing the folder into the
457
+ # tree must not violate folder naming, height and fanout constraints described
458
+ # in the CreateFolder documentation. The caller must have `resourcemanager.
459
+ # folders.undelete` permission on the identified folder.
460
+ # @param [String] name
461
+ # Required. The resource name of the Folder to undelete. Must be of the form `
462
+ # folders/`folder_id``.
463
+ # @param [Google::Apis::CloudresourcemanagerV2::UndeleteFolderRequest] undelete_folder_request_object
464
+ # @param [String] fields
465
+ # Selector specifying which fields to include in a partial response.
466
+ # @param [String] quota_user
467
+ # Available to use for quota purposes for server-side applications. Can be any
468
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
469
+ # @param [Google::Apis::RequestOptions] options
470
+ # Request-specific options
471
+ #
472
+ # @yield [result, err] Result & error if block supplied
473
+ # @yieldparam result [Google::Apis::CloudresourcemanagerV2::Folder] parsed result object
474
+ # @yieldparam err [StandardError] error object if request failed
475
+ #
476
+ # @return [Google::Apis::CloudresourcemanagerV2::Folder]
477
+ #
478
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
479
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
480
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
481
+ def undelete_folder(name, undelete_folder_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
482
+ command = make_simple_command(:post, 'v2/{+name}:undelete', options)
483
+ command.request_representation = Google::Apis::CloudresourcemanagerV2::UndeleteFolderRequest::Representation
484
+ command.request_object = undelete_folder_request_object
485
+ command.response_representation = Google::Apis::CloudresourcemanagerV2::Folder::Representation
486
+ command.response_class = Google::Apis::CloudresourcemanagerV2::Folder
487
+ command.params['name'] = name unless name.nil?
488
+ command.query['fields'] = fields unless fields.nil?
489
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
490
+ execute_or_queue_command(command, &block)
491
+ end
492
+
493
+ # Gets the latest state of a long-running operation. Clients can use this method
494
+ # to poll the operation result at intervals as recommended by the API service.
495
+ # @param [String] name
496
+ # The name of the operation resource.
497
+ # @param [String] fields
498
+ # Selector specifying which fields to include in a partial response.
499
+ # @param [String] quota_user
500
+ # Available to use for quota purposes for server-side applications. Can be any
501
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
502
+ # @param [Google::Apis::RequestOptions] options
503
+ # Request-specific options
504
+ #
505
+ # @yield [result, err] Result & error if block supplied
506
+ # @yieldparam result [Google::Apis::CloudresourcemanagerV2::Operation] parsed result object
507
+ # @yieldparam err [StandardError] error object if request failed
508
+ #
509
+ # @return [Google::Apis::CloudresourcemanagerV2::Operation]
510
+ #
511
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
512
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
513
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
514
+ def get_operation(name, fields: nil, quota_user: nil, options: nil, &block)
515
+ command = make_simple_command(:get, 'v1/{+name}', options)
516
+ command.response_representation = Google::Apis::CloudresourcemanagerV2::Operation::Representation
517
+ command.response_class = Google::Apis::CloudresourcemanagerV2::Operation
518
+ command.params['name'] = name unless name.nil?
519
+ command.query['fields'] = fields unless fields.nil?
520
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
521
+ execute_or_queue_command(command, &block)
522
+ end
523
+
524
+ protected
525
+
526
+ def apply_command_defaults(command)
527
+ command.query['key'] = key unless key.nil?
528
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
529
+ end
530
+ end
531
+ end
532
+ end
533
+ end