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 CreateContextInput {
6/// <p>The name of the context. Must be unique to your account in an Amazon Web Services Region.</p>
7pub context_name: ::std::option::Option<::std::string::String>,
8/// <p>The source type, ID, and URI.</p>
9pub source: ::std::option::Option<crate::types::ContextSource>,
10/// <p>The context type.</p>
11pub context_type: ::std::option::Option<::std::string::String>,
12/// <p>The description of the context.</p>
13pub description: ::std::option::Option<::std::string::String>,
14/// <p>A list of properties to add to the context.</p>
15pub properties: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
16/// <p>A list of tags to apply to the context.</p>
17pub tags: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>,
18}
19impl CreateContextInput {
20/// <p>The name of the context. Must be unique to your account in an Amazon Web Services Region.</p>
21pub fn context_name(&self) -> ::std::option::Option<&str> {
22self.context_name.as_deref()
23 }
24/// <p>The source type, ID, and URI.</p>
25pub fn source(&self) -> ::std::option::Option<&crate::types::ContextSource> {
26self.source.as_ref()
27 }
28/// <p>The context type.</p>
29pub fn context_type(&self) -> ::std::option::Option<&str> {
30self.context_type.as_deref()
31 }
32/// <p>The description of the context.</p>
33pub fn description(&self) -> ::std::option::Option<&str> {
34self.description.as_deref()
35 }
36/// <p>A list of properties to add to the context.</p>
37pub fn properties(&self) -> ::std::option::Option<&::std::collections::HashMap<::std::string::String, ::std::string::String>> {
38self.properties.as_ref()
39 }
40/// <p>A list of tags to apply to the context.</p>
41 ///
42 /// 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()`.
43pub fn tags(&self) -> &[crate::types::Tag] {
44self.tags.as_deref().unwrap_or_default()
45 }
46}
47impl CreateContextInput {
48/// Creates a new builder-style object to manufacture [`CreateContextInput`](crate::operation::create_context::CreateContextInput).
49pub fn builder() -> crate::operation::create_context::builders::CreateContextInputBuilder {
50crate::operation::create_context::builders::CreateContextInputBuilder::default()
51 }
52}
5354/// A builder for [`CreateContextInput`](crate::operation::create_context::CreateContextInput).
55#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
56#[non_exhaustive]
57pub struct CreateContextInputBuilder {
58pub(crate) context_name: ::std::option::Option<::std::string::String>,
59pub(crate) source: ::std::option::Option<crate::types::ContextSource>,
60pub(crate) context_type: ::std::option::Option<::std::string::String>,
61pub(crate) description: ::std::option::Option<::std::string::String>,
62pub(crate) properties: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
63pub(crate) tags: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>,
64}
65impl CreateContextInputBuilder {
66/// <p>The name of the context. Must be unique to your account in an Amazon Web Services Region.</p>
67 /// This field is required.
68pub fn context_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
69self.context_name = ::std::option::Option::Some(input.into());
70self
71}
72/// <p>The name of the context. Must be unique to your account in an Amazon Web Services Region.</p>
73pub fn set_context_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
74self.context_name = input;
75self
76}
77/// <p>The name of the context. Must be unique to your account in an Amazon Web Services Region.</p>
78pub fn get_context_name(&self) -> &::std::option::Option<::std::string::String> {
79&self.context_name
80 }
81/// <p>The source type, ID, and URI.</p>
82 /// This field is required.
83pub fn source(mut self, input: crate::types::ContextSource) -> Self {
84self.source = ::std::option::Option::Some(input);
85self
86}
87/// <p>The source type, ID, and URI.</p>
88pub fn set_source(mut self, input: ::std::option::Option<crate::types::ContextSource>) -> Self {
89self.source = input;
90self
91}
92/// <p>The source type, ID, and URI.</p>
93pub fn get_source(&self) -> &::std::option::Option<crate::types::ContextSource> {
94&self.source
95 }
96/// <p>The context type.</p>
97 /// This field is required.
98pub fn context_type(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
99self.context_type = ::std::option::Option::Some(input.into());
100self
101}
102/// <p>The context type.</p>
103pub fn set_context_type(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
104self.context_type = input;
105self
106}
107/// <p>The context type.</p>
108pub fn get_context_type(&self) -> &::std::option::Option<::std::string::String> {
109&self.context_type
110 }
111/// <p>The description of the context.</p>
112pub fn description(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
113self.description = ::std::option::Option::Some(input.into());
114self
115}
116/// <p>The description of the context.</p>
117pub fn set_description(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
118self.description = input;
119self
120}
121/// <p>The description of the context.</p>
122pub fn get_description(&self) -> &::std::option::Option<::std::string::String> {
123&self.description
124 }
125/// Adds a key-value pair to `properties`.
126 ///
127 /// To override the contents of this collection use [`set_properties`](Self::set_properties).
128 ///
129 /// <p>A list of properties to add to the context.</p>
130pub fn properties(mut self, k: impl ::std::convert::Into<::std::string::String>, v: impl ::std::convert::Into<::std::string::String>) -> Self {
131let mut hash_map = self.properties.unwrap_or_default();
132 hash_map.insert(k.into(), v.into());
133self.properties = ::std::option::Option::Some(hash_map);
134self
135}
136/// <p>A list of properties to add to the context.</p>
137pub fn set_properties(mut self, input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>) -> Self {
138self.properties = input;
139self
140}
141/// <p>A list of properties to add to the context.</p>
142pub fn get_properties(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
143&self.properties
144 }
145/// Appends an item to `tags`.
146 ///
147 /// To override the contents of this collection use [`set_tags`](Self::set_tags).
148 ///
149 /// <p>A list of tags to apply to the context.</p>
150pub fn tags(mut self, input: crate::types::Tag) -> Self {
151let mut v = self.tags.unwrap_or_default();
152 v.push(input);
153self.tags = ::std::option::Option::Some(v);
154self
155}
156/// <p>A list of tags to apply to the context.</p>
157pub fn set_tags(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>) -> Self {
158self.tags = input;
159self
160}
161/// <p>A list of tags to apply to the context.</p>
162pub fn get_tags(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Tag>> {
163&self.tags
164 }
165/// Consumes the builder and constructs a [`CreateContextInput`](crate::operation::create_context::CreateContextInput).
166pub fn build(
167self,
168 ) -> ::std::result::Result<crate::operation::create_context::CreateContextInput, ::aws_smithy_types::error::operation::BuildError> {
169 ::std::result::Result::Ok(crate::operation::create_context::CreateContextInput {
170 context_name: self.context_name,
171 source: self.source,
172 context_type: self.context_type,
173 description: self.description,
174 properties: self.properties,
175 tags: self.tags,
176 })
177 }
178}