Class: AWSCDK::CloudFront::CfnOriginAccessControl::OriginAccessControlConfigProperty

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

Overview

Creates a new origin access control in CloudFront.

After you create an origin access control, you can add it to an origin in a CloudFront distribution so that CloudFront sends authenticated (signed) requests to the origin.

This makes it possible to block public access to the origin, allowing viewers (users) to access the origin's content only through CloudFront.

For more information about using a CloudFront origin access control, see Restricting access to an AWS origin in the Amazon CloudFront Developer Guide .

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name:, origin_access_control_origin_type:, signing_behavior:, signing_protocol:, description: nil) ⇒ OriginAccessControlConfigProperty

Returns a new instance of OriginAccessControlConfigProperty.

Parameters:

  • name (String)

    A name to identify the origin access control.

  • origin_access_control_origin_type (String)

    The type of origin that this origin access control is for.

  • signing_behavior (String)

    Specifies which requests CloudFront signs (adds authentication information to).

  • signing_protocol (String)

    The signing protocol of the origin access control, which determines how CloudFront signs (authenticates) requests.

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

    A description of the origin access control.



524
525
526
527
528
529
530
531
532
533
534
535
# File 'cloud_front/cfn_origin_access_control.rb', line 524

def initialize(name:, origin_access_control_origin_type:, signing_behavior:, signing_protocol:, description: nil)
  @name = name
  Jsii::Type.check_type(@name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "name")
  @origin_access_control_origin_type = origin_access_control_origin_type
  Jsii::Type.check_type(@origin_access_control_origin_type, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "originAccessControlOriginType")
  @signing_behavior = signing_behavior
  Jsii::Type.check_type(@signing_behavior, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "signingBehavior")
  @signing_protocol = signing_protocol
  Jsii::Type.check_type(@signing_protocol, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "signingProtocol")
  @description = description
  Jsii::Type.check_type(@description, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "description") unless @description.nil?
end

Instance Attribute Details

#descriptionString? (readonly)

A description of the origin access control.



573
574
575
# File 'cloud_front/cfn_origin_access_control.rb', line 573

def description
  @description
end

#nameString (readonly)

A name to identify the origin access control.

You can specify up to 64 characters.



543
544
545
# File 'cloud_front/cfn_origin_access_control.rb', line 543

def name
  @name
end

#origin_access_control_origin_typeString (readonly)

The type of origin that this origin access control is for.



548
549
550
# File 'cloud_front/cfn_origin_access_control.rb', line 548

def origin_access_control_origin_type
  @origin_access_control_origin_type
end

#signing_behaviorString (readonly)

Specifies which requests CloudFront signs (adds authentication information to).

Specify always for the most common use case. For more information, see origin access control advanced settings in the Amazon CloudFront Developer Guide .

This field can have one of the following values:

  • always – CloudFront signs all origin requests, overwriting the Authorization header from the viewer request if one exists.
  • never – CloudFront doesn't sign any origin requests. This value turns off origin access control for all origins in all distributions that use this origin access control.
  • no-override – If the viewer request doesn't contain the Authorization header, then CloudFront signs the origin request. If the viewer request contains the Authorization header, then CloudFront doesn't sign the origin request and instead passes along the Authorization header from the viewer request. WARNING: To pass along the Authorization header from the viewer request, you *must add the Authorization header to a cache policy for all cache behaviors that use origins associated with this origin access control.*


561
562
563
# File 'cloud_front/cfn_origin_access_control.rb', line 561

def signing_behavior
  @signing_behavior
end

#signing_protocolString (readonly)

The signing protocol of the origin access control, which determines how CloudFront signs (authenticates) requests.

The only valid value is sigv4 .



568
569
570
# File 'cloud_front/cfn_origin_access_control.rb', line 568

def signing_protocol
  @signing_protocol
end

Class Method Details

.jsii_propertiesObject



575
576
577
578
579
580
581
582
583
# File 'cloud_front/cfn_origin_access_control.rb', line 575

def self.jsii_properties
  {
    :name => "name",
    :origin_access_control_origin_type => "originAccessControlOriginType",
    :signing_behavior => "signingBehavior",
    :signing_protocol => "signingProtocol",
    :description => "description",
  }
end

Instance Method Details

#to_jsiiObject



585
586
587
588
589
590
591
592
593
594
595
# File 'cloud_front/cfn_origin_access_control.rb', line 585

def to_jsii
  result = {}
  result.merge!({
    "name" => @name,
    "originAccessControlOriginType" => @origin_access_control_origin_type,
    "signingBehavior" => @signing_behavior,
    "signingProtocol" => @signing_protocol,
    "description" => @description,
  })
  result.compact
end