-
Notifications
You must be signed in to change notification settings - Fork 3
/
awsbaby.py
executable file
·55 lines (46 loc) · 1.54 KB
/
awsbaby.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/usr/bin/env python3
#############################################
# Copyright 2019 noelmcloughlin
#############################################
import sys
try:
sys.path.append('./aws')
import boto3_solutions as cloud
except ImportError:
sys.path.append('../aws')
import boto3_solutions as cloud
def main(argv):
solution = cloud.AwsSolution(argv)
scope = solution.scope
if 'help' in solution.choice:
cloud.AwsSolution.usage()
if 'clean' in solution.choice:
if 'sns' in scope:
cloud.SimpleNotificationService.clean(solution)
if 'elb' in scope:
cloud.ElasticLoadBalancing.clean(solution)
if 'autoscaling' in scope:
cloud.AutoScaling.clean(solution)
if 'ec2' in scope or 'vpc' in scope:
cloud.Ec2.clean(solution)
if 'sec' in scope:
cloud.SecurityGroup.clean(solution)
if 'start' in solution.choice:
solution = cloud.Vpc(solution)
solution = cloud.SecurityGroup(solution)
if 'sns' in scope:
solution = cloud.SimpleNotificationService(solution)
if 'ec2' in scope or 'vpc' in scope:
solution = cloud.Ec2(solution)
if 'elb' in scope:
solution = cloud.ElasticLoadBalancing(solution)
if 'autoscaling' in scope:
solution = cloud.AutoScaling(solution)
del solution
print('\nOk\n')
if __name__ == "__main__":
try:
main(sys.argv[1:])
except Exception as problem:
cloud.AwsSolution.fatal(problem)
exit(0)