sumomo 0.5.1 → 0.5.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/data/sumomo/custom_resources/APIDomainName.js +101 -0
- data/lib/sumomo/stack.rb +5 -0
- data/lib/sumomo/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 110f516e89512e4936f04d82b33c4796c2e4cec6
|
4
|
+
data.tar.gz: 969ce92b2f2915977fdc83fa5895737faa9df58f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5c5218b0256df836d1d9ba809a536a0fc5e22830a0cbfdca1c6c1bdacd4ef6f8e34b4abfc2e02f5d8a6434291f96bcb8c5939c0ffcb5cc10b4c73e21aabf5324
|
7
|
+
data.tar.gz: 999e3bfcd1bbd7c53a62723b77990b5c1aa1ba87d113008b1165791f8baf6519ccd3c52029041af9509a65df3757470696462244b8a13745afb21da0e707be57
|
@@ -0,0 +1,101 @@
|
|
1
|
+
var apigateway = new aws.APIGateway({region: request.ResourceProperties.Region});
|
2
|
+
|
3
|
+
var params = {
|
4
|
+
domainName: request.ResourceProperties.DomainName
|
5
|
+
}
|
6
|
+
|
7
|
+
if (request.ResourceProperties.CertificateArn)
|
8
|
+
{
|
9
|
+
params.certificateArn = request.ResourceProperties.CertificateArn;
|
10
|
+
}
|
11
|
+
|
12
|
+
function createName(onSuccess, onFail)
|
13
|
+
{
|
14
|
+
apigateway.createDomainName(params, function(err, data)
|
15
|
+
{
|
16
|
+
if (err)
|
17
|
+
{
|
18
|
+
console.log(err, err.stack);
|
19
|
+
onFail(err);
|
20
|
+
}
|
21
|
+
else
|
22
|
+
{
|
23
|
+
store.put("domainName", request.ResourceProperties.DomainName, function()
|
24
|
+
{
|
25
|
+
onSuccess(data);
|
26
|
+
},
|
27
|
+
function(err)
|
28
|
+
{
|
29
|
+
onFail(err);
|
30
|
+
});
|
31
|
+
}
|
32
|
+
});
|
33
|
+
}
|
34
|
+
|
35
|
+
function deleteName(onSuccess, onFail)
|
36
|
+
{
|
37
|
+
store.get("domainName", function(name)
|
38
|
+
{
|
39
|
+
apigateway.deleteDomainName({
|
40
|
+
domainName: name
|
41
|
+
|
42
|
+
}, function(err, data)
|
43
|
+
{
|
44
|
+
if (err)
|
45
|
+
{
|
46
|
+
onFail(err);
|
47
|
+
}
|
48
|
+
else
|
49
|
+
{
|
50
|
+
onSuccess(name);
|
51
|
+
}
|
52
|
+
});
|
53
|
+
},
|
54
|
+
function(err)
|
55
|
+
{
|
56
|
+
onFail(err);
|
57
|
+
});
|
58
|
+
}
|
59
|
+
|
60
|
+
if (request.RequestType == "Create")
|
61
|
+
{
|
62
|
+
createName(function(data)
|
63
|
+
{
|
64
|
+
Cloudformation.send(request, context, Cloudformation.SUCCESS, {}, "Success", data.domainName);
|
65
|
+
},
|
66
|
+
function(err)
|
67
|
+
{
|
68
|
+
Cloudformation.send(request, context, Cloudformation.FAILED, {}, "Error: " + err);
|
69
|
+
});
|
70
|
+
}
|
71
|
+
|
72
|
+
if (request.RequestType == "Update")
|
73
|
+
{
|
74
|
+
deleteName(function(name)
|
75
|
+
{
|
76
|
+
createName(function(data)
|
77
|
+
{
|
78
|
+
Cloudformation.send(request, context, Cloudformation.SUCCESS, {}, "Success", data.domainName);
|
79
|
+
},
|
80
|
+
function(err)
|
81
|
+
{
|
82
|
+
Cloudformation.send(request, context, Cloudformation.FAILED, {}, "Error: " + err);
|
83
|
+
});
|
84
|
+
},
|
85
|
+
function(err)
|
86
|
+
{
|
87
|
+
Cloudformation.send(request, context, Cloudformation.FAILED, {}, "Error: " + err);
|
88
|
+
});
|
89
|
+
}
|
90
|
+
|
91
|
+
if (request.RequestType == "Delete")
|
92
|
+
{
|
93
|
+
deleteName(function(name)
|
94
|
+
{
|
95
|
+
Cloudformation.send(request, context, Cloudformation.SUCCESS, {}, "Success", "");
|
96
|
+
},
|
97
|
+
function(err)
|
98
|
+
{
|
99
|
+
Cloudformation.send(request, context, Cloudformation.FAILED, {}, "Error: " + err);
|
100
|
+
});
|
101
|
+
}
|
data/lib/sumomo/stack.rb
CHANGED
@@ -145,6 +145,11 @@ module Sumomo
|
|
145
145
|
"Effect" => "Allow",
|
146
146
|
"Action" => ["cloudfront:CreateCloudFrontOriginAccessIdentity", "cloudfront:DeleteCloudFrontOriginAccessIdentity"],
|
147
147
|
"Resource" => "*"
|
148
|
+
},
|
149
|
+
{
|
150
|
+
"Effect" => "Allow",
|
151
|
+
"Action" => ["apigateway:*", "cloudfront:UpdateDistribution"],
|
152
|
+
"Resource" => "*"
|
148
153
|
}]
|
149
154
|
}
|
150
155
|
}
|
data/lib/sumomo/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sumomo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Siaw
|
@@ -168,6 +168,7 @@ files:
|
|
168
168
|
- bin/setup
|
169
169
|
- data/sumomo/custom_resource_utils.js
|
170
170
|
- data/sumomo/custom_resources/AMILookup.js
|
171
|
+
- data/sumomo/custom_resources/APIDomainName.js
|
171
172
|
- data/sumomo/custom_resources/AvailabilityZones.js
|
172
173
|
- data/sumomo/custom_resources/CloudflareCNAME.js
|
173
174
|
- data/sumomo/custom_resources/DeployTime.js
|