Documentation
¶
Index ¶
- Constants
- Variables
- type Aliases
- type AllowedMethods
- type CacheBehavior
- type CacheBehaviors
- type CloudFront
- func (cf *CloudFront) CannedSignedURL(path, queryString string, expires time.Time) (string, error)
- func (cf *CloudFront) Create(config DistributionConfig) (summary DistributionSummary, err error)
- func (cf *CloudFront) FindDistributionByAlias(alias string) (dist *DistributionSummary, err error)
- func (cf *CloudFront) List(marker string, max int) (items *DistributionsResp, err error)
- func (cloudfront *CloudFront) SignedURL(path, querystrings string, expires time.Time) string
- type Cookies
- type CustomErrorResponse
- type CustomErrorResponses
- type CustomOriginConfig
- type DistributionConfig
- type DistributionItem
- type DistributionSummary
- type DistributionsResp
- type EncodedAliases
- type EncodedAllowedMethods
- type EncodedCacheBehaviors
- type EncodedCustomErrorResponses
- type EncodedGeoRestriction
- type EncodedNames
- type EncodedOrigins
- type EncodedTrustedSigners
- type ForwardedValues
- type GeoRestriction
- type ItemsList
- type Logging
- type Names
- type Origin
- type Origins
- type S3OriginConfig
- type TrustedSigners
- type ViewerCertificate
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 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) CannedSignedURL ¶
Creates a signed url using RSAwithSHA1 as specified by http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/private-content-creating-signed-url-canned-policy.html#private-content-canned-policy-creating-signature
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
type CustomErrorResponse ¶
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 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 DistributionsResp ¶
type EncodedAliases ¶
type EncodedAllowedMethods ¶
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 EncodedNames ¶
type EncodedOrigins ¶
type EncodedTrustedSigners ¶
type ForwardedValues ¶
type GeoRestriction ¶
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 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 S3OriginConfig ¶
type S3OriginConfig struct {
OriginAccessIdentity string
}
type TrustedSigners ¶
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
Click to show internal directories.
Click to hide internal directories.