google-apis-cloudresourcemanager_v1beta1 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,702 @@
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 CloudresourcemanagerV1beta1
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_v1beta1'
30
+ #
31
+ # Cloudresourcemanager = Google::Apis::CloudresourcemanagerV1beta1 # 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_v1beta1',
49
+ client_version: Google::Apis::CloudresourcemanagerV1beta1::GEM_VERSION)
50
+ @batch_path = 'batch'
51
+ end
52
+
53
+ # Fetches an Organization resource identified by the specified resource name.
54
+ # @param [String] name
55
+ # The resource name of the Organization to fetch. This is the organization's
56
+ # relative path in the API, formatted as "organizations/[organizationId]". For
57
+ # example, "organizations/1234".
58
+ # @param [String] organization_id
59
+ # The id of the Organization resource to fetch. This field is deprecated and
60
+ # will be removed in v1. Use name instead.
61
+ # @param [String] fields
62
+ # Selector specifying which fields to include in a partial response.
63
+ # @param [String] quota_user
64
+ # Available to use for quota purposes for server-side applications. Can be any
65
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
66
+ # @param [Google::Apis::RequestOptions] options
67
+ # Request-specific options
68
+ #
69
+ # @yield [result, err] Result & error if block supplied
70
+ # @yieldparam result [Google::Apis::CloudresourcemanagerV1beta1::Organization] parsed result object
71
+ # @yieldparam err [StandardError] error object if request failed
72
+ #
73
+ # @return [Google::Apis::CloudresourcemanagerV1beta1::Organization]
74
+ #
75
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
76
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
77
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
78
+ def get_organization(name, organization_id: nil, fields: nil, quota_user: nil, options: nil, &block)
79
+ command = make_simple_command(:get, 'v1beta1/{+name}', options)
80
+ command.response_representation = Google::Apis::CloudresourcemanagerV1beta1::Organization::Representation
81
+ command.response_class = Google::Apis::CloudresourcemanagerV1beta1::Organization
82
+ command.params['name'] = name unless name.nil?
83
+ command.query['organizationId'] = organization_id unless organization_id.nil?
84
+ command.query['fields'] = fields unless fields.nil?
85
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
86
+ execute_or_queue_command(command, &block)
87
+ end
88
+
89
+ # Gets the access control policy for an Organization resource. May be empty if
90
+ # no such policy or resource exists. The `resource` field should be the
91
+ # organization's resource name, e.g. "organizations/123".
92
+ # @param [String] resource
93
+ # REQUIRED: The resource for which the policy is being requested. See the
94
+ # operation documentation for the appropriate value for this field.
95
+ # @param [Google::Apis::CloudresourcemanagerV1beta1::GetIamPolicyRequest] get_iam_policy_request_object
96
+ # @param [String] fields
97
+ # Selector specifying which fields to include in a partial response.
98
+ # @param [String] quota_user
99
+ # Available to use for quota purposes for server-side applications. Can be any
100
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
101
+ # @param [Google::Apis::RequestOptions] options
102
+ # Request-specific options
103
+ #
104
+ # @yield [result, err] Result & error if block supplied
105
+ # @yieldparam result [Google::Apis::CloudresourcemanagerV1beta1::Policy] parsed result object
106
+ # @yieldparam err [StandardError] error object if request failed
107
+ #
108
+ # @return [Google::Apis::CloudresourcemanagerV1beta1::Policy]
109
+ #
110
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
111
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
112
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
113
+ def get_organization_iam_policy(resource, get_iam_policy_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
114
+ command = make_simple_command(:post, 'v1beta1/{+resource}:getIamPolicy', options)
115
+ command.request_representation = Google::Apis::CloudresourcemanagerV1beta1::GetIamPolicyRequest::Representation
116
+ command.request_object = get_iam_policy_request_object
117
+ command.response_representation = Google::Apis::CloudresourcemanagerV1beta1::Policy::Representation
118
+ command.response_class = Google::Apis::CloudresourcemanagerV1beta1::Policy
119
+ command.params['resource'] = resource unless resource.nil?
120
+ command.query['fields'] = fields unless fields.nil?
121
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
122
+ execute_or_queue_command(command, &block)
123
+ end
124
+
125
+ # Lists Organization resources that are visible to the user and satisfy the
126
+ # specified filter. This method returns Organizations in an unspecified order.
127
+ # New Organizations do not necessarily appear at the end of the list.
128
+ # @param [String] filter
129
+ # An optional query string used to filter the Organizations to return in the
130
+ # response. Filter rules are case-insensitive. Organizations may be filtered by `
131
+ # owner.directoryCustomerId` or by `domain`, where the domain is a G Suite
132
+ # domain, for example: * Filter `owner.directorycustomerid:123456789` returns
133
+ # Organization resources with `owner.directory_customer_id` equal to `123456789`.
134
+ # * Filter `domain:google.com` returns Organization resources corresponding to
135
+ # the domain `google.com`. This field is optional.
136
+ # @param [Fixnum] page_size
137
+ # The maximum number of Organizations to return in the response. This field is
138
+ # optional.
139
+ # @param [String] page_token
140
+ # A pagination token returned from a previous call to `ListOrganizations` that
141
+ # indicates from where listing should continue. This field is optional.
142
+ # @param [String] fields
143
+ # Selector specifying which fields to include in a partial response.
144
+ # @param [String] quota_user
145
+ # Available to use for quota purposes for server-side applications. Can be any
146
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
147
+ # @param [Google::Apis::RequestOptions] options
148
+ # Request-specific options
149
+ #
150
+ # @yield [result, err] Result & error if block supplied
151
+ # @yieldparam result [Google::Apis::CloudresourcemanagerV1beta1::ListOrganizationsResponse] parsed result object
152
+ # @yieldparam err [StandardError] error object if request failed
153
+ #
154
+ # @return [Google::Apis::CloudresourcemanagerV1beta1::ListOrganizationsResponse]
155
+ #
156
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
157
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
158
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
159
+ def list_organizations(filter: nil, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil, &block)
160
+ command = make_simple_command(:get, 'v1beta1/organizations', options)
161
+ command.response_representation = Google::Apis::CloudresourcemanagerV1beta1::ListOrganizationsResponse::Representation
162
+ command.response_class = Google::Apis::CloudresourcemanagerV1beta1::ListOrganizationsResponse
163
+ command.query['filter'] = filter unless filter.nil?
164
+ command.query['pageSize'] = page_size unless page_size.nil?
165
+ command.query['pageToken'] = page_token unless page_token.nil?
166
+ command.query['fields'] = fields unless fields.nil?
167
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
168
+ execute_or_queue_command(command, &block)
169
+ end
170
+
171
+ # Sets the access control policy on an Organization resource. Replaces any
172
+ # existing policy. The `resource` field should be the organization's resource
173
+ # name, e.g. "organizations/123".
174
+ # @param [String] resource
175
+ # REQUIRED: The resource for which the policy is being specified. See the
176
+ # operation documentation for the appropriate value for this field.
177
+ # @param [Google::Apis::CloudresourcemanagerV1beta1::SetIamPolicyRequest] set_iam_policy_request_object
178
+ # @param [String] fields
179
+ # Selector specifying which fields to include in a partial response.
180
+ # @param [String] quota_user
181
+ # Available to use for quota purposes for server-side applications. Can be any
182
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
183
+ # @param [Google::Apis::RequestOptions] options
184
+ # Request-specific options
185
+ #
186
+ # @yield [result, err] Result & error if block supplied
187
+ # @yieldparam result [Google::Apis::CloudresourcemanagerV1beta1::Policy] parsed result object
188
+ # @yieldparam err [StandardError] error object if request failed
189
+ #
190
+ # @return [Google::Apis::CloudresourcemanagerV1beta1::Policy]
191
+ #
192
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
193
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
194
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
195
+ def set_organization_iam_policy(resource, set_iam_policy_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
196
+ command = make_simple_command(:post, 'v1beta1/{+resource}:setIamPolicy', options)
197
+ command.request_representation = Google::Apis::CloudresourcemanagerV1beta1::SetIamPolicyRequest::Representation
198
+ command.request_object = set_iam_policy_request_object
199
+ command.response_representation = Google::Apis::CloudresourcemanagerV1beta1::Policy::Representation
200
+ command.response_class = Google::Apis::CloudresourcemanagerV1beta1::Policy
201
+ command.params['resource'] = resource unless resource.nil?
202
+ command.query['fields'] = fields unless fields.nil?
203
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
204
+ execute_or_queue_command(command, &block)
205
+ end
206
+
207
+ # Returns permissions that a caller has on the specified Organization. The `
208
+ # resource` field should be the organization's resource name, e.g. "
209
+ # organizations/123".
210
+ # @param [String] resource
211
+ # REQUIRED: The resource for which the policy detail is being requested. See the
212
+ # operation documentation for the appropriate value for this field.
213
+ # @param [Google::Apis::CloudresourcemanagerV1beta1::TestIamPermissionsRequest] test_iam_permissions_request_object
214
+ # @param [String] fields
215
+ # Selector specifying which fields to include in a partial response.
216
+ # @param [String] quota_user
217
+ # Available to use for quota purposes for server-side applications. Can be any
218
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
219
+ # @param [Google::Apis::RequestOptions] options
220
+ # Request-specific options
221
+ #
222
+ # @yield [result, err] Result & error if block supplied
223
+ # @yieldparam result [Google::Apis::CloudresourcemanagerV1beta1::TestIamPermissionsResponse] parsed result object
224
+ # @yieldparam err [StandardError] error object if request failed
225
+ #
226
+ # @return [Google::Apis::CloudresourcemanagerV1beta1::TestIamPermissionsResponse]
227
+ #
228
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
229
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
230
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
231
+ def test_organization_iam_permissions(resource, test_iam_permissions_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
232
+ command = make_simple_command(:post, 'v1beta1/{+resource}:testIamPermissions', options)
233
+ command.request_representation = Google::Apis::CloudresourcemanagerV1beta1::TestIamPermissionsRequest::Representation
234
+ command.request_object = test_iam_permissions_request_object
235
+ command.response_representation = Google::Apis::CloudresourcemanagerV1beta1::TestIamPermissionsResponse::Representation
236
+ command.response_class = Google::Apis::CloudresourcemanagerV1beta1::TestIamPermissionsResponse
237
+ command.params['resource'] = resource unless resource.nil?
238
+ command.query['fields'] = fields unless fields.nil?
239
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
240
+ execute_or_queue_command(command, &block)
241
+ end
242
+
243
+ # Updates an Organization resource identified by the specified resource name.
244
+ # @param [String] name
245
+ # Output only. The resource name of the organization. This is the organization's
246
+ # relative path in the API. Its format is "organizations/[organization_id]". For
247
+ # example, "organizations/1234".
248
+ # @param [Google::Apis::CloudresourcemanagerV1beta1::Organization] organization_object
249
+ # @param [String] fields
250
+ # Selector specifying which fields to include in a partial response.
251
+ # @param [String] quota_user
252
+ # Available to use for quota purposes for server-side applications. Can be any
253
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
254
+ # @param [Google::Apis::RequestOptions] options
255
+ # Request-specific options
256
+ #
257
+ # @yield [result, err] Result & error if block supplied
258
+ # @yieldparam result [Google::Apis::CloudresourcemanagerV1beta1::Organization] parsed result object
259
+ # @yieldparam err [StandardError] error object if request failed
260
+ #
261
+ # @return [Google::Apis::CloudresourcemanagerV1beta1::Organization]
262
+ #
263
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
264
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
265
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
266
+ def update_organization(name, organization_object = nil, fields: nil, quota_user: nil, options: nil, &block)
267
+ command = make_simple_command(:put, 'v1beta1/{+name}', options)
268
+ command.request_representation = Google::Apis::CloudresourcemanagerV1beta1::Organization::Representation
269
+ command.request_object = organization_object
270
+ command.response_representation = Google::Apis::CloudresourcemanagerV1beta1::Organization::Representation
271
+ command.response_class = Google::Apis::CloudresourcemanagerV1beta1::Organization
272
+ command.params['name'] = name unless name.nil?
273
+ command.query['fields'] = fields unless fields.nil?
274
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
275
+ execute_or_queue_command(command, &block)
276
+ end
277
+
278
+ # Creates a Project resource. Initially, the Project resource is owned by its
279
+ # creator exclusively. The creator can later grant permission to others to read
280
+ # or update the Project. Several APIs are activated automatically for the
281
+ # Project, including Google Cloud Storage. The parent is identified by a
282
+ # specified ResourceId, which must include both an ID and a type, such as
283
+ # project, folder, or organization. This method does not associate the new
284
+ # project with a billing account. You can set or update the billing account
285
+ # associated with a project using the [`projects.updateBillingInfo`] (/billing/
286
+ # reference/rest/v1/projects/updateBillingInfo) method.
287
+ # @param [Google::Apis::CloudresourcemanagerV1beta1::Project] project_object
288
+ # @param [Boolean] use_legacy_stack
289
+ # A now unused experiment opt-out option.
290
+ # @param [String] fields
291
+ # Selector specifying which fields to include in a partial response.
292
+ # @param [String] quota_user
293
+ # Available to use for quota purposes for server-side applications. Can be any
294
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
295
+ # @param [Google::Apis::RequestOptions] options
296
+ # Request-specific options
297
+ #
298
+ # @yield [result, err] Result & error if block supplied
299
+ # @yieldparam result [Google::Apis::CloudresourcemanagerV1beta1::Project] parsed result object
300
+ # @yieldparam err [StandardError] error object if request failed
301
+ #
302
+ # @return [Google::Apis::CloudresourcemanagerV1beta1::Project]
303
+ #
304
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
305
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
306
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
307
+ def create_project(project_object = nil, use_legacy_stack: nil, fields: nil, quota_user: nil, options: nil, &block)
308
+ command = make_simple_command(:post, 'v1beta1/projects', options)
309
+ command.request_representation = Google::Apis::CloudresourcemanagerV1beta1::Project::Representation
310
+ command.request_object = project_object
311
+ command.response_representation = Google::Apis::CloudresourcemanagerV1beta1::Project::Representation
312
+ command.response_class = Google::Apis::CloudresourcemanagerV1beta1::Project
313
+ command.query['useLegacyStack'] = use_legacy_stack unless use_legacy_stack.nil?
314
+ command.query['fields'] = fields unless fields.nil?
315
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
316
+ execute_or_queue_command(command, &block)
317
+ end
318
+
319
+ # Marks the Project identified by the specified `project_id` (for example, `my-
320
+ # project-123`) for deletion. This method will only affect the Project if it has
321
+ # a lifecycle state of ACTIVE. This method changes the Project's lifecycle state
322
+ # from ACTIVE to DELETE_REQUESTED. The deletion starts at an unspecified time,
323
+ # at which point the project is no longer accessible. Until the deletion
324
+ # completes, you can check the lifecycle state checked by retrieving the Project
325
+ # with GetProject, and the Project remains visible to ListProjects. However, you
326
+ # cannot update the project. After the deletion completes, the Project is not
327
+ # retrievable by the GetProject and ListProjects methods. The caller must have
328
+ # delete permissions for this Project.
329
+ # @param [String] project_id
330
+ # The Project ID (for example, `foo-bar-123`).
331
+ # @param [String] fields
332
+ # Selector specifying which fields to include in a partial response.
333
+ # @param [String] quota_user
334
+ # Available to use for quota purposes for server-side applications. Can be any
335
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
336
+ # @param [Google::Apis::RequestOptions] options
337
+ # Request-specific options
338
+ #
339
+ # @yield [result, err] Result & error if block supplied
340
+ # @yieldparam result [Google::Apis::CloudresourcemanagerV1beta1::Empty] parsed result object
341
+ # @yieldparam err [StandardError] error object if request failed
342
+ #
343
+ # @return [Google::Apis::CloudresourcemanagerV1beta1::Empty]
344
+ #
345
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
346
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
347
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
348
+ def delete_project(project_id, fields: nil, quota_user: nil, options: nil, &block)
349
+ command = make_simple_command(:delete, 'v1beta1/projects/{projectId}', options)
350
+ command.response_representation = Google::Apis::CloudresourcemanagerV1beta1::Empty::Representation
351
+ command.response_class = Google::Apis::CloudresourcemanagerV1beta1::Empty
352
+ command.params['projectId'] = project_id unless project_id.nil?
353
+ command.query['fields'] = fields unless fields.nil?
354
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
355
+ execute_or_queue_command(command, &block)
356
+ end
357
+
358
+ # Retrieves the Project identified by the specified `project_id` (for example, `
359
+ # my-project-123`). The caller must have read permissions for this Project.
360
+ # @param [String] project_id
361
+ # Required. The Project ID (for example, `my-project-123`).
362
+ # @param [String] fields
363
+ # Selector specifying which fields to include in a partial response.
364
+ # @param [String] quota_user
365
+ # Available to use for quota purposes for server-side applications. Can be any
366
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
367
+ # @param [Google::Apis::RequestOptions] options
368
+ # Request-specific options
369
+ #
370
+ # @yield [result, err] Result & error if block supplied
371
+ # @yieldparam result [Google::Apis::CloudresourcemanagerV1beta1::Project] parsed result object
372
+ # @yieldparam err [StandardError] error object if request failed
373
+ #
374
+ # @return [Google::Apis::CloudresourcemanagerV1beta1::Project]
375
+ #
376
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
377
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
378
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
379
+ def get_project(project_id, fields: nil, quota_user: nil, options: nil, &block)
380
+ command = make_simple_command(:get, 'v1beta1/projects/{projectId}', options)
381
+ command.response_representation = Google::Apis::CloudresourcemanagerV1beta1::Project::Representation
382
+ command.response_class = Google::Apis::CloudresourcemanagerV1beta1::Project
383
+ command.params['projectId'] = project_id unless project_id.nil?
384
+ command.query['fields'] = fields unless fields.nil?
385
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
386
+ execute_or_queue_command(command, &block)
387
+ end
388
+
389
+ # Gets a list of ancestors in the resource hierarchy for the Project identified
390
+ # by the specified `project_id` (for example, `my-project-123`). The caller must
391
+ # have read permissions for this Project.
392
+ # @param [String] project_id
393
+ # Required. The Project ID (for example, `my-project-123`).
394
+ # @param [Google::Apis::CloudresourcemanagerV1beta1::GetAncestryRequest] get_ancestry_request_object
395
+ # @param [String] fields
396
+ # Selector specifying which fields to include in a partial response.
397
+ # @param [String] quota_user
398
+ # Available to use for quota purposes for server-side applications. Can be any
399
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
400
+ # @param [Google::Apis::RequestOptions] options
401
+ # Request-specific options
402
+ #
403
+ # @yield [result, err] Result & error if block supplied
404
+ # @yieldparam result [Google::Apis::CloudresourcemanagerV1beta1::GetAncestryResponse] parsed result object
405
+ # @yieldparam err [StandardError] error object if request failed
406
+ #
407
+ # @return [Google::Apis::CloudresourcemanagerV1beta1::GetAncestryResponse]
408
+ #
409
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
410
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
411
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
412
+ def get_project_ancestry(project_id, get_ancestry_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
413
+ command = make_simple_command(:post, 'v1beta1/projects/{projectId}:getAncestry', options)
414
+ command.request_representation = Google::Apis::CloudresourcemanagerV1beta1::GetAncestryRequest::Representation
415
+ command.request_object = get_ancestry_request_object
416
+ command.response_representation = Google::Apis::CloudresourcemanagerV1beta1::GetAncestryResponse::Representation
417
+ command.response_class = Google::Apis::CloudresourcemanagerV1beta1::GetAncestryResponse
418
+ command.params['projectId'] = project_id unless project_id.nil?
419
+ command.query['fields'] = fields unless fields.nil?
420
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
421
+ execute_or_queue_command(command, &block)
422
+ end
423
+
424
+ # Returns the IAM access control policy for the specified Project. Permission is
425
+ # denied if the policy or the resource does not exist. For additional
426
+ # information about resource structure and identification, see [Resource Names](/
427
+ # apis/design/resource_names).
428
+ # @param [String] resource
429
+ # REQUIRED: The resource for which the policy is being requested. See the
430
+ # operation documentation for the appropriate value for this field.
431
+ # @param [Google::Apis::CloudresourcemanagerV1beta1::GetIamPolicyRequest] get_iam_policy_request_object
432
+ # @param [String] fields
433
+ # Selector specifying which fields to include in a partial response.
434
+ # @param [String] quota_user
435
+ # Available to use for quota purposes for server-side applications. Can be any
436
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
437
+ # @param [Google::Apis::RequestOptions] options
438
+ # Request-specific options
439
+ #
440
+ # @yield [result, err] Result & error if block supplied
441
+ # @yieldparam result [Google::Apis::CloudresourcemanagerV1beta1::Policy] parsed result object
442
+ # @yieldparam err [StandardError] error object if request failed
443
+ #
444
+ # @return [Google::Apis::CloudresourcemanagerV1beta1::Policy]
445
+ #
446
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
447
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
448
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
449
+ def get_project_iam_policy(resource, get_iam_policy_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
450
+ command = make_simple_command(:post, 'v1beta1/projects/{resource}:getIamPolicy', options)
451
+ command.request_representation = Google::Apis::CloudresourcemanagerV1beta1::GetIamPolicyRequest::Representation
452
+ command.request_object = get_iam_policy_request_object
453
+ command.response_representation = Google::Apis::CloudresourcemanagerV1beta1::Policy::Representation
454
+ command.response_class = Google::Apis::CloudresourcemanagerV1beta1::Policy
455
+ command.params['resource'] = resource unless resource.nil?
456
+ command.query['fields'] = fields unless fields.nil?
457
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
458
+ execute_or_queue_command(command, &block)
459
+ end
460
+
461
+ # Lists Projects that the caller has the `resourcemanager.projects.get`
462
+ # permission on and satisfy the specified filter. This method returns Projects
463
+ # in an unspecified order. This method is eventually consistent with project
464
+ # mutations; this means that a newly created project may not appear in the
465
+ # results or recent updates to an existing project may not be reflected in the
466
+ # results. To retrieve the latest state of a project, use the GetProject method.
467
+ # NOTE: If the request filter contains a `parent.type` and `parent.id` and the
468
+ # caller has the `resourcemanager.projects.list` permission on the parent, the
469
+ # results will be drawn from an alternate index which provides more consistent
470
+ # results. In future versions of this API, this List method will be split into
471
+ # List and Search to properly capture the behavioral difference.
472
+ # @param [String] filter
473
+ # An expression for filtering the results of the request. Filter rules are case
474
+ # insensitive. If multiple fields are included in a filter query, the query will
475
+ # return results that match any of the fields. Some eligible fields for
476
+ # filtering are: + `name` + `id` + `labels.` (where *key* is the name of a label)
477
+ # + `parent.type` + `parent.id` Some examples of using labels as filters: |
478
+ # Filter | Description | |------------------|------------------------------------
479
+ # -----------------| | name:how* | The project's name starts with "how". | |
480
+ # name:Howl | The project's name is `Howl` or `howl`. | | name:HOWL | Equivalent
481
+ # to above. | | NAME:howl | Equivalent to above. | | labels.color:* | The
482
+ # project has the label `color`. | | labels.color:red | The project's label `
483
+ # color` has the value `red`. | | labels.color:red labels.size:big |The project'
484
+ # s label `color` has the value `red` and its label `size` has the value `big`. |
485
+ # If no filter is specified, the call will return projects for which the user
486
+ # has the `resourcemanager.projects.get` permission. NOTE: To perform a by-
487
+ # parent query (eg., what projects are directly in a Folder), the caller must
488
+ # have the `resourcemanager.projects.list` permission on the parent and the
489
+ # filter must contain both a `parent.type` and a `parent.id` restriction (
490
+ # example: "parent.type:folder parent.id:123"). In this case an alternate search
491
+ # index is used which provides more consistent results. Optional.
492
+ # @param [Fixnum] page_size
493
+ # The maximum number of Projects to return in the response. The server can
494
+ # return fewer Projects than requested. If unspecified, server picks an
495
+ # appropriate default. Optional.
496
+ # @param [String] page_token
497
+ # A pagination token returned from a previous call to ListProjects that
498
+ # indicates from where listing should continue. Optional.
499
+ # @param [String] fields
500
+ # Selector specifying which fields to include in a partial response.
501
+ # @param [String] quota_user
502
+ # Available to use for quota purposes for server-side applications. Can be any
503
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
504
+ # @param [Google::Apis::RequestOptions] options
505
+ # Request-specific options
506
+ #
507
+ # @yield [result, err] Result & error if block supplied
508
+ # @yieldparam result [Google::Apis::CloudresourcemanagerV1beta1::ListProjectsResponse] parsed result object
509
+ # @yieldparam err [StandardError] error object if request failed
510
+ #
511
+ # @return [Google::Apis::CloudresourcemanagerV1beta1::ListProjectsResponse]
512
+ #
513
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
514
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
515
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
516
+ def list_projects(filter: nil, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil, &block)
517
+ command = make_simple_command(:get, 'v1beta1/projects', options)
518
+ command.response_representation = Google::Apis::CloudresourcemanagerV1beta1::ListProjectsResponse::Representation
519
+ command.response_class = Google::Apis::CloudresourcemanagerV1beta1::ListProjectsResponse
520
+ command.query['filter'] = filter unless filter.nil?
521
+ command.query['pageSize'] = page_size unless page_size.nil?
522
+ command.query['pageToken'] = page_token unless page_token.nil?
523
+ command.query['fields'] = fields unless fields.nil?
524
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
525
+ execute_or_queue_command(command, &block)
526
+ end
527
+
528
+ # Sets the IAM access control policy for the specified Project. CAUTION: This
529
+ # method will replace the existing policy, and cannot be used to append
530
+ # additional IAM settings. NOTE: Removing service accounts from policies or
531
+ # changing their roles can render services completely inoperable. It is
532
+ # important to understand how the service account is being used before removing
533
+ # or updating its roles. The following constraints apply when using `
534
+ # setIamPolicy()`: + Project does not support `allUsers` and `
535
+ # allAuthenticatedUsers` as `members` in a `Binding` of a `Policy`. + The owner
536
+ # role can be granted to a `user`, `serviceAccount`, or a group that is part of
537
+ # an organization. For example, group@myownpersonaldomain.com could be added as
538
+ # an owner to a project in the myownpersonaldomain.com organization, but not the
539
+ # examplepetstore.com organization. + Service accounts can be made owners of a
540
+ # project directly without any restrictions. However, to be added as an owner, a
541
+ # user must be invited via Cloud Platform console and must accept the invitation.
542
+ # + A user cannot be granted the owner role using `setIamPolicy()`. The user
543
+ # must be granted the owner role using the Cloud Platform Console and must
544
+ # explicitly accept the invitation. + Invitations to grant the owner role cannot
545
+ # be sent using `setIamPolicy()`; they must be sent only using the Cloud
546
+ # Platform Console. + Membership changes that leave the project without any
547
+ # owners that have accepted the Terms of Service (ToS) will be rejected. + If
548
+ # the project is not part of an organization, there must be at least one owner
549
+ # who has accepted the Terms of Service (ToS) agreement in the policy. Calling `
550
+ # setIamPolicy()` to remove the last ToS-accepted owner from the policy will
551
+ # fail. This restriction also applies to legacy projects that no longer have
552
+ # owners who have accepted the ToS. Edits to IAM policies will be rejected until
553
+ # the lack of a ToS-accepting owner is rectified. Authorization requires the
554
+ # Google IAM permission `resourcemanager.projects.setIamPolicy` on the project
555
+ # @param [String] resource
556
+ # REQUIRED: The resource for which the policy is being specified. See the
557
+ # operation documentation for the appropriate value for this field.
558
+ # @param [Google::Apis::CloudresourcemanagerV1beta1::SetIamPolicyRequest] set_iam_policy_request_object
559
+ # @param [String] fields
560
+ # Selector specifying which fields to include in a partial response.
561
+ # @param [String] quota_user
562
+ # Available to use for quota purposes for server-side applications. Can be any
563
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
564
+ # @param [Google::Apis::RequestOptions] options
565
+ # Request-specific options
566
+ #
567
+ # @yield [result, err] Result & error if block supplied
568
+ # @yieldparam result [Google::Apis::CloudresourcemanagerV1beta1::Policy] parsed result object
569
+ # @yieldparam err [StandardError] error object if request failed
570
+ #
571
+ # @return [Google::Apis::CloudresourcemanagerV1beta1::Policy]
572
+ #
573
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
574
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
575
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
576
+ def set_project_iam_policy(resource, set_iam_policy_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
577
+ command = make_simple_command(:post, 'v1beta1/projects/{resource}:setIamPolicy', options)
578
+ command.request_representation = Google::Apis::CloudresourcemanagerV1beta1::SetIamPolicyRequest::Representation
579
+ command.request_object = set_iam_policy_request_object
580
+ command.response_representation = Google::Apis::CloudresourcemanagerV1beta1::Policy::Representation
581
+ command.response_class = Google::Apis::CloudresourcemanagerV1beta1::Policy
582
+ command.params['resource'] = resource unless resource.nil?
583
+ command.query['fields'] = fields unless fields.nil?
584
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
585
+ execute_or_queue_command(command, &block)
586
+ end
587
+
588
+ # Returns permissions that a caller has on the specified Project.
589
+ # @param [String] resource
590
+ # REQUIRED: The resource for which the policy detail is being requested. See the
591
+ # operation documentation for the appropriate value for this field.
592
+ # @param [Google::Apis::CloudresourcemanagerV1beta1::TestIamPermissionsRequest] test_iam_permissions_request_object
593
+ # @param [String] fields
594
+ # Selector specifying which fields to include in a partial response.
595
+ # @param [String] quota_user
596
+ # Available to use for quota purposes for server-side applications. Can be any
597
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
598
+ # @param [Google::Apis::RequestOptions] options
599
+ # Request-specific options
600
+ #
601
+ # @yield [result, err] Result & error if block supplied
602
+ # @yieldparam result [Google::Apis::CloudresourcemanagerV1beta1::TestIamPermissionsResponse] parsed result object
603
+ # @yieldparam err [StandardError] error object if request failed
604
+ #
605
+ # @return [Google::Apis::CloudresourcemanagerV1beta1::TestIamPermissionsResponse]
606
+ #
607
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
608
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
609
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
610
+ def test_project_iam_permissions(resource, test_iam_permissions_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
611
+ command = make_simple_command(:post, 'v1beta1/projects/{resource}:testIamPermissions', options)
612
+ command.request_representation = Google::Apis::CloudresourcemanagerV1beta1::TestIamPermissionsRequest::Representation
613
+ command.request_object = test_iam_permissions_request_object
614
+ command.response_representation = Google::Apis::CloudresourcemanagerV1beta1::TestIamPermissionsResponse::Representation
615
+ command.response_class = Google::Apis::CloudresourcemanagerV1beta1::TestIamPermissionsResponse
616
+ command.params['resource'] = resource unless resource.nil?
617
+ command.query['fields'] = fields unless fields.nil?
618
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
619
+ execute_or_queue_command(command, &block)
620
+ end
621
+
622
+ # Restores the Project identified by the specified `project_id` (for example, `
623
+ # my-project-123`). You can only use this method for a Project that has a
624
+ # lifecycle state of DELETE_REQUESTED. After deletion starts, the Project cannot
625
+ # be restored. The caller must have undelete permissions for this Project.
626
+ # @param [String] project_id
627
+ # Required. The project ID (for example, `foo-bar-123`).
628
+ # @param [Google::Apis::CloudresourcemanagerV1beta1::UndeleteProjectRequest] undelete_project_request_object
629
+ # @param [String] fields
630
+ # Selector specifying which fields to include in a partial response.
631
+ # @param [String] quota_user
632
+ # Available to use for quota purposes for server-side applications. Can be any
633
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
634
+ # @param [Google::Apis::RequestOptions] options
635
+ # Request-specific options
636
+ #
637
+ # @yield [result, err] Result & error if block supplied
638
+ # @yieldparam result [Google::Apis::CloudresourcemanagerV1beta1::Empty] parsed result object
639
+ # @yieldparam err [StandardError] error object if request failed
640
+ #
641
+ # @return [Google::Apis::CloudresourcemanagerV1beta1::Empty]
642
+ #
643
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
644
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
645
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
646
+ def undelete_project(project_id, undelete_project_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
647
+ command = make_simple_command(:post, 'v1beta1/projects/{projectId}:undelete', options)
648
+ command.request_representation = Google::Apis::CloudresourcemanagerV1beta1::UndeleteProjectRequest::Representation
649
+ command.request_object = undelete_project_request_object
650
+ command.response_representation = Google::Apis::CloudresourcemanagerV1beta1::Empty::Representation
651
+ command.response_class = Google::Apis::CloudresourcemanagerV1beta1::Empty
652
+ command.params['projectId'] = project_id unless project_id.nil?
653
+ command.query['fields'] = fields unless fields.nil?
654
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
655
+ execute_or_queue_command(command, &block)
656
+ end
657
+
658
+ # Updates the attributes of the Project identified by the specified `project_id`
659
+ # (for example, `my-project-123`). The caller must have modify permissions for
660
+ # this Project.
661
+ # @param [String] project_id
662
+ # The project ID (for example, `my-project-123`).
663
+ # @param [Google::Apis::CloudresourcemanagerV1beta1::Project] project_object
664
+ # @param [String] fields
665
+ # Selector specifying which fields to include in a partial response.
666
+ # @param [String] quota_user
667
+ # Available to use for quota purposes for server-side applications. Can be any
668
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
669
+ # @param [Google::Apis::RequestOptions] options
670
+ # Request-specific options
671
+ #
672
+ # @yield [result, err] Result & error if block supplied
673
+ # @yieldparam result [Google::Apis::CloudresourcemanagerV1beta1::Project] parsed result object
674
+ # @yieldparam err [StandardError] error object if request failed
675
+ #
676
+ # @return [Google::Apis::CloudresourcemanagerV1beta1::Project]
677
+ #
678
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
679
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
680
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
681
+ def update_project(project_id, project_object = nil, fields: nil, quota_user: nil, options: nil, &block)
682
+ command = make_simple_command(:put, 'v1beta1/projects/{projectId}', options)
683
+ command.request_representation = Google::Apis::CloudresourcemanagerV1beta1::Project::Representation
684
+ command.request_object = project_object
685
+ command.response_representation = Google::Apis::CloudresourcemanagerV1beta1::Project::Representation
686
+ command.response_class = Google::Apis::CloudresourcemanagerV1beta1::Project
687
+ command.params['projectId'] = project_id unless project_id.nil?
688
+ command.query['fields'] = fields unless fields.nil?
689
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
690
+ execute_or_queue_command(command, &block)
691
+ end
692
+
693
+ protected
694
+
695
+ def apply_command_defaults(command)
696
+ command.query['key'] = key unless key.nil?
697
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
698
+ end
699
+ end
700
+ end
701
+ end
702
+ end