aws_sdk_codestarconnections/types/
_tag.rs1#[non_exhaustive]
6#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
7pub struct Tag {
8 pub key: ::std::string::String,
10 pub value: ::std::string::String,
12}
13impl Tag {
14 pub fn key(&self) -> &str {
16 use std::ops::Deref;
17 self.key.deref()
18 }
19 pub fn value(&self) -> &str {
21 use std::ops::Deref;
22 self.value.deref()
23 }
24}
25impl Tag {
26 pub fn builder() -> crate::types::builders::TagBuilder {
28 crate::types::builders::TagBuilder::default()
29 }
30}
31
32#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
34#[non_exhaustive]
35pub struct TagBuilder {
36 pub(crate) key: ::std::option::Option<::std::string::String>,
37 pub(crate) value: ::std::option::Option<::std::string::String>,
38}
39impl TagBuilder {
40 pub fn key(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
43 self.key = ::std::option::Option::Some(input.into());
44 self
45 }
46 pub fn set_key(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
48 self.key = input;
49 self
50 }
51 pub fn get_key(&self) -> &::std::option::Option<::std::string::String> {
53 &self.key
54 }
55 pub fn value(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
58 self.value = ::std::option::Option::Some(input.into());
59 self
60 }
61 pub fn set_value(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
63 self.value = input;
64 self
65 }
66 pub fn get_value(&self) -> &::std::option::Option<::std::string::String> {
68 &self.value
69 }
70 pub fn build(self) -> ::std::result::Result<crate::types::Tag, ::aws_smithy_types::error::operation::BuildError> {
75 ::std::result::Result::Ok(crate::types::Tag {
76 key: self.key.ok_or_else(|| {
77 ::aws_smithy_types::error::operation::BuildError::missing_field("key", "key was not specified but it is required when building Tag")
78 })?,
79 value: self.value.ok_or_else(|| {
80 ::aws_smithy_types::error::operation::BuildError::missing_field(
81 "value",
82 "value was not specified but it is required when building Tag",
83 )
84 })?,
85 })
86 }
87}