Skip to content

Commit f66b78a

Browse files
authored
Merge pull request #4 from HicResearch/upgrade-cdkv2-extras
Small fixes to feature/upgrade-cdkv2
2 parents 57ae359 + b0d75e3 commit f66b78a

File tree

6 files changed

+112
-97
lines changed

6 files changed

+112
-97
lines changed

.pre-commit-config.yaml

Lines changed: 41 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,15 @@
11
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v4.4.0
4+
hooks:
5+
- id: trailing-whitespace
6+
- id: end-of-file-fixer
7+
- id: check-docstring-first
8+
- id: check-json
9+
- id: check-added-large-files
10+
- id: debug-statements
11+
- id: name-tests-test
12+
- id: requirements-txt-fixer
213
- repo: https://github.com/pycqa/isort
314
rev: 5.11.5
415
hooks:
@@ -15,58 +26,55 @@ repos:
1526
rev: 6.0.0
1627
hooks:
1728
- id: flake8
18-
args: ['--max-line-length=200', '--ignore=E203,W503', '--max-cognitive-complexity=17', '--max-expression-complexity=9' ]
29+
args:
30+
[
31+
"--max-line-length=200",
32+
"--ignore=E203,W503",
33+
"--max-cognitive-complexity=17",
34+
"--max-expression-complexity=9",
35+
]
1936
additional_dependencies: [
20-
flake8-bugbear, # Detect potential bugs
21-
flake8-builtins, # Check for built-ins being used as variables
22-
flake8-cognitive-complexity, # Check max function complexity
23-
flake8-comprehensions, # Suggestions for better list/set/dict comprehensions
24-
flake8-expression-complexity, # Check max expression complexity
25-
flake8-fixme, # Check for FIXME, TODO, and XXX left in comments
26-
flake8-logging-format, # Validate (lack of) logging format strings
27-
flake8-pie, # Misc. linting rules
28-
flake8-pytest-style, # Check against pytest style guide
29-
flake8-return, # Check return statements
30-
flake8-simplify, # Suggestions to simplify code
31-
flake8-use-fstring, # Encourages use of f-strings vs old style
32-
pep8-naming, # Check PEP8 class naming
33-
]
37+
flake8-bugbear, # Detect potential bugs
38+
flake8-builtins, # Check for built-ins being used as variables
39+
flake8-cognitive-complexity, # Check max function complexity
40+
flake8-comprehensions, # Suggestions for better list/set/dict comprehensions
41+
flake8-expression-complexity, # Check max expression complexity
42+
flake8-fixme, # Check for FIXME, TODO, and XXX left in comments
43+
flake8-logging-format, # Validate (lack of) logging format strings
44+
flake8-pie, # Misc. linting rules
45+
flake8-pytest-style, # Check against pytest style guide
46+
flake8-return, # Check return statements
47+
flake8-simplify, # Suggestions to simplify code
48+
flake8-use-fstring, # Encourages use of f-strings vs old style
49+
pep8-naming, # Check PEP8 class naming
50+
]
3451
verbose: true
3552
- repo: https://github.com/Lucas-C/pre-commit-hooks-safety
3653
rev: v1.3.1
3754
hooks:
38-
- id: python-safety-dependencies-check
39-
verbose: true
55+
- id: python-safety-dependencies-check
56+
verbose: true
4057
- repo: https://github.com/awslabs/git-secrets
4158
rev: 99d01d58ebcc06e237c0e3f3ff5ae628aeef6aa6
4259
hooks:
4360
- id: git-secrets
4461
verbose: true
45-
entry: 'git-secrets --register-aws'
62+
entry: "git-secrets --register-aws"
4663
language: script
4764
name: git-secrets-register-aws-provider
4865
- id: git-secrets
4966
verbose: true
50-
entry: 'git-secrets --scan'
67+
entry: "git-secrets --scan"
5168
language: script
5269
name: git-secrets-scan
53-
- repo: https://github.com/markdownlint/markdownlint
54-
rev: v0.12.0
70+
- repo: https://github.com/pre-commit/mirrors-prettier
71+
rev: v2.7.1
5572
hooks:
56-
- id: markdownlint
57-
name: Markdownlint
58-
description: Run markdownlint on your Markdown files
59-
entry: mdl .
60-
language: ruby
61-
files: \.(md|mdown|markdown)$
62-
verbose: true
63-
args:
64-
- "-s"
65-
- "mdl_style.rb"
73+
- id: prettier
6674
- repo: https://github.com/PyCQA/bandit
67-
rev: '1.7.5'
75+
rev: "1.7.5"
6876
hooks:
6977
- id: bandit
7078
entry: bandit
7179
exclude: ^tests/
72-
verbose: true
80+
verbose: true

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ Pay attention to any automated CI failures reported in the pull request, and sta
6464

