Class: AWSCDK::CloudFront::CfnDistribution::OriginProperty

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
cloud_front/cfn_distribution.rb

Overview

An origin.

An origin is the location where content is stored, and from which CloudFront gets content to serve to viewers. To specify an origin:

  • Use S3OriginConfig to specify an Amazon S3 bucket that is not configured with static website hosting.
  • Use VpcOriginConfig to specify a VPC origin.
  • Use CustomOriginConfig to specify all other kinds of origins, including:
  • An Amazon S3 bucket that is configured with static website hosting
  • An Elastic Load Balancing load balancer
  • An AWS Elemental MediaPackage endpoint
  • An AWS Elemental MediaStore container
  • Any other HTTP server, running on an Amazon EC2 instance or any other kind of host

For the current maximum number of origins that you can specify per distribution, see General Quotas on Web Distributions in the Amazon CloudFront Developer Guide (quotas were formerly referred to as limits).

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(domain_name:, id:, connection_attempts: nil, connection_timeout: nil, custom_origin_config: nil, origin_access_control_id: nil, origin_custom_headers: nil, origin_path: nil, origin_shield: nil, response_completion_timeout: nil, s3_origin_config: nil, vpc_origin_config: nil) ⇒ OriginProperty

Returns a new instance of OriginProperty.

Parameters:



2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
# File 'cloud_front/cfn_distribution.rb', line 2822

