Skip to main content

ExpString

Enum ExpString 

Source
pub enum ExpString {
Show 17 variants Base64(Box<ExpString>), FindInMap { map_name: MapName, top_level_key: Box<ExpString>, second_level_key: String, }, GetAtt { logical_resource_name: LogicalResourceName, attribute_name: AttributeName, }, If { condition_name: ConditionName, true_branch: Box<ExpString>, else_branch: Box<ExpString>, }, ImportValue(OutputExportName), Join { delimiter: String, values: Vec<ExpString>, }, Literal(String), Ref(LogicalResourceName), Select { index: u8, values: Box<ExpStringList>, }, Split { delimiter: String, source: Box<ExpString>, }, Sub { pattern: String, }, AwsAccountId, AwsPartition, AwsRegion, AwsStackId, AwsStackName, AwsUrlSuffix,
}

Variants§

§

Base64(Box<ExpString>)

§

FindInMap

Fields

§map_name: MapName
§top_level_key: Box<ExpString>
§second_level_key: String
§

GetAtt

Fields

§logical_resource_name: LogicalResourceName
§attribute_name: AttributeName
§

If

Fields

§condition_name: ConditionName
§true_branch: Box<ExpString>
§else_branch: Box<ExpString>
§

ImportValue(OutputExportName)

§

Join

Fields

§delimiter: String
§values: Vec<ExpString>
§

Literal(String)

§

Ref(LogicalResourceName)

§

Select

Fields

§index: u8
§

Split

Fields

§delimiter: String
§source: Box<ExpString>
§

Sub

Fields

§pattern: String
§

AwsAccountId

§

AwsPartition

§

AwsRegion

§

AwsStackId

§

AwsStackName

§

AwsUrlSuffix

Implementations§

Trait Implementations§

Source§

impl Clone for ExpString

Source§

fn clone(&self) -> ExpString

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ExpString

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl FnFindInMap for ExpString

Source§

fn fn_find_in_map( map_name: impl Into<MapName>, top_level_key: impl Into<ExpString>, second_level_key: impl Into<String>, ) -> Self

Creates a find in map expression using Fn::FindInMap Read more
Source§

impl FnIf for ExpString

Source§

fn fn_if( condition_name: impl Into<ConditionName>, true_branch: impl Into<Self>, else_branch: impl Into<Self>, ) -> Self

Creates a conditional expression using Fn::If Read more
Source§

impl FnSelect for ExpString

Source§

type ValueList = ExpStringList

The type representing a list of values that can be selected from
Source§

fn fn_select(index: u8, values: Self::ValueList) -> Self

Creates a select expression using Fn::Select Read more
Source§

impl From<&LogicalResourceName> for ExpString

Source§

fn from(value: &LogicalResourceName) -> Self

Converts to this type from the input type.
Source§

impl From<&ParameterKey> for ExpString

Source§

fn from(value: &ParameterKey) -> Self

Converts to this type from the input type.
Source§

impl From<&str> for ExpString

Source§

fn from(value: &str) -> Self

Converts to this type from the input type.
Source§

impl From<LogicalResourceName> for ExpString

Source§

fn from(value: LogicalResourceName) -> Self

Converts to this type from the input type.
Source§

impl From<ParameterKey> for ExpString

Source§

fn from(value: ParameterKey) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for ExpString

Source§

fn eq(&self, other: &ExpString) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for ExpString

Source§

fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error>

Serialize this value into the given Serde serializer. Read more
Source§

impl ToValue for ExpString

Source§

fn to_value(&self) -> Value

Render expression to CF template value^

§Panics

On internal errors/bugs, there is no public API that allows to construct values that panic on this call.

§Examples

Fn::Base64


assert_eq!(
  json!({"Fn::Base64":"some-literal"}),
  ExpString::from("some-literal").base64().to_value()
)

Fn::If

assert_eq!(
  json!({"Fn::If":["condition-name",{"Ref":"resource-a"},{"Ref":"resource-b"}]}),
  ExpString::If{
    condition_name: "condition-name".into(),
    true_branch: Box::new(LogicalResourceName::from("resource-a").into()),
    else_branch: Box::new(LogicalResourceName::from("resource-b").into()),
  }.to_value()
)

Ref


let logical_resource_name = LogicalResourceName::from("some-logical-resource-name");
let reference : ExpString = logical_resource_name.into();

assert_eq!(
  json!({"Ref":"some-logical-resource-name"}),
  reference.to_value()
)

Fn::GetAtt

assert_eq!(
  json!({"Fn::GetAtt":["some-logical-resource-name", "some-attribute-name"]}),
  ExpString::GetAtt{
    logical_resource_name: "some-logical-resource-name".into(),
    attribute_name: "some-attribute-name".into()
  }.to_value()
)

String Literal


let exp : ExpString = "some-literal".into();

assert_eq!(json!{"some-literal"}, exp.to_value())

Fn::Join

assert_eq!(
  json!({"Fn::Join":[',', [{"Ref": "some-logical-resource-name"}, "some-literal"]]}),
  ExpString::Join{
    delimiter: String::from(","),
    values: vec![
      LogicalResourceName::from("some-logical-resource-name").into(),
      "some-literal".into()
    ]
  }.to_value()
)
Source§

impl Eq for ExpString

Source§

impl StructuralPartialEq for ExpString

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.