Template

Struct Template 

Source
pub struct Template { /* private fields */ }

Implementations§

Source§

impl Template

Source

pub fn new() -> Self

Examples found in repository?
examples/template.rs (line 19)
5pub fn template() -> Template {
6    let env = Parameter::image_id("ImageId")
7        .description("AMI image id for proxy instance")
8        .default("ami-0ff8a91507f77f868");
9
10    let proxy1 = Instance::new("proxy1")
11        .instance_type("t2.micro")
12        .image_id(env.r#ref());
13    let proxy2 = Instance::new("proxy2")
14        .instance_type("t2.micro")
15        .image_id("ami-0ff8a91507f77f867");
16    let eip1 = EIp::vpc("proxyip1");
17    let eip2 = EIp::vpc("proxyip2");
18
19    let mut template = Template::new();
20
21    template
22        .description("Proxy Farm")
23        .parameter(env)
24        .resource(proxy1)
25        .resource(eip1)
26        .resource(proxy2)
27        .resource(eip2);
28
29    template
30}
Source

pub fn description(&mut self, description: impl Into<String>) -> &mut Self

Examples found in repository?
examples/template.rs (line 22)
5pub fn template() -> Template {
6    let env = Parameter::image_id("ImageId")
7        .description("AMI image id for proxy instance")
8        .default("ami-0ff8a91507f77f868");
9
10    let proxy1 = Instance::new("proxy1")
11        .instance_type("t2.micro")
12        .image_id(env.r#ref());
13    let proxy2 = Instance::new("proxy2")
14        .instance_type("t2.micro")
15        .image_id("ami-0ff8a91507f77f867");
16    let eip1 = EIp::vpc("proxyip1");
17    let eip2 = EIp::vpc("proxyip2");
18
19    let mut template = Template::new();
20
21    template
22        .description("Proxy Farm")
23        .parameter(env)
24        .resource(proxy1)
25        .resource(eip1)
26        .resource(proxy2)
27        .resource(eip2);
28
29    template
30}
Source

pub fn resource(&mut self, resource: impl ToResource) -> &mut Self

Examples found in repository?
examples/template.rs (line 24)
5pub fn template() -> Template {
6    let env = Parameter::image_id("ImageId")
7        .description("AMI image id for proxy instance")
8        .default("ami-0ff8a91507f77f868");
9
10    let proxy1 = Instance::new("proxy1")
11        .instance_type("t2.micro")
12        .image_id(env.r#ref());
13    let proxy2 = Instance::new("proxy2")
14        .instance_type("t2.micro")
15        .image_id("ami-0ff8a91507f77f867");
16    let eip1 = EIp::vpc("proxyip1");
17    let eip2 = EIp::vpc("proxyip2");
18
19    let mut template = Template::new();
20
21    template
22        .description("Proxy Farm")
23        .parameter(env)
24        .resource(proxy1)
25        .resource(eip1)
26        .resource(proxy2)
27        .resource(eip2);
28
29    template
30}
Source

pub fn parameter(&mut self, parameter: Parameter) -> &mut Self

Examples found in repository?
examples/template.rs (line 23)
5pub fn template() -> Template {
6    let env = Parameter::image_id("ImageId")
7        .description("AMI image id for proxy instance")
8        .default("ami-0ff8a91507f77f868");
9
10    let proxy1 = Instance::new("proxy1")
11        .instance_type("t2.micro")
12        .image_id(env.r#ref());
13    let proxy2 = Instance::new("proxy2")
14        .instance_type("t2.micro")
15        .image_id("ami-0ff8a91507f77f867");
16    let eip1 = EIp::vpc("proxyip1");
17    let eip2 = EIp::vpc("proxyip2");
18
19    let mut template = Template::new();
20
21    template
22        .description("Proxy Farm")
23        .parameter(env)
24        .resource(proxy1)
25        .resource(eip1)
26        .resource(proxy2)
27        .resource(eip2);
28
29    template
30}
Source

pub fn mapping( &mut self, name: impl Into<String>, mapping: Mapping, ) -> &mut Self

Source

pub fn output(&mut self, name: impl Into<String>, output: Output) -> &mut Self

Source

pub fn validate(&self) -> Result<&Self, Error>

Source

pub fn json(&self) -> String

Source

pub fn json_pretty(&self) -> String

Examples found in repository?
examples/json.rs (line 4)
3fn main() {
4    let template = template::template().json_pretty();
5
6    println!("{}", template);
7}
Source

pub fn yaml(&self) -> String

Examples found in repository?
examples/yaml.rs (line 4)
3fn main() {
4    let template = template::template().yaml();
5
6    println!("{}", template);
7}

Trait Implementations§

Source§

impl Debug for Template

Source§

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

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

impl Default for Template

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Serialize for Template

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

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> 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, 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.