Skip to content

Commit f4a2549

Browse files
committed
more fixes
1 parent ec7d5e5 commit f4a2549

File tree

2 files changed

+22
-7
lines changed

2 files changed

+22
-7
lines changed

data-collection/deploy/deploy-in-linked-account.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,8 @@ Resources:
456456
- "resiliencehub:ListAppAssessmentComplianceDrifts"
457457
- "resiliencehub:ListTestRecommendations"
458458
- "resiliencehub:DescribeResiliencyPolicy"
459-
Resource: "*" # Wildcard required as actions do not support resource-level permissions
459+
- "resiliencehub:ListAppVersionResources"
460+
Resource: "*" # Wildcard required as actions do not support resource-level permissions
460461
Roles:
461462
- Ref: LambdaRole
462463
Metadata:

data-collection/deploy/module-resilience-hub.yaml

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -192,18 +192,16 @@ Resources:
192192
# file will be uploaded to s3 at the end
193193
"""
194194
temp_file = None
195-
records = 0
196195
try:
197196
# Create temporary file
198197
temp_file = tempfile.NamedTemporaryFile(mode='w', delete=False, encoding='utf-8')
199198
def write_json(data) -> None:
200-
records += 1
201199
temp_file.write(json.dumps(sort_dict(data), default=json_converter) + '\n')
202200
yield write_json
203201
if not temp_file.closed:
204202
temp_file.close()
205203
s3_client.upload_file(temp_file.name, bucket, s3_path)
206-
print(f"Uploaded {records} records to s3://{bucket}/{s3_path}")
204+
print(f"Uploaded records to s3://{bucket}/{s3_path}")
207205
208206
except Exception as e:
209207
print(f"Error during S3 upload s3://{bucket}/{s3_path}: {str(e)}")
@@ -264,7 +262,7 @@ Resources:
264262
app_arn = app_summary['appArn']
265263
app_id = app_arn.split('/')[-1]
266264
app = resilience_client.describe_app(appArn=app_arn)['app']
267-
265+
268266
# Initialize data structure
269267
app_data = {
270268
'region': region,
@@ -332,8 +330,8 @@ Resources:
332330
333331
with s3_uploader(f'{module_name}/{module_name}-app_component_recommendations_latest/payer_id={payer_id}/account_id={account_id}/region_code={region}/app_id={app_id}/latest.json') as write:
334332
for rec in paginate(resilience_client.list_app_component_recommendations, 'componentRecommendations', assessmentArn=latest_assessment['assessmentArn']):
335-
print(f'Record Value Test {rec}')
336333
rec['assessment_arn'] = assessment_arn
334+
print(f'Record Value Test {rec}')
337335
write(rec)
338336
339337
with s3_uploader(f'{module_name}/{module_name}-alarm_recommendations_latest/payer_id={payer_id}/account_id={account_id}/region_code={region}/app_id={app_id}/latest.json') as write:
@@ -393,6 +391,19 @@ Resources:
393391
write(rec)
394392
app_data['app_component_drifts'] = str(app_component_drifts)
395393
394+
395+
with s3_uploader(f'{module_name}/{module_name}-app_assessment_latest/payer_id={payer_id}/account_id={account_id}/region_code={region}/app_id={app_id}/latest.json') as write:
396+
rec = resilience_client.describe_app_assessment(assessmentArn=latest_assessment['assessmentArn'])['assessment']
397+
version = rec.get('appVersion', '')
398+
write(rec)
399+
400+
with s3_uploader(f'{module_name}/{module_name}-app_version_resources_latest/payer_id={payer_id}/account_id={account_id}/region_code={region}/app_id={app_id}/latest.json') as write:
401+
for rec in paginate(resilience_client.list_app_version_resources, 'physicalResources', appArn=app_arn, appVersion=version):
402+
rec['app_version'] = version
403+
rec['app_arn'] = app_arn
404+
write(rec)
405+
406+
396407
with s3_uploader(f'{module_name}/{module_name}-applications/payer_id={payer_id}/account={account_id}/{region}-{app_id}.json') as write_app:
397408
write_app(app_data)
398409
with s3_uploader(f'{module_name}/{module_name}-application-details/payer_id={payer_id}/account_id={account_id}/{region}-{app_id}.json') as write_app:
@@ -473,11 +484,14 @@ Resources:
473484
- Path: !Sub "s3://${DestinationBucket}/${CFDataName}/${CFDataName}-application-details/"
474485
- Path: !Sub "s3://${DestinationBucket}/${CFDataName}/${CFDataName}-resiliency_policy/"
475486
- Path: !Sub "s3://${DestinationBucket}/${CFDataName}/${CFDataName}-assessments/"
476-
- Path: !Sub "s3://${DestinationBucket}/${CFDataName}/${CFDataName}-app_component_recommendations/"
487+
- Path: !Sub "s3://${DestinationBucket}/${CFDataName}/${CFDataName}-app_component_recommendations_latest/"
477488
- Path: !Sub "s3://${DestinationBucket}/${CFDataName}/${CFDataName}-alarm_recommendations_latest/"
478489
- Path: !Sub "s3://${DestinationBucket}/${CFDataName}/${CFDataName}-sop_recommendations_latest/"
479490
- Path: !Sub "s3://${DestinationBucket}/${CFDataName}/${CFDataName}-test_recommendations_latest/"
480491
- Path: !Sub "s3://${DestinationBucket}/${CFDataName}/${CFDataName}-compliance_drifts_latest/"
492+
- Path: !Sub "s3://${DestinationBucket}/${CFDataName}/${CFDataName}-app_assessment_latest/"
493+
- Path: !Sub "s3://${DestinationBucket}/${CFDataName}/${CFDataName}-app_version_resources_latest/"
494+
481495
SchemaChangePolicy:
482496
UpdateBehavior: UPDATE_IN_DATABASE
483497
DeleteBehavior: DEPRECATE_IN_DATABASE

0 commit comments

Comments
 (0)