Sparta: github.com/mweagle/Sparta/aws/cloudformation/resources Index | Files

package resources

import "github.com/mweagle/Sparta/aws/cloudformation/resources"

Package resources defines a set of CloudFormation Custom Resources that are implemented by Lambda functions. These resources are serialized to JSON and are instantiated by Sparta when an application requests a CustomAction handler. They must implement CustomResourceCommand to be properly invoked.

Index

Package Files

cloudWatchLogsLambdaEventSourceResource.go codeCommitLambdaEventSourceResource.go customResource.go doc.go helloworldresource.go s3ArtifactPublisherResource.go s3LambdaEventSourceResource.go sesLambdaEventSourceResource.go snsLambdaEventSourceResource.go zipToS3BucketResource.go

Constants

const (
    // CreateOperation is a request to create a resource
    // @enum CloudFormationOperation
    CreateOperation = "Create"
    // DeleteOperation is a request to delete a resource
    // @enum CloudFormationOperation
    DeleteOperation = "Delete"
    // UpdateOperation is a request to update a resource
    // @enum CloudFormationOperation
    UpdateOperation = "Update"
)
const (
    // CustomResourceTypePrefix is the known custom resource
    // type prefix
    CustomResourceTypePrefix = "Custom::goAWS"
)
const DefaultManifestName = "MANIFEST.json"

DefaultManifestName is the name of the file that will be created at the root of the S3 bucket with user-supplied metadata

Variables

var (
    // HelloWorld is the typename for HelloWorldResource
    HelloWorld = cloudFormationResourceType("HelloWorldResource")
    // S3LambdaEventSource is the typename for S3LambdaEventSourceResource
    S3LambdaEventSource = cloudFormationResourceType("S3EventSource")
    // SNSLambdaEventSource is the typename for SNSLambdaEventSourceResource
    SNSLambdaEventSource = cloudFormationResourceType("SNSEventSource")
    // CodeCommitLambdaEventSource is the type name for CodeCommitEventSourceResource
    CodeCommitLambdaEventSource = cloudFormationResourceType("CodeCommitEventSource")
    // SESLambdaEventSource is the typename for SESLambdaEventSourceResource
    SESLambdaEventSource = cloudFormationResourceType("SESEventSource")
    // CloudWatchLogsLambdaEventSource is the typename for SESLambdaEventSourceResource
    CloudWatchLogsLambdaEventSource = cloudFormationResourceType("CloudWatchLogsEventSource")
    // ZipToS3Bucket is the typename for ZipToS3Bucket
    ZipToS3Bucket = cloudFormationResourceType("ZipToS3Bucket")
    // S3ArtifactPublisher is the typename for publishing an S3Artifact
    S3ArtifactPublisher = cloudFormationResourceType("S3ArtifactPublisher")
)

func CloudFormationLambdaCustomResourceHandler Uses

func CloudFormationLambdaCustomResourceHandler(command CustomResourceCommand, logger *logrus.Logger) interface{}

CloudFormationLambdaCustomResourceHandler is an adapter function that transforms an implementing CustomResourceCommand into something that that can respond to the lambda custom resource lifecycle

func NewCustomResourceLambdaHandler Uses

func NewCustomResourceLambdaHandler(resourceType string, logger *logrus.Logger) interface{}

NewCustomResourceLambdaHandler returns a handler for the given type

func SendCloudFormationResponse Uses

func SendCloudFormationResponse(lambdaCtx *awsLambdaCtx.LambdaContext,
    event *CloudFormationLambdaEvent,
    results map[string]interface{},
    responseErr error,
    logger *logrus.Logger) error

SendCloudFormationResponse sends the given response to the CloudFormation URL that was submitted together with this event

type CloudFormationLambdaEvent Uses

type CloudFormationLambdaEvent struct {
    RequestType           string
    RequestID             string `json:"RequestId"`
    ResponseURL           string
    ResourceType          string
    StackID               string `json:"StackId"`
    LogicalResourceID     string `json:"LogicalResourceId"`
    ResourceProperties    json.RawMessage
    OldResourceProperties json.RawMessage
}

