Documentation ¶
Index ¶
- func NewHttpOrigin_Override(h HttpOrigin, domainName *string, props *HttpOriginProps)
- func NewLoadBalancerV2Origin_Override(l LoadBalancerV2Origin, loadBalancer awselasticloadbalancingv2.ILoadBalancerV2, ...)
- func NewOriginGroup_Override(o OriginGroup, props *OriginGroupProps)
- func NewRestApiOrigin_Override(r RestApiOrigin, restApi awsapigateway.RestApi, props *RestApiOriginProps)
- func NewS3Origin_Override(s S3Origin, bucket awss3.IBucket, props *S3OriginProps)
- type HttpOrigin
- type HttpOriginProps
- type LoadBalancerV2Origin
- type LoadBalancerV2OriginProps
- type OriginGroup
- type OriginGroupProps
- type RestApiOrigin
- type RestApiOriginProps
- type S3Origin
- type S3OriginProps
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewHttpOrigin_Override ¶
func NewHttpOrigin_Override(h HttpOrigin, domainName *string, props *HttpOriginProps)
Experimental.
func NewLoadBalancerV2Origin_Override ¶
func NewLoadBalancerV2Origin_Override(l LoadBalancerV2Origin, loadBalancer awselasticloadbalancingv2.ILoadBalancerV2, props *LoadBalancerV2OriginProps)
Experimental.
func NewOriginGroup_Override ¶
func NewOriginGroup_Override(o OriginGroup, props *OriginGroupProps)
Experimental.
func NewRestApiOrigin_Override ¶
func NewRestApiOrigin_Override(r RestApiOrigin, restApi awsapigateway.RestApi, props *RestApiOriginProps)
Experimental.
func NewS3Origin_Override ¶
func NewS3Origin_Override(s S3Origin, bucket awss3.IBucket, props *S3OriginProps)
Experimental.
Types ¶
type HttpOrigin ¶
type HttpOrigin interface { awscloudfront.OriginBase // Binds the origin to the associated Distribution. // // Can be used to grant permissions, create dependent resources, etc. // Experimental. Bind(_scope awscdk.Construct, options *awscloudfront.OriginBindOptions) *awscloudfront.OriginBindConfig // Experimental. RenderCustomOriginConfig() *awscloudfront.CfnDistribution_CustomOriginConfigProperty // Experimental. RenderS3OriginConfig() *awscloudfront.CfnDistribution_S3OriginConfigProperty }
An Origin for an HTTP server or S3 bucket configured for website hosting.
Example:
myBucket := s3.NewBucket(this, jsii.String("myBucket")) cloudfront.NewDistribution(this, jsii.String("myDist"), &distributionProps{ defaultBehavior: &behaviorOptions{ origin: origins.NewOriginGroup(&originGroupProps{ primaryOrigin: origins.NewS3Origin(myBucket), fallbackOrigin: origins.NewHttpOrigin(jsii.String("www.example.com")), // optional, defaults to: 500, 502, 503 and 504 fallbackStatusCodes: []*f64{ jsii.Number(404), }, }), }, })
Experimental.
func NewHttpOrigin ¶
func NewHttpOrigin(domainName *string, props *HttpOriginProps) HttpOrigin
Experimental.
type HttpOriginProps ¶
type HttpOriginProps struct { // The number of times that CloudFront attempts to connect to the origin; // // valid values are 1, 2, or 3 attempts. // Experimental. ConnectionAttempts *float64 `field:"optional" json:"connectionAttempts" yaml:"connectionAttempts"` // The number of seconds that CloudFront waits when trying to establish a connection to the origin. // // Valid values are 1-10 seconds, inclusive. // Experimental. ConnectionTimeout awscdk.Duration `field:"optional" json:"connectionTimeout" yaml:"connectionTimeout"` // A list of HTTP header names and values that CloudFront adds to requests it sends to the origin. // Experimental. CustomHeaders *map[string]*string `field:"optional" json:"customHeaders" yaml:"customHeaders"` // When you enable Origin Shield in the AWS Region that has the lowest latency to your origin, you can get better network performance. // See: https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/origin-shield.html // // Experimental. OriginShieldRegion *string `field:"optional" json:"originShieldRegion" yaml:"originShieldRegion"` // An optional path that CloudFront appends to the origin domain name when CloudFront requests content from the origin. // // Must begin, but not end, with '/' (e.g., '/production/images'). // Experimental. OriginPath *string `field:"optional" json:"originPath" yaml:"originPath"` // The HTTP port that CloudFront uses to connect to the origin. // Experimental. HttpPort *float64 `field:"optional" json:"httpPort" yaml:"httpPort"` // The HTTPS port that CloudFront uses to connect to the origin. // Experimental. HttpsPort *float64 `field:"optional" json:"httpsPort" yaml:"httpsPort"` // Specifies how long, in seconds, CloudFront persists its connection to the origin. // // The valid range is from 1 to 180 seconds, inclusive. // // Note that values over 60 seconds are possible only after a limit increase request for the origin response timeout quota // has been approved in the target account; otherwise, values over 60 seconds will produce an error at deploy time. // Experimental. KeepaliveTimeout awscdk.Duration `field:"optional" json:"keepaliveTimeout" yaml:"keepaliveTimeout"` // The SSL versions to use when interacting with the origin. // Experimental. OriginSslProtocols *[]awscloudfront.OriginSslPolicy `field:"optional" json:"originSslProtocols" yaml:"originSslProtocols"` // Specifies the protocol (HTTP or HTTPS) that CloudFront uses to connect to the origin. // Experimental. ProtocolPolicy awscloudfront.OriginProtocolPolicy `field:"optional" json:"protocolPolicy" yaml:"protocolPolicy"` // Specifies how long, in seconds, CloudFront waits for a response from the origin, also known as the origin response timeout. // // The valid range is from 1 to 180 seconds, inclusive. // // Note that values over 60 seconds are possible only after a limit increase request for the origin response timeout quota // has been approved in the target account; otherwise, values over 60 seconds will produce an error at deploy time. // Experimental. ReadTimeout awscdk.Duration `field:"optional" json:"readTimeout" yaml:"readTimeout"` }
Properties for an Origin backed by an S3 website-configured bucket, load balancer, or custom HTTP server.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import monocdk "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" var duration duration httpOriginProps := &httpOriginProps{ connectionAttempts: jsii.Number(123), connectionTimeout: duration, customHeaders: map[string]*string{ "customHeadersKey": jsii.String("customHeaders"), }, httpPort: jsii.Number(123), httpsPort: jsii.Number(123), keepaliveTimeout: duration, originPath: jsii.String("originPath"), originShieldRegion: jsii.String("originShieldRegion"), originSslProtocols: []originSslPolicy{ awscdk.Aws_cloudfront.*originSslPolicy_SSL_V3, }, protocolPolicy: awscdk.*Aws_cloudfront.originProtocolPolicy_HTTP_ONLY, readTimeout: duration, }
Experimental.
type LoadBalancerV2Origin ¶
type LoadBalancerV2Origin interface { HttpOrigin // Binds the origin to the associated Distribution. // // Can be used to grant permissions, create dependent resources, etc. // Experimental. Bind(_scope awscdk.Construct, options *awscloudfront.OriginBindOptions) *awscloudfront.OriginBindConfig // Experimental. RenderCustomOriginConfig() *awscloudfront.CfnDistribution_CustomOriginConfigProperty // Experimental. RenderS3OriginConfig() *awscloudfront.CfnDistribution_S3OriginConfigProperty }
An Origin for a v2 load balancer.
Example:
import ec2 "github.com/aws/aws-cdk-go/awscdk" import elbv2 "github.com/aws/aws-cdk-go/awscdk" var vpc vpc // Create an application load balancer in a VPC. 'internetFacing' must be 'true' // for CloudFront to access the load balancer and use it as an origin. lb := elbv2.NewApplicationLoadBalancer(this, jsii.String("LB"), &applicationLoadBalancerProps{ vpc: vpc, internetFacing: jsii.Boolean(true), }) cloudfront.NewDistribution(this, jsii.String("myDist"), &distributionProps{ defaultBehavior: &behaviorOptions{ origin: origins.NewLoadBalancerV2Origin(lb), }, })
Experimental.
func NewLoadBalancerV2Origin ¶
func NewLoadBalancerV2Origin(loadBalancer awselasticloadbalancingv2.ILoadBalancerV2, props *LoadBalancerV2OriginProps) LoadBalancerV2Origin
Experimental.
type LoadBalancerV2OriginProps ¶
type LoadBalancerV2OriginProps struct { // The number of times that CloudFront attempts to connect to the origin; // // valid values are 1, 2, or 3 attempts. // Experimental. ConnectionAttempts *float64 `field:"optional" json:"connectionAttempts" yaml:"connectionAttempts"` // The number of seconds that CloudFront waits when trying to establish a connection to the origin. // // Valid values are 1-10 seconds, inclusive. // Experimental. ConnectionTimeout awscdk.Duration `field:"optional" json:"connectionTimeout" yaml:"connectionTimeout"` // A list of HTTP header names and values that CloudFront adds to requests it sends to the origin. // Experimental. CustomHeaders *map[string]*string `field:"optional" json:"customHeaders" yaml:"customHeaders"` // When you enable Origin Shield in the AWS Region that has the lowest latency to your origin, you can get better network performance. // See: https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/origin-shield.html // // Experimental. OriginShieldRegion *string `field:"optional" json:"originShieldRegion" yaml:"originShieldRegion"` // An optional path that CloudFront appends to the origin domain name when CloudFront requests content from the origin. // // Must begin, but not end, with '/' (e.g., '/production/images'). // Experimental. OriginPath *string `field:"optional" json:"originPath" yaml:"originPath"` // The HTTP port that CloudFront uses to connect to the origin. // Experimental. HttpPort *float64 `field:"optional" json:"httpPort" yaml:"httpPort"` // The HTTPS port that CloudFront uses to connect to the origin. // Experimental. HttpsPort *float64 `field:"optional" json:"httpsPort" yaml:"httpsPort"` // Specifies how long, in seconds, CloudFront persists its connection to the origin. // // The valid range is from 1 to 180 seconds, inclusive. // // Note that values over 60 seconds are possible only after a limit increase request for the origin response timeout quota // has been approved in the target account; otherwise, values over 60 seconds will produce an error at deploy time. // Experimental. KeepaliveTimeout awscdk.Duration `field:"optional" json:"keepaliveTimeout" yaml:"keepaliveTimeout"` // The SSL versions to use when interacting with the origin. // Experimental. OriginSslProtocols *[]awscloudfront.OriginSslPolicy `field:"optional" json:"originSslProtocols" yaml:"originSslProtocols"` // Specifies the protocol (HTTP or HTTPS) that CloudFront uses to connect to the origin. // Experimental. ProtocolPolicy awscloudfront.OriginProtocolPolicy `field:"optional" json:"protocolPolicy" yaml:"protocolPolicy"` // Specifies how long, in seconds, CloudFront waits for a response from the origin, also known as the origin response timeout. // // The valid range is from 1 to 180 seconds, inclusive. // // Note that values over 60 seconds are possible only after a limit increase request for the origin response timeout quota // has been approved in the target account; otherwise, values over 60 seconds will produce an error at deploy time. // Experimental. ReadTimeout awscdk.Duration `field:"optional" json:"readTimeout" yaml:"readTimeout"` }
Properties for an Origin backed by a v2 load balancer.
Example:
import elbv2 "github.com/aws/aws-cdk-go/awscdk" var loadBalancer applicationLoadBalancer origin := origins.NewLoadBalancerV2Origin(loadBalancer, &loadBalancerV2OriginProps{ connectionAttempts: jsii.Number(3), connectionTimeout: awscdk.Duration.seconds(jsii.Number(5)), readTimeout: awscdk.Duration.seconds(jsii.Number(45)), keepaliveTimeout: awscdk.Duration.seconds(jsii.Number(45)), protocolPolicy: cloudfront.originProtocolPolicy_MATCH_VIEWER, })
Experimental.
type OriginGroup ¶
type OriginGroup interface { awscloudfront.IOrigin // The method called when a given Origin is added (for the first time) to a Distribution. // Experimental. Bind(scope awscdk.Construct, options *awscloudfront.OriginBindOptions) *awscloudfront.OriginBindConfig }
An Origin that represents a group.
Consists of a primary Origin, and a fallback Origin called when the primary returns one of the provided HTTP status codes.
Example:
myBucket := s3.NewBucket(this, jsii.String("myBucket")) cloudfront.NewDistribution(this, jsii.String("myDist"), &distributionProps{ defaultBehavior: &behaviorOptions{ origin: origins.NewOriginGroup(&originGroupProps{ primaryOrigin: origins.NewS3Origin(myBucket), fallbackOrigin: origins.NewHttpOrigin(jsii.String("www.example.com")), // optional, defaults to: 500, 502, 503 and 504 fallbackStatusCodes: []*f64{ jsii.Number(404), }, }), }, })
Experimental.
type OriginGroupProps ¶
type OriginGroupProps struct { // The fallback origin that should serve requests when the primary fails. // Experimental. FallbackOrigin awscloudfront.IOrigin `field:"required" json:"fallbackOrigin" yaml:"fallbackOrigin"` // The primary origin that should serve requests for this group. // Experimental. PrimaryOrigin awscloudfront.IOrigin `field:"required" json:"primaryOrigin" yaml:"primaryOrigin"` // The list of HTTP status codes that, when returned from the primary origin, would cause querying the fallback origin. // Experimental. FallbackStatusCodes *[]*float64 `field:"optional" json:"fallbackStatusCodes" yaml:"fallbackStatusCodes"` }
Construction properties for {@link OriginGroup}.
Example:
myBucket := s3.NewBucket(this, jsii.String("myBucket")) cloudfront.NewDistribution(this, jsii.String("myDist"), &distributionProps{ defaultBehavior: &behaviorOptions{ origin: origins.NewOriginGroup(&originGroupProps{ primaryOrigin: origins.NewS3Origin(myBucket), fallbackOrigin: origins.NewHttpOrigin(jsii.String("www.example.com")), // optional, defaults to: 500, 502, 503 and 504 fallbackStatusCodes: []*f64{ jsii.Number(404), }, }), }, })
Experimental.
type RestApiOrigin ¶
type RestApiOrigin interface { awscloudfront.OriginBase // Binds the origin to the associated Distribution. // // Can be used to grant permissions, create dependent resources, etc. // Experimental. Bind(_scope awscdk.Construct, options *awscloudfront.OriginBindOptions) *awscloudfront.OriginBindConfig // Experimental. RenderCustomOriginConfig() *awscloudfront.CfnDistribution_CustomOriginConfigProperty // Experimental. RenderS3OriginConfig() *awscloudfront.CfnDistribution_S3OriginConfigProperty }
An Origin for an API Gateway REST API.
Example:
var api restApi cloudfront.NewDistribution(this, jsii.String("Distribution"), &distributionProps{ defaultBehavior: &behaviorOptions{ origin: origins.NewRestApiOrigin(api), }, })
Experimental.
func NewRestApiOrigin ¶
func NewRestApiOrigin(restApi awsapigateway.RestApi, props *RestApiOriginProps) RestApiOrigin
Experimental.
type RestApiOriginProps ¶
type RestApiOriginProps struct { // The number of times that CloudFront attempts to connect to the origin; // // valid values are 1, 2, or 3 attempts. // Experimental. ConnectionAttempts *float64 `field:"optional" json:"connectionAttempts" yaml:"connectionAttempts"` // The number of seconds that CloudFront waits when trying to establish a connection to the origin. // // Valid values are 1-10 seconds, inclusive. // Experimental. ConnectionTimeout awscdk.Duration `field:"optional" json:"connectionTimeout" yaml:"connectionTimeout"` // A list of HTTP header names and values that CloudFront adds to requests it sends to the origin. // Experimental. CustomHeaders *map[string]*string `field:"optional" json:"customHeaders" yaml:"customHeaders"` // When you enable Origin Shield in the AWS Region that has the lowest latency to your origin, you can get better network performance. // See: https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/origin-shield.html // // Experimental. OriginShieldRegion *string `field:"optional" json:"originShieldRegion" yaml:"originShieldRegion"` // Specifies how long, in seconds, CloudFront persists its connection to the origin. // // The valid range is from 1 to 180 seconds, inclusive. // // Note that values over 60 seconds are possible only after a limit increase request for the origin response timeout quota // has been approved in the target account; otherwise, values over 60 seconds will produce an error at deploy time. // Experimental. KeepaliveTimeout awscdk.Duration `field:"optional" json:"keepaliveTimeout" yaml:"keepaliveTimeout"` // Specifies how long, in seconds, CloudFront waits for a response from the origin, also known as the origin response timeout. // // The valid range is from 1 to 180 seconds, inclusive. // // Note that values over 60 seconds are possible only after a limit increase request for the origin response timeout quota // has been approved in the target account; otherwise, values over 60 seconds will produce an error at deploy time. // Experimental. ReadTimeout awscdk.Duration `field:"optional" json:"readTimeout" yaml:"readTimeout"` }
Properties for an Origin for an API Gateway REST API.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import monocdk "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" var duration duration restApiOriginProps := &restApiOriginProps{ connectionAttempts: jsii.Number(123), connectionTimeout: duration, customHeaders: map[string]*string{ "customHeadersKey": jsii.String("customHeaders"), }, keepaliveTimeout: duration, originShieldRegion: jsii.String("originShieldRegion"), readTimeout: duration, }
Experimental.
type S3Origin ¶
type S3Origin interface { awscloudfront.IOrigin // The method called when a given Origin is added (for the first time) to a Distribution. // Experimental. Bind(scope awscdk.Construct, options *awscloudfront.OriginBindOptions) *awscloudfront.OriginBindConfig }
An Origin that is backed by an S3 bucket.
If the bucket is configured for website hosting, this origin will be configured to use the bucket as an HTTP server origin and will use the bucket's configured website redirects and error handling. Otherwise, the origin is created as a bucket origin and will use CloudFront's redirect and error handling.
Example:
// Adding an existing Lambda@Edge function created in a different stack // to a CloudFront distribution. var s3Bucket bucket functionVersion := lambda.version.fromVersionArn(this, jsii.String("Version"), jsii.String("arn:aws:lambda:us-east-1:123456789012:function:functionName:1")) cloudfront.NewDistribution(this, jsii.String("distro"), &distributionProps{ defaultBehavior: &behaviorOptions{ origin: origins.NewS3Origin(s3Bucket), edgeLambdas: []edgeLambda{ &edgeLambda{ functionVersion: functionVersion, eventType: cloudfront.lambdaEdgeEventType_VIEWER_REQUEST, }, }, }, })
Experimental.
func NewS3Origin ¶
func NewS3Origin(bucket awss3.IBucket, props *S3OriginProps) S3Origin
Experimental.
type S3OriginProps ¶
type S3OriginProps struct { // The number of times that CloudFront attempts to connect to the origin; // // valid values are 1, 2, or 3 attempts. // Experimental. ConnectionAttempts *float64 `field:"optional" json:"connectionAttempts" yaml:"connectionAttempts"` // The number of seconds that CloudFront waits when trying to establish a connection to the origin. // // Valid values are 1-10 seconds, inclusive. // Experimental. ConnectionTimeout awscdk.Duration `field:"optional" json:"connectionTimeout" yaml:"connectionTimeout"` // A list of HTTP header names and values that CloudFront adds to requests it sends to the origin. // Experimental. CustomHeaders *map[string]*string `field:"optional" json:"customHeaders" yaml:"customHeaders"` // When you enable Origin Shield in the AWS Region that has the lowest latency to your origin, you can get better network performance. // See: https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/origin-shield.html // // Experimental. OriginShieldRegion *string `field:"optional" json:"originShieldRegion" yaml:"originShieldRegion"` // An optional path that CloudFront appends to the origin domain name when CloudFront requests content from the origin. // // Must begin, but not end, with '/' (e.g., '/production/images'). // Experimental. OriginPath *string `field:"optional" json:"originPath" yaml:"originPath"` // An optional Origin Access Identity of the origin identity cloudfront will use when calling your s3 bucket. // Experimental. OriginAccessIdentity awscloudfront.IOriginAccessIdentity `field:"optional" json:"originAccessIdentity" yaml:"originAccessIdentity"` }
Properties to use to customize an S3 Origin.
Example:
myBucket := s3.NewBucket(this, jsii.String("myBucket")) cloudfront.NewDistribution(this, jsii.String("myDist"), &distributionProps{ defaultBehavior: &behaviorOptions{ origin: origins.NewS3Origin(myBucket, &s3OriginProps{ customHeaders: map[string]*string{ "Foo": jsii.String("bar"), }, }), }, })
Experimental.
Source Files ¶
- awscloudfrontorigins.go
- awscloudfrontorigins_HttpOrigin.go
- awscloudfrontorigins_HttpOriginProps.go
- awscloudfrontorigins_HttpOrigin__runtime_type_checks.go
- awscloudfrontorigins_LoadBalancerV2Origin.go
- awscloudfrontorigins_LoadBalancerV2OriginProps.go
- awscloudfrontorigins_LoadBalancerV2Origin__runtime_type_checks.go
- awscloudfrontorigins_OriginGroup.go
- awscloudfrontorigins_OriginGroupProps.go
- awscloudfrontorigins_OriginGroup__runtime_type_checks.go
- awscloudfrontorigins_RestApiOrigin.go
- awscloudfrontorigins_RestApiOriginProps.go
- awscloudfrontorigins_RestApiOrigin__runtime_type_checks.go
- awscloudfrontorigins_S3Origin.go
- awscloudfrontorigins_S3OriginProps.go
- awscloudfrontorigins_S3Origin__runtime_type_checks.go