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
interface IService | |
{ | |
void ProcessData(MyData data); | |
} | |
class MyService : IService | |
{ | |
void ProcessData(MyData data) | |
{ | |
// ... |
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
class MyService | |
{ | |
void ProcessData(SQSEvent event) | |
{ | |
var data = Deserialize<MyData>(event.Body); | |
ProcessData(data); | |
} | |
} |
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
public Task<OutputModel> MyHandler(InputModel input, ILambdaContext context) | |
{ | |
//... | |
} |
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
class ValidEmail | |
{ | |
string Email; | |
} | |
class EmailValidator | |
{ | |
ValidEmail? IsEmailValid(string email); | |
} |
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
class EmailValidator | |
{ | |
bool IsEmailValid(string email); | |
} |
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
class EmailValidationConfiguration | |
{ | |
Regex ValidationRegex; | |
} | |
class EmailValidator | |
{ | |
EmailValidator(EmailValidationConfiguration configuration) { } | |
} |
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
interface IService | |
{ | |
string GetData(); | |
} | |
interface IHttpService : IService {} | |
class HttpService : IHttpService | |
{ | |
public string GetData() => "Data obtained via HTTP"; |
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
interface IService | |
{ | |
string GetData(); | |
} | |
class HttpService : IService | |
{ | |
public string GetData() => "Data obtained via HTTP"; | |
} |
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
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 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 | |
}); | |
} |