aws_sdk_sagemaker/operation/update_context/
_update_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 UpdateContextInput {
6    /// <p>The name of the context to update.</p>
7    pub context_name: ::std::option::Option<::std::string::String>,
8    /// <p>The new description for the context.</p>
9    pub description: ::std::option::Option<::std::string::String>,
10    /// <p>The new list of properties. Overwrites the current property list.</p>
11    pub properties: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
12    /// <p>A list of properties to remove.</p>
13    pub properties_to_remove: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
14}
15impl UpdateContextInput {
16    /// <p>The name of the context to update.</p>
17    pub fn context_name(&self) -> ::std::option::Option<&str> {
18        self.context_name.as_deref()
19    }
20    /// <p>The new description for the context.</p>
21    pub fn description(&self) -> ::std::option::Option<&str> {
22        self.description.as_deref()
23    }
24    /// <p>The new list of properties. Overwrites the current property list.</p>
25    pub fn properties(&self) -> ::std::option::Option<&::std::collections::HashMap<::std::string::String, ::std::string::String>> {
26        self.properties.as_ref()
27    }
28    /// <p>A list of properties to remove.</p>
29    ///
30    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.properties_to_remove.is_none()`.
31    pub fn properties_to_remove(&self) -> &[::std::string::String] {
32        self.properties_to_remove.as_deref().unwrap_or_default()
33    }
34}
35impl UpdateContextInput {
36    /// Creates a new builder-style object to manufacture [`UpdateContextInput`](crate::operation::update_context::UpdateContextInput).
37    pub fn builder() -> crate::operation::update_context::builders::UpdateContextInputBuilder {
38        crate::operation::update_context::builders::UpdateContextInputBuilder::default()
39    }
40}
41
42/// A builder for [`UpdateContextInput`](crate::operation::update_context::UpdateContextInput).
43#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
44#[non_exhaustive]
45pub struct UpdateContextInputBuilder {
46    pub(crate) context_name: ::std::option::Option<::std::string::String>,
47    pub(crate) description: ::std::option::Option<::std::string::String>,
48    pub(crate) properties: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
49    pub(crate) properties_to_remove: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
50}
51impl UpdateContextInputBuilder {
52    /// <p>The name of the context to update.</p>
53    /// This field is required.
54    pub fn context_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
55        self.context_name = ::std::option::Option::Some(input.into());
56        self
57    }
58    /// <p>The name of the context to update.</p>
59    pub fn set_context_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
60        self.context_name = input;
61        self
62    }
63    /// <p>The name of the context to update.</p>
64    pub fn get_context_name(&self) -> &::std::option::Option<::std::string::String> {
65        &self.context_name
66    }
67    /// <p>The new description for the context.</p>
68    pub fn description(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
69        self.description = ::std::option::Option::Some(input.into());
70        self
71    }
72    /// <p>The new description for the context.</p>
73    pub fn set_description(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
74        self.description = input;
75        self
76    }
77    /// <p>The new description for the context.</p>
78    pub fn get_description(&self) -> &::std::option::Option<::std::string::String> {
79        &self.description
80    }
81    /// Adds a key-value pair to `properties`.
82    ///
83    /// To override the contents of this collection use [`set_properties`](Self::set_properties).
84    ///
85    /// <p>The new list of properties. Overwrites the current property list.</p>
86    pub fn properties(mut self, k: impl ::std::convert::Into<::std::string::String>, v: impl ::std::convert::Into<::std::string::String>) -> Self {
87        let mut hash_map = self.properties.unwrap_or_default();
88        hash_map.insert(k.into(), v.into());
89        self.properties = ::std::option::Option::Some(hash_map);
90        self
91    }
92    /// <p>The new list of properties. Overwrites the current property list.</p>
93    pub fn set_properties(mut self, input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>) -> Self {
94        self.properties = input;
95        self
96    }
97    /// <p>The new list of properties. Overwrites the current property list.</p>
98    pub fn get_properties(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
99        &self.properties
100    }
101    /// Appends an item to `properties_to_remove`.
102    ///
103    /// To override the contents of this collection use [`set_properties_to_remove`](Self::set_properties_to_remove).
104    ///
105    /// <p>A list of properties to remove.</p>
106    pub fn properties_to_remove(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
107        let mut v = self.properties_to_remove.unwrap_or_default();
108        v.push(input.into());
109        self.properties_to_remove = ::std::option::Option::Some(v);
110        self
111    }
112    /// <p>A list of properties to remove.</p>
113    pub fn set_properties_to_remove(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
114        self.properties_to_remove = input;
115        self
116    }
117    /// <p>A list of properties to remove.</p>
118    pub fn get_properties_to_remove(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
119        &self.properties_to_remove
120    }
121    /// Consumes the builder and constructs a [`UpdateContextInput`](crate::operation::update_context::UpdateContextInput).
122    pub fn build(
123        self,
124    ) -> ::std::result::Result<crate::operation::update_context::UpdateContextInput, ::aws_smithy_types::error::operation::BuildError> {
125        ::std::result::Result::Ok(crate::operation::update_context::UpdateContextInput {
126            context_name: self.context_name,
127            description: self.description,
128            properties: self.properties,
129            properties_to_remove: self.properties_to_remove,
130        })
131    }
132}