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