pub struct DistributionBuilder<T>where
T: DistributionState,{ /* private fields */ }Expand description
Builder for CloudFront distributions.
Creates a CloudFront distribution with origins, cache behaviors, and other configuration.
§Example
use rusty_cdk_core::stack::StackBuilder;
use rusty_cdk_core::cloudfront::{DistributionBuilder, OriginBuilder, DefaultCacheBehaviorBuilder};
use rusty_cdk_core::s3::BucketBuilder;
use rusty_cdk_core::wrappers::*;
let mut stack_builder = StackBuilder::new();
let bucket = unimplemented!("create a bucket");
let oac = unimplemented!("create an origin access control");
let policy = unimplemented!("create an origin");
let viewer_protocol_policy = unimplemented!("create a viewer protocol");
let origin = OriginBuilder::new("my-origin").s3_origin(&bucket, &oac, None).build();
let cache_behavior = DefaultCacheBehaviorBuilder::new(&origin, &policy, viewer_protocol_policy).build();
let distribution = DistributionBuilder::new("my-distribution", cache_behavior)
.origins(vec![origin])
.build(&mut stack_builder);Implementations§
Source§impl DistributionBuilder<DistributionStartState>
impl DistributionBuilder<DistributionStartState>
Sourcepub fn new(
id: &str,
default_cache_behavior: DefaultCacheBehavior,
) -> DistributionBuilder<DistributionStartState>
pub fn new( id: &str, default_cache_behavior: DefaultCacheBehavior, ) -> DistributionBuilder<DistributionStartState>
Creates a new CloudFront distribution builder.
§Arguments
id- Unique identifier for the distributiondefault_cache_behavior- Default cache behavior for all requests
pub fn origins( self, origins: Vec<Origin>, ) -> DistributionBuilder<DistributionOriginState>
Source§impl DistributionBuilder<DistributionOriginState>
impl DistributionBuilder<DistributionOriginState>
pub fn build(self, stack_builder: &mut StackBuilder) -> DistributionRef
Source§impl<T> DistributionBuilder<T>where
T: DistributionState,
impl<T> DistributionBuilder<T>where
T: DistributionState,
pub fn add_cache_behavior( self, behavior: CacheBehavior, ) -> DistributionBuilder<T>
pub fn aliases(self, aliases: Vec<String>) -> DistributionBuilder<T>
pub fn cnames(self, cnames: Vec<String>) -> DistributionBuilder<T>
pub fn price_class(self, price_class: PriceClass) -> DistributionBuilder<T>
pub fn http_version(self, http_version: HttpVersion) -> DistributionBuilder<T>
pub fn ipv6_enabled(self, enabled: bool) -> DistributionBuilder<T>
pub fn viewer_certificate( self, viewer_certificate: ViewerCertificate, ) -> DistributionBuilder<T>
pub fn enabled(self, enabled: bool) -> DistributionBuilder<T>
pub fn default_root_object( self, default: DefaultRootObject, ) -> DistributionBuilder<T>
Auto Trait Implementations§
impl<T> Freeze for DistributionBuilder<T>
impl<T> RefUnwindSafe for DistributionBuilder<T>where
T: RefUnwindSafe,
impl<T> Send for DistributionBuilder<T>where
T: Send,
impl<T> Sync for DistributionBuilder<T>where
T: Sync,
impl<T> Unpin for DistributionBuilder<T>where
T: Unpin,
impl<T> UnwindSafe for DistributionBuilder<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreCreates a shared type from an unshared type.