Class Distribution
A CloudFront distribution with associated origin(s) and caching behavior(s).
Inherited Members
Namespace: Amazon.CDK.AWS.CloudFront
Assembly: Amazon.CDK.AWS.CloudFront.dll
Syntax (csharp)
public class Distribution : Resource, IDistribution, IResource, IConstruct, IDependable
Syntax (vb)
Public Class Distribution
Inherits Resource
Implements IDistribution, IResource, IConstruct, IDependable
Remarks
ExampleMetadata: infused
Examples
// Adding an existing Lambda@Edge function created in a different stack
// to a CloudFront distribution.
Bucket s3Bucket;
var functionVersion = Version.FromVersionArn(this, "Version", "arn:aws:lambda:us-east-1:123456789012:function:functionName:1");
new Distribution(this, "distro", new DistributionProps {
DefaultBehavior = new BehaviorOptions {
Origin = new S3Origin(s3Bucket),
EdgeLambdas = new [] { new EdgeLambda {
FunctionVersion = functionVersion,
EventType = LambdaEdgeEventType.VIEWER_REQUEST
} }
}
});
Synopsis
Constructors
Distribution(ByRefValue) | Used by jsii to construct an instance of this class from a Javascript-owned object reference |
Distribution(DeputyBase.DeputyProps) | Used by jsii to construct an instance of this class from DeputyProps |
Distribution(Construct, String, IDistributionProps) |
Properties
DistributionDomainName | The domain name of the Distribution, such as d111111abcdef8.cloudfront.net. |
DistributionId | The distribution ID for this distribution. |
DomainName | The domain name of the Distribution, such as d111111abcdef8.cloudfront.net. |
Methods
AddBehavior(String, IOrigin, IAddBehaviorOptions) | Adds a new behavior to this distribution for the given pathPattern. |
FromDistributionAttributes(Construct, String, IDistributionAttributes) | Creates a Distribution construct that represents an external (imported) distribution. |
Constructors
Distribution(ByRefValue)
Used by jsii to construct an instance of this class from a Javascript-owned object reference
protected Distribution(ByRefValue reference)
Parameters
- reference Amazon.JSII.Runtime.Deputy.ByRefValue
The Javascript-owned object reference
Distribution(DeputyBase.DeputyProps)
Used by jsii to construct an instance of this class from DeputyProps
protected Distribution(DeputyBase.DeputyProps props)
Parameters
- props Amazon.JSII.Runtime.Deputy.DeputyBase.DeputyProps
The deputy props
Distribution(Construct, String, IDistributionProps)
public Distribution(Construct scope, string id, IDistributionProps props)
Parameters
- scope Constructs.Construct
- id System.String
- props IDistributionProps
Properties
DistributionDomainName
The domain name of the Distribution, such as d111111abcdef8.cloudfront.net.
public virtual string DistributionDomainName { get; }
Property Value
System.String
DistributionId
The distribution ID for this distribution.
public virtual string DistributionId { get; }
Property Value
System.String
DomainName
The domain name of the Distribution, such as d111111abcdef8.cloudfront.net.
public virtual string DomainName { get; }
Property Value
System.String
Methods
AddBehavior(String, IOrigin, IAddBehaviorOptions)
Adds a new behavior to this distribution for the given pathPattern.
public virtual void AddBehavior(string pathPattern, IOrigin origin, IAddBehaviorOptions behaviorOptions = null)
Parameters
- pathPattern System.String
the path pattern (e.g., 'images/*') that specifies which requests to apply the behavior to.
- origin IOrigin
the origin to use for this behavior.
- behaviorOptions IAddBehaviorOptions
the options for the behavior at this path.
FromDistributionAttributes(Construct, String, IDistributionAttributes)
Creates a Distribution construct that represents an external (imported) distribution.
public static IDistribution FromDistributionAttributes(Construct scope, string id, IDistributionAttributes attrs)
Parameters
- scope Constructs.Construct
- id System.String
- attrs IDistributionAttributes
Returns