CloudFormationLambdaEvent is the event to a resource

type CloudWatchEventSourceResourceRequest Uses

type CloudWatchEventSourceResourceRequest struct {
    LambdaTargetArn *gocf.StringExpr
    Filters         []*CloudWatchLogsLambdaEventSourceFilter
    RoleARN         *gocf.StringExpr `json:",omitempty"`
}

CloudWatchEventSourceResourceRequest is what the UserProperties should be set to in the CustomResource invocation

type CloudWatchLogsLambdaEventSourceFilter Uses

type CloudWatchLogsLambdaEventSourceFilter struct {
    Name         *gocf.StringExpr
    Pattern      *gocf.StringExpr
    LogGroupName *gocf.StringExpr
}

CloudWatchLogsLambdaEventSourceFilter represents a filter for a cloudwatchlogs stream

type CloudWatchLogsLambdaEventSourceResource Uses

type CloudWatchLogsLambdaEventSourceResource struct {
    gocf.CloudFormationCustomResource
    CloudWatchEventSourceResourceRequest
}

CloudWatchLogsLambdaEventSourceResource is a simple POC showing how to create custom resources

func (CloudWatchLogsLambdaEventSourceResource) Create Uses

func (command CloudWatchLogsLambdaEventSourceResource) Create(awsSession *session.Session,
    event *CloudFormationLambdaEvent,
    logger *logrus.Logger) (map[string]interface{}, error)

Create implements the create operation

func (CloudWatchLogsLambdaEventSourceResource) Delete Uses

func (command CloudWatchLogsLambdaEventSourceResource) Delete(awsSession *session.Session,
    event *CloudFormationLambdaEvent,
    logger *logrus.Logger) (map[string]interface{}, error)

Delete implements the delete operation

func (*CloudWatchLogsLambdaEventSourceResource) IAMPrivileges Uses

func (command *CloudWatchLogsLambdaEventSourceResource) IAMPrivileges() []string

IAMPrivileges returns the IAM privs for this custom action

func (CloudWatchLogsLambdaEventSourceResource) Update Uses

func (command CloudWatchLogsLambdaEventSourceResource) Update(awsSession *session.Session,
    event *CloudFormationLambdaEvent,
    logger *logrus.Logger) (map[string]interface{}, error)

Update implements the update operation

type CodeCommitLambdaEventSourceResource Uses

type CodeCommitLambdaEventSourceResource struct {
    gocf.CloudFormationCustomResource
    CodeCommitLambdaEventSourceResourceRequest
}

CodeCommitLambdaEventSourceResource is a simple POC showing how to create custom resources

func (CodeCommitLambdaEventSourceResource) Create Uses

func (command CodeCommitLambdaEventSourceResource) Create(awsSession *session.Session,
    event *CloudFormationLambdaEvent,
    logger *logrus.Logger) (map[string]interface{}, error)

Create implements the custom resource create operation

func (CodeCommitLambdaEventSourceResource) Delete Uses

func (command CodeCommitLambdaEventSourceResource) Delete(awsSession *session.Session,
    event *CloudFormationLambdaEvent,
    logger *logrus.Logger) (map[string]interface{}, error)

Delete implements the custom resource delete operation

func (*CodeCommitLambdaEventSourceResource) IAMPrivileges Uses

func (command *CodeCommitLambdaEventSourceResource) IAMPrivileges() []string

IAMPrivileges returns the IAM privs for this custom action

func (CodeCommitLambdaEventSourceResource) Update Uses

func (command CodeCommitLambdaEventSourceResource) Update(awsSession *session.Session,
    event *CloudFormationLambdaEvent,
    logger *logrus.Logger) (map[string]interface{}, error)

Update implements the custom resource update operation

type CodeCommitLambdaEventSourceResourceRequest Uses

