cloudfront

package
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 15, 2020 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ErrCode

func ErrCode(msg string, err error) error

Types

type CloudFront

type CloudFront struct {
	Service         cloudfrontiface.CloudFrontAPI
	Domains         map[string]*common.Domain
	WebsiteEndpoint string
}

CloudFront is a wrapper around the aws cloudfront service with some default config info

func NewSession

func NewSession(account common.Account) CloudFront

NewSession creates a new cloudfront session

func (*CloudFront) CreateDistribution

func (c *CloudFront) CreateDistribution(ctx context.Context, distribution *cloudfront.DistributionConfig, tags *cloudfront.Tags) (*cloudfront.Distribution, error)

CreateDistribution creates a cloudfront distribution with tags

func (*CloudFront) DefaultWebsiteDistributionConfig

func (c *CloudFront) DefaultWebsiteDistributionConfig(name string) (*cloudfront.DistributionConfig, error)

DefaultWebsiteDistributionConfig generates the cloudfront distribution configuration for an s3 website https://docs.aws.amazon.com/sdk-for-go/api/service/cloudfront/#DistributionConfig

func (*CloudFront) DeleteDistribution added in v0.9.0

func (c *CloudFront) DeleteDistribution(ctx context.Context, id string) error

DeleteDistribution deletes a cloudfront distribution

func (*CloudFront) DisableDistribution added in v0.8.0

func (c *CloudFront) DisableDistribution(ctx context.Context, id string) (*cloudfront.Distribution, error)

DisableDistribution disables a cloudfront distribution

func (*CloudFront) GetDistributionByName added in v0.7.0

func (c *CloudFront) GetDistributionByName(ctx context.Context, name string) (*cloudfront.DistributionSummary, error)

GetDistributionByName gets a cloudfront distribution by the name (by searching until it finds the matching alias)

func (*CloudFront) InvalidateCache added in v0.9.0

func (c *CloudFront) InvalidateCache(ctx context.Context, id string, paths []string) (*cloudfront.CreateInvalidationOutput, error)

InvalidateCache submits a cache invalidation request to cloudfront

func (*CloudFront) ListDistributions added in v0.7.0

func (c *CloudFront) ListDistributions(ctx context.Context) ([]*cloudfront.DistributionSummary, error)

ListDistributions lists all cloudfront distributions.

func (*CloudFront) ListDistributionsWithFilter added in v0.9.0

func (c *CloudFront) ListDistributionsWithFilter(ctx context.Context, filter func(*cloudfront.DistributionSummary) bool) ([]*cloudfront.DistributionSummary, error)

ListDistributionsWithFilter lists all cloudfront distributions and passes each DistributionSummary into the filter func to decide if it should be added or discarded

func (*CloudFront) ListTags added in v0.12.0

func (c *CloudFront) ListTags(ctx context.Context, arn string) ([]*cloudfront.Tag, error)

ListTags lists the tags for an ARN

func (*CloudFront) TagDistribution added in v0.11.0

func (c *CloudFront) TagDistribution(ctx context.Context, arn string, tags *cloudfront.Tags) error

TagDistribution updates the tags for a cloudfront distribution

func (*CloudFront) WebsiteDomain

func (c *CloudFront) WebsiteDomain(name string) (*common.Domain, error)

WebsiteDomain validates the name of the website, ensuring we have a cert for the domain and returning the domain. It splits the website name in 2 pieces since we are using a wildcard. This would need to change if we supported certificates per website.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL