aws_sdk_iot1clickprojects/operation/create_placement/
_create_placement_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 CreatePlacementInput {
6    /// <p>The name of the placement to be created.</p>
7    pub placement_name: ::std::option::Option<::std::string::String>,
8    /// <p>The name of the project in which to create the placement.</p>
9    pub project_name: ::std::option::Option<::std::string::String>,
10    /// <p>Optional user-defined key/value pairs providing contextual data (such as location or function) for the placement.</p>
11    pub attributes: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
12}
13impl CreatePlacementInput {
14    /// <p>The name of the placement to be created.</p>
15    pub fn placement_name(&self) -> ::std::option::Option<&str> {
16        self.placement_name.as_deref()
17    }
18    /// <p>The name of the project in which to create the placement.</p>
19    pub fn project_name(&self) -> ::std::option::Option<&str> {
20        self.project_name.as_deref()
21    }
22    /// <p>Optional user-defined key/value pairs providing contextual data (such as location or function) for the placement.</p>
23    pub fn attributes(&self) -> ::std::option::Option<&::std::collections::HashMap<::std::string::String, ::std::string::String>> {
24        self.attributes.as_ref()
25    }
26}
27impl CreatePlacementInput {
28    /// Creates a new builder-style object to manufacture [`CreatePlacementInput`](crate::operation::create_placement::CreatePlacementInput).
29    pub fn builder() -> crate::operation::create_placement::builders::CreatePlacementInputBuilder {
30        crate::operation::create_placement::builders::CreatePlacementInputBuilder::default()
31    }
32}
33
34/// A builder for [`CreatePlacementInput`](crate::operation::create_placement::CreatePlacementInput).
35#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
36#[non_exhaustive]
37pub struct CreatePlacementInputBuilder {
38    pub(crate) placement_name: ::std::option::Option<::std::string::String>,
39    pub(crate) project_name: ::std::option::Option<::std::string::String>,
40    pub(crate) attributes: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
41}
42impl CreatePlacementInputBuilder {
43    /// <p>The name of the placement to be created.</p>
44    /// This field is required.
45    pub fn placement_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
46        self.placement_name = ::std::option::Option::Some(input.into());
47        self
48    }
49    /// <p>The name of the placement to be created.</p>
50    pub fn set_placement_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
51        self.placement_name = input;
52        self
53    }
54    /// <p>The name of the placement to be created.</p>
55    pub fn get_placement_name(&self) -> &::std::option::Option<::std::string::String> {
56        &self.placement_name
57    }
58    /// <p>The name of the project in which to create the placement.</p>
59    /// This field is required.
60    pub fn project_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
61        self.project_name = ::std::option::Option::Some(input.into());
62        self
63    }
64    /// <p>The name of the project in which to create the placement.</p>
65    pub fn set_project_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
66        self.project_name = input;
67        self
68    }
69    /// <p>The name of the project in which to create the placement.</p>
70    pub fn get_project_name(&self) -> &::std::option::Option<::std::string::String> {
71        &self.project_name
72    }
73    /// Adds a key-value pair to `attributes`.
74    ///
75    /// To override the contents of this collection use [`set_attributes`](Self::set_attributes).
76    ///
77    /// <p>Optional user-defined key/value pairs providing contextual data (such as location or function) for the placement.</p>
78    pub fn attributes(mut self, k: impl ::std::convert::Into<::std::string::String>, v: impl ::std::convert::Into<::std::string::String>) -> Self {
79        let mut hash_map = self.attributes.unwrap_or_default();
80        hash_map.insert(k.into(), v.into());
81        self.attributes = ::std::option::Option::Some(hash_map);
82        self
83    }
84    /// <p>Optional user-defined key/value pairs providing contextual data (such as location or function) for the placement.</p>
85    pub fn set_attributes(mut self, input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>) -> Self {
86        self.attributes = input;
87        self
88    }
89    /// <p>Optional user-defined key/value pairs providing contextual data (such as location or function) for the placement.</p>
90    pub fn get_attributes(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
91        &self.attributes
92    }
93    /// Consumes the builder and constructs a [`CreatePlacementInput`](crate::operation::create_placement::CreatePlacementInput).
94    pub fn build(
95        self,
96    ) -> ::std::result::Result<crate::operation::create_placement::CreatePlacementInput, ::aws_smithy_types::error::operation::BuildError> {
97        ::std::result::Result::Ok(crate::operation::create_placement::CreatePlacementInput {
98            placement_name: self.placement_name,
99            project_name: self.project_name,
100            attributes: self.attributes,
101        })
102    }
103}