This file contains hidden or 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
| private creatGetOutputResolver( | |
| api: appsync.CfnGraphQLApi, | |
| schema: appsync.CfnGraphQLSchema, | |
| outputDataSource: appsync.CfnDataSource | |
| ) { | |
| const name = 'GetOutputResolver'; | |
| const requestMappingTemplate = `{ | |
| "version": "2017-02-28", | |
| "operation": "Invoke", | |
| "payload": { |
This file contains hidden or 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
| private createApiAccessGroup( | |
| api: appsync.CfnGraphQLApi | |
| ): iam.Group { | |
| const name = 'ApiAccessGroup'; | |
| const group = new iam.Group(this, name, { | |
| groupName: name | |
| }); | |
| group.attachInlinePolicy(this.createApiAccessPolicy(api)); |
This file contains hidden or 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
| private createApiAccessKey( | |
| api: appsync.CfnGraphQLApi | |
| ): iam.CfnAccessKey { | |
| const apiAccessGroup = this.createApiAccessGroup(api); | |
| const apiAccessUser = this.createApiAccessUser(apiAccessGroup); | |
| const name = 'ApiAccessKey'; | |
| return new iam.CfnAccessKey(this, name, { | |
| userName: apiAccessUser.userName | |
| }); |
This file contains hidden or 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
| private createApiAccessKeyOutputs( | |
| apiAccessKey: iam.CfnAccessKey | |
| ) { | |
| new cdk.CfnOutput(this, 'ApiAccessKeyId', { | |
| value: apiAccessKey.ref | |
| }); | |
| new cdk.CfnOutput(this, 'ApiSecretAccessKey', { | |
| value: apiAccessKey.attrSecretAccessKey | |
| }); | |
| } |
This file contains hidden or 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
| private static createLogGroup( | |
| scope: cdk.Construct, | |
| lambdaFunction: lambda.Function | |
| ) { | |
| new logs.LogGroup(scope, 'LogGroup', { | |
| logGroupName: `/aws/lambda/${lambdaFunction.functionName}`, // Autogenerated log group name | |
| retention: logs.RetentionDays.ONE_WEEK, | |
| removalPolicy: cdk.RemovalPolicy.DESTROY | |
| }); | |
| } |
This file contains hidden or 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
| interface IService | |
| { | |
| string GetData(); | |
| } | |
| class HttpService : IService | |
| { | |
| public string GetData() => "Data obtained via HTTP"; | |
| } |
This file contains hidden or 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
| interface IService | |
| { | |
| string GetData(); | |
| } | |
| interface IHttpService : IService {} | |
| class HttpService : IHttpService | |
| { | |
| public string GetData() => "Data obtained via HTTP"; |
This file contains hidden or 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
| class EmailValidationConfiguration | |
| { | |
| Regex ValidationRegex; | |
| } | |
| class EmailValidator | |
| { | |
| EmailValidator(EmailValidationConfiguration configuration) { } | |
| } |
This file contains hidden or 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
| class EmailValidator | |
| { | |
| bool IsEmailValid(string email); | |
| } |
This file contains hidden or 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
| class ValidEmail | |
| { | |
| string Email; | |
| } | |
| class EmailValidator | |
| { | |
| ValidEmail? IsEmailValid(string email); | |
| } |