aws_sdk_eks/types/
_update_labels_payload.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>An object representing a Kubernetes <code>label</code> change for a managed node group.</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct UpdateLabelsPayload {
7    /// <p>The Kubernetes <code>labels</code> to add or update.</p>
8    pub add_or_update_labels: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
9    /// <p>The Kubernetes <code>labels</code> to remove.</p>
10    pub remove_labels: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
11}
12impl UpdateLabelsPayload {
13    /// <p>The Kubernetes <code>labels</code> to add or update.</p>
14    pub fn add_or_update_labels(&self) -> ::std::option::Option<&::std::collections::HashMap<::std::string::String, ::std::string::String>> {
15        self.add_or_update_labels.as_ref()
16    }
17    /// <p>The Kubernetes <code>labels</code> to remove.</p>
18    ///
19    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.remove_labels.is_none()`.
20    pub fn remove_labels(&self) -> &[::std::string::String] {
21        self.remove_labels.as_deref().unwrap_or_default()
22    }
23}
24impl UpdateLabelsPayload {
25    /// Creates a new builder-style object to manufacture [`UpdateLabelsPayload`](crate::types::UpdateLabelsPayload).
26    pub fn builder() -> crate::types::builders::UpdateLabelsPayloadBuilder {
27        crate::types::builders::UpdateLabelsPayloadBuilder::default()
28    }
29}
30
31/// A builder for [`UpdateLabelsPayload`](crate::types::UpdateLabelsPayload).
32#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
33#[non_exhaustive]
34pub struct UpdateLabelsPayloadBuilder {
35    pub(crate) add_or_update_labels: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
36    pub(crate) remove_labels: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
37}
38impl UpdateLabelsPayloadBuilder {
39    /// Adds a key-value pair to `add_or_update_labels`.
40    ///
41    /// To override the contents of this collection use [`set_add_or_update_labels`](Self::set_add_or_update_labels).
42    ///
43    /// <p>The Kubernetes <code>labels</code> to add or update.</p>
44    pub fn add_or_update_labels(
45        mut self,
46        k: impl ::std::convert::Into<::std::string::String>,
47        v: impl ::std::convert::Into<::std::string::String>,
48    ) -> Self {
49        let mut hash_map = self.add_or_update_labels.unwrap_or_default();
50        hash_map.insert(k.into(), v.into());
51        self.add_or_update_labels = ::std::option::Option::Some(hash_map);
52        self
53    }
54    /// <p>The Kubernetes <code>labels</code> to add or update.</p>
55    pub fn set_add_or_update_labels(
56        mut self,
57        input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
58    ) -> Self {
59        self.add_or_update_labels = input;
60        self
61    }
62    /// <p>The Kubernetes <code>labels</code> to add or update.</p>
63    pub fn get_add_or_update_labels(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
64        &self.add_or_update_labels
65    }
66    /// Appends an item to `remove_labels`.
67    ///
68    /// To override the contents of this collection use [`set_remove_labels`](Self::set_remove_labels).
69    ///
70    /// <p>The Kubernetes <code>labels</code> to remove.</p>
71    pub fn remove_labels(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
72        let mut v = self.remove_labels.unwrap_or_default();
73        v.push(input.into());
74        self.remove_labels = ::std::option::Option::Some(v);
75        self
76    }
77    /// <p>The Kubernetes <code>labels</code> to remove.</p>
78    pub fn set_remove_labels(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
79        self.remove_labels = input;
80        self
81    }
82    /// <p>The Kubernetes <code>labels</code> to remove.</p>
83    pub fn get_remove_labels(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
84        &self.remove_labels
85    }
86    /// Consumes the builder and constructs a [`UpdateLabelsPayload`](crate::types::UpdateLabelsPayload).
87    pub fn build(self) -> crate::types::UpdateLabelsPayload {
88        crate::types::UpdateLabelsPayload {
89            add_or_update_labels: self.add_or_update_labels,
90            remove_labels: self.remove_labels,
91        }
92    }
93}