gclouder 0.2.3 → 0.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/assets/arguments/runtime-config/configs/variables.yml +10 -0
- data/assets/arguments/runtime-config/configs.yml +6 -0
- data/assets/mappings/file.yml +8 -0
- data/assets/resource_representations/runtime-config/projects.configs.yml +3 -0
- data/assets/resource_representations/runtime-config/projects.variables.yml +3 -0
- data/lib/gclouder/resource.rb +5 -0
- data/lib/gclouder/resources/runtime-config/configs.rb +76 -0
- data/lib/gclouder/resources/runtime-config/variables.rb +73 -0
- data/lib/gclouder/version.rb +1 -1
- data/lib/gclouder.rb +15 -0
- metadata +8 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d5fac046450304fa8776ed102e38e05adb98441a
|
4
|
+
data.tar.gz: 58d375a60028943c06e7bbb3383fbc6a7de1d076
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 81ac317bf67d099969b203bc6a46a6adc188078d181884f2c1e2538e5b3afd961abe78780aeac3dae19c3b244e264bf2d755d904fb98fe0905632f705904a33a
|
7
|
+
data.tar.gz: 12d85af734b3cf50621360237fe0c152c773456385a8372eb941b584716835b6850df482bd1e85ea90cc7b6b9369d3e9f47e891c04a996a807cd6e32d10fcc80
|
data/assets/mappings/file.yml
CHANGED
@@ -29,3 +29,11 @@ beta::pubsub::subscriptions:
|
|
29
29
|
beta::pubsub::topics:
|
30
30
|
- pubsub
|
31
31
|
- projects.topics
|
32
|
+
|
33
|
+
beta::runtime-config::configs:
|
34
|
+
- runtime-config
|
35
|
+
- projects.configs
|
36
|
+
|
37
|
+
beta::runtime-config::configs::variables:
|
38
|
+
- runtime-config
|
39
|
+
- projects.variables
|
data/lib/gclouder/resource.rb
CHANGED
@@ -51,6 +51,11 @@ module GClouder
|
|
51
51
|
snake_case ? list.to_snake_keys : list
|
52
52
|
end
|
53
53
|
|
54
|
+
def self.set(resource, name, value, args = nil, project_id: nil, extra_info: nil, silent: false, indent: 3)
|
55
|
+
feedback("good", resource, name, extra_info: "[#{value}]", indent: indent, silent: silent)
|
56
|
+
gcloud "#{resource} set #{name} #{value} #{args}", project_id: project_id, silent: silent
|
57
|
+
end
|
58
|
+
|
54
59
|
module Find
|
55
60
|
include GClouder::GCloud
|
56
61
|
|
@@ -0,0 +1,76 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
module GClouder
|
4
|
+
module Resources
|
5
|
+
module RuntimeConfig
|
6
|
+
module Configs
|
7
|
+
include GClouder::Config::CLIArgs
|
8
|
+
include GClouder::Config::Project
|
9
|
+
include GClouder::Logging
|
10
|
+
include GClouder::Resource::Cleaner
|
11
|
+
|
12
|
+
def self.header(stage = :ensure)
|
13
|
+
info "[#{stage}] runtime-config / configs", indent: 1, title: true
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.ensure
|
17
|
+
return if Local.list.empty?
|
18
|
+
header
|
19
|
+
|
20
|
+
Local.list.each do |region, configs|
|
21
|
+
info region, indent: 2, heading: true
|
22
|
+
info
|
23
|
+
configs.each do |config|
|
24
|
+
ConfigObject.ensure(config["name"])
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.validate
|
30
|
+
return if Local.list.empty?
|
31
|
+
header :validate
|
32
|
+
Local.validate
|
33
|
+
end
|
34
|
+
|
35
|
+
module Local
|
36
|
+
include GClouder::Config::CLIArgs
|
37
|
+
include GClouder::Config::Project
|
38
|
+
include GClouder::Logging
|
39
|
+
|
40
|
+
# FIXME: improve validation
|
41
|
+
def self.validate
|
42
|
+
Resources::Validate::Region.instances(
|
43
|
+
list,
|
44
|
+
required_keys: GClouder::Config::Arguments.required(%w(runtime-config configs)),
|
45
|
+
permitted_keys: GClouder::Config::Arguments.permitted(%w(runtime-config configs))
|
46
|
+
)
|
47
|
+
end
|
48
|
+
|
49
|
+
def self.list
|
50
|
+
GClouder::Resources::Global.instances(path: %w(runtime-config configs))
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
module Remote
|
55
|
+
def self.list
|
56
|
+
Resources::Remote.instances(
|
57
|
+
path: %w(beta runtime-config configs)
|
58
|
+
)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
module ConfigObject
|
63
|
+
include GClouder::GCloud
|
64
|
+
|
65
|
+
def self.ensure(config)
|
66
|
+
Resource.ensure :"beta runtime-config configs", config
|
67
|
+
end
|
68
|
+
|
69
|
+
def self.purge(config)
|
70
|
+
Resource.purge :"beta runtime-config configs", config
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
@@ -0,0 +1,73 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
module GClouder
|
4
|
+
module Resources
|
5
|
+
module RuntimeConfig
|
6
|
+
module Variables
|
7
|
+
include GClouder::Config::CLIArgs
|
8
|
+
include GClouder::Config::Project
|
9
|
+
include GClouder::Logging
|
10
|
+
include GClouder::Resource::Cleaner
|
11
|
+
|
12
|
+
def self.header(stage = :ensure)
|
13
|
+
info "[#{stage}] runtime-config / variables", indent: 1, title: true
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.ensure
|
17
|
+
return if Local.list.empty?
|
18
|
+
header
|
19
|
+
|
20
|
+
Local.list.each do |region, variables|
|
21
|
+
info region, indent: 2, heading: true
|
22
|
+
info
|
23
|
+
variables.each do |variable|
|
24
|
+
Variable.ensure(variable)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
puts "Ensure all done"
|
29
|
+
end
|
30
|
+
|
31
|
+
def self.validate
|
32
|
+
return if Local.list.empty?
|
33
|
+
header :validate
|
34
|
+
Local.validate
|
35
|
+
end
|
36
|
+
|
37
|
+
module Local
|
38
|
+
include GClouder::Config::CLIArgs
|
39
|
+
include GClouder::Config::Project
|
40
|
+
include GClouder::Logging
|
41
|
+
|
42
|
+
def self.validate
|
43
|
+
Resources::Validate::Region.instances(
|
44
|
+
list,
|
45
|
+
required_keys: GClouder::Config::Arguments.required(%w(runtime-config configs variables)),
|
46
|
+
permitted_keys: GClouder::Config::Arguments.permitted(%w(runtime-config configs variables))
|
47
|
+
)
|
48
|
+
end
|
49
|
+
|
50
|
+
def self.list
|
51
|
+
GClouder::Resources::Global.instances(path: %w(runtime-config variables))
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
module Variable
|
56
|
+
include GClouder::GCloud
|
57
|
+
|
58
|
+
def self.args(variable)
|
59
|
+
hash_to_args(variable.select{|k,v| k != "value"}) # Value is passed as an arg
|
60
|
+
end
|
61
|
+
|
62
|
+
def self.ensure(variable)
|
63
|
+
Resource.set :"beta runtime-config configs variables", variable["name"], variable["value"], args(variable)
|
64
|
+
end
|
65
|
+
|
66
|
+
def self.purge(config)
|
67
|
+
Resource.purge :"beta runtime-config configs variables", config
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
data/lib/gclouder/version.rb
CHANGED
data/lib/gclouder.rb
CHANGED
@@ -82,6 +82,9 @@ require "gclouder/resources/logging/sinks"
|
|
82
82
|
|
83
83
|
require "gclouder/resources/functions/function"
|
84
84
|
|
85
|
+
require "gclouder/resources/runtime-config/configs"
|
86
|
+
require "gclouder/resources/runtime-config/variables"
|
87
|
+
|
85
88
|
module GClouder
|
86
89
|
include GClouder::Logging
|
87
90
|
include GClouder::Config::CLIArgs
|
@@ -256,6 +259,18 @@ module GClouder
|
|
256
259
|
skip: [ :check ],
|
257
260
|
},
|
258
261
|
|
262
|
+
{
|
263
|
+
name: "runtime-configs",
|
264
|
+
module: Resources::RuntimeConfig::Configs,
|
265
|
+
skip: [ :check ],
|
266
|
+
},
|
267
|
+
|
268
|
+
{
|
269
|
+
name: "variables",
|
270
|
+
module: Resources::RuntimeConfig::Variables,
|
271
|
+
skip: [ :check, :clean ],
|
272
|
+
},
|
273
|
+
|
259
274
|
{
|
260
275
|
name: "functions",
|
261
276
|
module: Resources::Functions::Function,
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gclouder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rob Wilson
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2017-09-
|
12
|
+
date: 2017-09-15 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: trollop
|
@@ -188,6 +188,8 @@ files:
|
|
188
188
|
- assets/arguments/dns/managed-zones.yml
|
189
189
|
- assets/arguments/dns/record-sets/transaction.yml
|
190
190
|
- assets/arguments/functions.yml
|
191
|
+
- assets/arguments/runtime-config/configs.yml
|
192
|
+
- assets/arguments/runtime-config/configs/variables.yml
|
191
193
|
- assets/defaults/compute/disks.yml
|
192
194
|
- assets/mappings/file.yml
|
193
195
|
- assets/mappings/property.yml
|
@@ -204,6 +206,8 @@ files:
|
|
204
206
|
- assets/resource_representations/logging/projects.sinks.yml
|
205
207
|
- assets/resource_representations/pubsub/projects.subscriptions.yml
|
206
208
|
- assets/resource_representations/pubsub/projects.topics.yml
|
209
|
+
- assets/resource_representations/runtime-config/projects.configs.yml
|
210
|
+
- assets/resource_representations/runtime-config/projects.variables.yml
|
207
211
|
- bin/gclouder
|
208
212
|
- lib/gclouder.rb
|
209
213
|
- lib/gclouder/config/arguments.rb
|
@@ -253,6 +257,8 @@ files:
|
|
253
257
|
- lib/gclouder/resources/project_id.rb
|
254
258
|
- lib/gclouder/resources/pubsub/subscriptions.rb
|
255
259
|
- lib/gclouder/resources/pubsub/topics.rb
|
260
|
+
- lib/gclouder/resources/runtime-config/configs.rb
|
261
|
+
- lib/gclouder/resources/runtime-config/variables.rb
|
256
262
|
- lib/gclouder/resources/storage/buckets.rb
|
257
263
|
- lib/gclouder/resources/storage/notifications.rb
|
258
264
|
- lib/gclouder/resources/validate/global.rb
|