Class: AWSCDK::CloudFront::S3OriginConfig

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

Overview

S3 origin configuration for CloudFront.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(s3_bucket_source:, origin_access_identity: nil, origin_headers: nil, origin_path: nil, origin_shield_region: nil) ⇒ S3OriginConfig

Returns a new instance of S3OriginConfig.

Parameters:

  • s3_bucket_source (AWSCDK::S3::IBucket)

    The source bucket to serve content from.

  • origin_access_identity (Object, nil) (defaults to: nil)

    The optional Origin Access Identity of the origin identity cloudfront will use when calling your s3 bucket.

  • origin_headers (Hash{String => String}, nil) (defaults to: nil)

    Any additional headers to pass to the origin.

  • origin_path (String, nil) (defaults to: nil)

    The relative path to the origin root to use for sources.

  • origin_shield_region (String, nil) (defaults to: nil)

    When you enable Origin Shield in the AWS Region that has the lowest latency to your origin, you can get better network performance.



12
13
14
15
16
17
18
19
20
21
22
23
# File 'cloud_front/s3_origin_config.rb', line 12

def initialize(s3_bucket_source:, origin_access_identity: nil, origin_headers: nil, origin_path: nil, origin_shield_region: nil)
  @s3_bucket_source = s3_bucket_source
  Jsii::Type.check_type(@s3_bucket_source, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfczMuSUJ1Y2tldCJ9")), "s3BucketSource")
  @origin_access_identity = origin_access_identity
  Jsii::Type.check_type(@origin_access_identity, JSON.parse(Base64.strict_decode64("eyJpbnRlcnNlY3Rpb24iOnsidHlwZXMiOlt7ImZxbiI6ImF3cy1jZGstbGliLmludGVyZmFjZXMuYXdzX2Nsb3VkZnJvbnQuSUNsb3VkRnJvbnRPcmlnaW5BY2Nlc3NJZGVudGl0eVJlZiJ9LHsiZnFuIjoiYXdzLWNkay1saWIuYXdzX2lhbS5JR3JhbnRhYmxlIn1dfX0=")), "originAccessIdentity") unless @origin_access_identity.nil?
  @origin_headers = origin_headers
  Jsii::Type.check_type(@origin_headers, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoibWFwIn19")), "originHeaders") unless @origin_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_region = origin_shield_region
  Jsii::Type.check_type(@origin_shield_region, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "originShieldRegion") unless @origin_shield_region.nil?
end

Instance Attribute Details

#origin_access_identityObject? (readonly)

Note:

Default: No Origin Access Identity which requires the S3 bucket to be public accessible

The optional Origin Access Identity of the origin identity cloudfront will use when calling your s3 bucket.

Returns:

  • (Object, nil)


33
34
35
# File 'cloud_front/s3_origin_config.rb', line 33

def origin_access_identity
  @origin_access_identity
end

#origin_headersHash{String => String}? (readonly)

Note:

Default: - No additional headers are passed.

Any additional headers to pass to the origin.

Returns:

  • (Hash{String => String}, nil)


38
39
40
# File 'cloud_front/s3_origin_config.rb', line 38

def origin_headers
  @origin_headers
end

#origin_pathString? (readonly)

Note:

Default: /

The relative path to the origin root to use for sources.

Returns:

  • (String, nil)


43
44
45
# File 'cloud_front/s3_origin_config.rb', line 43

def origin_path
  @origin_path
end

#origin_shield_regionString? (readonly)

Note:

Default: - origin shield not enabled

When you enable Origin Shield in the AWS Region that has the lowest latency to your origin, you can get better network performance.

Returns:

  • (String, nil)


48
49
50
# File 'cloud_front/s3_origin_config.rb', line 48

def origin_shield_region
  @origin_shield_region
end

#s3_bucket_sourceAWSCDK::S3::IBucket (readonly)

The source bucket to serve content from.

Returns:



28
29
30
# File 'cloud_front/s3_origin_config.rb', line 28

def s3_bucket_source
  @s3_bucket_source
end

Class Method Details

.jsii_propertiesObject



50
51
52
53
54
55
56
57
58
# File 'cloud_front/s3_origin_config.rb', line 50

def self.jsii_properties
  {
    :s3_bucket_source => "s3BucketSource",
    :origin_access_identity => "originAccessIdentity",
    :origin_headers => "originHeaders",
    :origin_path => "originPath",
    :origin_shield_region => "originShieldRegion",
  }
end

Instance Method Details

#to_jsiiObject



60
61
62
63
64
65
66
67
68
69
70
# File 'cloud_front/s3_origin_config.rb', line 60

def to_jsii
  result = {}
  result.merge!({
    "s3BucketSource" => @s3_bucket_source,
    "originAccessIdentity" => @origin_access_identity,
    "originHeaders" => @origin_headers,
    "originPath" => @origin_path,
    "originShieldRegion" => @origin_shield_region,
  })
  result.compact
end