Skip to content

Commit 4e2a03c

Browse files
authored
feat: addition of account name (#227)
1 parent d7fa093 commit 4e2a03c

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

data-collection/deploy/module-support-cases.yaml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,12 +175,19 @@ Resources:
175175
def main(account, role_name, module_name, bucket):
176176
account_id = account["account_id"]
177177
payer_id = account["payer_id"]
178+
account_name = account.get("account_name", None)
178179
support = get_client_with_role(role_name, account_id, region="us-east-1", service="support")
179180
s3 = boto3.client('s3')
180181
181182
default_start_date = (datetime.now().date() - timedelta(days=365)).strftime('%Y-%m-%d') # Case communications are available for 12 months after creation.
182183
183-
status = {"last_read": default_start_date, "account_id": account_id, "last_summary": None}
184+
status = {
185+
"last_read": default_start_date,
186+
"account_alias": account_name,
187+
"account_id": account_id,
188+
"payer_id": payer_id,
189+
"last_summary": None
190+
}
184191
status_key = f"{module_name}/{module_name}-status/payer_id={payer_id}/{account_id}.json"
185192
try:
186193
status = json.loads(
@@ -220,6 +227,7 @@ Resources:
220227
case_id = data['CaseId']
221228
case_date = datetime.strptime(data["TimeCreated"], '%Y-%m-%dT%H:%M:%S.%fZ')
222229
with open("/tmp/tmp.json", "w", encoding='utf-8') as f:
230+
data['AccountAlias'] = account_name
223231
f.write(to_json(data)) # single line per file
224232
key = case_date.strftime(
225233
f"{module_name}/" +
@@ -245,6 +253,7 @@ Resources:
245253
)
246254
with open("/tmp/tmp.json", "w", encoding='utf-8') as f:
247255
for communication in communication_iterator:
256+
communication['AccountAlias'] = account_name
248257
f.write(to_json(communication) + '\n')
249258
key = case_date.strftime(
250259
f"{module_name}/" +
@@ -358,4 +367,4 @@ Resources:
358367
Type: Custom::LambdaAnalyticsExecutor
359368
Properties:
360369
ServiceToken: !Ref LambdaAnalyticsARN
361-
Name: !Ref CFDataName
370+
Name: !Ref CFDataName

0 commit comments

Comments
 (0)