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 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
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 SubscriptionParams | |
{ | |
User User; | |
BillingPeriod BillingPeriod; | |
PaymentMethod PaymentMethod; | |
} | |
interface ISubscriptionService | |
{ | |
SubscriptionResult Subscribe(SubscriptionParams params); |
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
const fn = new Function(this, 'id', { | |
..., | |
logRetention: RetentionDays.ONE_WEEK, | |
... | |
}); |
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
import { Dashboard } from "@aws-cdk/aws-cloudwatch"; | |
const dashboard = new Dashboard(scope, 'id', { | |
dashboardName: 'name' | |
}); |
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
import { GraphWidget, IWidget, Metric } from "@aws-cdk/aws-cloudwatch"; | |
import { Construct, Duration } from "@aws-cdk/core"; | |
const invocationWidget = new GraphWidget({ | |
width: 24, | |
title: 'title', | |
left: [new Metric({ | |
metricName: 'Count', | |
namespace: 'AWS/ApiGateway', | |
dimensions: {'ApiName': 'apiName'}, |
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
import { GraphWidget, IWidget, Metric } from "@aws-cdk/aws-cloudwatch"; | |
import { Construct, Duration } from "@aws-cdk/core"; | |
const latencyWidget = new GraphWidget({ | |
width: 24, | |
title: 'API Latency', | |
left: [new Metric({ | |
metricName: 'Latency', | |
namespace: 'AWS/ApiGateway', | |
dimensions: {'ApiName': 'apiName'}, |
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
dashboard.addWidgets(invocationWidget); | |
dashboard.addWidgets(latencyWidget); |
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 | |
{ | |
/* ... dependencies ... */ | |
MyResult Process(MyParams params) | |
{ | |
if (!Regex.IsMatch(params.SerialCode, myPattern)) return MyResult.InvalidSerialCode; | |
var externalData = httpClient.Get<ExternalData>("...get external data from HTTP endpoint"); | |
db | |
.Execute("...insert data into database...") |