github.com/mweagle/Sparta@v1.15.0/docs/reference/archetypes/index.xml (about) 1 <?xml version="1.0" encoding="utf-8" standalone="yes"?> 2 <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"> 3 <channel> 4 <title>Sparta - AWS Lambda Microservices</title> 5 <link>/reference/archetypes/</link> 6 <description>Recent content on Sparta - AWS Lambda Microservices</description> 7 <generator>Hugo -- gohugo.io</generator> 8 <language>en-US</language> 9 <lastBuildDate>Sat, 13 Oct 2018 07:59:27 +0000</lastBuildDate> 10 11 <atom:link href="/reference/archetypes/index.xml" rel="self" type="application/rss+xml" /> 12 13 14 <item> 15 <title>Event Bridge</title> 16 <link>/reference/archetypes/event_bridge/</link> 17 <pubDate>Sat, 22 Feb 2020 17:36:59 +0000</pubDate> 18 19 <guid>/reference/archetypes/event_bridge/</guid> 20 <description>The EventBridge lambda event source allows you to trigger lambda functions in response to either cron schedules or account events. There are two different archetype functions available. 21 Scheduled Scheduled Lambdas execute either at fixed times or periodically depending on the schedule expression. 22 To create a scheduled function use a constructor as in: 23 import ( spartaArchetype &#34;github.com/mweagle/Sparta/archetype&#34; ) // EventBridge reactor function func echoEventBridgeEvent(ctx context.Context, msg json.RawMessage) (interface{}, error) { logger, _ := ctx.</description> 24 </item> 25 26 <item> 27 <title>CodeCommit</title> 28 <link>/reference/archetypes/codecommit/</link> 29 <pubDate>Thu, 31 Jan 2019 05:47:27 +0000</pubDate> 30 31 <guid>/reference/archetypes/codecommit/</guid> 32 <description>The CodeCommit Lambda event source allows you to trigger lambda functions in response to CodeCommit repository events. 33 Events Lambda functions triggered in response to CodeCommit evetms use a combination of events and branches to manage which state changes trigger your lambda function. 34 To create an event subscriber use a constructor as in: 35 // CodeCommit reactor function func reactorFunc(ctx context.Context, event awsLambdaEvents.CodeCommitEvent) (interface{}, error) { logger, _ := ctx.Value(sparta.ContextKeyRequestLogger).(*logrus.Entry) logger.WithFields(logrus.Fields{ &#34;Event&#34;: event, }).</description> 36 </item> 37 38 <item> 39 <title>CloudWatch</title> 40 <link>/reference/archetypes/cloudwatch/</link> 41 <pubDate>Wed, 28 Nov 2018 20:03:46 +0000</pubDate> 42 43 <guid>/reference/archetypes/cloudwatch/</guid> 44 <description>The CloudWatch Logs Lambda event source allows you to trigger lambda functions in response to either cron schedules or account events. There are three different archetype functions available. 45 Scheduled Scheduled Lambdas execute either at fixed times or periodically depending on the schedule expression. 46 To create a scheduled function use a constructor as in: 47 import ( awsLambdaEvents &#34;github.com/aws/aws-lambda-go/events&#34; spartaArchetype &#34;github.com/mweagle/Sparta/archetype&#34; ) // CloudWatch reactor function func reactorFunc(ctx context.Context, cwLogs awsLambdaEvents.CloudwatchLogsEvent) (interface{}, error) { logger, _ := ctx.</description> 48 </item> 49 50 <item> 51 <title>DynamoDB</title> 52 <link>/reference/archetypes/dynamodb/</link> 53 <pubDate>Wed, 28 Nov 2018 20:03:46 +0000</pubDate> 54 55 <guid>/reference/archetypes/dynamodb/</guid> 56 <description>To create a DynamoDB reactor that subscribes via an EventSourceMapping, use the NewDynamoDBReactor constructor as in: 57 import ( awsLambdaEvents &#34;github.com/aws/aws-lambda-go/events&#34; spartaArchetype &#34;github.com/mweagle/Sparta/archetype&#34; ) // DynamoDB reactor function func reactorFunc(ctx context.Context, dynamoEvent awsLambdaEvents.DynamoDBEvent) (interface{}, error) { logger, _ := ctx.Value(sparta.ContextKeyRequestLogger).(*logrus.Entry) logger.WithFields(logrus.Fields{ &#34;Event&#34;: dynamoEvent, }).Info(&#34;DynamoDB Event&#34;) return &#34;Hello World 👋. Welcome to AWS Lambda! 🙌🎉🍾&#34;, nil } func main() { // ... handler := spartaArchetype.DynamoDBReactorFunc(reactorFunc) lambdaFn, lambdaFnErr := spartaArchetype.NewDynamoDBReactor(handler, &#34;DYNAMO_DB_ARN_OR_CLOUDFORMATION_REF_VALUE&#34;, &#34;TRIM_HORIZON&#34;, 10, nil) } </description> 58 </item> 59 60 <item> 61 <title>Kinesis</title> 62 <link>/reference/archetypes/kinesis/</link> 63 <pubDate>Wed, 28 Nov 2018 20:03:46 +0000</pubDate> 64 65 <guid>/reference/archetypes/kinesis/</guid> 66 <description>To create a Kinesis Stream reactor that subscribes via an EventSourceMapping, use the NewKinesisReactor constructor as in: 67 import ( awsLambdaEvents &#34;github.com/aws/aws-lambda-go/events&#34; spartaArchetype &#34;github.com/mweagle/Sparta/archetype&#34; ) // KinesisStream reactor function func reactorFunc(ctx context.Context, kinesisEvent awsLambdaEvents.KinesisEvent) (interface{}, error) { logger, _ := ctx.Value(sparta.ContextKeyRequestLogger).(*logrus.Entry) logger.WithFields(logrus.Fields{ &#34;Event&#34;: kinesisEvent, }).Info(&#34;Kinesis Event&#34;) return &#34;Hello World 👋. Welcome to AWS Lambda! 🙌🎉🍾&#34;, nil } func main() { // ... handler := spartaArchetype.KinesisReactorFunc(reactorFunc) lambdaFn, lambdaFnErr := spartaArchetype.NewKinesisReactor(handler, &#34;KINESIS_STREAM_ARN_OR_CLOUDFORMATION_REF_VALUE&#34;, &#34;TRIM_HORIZON&#34;, 10, nil) } </description> 68 </item> 69 70 <item> 71 <title>Kinesis Firehose</title> 72 <link>/reference/archetypes/kinesis_firehose/</link> 73 <pubDate>Wed, 28 Nov 2018 20:03:46 +0000</pubDate> 74 75 <guid>/reference/archetypes/kinesis_firehose/</guid> 76 <description>There are two ways to create a Firehose Transform reactor that transforms a KinesisFirehoseEventRecord with a Lambda function: 77 NewKinesisFirehoseLambdaTransformer Transform using a Lambda function NewKinesisFirehoseTransformer Transform using a go text/template declaration NewKinesisFirehoseLambdaTransformer import ( awsEvents &#34;github.com/aws/aws-lambda-go/events&#34; spartaArchetype &#34;github.com/mweagle/Sparta/archetype&#34; ) // KinesisStream reactor function func reactorFunc(ctx context.Context, record *awsEvents.KinesisFirehoseEventRecord) (*awsEvents.KinesisFirehoseResponseRecord, error) { logger, _ := ctx.Value(sparta.ContextKeyRequestLogger).(*logrus.Entry) logger.WithFields(logrus.Fields{ &#34;Record&#34;: record, }).Info(&#34;Kinesis Firehose Event&#34;) responseRecord = &amp;awsEvents.</description> 78 </item> 79 80 <item> 81 <title>REST Service</title> 82 <link>/reference/archetypes/rest/</link> 83 <pubDate>Wed, 28 Nov 2018 20:03:46 +0000</pubDate> 84 85 <guid>/reference/archetypes/rest/</guid> 86 <description>The rest package provides convenience functions to define a serverless REST style service. 87 The package uses three concepts: 88 Routes: URL paths that resolve to a single go struct Resources: go structs that optionally define HTTP method (GET, POST, etc.). ResourceDefinition: an interface that go structs must implement in order to support resource-based registration. Routes Routes are similar many HTTP-routing libraries. They support path parameters. 89 Resources Resources are the targets of Routes.</description> 90 </item> 91 92 <item> 93 <title>S3</title> 94 <link>/reference/archetypes/s3/</link> 95 <pubDate>Wed, 28 Nov 2018 20:03:46 +0000</pubDate> 96 97 <guid>/reference/archetypes/s3/</guid> 98 <description>There are two different S3-based constructors depending on whether your lambda function should use an Object Key Name filter. The S3 subscriber is preconfigured to be notified of both s3:ObjectCreated:* and s3:ObjectRemoved:* events. 99 Object Key Name Filtering Object key name filtering only invokes a lambda function when objects with the given prefix are created. 100 To subscribe to object events created by objects with a given prefix, use the NewS3ScopedReactor constructor as in:</description> 101 </item> 102 103 <item> 104 <title>SNS</title> 105 <link>/reference/archetypes/sns/</link> 106 <pubDate>Wed, 28 Nov 2018 20:03:46 +0000</pubDate> 107 108 <guid>/reference/archetypes/sns/</guid> 109 <description>To create a SNS reactor that subscribes via an subscription configuration, use the NewSNSReactor constructor as in: 110 import ( awsLambdaEvents &#34;github.com/aws/aws-lambda-go/events&#34; spartaArchetype &#34;github.com/mweagle/Sparta/archetype&#34; ) // DynamoDB reactor function func reactorFunc(ctx context.Context, snsEvent awsLambdaEvents.SNSEvent) (interface{}, error) { logger, _ := ctx.Value(sparta.ContextKeyRequestLogger).(*logrus.Entry) logger.WithFields(logrus.Fields{ &#34;Event&#34;: snsEvent, }).Info(&#34;SNS Event&#34;) return &#34;Hello World 👋. Welcome to AWS Lambda! 🙌🎉🍾&#34;, nil } func main() { // ... handler := spartaArchetype.SNSReactorFunc(reactorFunc) lambdaFn, lambdaFnErr := spartaArchetype.NewDynamoDBReactor(handler, &#34;SNS_ARN_OR_CLOUDFORMATION_REF_VALUE&#34;, nil) } </description> 111 </item> 112 113 </channel> 114 </rss>