type CodeCommitLambdaEventSourceResourceRequest struct {
    LambdaTargetArn *gocf.StringExpr
    RepositoryName  *gocf.StringExpr
    TriggerName     *gocf.StringExpr
    Events          []string `json:",omitempty"`
    Branches        []string `json:",omitempty"`
}

CodeCommitLambdaEventSourceResourceRequest defines the request properties to configure SNS

type CustomResourceCommand Uses

type CustomResourceCommand interface {
    Create(session *session.Session,
        event *CloudFormationLambdaEvent,
        logger *logrus.Logger) (map[string]interface{}, error)

    Update(session *session.Session,
        event *CloudFormationLambdaEvent,
        logger *logrus.Logger) (map[string]interface{}, error)

    Delete(session *session.Session,
        event *CloudFormationLambdaEvent,
        logger *logrus.Logger) (map[string]interface{}, error)
}

CustomResourceCommand defines operations that a CustomResource must implement.

type CustomResourcePrivilegedCommand Uses

type CustomResourcePrivilegedCommand interface {
    // The IAMPrivileges this command requires of the IAM role
    IAMPrivileges() []string
}

CustomResourcePrivilegedCommand is a command that also has IAM privileges which implies there must be an ARN associated with the command

type HelloWorldResource Uses

type HelloWorldResource struct {
    gocf.CloudFormationCustomResource
    HelloWorldResourceRequest
}

HelloWorldResource is a simple POC showing how to create custom resources

func (HelloWorldResource) Create Uses

func (command HelloWorldResource) Create(awsSession *session.Session,
    event *CloudFormationLambdaEvent,
    logger *logrus.Logger) (map[string]interface{}, error)

Create implements resource create

func (HelloWorldResource) Delete Uses

func (command HelloWorldResource) Delete(awsSession *session.Session,
    event *CloudFormationLambdaEvent,
    logger *logrus.Logger) (map[string]interface{}, error)

Delete implements resource delete

func (*HelloWorldResource) IAMPrivileges Uses

func (command *HelloWorldResource) IAMPrivileges() []string

IAMPrivileges returns the IAM privs for this custom action

func (HelloWorldResource) Update Uses

func (command HelloWorldResource) Update(awsSession *session.Session,
    event *CloudFormationLambdaEvent,
    logger *logrus.Logger) (map[string]interface{}, error)

Update implements resource update

type HelloWorldResourceRequest Uses

type HelloWorldResourceRequest struct {
    Message *gocf.StringExpr
}

HelloWorldResourceRequest is what the UserProperties should be set to in the CustomResource invocation

type S3ArtifactPublisherResource Uses

type S3ArtifactPublisherResource struct {
    gocf.CloudFormationCustomResource
    S3ArtifactPublisherResourceRequest
}

S3ArtifactPublisherResource is a simple POC showing how to create custom resources

func (S3ArtifactPublisherResource) Create Uses

func (command S3ArtifactPublisherResource) Create(awsSession *session.Session,
    event *CloudFormationLambdaEvent,
    logger *logrus.Logger) (map[string]interface{}, error)

Create implements the S3 create operation

func (S3ArtifactPublisherResource) Delete Uses

func (command S3ArtifactPublisherResource) Delete(awsSession *session.Session,
    event *CloudFormationLambdaEvent,
    logger *logrus.Logger) (map[string]interface{}, error)

Delete implements the S3 delete operation

func (*S3ArtifactPublisherResource) IAMPrivileges Uses

func (command *S3ArtifactPublisherResource) IAMPrivileges() []string

IAMPrivileges returns the IAM privs for this custom action

func (S3ArtifactPublisherResource) Update Uses

func (command S3ArtifactPublisherResource) Update(awsSession *session.Session,
    event *CloudFormationLambdaEvent,
    logger *logrus.Logger) (map[string]interface{}, error)

Update implements the S3 update operation

type S3ArtifactPublisherResourceRequest Uses

