google-cloud-resource_manager-v3 0.3.0 → 0.5.0

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