aws_sdk_sagemaker/types/
_tag.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>A tag object that consists of a key and an optional value, used to manage metadata for SageMaker Amazon Web Services resources.</p>
4/// <p>You can add tags to notebook instances, training jobs, hyperparameter tuning jobs, batch transform jobs, models, labeling jobs, work teams, endpoint configurations, and endpoints. For more information on adding tags to SageMaker resources, see <a href="https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_AddTags.html">AddTags</a>.</p>
5/// <p>For more information on adding metadata to your Amazon Web Services resources with tagging, see <a href="https://docs.aws.amazon.com/general/latest/gr/aws_tagging.html">Tagging Amazon Web Services resources</a>. For advice on best practices for managing Amazon Web Services resources with tagging, see <a href="https://d1.awsstatic.com/whitepapers/aws-tagging-best-practices.pdf">Tagging Best Practices: Implement an Effective Amazon Web Services Resource Tagging Strategy</a>.</p>
6#[non_exhaustive]
7#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
8pub struct Tag {
9    /// <p>The tag key. Tag keys must be unique per resource.</p>
10    pub key: ::std::option::Option<::std::string::String>,
11    /// <p>The tag value.</p>
12    pub value: ::std::option::Option<::std::string::String>,
13}
14impl Tag {
15    /// <p>The tag key. Tag keys must be unique per resource.</p>
16    pub fn key(&self) -> ::std::option::Option<&str> {
17        self.key.as_deref()
18    }
19    /// <p>The tag value.</p>
20    pub fn value(&self) -> ::std::option::Option<&str> {
21        self.value.as_deref()
22    }
23}
24impl Tag {
25    /// Creates a new builder-style object to manufacture [`Tag`](crate::types::Tag).
26    pub fn builder() -> crate::types::builders::TagBuilder {
27        crate::types::builders::TagBuilder::default()
28    }
29}
30
31/// A builder for [`Tag`](crate::types::Tag).
32#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
33#[non_exhaustive]
34pub struct TagBuilder {
35    pub(crate) key: ::std::option::Option<::std::string::String>,
36    pub(crate) value: ::std::option::Option<::std::string::String>,
37}
38impl TagBuilder {
39    /// <p>The tag key. Tag keys must be unique per resource.</p>
40    /// This field is required.
41    pub fn key(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
42        self.key = ::std::option::Option::Some(input.into());
43        self
44    }
45    /// <p>The tag key. Tag keys must be unique per resource.</p>
46    pub fn set_key(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
47        self.key = input;
48        self
49    }
50    /// <p>The tag key. Tag keys must be unique per resource.</p>
51    pub fn get_key(&self) -> &::std::option::Option<::std::string::String> {
52        &self.key
53    }
54    /// <p>The tag value.</p>
55    /// This field is required.
56    pub fn value(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
57        self.value = ::std::option::Option::Some(input.into());
58        self
59    }
60    /// <p>The tag value.</p>
61    pub fn set_value(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
62        self.value = input;
63        self
64    }
65    /// <p>The tag value.</p>
66    pub fn get_value(&self) -> &::std::option::Option<::std::string::String> {
67        &self.value
68    }
69    /// Consumes the builder and constructs a [`Tag`](crate::types::Tag).
70    pub fn build(self) -> crate::types::Tag {
71        crate::types::Tag {
72            key: self.key,
73            value: self.value,
74        }
75    }
76}