type S3ArtifactPublisherResourceRequest struct {
    Bucket *gocf.StringExpr
    Key    *gocf.StringExpr
    Body   map[string]interface{}
}

S3ArtifactPublisherResourceRequest is what the UserProperties should be set to in the CustomResource invocation

type S3LambdaEventSourceResource Uses

type S3LambdaEventSourceResource struct {
    gocf.CloudFormationCustomResource
    S3LambdaEventSourceResourceRequest
}

S3LambdaEventSourceResource manages registering a Lambda function with S3 event

func (S3LambdaEventSourceResource) Create Uses

func (command S3LambdaEventSourceResource) Create(awsSession *session.Session,
    event *CloudFormationLambdaEvent,
    logger *logrus.Logger) (map[string]interface{}, error)

Create implements the custom resource create operation

func (S3LambdaEventSourceResource) Delete Uses

func (command S3LambdaEventSourceResource) Delete(awsSession *session.Session,
    event *CloudFormationLambdaEvent,
    logger *logrus.Logger) (map[string]interface{}, error)

Delete implements the custom resource delete operation

func (*S3LambdaEventSourceResource) IAMPrivileges Uses

func (command *S3LambdaEventSourceResource) IAMPrivileges() []string

IAMPrivileges returns the IAM privs for this custom action

func (S3LambdaEventSourceResource) Update Uses

func (command S3LambdaEventSourceResource) Update(awsSession *session.Session,
    event *CloudFormationLambdaEvent,
    logger *logrus.Logger) (map[string]interface{}, error)

Update implements the custom resource update operation

type S3LambdaEventSourceResourceRequest Uses

type S3LambdaEventSourceResourceRequest struct {
    BucketArn       *gocf.StringExpr
    Events          []string
    LambdaTargetArn *gocf.StringExpr
    Filter          *s3.NotificationConfigurationFilter `json:"Filter,omitempty"`
}

S3LambdaEventSourceResourceRequest is what the UserProperties should be set to in the CustomResource invocation

type SESLambdaEventSourceResource Uses

type SESLambdaEventSourceResource struct {
    gocf.CloudFormationCustomResource
    SESLambdaEventSourceResourceRequest
}

SESLambdaEventSourceResource handles configuring SES configuration

func (SESLambdaEventSourceResource) Create Uses

func (command SESLambdaEventSourceResource) Create(awsSession *session.Session,
    event *CloudFormationLambdaEvent,
    logger *logrus.Logger) (map[string]interface{}, error)

Create implements the custom resource create operation

func (SESLambdaEventSourceResource) Delete Uses

func (command SESLambdaEventSourceResource) Delete(awsSession *session.Session,
    event *CloudFormationLambdaEvent,
    logger *logrus.Logger) (map[string]interface{}, error)

Delete implements the custom resource delete operation

func (*SESLambdaEventSourceResource) IAMPrivileges Uses

func (command *SESLambdaEventSourceResource) IAMPrivileges() []string

IAMPrivileges returns the IAM privs for this custom action

func (SESLambdaEventSourceResource) Update Uses

func (command SESLambdaEventSourceResource) Update(awsSession *session.Session,
    event *CloudFormationLambdaEvent,
    logger *logrus.Logger) (map[string]interface{}, error)

Update implements the custom resource update operation

type SESLambdaEventSourceResourceAction Uses

type SESLambdaEventSourceResourceAction struct {
    ActionType       *gocf.StringExpr
    ActionProperties map[string]interface{}
}

SESLambdaEventSourceResourceAction represents an SES rule action TODO - specialized types for Actions

type SESLambdaEventSourceResourceRequest Uses

type SESLambdaEventSourceResourceRequest struct {
    RuleSetName *gocf.StringExpr
    Rules       []*SESLambdaEventSourceResourceRule
}

SESLambdaEventSourceResourceRequest defines the request properties to configure SES

type SESLambdaEventSourceResourceRule Uses