6565
- [ ] Testing
6666
- Unit test added (prefer not to modify an existing test, otherwise,
67-
it's probably a breaking change)
67+
it's probably a breaking change)
6868
- [ ] Docs
6969
- **README**: README updated if necessary
7070
- [ ] Title and Description

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,12 @@ cd secure-egress-backend
6262
- [ ] Run the following commands to create an isolated Python environment and deploy the CDK backend stack:
6363

6464
```bash
65-
alias cdkv1="npx aws-cdk@1.154"
65+
alias cdkv2="npx aws-cdk@2.81"
6666
python3 -m venv .venv
6767
source .venv/bin/activate
6868
pip3 install -r requirements.txt
69-
cdkv1 bootstrap aws://<<AWS_ACCOUNT_ID>>/<<AWS_REGION>> # TRE account ID / eu-west-2
70-
cdkv1 deploy
69+
cdkv2 bootstrap aws://<<AWS_ACCOUNT_ID>>/<<AWS_REGION>> # TRE account ID / eu-west-2
70+
cdkv2 deploy
7171
```
7272
7373
## Solution Overview
@@ -255,8 +255,8 @@ be used at various points. Among the key values are:
255255
- Step Function choice task which parses the status of the request as received from the frontend API call in the
256256
previous task to determine if the request was **_APPROVED_** or **_REJECTED_** by Information Governance
257257
- At this step the Step Function also checks if any additional approvals are required based on the value of `is_single_approval_enabled`.
258-
If no further approvals are required the appropriate data operation is done based on the decision
259-
and an email is sent to the requester.
258+
If no further approvals are required the appropriate data operation is done based on the decision
259+
and an email is sent to the requester.
260260
If an additional approval is required Research IT approval workflow is followed.
261261
262262
- **Delete Rejected Objects From Staging - IGLead:**

egress_backend/egress_backend_stack.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -911,6 +911,7 @@ def __init__(
911911
{
912912
"Egress Request ID": sfn.JsonPath.string_at("$.egress_request_id"),
913913
"Researcher Email": sfn.JsonPath.string_at("$.created_by_email"),
914+
"Workspace ID": sfn.JsonPath.string_at("$.workspace_id"),
914915
"Egress Object File Types": sfn.JsonPath.string_at(
915916
"$.copy_to_staging_result.file_extensions"
916917
),
@@ -930,6 +931,7 @@ def __init__(
930931
{
931932
"Egress Request ID": sfn.JsonPath.string_at("$.egress_request_id"),
932933
"Researcher Email": sfn.JsonPath.string_at("$.created_by_email"),
934+
"Workspace ID": sfn.JsonPath.string_at("$.workspace_id"),
933935
"Information Governance": sfn.JsonPath.string_at(
934936
"$.information_governance.result.ig_reviewer_1_email"
935937
),
@@ -1963,6 +1965,14 @@ def __init__(
19631965
else egress_app_url,
19641966
description="The URL for the Egress App.",
19651967
)
1968+
1969+
CfnOutput(
1970+
self,
1971+
"MaxDownloadsAllowed",
1972+
value=self.node.try_get_context(env_id).get("max_downloads_allowed"),
1973+
description="Max downloads allowed parameter provided.",
1974+
)
1975+
19661976
for idx, role in enumerate(
19671977
self.node.try_get_context(env_id).get("egress_reviewer_roles")
19681978
):

egress_backend/graphql/schema.graphql

Lines changed: 55 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,73 +1,73 @@
11
input DownloadDataInput {
2-
egress_request_id: String!
3-
workspace_id: String!
4-
download_count: String!
2+
egress_request_id: String!
3+
workspace_id: String!
4+
download_count: String!
55
}
66

77
type Mutation {
8-
updateRequest(request: UpdateRequestInput!): String
9-
@aws_auth(cognito_groups: ["InformationGovernance","TREAdmin"])
10-
downloadData(request: DownloadDataInput!): presign_payload
11-
@aws_auth(cognito_groups: ["InformationGovernance"])
8+
updateRequest(request: UpdateRequestInput!): String
9+
@aws_auth(cognito_groups: ["InformationGovernance", "TREAdmin"])
10+
downloadData(request: DownloadDataInput!): presign_payload
11+
@aws_auth(cognito_groups: ["InformationGovernance"])
1212
}
1313

1414
type Query {
15-
listRequests: [Request]
16-
@aws_auth(cognito_groups: ["InformationGovernance","TREAdmin"])
15+
listRequests: [Request]
16+
@aws_auth(cognito_groups: ["InformationGovernance", "TREAdmin"])
1717
}
1818

19-
type Request @aws_auth(cognito_groups: ["InformationGovernance","TREAdmin"]) {
20-
egress_request_id: String!
21-
egress_store_name: String!
22-
swb_egress_store_id: String!
23-
project_id: String!
24-
workspace_id: String!
25-
requested_by: String!
26-
requested_dt: String!
27-
updated_by: String!
28-
updated_dt: String!
29-
egress_status: String!
30-
s3_egress_store_bucket: String!
31-
s3_egress_store_bucket_path: String!
32-
s3_egress_store_object_list_location: String!
33-
s3_swb_object_metadata_version: String!
34-
task_token: String
35-
ig_reviewer_1_name: String
36-
ig_reviewer_1_email: String
37-
ig_reviewer_1_dt: String
38-
ig_reviewer_1_reason: String
39-
ig_reviewer_1_decision: String
40-
rit_reviewer_2_name: String
41-
rit_reviewer_2_email: String
42-
rit_reviewer_2_dt: String
43-
rit_reviewer_2_reason: String
44-
rit_reviewer_2_decision: String
45-
current_reviewer_group: String
46-
s3_staging_object_metadata_version: String
47-
download_count: String
48-
is_single_approval_enabled: String
19+
type Request @aws_auth(cognito_groups: ["InformationGovernance", "TREAdmin"]) {
20+
egress_request_id: String!
21+
egress_store_name: String!
22+
swb_egress_store_id: String!
23+
project_id: String!
24+
workspace_id: String!
25+
requested_by: String!
26+
requested_dt: String!
27+
updated_by: String!
28+
updated_dt: String!
29+
egress_status: String!
30+
s3_egress_store_bucket: String!
31+
s3_egress_store_bucket_path: String!
32+
s3_egress_store_object_list_location: String!
33+
s3_swb_object_metadata_version: String!
34+
task_token: String
35+
ig_reviewer_1_name: String
36+
ig_reviewer_1_email: String
37+
ig_reviewer_1_dt: String
38+
ig_reviewer_1_reason: String
39+
ig_reviewer_1_decision: String
40+
rit_reviewer_2_name: String
41+
rit_reviewer_2_email: String
42+
rit_reviewer_2_dt: String
43+
rit_reviewer_2_reason: String
44+
rit_reviewer_2_decision: String
45+
current_reviewer_group: String
46+
s3_staging_object_metadata_version: String
47+
download_count: String
48+
is_single_approval_enabled: String
4949
}
5050

5151
input UpdateRequestInput {
52-
egress_request_id: String!
53-
task_token: String!
54-
ig_reviewer_1_name: String
55-
ig_reviewer_1_email: String
56-
ig_reviewer_1_dt: String
57-
ig_reviewer_1_reason: String
58-
ig_reviewer_1_decision: String
59-
rit_reviewer_2_name: String
60-
rit_reviewer_2_email: String
61-
rit_reviewer_2_dt: String
62-
rit_reviewer_2_reason: String
63-
rit_reviewer_2_decision: String
52+
egress_request_id: String!
53+
task_token: String!
54+
ig_reviewer_1_name: String
55+
ig_reviewer_1_email: String
56+
ig_reviewer_1_dt: String
57+
ig_reviewer_1_reason: String
58+
ig_reviewer_1_decision: String
59+
rit_reviewer_2_name: String
60+
rit_reviewer_2_email: String
61+
rit_reviewer_2_dt: String
62+
rit_reviewer_2_reason: String
63+
rit_reviewer_2_decision: String
6464
}
6565

6666
type presign_payload {
67-
presign_url: String
67+
presign_url: String
6868
}
6969

7070
schema {
71-
query: Query
72-
mutation: Mutation
73-
}
71+
query: Query
72+
mutation: Mutation
73+
}

mdl_style.rb

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)