Skip to content

Commit b5c7140

Browse files
Merge branch 'main' into AEA-5853-test-params
2 parents adbe7af + 6d72649 commit b5c7140

File tree

8 files changed

+63
-20
lines changed

8 files changed

+63
-20
lines changed

.github/scripts/release_code.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,3 +52,4 @@ sam deploy \
5252
TC007NHSNumberValue="$TC007_NHS_NUMBERS" \
5353
TC008NHSNumberValue="$TC008_NHS_NUMBERS" \
5454
TC009NHSNumberValue="$TC009_NHS_NUMBERS"
55+
ForwardCsocLogs="$FORWARD_CSOC_LOGS"

.github/workflows/ci.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ jobs:
7878
STATE_MACHINE_LOG_LEVEL: ALL
7979
RUN_REGRESSION_TESTS: true
8080
REGRESSION_TEST_PRODUCT: PFP-APIGEE
81+
FORWARD_CSOC_LOGS: false
8182
secrets:
8283
REGRESSION_TESTS_PEM: ${{ secrets.REGRESSION_TESTS_PEM }}
8384
CLOUD_FORMATION_DEPLOY_ROLE: ${{ secrets.DEV_CLOUD_FORMATION_DEPLOY_ROLE }}
@@ -105,6 +106,7 @@ jobs:
105106
LOG_RETENTION_DAYS: 30
106107
STATE_MACHINE_LOG_LEVEL: ALL
107108
RUN_REGRESSION_TESTS: false
109+
FORWARD_CSOC_LOGS: false
108110
secrets:
109111
REGRESSION_TESTS_PEM: ${{ secrets.REGRESSION_TESTS_PEM }}
110112
CLOUD_FORMATION_DEPLOY_ROLE: ${{ secrets.DEV_CLOUD_FORMATION_DEPLOY_ROLE }}
@@ -138,6 +140,7 @@ jobs:
138140
STATE_MACHINE_LOG_LEVEL: ALL
139141
RUN_REGRESSION_TESTS: true
140142
REGRESSION_TEST_PRODUCT: PFP-APIGEE
143+
FORWARD_CSOC_LOGS: false
141144
secrets:
142145
REGRESSION_TESTS_PEM: ${{ secrets.REGRESSION_TESTS_PEM }}
143146
CLOUD_FORMATION_DEPLOY_ROLE: ${{ secrets.QA_CLOUD_FORMATION_DEPLOY_ROLE }}

.github/workflows/pull_request.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ jobs:
108108
TC007_NHS_NUMBERS: ${{vars.TC007_NHS_NUMBERS}}
109109
TC008_NHS_NUMBERS: ${{vars.TC008_NHS_NUMBERS}}
110110
TC009_NHS_NUMBERS: ${{vars.TC009_NHS_NUMBERS}}
111+
FORWARD_CSOC_LOGS: false
111112
secrets:
112113
REGRESSION_TESTS_PEM: ${{ secrets.REGRESSION_TESTS_PEM }}
113114
CLOUD_FORMATION_DEPLOY_ROLE: ${{ secrets.DEV_CLOUD_FORMATION_DEPLOY_ROLE }}
@@ -134,6 +135,7 @@ jobs:
134135
TC007_NHS_NUMBERS: "xxx"
135136
TC008_NHS_NUMBERS: "xxx"
136137
TC009_NHS_NUMBERS: "xxx"
138+
FORWARD_CSOC_LOGS: false
137139
secrets:
138140
REGRESSION_TESTS_PEM: ${{ secrets.REGRESSION_TESTS_PEM }}
139141
CLOUD_FORMATION_DEPLOY_ROLE: ${{ secrets.DEV_CLOUD_FORMATION_DEPLOY_ROLE }}

