cloudfront

package
v0.0.0-...-69fa356 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2016 License: LGPL-3.0 Imports: 14 Imported by: 4

Documentation

Index

Constants

View Source
const (
	ServiceName = "cloudfront"
	ApiVersion  = "2014-11-06"
)

Variables

View Source
var CookiesDefault = Cookies{
	Forward:          "none",
	WhitelistedNames: Names{},
}

Functions

This section is empty.

Types

type Aliases

type Aliases []string

func (Aliases) MarshalXML

func (a Aliases) MarshalXML(e *xml.Encoder, start xml.StartElement) error

func (*Aliases) UnmarshalXML

func (n *Aliases) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

type AllowedMethods

type AllowedMethods struct {
	Allowed []string `xml:"Items"`
	Cached  []string `xml:"CachedMethods>Items,omitempty"`
}

func (AllowedMethods) MarshalXML

func (n AllowedMethods) MarshalXML(e *xml.Encoder, start xml.StartElement) error

func (*AllowedMethods) UnmarshalXML

func (n *AllowedMethods) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

type CacheBehavior

type CacheBehavior struct {
	TargetOriginId       string
	PathPattern          string `xml:",omitempty"`
	ForwardedValues      ForwardedValues
	TrustedSigners       TrustedSigners
	ViewerProtocolPolicy string
	MinTTL               int
	AllowedMethods       AllowedMethods
	SmoothStreaming      bool
}

type CacheBehaviors

type CacheBehaviors []CacheBehavior

func (CacheBehaviors) MarshalXML

func (a CacheBehaviors) MarshalXML(e *xml.Encoder, start xml.StartElement) error

func (*CacheBehaviors) UnmarshalXML

func (n *CacheBehaviors) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

type CloudFront

type CloudFront struct {
	Signer  *aws.V4Signer
	Auth    aws.Auth
	BaseURL string
	// contains filtered or unexported fields
}

func New

func New(baseurl string, key *rsa.PrivateKey, keyPairId string) *CloudFront

func NewCloudFront

func NewCloudFront(auth aws.Auth) *CloudFront

TODO Reconcile with 'New' fn below

func NewKeyLess

func NewKeyLess(auth aws.Auth, baseurl string) *CloudFront

func (*CloudFront) Create

func (cf *CloudFront) Create(config DistributionConfig) (summary DistributionSummary, err error)

Create a CloudFront distribution

Usage:

	conf := cloudfront.DistributionConfig{
   Enabled: true,

		Origins: cloudfront.Origins{
			cloudfront.Origin{
				Id:         "test",
				DomainName: "example.com",
				CustomOriginConfig: &cloudfront.CustomOriginConfig{
					HTTPPort:             80,
					HTTPSPort:            443,
					OriginProtocolPolicy: "http-only",
				},
			},
		},

		DefaultCacheBehavior: cloudfront.CacheBehavior{
			TargetOriginId: "test",
			PathPattern:    "/test",
			ForwardedValues: cloudfront.ForwardedValues{
				QueryString: true,
				Cookies: cloudfront.Cookies{
					Forward: "whitelist",
					WhitelistedNames: cloudfront.Names{
						"cat",
						"dog",
					},
				},
				Headers: cloudfront.Names{
					"horse",
					"pig",
				},
			},
			ViewerProtocolPolicy: "allow-all",
			MinTTL:               300,
			AllowedMethods: cloudfront.AllowedMethods{
				Allowed: []string{"GET", "HEAD"},
				Cached:  []string{"GET", "HEAD"},
			},
		},

		Restrictions: cloudfront.GeoRestriction{
			RestrictionType: "blacklist",
			Locations: []string{
				"CA",
				"DE",
			},
		},

		CustomErrorResponses: cloudfront.CustomErrorResponses{
			cloudfront.CustomErrorResponse{
				ErrorCode:        404,
				ResponseCode:     403,
				ResponsePagePath: "/index.html",
			},
		},

		PriceClass: "PriceClass_All",
	}

	cf := cloudfront.NewCloudFront(aws.Auth{
		AccessKey: // ...
		SecretKey: // ...
	})
	cf.CreateDistribution(conf)

func (*CloudFront) FindDistributionByAlias

func (cf *CloudFront) FindDistributionByAlias(alias string) (dist *DistributionSummary, err error)

func (*CloudFront) List

func (cf *CloudFront) List(marker string, max int) (items *DistributionsResp, err error)

Marker is an optional pointer to the NextMarker from the previous page of results Max is the maximum number of results to return, max 100

func (*CloudFront) SignedURL

func (cloudfront *CloudFront) SignedURL(path, querystrings string, expires time.Time) string

type Cookies

type Cookies struct {
	Forward          string
	WhitelistedNames Names
}

type CustomErrorResponse

type CustomErrorResponse struct {
	XMLName            xml.Name `xml:"CustomErrorResponse"`
	ErrorCode          int
	ResponsePagePath   string
	ResponseCode       int
	ErrorCachingMinTTL int
}

type CustomErrorResponses

type CustomErrorResponses []CustomErrorResponse

func (CustomErrorResponses) MarshalXML

func (a CustomErrorResponses) MarshalXML(e *xml.Encoder, start xml.StartElement) error

