-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathsetup.py
executable file
·67 lines (52 loc) · 1.45 KB
/
setup.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
56
57
58
59
60
61
62
63
64
65
66
67
#!/usr/bin/python2.7
"""
# setup.py
# Author: Christopher Treadgold
# Date: N/D
# Edited: 07/08/2016 | Christopher Treadgold
"""
import cms_functions
import sys
import os
if len(sys.argv) not in range(2, 4):
command = ''
for arg in sys.argv:
command += arg + ' '
print 'Invalid command: ' + command
print 'Usage: %s <cms_prefix> <region (optional)>' % sys.argv[0]
sys.exit()
# Instantiate an AwsFunc class
if len(sys.argv) == 3:
cms = cms_functions.AwsFunc(sys.argv[1], region=sys.argv[2])
else:
cms = cms_functions.AwsFunc(sys.argv[1])
# Create tje rest api
cms.create_rest_api()
# Create the lambda function
cms.create_lambda_function()
# Setup the rest api
cms.api_add_post_method()
cms.api_add_options_method()
cms.deploy_api()
# Create the s3 bucket
cms.create_bucket()
# Create the cloudfront distribution
# cms.create_cloudfront_distribution() TODO: Reactivate
# Create the dynamodb blog table
cms.create_blog_table()
# Create the dynamodb page table
cms.create_page_table()
# Create the dynamodb token table
cms.create_token_table()
# Create the dunamodb role table
cms.create_role_table()
# Add an admin role to the role table
cms.create_admin_role_db_entry()
# Create the dynamodb user table
cms.create_user_table()
# Add an admin to the user table
cms.create_admin_user_db_entry()
# Print the default login credentials and the login link
cms.print_login_link()
# Saves the cms installation information
cms.save_constants()