aws_sdk_sagemaker/operation/create_context/
_create_context_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 CreateContextInput {
6    /// <p>The name of the context. Must be unique to your account in an Amazon Web Services Region.</p>
7    pub context_name: ::std::option::Option<::std::string::String>,
8    /// <p>The source type, ID, and URI.</p>
9    pub source: ::std::option::Option<crate::types::ContextSource>,
10    /// <p>The context type.</p>
11    pub context_type: ::std::option::Option<::std::string::String>,
12    /// <p>The description of the context.</p>
13    pub description: ::std::option::Option<::std::string::String>,
14    /// <p>A list of properties to add to the context.</p>
15    pub 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>
17    pub 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>
21    pub fn context_name(&self) -> ::std::option::Option<&str> {
22        self.context_name.as_deref()
23    }
24    /// <p>The source type, ID, and URI.</p>
25    pub fn source(&self) -> ::std::option::Option<&crate::types::ContextSource> {
26        self.source.as_ref()
27    }
28    /// <p>The context type.</p>
29    pub fn context_type(&self) -> ::std::option::Option<&str> {
30        self.context_type.as_deref()
31    }
32    /// <p>The description of the context.</p>
33    pub fn description(&self) -> ::std::option::Option<&str> {
34        self.description.as_deref()
35    }
36    /// <p>A list of properties to add to the context.</p>
37    pub fn properties(&self) -> ::std::option::Option<&::std::collections::HashMap<::std::string::String, ::std::string::String>> {
38        self.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()`.
43    pub fn tags(&self) -> &[crate::types::Tag] {
44        self.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).
49    pub fn builder() -> crate::operation::create_context::builders::CreateContextInputBuilder {
50        crate::operation::create_context::builders::CreateContextInputBuilder::default()
51    }
52}
53
54/// 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 {
58    pub(crate) context_name: ::std::option::Option<::std::string::String>,
59    pub(crate) source: ::std::option::Option<crate::types::ContextSource>,
60    pub(crate) context_type: ::std::option::Option<::std::string::String>,
61    pub(crate) description: ::std::option::Option<::std::string::String>,
62    pub(crate) properties: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
63    pub(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.
68    pub fn context_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
69        self.context_name = ::std::option::Option::Some(input.into());
70        self
71    }
72    /// <p>The name of the context. Must be unique to your account in an Amazon Web Services Region.</p>
73    pub fn set_context_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
74        self.context_name = input;
75        self
76    }
77    /// <p>The name of the context. Must be unique to your account in an Amazon Web Services Region.</p>
78    pub 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.
83    pub fn source(mut self, input: crate::types::ContextSource) -> Self {
84        self.source = ::std::option::Option::Some(input);
85        self
86    }
87    /// <p>The source type, ID, and URI.</p>
88    pub fn set_source(mut self, input: ::std::option::Option<crate::types::ContextSource>) -> Self {
89        self.source = input;
90        self
91    }
92    /// <p>The source type, ID, and URI.</p>
93    pub 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.
98    pub fn context_type(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
99        self.context_type = ::std::option::Option::Some(input.into());
100        self
101    }
102    /// <p>The context type.</p>
103    pub fn set_context_type(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
104        self.context_type = input;
105        self
106    }
107    /// <p>The context type.</p>
108    pub fn get_context_type(&self) -> &::std::option::Option<::std::string::String> {
109        &self.context_type
110    }
111    /// <p>The description of the context.</p>
112    pub fn description(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
113        self.description = ::std::option::Option::Some(input.into());
114        self
115    }
116    /// <p>The description of the context.</p>
117    pub fn set_description(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
118        self.description = input;
119        self
120    }
121    /// <p>The description of the context.</p>
122    pub 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>
130    pub fn properties(mut self, k: impl ::std::convert::Into<::std::string::String>, v: impl ::std::convert::Into<::std::string::String>) -> Self {
131        let mut hash_map = self.properties.unwrap_or_default();
132        hash_map.insert(k.into(), v.into());
133        self.properties = ::std::option::Option::Some(hash_map);
134        self
135    }
136    /// <p>A list of properties to add to the context.</p>
137    pub fn set_properties(mut self, input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>) -> Self {
138        self.properties = input;
139        self
140    }
141    /// <p>A list of properties to add to the context.</p>
142    pub 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>
150    pub fn tags(mut self, input: crate::types::Tag) -> Self {
151        let mut v = self.tags.unwrap_or_default();
152        v.push(input);
153        self.tags = ::std::option::Option::Some(v);
154        self
155    }
156    /// <p>A list of tags to apply to the context.</p>
157    pub fn set_tags(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>) -> Self {
158        self.tags = input;
159        self
160    }
161    /// <p>A list of tags to apply to the context.</p>
162    pub 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).
166    pub fn build(
167        self,
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}