def initialize(domain_name:, id:, connection_attempts: nil, connection_timeout: nil, custom_origin_config: nil, origin_access_control_id: nil, origin_custom_headers: nil, origin_path: nil, origin_shield: nil, response_completion_timeout: nil, s3_origin_config: nil, vpc_origin_config: nil)
  @domain_name = domain_name
  Jsii::Type.check_type(@domain_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "domainName")
  @id = id
  Jsii::Type.check_type(@id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "id")
  @connection_attempts = connection_attempts
  Jsii::Type.check_type(@connection_attempts, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "connectionAttempts") unless @connection_attempts.nil?
  @connection_timeout = connection_timeout
  Jsii::Type.check_type(@connection_timeout, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "connectionTimeout") unless @connection_timeout.nil?
  @custom_origin_config = custom_origin_config.is_a?(Hash) ? ::AWSCDK::CloudFront::CfnDistribution::CustomOriginConfigProperty.new(**custom_origin_config.transform_keys(&:to_sym)) : custom_origin_config
  Jsii::Type.check_type(@custom_origin_config, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c19jbG91ZGZyb250LkNmbkRpc3RyaWJ1dGlvbi5DdXN0b21PcmlnaW5Db25maWdQcm9wZXJ0eSJ9XX19")), "customOriginConfig") unless @custom_origin_config.nil?
  @origin_access_control_id = origin_access_control_id
  Jsii::Type.check_type(@origin_access_control_id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "originAccessControlId") unless @origin_access_control_id.nil?
  @origin_custom_headers = origin_custom_headers
  Jsii::Type.check_type(@origin_custom_headers, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImNvbGxlY3Rpb24iOnsiZWxlbWVudHR5cGUiOnsidW5pb24iOnsidHlwZXMiOlt7ImZxbiI6ImF3cy1jZGstbGliLklSZXNvbHZhYmxlIn0seyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY2xvdWRmcm9udC5DZm5EaXN0cmlidXRpb24uT3JpZ2luQ3VzdG9tSGVhZGVyUHJvcGVydHkifV19fSwia2luZCI6ImFycmF5In19XX19")), "originCustomHeaders") unless @origin_custom_headers.nil?
  @origin_path = origin_path
  Jsii::Type.check_type(@origin_path, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "originPath") unless @origin_path.nil?
  @origin_shield = origin_shield.is_a?(Hash) ? ::AWSCDK::CloudFront::CfnDistribution::OriginShieldProperty.new(**origin_shield.transform_keys(&:to_sym)) : origin_shield
  Jsii::Type.check_type(@origin_shield, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c19jbG91ZGZyb250LkNmbkRpc3RyaWJ1dGlvbi5PcmlnaW5TaGllbGRQcm9wZXJ0eSJ9XX19")), "originShield") unless @origin_shield.nil?
  @response_completion_timeout = response_completion_timeout
  Jsii::Type.check_type(@response_completion_timeout, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "responseCompletionTimeout") unless @response_completion_timeout.nil?
  @s3_origin_config = s3_origin_config.is_a?(Hash) ? ::AWSCDK::CloudFront::CfnDistribution::S3OriginConfigProperty.new(**s3_origin_config.transform_keys(&:to_sym)) : s3_origin_config
  Jsii::Type.check_type(@s3_origin_config, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c19jbG91ZGZyb250LkNmbkRpc3RyaWJ1dGlvbi5TM09yaWdpbkNvbmZpZ1Byb3BlcnR5In1dfX0=")), "s3OriginConfig") unless @s3_origin_config.nil?
  @vpc_origin_config = vpc_origin_config.is_a?(Hash) ? ::AWSCDK::CloudFront::CfnDistribution::VPCOriginConfigProperty.new(**vpc_origin_config.transform_keys(&:to_sym)) : vpc_origin_config
  Jsii::Type.check_type(@vpc_origin_config, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c19jbG91ZGZyb250LkNmbkRpc3RyaWJ1dGlvbi5WcGNPcmlnaW5Db25maWdQcm9wZXJ0eSJ9XX19")), "vpcOriginConfig") unless @vpc_origin_config.nil?
end

Instance Attribute Details

#connection_attemptsNumeric? (readonly)

The number of times that CloudFront attempts to connect to the origin.

The minimum number is 1, the maximum is 3, and the default (if you don't specify otherwise) is 3.

For a custom origin (including an Amazon S3 bucket that's configured with static website hosting), this value also specifies the number of times that CloudFront attempts to get a response from the origin, in the case of an Origin Response Timeout .

For more information, see Origin Connection Attempts in the Amazon CloudFront Developer Guide .



2873
2874
2875
# File 'cloud_front/cfn_distribution.rb', line 2873

def connection_attempts
  @connection_attempts
end

#connection_timeoutNumeric? (readonly)

The number of seconds that CloudFront waits when trying to establish a connection to the origin.

The minimum timeout is 1 second, the maximum is 10 seconds, and the default (if you don't specify otherwise) is 10 seconds.

For more information, see Origin Connection Timeout in the Amazon CloudFront Developer Guide .



2882
2883
2884
# File 'cloud_front/cfn_distribution.rb', line 2882

def connection_timeout
  @connection_timeout
end

#custom_origin_configAWSCDK::IResolvable, ... (readonly)

Use this type to specify an origin that is not an Amazon S3 bucket, with one exception.

If the Amazon S3 bucket is configured with static website hosting, use this type. If the Amazon S3 bucket is not configured with static website hosting, use the S3OriginConfig type instead.



2889
2890
2891
# File 'cloud_front/cfn_distribution.rb', line 2889

def custom_origin_config
  @custom_origin_config
end

#domain_nameString (readonly)

The domain name for the origin.

For more information, see Origin Domain Name in the Amazon CloudFront Developer Guide .



2855
2856
2857
# File 'cloud_front/cfn_distribution.rb', line 2855

def domain_name
  @domain_name
end

#idString (readonly)

A unique identifier for the origin. This value must be unique within the distribution.

Use this value to specify the TargetOriginId in a CacheBehavior or DefaultCacheBehavior .



2862
2863
2864
# File 'cloud_front/cfn_distribution.rb', line 2862

def id
  @id
end

#origin_access_control_idString? (readonly)

The unique identifier of an origin access control for this origin.

For more information, see Restricting access to an Amazon S3 origin in the Amazon CloudFront Developer Guide .



2896
2897
2898
# File 'cloud_front/cfn_distribution.rb', line 2896

def origin_access_control_id
  @origin_access_control_id
end

#origin_custom_headersAWSCDK::IResolvable, ... (readonly)

A list of HTTP header names and values that CloudFront adds to the requests that it sends to the origin.

For more information, see Adding Custom Headers to Origin Requests in the Amazon CloudFront Developer Guide .



2903
2904
2905
# File 'cloud_front/cfn_distribution.rb', line 2903

def origin_custom_headers
  @origin_custom_headers
end

#origin_pathString? (readonly)

Note:

Default: - ""

An optional path that CloudFront appends to the origin domain name when CloudFront requests content from the origin.

For more information, see Origin Path in the Amazon CloudFront Developer Guide .



2911
2912
2913
# File 'cloud_front/cfn_distribution.rb', line 2911

def origin_path
  @origin_path
end

#origin_shieldAWSCDK::IResolvable, ... (readonly)

CloudFront Origin Shield. Using Origin Shield can help reduce the load on your origin.

For more information, see Using Origin Shield in the Amazon CloudFront Developer Guide .



2918
2919
2920
# File 'cloud_front/cfn_distribution.rb', line 2918

def origin_shield
  @origin_shield
end

#response_completion_timeoutNumeric? (readonly)

The time (in seconds) that a request from CloudFront to the origin can stay open and wait for a response.

If the complete response isn't received from the origin by this time, CloudFront ends the connection.

The value for ResponseCompletionTimeout must be equal to or greater than the value for OriginReadTimeout . If you don't set a value for ResponseCompletionTimeout , CloudFront doesn't enforce a maximum value.

For more information, see Response completion timeout in the Amazon CloudFront Developer Guide .



2929
2930
2931
# File 'cloud_front/cfn_distribution.rb', line 2929

def response_completion_timeout
  @response_completion_timeout
end

#s3_origin_configAWSCDK::IResolvable, ... (readonly)

Use this type to specify an origin that is an Amazon S3 bucket that is not configured with static website hosting.

To specify any other type of origin, including an Amazon S3 bucket that is configured with static website hosting, use the CustomOriginConfig type instead.



2936
2937
2938
# File 'cloud_front/cfn_distribution.rb', line 2936

def s3_origin_config
  @s3_origin_config
end

#vpc_origin_configAWSCDK::IResolvable, ... (readonly)

The VPC origin configuration.



2941
2942
2943
# File 'cloud_front/cfn_distribution.rb', line 2941

def vpc_origin_config
  @vpc_origin_config
end

Class Method Details

.jsii_propertiesObject



2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
# File 'cloud_front/cfn_distribution.rb', line 2943

def self.jsii_properties
  {
    :domain_name => "domainName",
    :id => "id",
    :connection_attempts => "connectionAttempts",
    :connection_timeout => "connectionTimeout",
    :custom_origin_config => "customOriginConfig",
    :origin_access_control_id => "originAccessControlId",
    :origin_custom_headers => "originCustomHeaders",
    :origin_path => "originPath",
    :origin_shield => "originShield",
    :response_completion_timeout => "responseCompletionTimeout",
    :s3_origin_config => "s3OriginConfig",
    :vpc_origin_config => "vpcOriginConfig",
  }
end

Instance Method Details

#to_jsiiObject



2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
# File 'cloud_front/cfn_distribution.rb', line 2960

def to_jsii
  result = {}
  result.merge!({
    "domainName" => @domain_name,
    "id" => @id,
    "connectionAttempts" => @connection_attempts,
    "connectionTimeout" => @connection_timeout,
    "customOriginConfig" => @custom_origin_config,
    "originAccessControlId" => @origin_access_control_id,
    "originCustomHeaders" => @origin_custom_headers,
    "originPath" => @origin_path,
    "originShield" => @origin_shield,
    "responseCompletionTimeout" => @response_completion_timeout,
    "s3OriginConfig" => @s3_origin_config,
    "vpcOriginConfig" => @vpc_origin_config,
  })
  result.compact
end