google-cloud-resource_manager 0.28.0 → 0.29.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE +2 -2
- data/lib/google-cloud-resource_manager.rb +22 -2
- data/lib/google/cloud/resource_manager.rb +43 -4
- data/lib/google/cloud/resource_manager/credentials.rb +8 -8
- data/lib/google/cloud/resource_manager/manager.rb +2 -2
- data/lib/google/cloud/resource_manager/policy.rb +3 -3
- data/lib/google/cloud/resource_manager/project.rb +9 -8
- data/lib/google/cloud/resource_manager/project/list.rb +3 -3
- data/lib/google/cloud/resource_manager/project/updater.rb +2 -2
- data/lib/google/cloud/resource_manager/service.rb +3 -3
- data/lib/google/cloud/resource_manager/version.rb +3 -3
- metadata +11 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8f8bc39dd1604e2f41633a4e0c696d9d1b2c50622667a31956ef530f0f080669
|
4
|
+
data.tar.gz: 5917ace0ef08d18c88a733a15c6c66d95ebeb37914dc4a3a3338d04007a0858d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ff7c80520e2d5893322f5564332d8ff062da3a85fad63a1fa644566e18dbd5e5f6ac359442712ee98e7c6d2c802cd39fb823f747caa9465314f3867d29177291
|
7
|
+
data.tar.gz: 5ff7c5dc83b5b26c9dd5a7ff3b6358eb375201c510e06a289f233158b01f84ac1b123d5d69d4aafb12892199757cb0b26f9690342c0db2f0d1ea54e761f81416
|
data/LICENSE
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Apache License
|
2
2
|
Version 2.0, January 2004
|
3
|
-
|
3
|
+
https://www.apache.org/licenses/
|
4
4
|
|
5
5
|
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
6
6
|
|
@@ -192,7 +192,7 @@
|
|
192
192
|
you may not use this file except in compliance with the License.
|
193
193
|
You may obtain a copy of the License at
|
194
194
|
|
195
|
-
|
195
|
+
https://www.apache.org/licenses/LICENSE-2.0
|
196
196
|
|
197
197
|
Unless required by applicable law or agreed to in writing, software
|
198
198
|
distributed under the License is distributed on an "AS IS" BASIS,
|
@@ -1,10 +1,10 @@
|
|
1
|
-
# Copyright 2016 Google
|
1
|
+
# Copyright 2016 Google LLC
|
2
2
|
#
|
3
3
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
4
|
# you may not use this file except in compliance with the License.
|
5
5
|
# You may obtain a copy of the License at
|
6
6
|
#
|
7
|
-
#
|
7
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
8
8
|
#
|
9
9
|
# Unless required by applicable law or agreed to in writing, software
|
10
10
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
@@ -21,6 +21,8 @@
|
|
21
21
|
|
22
22
|
gem "google-cloud-core"
|
23
23
|
require "google/cloud"
|
24
|
+
require "google/cloud/config"
|
25
|
+
require "googleauth"
|
24
26
|
|
25
27
|
module Google
|
26
28
|
module Cloud
|
@@ -108,3 +110,21 @@ module Google
|
|
108
110
|
end
|
109
111
|
end
|
110
112
|
end
|
113
|
+
|
114
|
+
# Set the default resource manager configuration
|
115
|
+
Google::Cloud.configure.add_config! :resource_manager do |config|
|
116
|
+
default_creds = Google::Cloud::Config.deferred do
|
117
|
+
Google::Cloud::Config.credentials_from_env(
|
118
|
+
"RESOURCE_MANAGER_CREDENTIALS", "RESOURCE_MANAGER_CREDENTIALS_JSON",
|
119
|
+
"RESOURCE_MANAGER_KEYFILE", "RESOURCE_MANAGER_KEYFILE_JSON"
|
120
|
+
)
|
121
|
+
end
|
122
|
+
|
123
|
+
config.add_field! :credentials, default_creds,
|
124
|
+
match: [String, Hash, Google::Auth::Credentials],
|
125
|
+
allow_nil: true
|
126
|
+
config.add_alias! :keyfile, :credentials
|
127
|
+
config.add_field! :scope, nil, match: [String, Array]
|
128
|
+
config.add_field! :retries, nil, match: Integer
|
129
|
+
config.add_field! :timeout, nil, match: Integer
|
130
|
+
end
|
@@ -1,10 +1,10 @@
|
|
1
|
-
# Copyright 2015 Google
|
1
|
+
# Copyright 2015 Google LLC
|
2
2
|
#
|
3
3
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
4
|
# you may not use this file except in compliance with the License.
|
5
5
|
# You may obtain a copy of the License at
|
6
6
|
#
|
7
|
-
#
|
7
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
8
8
|
#
|
9
9
|
# Unless required by applicable law or agreed to in writing, software
|
10
10
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
@@ -15,6 +15,8 @@
|
|
15
15
|
|
16
16
|
require "google-cloud-resource_manager"
|
17
17
|
require "google/cloud/resource_manager/manager"
|
18
|
+
require "google/cloud/config"
|
19
|
+
require "google/cloud/env"
|
18
20
|
|
19
21
|
module Google
|
20
22
|
module Cloud
|
@@ -257,8 +259,11 @@ module Google
|
|
257
259
|
#
|
258
260
|
def self.new credentials: nil, scope: nil, retries: nil, timeout: nil,
|
259
261
|
keyfile: nil
|
262
|
+
scope ||= configure.scope
|
263
|
+
retries ||= configure.retries
|
264
|
+
timeout ||= configure.timeout
|
260
265
|
credentials ||= keyfile
|
261
|
-
credentials ||=
|
266
|
+
credentials ||= default_credentials(scope: scope)
|
262
267
|
unless credentials.is_a? Google::Auth::Credentials
|
263
268
|
credentials = ResourceManager::Credentials.new credentials,
|
264
269
|
scope: scope
|
@@ -266,7 +271,41 @@ module Google
|
|
266
271
|
|
267
272
|
ResourceManager::Manager.new(
|
268
273
|
ResourceManager::Service.new(
|
269
|
-
credentials, retries: retries, timeout: timeout
|
274
|
+
credentials, retries: retries, timeout: timeout
|
275
|
+
)
|
276
|
+
)
|
277
|
+
end
|
278
|
+
|
279
|
+
##
|
280
|
+
# Configure the Google Cloud Resource Manager library.
|
281
|
+
#
|
282
|
+
# The following Resource Manager configuration parameters are supported:
|
283
|
+
#
|
284
|
+
# * `credentials` - (String, Hash, Google::Auth::Credentials) The path to
|
285
|
+
# the keyfile as a String, the contents of the keyfile as a Hash, or a
|
286
|
+
# Google::Auth::Credentials object. (See {ResourceManager::Credentials})
|
287
|
+
# (The parameter `keyfile` is also available but deprecated.)
|
288
|
+
# * `scope` - (String, Array<String>) The OAuth 2.0 scopes controlling
|
289
|
+
# the set of resources and operations that the connection can access.
|
290
|
+
# * `retries` - (Integer) Number of times to retry requests on server
|
291
|
+
# error.
|
292
|
+
# * `timeout` - (Integer) Default timeout to use in requests.
|
293
|
+
#
|
294
|
+
# @return [Google::Cloud::Config] The configuration object the
|
295
|
+
# Google::Cloud::ResourceManager library uses.
|
296
|
+
#
|
297
|
+
def self.configure
|
298
|
+
yield Google::Cloud.configure.resource_manager if block_given?
|
299
|
+
|
300
|
+
Google::Cloud.configure.resource_manager
|
301
|
+
end
|
302
|
+
|
303
|
+
##
|
304
|
+
# @private Default credentials.
|
305
|
+
def self.default_credentials scope: nil
|
306
|
+
Google::Cloud.configure.resource_manager.credentials ||
|
307
|
+
Google::Cloud.configure.credentials ||
|
308
|
+
ResourceManager::Credentials.default(scope: scope)
|
270
309
|
end
|
271
310
|
end
|
272
311
|
end
|
@@ -1,10 +1,10 @@
|
|
1
|
-
# Copyright 2015 Google
|
1
|
+
# Copyright 2015 Google LLC
|
2
2
|
#
|
3
3
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
4
|
# you may not use this file except in compliance with the License.
|
5
5
|
# You may obtain a copy of the License at
|
6
6
|
#
|
7
|
-
#
|
7
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
8
8
|
#
|
9
9
|
# Unless required by applicable law or agreed to in writing, software
|
10
10
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
@@ -35,19 +35,19 @@ module Google
|
|
35
35
|
# )
|
36
36
|
#
|
37
37
|
class Credentials < Google::Auth::Credentials
|
38
|
-
SCOPE = ["https://www.googleapis.com/auth/cloud-platform"]
|
39
|
-
PATH_ENV_VARS = %w
|
38
|
+
SCOPE = ["https://www.googleapis.com/auth/cloud-platform"].freeze
|
39
|
+
PATH_ENV_VARS = %w[RESOURCE_MANAGER_CREDENTIALS
|
40
40
|
RESOURCE_MANAGER_KEYFILE
|
41
41
|
GOOGLE_CLOUD_CREDENTIALS
|
42
42
|
GOOGLE_CLOUD_KEYFILE
|
43
|
-
GCLOUD_KEYFILE
|
44
|
-
JSON_ENV_VARS = %w
|
43
|
+
GCLOUD_KEYFILE].freeze
|
44
|
+
JSON_ENV_VARS = %w[RESOURCE_MANAGER_CREDENTIALS_JSON
|
45
45
|
RESOURCE_MANAGER_KEYFILE_JSON
|
46
46
|
GOOGLE_CLOUD_CREDENTIALS_JSON
|
47
47
|
GOOGLE_CLOUD_KEYFILE_JSON
|
48
|
-
GCLOUD_KEYFILE_JSON
|
48
|
+
GCLOUD_KEYFILE_JSON].freeze
|
49
49
|
DEFAULT_PATHS = \
|
50
|
-
["~/.config/gcloud/application_default_credentials.json"]
|
50
|
+
["~/.config/gcloud/application_default_credentials.json"].freeze
|
51
51
|
end
|
52
52
|
end
|
53
53
|
end
|
@@ -1,10 +1,10 @@
|
|
1
|
-
# Copyright 2015 Google
|
1
|
+
# Copyright 2015 Google LLC
|
2
2
|
#
|
3
3
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
4
|
# you may not use this file except in compliance with the License.
|
5
5
|
# You may obtain a copy of the License at
|
6
6
|
#
|
7
|
-
#
|
7
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
8
8
|
#
|
9
9
|
# Unless required by applicable law or agreed to in writing, software
|
10
10
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
@@ -1,10 +1,10 @@
|
|
1
|
-
# Copyright 2016 Google
|
1
|
+
# Copyright 2016 Google LLC
|
2
2
|
#
|
3
3
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
4
|
# you may not use this file except in compliance with the License.
|
5
5
|
# You may obtain a copy of the License at
|
6
6
|
#
|
7
|
-
#
|
7
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
8
8
|
#
|
9
9
|
# Unless required by applicable law or agreed to in writing, software
|
10
10
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
@@ -179,7 +179,7 @@ module Google
|
|
179
179
|
# @private New Policy from a
|
180
180
|
# Google::Apis::CloudresourcemanagerV1::Policy object.
|
181
181
|
def self.from_gapi gapi
|
182
|
-
roles = gapi.bindings.each_with_object({}) do |binding, memo|
|
182
|
+
roles = Array(gapi.bindings).each_with_object({}) do |binding, memo|
|
183
183
|
memo[binding.role] = binding.members.to_a
|
184
184
|
end
|
185
185
|
new gapi.etag, roles
|
@@ -1,10 +1,10 @@
|
|
1
|
-
# Copyright 2015 Google
|
1
|
+
# Copyright 2015 Google LLC
|
2
2
|
#
|
3
3
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
4
|
# you may not use this file except in compliance with the License.
|
5
5
|
# You may obtain a copy of the License at
|
6
6
|
#
|
7
|
-
#
|
7
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
8
8
|
#
|
9
9
|
# Unless required by applicable law or agreed to in writing, software
|
10
10
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
@@ -169,7 +169,7 @@ module Google
|
|
169
169
|
#
|
170
170
|
def created_at
|
171
171
|
Time.parse @gapi.create_time
|
172
|
-
rescue
|
172
|
+
rescue StandardError
|
173
173
|
nil
|
174
174
|
end
|
175
175
|
|
@@ -258,7 +258,7 @@ module Google
|
|
258
258
|
def reload!
|
259
259
|
@gapi = service.get_project project_id
|
260
260
|
end
|
261
|
-
|
261
|
+
alias refresh! reload!
|
262
262
|
|
263
263
|
##
|
264
264
|
# Marks the project for deletion. This method will only affect the
|
@@ -361,7 +361,7 @@ module Google
|
|
361
361
|
policy = Policy.from_gapi gapi
|
362
362
|
return policy unless block_given?
|
363
363
|
yield policy
|
364
|
-
|
364
|
+
update_policy policy
|
365
365
|
end
|
366
366
|
|
367
367
|
##
|
@@ -393,13 +393,14 @@ module Google
|
|
393
393
|
#
|
394
394
|
# policy.add "roles/owner", "user:owner@example.com"
|
395
395
|
#
|
396
|
-
# project.
|
396
|
+
# project.update_policy policy # API call
|
397
397
|
#
|
398
|
-
def
|
398
|
+
def update_policy new_policy
|
399
399
|
ensure_service!
|
400
400
|
gapi = service.set_policy project_id, new_policy.to_gapi
|
401
401
|
Policy.from_gapi gapi
|
402
402
|
end
|
403
|
+
alias policy= update_policy
|
403
404
|
|
404
405
|
##
|
405
406
|
# Tests the specified permissions against the [Cloud
|
@@ -445,7 +446,7 @@ module Google
|
|
445
446
|
##
|
446
447
|
# Raise an error unless an active service is available.
|
447
448
|
def ensure_service!
|
448
|
-
|
449
|
+
raise "Must have active connection" unless service
|
449
450
|
end
|
450
451
|
end
|
451
452
|
end
|
@@ -1,10 +1,10 @@
|
|
1
|
-
# Copyright 2015 Google
|
1
|
+
# Copyright 2015 Google LLC
|
2
2
|
#
|
3
3
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
4
|
# you may not use this file except in compliance with the License.
|
5
5
|
# You may obtain a copy of the License at
|
6
6
|
#
|
7
|
-
#
|
7
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
8
8
|
#
|
9
9
|
# Unless required by applicable law or agreed to in writing, software
|
10
10
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
@@ -157,7 +157,7 @@ module Google
|
|
157
157
|
##
|
158
158
|
# Raise an error unless an active connection is available.
|
159
159
|
def ensure_manager!
|
160
|
-
|
160
|
+
raise "Must have active connection" unless @manager
|
161
161
|
end
|
162
162
|
end
|
163
163
|
end
|
@@ -1,10 +1,10 @@
|
|
1
|
-
# Copyright 2015 Google
|
1
|
+
# Copyright 2015 Google LLC
|
2
2
|
#
|
3
3
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
4
|
# you may not use this file except in compliance with the License.
|
5
5
|
# You may obtain a copy of the License at
|
6
6
|
#
|
7
|
-
#
|
7
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
8
8
|
#
|
9
9
|
# Unless required by applicable law or agreed to in writing, software
|
10
10
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
@@ -1,10 +1,10 @@
|
|
1
|
-
# Copyright 2016 Google
|
1
|
+
# Copyright 2016 Google LLC
|
2
2
|
#
|
3
3
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
4
|
# you may not use this file except in compliance with the License.
|
5
5
|
# You may obtain a copy of the License at
|
6
6
|
#
|
7
|
-
#
|
7
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
8
8
|
#
|
9
9
|
# Unless required by applicable law or agreed to in writing, software
|
10
10
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
@@ -122,7 +122,7 @@ module Google
|
|
122
122
|
end
|
123
123
|
|
124
124
|
def inspect
|
125
|
-
|
125
|
+
self.class.to_s
|
126
126
|
end
|
127
127
|
|
128
128
|
protected
|
@@ -1,10 +1,10 @@
|
|
1
|
-
# Copyright 2016 Google
|
1
|
+
# Copyright 2016 Google LLC
|
2
2
|
#
|
3
3
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
4
|
# you may not use this file except in compliance with the License.
|
5
5
|
# You may obtain a copy of the License at
|
6
6
|
#
|
7
|
-
#
|
7
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
8
8
|
#
|
9
9
|
# Unless required by applicable law or agreed to in writing, software
|
10
10
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
@@ -16,7 +16,7 @@
|
|
16
16
|
module Google
|
17
17
|
module Cloud
|
18
18
|
module ResourceManager
|
19
|
-
VERSION = "0.
|
19
|
+
VERSION = "0.29.0".freeze
|
20
20
|
end
|
21
21
|
end
|
22
22
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: google-cloud-resource_manager
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.29.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Moore
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2018-02-28 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: google-cloud-core
|
@@ -17,28 +17,28 @@ dependencies:
|
|
17
17
|
requirements:
|
18
18
|
- - "~>"
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version: '1.
|
20
|
+
version: '1.2'
|
21
21
|
type: :runtime
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
25
|
- - "~>"
|
26
26
|
- !ruby/object:Gem::Version
|
27
|
-
version: '1.
|
27
|
+
version: '1.2'
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: google-api-client
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
31
31
|
requirements:
|
32
32
|
- - "~>"
|
33
33
|
- !ruby/object:Gem::Version
|
34
|
-
version: 0.
|
34
|
+
version: 0.19.8
|
35
35
|
type: :runtime
|
36
36
|
prerelease: false
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
39
|
- - "~>"
|
40
40
|
- !ruby/object:Gem::Version
|
41
|
-
version: 0.
|
41
|
+
version: 0.19.8
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
43
|
name: googleauth
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
@@ -127,16 +127,16 @@ dependencies:
|
|
127
127
|
name: rubocop
|
128
128
|
requirement: !ruby/object:Gem::Requirement
|
129
129
|
requirements:
|
130
|
-
- - "
|
130
|
+
- - "~>"
|
131
131
|
- !ruby/object:Gem::Version
|
132
|
-
version: 0.
|
132
|
+
version: 0.50.0
|
133
133
|
type: :development
|
134
134
|
prerelease: false
|
135
135
|
version_requirements: !ruby/object:Gem::Requirement
|
136
136
|
requirements:
|
137
|
-
- - "
|
137
|
+
- - "~>"
|
138
138
|
- !ruby/object:Gem::Version
|
139
|
-
version: 0.
|
139
|
+
version: 0.50.0
|
140
140
|
- !ruby/object:Gem::Dependency
|
141
141
|
name: simplecov
|
142
142
|
requirement: !ruby/object:Gem::Requirement
|
@@ -221,7 +221,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
221
221
|
version: '0'
|
222
222
|
requirements: []
|
223
223
|
rubyforge_project:
|
224
|
-
rubygems_version: 2.7.
|
224
|
+
rubygems_version: 2.7.6
|
225
225
|
signing_key:
|
226
226
|
specification_version: 4
|
227
227
|
summary: API Client library for Google Cloud Resource Manager
|