cloudit 0.0.5 → 0.0.6
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/.gitignore +1 -0
- data/cloudit.gemspec +1 -0
- data/lib/cloudit/command/base.rb +1 -0
- data/lib/cloudit/command/validate.rb +46 -0
- data/lib/cloudit/config.rb +15 -0
- data/lib/cloudit/version.rb +1 -1
- metadata +18 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 609f1619ba5a51d37de43b26ad52d870e9f6ddf5
|
4
|
+
data.tar.gz: 2423dc9a70218e2cfadea439a532e649615deabc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ff866b4552086b781b510d8e7ad8aeb7187d8965e4c8ba68ce386e5090307759215ed6acf8f2a720074bddd59eecd262fd78ad956cf3776d8b0245db5eb73e4a
|
7
|
+
data.tar.gz: 1dec52e4da47606028e17cc389447686ca9753d198bf4c365ace6184edee89454e38815e5118ae370789194f94402f6e46f007dec34166056ac5efedd97906bd
|
data/.gitignore
CHANGED
data/cloudit.gemspec
CHANGED
data/lib/cloudit/command/base.rb
CHANGED
@@ -0,0 +1,46 @@
|
|
1
|
+
require 'cloudit/command/base'
|
2
|
+
require 'cloudit/command/generate'
|
3
|
+
require 'aws-sdk'
|
4
|
+
|
5
|
+
class Cloudit::Command::Validate < Cloudit::Command::Base
|
6
|
+
VALID_METHODS = ['help']
|
7
|
+
DESCRIPTION = "Validate CloudFormation template"
|
8
|
+
|
9
|
+
def index
|
10
|
+
if @opts.help?
|
11
|
+
$stdout.puts slop_opts
|
12
|
+
else
|
13
|
+
validate_template @opts[:region]
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
private
|
18
|
+
|
19
|
+
def validate_template(region='us-east-1')
|
20
|
+
cf = Aws::CloudFormation::Client.new(
|
21
|
+
region: region,
|
22
|
+
access_key_id: Cloudit::Config.access_key_id,
|
23
|
+
secret_access_key: Cloudit::Config.secret_access_key
|
24
|
+
)
|
25
|
+
|
26
|
+
json = Cloudit::Command::Generate.new.generate_json
|
27
|
+
resp = cf.validate_template(template_body: json)
|
28
|
+
$stdout.puts resp
|
29
|
+
rescue Aws::CloudFormation::Errors::ValidationError => e
|
30
|
+
$stdout.puts e.message
|
31
|
+
end
|
32
|
+
|
33
|
+
def self.setup_options
|
34
|
+
opts = Slop::Options.new
|
35
|
+
opts.banner = 'Usage: cloudit validate'
|
36
|
+
opts.separator ''
|
37
|
+
opts.separator 'Validate options:'
|
38
|
+
opts.string '-r', '--region', 'region used for validation'
|
39
|
+
opts.bool '-h', '--help', 'print usage', default: false
|
40
|
+
|
41
|
+
self.slop_opts = opts
|
42
|
+
self.parser = Slop::Parser.new(opts)
|
43
|
+
end
|
44
|
+
|
45
|
+
setup_options
|
46
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'yaml'
|
2
|
+
|
3
|
+
class Cloudit::Config
|
4
|
+
ATTRIBUTES = [:region, :access_key_id, :secret_access_key]
|
5
|
+
|
6
|
+
class << self
|
7
|
+
attr_accessor(*ATTRIBUTES)
|
8
|
+
end
|
9
|
+
|
10
|
+
yml = YAML::load_file("./.cloudit/config")
|
11
|
+
|
12
|
+
ATTRIBUTES.each do |a|
|
13
|
+
self.send("#{a.to_s}=", yml[a.to_s])
|
14
|
+
end
|
15
|
+
end
|
data/lib/cloudit/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cloudit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Zachary Chai
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-06-
|
11
|
+
date: 2016-06-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: slop
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: aws-sdk
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: bundler
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -91,6 +105,8 @@ files:
|
|
91
105
|
- lib/cloudit/command/base.rb
|
92
106
|
- lib/cloudit/command/generate.rb
|
93
107
|
- lib/cloudit/command/index.rb
|
108
|
+
- lib/cloudit/command/validate.rb
|
109
|
+
- lib/cloudit/config.rb
|
94
110
|
- lib/cloudit/version.rb
|
95
111
|
homepage: https://github.com/zach-chai/cloudit
|
96
112
|
licenses:
|