.github/workflows/release.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ jobs:
7777
TC007_NHS_NUMBERS: ${{vars.TC007_NHS_NUMBERS}}
7878
TC008_NHS_NUMBERS: ${{vars.TC008_NHS_NUMBERS}}
7979
TC009_NHS_NUMBERS: ${{vars.TC009_NHS_NUMBERS}}
80+
FORWARD_CSOC_LOGS: false
8081
secrets:
8182
REGRESSION_TESTS_PEM: ${{ secrets.REGRESSION_TESTS_PEM }}
8283
CLOUD_FORMATION_DEPLOY_ROLE: ${{ secrets.DEV_CLOUD_FORMATION_DEPLOY_ROLE }}
@@ -107,6 +108,7 @@ jobs:
107108
TC007_NHS_NUMBERS: ${{vars.TC007_NHS_NUMBERS}}
108109
TC008_NHS_NUMBERS: ${{vars.TC008_NHS_NUMBERS}}
109110
TC009_NHS_NUMBERS: ${{vars.TC009_NHS_NUMBERS}}
111+
FORWARD_CSOC_LOGS: false
110112
secrets:
111113
REGRESSION_TESTS_PEM: ${{ secrets.REGRESSION_TESTS_PEM }}
112114
CLOUD_FORMATION_DEPLOY_ROLE: ${{ secrets.DEV_CLOUD_FORMATION_DEPLOY_ROLE }}
@@ -142,6 +144,7 @@ jobs:
142144
TC007_NHS_NUMBERS: ${{vars.TC007_NHS_NUMBERS}}
143145
TC008_NHS_NUMBERS: ${{vars.TC008_NHS_NUMBERS}}
144146
TC009_NHS_NUMBERS: ${{vars.TC009_NHS_NUMBERS}}
147+
FORWARD_CSOC_LOGS: false
145148
secrets:
146149
REGRESSION_TESTS_PEM: ${{ secrets.REGRESSION_TESTS_PEM }}
147150
CLOUD_FORMATION_DEPLOY_ROLE: ${{ secrets.REF_CLOUD_FORMATION_DEPLOY_ROLE }}
@@ -178,6 +181,7 @@ jobs:
178181
TC007_NHS_NUMBERS: ${{vars.TC007_NHS_NUMBERS}}
179182
TC008_NHS_NUMBERS: ${{vars.TC008_NHS_NUMBERS}}
180183
TC009_NHS_NUMBERS: ${{vars.TC009_NHS_NUMBERS}}
184+
FORWARD_CSOC_LOGS: false
181185
secrets:
182186
REGRESSION_TESTS_PEM: ${{ secrets.REGRESSION_TESTS_PEM }}
183187
CLOUD_FORMATION_DEPLOY_ROLE: ${{ secrets.QA_CLOUD_FORMATION_DEPLOY_ROLE }}
@@ -209,6 +213,7 @@ jobs:
209213
TC007_NHS_NUMBERS: ${{vars.TC007_NHS_NUMBERS}}
210214
TC008_NHS_NUMBERS: ${{vars.TC008_NHS_NUMBERS}}
211215
TC009_NHS_NUMBERS: ${{vars.TC009_NHS_NUMBERS}}
216+
FORWARD_CSOC_LOGS: false
212217
secrets:
213218
REGRESSION_TESTS_PEM: ${{ secrets.REGRESSION_TESTS_PEM }}
214219
CLOUD_FORMATION_DEPLOY_ROLE: ${{ secrets.INT_CLOUD_FORMATION_DEPLOY_ROLE }}
@@ -239,6 +244,7 @@ jobs:
239244
TC007_NHS_NUMBERS: "xxx"
240245
TC008_NHS_NUMBERS: "xxx"
241246
TC009_NHS_NUMBERS: "xxx"
247+
FORWARD_CSOC_LOGS: false
242248
secrets:
243249
REGRESSION_TESTS_PEM: ${{ secrets.REGRESSION_TESTS_PEM }}
244250
CLOUD_FORMATION_DEPLOY_ROLE: ${{ secrets.INT_CLOUD_FORMATION_DEPLOY_ROLE }}
@@ -270,6 +276,7 @@ jobs:
270276
TC007_NHS_NUMBERS: "xxx"
271277
TC008_NHS_NUMBERS: "xxx"
272278
TC009_NHS_NUMBERS: "xxx"
279+
FORWARD_CSOC_LOGS: true
273280
secrets:
274281
REGRESSION_TESTS_PEM: ${{ secrets.REGRESSION_TESTS_PEM }}
275282
CLOUD_FORMATION_DEPLOY_ROLE: ${{ secrets.PROD_CLOUD_FORMATION_DEPLOY_ROLE }}

.github/workflows/sam_release_code.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,9 @@ on:
7272
TC009_NHS_NUMBERS:
7373
required: false
7474
type: string
75+
FORWARD_CSOC_LOGS:
76+
required: true
77+
type: boolean
7578
secrets:
7679
CLOUD_FORMATION_DEPLOY_ROLE:
7780
required: true
@@ -154,6 +157,7 @@ jobs:
154157
TC007_NHS_NUMBERS: ${{ inputs.TC007_NHS_NUMBERS }}
155158
TC008_NHS_NUMBERS: ${{ inputs.TC008_NHS_NUMBERS }}
156159
TC009_NHS_NUMBERS: ${{ inputs.TC009_NHS_NUMBERS }}
160+
FORWARD_CSOC_LOGS: ${{ inputs.FORWARD_CSOC_LOGS }}
157161
run: ./release_code.sh
158162

