google-cloud-resource_manager-v3 0.3.0 → 0.4.0

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