sumomo 0.7.1 → 0.7.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/sumomo.rb +0 -2
- data/lib/sumomo/api.rb +2 -2
- data/lib/sumomo/stack.rb +55 -38
- data/lib/sumomo/version.rb +1 -1
- data/sumomo.gemspec +1 -1
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eedd627e371d22547e9f4a25f5eb7f913116a391
|
4
|
+
data.tar.gz: 3ed9a3f02775ede22c5072ea0b1f9136e9242489
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8a542867a471555b413c97eda75e6bf42b3d44d4b763f682982150de9b8beccffaee828930df0ada01958f70cf0f47e0e7ff5d31a93298cd9c8037fa684461c1
|
7
|
+
data.tar.gz: f7d7a7e77372122f0a97cef34e99bee744a6159caf8f0f675793819f2c3a74f93f39265483f377996e04708d96dacfe211c05998a44ab51dedc49d1fbb6e8871
|
data/lib/sumomo.rb
CHANGED
data/lib/sumomo/api.rb
CHANGED
@@ -72,7 +72,7 @@ module Sumomo
|
|
72
72
|
end
|
73
73
|
end
|
74
74
|
|
75
|
-
def make_api(domain_name, name:, script:nil, dns:nil, cert:nil, &block)
|
75
|
+
def make_api(domain_name, name:, script:nil, dns:nil, cert:nil, with_statements:[], &block)
|
76
76
|
|
77
77
|
api = make "AWS::ApiGateway::RestApi", name: name do
|
78
78
|
Name name
|
@@ -95,7 +95,7 @@ module Sumomo
|
|
95
95
|
|
96
96
|
files += [ {name:"index.js", code:script} ]
|
97
97
|
|
98
|
-
fun = make_lambda(name: "#{name}Lambda#{@version_number}", files:files)
|
98
|
+
fun = make_lambda(name: "#{name}Lambda#{@version_number}", files:files, with_statements:with_statements)
|
99
99
|
|
100
100
|
resource = make "AWS::ApiGateway::Resource", name: "#{name}Resource" do
|
101
101
|
ParentId api.RootResourceId
|
data/lib/sumomo/stack.rb
CHANGED
@@ -28,7 +28,7 @@ module Sumomo
|
|
28
28
|
runtime: "nodejs4.3",
|
29
29
|
memory_size: 128,
|
30
30
|
timeout: 30,
|
31
|
-
|
31
|
+
with_statements: [])
|
32
32
|
|
33
33
|
name ||= make_default_resource_name("Lambda")
|
34
34
|
|
@@ -47,6 +47,8 @@ module Sumomo
|
|
47
47
|
|
48
48
|
@store.set_raw(function_key, stringio.string)
|
49
49
|
|
50
|
+
stack = self
|
51
|
+
|
50
52
|
code_location = {"S3Bucket": @bucket_name, "S3Key": function_key}
|
51
53
|
fun = make "AWS::Lambda::Function", name: name do
|
52
54
|
Code code_location
|
@@ -55,7 +57,7 @@ module Sumomo
|
|
55
57
|
Handler handler
|
56
58
|
Runtime runtime
|
57
59
|
Timeout timeout
|
58
|
-
Role
|
60
|
+
Role stack.exec_role(with_statements: with_statements).Arn
|
59
61
|
end
|
60
62
|
|
61
63
|
log_group = make "AWS::Logs::LogGroup", name: "#{name}LogGroup" do
|
@@ -114,8 +116,17 @@ module Sumomo
|
|
114
116
|
end
|
115
117
|
end
|
116
118
|
|
117
|
-
def
|
118
|
-
|
119
|
+
def exec_role(with_statements: [])
|
120
|
+
|
121
|
+
if @exec_roles == nil
|
122
|
+
@exec_roles = {}
|
123
|
+
end
|
124
|
+
|
125
|
+
statement_key = JSON.parse(with_statements.to_json)
|
126
|
+
|
127
|
+
if !@exec_roles.has_key?(statement_key)
|
128
|
+
name = make_default_resource_name("LambdaExecRole")
|
129
|
+
|
119
130
|
role_policy_doc = {
|
120
131
|
"Version" => "2012-10-17",
|
121
132
|
"Statement" => [{
|
@@ -124,52 +135,58 @@ module Sumomo
|
|
124
135
|
"Action" => ["sts:AssumeRole"]
|
125
136
|
}]
|
126
137
|
}
|
138
|
+
|
127
139
|
bucket_name = @bucket_name
|
128
|
-
|
140
|
+
|
141
|
+
statement_list = [
|
142
|
+
{
|
143
|
+
"Effect" => "Allow",
|
144
|
+
"Action" => ["logs:CreateLogStream","logs:PutLogEvents"],
|
145
|
+
"Resource" => "arn:aws:logs:*:*:*"
|
146
|
+
},
|
147
|
+
{
|
148
|
+
"Effect" => "Allow",
|
149
|
+
"Action" => ["cloudformation:DescribeStacks", "ec2:Describe*", ],
|
150
|
+
"Resource" => "*"
|
151
|
+
},
|
152
|
+
{
|
153
|
+
"Effect" => "Allow",
|
154
|
+
"Action" => ["s3:DeleteObject", "s3:GetObject", "s3:PutObject"],
|
155
|
+
"Resource" => "arn:aws:s3:::#{bucket_name}/*"
|
156
|
+
},
|
157
|
+
{
|
158
|
+
"Effect" => "Allow",
|
159
|
+
"Action" => ["cloudfront:CreateCloudFrontOriginAccessIdentity", "cloudfront:DeleteCloudFrontOriginAccessIdentity"],
|
160
|
+
"Resource" => "*"
|
161
|
+
},
|
162
|
+
{
|
163
|
+
"Effect" => "Allow",
|
164
|
+
"Action" => ["apigateway:*", "cloudfront:UpdateDistribution"],
|
165
|
+
"Resource" => "*"
|
166
|
+
},
|
167
|
+
{
|
168
|
+
"Effect" => "Allow",
|
169
|
+
"Action" => ["acm:RequestCertificate", "acm:DeleteCertificate", "acm:DescribeCertificate"],
|
170
|
+
"Resource" => "*"
|
171
|
+
}] + with_statements
|
172
|
+
|
173
|
+
@exec_roles[statement_key] = make "AWS::IAM::Role", name: name do
|
129
174
|
AssumeRolePolicyDocument role_policy_doc
|
130
175
|
Path "/"
|
131
176
|
Policies [
|
132
177
|
{
|
133
|
-
"PolicyName" =>
|
178
|
+
"PolicyName" => name,
|
134
179
|
"PolicyDocument" => {
|
135
180
|
"Version" => "2012-10-17",
|
136
|
-
"Statement" =>
|
137
|
-
"Effect" => "Allow",
|
138
|
-
"Action" => ["logs:CreateLogStream","logs:PutLogEvents"],
|
139
|
-
"Resource" => "arn:aws:logs:*:*:*"
|
140
|
-
},
|
141
|
-
{
|
142
|
-
"Effect" => "Allow",
|
143
|
-
"Action" => ["cloudformation:DescribeStacks", "ec2:Describe*", ],
|
144
|
-
"Resource" => "*"
|
145
|
-
},
|
146
|
-
{
|
147
|
-
"Effect" => "Allow",
|
148
|
-
"Action" => ["s3:DeleteObject", "s3:GetObject", "s3:PutObject"],
|
149
|
-
"Resource" => "arn:aws:s3:::#{bucket_name}/*"
|
150
|
-
},
|
151
|
-
{
|
152
|
-
"Effect" => "Allow",
|
153
|
-
"Action" => ["cloudfront:CreateCloudFrontOriginAccessIdentity", "cloudfront:DeleteCloudFrontOriginAccessIdentity"],
|
154
|
-
"Resource" => "*"
|
155
|
-
},
|
156
|
-
{
|
157
|
-
"Effect" => "Allow",
|
158
|
-
"Action" => ["apigateway:*", "cloudfront:UpdateDistribution"],
|
159
|
-
"Resource" => "*"
|
160
|
-
},
|
161
|
-
{
|
162
|
-
"Effect" => "Allow",
|
163
|
-
"Action" => ["acm:RequestCertificate", "acm:DeleteCertificate", "acm:DescribeCertificate"],
|
164
|
-
"Resource" => "*"
|
165
|
-
}]
|
181
|
+
"Statement" => statement_list
|
166
182
|
}
|
167
183
|
}
|
168
184
|
]
|
169
185
|
end
|
170
186
|
end
|
171
|
-
@exec_role
|
172
|
-
end
|
173
187
|
|
188
|
+
@exec_roles[statement_key]
|
189
|
+
|
190
|
+
end
|
174
191
|
end
|
175
192
|
end
|
data/lib/sumomo/version.rb
CHANGED
data/sumomo.gemspec
CHANGED
@@ -32,7 +32,7 @@ Gem::Specification.new do |spec|
|
|
32
32
|
|
33
33
|
spec.add_dependency "momo", "0.4.1"
|
34
34
|
spec.add_dependency "s3cabinet"
|
35
|
-
spec.add_dependency "aws-sdk"
|
35
|
+
spec.add_dependency "aws-sdk", "2.10.9"
|
36
36
|
spec.add_dependency "rubyzip"
|
37
37
|
spec.add_dependency "activesupport"
|
38
38
|
spec.add_dependency "hashie"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sumomo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Siaw
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-01-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -84,16 +84,16 @@ dependencies:
|
|
84
84
|
name: aws-sdk
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- -
|
87
|
+
- - '='
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version:
|
89
|
+
version: 2.10.9
|
90
90
|
type: :runtime
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- -
|
94
|
+
- - '='
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version:
|
96
|
+
version: 2.10.9
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: rubyzip
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -2558,7 +2558,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
2558
2558
|
version: '0'
|
2559
2559
|
requirements: []
|
2560
2560
|
rubyforge_project:
|
2561
|
-
rubygems_version: 2.6.
|
2561
|
+
rubygems_version: 2.6.11
|
2562
2562
|
signing_key:
|
2563
2563
|
specification_version: 4
|
2564
2564
|
summary: An advanced infrastructure description language for AWS
|