type SESLambdaEventSourceResourceRule struct {
    Name        *gocf.StringExpr
    Actions     []*SESLambdaEventSourceResourceAction
    ScanEnabled *gocf.BoolExpr `json:",omitempty"`
    Enabled     *gocf.BoolExpr `json:",omitempty"`
    Recipients  []*gocf.StringExpr
    TLSPolicy   *gocf.StringExpr `json:",omitempty"`
}

SESLambdaEventSourceResourceRule stores settings necessary to configure an SES inbound rule

type SNSLambdaEventSourceResource Uses

type SNSLambdaEventSourceResource struct {
    gocf.CloudFormationCustomResource
    SNSLambdaEventSourceResourceRequest
}

SNSLambdaEventSourceResource is a simple POC showing how to create custom resources

func (SNSLambdaEventSourceResource) Create Uses

func (command SNSLambdaEventSourceResource) Create(awsSession *session.Session,
    event *CloudFormationLambdaEvent,
    logger *logrus.Logger) (map[string]interface{}, error)

Create implements the custom resource create operation

func (SNSLambdaEventSourceResource) Delete Uses

func (command SNSLambdaEventSourceResource) Delete(awsSession *session.Session,
    event *CloudFormationLambdaEvent,
    logger *logrus.Logger) (map[string]interface{}, error)

Delete implements the custom resource delete operation

func (*SNSLambdaEventSourceResource) IAMPrivileges Uses

func (command *SNSLambdaEventSourceResource) IAMPrivileges() []string

IAMPrivileges returns the IAM privs for this custom action

func (SNSLambdaEventSourceResource) Update Uses

func (command SNSLambdaEventSourceResource) Update(awsSession *session.Session,
    event *CloudFormationLambdaEvent,
    logger *logrus.Logger) (map[string]interface{}, error)

Update implements the custom resource update operation

type SNSLambdaEventSourceResourceRequest Uses

type SNSLambdaEventSourceResourceRequest struct {
    LambdaTargetArn *gocf.StringExpr
    SNSTopicArn     *gocf.StringExpr
}

SNSLambdaEventSourceResourceRequest defines the request properties to configure SNS

type ZipToS3BucketResource Uses

type ZipToS3BucketResource struct {
    gocf.CloudFormationCustomResource
    ZipToS3BucketResourceRequest
}

ZipToS3BucketResource manages populating an S3 bucket with the contents of a ZIP file...

func (ZipToS3BucketResource) Create Uses

func (command ZipToS3BucketResource) Create(awsSession *session.Session,
    event *CloudFormationLambdaEvent,
    logger *logrus.Logger) (map[string]interface{}, error)

Create implements the custom resource create operation

func (ZipToS3BucketResource) Delete Uses

func (command ZipToS3BucketResource) Delete(awsSession *session.Session,
    event *CloudFormationLambdaEvent,
    logger *logrus.Logger) (map[string]interface{}, error)

Delete implements the custom resource delete operation

func (*ZipToS3BucketResource) IAMPrivileges Uses

func (command *ZipToS3BucketResource) IAMPrivileges() []string

IAMPrivileges returns the IAM privs for this custom action

func (ZipToS3BucketResource) Update Uses

func (command ZipToS3BucketResource) Update(awsSession *session.Session,
    event *CloudFormationLambdaEvent,
    logger *logrus.Logger) (map[string]interface{}, error)

Update implements the custom resource update operation

type ZipToS3BucketResourceRequest Uses

type ZipToS3BucketResourceRequest struct {
    SrcBucket    *gocf.StringExpr
    SrcKeyName   *gocf.StringExpr
    DestBucket   *gocf.StringExpr
    ManifestName string
    Manifest     map[string]interface{}
}

ZipToS3BucketResourceRequest is the data request made to a ZipToS3BucketResource lambda handler

Package resources imports 25 packages (graph) and is imported by 2 packages. Updated 2019-02-21. Refresh now. Tools for package owners.