github.com/mweagle/Sparta@v1.15.0/CHANGES.md (about) 1 # Change Notes 2 3 ## v1.15.0 - The Daylight Savings Edition 🕑 4 5 - :warning: **BREAKING** 6 - :checkered_flag: **CHANGES** 7 - Added [sparta.AWSLambdaProvider](https://godoc.org/github.com/mweagle/Sparta#AWSLambdaProvider) to encapsulate an AWS Lambda compatible instance. 8 - Existing `*sparta.LambdaAWSInfo` objects can be constructed from a `AWSLambdaProvider` via [sparta.NewAWSLambdaFromProvider](https://godoc.org/github.com/mweagle/Sparta#AWSLambdaProvider). 9 - Added `--inputExtensions` command line argument to the _Explore_ command to support filtering eligible assets for interactive testing. 10 - Updated `describe` output format and layout 11 - See the [SpartaCast example](https://raw.githubusercontent.com/mweagle/SpartaCast/master/site/describe.jpeg) 12 - Added `sparta.Describable` interface to allow for user-supplied decorators to provide nodes and edges to the layout. 13 - [ServiceDecoratorHookHandler](https://godoc.org/github.com/mweagle/Sparta#ServiceDecoratorHookHandler]) instances that implement _Describable_ are eligible to be included in the layout. 14 - Added a `Complete` log statement to the end of log output. 15 - Example: `INFO[0044] Complete Time (Local)="02 May 20 05:38 PDT" Time (UTC)="2020-05-02T12:38:54Z"` 16 - Add `step.NewDynamicWaitDurationState` to allow for [input-dependent wait](https://docs.aws.amazon.com/step-functions/latest/dg/amazon-states-language-wait-state.html) functions. 17 - :bug: **FIXED** 18 - [Avoid creating default state machine role when an external role is set](https://github.com/mweagle/Sparta/pull/170) 19 - Moved to PNG [AWS Architecture icons](https://aws.amazon.com/architecture/icons/) for `describe` output to elimniate [data-uri SVG rendering issues](https://github.com/cytoscape/cytoscape.js/issues/1684). 20 21 ## v1.14.0 - The post:Invent Edition 🎰 22 23 - :warning: **BREAKING** 24 - :checkered_flag: **CHANGES** 25 26 - Added [step.NewExpressStateMachine](https://godoc.org/github.com/mweagle/Sparta/aws/step#NewExpressStateMachine) to support creating AWS Step Functions Express Workflows functions that support the new [step function type](https://aws.amazon.com/blogs/aws/new-aws-step-functions-express-workflows-high-performance-low-cost/) 27 - Added [archetype.NewEventBridgeScheduledReactor](https://godoc.org/github.com/mweagle/Sparta/aws/archetype#NewEventBridgeScheduledReactor) and [archetype.NewEventBridgeEventReactor](https://godoc.org/github.com/mweagle/Sparta/aws/archetype#NewEventBridgeEventReactor) 28 29 - These convenience functions provide convenience constructors for [EventBridge Lambda Subscribers](https://aws.amazon.com/eventbridge/). 30 - Sample usage: 31 32 ```go 33 func echoEventBridgeEvent(ctx context.Context, msg json.RawMessage) (interface{}, error) { 34 logger, _ := ctx.Value(sparta.ContextKeyLogger).(*logrus.Logger) 35 var eventData map[string]interface{} 36 err := json.Unmarshal(msg, &eventData) 37 logger.WithFields(logrus.Fields{ 38 "error": err, 39 "message": eventData, 40 }).Info("EventBridge event") 41 return nil, err 42 } 43 44 func main() { 45 //... 46 eventBridgeReactorFunc := spartaArchetype.EventBridgeReactorFunc(echoEventBridgeEvent) 47 lambdaFn, _ := spartaArchetype.NewEventBridgeScheduledReactor(eventBridgeReactorFunc, 48 "rate(1 minute)", 49 nil) 50 // Register lambdaFn 51 } 52 ``` 53 54 - Updated `describe` output to use latest [AWS Architecture Icons](https://aws.amazon.com/architecture/icons/). 55 56 - :bug: **FIXED** 57 - [Handle usernames with periods](https://github.com/mweagle/Sparta/pull/161) 58 - Thanks [sasanrose](https://github.com/sasanrose) 59 60 ## v1.13.0 - The pre:Invent Edition 🗓 61 62 - :warning: **BREAKING** 63 - :checkered_flag: **CHANGES** 64 65 - Updated [go-cloudformation](https://github.com/mweagle/go-cloudformation) dependency to expose: 66 - [LambdaEventInvokeConfig](https://godoc.org/github.com/mweagle/go-cloudformation#LambdaEventInvokeConfig) for success/failure handlers 67 - See the [blog post](https://aws.amazon.com/blogs/compute/introducing-aws-lambda-destinations/) for more information 68 - Destinations can be connected via [TemplateDecorators](https://godoc.org/github.com/mweagle/Sparta#TemplateDecorator) or [ServiceDecoratorHook](https://godoc.org/github.com/mweagle/Sparta#ServiceDecoratorHook) 69 - [LambdaEventSourceMapping](https://godoc.org/github.com/mweagle/go-cloudformation#LambdaEventSourceMapping) for updated stream controls 70 - See the [blog post](https://aws.amazon.com/blogs/compute/new-aws-lambda-scaling-controls-for-kinesis-and-dynamodb-event-sources/) for more information 71 - Added [cloudwatch.EmbeddedMetric](https://godoc.org/github.com/mweagle/Sparta/aws/cloudwatch#EmbeddedMetric) to support publishing CloudWatch [Embedded Metrics](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch_Embedded_Metric_Format_Specification.html) via logs 72 73 - See the [blog post](https://aws.amazon.com/about-aws/whats-new/2019/11/amazon-cloudwatch-launches-embedded-metric-format/) for more information 74 - Usage: 75 76 ```go 77 metricDirective := emMetric.NewMetricDirective("SpecialNamespace", 78 // Initialize with metric dimensions 79 map[string]string{"functionVersion": os.Getenv("AWS_LAMBDA_FUNCTION_VERSION")}) 80 // Record a metric value 81 metricDirective.Metrics["invocations"] = cloudwatch.MetricValue{ 82 Unit: cloudwatch.UnitCount, 83 Value: 1, 84 } 85 // Publish optionally accepts additional high-cardinality KV properties 86 emMetric.Publish(nil) 87 ``` 88 89 - :bug: **FIXED** 90 - [Set executable bit on Sparta binary in ZIP archive](https://github.com/mweagle/Sparta/issues/158) 91 92 ## v1.12.0 - The Mapping Edition 🗺 93 94 - :warning: **BREAKING** 95 - :checkered_flag: **CHANGES** 96 - Added [step.MapState](https://godoc.org/github.com/mweagle/Sparta/aws/step#MapState) to support creating AWS Step functions that support the new [Map State](https://states-language.net/spec.html#map-state) 97 - See the [blog post](https://aws.amazon.com/blogs/aws/new-step-functions-support-for-dynamic-parallelism/) for more details 98 - Also the corresponding sample application in the [Sparta Step](https://github.com/mweagle/SpartaStep/blob/master/parallel/main.go) project. 99 - :bug: **FIXED** 100 - Fixed latent issue in [step.ParallelState](https://godoc.org/github.com/mweagle/Sparta/aws/step#ParallelState) that prevented `Branches` field from being properly marshaled. 101 102 ## v1.11.0 - The Firehose Edition 🚒 103 104 - :warning: **BREAKING** 105 - :checkered_flag: **CHANGES** 106 - Added [archetype.NewKinesisFirehoseTransformer](https://godoc.org/github.com/mweagle/Sparta/archetype#NewKinesisFirehoseTransformer) and [archetype.NewKinesisFirehoseLambdaTransformer](https://godoc.org/github.com/mweagle/Sparta/archetype#NewKinesisFirehoseLambdaTransformer) to support Kinesis Firehose Lambda Transforms 107 - See the [documentation](http://gosparta.io/reference/archetypes/kinesis_firehose/) for more details 108 - Also the corresponding sample application at the [SpartaXForm repo](https://github.com/mweagle/SpartaXForm). 109 - :bug: **FIXED** 110 111 ## v1.10.0 - The Load Balancer Edition ⚖️ 112 113 - :warning: **BREAKING** 114 - :checkered_flag: **CHANGES** 115 - Added [ApplicationLoadBalancerDecorator](https://godoc.org/github.com/mweagle/Sparta/decorator#ApplicationLoadBalancerDecorator) type to support Lambda functions as load balancer targets. 116 - See the [documentation](http://gosparta.io/reference/decorators/application_load_balancer/) for more details 117 - Also the corresponding sample application at the [SpartaALB repo](https://github.com/mweagle/SpartaALB). 118 - :bug: **FIXED** 119 120 ## v1.9.4 - The Sockets Edition 🔌 121 122 - :warning: **BREAKING** 123 - Update `sparta.Main` and `sparta.MainEx` to accept new _APIGateway_ interface type rather than concrete _API_ type. This should be backward compatible for most usage and was done to support the new APIV2 Gateway type. 124 - :checkered_flag: **CHANGES** 125 - Added [API V2] type to provision WebSocket APIs 126 - See the [documentation](http://gosparta.io/reference/apiv2gateway/) for more details 127 - Update to `go` [modules](https://github.com/golang/go/wiki/Modules) 128 - :bug: **FIXED** 129 130 ## v1.9.3 - The Discovery Edition ☁️🔍 131 132 - :warning: **BREAKING** 133 - :checkered_flag: **CHANGES** 134 - Added [Cloud Map](https://aws.amazon.com/cloud-map/) discovery publisher 135 - See the [documentation](https://gosparta.io/reference/decorators/cloudmap/) 136 - Added `panic` recover handler to more gracefully handle exceptions 137 - Include AWS Session in context with key `sparta.ContextKeyAWSSession` 138 - :bug: **FIXED** 139 140 - [Update to support new Amazon Linux AMI](https://github.com/mweagle/Sparta/issues/145) 141 - Fixed latent issue where `env` specified log level wasn't respected at lambda execution time 142 143 ## v1.9.2 - The Names Edition 📛 144 145 - :warning: **BREAKING** 146 - :checkered_flag: **CHANGES** 147 148 - Added `API.EndpointConfiguration` field to [API](https://godoc.org/github.com/mweagle/Sparta#API). 149 - This field exposes the [EndpointConfiguration](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apigateway-restapi-endpointconfiguration.html) property to specify either _EDGE_ or _REGIONAL_ API types. 150 - Added `decorator.APIGatewayDomainDecorator` to associate a custom domain with an API Gateway instance 151 152 - Usage: 153 154 ```go 155 hooks := &sparta.WorkflowHooks{} 156 serviceDecorator := spartaDecorators.APIGatewayDomainDecorator(apiGateway, 157 gocf.String(acmCertARNLiteral), 158 "", // Optional base path value 159 "subdomain.mydomain.net") 160 hooks.ServiceDecorators = []sparta.ServiceDecoratorHookHandler{ 161 serviceDecorator, 162 } 163 ``` 164 165 - See [apigateway_domain_test](https://github.com/mweagle/Sparta/blob/master/decorator/dashboard.go) for a complete example. 166 - See the [AWS Documentation](https://docs.aws.amazon.com/apigateway/latest/developerguide/how-to-custom-domains.html) for more information. 167 168 - :bug: **FIXED** 169 - [Support custom domains](https://github.com/mweagle/Sparta/issues/91) 170 171 ## v1.9.1 - The CodeCommitment Edition 💕 172 173 - :warning: **BREAKING** 174 - :checkered_flag: **CHANGES** 175 176 - Added `CodeCommitPermission` type to support CodeCommit [notifications](https://docs.aws.amazon.com/codecommit/latest/userguide/how-to-repository-email.html) 177 - There is an _archetype_ constructor that encapsulates this type of Lambda reactor. 178 179 - Usage: 180 181 ```go 182 func echoCodeCommit(ctx context.Context, 183 event awsLambdaEvents.CodeCommitEvent) (interface{}, error) { 184 // ... 185 return &event, nil 186 } 187 func main() { 188 // ... 189 reactor, reactorErr := spartaArchetype.NewCodeCommitReactor(spartaArchetype.CodeCommitReactorFunc(echoCodeCommit), 190 gocf.String("TestCodeCommitRepo"), 191 nil, 192 nil, 193 nil) 194 ... 195 } 196 ``` 197 198 - Updated to [staticcheck.io](https://staticcheck.io/) 199 200 - :bug: **FIXED** 201 - [Add CodeCommit support](https://github.com/mweagle/Sparta/issues/86) 202 - [Fixed broken link to AWS documentation](https://github.com/mweagle/Sparta/pull/136) 203 - [RegisterLambdaUtilizationMetricPublisher Name ref obsolete](https://github.com/mweagle/Sparta/issues/130) 204 - [Document archetype constructors](https://github.com/mweagle/Sparta/issues/119) 205 206 ## v1.9.0 - The LayerCake Edition 🍰 207 208 - :warning: **BREAKING** 209 - :checkered_flag: **CHANGES** 210 211 - Added `LambdaAWSInfo.Layers` field to support [Lambda Layers](https://docs.aws.amazon.com/lambda/latest/dg/configuration-layers.html) 212 213 - Usage: 214 215 ```go 216 lambdaRole := sparta.IAMRoleDefinition{ 217 Privileges: []sparta.IAMRolePrivilege{ 218 iamBuilder.Allow("lambda:GetLayerVersion"). 219 ForResource(). 220 Literal("*"). 221 ToPrivilege(), 222 }, 223 } 224 lambdaFn, lambdaFnErr := sparta.NewAWSLambda("Hello World", 225 helloWorld, 226 lambdaRole) 227 lambdaFn.Layers = []gocf.Stringable{ 228 gocf.String("arn:aws:lambda:us-west-2:123412341234:layer:ffmpeg:1"), 229 } 230 ``` 231 232 - Added `WithCondition` to [IAM Builder](https://godoc.org/github.com/mweagle/Sparta/aws/iam/builder) 233 - Added `s3Site.UserManifestData` map property to allow for custom user data to be included in _MANIFEST.json_ content that is deployed to an S3 Site bucket. 234 - Userdata is scoped to a **userdata** keyname in _MANIFEST.json_ 235 - See the [SpartaAmplify](https://github.com/mweagle/SpartaAmplify) sample app for a complete example. 236 - Added `github.com/mweagle/Sparta/system.RunAndCaptureOSCommand` 237 - This is convenience function to support alternative `io.Writer` sinks for _stdout_ and _stderr_. 238 - Minor usability improvements to `--status` report output 239 240 - :bug: **FIXED** 241 - [overview page is broken](https://github.com/mweagle/Sparta/issues/133) 242 243 ## v1.8.0 - The #postReInvent Edition ⌛️ 244 245 - :warning: **BREAKING** 246 - Renamed `archetype.CloudWatchLogsReactor` to `archetype.CloudWatchReactor` 247 - Also changed `OnLogMessage` to `OnCloudWatchMessage` 248 - I consistently forget the fact that CloudWatch is more than logs 249 - Moved the internal `cloudwatchlogs` package to the `cloudwatch/logs` import path 250 - Renamed fluent typenames in _github.com/mweagle/Sparta/aws/iam/builder_ to support Principal-based builders 251 - Renamed `step.NewTaskState` to `step.NewLambdaTaskState` to enable type specific [Step function services](https://docs.aws.amazon.com/step-functions/latest/dg/concepts-connectors.html). 252 - Simplified versioning Lambda resource so that the [Lambda::Version](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-version.html) resource is orphaned (via [DeletionPolicy](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html)) rather than the prior implementation, which fetched all versions from the provisioned template and accumulated them over time. 253 - This also obsoleted the `ContextKeyLambdaVersions` constant 254 - :checkered_flag: **CHANGES** 255 256 - More documentation 257 - Added Step function [service integrations](https://docs.aws.amazon.com/step-functions/latest/dg/connectors-supported-services.html) 258 - See the [SpartaStepServicefull](https://github.com/mweagle/SpartaStepServicefull) project for an example of a service that: 259 - Provisions no Lambda functions 260 - Dockerizes itself 261 - Pushes that image to ECR 262 - Uses the resulting ECR Image URL as a Fargate Task in a Step function: 263 - <div align="center"><img src="https://raw.githubusercontent.com/mweagle/Sparta/master/docs_source/static/site/1.8.0/step_functions_fargate.jpg" /> 264 - Added _github.com/mweagle/Sparta/aws/iam/builder.IAMBuilder::ForPrincipals_ fluent builder. Example usage: 265 266 ```go 267 "Statement": []spartaIAM.PolicyStatement{ 268 iamBuilder.Allow("sts:AssumeRole"). 269 ForPrincipals("states.amazonaws.com"). 270 ToPolicyStatement(), 271 ``` 272 273 - Upgraded to `docker login --password-stdin` for local authentication. Previously used `docker login --password`. Example: 274 275 ```plain 276 INFO[0005] df64d3292fd6: Preparing 277 INFO[0006] denied: Your Authorization Token has expired. Please run 'aws ecr get-login --no-include-email' to fetch a new one. 278 INFO[0006] ECR push failed - reauthorizing Error="exit status 1" 279 INFO[0006] Login Succeeded 280 INFO[0006] The push refers to repository [123412341234.dkr.ecr.us-west-2.amazonaws.com/argh] 281 ``` 282 283 - See the [Docker docs](https://docs.docker.com/engine/reference/commandline/login/#parent-command) 284 285 - Include `docker -v` output in log when calling [BuildDockerImage](https://godoc.org/github.com/mweagle/Sparta/docker#BuildDockerImage) 286 - Added `StateMachineNamedDecorator(stepFunctionResourceName)` to supply the name of the Step function 287 - Migrated all API-Gateway integration mappings to use the [mapping override](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-mapping-template-reference.html) support in VTL. 288 289 - This reduces the number of API-Gateway RegExp-based integration mappings and relies on a Lambda function returning a shape that matches the default _application/json_ expectations: 290 291 ```json 292 { 293 "code" : int, 294 "body" : ..., 295 "headers": { 296 "x-lowercase-header" : "foo", 297 } 298 } 299 ``` 300 301 - The default shape can be customized by providing custom mapping templates to the [IntegrationResponses](https://godoc.org/github.com/mweagle/Sparta#IntegrationResponse) 302 303 - [rest.MethodHandler:Headers](https://godoc.org/github.com/mweagle/Sparta/archetype/rest#MethodHandler.Headers) has been deprecated. 304 - Moving all header management to VTL eliminated the need to explicitly declare headers. 305 - Added `spartaDecorators.PublishAllResourceOutputs(cfResourceName, gocf.ResourceProperties)` which adds all the associated resource `Ref` and `Att` values to the Stack Outputs 306 - The set of `Att` values is extracted from the [CloudFormation Resource Specification](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/cfn-resource-specification.html) via the [go-cloudformation](https://github.com/mweagle/go-cloudformation) project. 307 308 - :bug: **FIXED** 309 - API Gateway custom headers were not being properly returned 310 - [RegisterLambdaUtilizationMetricPublisher Name ref obsolete](https://github.com/mweagle/Sparta/issues/130) 311 312 ## v1.7.3 - The Documentation Edition 📚 313 314 - :warning: **BREAKING** 315 - Renamed `archetype.NewCloudWatchLogsReactor` to `archetype.NewCloudWatchReactor` 316 - :checkered_flag: **CHANGES** 317 - Moved all documentation into the _master_ branch to make it a bit easier to update docs together with code. 318 - See _/docs_source/content/meta/\_index.md_ for how to edit, preview, and submit. 319 - Added `archetype.NewCloudWatchScheduledReactor` and `archetype.NewCloudWatchEventedReactor` 320 - :bug: **FIXED** 321 322 ## v1.7.2 - The Cloud Drift Edition v2 🌬☁️ 323 324 - :warning: **BREAKING** 325 - :checkered_flag: **CHANGES** 326 327 - Moved `decorator.DriftDetector` to `validator.DriftDetector` and changed signature to [ServiceValidationHookHandler](https://godoc.org/github.com/mweagle/Sparta#ServiceValidationHookHandler) 328 329 - Clearly I was too focused on enabling drift detection than enabling it in an appropriate place. 330 - Updated usage: 331 332 ```go 333 import ( 334 "github.com/mweagle/Sparta/validator" 335 ) 336 workflowHooks := &sparta.WorkflowHooks{ 337 Validators: []sparta.ServiceValidationHookHandler{ 338 validator.DriftDetector(true), 339 }, 340 } 341 ``` 342 343 - Added `LambdaFuncName` to output when stack drift detected. 344 345 - Example: 346 347 ```plain 348 WARN[0013] Stack drift detected Actual=debug Expected=info LambdaFuncName="Hello World" PropertyPath=/Environment/Variables/SPARTA_LOG_LEVEL Relation=NOT_EQUAL Resource=HelloWorldLambda80576f7b21690b0cb485a6b69c927aac972cd693 349 ``` 350 351 - :bug: **FIXED** 352 353 ## v1.7.1 - The Cloud Drift Edition 🌬☁️ 354 355 - :warning: **BREAKING** 356 - :checkered_flag: **CHANGES** 357 358 - Added `decorator.DriftDetector` to optionally prevent operations in the presence of [CloudFormation Drift](https://aws.amazon.com/blogs/aws/new-cloudformation-drift-detection/). 359 360 - Usage: 361 362 ```go 363 workflowHooks := &sparta.WorkflowHooks{ 364 PreBuilds: []sparta.WorkflowHookHandler{ 365 decorator.DriftDetector(false), 366 }, 367 } 368 ``` 369 370 - Sample output: 371 372 ```text 373 INFO[0001] Calling WorkflowHook Phase=PreBuild WorkflowHookContext="map[]" 374 INFO[0001] Waiting for drift detection to complete Status=DETECTION_IN_PROGRESS 375 ERRO[0012] Stack drift detected Actual=debug Expected=info PropertyPath=/Environment/Variables/SPARTA_LOG_LEVEL Relation=NOT_EQUAL Resource=HelloWorldLambda80576f7b21690b0cb485a6b69c927aac972cd693 376 INFO[0012] Invoking rollback functions 377 ERRO[0012] Failed to provision service: DecorateWorkflow returned an error: stack MyHelloWorldStack-mweagle prevented update due to drift being detected 378 ``` 379 380 - Usability improvements when errors produced. Previously the usage instructions were output on every failed command. Now they are only displayed if there are CLI argument validation errors. 381 - Usability improvement to log individual [validation errors](https://godoc.org/gopkg.in/go-playground/validator.v9) if the CLI arguments are invalid. 382 383 - :bug: **FIXED** 384 - Fixed latent issue where Sparta misreported its internal version 385 386 ## v1.7.0 - The Time Machine Edition 🕰 387 388 - :warning: **BREAKING** 389 - :checkered_flag: **CHANGES** 390 391 - Added `LambdaAWSInfo.Interceptors` support 392 393 - `Interceptors` are functions (`func(context.Context, json.RawMessage) context.Context`) called in the normal event handling lifecycle to support cross cutting concerns. They are the runtime analog to `WorkflowHooks`. 394 - The following stages are supported: 395 - _Begin_: Called as soon as Sparta determines which user-function to invoke 396 - _BeforeSetup_: Called before Sparta creates your lambda's `context` value 397 - _AfterSetup_: Called after Sparta creates your lambda's `context` value 398 - _BeforeDispatch_: Called before Sparta invokes your lambda function 399 - _AfterDispatch_: Called after Sparta invokes your lambda function 400 - _Complete_: Called immediately before Sparta returns your function return value(s) to AWS 401 - The first interceptor is `interceptor.RegisterXRayInterceptor(ctx, options)` which creates a custom [XRay Segment](https://docs.aws.amazon.com/xray/latest/devguide/xray-sdk-go-segment.html) spanning your lambda's execution and supports: 402 - Including the service BuildID in the [Trace Annotation](https://docs.aws.amazon.com/xray/latest/devguide/xray-api-segmentdocuments.html#api-segmentdocuments-annotations) 403 - Optionally including the incoming event, all log statements (_trace_ and higher), and AWS request-id as [Trace Metadata](https://docs.aws.amazon.com/xray/latest/devguide/xray-api-segmentdocuments.html#api-segmentdocuments-metadata) **ONLY** in the case when your lambda function returns an error. 404 - Log messages are stored in a [ring buffer](https://golang.org/pkg/container/ring/) and limited to 1024 entries. 405 - This data is associated with XRay Traces in the console. Example: 406 407 - <div align="center"><img src="https://raw.githubusercontent.com/mweagle/Sparta/master/docs_source/static/site/1.7.0/XRaySegment.jpg" /> 408 </div> 409 410 - See the [SpartaXRayInterceptor](https://github.com/mweagle/SpartaXRayInterceptor) repo for a complete sample 411 412 - Go back in time to when you wish you had enabled debug-level logging before the error ever occurred. 413 414 - Expose `sparta.ProperName` as framework name literal 415 - Add lightweight Key-Value interface and S3 and DynamoDB implementations to support [SpartaTodoBackend](https://github.com/mweagle/SpartaTodoBackend/) 416 - The DynamoDB provider uses [dynamodbattribute](https://docs.aws.amazon.com/sdk-for-go/api/service/dynamodb/dynamodbattribute/) to map `go` structs to attributes. 417 - See the [aws.accessor](https://godoc.org/github.com/mweagle/Sparta/aws/accessor) docs 418 419 - :bug: **FIXED** 420 421 ## v1.6.0 - The REST Edition 😴 422 423 - :warning: **BREAKING** 424 - Eliminate pre 1.0 GM Sparta function signature: `type LambdaFunction func(*json.RawMessage, *LambdaContext, http.ResponseWriter, *logrus.Logger)` 🎉 425 - See the [AWS Docs](https://docs.aws.amazon.com/lambda/latest/dg/go-programming-model-handler-types.html) for officially supported signatures 426 - Changed API Gateway response mapping to support body and header return values. 427 - API Gateway lambda functions should use `aws/apigateway.NewResponse` to produce a new `Response` type with struct fields that are properly interpreted by the new `$input.json('$.body')` mapping expression. 428 - The change was driven by the [SpartaTodoBackend](https://github.com/mweagle/SpartaTodoBackend) service's need to return both a body and HTTP location header. 429 - See the [response](https://github.com/mweagle/SpartaTodoBackend/blob/master/service/todos.go#L79) for an example 430 - :checkered_flag: **CHANGES** 431 432 - Add more _go_ idiomatic `sparta.NewAWSLambda(...) (*sparta.LambdaAWSInfo, error)` constructor 433 - The existing `sparta.HandleAWSLambda` function is deprecated and will be removed in a subsequent release 434 - Added _Sparta/archetype/rest_ package to streamline REST-based Sparta services. 435 436 - This package includes a fluent builder (`MethodHandler`) and constructor function (`RegisterResource`) that transforms a _rest.Resource_ implementing struct into an API Gateway resource. 437 - Usage: 438 439 ```go 440 // File: resource.go 441 // TodoItemResource is the /todo/{id} resource 442 type TodoItemResource struct { 443 } 444 // ResourceDefinition returns the Sparta REST definition for the Todo item 445 func (svc *TodoItemResource) ResourceDefinition() (spartaREST.ResourceDefinition, error) { 446 447 return spartaREST.ResourceDefinition{ 448 URL: todoItemURL, 449 MethodHandlers: spartaREST.MethodHandlerMap{ 450 ... 451 } 452 }, nil 453 } 454 455 // File: main.go 456 func() { 457 myResource := &TodoItemResource{} 458 resourceMap, resourcesErr := spartaREST.RegisterResource(apiGatewayInstance, myResource) 459 } 460 ``` 461 462 - Sample fluent method builder: 463 464 ```go 465 // GET 466 http.MethodGet: spartaREST.NewMethodHandler(svc.Get, http.StatusOK). 467 StatusCodes(http.StatusInternalServerError). 468 Privileges(svc.S3Accessor.KeysPrivilege("s3:GetObject"), 469 svc.S3Accessor.BucketPrivilege("s3:ListBucket")), 470 ``` 471 472 - See [SpartaTodoBackend](https://github.com/mweagle/SpartaTodoBackend) for a complete example 473 - The _SpartaTodoBackend_ is a self-deploying CORS-accessible service that satisfies the [TodoBackend](https://www.todobackend.com/) online tests 474 475 - Added _Sparta/aws/accessor_ package to streamline S3-backed service creation. 476 - Embed a `services.S3Accessor` type to enable utility methods for: 477 - `Put` 478 - `Get` 479 - `GetAll` 480 - `Delete` 481 - `DeleteAll` 482 - Added [prealloc](https://github.com/alexkohler/prealloc) check to ensure that slices are preallocated when possible 483 484 - :bug: **FIXED** 485 - Fix latent issue where CloudWatch Log ARN was malformed [commit](https://github.com/mweagle/Sparta/commit/5800553983ed16e6c5e4a622559909c050c00219) 486 487 ## v1.5.0 - The Observability Edition 🔭 488 489 - :warning: **BREAKING** 490 - :checkered_flag: **CHANGES** 491 492 - Expose `sparta.InstanceID()` that returns a random instance identifier for a single Lambda container instance 493 - The _instanceID_ field is also included in the [ContextLogger](https://godoc.org/github.com/mweagle/Sparta#pkg-constants) 494 - Add a self-monitoring function that publishes container-level metrics to CloudWatch. 495 496 - Usage: 497 498 ```go 499 import spartaCloudWatch "github.com/mweagle/Sparta/aws/cloudwatch" 500 func main() { 501 ... 502 spartaCloudWatch.RegisterLambdaUtilizationMetricPublisher(map[string]string{ 503 "BuildId": sparta.StampedBuildID, 504 }) 505 ... 506 } 507 ``` 508 509 - The optional `map[string]string` parameter is the custom Name-Value pairs to use as a [CloudWatch Dimension](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/cloudwatch_concepts.html#Dimension) 510 - <div align="center"><img src="https://raw.githubusercontent.com/mweagle/Sparta/master/docs_source/static/site/1.5.0/CloudWatch_Management_Console.jpg" /> 511 512 - Add `WorkflowHooks.Validators` to support policy-based validation of the materialized template. 513 - Each validator receives a complete read-only copy of the template 514 - Add [magefile](https://magefile.org/) actions in _github.com/mweagle/Sparta/magefile_ to support cross platform scripting. 515 516 - A Sparta service can use a standard _magefile.go_ as in: 517 518 ```go 519 // +build mage 520 521 package main 522 523 import ( 524 spartaMage "github.com/mweagle/Sparta/magefile" 525 ) 526 527 // Provision the service 528 func Provision() error { 529 return spartaMage.Provision() 530 } 531 532 // Describe the stack by producing an HTML representation of the CloudFormation 533 // template 534 func Describe() error { 535 return spartaMage.Describe() 536 } 537 538 // Delete the service, iff it exists 539 func Delete() error { 540 return spartaMage.Delete() 541 } 542 543 // Status report if the stack has been provisioned 544 func Status() error { 545 return spartaMage.Status() 546 } 547 548 // Version information 549 func Version() error { 550 return spartaMage.Version() 551 } 552 ``` 553 554 which exposes the most common Sparta command line options. 555 556 - Usage: `mage status`: 557 558 ```plain 559 $ mage status 560 INFO[0000] ════════════════════════════════════════════════ 561 INFO[0000] ╔═╗╔═╗╔═╗╦═╗╔╦╗╔═╗ Version : 1.5.0 562 INFO[0000] ╚═╗╠═╝╠═╣╠╦╝ ║ ╠═╣ SHA : 8f199e1 563 INFO[0000] ╚═╝╩ ╩ ╩╩╚═ ╩ ╩ ╩ Go : go1.11.1 564 INFO[0000] ════════════════════════════════════════════════ 565 INFO[0000] Service: MyHelloWorldStack-mweagle LinkFlags= Option=status UTC="2018-10-20T04:46:57Z" 566 INFO[0000] ════════════════════════════════════════════════ 567 INFO[0001] StackId Id="arn:aws:cloudformation:us-west-2:************:stack/MyHelloWorldStack-mweagle/5817dff0-c5f1-11e8-b43a-503ac9841a99" 568 INFO[0001] Stack status State=UPDATE_COMPLETE 569 INFO[0001] Created Time="2018-10-02 03:14:59.127 +0000 UTC" 570 INFO[0001] Last Update Time="2018-10-19 03:23:00.048 +0000 UTC" 571 INFO[0001] Tag io:gosparta:buildId=7ee3e1bc52f15c4a636e05061eaec7b748db22a9 572 ``` 573 574 - :bug: **FIXED** 575 - Fix latent issue where multiple [archetype](https://godoc.org/github.com/mweagle/Sparta/archetype) handlers of the same type would collide. 576 577 ## v1.4.0 578 579 - :warning: **BREAKING** 580 - Moved `sparta.LambdaVersioningDecorator` to `decorator.LambdaVersioningDecorator` 581 - Updated [cloudformation.ConvergeStackState](https://godoc.org/github.com/mweagle/Sparta/aws/cloudformation#ConvergeStackState) to accept a timeout parameter 582 - Updated [ServiceDecorator.DecorateService](https://godoc.org/github.com/mweagle/Sparta#ServiceDecoratorHookFunc.DecorateService) to accept the S3Key parameter 583 - This allows `ServiceDecorators` to add their own Lambda-backed CloudFormation custom resources and have them instantiated at AWS Lambda runtime. (eg: CloudFormation [Lambda-backed custom resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/template-custom-resources-lambda.html) ). See next section for more information. 584 - :checkered_flag: **CHANGES** 585 586 - Simplified CustomResource creation and dispatch logic 587 588 - The benefit of this is that users can define new `CustomResourceCommand` implementing CustomResources and have them roundtripped and instantiated at AWS Lambda execution time. 🎉 589 - I'll write up more documentation, but the steps to defining your own Lambda-backed custom resource: 590 591 1. Create a resource that embeds [gocf.CloudFormationCustomResource](https://godoc.org/github.com/mweagle/go-cloudformation#CloudFormationCustomResource) and your custom event properties: 592 593 ```go 594 type HelloWorldResourceRequest struct { 595 Message *gocf.StringExpr 596 } 597 type HelloWorldResource struct { 598 gocf.CloudFormationCustomResource 599 HelloWorldResourceRequest 600 } 601 ``` 602 603 1. Register the custom resource provider with [RegisterCustomResourceProvider](https://godoc.org/github.com/mweagle/go-cloudformation#RegisterCustomResourceProvider) 604 1. Implement [CustomResourceCommand](https://godoc.org/github.com/mweagle/Sparta/aws/cloudformation/resources#CustomResourceCommand) 605 606 - At provisioning time, an instance of your CustomResource will be created and the appropriate functions will be called with the incoming [CloudFormationLambdaEvent](https://godoc.org/github.com/mweagle/Sparta/aws/cloudformation/resources#CloudFormationLambdaEvent). 607 - Unmarshal the `event.ResourceProperties` map into your command handler instance and perform the requested operation. 608 609 - Added a set of `archetype.*` convenience functions to create `sparta.LambdaAWSInfo` for specific event types. 610 611 - The `archetype.*` package exposes creation functions to simplify common lambda types. Sample S3 _Reactor_ handler: 612 613 ```go 614 func echoS3Event(ctx context.Context, s3Event awsLambdaEvents.S3Event) (interface{}, error) { 615 // Respond to s3:ObjectCreated:*", "s3:ObjectRemoved:*" S3 events 616 } 617 func main() { 618 lambdaFn, _ := spartaArchetype.NewS3Reactor(spartaArchetype.S3ReactorFunc(echoS3Event), 619 gocf.String("MY_S3_BUCKET"), 620 nil) 621 // ... 622 } 623 ``` 624 625 - Added `--nocolor` command line option to suppress colorized output. Default value: `false`. 626 - When a service `provision` fails, only report resources that failed to succeed. 627 - Previously, resources that were cancelled due to other resource failures were also logged as _ERROR_ statements. 628 - Added `decorator.CloudWatchErrorAlarmDecorator(...)` to create per-Lambda CloudWatch Alarms. 629 630 - Sample usage: 631 632 ```go 633 lambdaFn.Decorators = []sparta.TemplateDecoratorHandler{ 634 spartaDecorators.CloudWatchErrorAlarmDecorator(1, // Number of periods 635 1, // Number of minutes per period 636 1, // GreaterThanOrEqualToThreshold value 637 gocf.String("SNS_TOPIC_ARN_OR_RESOURCE_REF")), 638 } 639 ``` 640 641 - Added `decorator.NewLogAggregatorDecorator` which forwards all CloudWatch log messages to a Kinesis stream. 642 - See [SpartaPProf](https://github.com/mweagle/SpartaPProf) for an example of forwarding CloudWatch log messages to Google StackDriver 643 - Added [decorator.CloudFrontSiteDistributionDecorator](https://godoc.org/github.com/mweagle/Sparta/decorator#CloudFrontSiteDistributionDecorator) to provision a CloudFront distribution with a custom Route53 name and optional SSL support. 644 645 - Sample usage: 646 647 ```go 648 func distroHooks(s3Site *sparta.S3Site) *sparta.WorkflowHooks { 649 hooks := &sparta.WorkflowHooks{} 650 siteHookDecorator := spartaDecorators.CloudFrontSiteDistributionDecorator(s3Site, 651 "subdomainNameHere", 652 "myAWSHostedZone.com", 653 "arn:aws:acm:us-east-1:OPTIONAL-ACM-CERTIFICATE-FOR-SSL") 654 hooks.ServiceDecorators = []sparta.ServiceDecoratorHookHandler{ 655 siteHookDecorator, 656 } 657 return hooks 658 } 659 ``` 660 661 - Supply the `WorkflowHooks` struct to `MainEx` to annotate your service with an example CloudFront distribution. Note that CF distributions introduce a significant provisioning delay. 662 - See [SpartaHTML](https://github.com/mweagle/SpartaHTML) for more 663 664 - Added `decorator.S3ArtifactPublisherDecorator` to publish an arbitrary JSON file to an S3 location 665 - This is implemented as Sparta-backed CustomResource 666 - Added `status` command to produce a report of a provisioned service. Sample usage: 667 668 ```bash 669 $ go run main.go status --redact 670 INFO[0000] ════════════════════════════════════════════════ 671 INFO[0000] ╔═╗╔═╗╔═╗╦═╗╔╦╗╔═╗ Version : 1.4.0 672 INFO[0000] ╚═╗╠═╝╠═╣╠╦╝ ║ ╠═╣ SHA : 3681d28 673 INFO[0000] ╚═╝╩ ╩ ╩╩╚═ ╩ ╩ ╩ Go : go1.11.1 674 INFO[0000] ════════════════════════════════════════════════ 675 INFO[0000] Service: SpartaPProf-mweagle LinkFlags= Option=status UTC="2018-10-05T12:24:57Z" 676 INFO[0000] ════════════════════════════════════════════════ 677 INFO[0000] StackId Id="arn:aws:cloudformation:us-west-2:************:stack/SpartaPProf-mweagle/da781540-c764-11e8-9bf1-0aceeffcea3c" 678 INFO[0000] Stack status State=CREATE_COMPLETE 679 INFO[0000] Created Time="2018-10-03 23:34:21.142 +0000 UTC" 680 INFO[0000] Tag io:gosparta:buildTags=googlepprof 681 INFO[0000] Tag io:gosparta:buildId=c3fbe8c289c3184efec842dca56b9bf541f39d21 682 INFO[0000] Output HelloWorldFunctionARN="arn:aws:lambda:us-west-2:************:function:SpartaPProf-mweagle_Hello_World" 683 INFO[0000] Output KinesisLogConsumerFunctionARN="arn:aws:lambda:us-west-2:************:function:SpartaPProf-mweagle_KinesisLogConsumer" 684 ``` 685 686 - Replaced _Makefile_ with [magefile](https://magefile.org/) to better support cross platform builds. 687 688 - This is an internal only change and does not impact users 689 - For **CONTRIBUTORS**, to use the new _mage_ targets: 690 691 ```plain 692 $> go get -u github.com/magefile/mage 693 $> mage -l 694 695 Targets: 696 build the application 697 clean the working directory 698 describe runs the `TestDescribe` test to generate a describe HTML output file at graph.html 699 ensureAllPreconditions ensures that the source passes *ALL* static `ensure*` precondition steps 700 ensureFormatted ensures that the source code is formatted with goimports 701 ensureLint ensures that the source is `golint`ed 702 ensureSpelling ensures that there are no misspellings in the source 703 ensureStaticChecks ensures that the source code passes static code checks 704 ensureTravisBuildEnvironment is the command that sets up the Travis environment to run the build. 705 ensureVet ensures that the source has been `go vet`ted 706 generateBuildInfo creates the automatic buildinfo.go file so that we can stamp the SHA into the binaries we build... 707 generateConstants runs the set of commands that update the embedded CONSTANTS for both local and AWS Lambda execution 708 installBuildRequirements installs or updates the dependent packages that aren't referenced by the source, but are needed to build the Sparta source 709 publish the latest source 710 test runs the Sparta tests 711 testCover runs the test and opens up the resulting report 712 travisBuild is the task to build in the context of a Travis CI pipeline 713 ``` 714 715 - Added [misspell](https://github.com/client9/misspell) static check as part of `mage test` to catch misspellings 716 717 - :bug: **FIXED** 718 719 ## v1.3.0 720 721 - :warning: **BREAKING** 722 - :checkered_flag: **CHANGES** 723 - Update branchname and release tag to support Go 1.11 [modules](https://github.com/golang/go/wiki/Modules). 724 - :bug: **FIXED** 725 - Fixed `panic` when extracting [lambda function name](https://github.com/mweagle/Sparta/commit/c10a7a88c403ecf5b1f06784f0027fb35e0220a7). 726 727 ## v1.2.1 728 729 - :warning: **BREAKING** 730 - :checkered_flag: **CHANGES** 731 - Added `decorator.LogAggregatorDecorator` 732 - This is a decorator that: 733 1. Creates a [CloudWatchLogs Subscription Filter](https://t.co/C0cbo99Tsr) for the Lambda functions 734 1. Creates a Kinesis sink with the user defined shard count to receive the log events. 735 1. Subscribes the relay lambda function to the Kinesis stream 736 1. See [SpartaPProf](https://github.com/mweagle/SpartaPProf) for an example that relays log entries to Google StackDriver. 737 - Added `decorator.PublishAttOutputDecorator` and `decorator.PublishRefOutputDecorator` as convenience functions to update the Stack [Outputs](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/outputs-section-structure.html) section. 738 - Added `RuntimeLoggerHook` to [WorkflowHooks](https://godoc.org/github.com/mweagle/Sparta#WorkflowHooks) to support logrus logger [hooks](https://github.com/sirupsen/logrus#hooks). 739 - Added `IsExecutingInLambda () bool` to return execution environment 740 - :bug: **FIXED** 741 - [`$GOPATH` is no longer present by default](https://github.com/mweagle/Sparta/issues/111) 742 - [`gas` was replaced by `gosec`](https://github.com/mweagle/Sparta/issues/112) 743 - [`tview.ANSIIWriter` has been renamed to `tview.ANSIWriter`](https://github.com/mweagle/Sparta/issues/110) 744 745 ## v1.2 746 747 - :warning: **BREAKING** 748 - :checkered_flag: **CHANGES** 749 750 - Added support for SQS event triggers. 751 752 - SQS event sources use the same [EventSourceMappings](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-eventsourcemapping.html) entry that is used by DynamoDB and Kinesis. For example: 753 754 ```go 755 lambdaFn.EventSourceMappings = append(lambdaFn.EventSourceMappings, 756 &sparta.EventSourceMapping{ 757 EventSourceArn: gocf.GetAtt(sqsResourceName, "Arn"), 758 BatchSize: 2, 759 }) 760 ``` 761 762 - Where `sqsResourceName` is the name of a CloudFormation resource provisioned by the stack 763 - Use the [aws.SQSEvent](https://godoc.org/github.com/aws/aws-lambda-go/events#SQSEvent) value type as the incoming message 764 765 - See the [SpartaSQS](https://github.com/mweagle/SpartaSQS) project for a complete example 766 767 - Migrated `describe` command to use [Cytoscape.JS](http://js.cytoscape.org/) library 768 - Cytoscape supports several layout algorithms and per-service node icons. 769 - Added `APIGatewayEnvelope` type to allow struct embedding and overriding of the `Body` field. Example: 770 771 ```go 772 // FeedbackBody is the typed body submitted in a FeedbackRequest 773 type FeedbackBody struct { 774 Language string `json:"lang"` 775 Comment string `json:"comment"` 776 } 777 778 // FeedbackRequest is the typed input to the 779 // onFeedbackDetectSentiment 780 type FeedbackRequest struct { 781 spartaEvents.APIGatewayEnvelope 782 Body FeedbackBody `json:"body"` 783 } 784 ``` 785 786 - The previous [APIGatewayRequest](https://godoc.org/github.com/mweagle/Sparta/aws/events#APIGatewayRequest) remains unchanged: 787 788 ```go 789 type APIGatewayRequest struct { 790 APIGatewayEnvelope 791 Body interface{} `json:"body"` 792 } 793 ``` 794 795 - :bug: **FIXED** 796 - Fixed latent bug where dynamically created DynamoDB and Kinesis Event Source mappings had insufficient IAM privileges 797 - Fixed latent bug where the [S3Site](https://godoc.org/github.com/mweagle/Sparta#S3Site) source directory was validated before `go:generate` could have been executed. This resulted in cases where fresh-cloned repositories would not self-deploy. 798 - The filepath existence requirement was moved further into the provision workflow to support inline JS build operations. 799 800 ## v1.1.1 801 802 - :warning: **BREAKING** 803 - :checkered_flag: **CHANGES** 804 - Re-implemented the `explore` command. 805 - The `explore` command provides a terminal-based UI to interactively submit events to provisioned Lambda functions. 806 - The set of JSON files are determined by walking the working directory for all _\*.json_ files 807 - _Example_: <div align="center"><img src="https://raw.githubusercontent.com/mweagle/Sparta/master/docs_source/static/site/1.1.1/explore.jpg" /> 808 - Eliminate redundant `Statement` entries in [AssumeRolePolicyDocument](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iam-role.html) 809 - Add `sparta.StampedBuildID` global variable to access the _BuildID_ value (either user defined or automatically generated) 810 - Added `-z/--timestamps` command line flag to optionally include UTC timestamp prefix on every log line. 811 - Prefer `git rev-parse HEAD` value for fallback BuildID value iff `--buildID` isn't provided as a _provision_ command line argument. If an error is detected calling `git`, the previous randomly initialized buffer behavior is used. 812 - :bug: **FIXED** 813 814 ## v1.1.0 815 816 - :warning: **BREAKING** 817 - Removed `lambdabinary` build tags from [BuildDockerImage](https://godoc.org/github.com/mweagle/Sparta/docker#BuildDockerImage) 818 - AWS native support for **Go** in AWS caused a significant difference in standard vs `lambdabinary` build targets executed which prevented custom application options from being respected. 819 - :checkered_flag: **CHANGES** 820 821 - Change [EventSourceMapping.EventSourceArn](https://godoc.org/github.com/mweagle/Sparta#EventSourceMapping) from string to `interface{}` type. 822 823 - This change was to allow for provisioning of Pull-based event sources being provisioned in the same Sparta application as the lambda definition. 824 - For example, to reference a DynamoDB Stream created by in a [ServiceDecoratorHook](https://godoc.org/github.com/mweagle/Sparta#ServiceDecoratorHook) for the _myDynamoDBResourceName_ resource you can now use: 825 826 ```go 827 lambdaFn.EventSourceMappings = append(lambdaFn.EventSourceMappings, 828 &sparta.EventSourceMapping{ 829 EventSourceArn: gocf.GetAtt(myDynamoDBResourceName, "StreamArn"), 830 StartingPosition: "TRIM_HORIZON", 831 BatchSize: 10, 832 }) 833 ``` 834 835 - Updated `describe` output format and upgraded to latest versions of static HTML assets. 836 - _Example_: <div align="center"><img src="https://raw.githubusercontent.com/mweagle/Sparta/master/docs_source/static/site/1.1.0/describe.jpg" /> 837 </div> 838 - Delegate CloudFormation template aggregation to [go-cloudcondenser](https://github.com/mweagle/go-cloudcondenser) 839 - Exposed [ReservedConcurrentExecutions](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-function.html#cfn-lambda-function-reservedconcurrentexecutions) option for Lambda functions. 840 - Exposed [DeadLetterConfigArn](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-function.html#cfn-lambda-function-deadletterconfig) property to support custom DLQ destinations. 841 - Added IAM `sparta.IAMRolePrivilege` fluent builder type in the _github.com/mweagle/Sparta/aws/iam/builder_. Sample usage: 842 843 ```go 844 iambuilder.Allow("ssm:GetParameter").ForResource(). 845 Literal("arn:aws:ssm:"). 846 Region(":"). 847 AccountID(":"). 848 Literal("parameter/MyReservedParameter"). 849 ToPrivilege() 850 ``` 851 852 - Remove _io:gosparta:home_ and _io:gosparta:sha_ Tags from Lambda functions 853 - Standardize on Lambda function naming in AWS Console 854 - Reduced AWS Go binary size by 20% or more by including the `-s` and `-w` [link flags](https://golang.org/cmd/link/) 855 - See [Shrink your Go Binaries with this One Weird Trick](https://blog.filippo.io/shrink-your-go-binaries-with-this-one-weird-trick/) for more information 856 - Added `github.com/mweagle/Sparta/aws/cloudformation.UserAccountScopedStackName` to produce CloudFormation Stack names that are namespaced by AWS account username 857 - Ensure `Pre` and `Post` deploy hooks are granted proper permissions 858 - See [SpartaSafeDeploy](https://github.com/mweagle/SpartaSafeDeploy) for more information. 859 - Added [Sparta/aws/apigateway.Error](https://godoc.org/github.com/mweagle/Sparta/aws/apigateway#Error) to support returning custom API Gateway errors 860 - See [SpartaHTML](https://github.com/mweagle/SpartaHTML) for example usage 861 - API Gateway `error` responses are now converted to JSON objects via a Body Mapping template: 862 863 ```go 864 "application/json": "$input.path('$.errorMessage')", 865 ``` 866 867 - See the [AWS docs](https://docs.aws.amazon.com/apigateway/latest/developerguide/handle-errors-in-lambda-integration.html) for more information 868 869 - Added check for Linux only package [sysinfo](github.com/zcalusic/sysinfo). This Linux-only package is ignored by `go get` because of build tags and cannot be safely imported. An error will be shown if the package cannot be found: 870 871 ```plain 872 ERRO[0000] Failed to validate preconditions: Please run 873 `go get -v github.com/zcalusic/sysinfo` to install this Linux-only package. 874 This package is used when cross-compiling your AWS Lambda binary and cannot 875 be safely imported across platforms. When you `go get` the package, you may 876 see errors as in `undefined: syscall.Utsname`. These are expected and can be 877 ignored 878 ``` 879 880 - Added additional build-time static analysis check for suspicious coding practices with [gas](https://github.com/GoASTScanner/gas) 881 882 - :bug: **FIXED** 883 - [101](https://github.com/mweagle/Sparta/issues/101) 884 - Fixed latent bug where `NewAuthorizedMethod` didn't properly preserve the [AuthorizerID](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-method.html#cfn-apigateway-method-authorizationtype) when serializing to CloudFormation. This also forced a change to the function signature to accept a `gocf.Stringable` satisfying type for the [authorizerID](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-authorizer.html). 885 886 ## v1.0.1 887 888 - :warning: **BREAKING** 889 - :checkered_flag: **CHANGES** 890 - Added [events](https://github.com/mweagle/Sparta/blob/master/aws/events/event.go) package for Sparta specific event types. 891 - Initial top level event is `APIGatewayRequest` type for responding to API-Gateway mediated requests. 892 - Prefer stamping `buildID` into binary rather than providing as environment variable. Previously the stamped buildID was the `env.SPARTA_BUILD_ID` mutable variable. 893 - Remove dependency on [go-validator](github.com/asaskevich/govalidator) 894 - :bug: **FIXED** 895 - Fixed latent bug where [Discovery](https://godoc.org/github.com/mweagle/Sparta#Discover) wasn't properly initialized in AWS Lambda execution context 896 - Fixed latent bug where [CommandLineOptions](https://github.com/mweagle/Sparta/blob/master/sparta_main.go#L72) weren't properly defined in AWS build target 897 - Affected [SpartaCodePipeline](https://github.com/mweagle/SpartaCodePipeline) project 898 899 ## v1.0.0 900 901 ## 🎉 AWS Lambda for Go Support 🎉 902 903 - Sparta Go function signature has been changed to **ONLY** support the official AWS Lambda Go signatures 904 905 - `func ()` 906 - `func () error` 907 - `func (TIn) error` 908 - `func () (TOut, error)` 909 - `func (context.Context) error` 910 - `func (context.Context, TIn) error` 911 - `func (context.Context) (TOut, error)` 912 - `func (context.Context, TIn) (TOut, error)` 913 914 - See the lambda.Start [docs](https://godoc.org/github.com/aws/aws-lambda-go/lambda#Start) or the related [AWS Blog Post](https://aws.amazon.com/blogs/compute/announcing-go-support-for-aws-lambda/) for more information. 915 - _ALL_ Sparta Go Lambda function targets **MUST** now use the `sparta.HandleAWSLambda` creation function, a function pointer that satisfies one of the supported signatures. 916 - Providing an invalid signature such as `func() string` will produce a `provision` time error as in: 917 918 ```plain 919 Error: Invalid lambda returns: Hello World. Error: handler returns a single value, but it does not implement error 920 ``` 921 922 - :warning: **BREAKING** 923 924 - Removed `sparta.NewLambda` constructor 925 - Removed `sparta.NewServeMuxLambda` proxying function 926 - Removed `sparta.LambdaFunction` type 927 - `ContextKeyLambdaContext` is no longer published into the context. Prefer the official AWS [FromContext()](https://godoc.org/github.com/aws/aws-lambda-go/lambdacontext#LambdaContext) function to access the AWS Go Lambda context. 928 - Moved [DashboardDecorator](https://github.com/mweagle/SpartaXRay) to `decorators` namespace 929 - Removed `explore` command line option as proxying tier is no longer supported 930 - Changed all `logrus` imports to proper [lowercase format](https://github.com/sirupsen/logrus#logrus-) 931 932 - :checkered_flag: **CHANGES** 933 934 - All decorators are now implemented as slices. 935 - Existing single-valued fields remain supported, but deprecated 936 - There are convenience types to adapt free functions to their `*Handler` interface versions: 937 - `TemplateDecoratorHookFunc` 938 - `WorkflowHookFunc` 939 - `ArchiveHookFunc` 940 - `ServiceDecoratorHookFunc` 941 - `RollbackHookFunc` 942 - Added `CodeDeployServiceUpdateDecorator` to support [safe AWS Lambda deploys](https://github.com/awslabs/serverless-application-model/blob/master/docs/safe_lambda_deployments.rst) 943 - Safe lambda deploys are implemented via [ServiceDecoratorHooks](https://godoc.org/github.com/mweagle/Sparta#WorkflowHooks) 944 - See [SpartaSafeDeploy](https://github.com/mweagle/SpartaSafeDeploy) for a complete example 945 - Added **requestID** and **lambdaARN** request-scoped [\*logrus.Entry](https://godoc.org/github.com/sirupsen/logrus#Entry) to `context` argument. 946 947 - This can be accessed as in: 948 949 ```go 950 contextLogger, contextLoggerOk := ctx.Value(sparta.ContextKeyRequestLogger).(*logrus.Entry) 951 if contextLoggerOk { 952 contextLogger.Info("Request scoped log") 953 } 954 ``` 955 956 - The existing `*logrus.Logger` entry is also available in the `context` via: 957 958 ```go 959 logger, loggerOk := ctx.Value(sparta.ContextKeyLogger).(*logrus.Logger) 960 ``` 961 962 - [NewMethod](https://godoc.org/github.com/mweagle/Sparta#Resource.NewMethod) now accepts variadic parameters to limit how many API Gateway integration mappings are defined 963 - Added `SupportedRequestContentTypes` to [NewMethod](https://godoc.org/github.com/mweagle/Sparta#Resource.NewMethod) to limit API Gateway generated content. 964 - Added `apiGateway.CORSOptions` field to configure _CORS_ settings 965 - Added `Add S3Site.CloudFormationS3ResourceName()` 966 967 - This value can be used to scope _CORS_ access to a dynamoc S3 website as in: 968 969 ```go 970 apiGateway.CORSOptions = &sparta.CORSOptions{ 971 Headers: map[string]interface{}{ 972 "Access-Control-Allow-Origin": gocf.GetAtt(s3Site.CloudFormationS3ResourceName(), 973 "WebsiteURL"), 974 } 975 } 976 ``` 977 978 - Improved CLI usability in consistency of named outputs, formatting. 979 980 - :bug: **FIXED** 981 - Fix latent bug where `provision` would not consistently create new [API Gateway Stage](https://docs.aws.amazon.com/apigateway/latest/developerguide/stages.html) events. 982 983 ## v0.30.1 984 985 - :warning: **BREAKING** 986 - :checkered_flag: **CHANGES** 987 - Improved API-Gateway CORS support. The following customizations are opt-in: 988 - Parameterize CORS headers returned by _OPTIONS_ via [API.CORSOptions](https://godoc.org/github.com/mweagle/Sparta#API) 989 - Add `SupportedRequestContentTypes` to [Method](https://godoc.org/github.com/mweagle/Sparta#Method) struct. This is a slice of supported content types that define what API-Gateway _Content-Type_ values are supported. Limiting the set of supported content types reduces CloudFormation template size. 990 - Add variadic `possibleHTTPStatusCodeResponses` values to [NewMethod](https://godoc.org/github.com/mweagle/Sparta#Resource.NewMethod). If defined, Sparta will ONLY generate [IntegrationResponse](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-integration-settings-integration-response.html) entries for the possible codes (including the default HTTP status code). The previous, and default behavior, is to generate IntegrationResponse entries for _ALL_ valid HTTP status codes. 991 - Include per-resource CloudFormation provisioning times in output log 992 - Humanize magnitude output values and times with [go-humanize](https://github.com/dustin/go-humanize) 993 - Replace CloudFormation polling log output with [spinner](https://github.com/briandowns/spinner) 994 - This feedback is only available in normal CLI output. JSON formatted output remains unchanged. 995 - Usability improvements for Windows based builds 996 - :bug: **FIXED** 997 - Re-enable `cloudformation:DescribeStacks` and `cloudformation:DescribeStackResource` privileges to support HTML based deployments 998 999 ## v0.30.0 1000 1001 - :warning: **BREAKING** 1002 - `Tags` for dependent resources no longer available via [sparta.Discover](https://godoc.org/github.com/mweagle/Sparta#Discover) 1003 - Remove public sparta `Tag*` constants that were previously reserved for Discover support. 1004 - :checkered_flag: **CHANGES** 1005 - Change [sparta.Discover](https://godoc.org/github.com/mweagle/Sparta#Discover) to use _Environment_ data rather than CloudFormation API calls. 1006 - See [SpartaDynamoDB](https://github.com/mweagle/SpartaDynamoDB) for sample usage of multiple lambda functions depending on a single, dynamically provisioned Dynamo table. 1007 - Include **BuildID** in Lambda environment via `SPARTA_BUILD_ID` environment variable. 1008 - :bug: **FIXED** 1009 - Correct CLI typo 1010 1011 ## v0.20.4 1012 1013 - :warning: **BREAKING** 1014 - Changed `step.NewStateMachine` signature to include _StateMachineName_ as first argument per [Nov 15th, 2017 release](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/ReleaseHistory.html) 1015 - :checkered_flag: **CHANGES** 1016 1017 - Add `profile` command 1018 1019 - Profile snapshots are enabled via: 1020 1021 ```go 1022 sparta.ScheduleProfileLoop(nil, 5*time.Second, 30*time.Second, "heap") 1023 ``` 1024 1025 - Profile snapshots are published to S3 and are locally aggregated across all lambda instance publishers. To view the ui, run the `profile` Sparta command. 1026 - For more information, please see [The new pprof user interface - ⭐️](https://rakyll.org/pprof-ui/), [Profiling Go programs with pprof](https://jvns.ca/blog/2017/09/24/profiling-go-with-pprof/), or the [Go blog](https://blog.golang.org/profiling-go-programs) 1027 - See the [SpartaPProf](https://github.com/mweagle/SpartaPProf) sample for a service that installs profiling hooks. 1028 - Ensure you have the latest `pprof` UI via _go get -u -v github.com/google/pprof_ 1029 - The standard [profile names](https://golang.org/pkg/runtime/pprof/#Profile) are available, as well as a _cpu_ type implied by a non-zero `time.Duration` supplied as the third parameter to `ScheduleProfileLoop`. 1030 1031 - Eliminate unnecessary logging in AWS lambda environment 1032 - Log NodeJS [process.uptime()](https://nodejs.org/api/process.html#process_process_uptime) 1033 1034 - :bug: **FIXED** 1035 - Added more constructive message when working directory for `go build` doesn't contain `main` package. 1036 1037 ## v0.20.3 1038 1039 - :warning: **BREAKING** 1040 - :checkered_flag: **CHANGES** 1041 - :bug: **FIXED** 1042 - Fixed `explore` interactive debugging instructions 1043 1044 ## v0.20.2 1045 1046 - :warning: **BREAKING** 1047 - :checkered_flag: **CHANGES** 1048 1049 - Added support for [Step functions](https://aws.amazon.com/step-functions/faqs/). 1050 - Step functions are expressed via a combination of: states, `NewStateMachine`, and adding a `StateMachineDecorator` as a [service hook](https://godoc.org/github.com/mweagle/Sparta#ServiceDecoratorHook). 1051 - See the [SpartaStep](https://github.com/mweagle/SpartaStep) sample for a service that provisions a simple roll die state machine. 1052 - Usability improvements & enhancements for CLI log output. Text-formatted output now includes cleaner header as in: 1053 1054 ```plain 1055 INFO[0000] ══════════════════════════════════════════════════════════════ 1056 INFO[0000] _______ ___ ___ _________ 1057 INFO[0000] / __/ _ \/ _ | / _ \/_ __/ _ | Version : 0.20.2 1058 INFO[0000] _\ \/ ___/ __ |/ , _/ / / / __ | SHA : 740028b 1059 INFO[0000] /___/_/ /_/ |_/_/|_| /_/ /_/ |_| Go : go1.9.1 1060 INFO[0000] 1061 INFO[0000] ══════════════════════════════════════════════════════════════ 1062 INFO[0000] Service: SpartaStep-mweagle LinkFlags= Option=provision UTC="2017-11-01T01:14:31Z" 1063 INFO[0000] ══════════════════════════════════════════════════════════════ 1064 ``` 1065 1066 - Added [megacheck](https://github.com/dominikh/go-tools/tree/master/cmd/megacheck) to compile pipeline. Fixed issues. 1067 - Corrected inline Go examples to use proper function references & signatures. 1068 1069 - :bug: **FIXED** 1070 - Handle case where multipart forms with empty values weren't handled [https://github.com/mweagle/Sparta/issues/74](https://github.com/mweagle/Sparta/issues/74) 1071 1072 ## v0.20.1 1073 1074 - :warning: **BREAKING** 1075 - :checkered_flag: **CHANGES** 1076 - Add `sparta.LambdaName` to return the reflection-discovered name of an `http.HandleFunc` instance. 1077 - :bug: **FIXED** 1078 - Fixed issue with `--describe` not rendering CloudFormation template properly 1079 - Better handle failures when [posting body](https://github.com/mweagle/Sparta/pull/72) - thanks [@nylar](https://github.com/nylar) 1080 1081 ## v0.20.0 1082 1083 ### :star: Deprecation Notice 1084 1085 The `sparta.LambdaFunc` signature is officially deprecated in favor of `http.HandlerFunc` and will be removed in an upcoming release. See below for more information 1086 1087 - :warning: **BREAKING** 1088 - Changed `NewLambdaHTTPHandler` to `NewServeMuxLambda` 1089 - Remove obsolete `InvokeID` from [LambdaContext](https://godoc.org/github.com/mweagle/Sparta#LambdaContext) 1090 - Changed `codePipelineTrigger` CLI arg name to `codePipelinePackage` 1091 - :checkered_flag: **CHANGES** 1092 1093 - Eliminated NodeJS cold start `cp & chmod` penalty! :fire: 1094 - Prior to this release, the NodeJS proxying code would copy the embedded binary to _/tmp_ and add the executable flag prior to actually launching the binary. This had a noticeable performance penalty for startup. 1095 - This release embeds the application or library in a _./bin_ directory with the file permissions set so that there is no additional filesystem overhead on cold-start. h/t to [StackOverflow](https://stackoverflow.com/questions/41651134/cant-run-binary-from-within-python-aws-lambda-function) for the tips. 1096 - Migrated all IPC calls to [protocolBuffers](https://developers.google.com/protocol-buffers/). 1097 - Message definitions are in the [proxy](https://github.com/mweagle/Sparta/tree/master/proxy) directory. 1098 - The client-side log level (eg: `--level debug`) is carried into the AWS Lambda Code package. 1099 - Provisioning a service with `--level debug` will log everything at `logger.Debug` level and higher **including all AWS API** calls made both at `provision` and Lambda execution time. 1100 - Help resolve "Works on My Stack" syndrome. 1101 - HTTP handler `panic` events are now recovered and the traceback logged for both NodeJS and `cgo` deployments 1102 - Introduced `sparta.HandleAWSLambda` 1103 1104 - `sparta.HandleAWSLambda` accepts standard `http.RequestFunc` signatures as in: 1105 1106 ```go 1107 func helloWorld(w http.ResponseWriter, r *http.Request) { 1108 ... 1109 } 1110 1111 lambdaFn := sparta.HandleAWSLambda("Hello HTTP World", 1112 http.HandlerFunc(helloWorld), 1113 sparta.IAMRoleDefinition{}) 1114 ``` 1115 1116 - This allows you to [chain middleware](https://github.com/justinas/alice) for a lambda function as if it were a standard HTTP handler. Say, for instance: [X-Ray](https://github.com/aws/aws-xray-sdk-go). 1117 - The legacy [sparta.LambdaFunction](https://godoc.org/github.com/mweagle/Sparta#LambdaFunction) is still supported, but marked for deprecation. You will see a log warning as in: 1118 1119 ```plain 1120 WARN[0045] DEPRECATED: sparta.LambdaFunc() signature provided. Please migrate to http.HandlerFunc() 1121 ``` 1122 1123 - _LambdaContext_ and _\*logrus.Logger_ are now available in the [requext.Context()](https://golang.org/pkg/net/http/#Request.Context) via: 1124 - `sparta.ContextKeyLogger` => `*logrus.Logger` 1125 - `sparta.ContextKeyLambdaContext` => `*sparta.LambdaContext` 1126 - Example: 1127 - `loggerVal, loggerValOK := r.Context().Value(sparta.ContextKeyLogger).(*logrus.Logger)` 1128 1129 - Added support for [CodePipeline](https://aws.amazon.com/about-aws/whats-new/2016/11/aws-codepipeline-introduces-aws-cloudformation-deployment-action/) 1130 - See the [SpartaCodePipeline](https://github.com/mweagle/SpartaCodePipeline) project for a complete example and the related [post](https://medium.com/@mweagle/serverless-serverfull-and-weaving-pipelines-c9f83eec9227). 1131 - Upgraded NodeJS to [nodejs6.10](http://docs.aws.amazon.com/lambda/latest/dg/API_CreateFunction.html#SSS-CreateFunction-request-Runtime) runtime 1132 - Parity between NodeJS and Python/`cgo` startup output 1133 - Both NodeJS and `cgo` based Sparta applications now log equivalent system information. 1134 1135 - Example: 1136 1137 ```json 1138 { 1139 "level": "info", 1140 "msg": "SystemInfo", 1141 "systemInfo": { 1142 "sysinfo": { 1143 "version": "0.9.1", 1144 "timestamp": "2017-09-16T17:07:34.491807588Z" 1145 }, 1146 "node": { 1147 "hostname": "ip-10-25-51-97", 1148 "machineid": "0046d1358d2346adbf8851e664b30d25", 1149 "hypervisor": "xenhvm", 1150 "timezone": "UTC" 1151 }, 1152 "os": { 1153 "name": "Amazon Linux AMI 2017.03", 1154 "vendor": "amzn", 1155 "version": "2017.03", 1156 "architecture": "amd64" 1157 }, 1158 "kernel": { 1159 "release": "4.9.43-17.38.amzn1.x86_64", 1160 "version": "#1 SMP Thu Aug 17 00:20:39 UTC 2017", 1161 "architecture": "x86_64" 1162 }, 1163 "product": {}, 1164 "board": {}, 1165 "chassis": {}, 1166 "bios": {}, 1167 "cpu": { 1168 "vendor": "GenuineIntel", 1169 "model": "Intel(R) Xeon(R) CPU E5-2680 v2 @ 2.80GHz", 1170 "cache": 25600, 1171 "threads": 2 1172 }, 1173 "memory": {} 1174 }, 1175 "time": "2017-09-16T17:07:34Z" 1176 } 1177 ``` 1178 1179 - :bug: **FIXED** 1180 - There were more than a few 1181 1182 ## v0.13.2 1183 1184 - :warning: **BREAKING** 1185 - :checkered_flag: **CHANGES** 1186 - Changed how Lambda [FunctionName](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-function.html#cfn-lambda-function-functionname) values are defined so that function name uniqueness is preserved for free, imported free, and struct-defined functions 1187 - :bug: **FIXED** 1188 1189 ## v0.13.1 1190 1191 - :warning: **BREAKING** 1192 - :checkered_flag: **CHANGES** 1193 - Changed how Lambda [FunctionName](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-function.html#cfn-lambda-function-functionname) values are defined so that same-named functions provisioned across multiple stacks remain unique. This is done by prefixing the function name with the CloudFormation StackName. 1194 - Cleaned up S3 upload log statements to prefer relative paths iff applicable 1195 - :bug: **FIXED** 1196 - [Cloudformation lambda function name validation error](https://github.com/mweagle/Sparta/issues/63) 1197 - [64](https://github.com/mweagle/Sparta/issues/64) 1198 1199 ## v0.13.0 1200 1201 - :warning: **BREAKING** 1202 - Removed `sparta.NewNamedLambda`. Stable, user-defined function names can be supplied via the [SpartaOptions.Name](https://godoc.org/github.com/mweagle/Sparta#SpartaOptions) field. 1203 - :checkered_flag: **CHANGES** 1204 1205 - [CloudWatch Dashboard Support!](http://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch_Dashboards.html) 1206 1207 - You can provision a CloudWatch dashboard that provides a single overview and link portal for your Lambda-based service. Use the new `sparta.DashboardDecorator` function to automatically create a dashboard. This leverages the existing [WorkflowHooks](https://godoc.org/github.com/mweagle/Sparta#WorkflowHooks) functionality. 1208 - Example: 1209 1210 ```go 1211 // Setup the DashboardDecorator lambda hook 1212 workflowHooks := &sparta.WorkflowHooks{ 1213 ServiceDecorator: sparta.DashboardDecorator(lambdaFunctions, 60), 1214 } 1215 ``` 1216 1217 - Where the `60` value is the CloudWatch time series [period](http://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/cloudwatch_concepts.html). 1218 - The CloudWatch Dashboard URL will be included in your stack's Outputs as in: 1219 1220 ```plain 1221 INFO[0064] Stack output Description="CloudWatch Dashboard URL" Key=CloudWatchDashboardURL Value="https://us-west-2.console.aws.amazon.com/cloudwatch/home?region=us-west-2#dashboards:name=SpartaXRay-mweagle" 1222 ``` 1223 1224 - _Example_: <div align="center"><img src="https://raw.githubusercontent.com/mweagle/Sparta/master/docs_source/static/site/0.13.0/dashboard.jpg" /> 1225 1226 </div> 1227 1228 - For more info, see the [AWS Blog Post](https://aws.amazon.com/blogs/aws/new-api-cloudformation-support-for-amazon-cloudwatch-dashboards/) 1229 - The [SpartaXRay](https://github.com/mweagle/SpartaXRay) sample application has additional code samples. 1230 1231 - [XRay](http://docs.aws.amazon.com/xray/latest/devguide/xray-services-lambda.html) support added 1232 - added `LambdaFunctionOptions.TracingConfig` field to [LambdaFunctionOptions](https://godoc.org/github.com/mweagle/Sparta#LambdaFunctionOptions) 1233 - added XRay IAM privileges to default IAM role settings: 1234 - _xray:PutTraceSegments_ 1235 - _xray:PutTelemetryRecords_ 1236 - See [AWS blog](https://aws.amazon.com/blogs/aws/aws-lambda-support-for-aws-x-ray/) for more information 1237 - added [LambdaFunctionOptions.Tags](https://godoc.org/github.com/mweagle/Sparta#LambdaFunctionOptions) to support tagging AWS Lambda functions 1238 - added _SpartaGitHash_ output to both CLI and CloudWatch Dashboard output. This is in addition to the _SpartaVersion_ value (which I occasionally have failed to update). 1239 1240 - :bug: **FIXED** 1241 - Fixed latent issue where `SpartaOptions.Name` field wasn't consistently used for function names. 1242 1243 ## v0.12.1 1244 1245 - :warning: **BREAKING** 1246 - :checkered_flag: **CHANGES** 1247 - added _Sparta/aws/cloudformation.UserScopedStackName()_ to generate username-suffixed CloudFormation StackNames 1248 - :bug: **FIXED** 1249 1250 ## v0.12.0 1251 1252 - :warning: **BREAKING** 1253 - Replaced all [https://github.com/crewjam/go-cloudformation](https://github.com/crewjam/go-cloudformation) references with [https://github.com/mweagle/go-cloudformation](https://github.com/mweagle/go-cloudformation) references 1254 - This is mostly internal facing, but impacts advanced usage via [ServiceDecoratorHook](https://godoc.org/github.com/mweagle/Sparta#ServiceDecoratorHook) users. Clients may 1255 need to update the types used to create [alternative topologies](http://gosparta.io/docs/alternative_topologies/). 1256 - :checkered_flag: **CHANGES** 1257 - :bug: **FIXED** 1258 - Fixed latent issue where CGO-enabled services that reference `cgo.NewSession()` would not build properly 1259 - Fixed latent issue where S3 backed sites (eg: [SpartaHugo](https://github.com/mweagle/SpartaHugo)) would not refresh on update. 1260 - [55](https://github.com/mweagle/Sparta/issues/55) 1261 1262 ## v0.11.2 1263 1264 - :warning: **BREAKING** 1265 - :checkered_flag: **CHANGES** 1266 1267 - Added `--inplace/-c` command line option to support safe, concurrent updating of Lambda code packages 1268 1269 - If enabled _AND_ the stack update [changeset](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-changesets.html) reports _only_ modifications to Lambda functions, then Sparta will use the AWS Lambda API to [update the function code](http://docs.aws.amazon.com/sdk-for-go/api/service/lambda/#Lambda.UpdateFunctionCode). 1270 - If enabled _AND_ additional mutations are reported, you'll see an error as in: 1271 1272 ```plain 1273 ERRO[0022] Unsupported in-place operations detected: 1274 Add for IAMRole9fd267df3a3d0a144ae11a64c7fb9b7ffff3fb6c (ResourceType: AWS::IAM::Role), 1275 Add for mainhelloWorld2Lambda32fcf388f6b20e86feb93e990fa8decc5b3f9095 (ResourceType: AWS::Lambda::Function) 1276 ``` 1277 1278 - Prefer [NewRecorder](https://golang.org/pkg/net/http/httptest/#NewRecorder) to internal type for CGO marshalling 1279 - Added `--format/-f` command line flag `[text, txt, json]` to specify logfile output format. Default is `text`. 1280 - See [logrus.Formatters](https://github.com/sirupsen/logrus#formatters) 1281 1282 - :bug: **FIXED** 1283 - [45](https://github.com/mweagle/Sparta/issues/45) 1284 1285 ## v0.11.1 1286 1287 - :warning: **BREAKING** 1288 - :checkered_flag: **CHANGES** 1289 1290 - Support Go 1.8 newly optional _GOPATH_ environment variable 1291 - Python proxied `cgo` builds now preserve the transformed source in the _./sparta_ scratch space directory. 1292 - Sparta assigned AWS Lambda function names now strip the leading SCM prefix. Example: 1293 1294 ```bash 1295 github.com/mweagle/SpartaPython.HelloWorld 1296 ``` 1297 1298 becomes: 1299 1300 ```bash 1301 mweagle/SpartaPython.HelloWorld 1302 ``` 1303 1304 - Upgrade to Mermaid [7.0.0](https://github.com/knsv/mermaid/releases/tag/7.0.0) 1305 - Use stable _PolicyName_ in `IAM::Role` definitions to minimize CloudFormation resource update churn 1306 1307 - :bug: **FIXED** 1308 - Fixed latent bug where S3 bucket version check didn't respect `--noop` mode. 1309 - Fixed latent `cgo` bug where command line arguments weren't properly parsed 1310 1311 ## v0.11.0 1312 1313 - :warning: **BREAKING** 1314 - :checkered_flag: **CHANGES** 1315 - :tada: Python CGO support added. See the [https://github.com/mweagle/SpartaPython](https://github.com/mweagle/SpartaPython) project for example usage! 1316 - In preliminary testing, the Python CGO package provides significant cold start and hot-execution performance benefits. 1317 - Migrated dependency management to [dep](https://github.com/golang/dep) 1318 - :bug: **FIXED** 1319 - Fixed latent bug where DynamoDB EventSource mappings ResourceARNs weren't properly serialized. 1320 - Fixed latent bug where code pushed to S3 version-enabled buckets didn't use the latest `VersionID` in the AWS [Lambda Code](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lambda-function-code.html) value. 1321 1322 ## v0.10.0 1323 1324 - :warning: **BREAKING** 1325 - `describe` option now requires `-b/--s3Bucket` argument 1326 - Changed signature of `aws/s3/CreateS3RollbackFunc` to accept full S3 URL, including `versionId` query param 1327 - Signatures for `sparta.Provision` and `sparta.Discover` updated with new arguments 1328 - :checkered_flag: **CHANGES** 1329 1330 - Add `-p/--codePipelineTrigger` command line option to generate CodePipeline deployment package 1331 - Add `sparta.RegisterCodePipelineEnvironment` to define environment variables in support of [CloudFormation Deployments](https://aws.amazon.com/about-aws/whats-new/2016/11/aws-codepipeline-introduces-aws-cloudformation-deployment-action/). Example: 1332 1333 ```go 1334 func init() { 1335 sparta.RegisterCodePipelineEnvironment("test", map[string]string{ 1336 "MESSAGE": "Hello Test!", 1337 }) 1338 sparta.RegisterCodePipelineEnvironment("production", map[string]string{ 1339 "MESSAGE": "Hello Production!", 1340 }) 1341 } 1342 ``` 1343 1344 - Add support for `Environment` and `KmsKeyArn` properties to [LambdaFunctionOptions](https://godoc.org/github.com/mweagle/Sparta#LambdaFunctionOptions). See [AWS](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-function.html) for more information. 1345 - Move all build artifacts to _./sparta_ directory 1346 - `-n/--noop` argument orphans S3 artifacts in _./sparta_ directory 1347 - Add support for S3 version policy enabled buckets 1348 - Artifacts pushed to S3 version-enabled buckets now use stable object keys. Rollback functions target specific versions if available. 1349 - Cleanup log statements 1350 - Add `sparta/aws/session.NewSessionWithLevel()` to support [AWS LogLevel](http://docs.aws.amazon.com/sdk-for-go/api/aws/#LogLevelType) parameter 1351 1352 - :bug: **FIXED** 1353 - [34](https://github.com/mweagle/Sparta/issues/34) 1354 - [37](https://github.com/mweagle/Sparta/issues/37) 1355 - [38](https://github.com/mweagle/Sparta/issues/38) 1356 1357 ## v0.9.3 1358 1359 - :warning: **BREAKING** 1360 - :checkered_flag: **CHANGES** 1361 1362 - Added [LambdaFunctionOptions.SpartaOptions](https://godoc.org/github.com/mweagle/Sparta#SpartaOptions) struct 1363 - The primary use case is to support programmatically generated lambda functions that must be disambiguated by their Sparta name. Sparta defaults to reflection based function name identification. 1364 - Added `--ldflags` support to support lightweight [dynamic string variables](https://golang.org/cmd/link/) 1365 - Usage: 1366 `go run main.go provision --level info --s3Bucket $(S3_BUCKET) --ldflags "-X main.dynamicValue=SampleValue"` 1367 1368 - :bug: **FIXED** 1369 1370 ## v0.9.2 1371 1372 - :warning: **BREAKING** 1373 - :checkered_flag: **CHANGES** 1374 - Move Sparta-related provisioning values from stack [Outputs](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/outputs-section-structure.html) to [Tags](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/cfn-console-add-tags.html). 1375 - Add support for go [BuildTags](https://golang.org/pkg/go/build/) to support environment settings. 1376 - Added [Sparta/aws/cloudformation](https://godoc.org/github.com/mweagle/Sparta/aws/cloudformation) functions to support stack creation. 1377 - Added [Sparta/aws/s3](https://godoc.org/github.com/mweagle/Sparta/aws/cloudformation) functions to encapsulate common S3 operations. 1378 - Added [Sparta/zip](https://godoc.org/github.com/mweagle/Sparta/zip) functions to expose common ZIP related functions. 1379 - Legibility enhancements for `describe` output 1380 - `sparta.CloudFormationResourceName` proxies to `github.com/mweagle/Sparta/aws/cloudformation.CloudFormationResourceName`. The `sparta` package function is _deprecated_ and will be removed in a subsequent release. 1381 - :bug: **FIXED** 1382 - Fixed latent bug in `github.com/mweagle/Sparta/zip.AddToZip` where the supplied ZipWriter was incorrectly closed on function exit. 1383 - Fixed latent parsing _userdata_ input 1384 - Fixed latent issue where empty [ChangeSets](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-changesets-execute.html) were applied rather than deleted. 1385 1386 ## v0.9.1 1387 1388 - :warning: **BREAKING** 1389 - :checkered_flag: **CHANGES** 1390 - Improved `describe` output. Includes APIGateway resources and more consistent UI. 1391 - Additive changes to [WorkflowHooks](https://godoc.org/github.com/mweagle/Sparta#WorkflowHooks) 1392 - `Context` property to set the initial context for Workflow hook execution 1393 - [ServiceDecorator](https://godoc.org/github.com/mweagle/Sparta#ServiceDecorator) type to define service-scoped AWS resources. Previously, template decoration was bound to specific Lambda functions. 1394 - Published related [SpartaVault](https://github.com/mweagle/SpartaVault): use AWS KMS to encrypt secrets as Go variables. See the [KMS Docs](http://docs.aws.amazon.com/kms/latest/developerguide/workflow.html) for information. 1395 - Add Godeps support 1396 - :bug: **FIXED** 1397 - Fixed latent bug when adding custom resources to the ZIP archive via [ArchiveHook](https://godoc.org/github.com/mweagle/Sparta#ArchiveHook). ArchiveHook is now called after core Sparta assets are injected into archive. 1398 1399 ## v0.9.0 1400 1401 - :warning: **BREAKING** 1402 1403 - `NewMethod` and `NewAuthorizedMethod` for APIGateway definitions have been changed to include new, final parameter that marks the _default_ integration response code. 1404 1405 - Prior to this change, Sparta would automatically use `http.StatusOK` for all non-POST requests, and `http.StatusCreated` for POST requests. The change allows you to control whitelisted headers to be returned through APIGateway as in: 1406 1407 ```go 1408 // API response struct 1409 type helloWorldResponse struct { 1410 Location string `json:"location"` 1411 Body string `json:"body"` 1412 } 1413 // 1414 // Promote the location key value to an HTTP header 1415 // 1416 apiGWMethod, _ := apiGatewayResource.NewMethod("GET", http.StatusOK) 1417 apiGWMethod.Responses[http.StatusOK].Parameters = map[string]bool{ 1418 "method.response.header.Location": true, 1419 } 1420 apiGWMethod.Integration.Responses[http.StatusOK].Parameters["method.response.header.Location"] = "integration.response.body.location" 1421 ``` 1422 1423 - :checkered_flag: **CHANGES** 1424 1425 - (@sdbeard) Added [sparta.NewNamedLambda](https://godoc.org/github.com/mweagle/Sparta#NewNamedLambda) that allows you to set stable AWS Lambda [FunctionNames](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-function.html#cfn-lambda-function-functionname) 1426 - Added [spartaCF.AddAutoIncrementingLambdaVersionResource](https://godoc.org/github.com/mweagle/Sparta/aws/cloudformation#AddAutoIncrementingLambdaVersionResource) to support Lambda function versions. Should be called from a TemplateDecorator. Usage: 1427 1428 ```go 1429 autoIncrementingInfo, autoIncrementingInfoErr := spartaCF.AddAutoIncrementingLambdaVersionResource(serviceName, 1430 lambdaResourceName, 1431 cfTemplate, 1432 logger) 1433 if nil != autoIncrementingInfoErr { 1434 return autoIncrementingInfoErr 1435 } 1436 ``` 1437 1438 - Added new [CloudWatch Metrics](http://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CW_Support_For_AWS.html.html#cfn-lambda-function-functionname) for lambda execution 1439 - Removed all NodeJS shim `dependencies` from _./resources/provision/package.json_ 1440 - Added utility CloudFormation script _./aws/cloudformation/cli/describe.go_ which produces a JSON serialization of a [DescribeStacksOutput](https://godoc.org/github.com/aws/aws-sdk-go/service/cloudformation#DescribeStacksOutput) struct for build-time discovery of cluster-scoped resources. 1441 - Relaxed constraint that an API GW resource is bound to single Sparta lambda function. You can now register per-HTTP method name lambda functions for the same API GW resource. 1442 - Added [Contributors](https://github.com/mweagle/Sparta#contributors) section to README 1443 1444 - :bug: **FIXED** 1445 - [19](https://github.com/mweagle/Sparta/issues/19) 1446 - [15](https://github.com/mweagle/Sparta/issues/15) 1447 - [16](https://github.com/mweagle/Sparta/issues/16) 1448 1449 ## v0.8.0 1450 1451 - :warning: **BREAKING** 1452 - `TemplateDecorator` signature changed to include `context map[string]interface{}` to support sharing state across `WorkflowHooks` (below). 1453 - :checkered_flag: **CHANGES** 1454 - Add `SpartaBuildID` stack output with build ID 1455 - `WorkflowHooks` 1456 - WorkflowHooks enable an application to customize the ZIP archive used as the AWS Lambda target rather than needing to embed resources inside their Go binary 1457 - They may also be used for Docker-based mixed topologies. See 1458 - Add optional `-i/--buildID` parameter for `provision`. 1459 - The parameter will be added to the stack outputs 1460 - A random value will be used if non is provided on the command line 1461 - Artifacts posted to S3 are now scoped by `serviceName` 1462 - Add `sparta.MainEx` for non-breaking signature extension 1463 - :bug: **FIXED** 1464 1465 - (@sdbeard) Fixed latent bug in Kinesis event source subscriptions that caused `ValidationError`s during provisioning: 1466 1467 ```bash 1468 ERRO[0028] ValidationError: [/Resources/IAMRole3dbc1b4199ad659e6267d25cfd8cc63b4124530d/Type/Policies/0/PolicyDocument/Statement/5/Resource] 'null' values are not allowed in templates 1469 status code: 400, request id: ed5fae8e-7103-11e6-8d13-b943b498f5a2 1470 ``` 1471 1472 - Fixed latent bug in [ConvertToTemplateExpression](https://godoc.org/github.com/mweagle/Sparta/aws/cloudformation#ConvertToTemplateExpression) when parsing input with multiple AWS JSON fragments. 1473 - Fixed latent bug in [sparta.Discover](https://godoc.org/github.com/mweagle/Sparta#Discover) which prevented dependent resources from being discovered at Lambda execution time. 1474 - Fixed latent bug in [explore.NewAPIGatewayRequest](https://godoc.org/github.com/mweagle/Sparta/explore#NewAPIGatewayRequest) where whitelisted param keynames were unmarshalled to `method.request.TYPE.VALUE` rather than `TYPE`. 1475 1476 ## v0.7.1 1477 1478 - :warning: **BREAKING** 1479 - :checkered_flag: **CHANGES** 1480 - Upgrade to latest [go-cloudformation](https://github.com/crewjam/go-cloudformation) that required internal [refactoring](https://github.com/mweagle/Sparta/pull/9). 1481 - :bug: **FIXED** 1482 - N/A 1483 1484 ## v0.7.0 1485 1486 - :warning: **BREAKING** 1487 - `TemplateDecorator` signature changed to include `serviceName`, `S3Bucket`, and `S3Key` to allow for decorating CloudFormation with [UserData](http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/user-data.html) to support [alternative topology](http://gosparta.io/docs/alternative_topologies/) deployments. 1488 - `CommonIAMStatements` changed from `map[string][]iamPolicyStatement` to struct with named fields. 1489 - `PushSourceConfigurationActions` changed from `map[string][]string` to struct with named fields. 1490 - Eliminated [goptions](https://github.com/voxelbrain/goptions) 1491 - :checkered_flag: **CHANGES** 1492 - Moved CLI parsing to [Cobra](https://github.com/spf13/cobra) 1493 - Applications can extend the set of flags for existing Sparta commands (eg, `provision` can include `--subnetIDs`) as well as add their own top level commands to the `CommandLineOptions` exported values. See [SpartaCICD](https://github.com/mweagle/SpartaCICD) for an example. 1494 - Added _Sparta/aws/cloudformation_ `ConvertToTemplateExpression` to convert string value into [Fn::Join](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-join.html) compatible representation. Parses inline AWS references and supports user-defined [template](https://golang.org/pkg/text/template/) properties. 1495 - Added `sparta/aws/iam` _PolicyStatement_ type 1496 - Upgraded `describe` output to use [Mermaid 6.0.0](https://github.com/knsv/mermaid/releases/tag/6.0.0) 1497 - All [goreportcard](https://goreportcard.com/report/github.com/mweagle/Sparta) issues fixed. 1498 - :bug: **FIXED** 1499 - Fixed latent VPC provisioning bug where VPC/Subnet IDs couldn't be provided to template serialization. 1500 1501 ## v0.6.0 1502 1503 - :warning: **BREAKING** 1504 - `TemplateDecorator` signature changed to include `map[string]string` to allow for decorating CloudFormation resource metadata 1505 - :checkered_flag: **CHANGES** 1506 - All NodeJS CustomResources moved to _go_ 1507 - Add support for user-defined CloudFormation CustomResources via `LambdaAWSInfo.RequireCustomResource` 1508 - `DiscoveryInfo` struct now includes `TagLogicalResourceID` field with CloudFormation Resource ID of calling lambda function 1509 - :bug: **FIXED** 1510 - N/A 1511 1512 ## v0.5.5 1513 1514 This release includes a major internal refactoring to move the current set of NodeJS [Lambda-backed CloudFormation CustomResources](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/template-custom-resources-lambda.html) to Sparta Go functions. The two migrated CustomActions are: 1515 1516 - The S3 event source configuration 1517 - Provisioning an S3-static site 1518 1519 Both are implemented using [cloudformationresources](https://github.com/mweagle/cloudformationresources). There are no changes to the calling code and no regressions are expected. 1520 1521 - :warning: **BREAKING** 1522 - APIGateway provisioning now only creates a single discovery file: _MANIFEST.json_ at the site root. 1523 - :checkered_flag: **CHANGES** 1524 - VPC support! Added [LambdaFunctionVPCConfig](https://godoc.org/github.com/crewjam/go-cloudformation#LambdaFunctionVPCConfig) to [LambdaFunctionsOptions](https://godoc.org/github.com/mweagle/Sparta#LambdaFunctionOptions) struct. 1525 - Updated NodeJS runtime to [nodejs4.3](http://docs.aws.amazon.com/lambda/latest/dg/programming-model.html) 1526 - CloudFormation updates are now done via [Change Sets](https://aws.amazon.com/blogs/aws/new-change-sets-for-aws-cloudformation/), rather than [UpdateStack](http://docs.aws.amazon.com/sdk-for-go/api/service/cloudformation/CloudFormation.html#UpdateStack-instance_method). 1527 - APIGateway and CloudWatchEvents are now configured using [CloudFormation](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/ReleaseHistory.html). They were previously implemented using NodeJS CustomResources. 1528 - :bug: **FIXED** 1529 - Fixed latent issue where `IAM::Role` resources didn't use stable CloudFormation resource names 1530 - Fixed latent issue where names & descriptions of Lambda functions weren't consistent 1531 - [1](https://github.com/mweagle/SpartaApplication/issues/1) 1532 1533 ## v0.5.4 1534 1535 - :warning: **BREAKING** 1536 - N/A 1537 - :checkered_flag: **CHANGES** 1538 - Run `go generate` as part of the _provision_ step 1539 - :bug: **FIXED** 1540 - N/A 1541 1542 ## v0.5.3 1543 1544 - :warning: **BREAKING** 1545 - N/A 1546 - :checkered_flag: **CHANGES** 1547 - N/A 1548 - :bug: **FIXED** 1549 - [6](https://github.com/mweagle/Sparta/issues/6) 1550 1551 ## v0.5.2 1552 1553 - :warning: **BREAKING** 1554 - N/A 1555 - :checkered_flag: **CHANGES** 1556 - Added [cloudwatchlogs.Event](https://godoc.org/github.com/mweagle/Sparta/aws/cloudwatchlogs#Event) to support unmarshaling CloudWatchLogs data 1557 1558 ## v0.5.1 1559 1560 - :warning: **BREAKING** 1561 - N/A 1562 - :checkered_flag: **CHANGES** 1563 - Added [LambdaAWSInfo.URLPath](https://godoc.org/github.com/mweagle/Sparta#LambdaAWSInfo.URLPath) to enable _localhost_ testing 1564 - See _explore_test.go_ for example 1565 - :bug: **FIXED** 1566 - [8](https://github.com/mweagle/Sparta/issues/8) 1567 1568 ## v0.5.0 1569 1570 - :warning: **BREAKING** 1571 - N/A 1572 - :checkered_flag: **CHANGES** 1573 - Added [sparta.CloudWatchLogsPermission](https://godoc.org/github.com/mweagle/Sparta#CloudWatchLogsPermission) type to support lambda invocation in response to log events. 1574 - Fixed latent bug on Windows where temporary archives weren't properly deleted 1575 - The `GO15VENDOREXPERIMENT=1` environment variable for cross compilation is now inherited from the current session. 1576 - Sparta previously always added it to the environment variables during compilation. 1577 - Hooked AWS SDK logger so that Sparta `--level debug` log level includes AWS SDK status 1578 - Also include `debug` level message listing AWS SDK version for diagnostic info 1579 - Log output includes lambda deployment [package size](http://docs.aws.amazon.com/lambda/latest/dg/limits.html) 1580 1581 ## v0.4.0 1582 1583 - :warning: **BREAKING** 1584 - Change `sparta.Discovery()` return type from `map[string]interface{}` to `sparta.DiscoveryInfo`. 1585 - This type provides first class access to service-scoped and `DependsOn`-related resource information 1586 - :checkered_flag: **CHANGES** 1587 - N/A 1588 1589 ## v0.3.0 1590 1591 - :warning: **BREAKING** 1592 - Enforce that a single **Go** function cannot be associated with more than 1 `sparta.LamddaAWSInfo` struct. 1593 - This was done so that `sparta.Discovery` can reliably use the enclosing **Go** function name for discovery. 1594 - Enforce that a non-nil `*sparta.API` value provided to `sparta.Main()` includes a non-empty set of resources and methods 1595 - :checkered_flag: **CHANGES** 1596 type 1597 - This type can be used to enable [CloudWatch Events](https://aws.amazon.com/blogs/aws/new-cloudwatch-events-track-and-respond-to-changes-to-your-aws-resources/) 1598 - See the [SpartaApplication](https://github.com/mweagle/SpartaApplication/blob/master/application.go#L381) example app for a sample usage. 1599 - `sparta.Discovery` now returns the following CloudFormation [Pseudo Parameters](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/pseudo-parameter-reference.html): 1600 - _StackName_ 1601 - _StackID_ 1602 - _Region_ 1603 - Upgrade to Mermaid [0.5.7](https://github.com/knsv/mermaid/releases/tag/0.5.7) to fix `describe` rendering failure on Chrome. 1604 1605 ## v0.2.0 1606 1607 - :warning: **BREAKING** 1608 1609 - Changed `NewRequest` to `NewLambdaRequest` to support mock API gateway requests being made in `explore` mode 1610 - `TemplateDecorator` signature changed to support [go-cloudformation](https://github.com/crewjam/go-cloudformation) representation of the CloudFormation JSON template. 1611 - /ht @crewjam for [go-cloudformation](https://github.com/crewjam/go-cloudformation) 1612 - Use `sparta.EventSourceMapping` rather than [aws.CreateEventSourceMappingInput](http://docs.aws.amazon.com/sdk-for-go/api/service/lambda.html#type-CreateEventSourceMappingInput) type for `LambdaAWSInfo.EventSourceMappings` slice 1613 - Add dependency on [crewjam/go-cloudformation](https://github.com/crewjam/go-cloudformation) for CloudFormation template creation 1614 - /ht @crewjam for the great library 1615 - CloudWatch log output no longer automatically uppercases all first order child key names. 1616 1617 - :checkered_flag: **CHANGES** 1618 1619 - :boom: Add `LambdaAWSInfo.DependsOn` slice 1620 - Lambda functions can now declare explicit dependencies on resources added via a `TemplateDecorator` function 1621 - The `DependsOn` value should be the dependency's logical resource name. Eg, the value returned from `CloudFormationResourceName(...)`. 1622 - :boom: Add `sparta.Discovery()` function 1623 1624 - To be called from a **Go** lambda function (Eg, `func echoEvent(*json.RawMessage, *LambdaContext, http.ResponseWriter, *logrus.Logger)`), it returns the Outputs (both [Fn::Att](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-getatt.html) and [Ref](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-ref.html) ) values of dynamically generated CloudFormation resources that are declared as explicit `DependsOn` of the current function. 1625 - Sample output return value: 1626 1627 ```json 1628 { 1629 "SESMessageStoreBucketa622fdfda5789d596c08c79124f12b978b3da772": { 1630 "DomainName": "spartaapplication-sesmessagestorebucketa622fdfda5-1rhh9ckj38gt4.s3.amazonaws.com", 1631 "Ref": "spartaapplication-sesmessagestorebucketa622fdfda5-1rhh9ckj38gt4", 1632 "Tags": [ 1633 { 1634 "Key": "sparta:logicalBucketName", 1635 "Value": "Special" 1636 } 1637 ], 1638 "Type": "AWS::S3::Bucket", 1639 "WebsiteURL": "http://spartaapplication-sesmessagestorebucketa622fdfda5-1rhh9ckj38gt4.s3-website-us-west-2.amazonaws.com" 1640 }, 1641 "golangFunc": "main.echoSESEvent" 1642 } 1643 ``` 1644 1645 - See the [SES EventSource docs](http://gosparta.io/docs/eventsources/ses/) for more information. 1646 1647 - Added `TS` (UTC TimeStamp) field to startup message 1648 - Improved stack provisioning performance 1649 - Fixed latent issue where CloudFormation template wasn't deleted from S3 on stack provisioning failure. 1650 - Refactor AWS runtime requirements into `lambdaBinary` build tag scope to support Windows builds. 1651 - Add `SESPermission` type to support triggering Lambda functions in response to inbound email 1652 - See _doc_sespermission_test.go_ for an example 1653 - Storing the message body to S3 is done by assigning the `MessageBodyStorage` field. 1654 - Add `NewAPIGatewayRequest` to support _localhost_ API Gateway mock requests 1655 1656 ## v0.1.5 1657 1658 - :warning: **BREAKING** 1659 - N/A 1660 - :checkered_flag: **CHANGES** 1661 - Add [S3 Object Expiration](http://docs.aws.amazon.com/AmazonS3/latest/dev/how-to-set-lifecycle-configuration-intro.html) warning message if the target bucket doesn't specify one. 1662 - Replace internal CloudFormation polling loop with [WaitUntilStackCreateComplete](https://godoc.org/github.com/aws/aws-sdk-go/service/cloudformation#CloudFormation.WaitUntilStackCreateComplete) and [WaitUntilStackUpdateComplete](https://godoc.org/github.com/aws/aws-sdk-go/service/cloudformation#CloudFormation.WaitUntilStackUpdateComplete) 1663 1664 ## v0.1.4 1665 1666 - :warning: **BREAKING** 1667 - N/A 1668 - :checkered_flag: **CHANGES** 1669 - Reduce deployed binary size by excluding Sparta embedded resources from deployed binary via build tags. 1670 1671 ## v0.1.3 1672 1673 - :warning: **BREAKING** 1674 - API Gateway responses are only transformed into a standard format in the case of a go lambda function returning an HTTP status code >= 400 1675 - Previously all responses were wrapped which prevented integration with other services. 1676 - :checkered_flag: **CHANGES** 1677 1678 - Default [integration mappings](http://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-mapping-template-reference.html) now defined for: 1679 - _application/json_ 1680 - _text/plain_ 1681 - _application/x-www-form-urlencoded_ 1682 - _multipart/form-data_ 1683 - Depending on the content-type, the **Body** value of the incoming event will either be a `string` or a `json.RawMessage` type. 1684 - CloudWatch log files support spawned golang binary JSON formatted logfiles 1685 - CloudWatch log output includes environment. Sample: 1686 1687 ```JSON 1688 { 1689 "AWS_SDK": "2.2.25", 1690 "NODE_JS": "v0.10.36", 1691 "OS": { 1692 "PLATFORM": "linux", 1693 "RELEASE": "3.14.48-33.39.amzn1.x86_64", 1694 "TYPE": "Linux", 1695 "UPTIME": 4755.330878024 1696 } 1697 } 1698 ``` 1699 1700 ## v0.1.2 1701 1702 - :warning: **BREAKING** 1703 - N/A 1704 - :checkered_flag: **CHANGES** 1705 - Added `explore.NewRequest` to support _localhost_ testing of lambda functions. 1706 - Clients can supply optional **event** data similar to the AWS Console feature. 1707 - See [explore_test](https://github.com/mweagle/Sparta/blob/master/explore_test.go) for an example. 1708 1709 ## v0.1.1 1710 1711 - :warning: **BREAKING** 1712 - `sparta.Main()` signature changed to accept optional `S3Site` pointer 1713 - :checkered_flag: **CHANGES** 1714 1715 - Updated `describe` CSS font styles to eliminate clipping 1716 - Support `{Ref: 'MyDynamicResource'}` for _SourceArn_ values. Example: 1717 1718 ```javascript 1719 lambdaFn.Permissions = append(lambdaFn.Permissions, sparta.SNSPermission{ 1720 BasePermission: sparta.BasePermission{ 1721 SourceArn: sparta.ArbitraryJSONObject{"Ref": snsTopicName}, 1722 }, 1723 }) 1724 ``` 1725 1726 - Where _snsTopicName_ is a CloudFormation resource name representing a resource added to the template via a [TemplateDecorator](https://godoc.org/github.com/mweagle/Sparta#TemplateDecorator). 1727 1728 - Add CloudWatch metrics to help track [container reuse](https://aws.amazon.com/blogs/compute/container-reuse-in-lambda/). 1729 - Metrics are published to **Sparta/<SERVICE_NAME>** namespace. 1730 - MetricNames: `ProcessCreated`, `ProcessReused`, `ProcessTerminated`. 1731 1732 ## v0.1.0 1733 1734 - :warning: **BREAKING** 1735 - `sparta.Main()` signature changed to accept optional `S3Site` pointer 1736 - :checkered_flag: **CHANGES** 1737 - Added `S3Site` type and optional static resource provisioning as part of `provision` 1738 - See the [SpartaHTML](https://github.com/mweagle/SpartaHTML) application for a complete example 1739 - Added `API.CORSEnabled` option (defaults to _false_). 1740 - If defined, all APIGateway methods will have [CORS Enabled](http://docs.aws.amazon.com/apigateway/latest/developerguide/how-to-cors.html). 1741 - Update logging to use structured fields rather than variadic, concatenation 1742 - Reimplement `explore` command line option. 1743 - The `explore` command line option creates a _localhost_ server to which requests can be sent for testing. The POST request body **MUST** be _application/json_, with top level `event` and `context` keys for proper unmarshaling. 1744 - Expose NewLambdaHTTPHandler() which can be used to generate an _httptest_ 1745 1746 ## v0.0.7 1747 1748 - :warning: **BREAKING** 1749 - N/A 1750 - :checkered_flag: **CHANGES** 1751 - Documentation moved to [gosparta.io](http://gosparta.io) 1752 compliant value for `go test` integration. 1753 - Add [context](http://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-mapping-template-reference.html) struct to APIGatewayLambdaJSONEvent 1754 - Default description based on _Go_ function name for AWS Lambda if none provided 1755 - Added [SNS Event](https://github.com/mweagle/Sparta/blob/master/aws/sns/events.go) types for unmarshaling 1756 - Added [DynamoDB Event](https://github.com/mweagle/Sparta/blob/master/aws/dynamodb/events.go) types for unmarshaling 1757 - Added [Kinesis Event](https://github.com/mweagle/Sparta/blob/master/aws/kinesis/events.go) types for unmarshaling 1758 - Fixed latent issue where `IAMRoleDefinition` CloudFormation names would collide if they had the same Permission set. 1759 - Remove _API Gateway_ view from `describe` if none is defined. 1760 1761 ## v0.0.6 1762 1763 - :warning: **BREAKING** 1764 - Changed: 1765 - `type LambdaFunction func(*json.RawMessage, *LambdaContext, *http.ResponseWriter, *logrus.Logger)` 1766 - **TO** 1767 - `type LambdaFunction func(*json.RawMessage, *LambdaContext, http.ResponseWriter, *logrus.Logger)` 1768 - See also [FAQ: When should I use a pointer to an interface?](https://golang.org/doc/faq#pointer_to_interface). 1769 - Add _.travis.yml_ for CI support. 1770 - :checkered_flag: **CHANGES** 1771 - Added [LambdaAWSInfo.Decorator](https://github.com/mweagle/Sparta/blob/master/sparta.go#L603) field (type [TemplateDecorator](https://github.com/mweagle/Sparta/blob/master/sparta.go#L192) ). If defined, the template decorator will be called during CloudFormation template creation and enables a Sparta lambda function to annotate the CloudFormation template with additional Resources or Output entries. 1772 - See [TestDecorateProvision](https://github.com/mweagle/Sparta/blob/master/provision_test.go#L44) for an example. 1773 - Improved API Gateway `describe` output. 1774 - Added [method response](http://docs.aws.amazon.com/apigateway/api-reference/resource/method-response/) support. 1775 - The [DefaultMethodResponses](https://godoc.org/github.com/mweagle/Sparta#DefaultMethodResponses) map is used if [Method.Responses](https://godoc.org/github.com/mweagle/Sparta#Method) is empty (`len(Responses) <= 0`) at provision time. 1776 - The default response map defines `201` for _POST_ methods, and `200` for all other methods. An API Gateway method may only support a single 2XX status code. 1777 - Added [integration response](http://docs.aws.amazon.com/apigateway/api-reference/resource/integration-response/) support for to support HTTP status codes defined in [status.go](https://golang.org/src/net/http/status.go). 1778 - The [DefaultIntegrationResponses](https://godoc.org/github.com/mweagle/Sparta#DefaultIntegrationResponses) map is used if [Integration.Responses](https://godoc.org/github.com/mweagle/Sparta#Integration) is empty (`len(Responses) <= 0`) at provision time. 1779 - The mapping uses regular expressions based on the standard _golang_ [HTTP StatusText](https://golang.org/src/net/http/status.go) values. 1780 - Added `SpartaHome` and `SpartaVersion` template [outputs](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/outputs-section-structure.html). 1781 1782 ## v0.0.5 1783 1784 - :warning: **BREAKING** 1785 - Changed `Sparta.Main()` signature to accept API pointer as fourth argument. Parameter is optional. 1786 - :checkered_flag: **CHANGES** 1787 - Preliminary support for API Gateway provisioning 1788 - See API type for more information. 1789 - `describe` output includes: 1790 - Dynamically generated CloudFormation Template 1791 - API Gateway json 1792 - Lambda implementation of `CustomResources` for push source configuration promoted from inline [ZipFile](http://docs.aws.amazon.com/lambda/latest/dg/API_FunctionCode.html) JS code to external JS files that are proxied via _index.js_ exports. 1793 - [Fixed latent bug](https://github.com/mweagle/Sparta/commit/684b48eb0c2356ba332eee6054f4d57fc48e1419) where remote push source registrations were deleted during stack updates. 1794 1795 ## v0.0.3 1796 1797 - :warning: **BREAKING** 1798 - Changed `LambdaEvent` type to `json.RawMessage` 1799 - Changed [AddPermissionInput](http://docs.aws.amazon.com/sdk-for-go/api/service/lambda.html#type-AddPermissionInput) type to _sparta_ types: 1800 - `LambdaPermission` 1801 - `S3Permission` 1802 - `SNSPermission` 1803 - :checkered_flag: **CHANGES** 1804 - `sparta.NewLambda(...)` supports either `string` or `sparta.IAMRoleDefinition` types for the IAM role execution value 1805 - `sparta.IAMRoleDefinition` types implicitly create an [IAM::Role](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iam-role.html) resource as part of the stack 1806 - `string` values refer to pre-existing IAM rolenames 1807 - `S3Permission` type 1808 - `S3Permission` types denotes an S3 [event source](http://docs.aws.amazon.com/lambda/latest/dg/intro-core-components.html#intro-core-components-event-sources) that should be automatically configured as part of the service definition. 1809 - S3's [LambdaConfiguration](http://docs.aws.amazon.com/sdk-for-go/api/service/s3.html#type-LambdaFunctionConfiguration) is managed by a [Lambda custom resource](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/template-custom-resources-lambda.html) dynamically generated as part of in the [CloudFormation template](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/template-custom-resources.html). 1810 - The subscription management resource is inline NodeJS code and leverages the [cfn-response](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/walkthrough-custom-resources-lambda-cross-stack-ref.html) module. 1811 - `SNSPermission` type 1812 - `SNSPermission` types denote an SNS topic that should should send events to the target Lambda function 1813 - An SNS Topic's [subscriber list](http://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/SNS.html#subscribe-property) is managed by a [Lambda custom resource](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/template-custom-resources-lambda.html) dynamically generated as part of in the [CloudFormation template](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/template-custom-resources.html). 1814 - The subscription management resource is inline NodeJS code and leverages the [cfn-response](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/walkthrough-custom-resources-lambda-cross-stack-ref.html) module. 1815 - `LambdaPermission` type 1816 - These denote Lambda Permissions whose event source subscriptions should **NOT** be managed by the service definition. 1817 - Improved `describe` output CSS and layout 1818 - Describe now includes push/pull Lambda event sources 1819 - Fixed latent bug where Lambda functions didn't have CloudFormation::Log privileges 1820 1821 ## v0.0.2 1822 1823 - Update describe command to use [mermaid](https://github.com/knsv/mermaid) for resource dependency tree 1824 - Previously used [vis.js](http://visjs.org/#) 1825 1826 ## v0.0.1 1827 1828 - Initial release