Skip to main content

aws_sdk_docdb/types/
_tag.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>Metadata assigned to an Amazon DocumentDB resource consisting of a key-value pair.</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct Tag {
7    /// <p>The required name of the tag. The string value can be from 1 to 128 Unicode characters in length and can't be prefixed with "aws:" or "rds:". The string can contain only the set of Unicode letters, digits, white space, '_', '.', '/', '=', '+', '-' (Java regex: "^(\[\\p{L}\\p{Z}\\p{N}_.:/=+\\-\]*)$").</p>
8    pub key: ::std::option::Option<::std::string::String>,
9    /// <p>The optional value of the tag. The string value can be from 1 to 256 Unicode characters in length and can't be prefixed with "aws:" or "rds:". The string can contain only the set of Unicode letters, digits, white space, '_', '.', '/', '=', '+', '-' (Java regex: "^(\[\\p{L}\\p{Z}\\p{N}_.:/=+\\-\]*)$").</p>
10    pub value: ::std::option::Option<::std::string::String>,
11}
12impl Tag {
13    /// <p>The required name of the tag. The string value can be from 1 to 128 Unicode characters in length and can't be prefixed with "aws:" or "rds:". The string can contain only the set of Unicode letters, digits, white space, '_', '.', '/', '=', '+', '-' (Java regex: "^(\[\\p{L}\\p{Z}\\p{N}_.:/=+\\-\]*)$").</p>
14    pub fn key(&self) -> ::std::option::Option<&str> {
15        self.key.as_deref()
16    }
17    /// <p>The optional value of the tag. The string value can be from 1 to 256 Unicode characters in length and can't be prefixed with "aws:" or "rds:". The string can contain only the set of Unicode letters, digits, white space, '_', '.', '/', '=', '+', '-' (Java regex: "^(\[\\p{L}\\p{Z}\\p{N}_.:/=+\\-\]*)$").</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 required name of the tag. The string value can be from 1 to 128 Unicode characters in length and can't be prefixed with "aws:" or "rds:". The string can contain only the set of Unicode letters, digits, white space, '_', '.', '/', '=', '+', '-' (Java regex: "^(\[\\p{L}\\p{Z}\\p{N}_.:/=+\\-\]*)$").</p>
38    pub fn key(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
39        self.key = ::std::option::Option::Some(input.into());
40        self
41    }
42    /// <p>The required name of the tag. The string value can be from 1 to 128 Unicode characters in length and can't be prefixed with "aws:" or "rds:". The string can contain only the set of Unicode letters, digits, white space, '_', '.', '/', '=', '+', '-' (Java regex: "^(\[\\p{L}\\p{Z}\\p{N}_.:/=+\\-\]*)$").</p>
43    pub fn set_key(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
44        self.key = input;
45        self
46    }
47    /// <p>The required name of the tag. The string value can be from 1 to 128 Unicode characters in length and can't be prefixed with "aws:" or "rds:". The string can contain only the set of Unicode letters, digits, white space, '_', '.', '/', '=', '+', '-' (Java regex: "^(\[\\p{L}\\p{Z}\\p{N}_.:/=+\\-\]*)$").</p>
48    pub fn get_key(&self) -> &::std::option::Option<::std::string::String> {
49        &self.key
50    }
51    /// <p>The optional value of the tag. The string value can be from 1 to 256 Unicode characters in length and can't be prefixed with "aws:" or "rds:". The string can contain only the set of Unicode letters, digits, white space, '_', '.', '/', '=', '+', '-' (Java regex: "^(\[\\p{L}\\p{Z}\\p{N}_.:/=+\\-\]*)$").</p>
52    pub fn value(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
53        self.value = ::std::option::Option::Some(input.into());
54        self
55    }
56    /// <p>The optional value of the tag. The string value can be from 1 to 256 Unicode characters in length and can't be prefixed with "aws:" or "rds:". The string can contain only the set of Unicode letters, digits, white space, '_', '.', '/', '=', '+', '-' (Java regex: "^(\[\\p{L}\\p{Z}\\p{N}_.:/=+\\-\]*)$").</p>
57    pub fn set_value(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
58        self.value = input;
59        self
60    }
61    /// <p>The optional value of the tag. The string value can be from 1 to 256 Unicode characters in length and can't be prefixed with "aws:" or "rds:". The string can contain only the set of Unicode letters, digits, white space, '_', '.', '/', '=', '+', '-' (Java regex: "^(\[\\p{L}\\p{Z}\\p{N}_.:/=+\\-\]*)$").</p>
62    pub fn get_value(&self) -> &::std::option::Option<::std::string::String> {
63        &self.value
64    }
65    /// Consumes the builder and constructs a [`Tag`](crate::types::Tag).
66    pub fn build(self) -> crate::types::Tag {
67        crate::types::Tag {
68            key: self.key,
69            value: self.value,
70        }
71    }
72}