aws_sdk_elasticloadbalancingv2/types/
_tag.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>Information about a tag.</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct Tag {
7    /// <p>The key of the tag.</p>
8    pub key: ::std::option::Option<::std::string::String>,
9    /// <p>The value of the tag.</p>
10    pub value: ::std::option::Option<::std::string::String>,
11}
12impl Tag {
13    /// <p>The key of the tag.</p>
14    pub fn key(&self) -> ::std::option::Option<&str> {
15        self.key.as_deref()
16    }
17    /// <p>The value of the tag.</p>
18    pub fn value(&self) -> ::std::option::Option<&str> {
19        self.value.as_deref()
20    }
21}
22impl Tag {
23    /// Creates a new builder-style object to manufacture [`Tag`](crate::types::Tag).
24    pub fn builder() -> crate::types::builders::TagBuilder {
25        crate::types::builders::TagBuilder::default()
26    }
27}
28
29/// A builder for [`Tag`](crate::types::Tag).
30#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
31#[non_exhaustive]
32pub struct TagBuilder {
33    pub(crate) key: ::std::option::Option<::std::string::String>,
34    pub(crate) value: ::std::option::Option<::std::string::String>,
35}
36impl TagBuilder {
37    /// <p>The key of the tag.</p>
38    /// This field is required.
39    pub fn key(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
40        self.key = ::std::option::Option::Some(input.into());
41        self
42    }
43    /// <p>The key of the tag.</p>
44    pub fn set_key(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
45        self.key = input;
46        self
47    }
48    /// <p>The key of the tag.</p>
49    pub fn get_key(&self) -> &::std::option::Option<::std::string::String> {
50        &self.key
51    }
52    /// <p>The value of the tag.</p>
53    pub fn value(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
54        self.value = ::std::option::Option::Some(input.into());
55        self
56    }
57    /// <p>The value of the tag.</p>
58    pub fn set_value(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
59        self.value = input;
60        self
61    }
62    /// <p>The value of the tag.</p>
63    pub fn get_value(&self) -> &::std::option::Option<::std::string::String> {
64        &self.value
65    }
66    /// Consumes the builder and constructs a [`Tag`](crate::types::Tag).
67    pub fn build(self) -> crate::types::Tag {
68        crate::types::Tag {
69            key: self.key,
70            value: self.value,
71        }
72    }
73}