cloudfront

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Behavior

type Behavior struct {
	// PathPattern is the path pattern used when configuring the Behavior
	PathPattern string
	// RequestPolicy is the ID of the origin request policy to be associated with this Behavior
	RequestPolicy string
	// ViewerFnARN is the ARN of the function to be associated with the Behavior's viewer requests
	ViewerFnARN string
}

Behavior represents a CloudFront Cache Behavior

type CallerRefFn added in v0.0.8

type CallerRefFn func() string

CallerRefFn is the function that should be called when setting the request's caller reference. It should be a unique identifier to prevent the request from being replayed. https://docs.aws.amazon.com/cloudfront/latest/APIReference/API_CreateDistribution.html

type Distribution added in v0.0.7

type Distribution struct {
	ID               string
	ARN              string
	Address          string
	AlternateDomains []string
	CustomOrigins    []Origin
	DefaultOrigin    Origin
	Description      string
	IPv6Enabled      bool
	Logging          loggingConfig
	PriceClass       string
	Tags             map[string]string
	TLS              tlsConfig
	WebACLID         string
}

Distribution represents a CloudFront distribution

type DistributionBuilder added in v0.0.7

type DistributionBuilder struct {
	// contains filtered or unexported fields
}

DistributionBuilder allows the construction of a Distribution

func NewDistributionBuilder added in v0.0.7

func NewDistributionBuilder(defaultOriginDomain, description, priceClass, group string) DistributionBuilder

NewDistributionBuilder takes required arguments for a distribution and returns a DistributionBuilder

func (DistributionBuilder) Build added in v0.0.7

func (b DistributionBuilder) Build() (Distribution, error)

Build constructs a Distribution taking into account all configuration set by previous "With*" method calls

func (DistributionBuilder) WithAlternateDomains added in v0.0.7

func (b DistributionBuilder) WithAlternateDomains(domains []string) DistributionBuilder

WithAlternateDomains takes a slice of domains to be added to the Distribution's alternate domains

func (DistributionBuilder) WithIPv6 added in v0.0.7

WithIPv6 enables IPv6

func (DistributionBuilder) WithInfo added in v0.0.8

func (b DistributionBuilder) WithInfo(id string, arn string, address string) DistributionBuilder

WithInfo takes in identifying information from an existing CloudFront to populate the resulting Distribution

func (DistributionBuilder) WithLogging added in v0.0.7

func (b DistributionBuilder) WithLogging(bucketAddress, prefix string) DistributionBuilder

WithLogging takes in bucket address and file prefix to enable sending CF logs to S3

func (DistributionBuilder) WithOrigin added in v0.0.8

WithOrigin takes in an Origin that should be part of the Distribution

func (DistributionBuilder) WithTLS added in v0.0.7

func (b DistributionBuilder) WithTLS(certARN, securityPolicyID string) DistributionBuilder

WithTLS takes in an ACM certificate ARN and a Security Policy ID to enable TLS termination

func (DistributionBuilder) WithTags added in v0.0.7

WithTags takes in custom tags which should be present at the Distribution

func (DistributionBuilder) WithWebACL added in v0.0.7

WithWebACL takes the ID of the Web ACL that should be associated with the Distribution

type DistributionRepository added in v0.0.8

type DistributionRepository interface {
	// Create creates the given Distribution on CloudFront
	Create(Distribution) (Distribution, error)
	// Sync ensures the given Distribution is correctly configured on CloudFront
	Sync(Distribution) error
	// Delete deletes the Distribution at AWS
	Delete(distribution Distribution) error
}

DistributionRepository provides a repository for manipulating CloudFront distributions to match desired configuration

func NewDistributionRepository added in v0.0.8

func NewDistributionRepository(awsClient cloudfrontiface.CloudFrontAPI, callerRefFn CallerRefFn, waitTimeout time.Duration) DistributionRepository

NewDistributionRepository creates a new AWS CloudFront DistributionRepository

type Origin

type Origin struct {
	// Host is the origin's hostname
	Host string
	// Behaviors is the collection of Behaviors associated with this Origin
	Behaviors []Behavior
	// ResponseTimeout is how long CloudFront will wait for a response from the Origin in seconds
	ResponseTimeout int64
}

Origin represents a CloudFront Origin and aggregates Behaviors associated with it

func (Origin) HasEqualParameters added in v0.0.8

func (o Origin) HasEqualParameters(o2 Origin) bool

HasEqualParameters returns whether both Origins have the same parameters. It ignores differences in Behaviors

type OriginBuilder

type OriginBuilder struct {
	// contains filtered or unexported fields
}

OriginBuilder allows the construction of a Origin

func NewOriginBuilder

func NewOriginBuilder(host string) OriginBuilder

NewOriginBuilder returns an OriginBuilder for a given host

func (OriginBuilder) Build

func (b OriginBuilder) Build() Origin

Build creates an Origin based on configuration made so far

func (OriginBuilder) WithBehavior

func (b OriginBuilder) WithBehavior(pathPattern string) OriginBuilder

WithBehavior adds a Behavior to the Origin being built given a path pattern the Behavior should respond for

func (OriginBuilder) WithRequestPolicy added in v0.0.8

func (b OriginBuilder) WithRequestPolicy(policy string) OriginBuilder

WithRequestPolicy associates a given origin request policy ID with all Behaviors in the Origin being built

func (OriginBuilder) WithResponseTimeout added in v0.0.6

func (b OriginBuilder) WithResponseTimeout(rpTimeout int64) OriginBuilder

WithResponseTimeout associates a custom response timeout to custom origin

func (OriginBuilder) WithViewerFunction added in v0.0.5

func (b OriginBuilder) WithViewerFunction(fnARN string) OriginBuilder

WithViewerFunction associates a function with all viewer requests of all Behaviors in the Origin being built

Jump to

Keyboard shortcuts

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