159163
- name: create_int_release_notes

SAMtemplates/apis/api_resources.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,17 @@ Parameters:
1818

1919
EnableSplunk:
2020
Type: String
21+
ForwardCsocLogs:
22+
Type: String
23+
Default: false
2124

2225
Conditions:
2326
ShouldUseSplunk: !Equals
2427
- true
2528
- !Ref EnableSplunk
29+
ShouldForwardCsocLogs: !Equals
30+
- true
31+
- !Ref ForwardCsocLogs
2632

2733
Resources:
2834
ApiGwRole:
@@ -65,6 +71,15 @@ Resources:
6571
FilterPattern: ""
6672
DestinationArn: !ImportValue lambda-resources:SplunkDeliveryStream
6773

74+
ApiGwAccessLogsCsocSubscriptionFilter:
75+
Condition: ShouldForwardCsocLogs
76+
Type: AWS::Logs::SubscriptionFilter
77+
Properties:
78+
RoleArn: !ImportValue lambda-resources:SplunkSubscriptionFilterRole
79+
LogGroupName: !Ref ApiGwAccessLogs
80+
FilterPattern: ""
81+
DestinationArn: "arn:aws:logs:eu-west-2:693466633220:destination:api_gateway_log_destination"
82+
6883
Outputs:
6984
ApiGwRoleArn:
7085
Description: The API GW role ARN

SAMtemplates/apis/main.yaml

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Parameters:
1010

1111
EnableMutualTLS:
1212
Type: String
13-
13+
1414
TruststoreVersion:
1515
Type: String
1616

@@ -20,33 +20,35 @@ Parameters:
2020
GetMyPrescriptionsStateMachineName:
2121
Type: String
2222
Default: none
23-
23+
2424
GetMyPrescriptionsStateMachineArn:
2525
Type: String
2626
Default: none
27-
27+
2828
CapabilityStatementFunctionName:
2929
Type: String
3030
Default: none
31-
31+
3232
CapabilityStatementFunctionArn:
3333
Type: String
3434
Default: none
35-
35+
3636
StatusFunctionName:
3737
Type: String
3838
Default: none
39-
39+
4040
StatusFunctionArn:
4141
Type: String
4242
Default: none
43-
43+
4444
LogRetentionInDays:
4545
Type: Number
46-
46+
4747
EnableSplunk:
4848
Type: String
49-
49+
ForwardCsocLogs:
50+
Type: String
51+
Default: false
5052
Conditions:
5153
ShouldUseMutualTLS: !Equals
5254
- true
@@ -68,7 +70,7 @@ Resources:
6870
- - !Ref StackName
6971
- !ImportValue eps-route53-resources:EPS-domain
7072
HostedZoneId: !ImportValue eps-route53-resources:EPS-ZoneID
71-
73+
7274
RestApiGateway:
7375
Type: AWS::ApiGateway::RestApi
7476
Properties:
@@ -80,7 +82,7 @@ Resources:
8082
EndpointConfiguration:
8183
Types:
8284
- REGIONAL
83-
85+
8486
RestApiDomain:
8587
Type: AWS::ApiGateway::DomainName
8688
Properties:
@@ -89,7 +91,7 @@ Resources:
8991
- - !Ref StackName
9092
- !ImportValue eps-route53-resources:EPS-domain
9193
RegionalCertificateArn: !Ref GenerateCertificate
92-
EndpointConfiguration:
94+
EndpointConfiguration:
9395
Types:
9496
- REGIONAL
9597
SecurityPolicy: TLS_1_2
@@ -110,7 +112,7 @@ Resources:
110112
- ShouldUseMutualTLS
111113
- !Ref TruststoreVersion
112114
- !Ref AWS::NoValue
113-
115+
114116
RestApiRecordSet:
115117
Type: AWS::Route53::RecordSet
116118
Properties:
@@ -123,7 +125,7 @@ Resources:
123125
AliasTarget:
124126
DNSName: !GetAtt RestApiDomain.RegionalDomainName
125127
HostedZoneId: !GetAtt RestApiDomain.RegionalHostedZoneId
126-
128+
127129
GetMyPrescriptionsResource:
128130
Type: AWS::ApiGateway::Resource
129131
Properties:
@@ -223,7 +225,7 @@ Resources:
223225
224226
$payload.Payload.body
225227
MethodResponses:
226-
- StatusCode: "200"
228+
- StatusCode: "200"
227229

