-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implemented SequenceRunManager app deployment
* Added Shared API Gateway as stateful resource * Introduced param constants that go across stateful & stateless * Rearranged Python dependencies into deps directory * Removed no longer used constants * Removed now deprecated API Gateway Alpha constructs * Updated CDK nag validation accordingly Resolves #151
- Loading branch information
Showing
20 changed files
with
248 additions
and
175 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
// environmental neutral; global constants for SSM parameter store coordinate that share the | ||
// contract between stateful and stateless workloads. These constants typically be ssm param. | ||
export const SHARED_HTTP_API_ID: string = '/orcabus/shared-http-api-id'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { Construct } from 'constructs'; | ||
import { aws_ssm, Duration } from 'aws-cdk-lib'; | ||
import * as cognito from 'aws-cdk-lib/aws-cognito'; | ||
import { HttpUserPoolAuthorizer } from 'aws-cdk-lib/aws-apigatewayv2-authorizers'; | ||
import { SHARED_HTTP_API_ID } from '../../../../config/param'; | ||
import { CorsHttpMethod, HttpApi } from 'aws-cdk-lib/aws-apigatewayv2'; | ||
|
||
export class SharedApiGatewayConstruct extends Construct { | ||
private readonly SSM_USER_POOL_ID: string = '/data_portal/client/cog_user_pool_id'; // FIXME one fine day in future | ||
|
||
constructor(scope: Construct, id: string) { | ||
super(scope, id); | ||
|
||
const userPoolId: string = aws_ssm.StringParameter.valueFromLookup(this, this.SSM_USER_POOL_ID); | ||
const userPool = cognito.UserPool.fromUserPoolId(this, id, userPoolId); | ||
|
||
const httpApi = new HttpApi(this, id + 'HttpApi', { | ||
apiName: 'OrcaBusSharedAPI', | ||
corsPreflight: { | ||
allowHeaders: ['Authorization'], | ||
allowMethods: [ | ||
CorsHttpMethod.GET, | ||
CorsHttpMethod.HEAD, | ||
CorsHttpMethod.OPTIONS, | ||
CorsHttpMethod.POST, | ||
], | ||
allowOrigins: ['*'], // FIXME allowed origins from config constant | ||
maxAge: Duration.days(10), | ||
}, | ||
defaultAuthorizer: new HttpUserPoolAuthorizer(id + 'HttpUserPoolAuthorizer', userPool), | ||
// defaultDomainMapping: ... TODO | ||
}); | ||
|
||
new aws_ssm.StringParameter(this, 'sharedHttpApiIdParameter', { | ||
description: 'OrcaBus Shared API Gateway httpApiId', | ||
parameterName: SHARED_HTTP_API_ID, | ||
stringValue: httpApi.httpApiId, | ||
}); | ||
|
||
// TODO setup cloud map service discovery perhaps | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.