-
Notifications
You must be signed in to change notification settings - Fork 7
/
master_data.py
79 lines (75 loc) · 3.13 KB
/
master_data.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
68
69
70
71
72
73
74
75
76
77
78
79
import boto3
import uuid
import datetime
dynamodb = boto3.resource('dynamodb', region_name='<AWS_REGION>') # TODO:: Update with aws-region where thes stack is deployed
table = dynamodb.Table('aws-samples-budgets') # TODO:: Once stack is deployed, update the DynamoDB Table Name
def insert_data(db_item):
table.put_item(Item=db_item)
budgets = [
{
"partitionKey": "BUDGET",
"rangeKey": str(uuid.uuid4()),
"budgetName": "bu1-monthly-budget",
"budgetLimit": 0,
"actualSpend": 0,
"forecastedSpend": 0,
"approverEmail": "[email protected]", # Email address of the admin for the business unit
"notifySNSTopic": "arn:aws:sns:ap-south-1:1234567891235:approval-notification", # Update the SNS notification for the business unit
"accruedForecastedSpend": 0,
"accruedBlockedSpend": 0,
"accruedApprovedSpend": 0,
"businessEntity": "business_entity_1",
"budgetForecastProcessed": False,
"budgetUpdatedAt": str(datetime.datetime.utcnow())
},
{
"partitionKey": "BUDGET",
"rangeKey": str(uuid.uuid4()),
"budgetName": "bu2-monthly-budget",
"budgetLimit": 0,
"actualSpend": 0,
"forecastedSpend": 0,
"approverEmail": "[email protected]", # Email address of the admin for the business unit
"notifySNSTopic": "arn:aws:sns:ap-south-1:1234567891235:approval-notification", # Update the SNS notification for the business unit
"accruedForecastedSpend": 0,
"accruedBlockedSpend": 0,
"accruedApprovedSpend": 0,
"businessEntity": "business_entity_2",
"budgetForecastProcessed": False,
"budgetUpdatedAt": str(datetime.datetime.utcnow())
},
{
"partitionKey": "BUDGET",
"rangeKey": str(uuid.uuid4()),
"budgetName": "bu3-monthly-budget",
"budgetLimit": 0,
"actualSpend": 0,
"forecastedSpend": 0,
"approverEmail": "[email protected]", # Email address of the admin for the business unit
"notifySNSTopic": "arn:aws:sns:ap-south-1:1234567891235:approval-notification", # Update the SNS notification for the business unit
"accruedForecastedSpend": 0,
"accruedBlockedSpend": 0,
"accruedApprovedSpend": 0,
"businessEntity": "business_entity_3",
"budgetForecastProcessed": False,
"budgetUpdatedAt": str(datetime.datetime.utcnow())
},
{
"partitionKey": "BUDGET",
"rangeKey": str(uuid.uuid4()),
"budgetName": "bu4-monthly-budget",
"budgetLimit": 0,
"actualSpend": 0,
"forecastedSpend": 0,
"approverEmail": "[email protected]", # Email address of the admin for the business unit
"notifySNSTopic": "arn:aws:sns:ap-south-1:1234567891235:approval-notification", # Update the SNS notification for the business unit
"accruedForecastedSpend": 0,
"accruedBlockedSpend": 0,
"accruedApprovedSpend": 0,
"businessEntity": "business_entity_4",
"budgetForecastProcessed": False,
"budgetUpdatedAt": str(datetime.datetime.utcnow())
}
]
for item in budgets:
insert_data(item)