cloudmason 1.0.4 → 1.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.
- package/commands/helpers/cf.js +0 -1
- package/commands/init_org.js +9 -10
- package/main.js +9 -1
- package/package.json +1 -1
package/commands/helpers/cf.js
CHANGED
package/commands/init_org.js
CHANGED
|
@@ -28,21 +28,20 @@ exports.main = async function(args){
|
|
|
28
28
|
return true;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
+
exports.setOrg = async function(args){
|
|
32
|
+
// Set org.txt
|
|
33
|
+
const orgPath = path.resolve(__dirname,'..','org.txt');
|
|
34
|
+
const orgData = `${args.name},${args.region}`;
|
|
35
|
+
fs.writeFileSync(orgPath,orgData,'utf-8')
|
|
36
|
+
console.log('Set org:',orgData)
|
|
37
|
+
return true;
|
|
38
|
+
}
|
|
39
|
+
|
|
31
40
|
|
|
32
41
|
/////////////////////////////////////////
|
|
33
42
|
////////////// FUNCS ////////////////////
|
|
34
43
|
////////////////////////////////////////
|
|
35
44
|
|
|
36
|
-
async function bucketExists(bucketName,region){
|
|
37
|
-
const client = new S3Client({region});
|
|
38
|
-
try {
|
|
39
|
-
await client.send(new HeadBucketCommand({ Bucket: bucketName }));
|
|
40
|
-
return true;
|
|
41
|
-
} catch (e){
|
|
42
|
-
return false;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
45
|
async function getDefaultVPC(region){
|
|
47
46
|
const ec2Client = new EC2Client({ region });
|
|
48
47
|
const response = await ec2Client.send(new DescribeVpcsCommand({ Filters: [{ Name: "isDefault", Values: ["true"] }] }));
|
package/main.js
CHANGED
|
@@ -14,6 +14,14 @@ const Commands = {
|
|
|
14
14
|
{n: 'region', desc: 'AWS Region for Core Assets. Default us-east-1', r: false}
|
|
15
15
|
]
|
|
16
16
|
},
|
|
17
|
+
'set-org': {
|
|
18
|
+
desc: "Set an exsiting organization",
|
|
19
|
+
exec: require('./commands/init_org').setOrg,
|
|
20
|
+
args: [
|
|
21
|
+
{n: 'name', desc: 'Unique org Name. Letters only', r: true, pattern: `[A-Za-z]{2,20}`},
|
|
22
|
+
{n: 'region', desc: 'AWS Region for Core Assets. Default us-east-1', r: false}
|
|
23
|
+
]
|
|
24
|
+
},
|
|
17
25
|
'new-app': {
|
|
18
26
|
desc: 'Add a new application',
|
|
19
27
|
exec: require('./commands/new_app').main,
|
|
@@ -142,7 +150,7 @@ async function main(){
|
|
|
142
150
|
return;
|
|
143
151
|
}
|
|
144
152
|
// Exit if no org found
|
|
145
|
-
if (args.cmd !== 'init-org' && args.cmd !== 'set-org' && !orgExists){
|
|
153
|
+
if (args.cmd !== 'init-org' && args.cmd !== 'set-org' && args.cmd !== 'starter' && !orgExists){
|
|
146
154
|
console.log(`No organization found. Use init-org or set-org`);
|
|
147
155
|
}
|
|
148
156
|
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"cloudmason","version":"1.0.
|
|
1
|
+
{"name":"cloudmason","version":"1.0.6","description":"","main":"main.js","scripts":{"build":"node build.js"},"bin":{"mason":"./main.js"},"repository":{"type":"git","url":"https://github.com/kai-harvey/secure-saas.git"},"author":"Kai Harvey","license":"ISC","dependencies":{"@aws-sdk/client-acm":"^3.418.0","@aws-sdk/client-auto-scaling":"^3.470.0","@aws-sdk/client-cloudformation":"^3.418.0","@aws-sdk/client-ec2":"^3.416.0","@aws-sdk/client-iam":"^3.418.0","@aws-sdk/client-route-53":"^3.425.0","@aws-sdk/client-s3":"^3.418.0","@aws-sdk/client-ssm":"^3.421.0","adm-zip":"^0.5.10"}}
|