aws_sdk_lightsail/operation/create_domain/
_create_domain_input.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2#[allow(missing_docs)] // documentation missing in model
3#[non_exhaustive]
4#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
5pub struct CreateDomainInput {
6    /// <p>The domain name to manage (<code>example.com</code>).</p>
7    pub domain_name: ::std::option::Option<::std::string::String>,
8    /// <p>The tag keys and optional values to add to the resource during create.</p>
9    /// <p>Use the <code>TagResource</code> action to tag a resource after it's created.</p>
10    pub tags: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>,
11}
12impl CreateDomainInput {
13    /// <p>The domain name to manage (<code>example.com</code>).</p>
14    pub fn domain_name(&self) -> ::std::option::Option<&str> {
15        self.domain_name.as_deref()
16    }
17    /// <p>The tag keys and optional values to add to the resource during create.</p>
18    /// <p>Use the <code>TagResource</code> action to tag a resource after it's created.</p>
19    ///
20    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.tags.is_none()`.
21    pub fn tags(&self) -> &[crate::types::Tag] {
22        self.tags.as_deref().unwrap_or_default()
23    }
24}
25impl CreateDomainInput {
26    /// Creates a new builder-style object to manufacture [`CreateDomainInput`](crate::operation::create_domain::CreateDomainInput).
27    pub fn builder() -> crate::operation::create_domain::builders::CreateDomainInputBuilder {
28        crate::operation::create_domain::builders::CreateDomainInputBuilder::default()
29    }
30}
31
32/// A builder for [`CreateDomainInput`](crate::operation::create_domain::CreateDomainInput).
33#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
34#[non_exhaustive]
35pub struct CreateDomainInputBuilder {
36    pub(crate) domain_name: ::std::option::Option<::std::string::String>,
37    pub(crate) tags: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>,
38}
39impl CreateDomainInputBuilder {
40    /// <p>The domain name to manage (<code>example.com</code>).</p>
41    /// This field is required.
42    pub fn domain_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
43        self.domain_name = ::std::option::Option::Some(input.into());
44        self
45    }
46    /// <p>The domain name to manage (<code>example.com</code>).</p>
47    pub fn set_domain_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
48        self.domain_name = input;
49        self
50    }
51    /// <p>The domain name to manage (<code>example.com</code>).</p>
52    pub fn get_domain_name(&self) -> &::std::option::Option<::std::string::String> {
53        &self.domain_name
54    }
55    /// Appends an item to `tags`.
56    ///
57    /// To override the contents of this collection use [`set_tags`](Self::set_tags).
58    ///
59    /// <p>The tag keys and optional values to add to the resource during create.</p>
60    /// <p>Use the <code>TagResource</code> action to tag a resource after it's created.</p>
61    pub fn tags(mut self, input: crate::types::Tag) -> Self {
62        let mut v = self.tags.unwrap_or_default();
63        v.push(input);
64        self.tags = ::std::option::Option::Some(v);
65        self
66    }
67    /// <p>The tag keys and optional values to add to the resource during create.</p>
68    /// <p>Use the <code>TagResource</code> action to tag a resource after it's created.</p>
69    pub fn set_tags(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>) -> Self {
70        self.tags = input;
71        self
72    }
73    /// <p>The tag keys and optional values to add to the resource during create.</p>
74    /// <p>Use the <code>TagResource</code> action to tag a resource after it's created.</p>
75    pub fn get_tags(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Tag>> {
76        &self.tags
77    }
78    /// Consumes the builder and constructs a [`CreateDomainInput`](crate::operation::create_domain::CreateDomainInput).
79    pub fn build(
80        self,
81    ) -> ::std::result::Result<crate::operation::create_domain::CreateDomainInput, ::aws_smithy_types::error::operation::BuildError> {
82        ::std::result::Result::Ok(crate::operation::create_domain::CreateDomainInput {
83            domain_name: self.domain_name,
84            tags: self.tags,
85        })
86    }
87}