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)
func NewLoadBalancerV2Origin_Override ¶
func NewLoadBalancerV2Origin_Override(l LoadBalancerV2Origin, loadBalancer awselasticloadbalancingv2.ILoadBalancerV2, props *LoadBalancerV2OriginProps)
func NewOriginGroup_Override ¶
func NewOriginGroup_Override(o OriginGroup, props *OriginGroupProps)
func NewRestApiOrigin_Override ¶ added in v2.25.0
func NewRestApiOrigin_Override(r RestApiOrigin, restApi awsapigateway.RestApi, props *RestApiOriginProps)
func NewS3Origin_Override ¶
func NewS3Origin_Override(s S3Origin, bucket awss3.IBucket, props *S3OriginProps)
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. Bind(_scope constructs.Construct, options *awscloudfront.OriginBindOptions) *awscloudfront.OriginBindConfig RenderCustomOriginConfig() *awscloudfront.CfnDistribution_CustomOriginConfigProperty 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), }, }), }, })
func NewHttpOrigin ¶
func NewHttpOrigin(domainName *string, props *HttpOriginProps) HttpOrigin
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. 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. 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. CustomHeaders *map[string]*string `field:"optional" json:"customHeaders" yaml:"customHeaders"` // A unique identifier for the origin. // // This value must be unique within the distribution. OriginId *string `field:"optional" json:"originId" yaml:"originId"` // Origin Shield is enabled by setting originShieldRegion to a valid region, after this to disable Origin Shield again you must set this flag to false. OriginShieldEnabled *bool `field:"optional" json:"originShieldEnabled" yaml:"originShieldEnabled"` // 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 // 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'). OriginPath *string `field:"optional" json:"originPath" yaml:"originPath"` // The HTTP port that CloudFront uses to connect to the origin. HttpPort *float64 `field:"optional" json:"httpPort" yaml:"httpPort"` // The HTTPS port that CloudFront uses to connect to the origin. 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. KeepaliveTimeout awscdk.Duration `field:"optional" json:"keepaliveTimeout" yaml:"keepaliveTimeout"` // The SSL versions to use when interacting with the origin. OriginSslProtocols *[]awscloudfront.OriginSslPolicy `field:"optional" json:"originSslProtocols" yaml:"originSslProtocols"` // Specifies the protocol (HTTP or HTTPS) that CloudFront uses to connect to the origin. 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. 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 cdk "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" httpOriginProps := &httpOriginProps{ connectionAttempts: jsii.Number(123), connectionTimeout: cdk.duration.minutes(jsii.Number(30)), customHeaders: map[string]*string{ "customHeadersKey": jsii.String("customHeaders"), }, httpPort: jsii.Number(123), httpsPort: jsii.Number(123), keepaliveTimeout: cdk.*duration.minutes(jsii.Number(30)), originId: jsii.String("originId"), originPath: jsii.String("originPath"), originShieldEnabled: jsii.Boolean(false), originShieldRegion: jsii.String("originShieldRegion"), originSslProtocols: []originSslPolicy{ awscdk.Aws_cloudfront.*originSslPolicy_SSL_V3, }, protocolPolicy: awscdk.*Aws_cloudfront.originProtocolPolicy_HTTP_ONLY, readTimeout: cdk.*duration.minutes(jsii.Number(30)), }
type LoadBalancerV2Origin ¶
type LoadBalancerV2Origin interface { HttpOrigin // Binds the origin to the associated Distribution. // // Can be used to grant permissions, create dependent resources, etc. Bind(_scope constructs.Construct, options *awscloudfront.OriginBindOptions) *awscloudfront.OriginBindConfig RenderCustomOriginConfig() *awscloudfront.CfnDistribution_CustomOriginConfigProperty 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), }, })
func NewLoadBalancerV2Origin ¶
func NewLoadBalancerV2Origin(loadBalancer awselasticloadbalancingv2.ILoadBalancerV2, props *LoadBalancerV2OriginProps) LoadBalancerV2Origin
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. 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. 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. CustomHeaders *map[string]*string `field:"optional" json:"customHeaders" yaml:"customHeaders"` // A unique identifier for the origin. // // This value must be unique within the distribution. OriginId *string `field:"optional" json:"originId" yaml:"originId"` // Origin Shield is enabled by setting originShieldRegion to a valid region, after this to disable Origin Shield again you must set this flag to false. OriginShieldEnabled *bool `field:"optional" json:"originShieldEnabled" yaml:"originShieldEnabled"` // 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 // 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'). OriginPath *string `field:"optional" json:"originPath" yaml:"originPath"` // The HTTP port that CloudFront uses to connect to the origin. HttpPort *float64 `field:"optional" json:"httpPort" yaml:"httpPort"` // The HTTPS port that CloudFront uses to connect to the origin. 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. KeepaliveTimeout awscdk.Duration `field:"optional" json:"keepaliveTimeout" yaml:"keepaliveTimeout"` // The SSL versions to use when interacting with the origin. OriginSslProtocols *[]awscloudfront.OriginSslPolicy `field:"optional" json:"originSslProtocols" yaml:"originSslProtocols"` // Specifies the protocol (HTTP or HTTPS) that CloudFront uses to connect to the origin. 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. 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, })
type OriginGroup ¶
type OriginGroup interface { awscloudfront.IOrigin // The method called when a given Origin is added (for the first time) to a Distribution. Bind(scope constructs.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), }, }), }, })
func NewOriginGroup ¶
func NewOriginGroup(props *OriginGroupProps) OriginGroup
type OriginGroupProps ¶
type OriginGroupProps struct { // The fallback origin that should serve requests when the primary fails. FallbackOrigin awscloudfront.IOrigin `field:"required" json:"fallbackOrigin" yaml:"fallbackOrigin"` // The primary origin that should serve requests for this group. 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. FallbackStatusCodes *[]*float64 `field:"optional" json:"fallbackStatusCodes" yaml:"fallbackStatusCodes"` }
Construction properties for `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), }, }), }, })
type RestApiOrigin ¶ added in v2.25.0
type RestApiOrigin interface { awscloudfront.OriginBase // Binds the origin to the associated Distribution. // // Can be used to grant permissions, create dependent resources, etc. Bind(_scope constructs.Construct, options *awscloudfront.OriginBindOptions) *awscloudfront.OriginBindConfig RenderCustomOriginConfig() *awscloudfront.CfnDistribution_CustomOriginConfigProperty 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), }, })
func NewRestApiOrigin ¶ added in v2.25.0
func NewRestApiOrigin(restApi awsapigateway.RestApi, props *RestApiOriginProps) RestApiOrigin
type RestApiOriginProps ¶ added in v2.25.0
type RestApiOriginProps struct { // The number of times that CloudFront attempts to connect to the origin; // // valid values are 1, 2, or 3 attempts. 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. 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. CustomHeaders *map[string]*string `field:"optional" json:"customHeaders" yaml:"customHeaders"` // A unique identifier for the origin. // // This value must be unique within the distribution. OriginId *string `field:"optional" json:"originId" yaml:"originId"` // Origin Shield is enabled by setting originShieldRegion to a valid region, after this to disable Origin Shield again you must set this flag to false. OriginShieldEnabled *bool `field:"optional" json:"originShieldEnabled" yaml:"originShieldEnabled"` // 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 // 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. 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. 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 cdk "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" restApiOriginProps := &restApiOriginProps{ connectionAttempts: jsii.Number(123), connectionTimeout: cdk.duration.minutes(jsii.Number(30)), customHeaders: map[string]*string{ "customHeadersKey": jsii.String("customHeaders"), }, keepaliveTimeout: cdk.*duration.minutes(jsii.Number(30)), originId: jsii.String("originId"), originShieldEnabled: jsii.Boolean(false), originShieldRegion: jsii.String("originShieldRegion"), readTimeout: cdk.*duration.minutes(jsii.Number(30)), }
type S3Origin ¶
type S3Origin interface { awscloudfront.IOrigin // The method called when a given Origin is added (for the first time) to a Distribution. Bind(scope constructs.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, }, }, }, })
func NewS3Origin ¶
func NewS3Origin(bucket awss3.IBucket, props *S3OriginProps) S3Origin
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. 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. 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. CustomHeaders *map[string]*string `field:"optional" json:"customHeaders" yaml:"customHeaders"` // A unique identifier for the origin. // // This value must be unique within the distribution. OriginId *string `field:"optional" json:"originId" yaml:"originId"` // Origin Shield is enabled by setting originShieldRegion to a valid region, after this to disable Origin Shield again you must set this flag to false. OriginShieldEnabled *bool `field:"optional" json:"originShieldEnabled" yaml:"originShieldEnabled"` // 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 // 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'). 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. 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"), }, }), }, })
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