func (*CustomErrorResponses) UnmarshalXML

func (n *CustomErrorResponses) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

type CustomOriginConfig

type CustomOriginConfig struct {
	HTTPPort             int
	HTTPSPort            int
	OriginProtocolPolicy string
}

type DistributionConfig

type DistributionConfig struct {
	XMLName              xml.Name `xml:"DistributionConfig"`
	CallerReference      string
	Aliases              Aliases
	DefaultRootObject    string
	Origins              Origins
	DefaultCacheBehavior CacheBehavior
	Comment              string
	CacheBehaviors       CacheBehaviors
	CustomErrorResponses CustomErrorResponses
	Restrictions         *GeoRestriction `xml:"Restrictions>GeoRestriction,omitempty"`
	Logging              Logging
	ViewerCertificate    *ViewerCertificate `xml:",omitempty"`
	PriceClass           string
	Enabled              bool
}

type DistributionItem

type DistributionItem struct {
	XMLName xml.Name `xml:"DistributionSummary"`
	DistributionSummary
}

type DistributionSummary

type DistributionSummary struct {
	XMLName xml.Name `xml:"Distribution"`
	DistributionConfig
	DomainName       string
	Status           string
	Id               string
	LastModifiedTime time.Time
}

type DistributionsResp

type DistributionsResp struct {
	Items       []DistributionItem `xml:"Items>DistributionSummary"`
	IsTruncated bool
	Marker      string

	// Use this to get the next page of results if IsTruncated is true
	NextMarker string

	// Total number in account
	Quantity int
	MaxItems int
}

type EncodedAliases

type EncodedAliases struct {
	Quantity int
	Items    []string `xml:"Items>CNAME"`
}

type EncodedAllowedMethods

type EncodedAllowedMethods struct {
	AllowedQuantity int      `xml:"Quantity"`
	Allowed         []string `xml:"Items>Method"`
	CachedQuantity  int      `xml:"CachedMethods>Quantity"`
	Cached          []string `xml:"CachedMethods>Items>Method"`
}

type EncodedCacheBehaviors

type EncodedCacheBehaviors struct {
	Quantity int
	Items    []CacheBehavior `xml:"Items>CacheBehavior"`
}

type EncodedCustomErrorResponses

type EncodedCustomErrorResponses struct {
	Quantity int
	Items    []CustomErrorResponse `xml:"Items>CustomErrorResponse"`
}

type EncodedGeoRestriction

type EncodedGeoRestriction struct {
	RestrictionType string
	Quantity        int
	Locations       []string `xml:"Items>Location"`
}

type EncodedNames

type EncodedNames struct {
	Quantity int
	Items    []string `xml:"Items>Name"`
}

type EncodedOrigins

type EncodedOrigins struct {
	Quantity int
	Items    []Origin `xml:"Items>Origin"`
}

type EncodedTrustedSigners

type EncodedTrustedSigners struct {
	Enabled  bool
	Quantity int
	Items    []string `xml:"Items>AWSAccountNumber"`
}

type ForwardedValues

type ForwardedValues struct {
	QueryString bool
	Cookies     *Cookies
	Headers     Names
}

type GeoRestriction

type GeoRestriction struct {
	RestrictionType string
	Locations       []string
}

func (GeoRestriction) MarshalXML

func (a GeoRestriction) MarshalXML(e *xml.Encoder, start xml.StartElement) error

func (*GeoRestriction) UnmarshalXML

func (n *GeoRestriction) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

type ItemsList

type ItemsList []string

type Logging

type Logging struct {
	Enabled        bool
	IncludeCookies bool
	Bucket         string
	Prefix         string
}

type Names

type Names []string

func (Names) MarshalXML

func (w Names) MarshalXML(e *xml.Encoder, start xml.StartElement) error

func (*Names) UnmarshalXML

func (n *Names) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

type Origin

type Origin struct {
	XMLName            xml.Name `xml:"Origin"`
	Id                 string
	DomainName         string
	OriginPath         string              `xml:"OriginPath,omitempty"`
	S3OriginConfig     *S3OriginConfig     `xml:",omitempty"`
	CustomOriginConfig *CustomOriginConfig `xml:",omitempty"`
}

type Origins

type Origins []Origin

func (Origins) MarshalXML

func (o Origins) MarshalXML(e *xml.Encoder, start xml.StartElement) error

func (*Origins) UnmarshalXML

func (o *Origins) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

type S3OriginConfig

type S3OriginConfig struct {
	OriginAccessIdentity string
}

type TrustedSigners

type TrustedSigners struct {
	Enabled           bool
	AWSAccountNumbers []string
}

func (TrustedSigners) MarshalXML

func (n TrustedSigners) MarshalXML(e *xml.Encoder, start xml.StartElement) error

func (*TrustedSigners) UnmarshalXML

func (n *TrustedSigners) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

type ViewerCertificate

type ViewerCertificate struct {
	IAMCertificateId             string `xml:",omitempty"`
	CloudFrontDefaultCertificate bool   `xml:",omitempty"`
	SSLSupportMethod             string
	MinimumProtocolVersion       string
}

Jump to

Keyboard shortcuts

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