Skip to content

Commit

Permalink
Issue #5 mv templateReaders inputReaders
Browse files Browse the repository at this point in the history
  • Loading branch information
cschneider-vertical-relevance committed May 3, 2022
1 parent 4bdd0bb commit 6133af3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
4 changes: 2 additions & 2 deletions stacks/control_broker_stack.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def __init__(
self.deploy_outer_sfn_lambdas()
self.deploy_outer_sfn()

self.Input_reader_roles: List[aws_iam.Role] = [
self.input_reader_roles: List[aws_iam.Role] = [
self.lambda_evaluate_cloudformation_by_opa.role,
self.lambda_pac_evaluation_router.role,
]
Expand All @@ -79,7 +79,7 @@ def __init__(
CfnOutput(
self,
"InputReaderArns",
value=json.dumps([r.role_arn for r in self.Input_reader_roles]),
value=json.dumps([r.role_arn for r in self.input_reader_roles]),
)

def deploy_utils(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,30 +10,36 @@
cloudcontrol = boto3.client('cloudcontrol')

def get_object(*,bucket,key):

try:
r = s3.get_object(
Bucket = bucket,
Key = key
)
except ClientError as e:
print(f'ClientError:\n{e}')
print(f'ClientError:\nbucket:\n{bucket}\nkey:\n{key}\n{e}')
raise
else:
print(f'no ClientError get_object:\nbucket:\n{bucket}\nkey:\n{key}\n{e}')
body = r['Body']
content = json.loads(body.read().decode('utf-8'))
return content

def put_object(*,bucket,key,object_:dict):

print(f'begin put_object\nbucket:\n{bucket}\nkey:\n{key}')

try:
r = s3.put_object(
Bucket = bucket,
Key = key,
Body = json.dumps(object_)
)
except ClientError as e:
print(f'ClientError:\n{e}')
print(f'ClientError:\nbucket:\n{bucket}\nkey:\n{key}\n{e}')
raise
else:
print(f'no ClientError put_object:\nbucket:\n{bucket}\nkey:\n{key}\n{e}')
return True

class CloudControl():
Expand Down Expand Up @@ -309,7 +315,7 @@ def get_routing_decision(self):
input_conversion_object = self.convert_config_event_to_cfn
),
"InvokingSfnNextState": self.get_invoking_sfn_next_state(
input_type = "CloudFormationTemplate",
input_type = "CloudFormationTemplate", # ConvertedTo
pac_framework = pac_framework,
)
}
Expand Down

0 comments on commit 6133af3

Please sign in to comment.