Skip to content

Commit

Permalink
ruff format
Browse files Browse the repository at this point in the history
  • Loading branch information
noah-paige committed Sep 10, 2024
1 parent e76479e commit 3d4c86a
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 12 deletions.
2 changes: 1 addition & 1 deletion deploy/stacks/albfront_stack.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ def create_log_group(self, envname, resource_prefix, log_group_name):
f'ECSLogGroup{log_group_name}{envname}',
log_group_name=f'/{resource_prefix}/{envname}/ecs/{log_group_name}',
removal_policy=RemovalPolicy.DESTROY,
retention=getattr(logs.RetentionDays, self.log_retention_duration)
retention=getattr(logs.RetentionDays, self.log_retention_duration),
)
return log_group

Expand Down
6 changes: 4 additions & 2 deletions deploy/stacks/container.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,9 @@ def __init__(
ecs.CfnTaskDefinition.KeyValuePairProperty(name='envname', value=envname),
ecs.CfnTaskDefinition.KeyValuePairProperty(name='LOGLEVEL', value='DEBUG'),
ecs.CfnTaskDefinition.KeyValuePairProperty(name='config_location', value='/config.json'),
ecs.CfnTaskDefinition.KeyValuePairProperty(name='LOG_RETENTION', value=self.log_retention_duration),
ecs.CfnTaskDefinition.KeyValuePairProperty(
name='LOG_RETENTION', value=self.log_retention_duration
),
],
essential=True,
log_configuration=ecs.CfnTaskDefinition.LogConfigurationProperty(
Expand Down Expand Up @@ -717,7 +719,7 @@ def create_log_group(self, envname, resource_prefix, log_group_name):
f'ECSLogGroup{log_group_name}{envname}',
log_group_name=f'/{resource_prefix}/{envname}/ecs/{log_group_name}',
removal_policy=RemovalPolicy.DESTROY,
retention=getattr(logs.RetentionDays, self.log_retention_duration)
retention=getattr(logs.RetentionDays, self.log_retention_duration),
)
return log_group

Expand Down
19 changes: 14 additions & 5 deletions deploy/stacks/lambda_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,10 @@ def __init__(
'ElasticSearchProxyHandler',
function_name=f'{resource_prefix}-{envname}-esproxy',
log_group=logs.LogGroup(
self, 'esproxyloggroup', log_group_name=f'/aws/lambda/{resource_prefix}-{envname}-backend-esproxy', retention=getattr(logs.RetentionDays, self.log_retention_duration)
self,
'esproxyloggroup',
log_group_name=f'/aws/lambda/{resource_prefix}-{envname}-backend-esproxy',
retention=getattr(logs.RetentionDays, self.log_retention_duration),
),
description='dataall es search function',
role=self.create_function_role(envname, resource_prefix, 'esproxy', pivot_role_name, vpc),
Expand Down Expand Up @@ -145,7 +148,10 @@ def __init__(
'LambdaGraphQL',
function_name=f'{resource_prefix}-{envname}-graphql',
log_group=logs.LogGroup(
self, 'graphqlloggroup', log_group_name=f'/aws/lambda/{resource_prefix}-{envname}-backend-graphql', retention=getattr(logs.RetentionDays, self.log_retention_duration)
self,
'graphqlloggroup',
log_group_name=f'/aws/lambda/{resource_prefix}-{envname}-backend-graphql',
retention=getattr(logs.RetentionDays, self.log_retention_duration),
),
description='dataall graphql function',
role=self.create_function_role(envname, resource_prefix, 'graphql', pivot_role_name, vpc),
Expand Down Expand Up @@ -176,7 +182,10 @@ def __init__(
'AWSWorker',
function_name=f'{resource_prefix}-{envname}-awsworker',
log_group=logs.LogGroup(
self, 'awsworkerloggroup', log_group_name=f'/aws/lambda/{resource_prefix}-{envname}-backend-awsworker', retention=getattr(logs.RetentionDays, self.log_retention_duration)
self,
'awsworkerloggroup',
log_group_name=f'/aws/lambda/{resource_prefix}-{envname}-backend-awsworker',
retention=getattr(logs.RetentionDays, self.log_retention_duration),
),
description='dataall aws worker for aws asynchronous tasks function',
role=self.create_function_role(envname, resource_prefix, 'awsworker', pivot_role_name, vpc),
Expand Down Expand Up @@ -248,7 +257,7 @@ def __init__(
self,
'customauthorizerloggroup',
log_group_name=f'/aws/lambda/{resource_prefix}-{envname}-custom-authorizer',
retention=getattr(logs.RetentionDays, self.log_retention_duration)
retention=getattr(logs.RetentionDays, self.log_retention_duration),
),
handler='custom_authorizer_lambda.lambda_handler',
code=_lambda.Code.from_asset(
Expand Down Expand Up @@ -766,7 +775,7 @@ def set_up_graphql_api_gateway(
f'{resource_prefix}/{envname}/apigateway',
log_group_name=f'{resource_prefix}/{envname}/apigateway',
removal_policy=RemovalPolicy.DESTROY,
retention=getattr(logs.RetentionDays, self.log_retention_duration),
retention=getattr(logs.RetentionDays, self.log_retention_duration),
)

iam_policy = iam.PolicyDocument(
Expand Down
2 changes: 1 addition & 1 deletion deploy/stacks/opensearch.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def __init__(
id='EsAppLogGroup',
log_group_name=f'/{resource_prefix}/{envname}/opensearch',
removal_policy=RemovalPolicy.DESTROY,
retention=getattr(logs.RetentionDays, log_retention_duration),
retention=getattr(logs.RetentionDays, log_retention_duration),
)

self.domain = opensearch.Domain(
Expand Down
2 changes: 1 addition & 1 deletion deploy/stacks/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -652,7 +652,7 @@ def set_backend_stage(self, target_env, repository_name):
custom_waf_rules=target_env.get('custom_waf_rules', None),
with_approval_tests=target_env.get('with_approval_tests', False),
allowed_origins=target_env.get('allowed_origins', '*'),
log_retention_duration=target_env.get('log_retention_duration', 'TWO_YEARS')
log_retention_duration=target_env.get('log_retention_duration', 'TWO_YEARS'),
)
)
return backend_stage
Expand Down
4 changes: 2 additions & 2 deletions deploy/stacks/vpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def __init__(
**kwargs,
):
super().__init__(scope, id, **kwargs)
self.log_retention_duration=log_retention_duration
self.log_retention_duration = log_retention_duration

if vpc_id:
self.vpc = ec2.Vpc.from_lookup(self, 'vpc', vpc_id=vpc_id)
Expand Down Expand Up @@ -181,7 +181,7 @@ def create_new_vpc(self, cidr, envname, resource_prefix, restricted_nacl):
f'{resource_prefix}/{envname}/flowlogs',
log_group_name=f'{resource_prefix}/{envname}/flowlogs',
removal_policy=RemovalPolicy.DESTROY,
retention=getattr(logs.RetentionDays, self.log_retention_duration)
retention=getattr(logs.RetentionDays, self.log_retention_duration),
)
iam_policy = iam.PolicyDocument(
assign_sids=True,
Expand Down

0 comments on commit 3d4c86a

Please sign in to comment.