228230
CapabilityStatementResource:
229231
Type: AWS::ApiGateway::Resource
@@ -251,7 +253,7 @@ Resources:
251253
RestApiId: !Ref RestApiGateway
252254
ParentId: !GetAtt RestApiGateway.RootResourceId
253255
PathPart: _status
254-
256+
255257
StatusMethod:
256258
Type: AWS::ApiGateway::Method
257259
Properties:
@@ -278,7 +280,7 @@ Resources:
278280
- StatusMethod
279281
Properties:
280282
RestApiId: !Ref RestApiGateway
281-
283+
282284
RestApiGatewayStage:
283285
Type: AWS::ApiGateway::Stage
284286
Properties:
@@ -289,15 +291,15 @@ Resources:
289291
TracingEnabled: true
290292
AccessLogSetting:
291293
DestinationArn: !GetAtt RestApiGatewayResources.Outputs.ApiGwAccessLogsArn
292-
Format: '{ "requestTime": "$context.requestTime", "apiId": "$context.apiId", "accountId": "$context.accountId", "resourcePath": "$context.resourcePath", "stage": "$context.stage", "requestId": "$context.requestId", "extendedRequestId": "$context.extendedRequestId", "status": "$context.status", "httpMethod": "$context.httpMethod", "protocol": "$context.protocol", "path": "$context.path", "responseLatency": "$context.responseLatency", "responseLength": "$context.responseLength", "domainName": "$context.domainName", "identity": { "sourceIp": "$context.identity.sourceIp", "userAgent": "$context.identity.userAgent", "clientCert":{ "subjectDN": "$context.identity.clientCert.subjectDN", "issuerDN": "$context.identity.clientCert.issuerDN", "serialNumber": "$context.identity.clientCert.serialNumber", "validityNotBefore": "$context.identity.clientCert.validity.notBefore", "validityNotAfter": "$context.identity.clientCert.validity.notAfter" }}, "integration":{ "error": "$context.integration.error", "integrationStatus": "$context.integration.integrationStatus", "latency": "$context.integration.latency", "requestId": "$context.integration.requestId", "status": "$context.integration.status" }}'
293-
294+
Format: '{ "requestId": "$context.requestId", "ip": "$context.identity.sourceIp", "caller":"$context.identity.caller", "user":"$context.identity.user","requestTime":"$context.requestTime", "httpMethod":"$context.httpMethod","resourcePath":"$context.resourcePath", "status":"$context.status","protocol":"$context.protocol", "responseLength":"$context.responseLength", "accountId":"$context.accountId", "apiId":"$context.apiId", "stage" : "$context.stage", "api_key" : "$context.identity.apiKey", "identity": { "sourceIp": "$context.identity.sourceIp", "userAgent": "$context.identity.userAgent", "clientCert":{ "subjectDN": "$context.identity.clientCert.subjectDN", "issuerDN": "$context.identity.clientCert.issuerDN", "serialNumber": "$context.identity.clientCert.serialNumber", "validityNotBefore": "$context.identity.clientCert.validity.notBefore", "validityNotAfter": "$context.identity.clientCert.validity.notAfter" }}, "integration":{ "error": "$context.integration.error", "integrationStatus": "$context.integration.integrationStatus", "latency": "$context.integration.latency", "requestId": "$context.integration.requestId", "status": "$context.integration.status" } }'
295+
294296
RestApiDomainMapping:
295297
Type: AWS::ApiGateway::BasePathMapping
296298
Properties:
297299
DomainName: !Ref RestApiDomain
298300
RestApiId: !Ref RestApiGateway
299301
Stage: !Ref RestApiGatewayStage
300-
302+
301303
RestApiGatewayResources:
302304
Type: AWS::Serverless::Application
303305
Properties:
@@ -311,3 +313,4 @@ Resources:
311313
ApiName: !Sub ${StackName}-apigw
312314
LogRetentionInDays: !Ref LogRetentionInDays
313315
EnableSplunk: !Ref EnableSplunk
316+
ForwardCsocLogs: !Ref ForwardCsocLogs

SAMtemplates/main_template.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,13 @@ Parameters:
115115
Type: String
116116
Default: "123"
117117

118+
ForwardCsocLogs:
119+
Type: String
120+
Default: false
121+
AllowedValues:
122+
- true
123+
- false
124+
118125
Resources:
119126
Apis:
120127
Type: AWS::Serverless::Application
@@ -133,6 +140,7 @@ Resources:
133140
StatusFunctionArn: !GetAtt Functions.Outputs.StatusFunctionArn
134141
LogRetentionInDays: !Ref LogRetentionInDays
135142
EnableSplunk: !Ref EnableSplunk
143+
ForwardCsocLogs: !Ref ForwardCsocLogs
136144

137145
Parameters:
138146
Type: AWS::Serverless::Application

0 commit comments

Comments
 (0)