aws_sdk_directconnect/types/
_tag.rs1#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct Tag {
7 pub key: ::std::string::String,
9 pub value: ::std::option::Option<::std::string::String>,
11}
12impl Tag {
13 pub fn key(&self) -> &str {
15 use std::ops::Deref;
16 self.key.deref()
17 }
18 pub fn value(&self) -> ::std::option::Option<&str> {
20 self.value.as_deref()
21 }
22}
23impl Tag {
24 pub fn builder() -> crate::types::builders::TagBuilder {
26 crate::types::builders::TagBuilder::default()
27 }
28}
29
30#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
32#[non_exhaustive]
33pub struct TagBuilder {
34 pub(crate) key: ::std::option::Option<::std::string::String>,
35 pub(crate) value: ::std::option::Option<::std::string::String>,
36}
37impl TagBuilder {
38 pub fn key(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
41 self.key = ::std::option::Option::Some(input.into());
42 self
43 }
44 pub fn set_key(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
46 self.key = input;
47 self
48 }
49 pub fn get_key(&self) -> &::std::option::Option<::std::string::String> {
51 &self.key
52 }
53 pub fn value(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
55 self.value = ::std::option::Option::Some(input.into());
56 self
57 }
58 pub fn set_value(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
60 self.value = input;
61 self
62 }
63 pub fn get_value(&self) -> &::std::option::Option<::std::string::String> {
65 &self.value
66 }
67 pub fn build(self) -> ::std::result::Result<crate::types::Tag, ::aws_smithy_types::error::operation::BuildError> {
71 ::std::result::Result::Ok(crate::types::Tag {
72 key: self.key.ok_or_else(|| {
73 ::aws_smithy_types::error::operation::BuildError::missing_field("key", "key was not specified but it is required when building Tag")
74 })?,
75 value: self.value,
76 })
77 }
78}