Skip to main content

aws_sdk_s3control/types/
_tagging.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p></p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct Tagging {
7    /// <p>A collection for a set of tags.</p>
8    pub tag_set: ::std::vec::Vec<crate::types::S3Tag>,
9}
10impl Tagging {
11    /// <p>A collection for a set of tags.</p>
12    pub fn tag_set(&self) -> &[crate::types::S3Tag] {
13        use std::ops::Deref;
14        self.tag_set.deref()
15    }
16}
17impl Tagging {
18    /// Creates a new builder-style object to manufacture [`Tagging`](crate::types::Tagging).
19    pub fn builder() -> crate::types::builders::TaggingBuilder {
20        crate::types::builders::TaggingBuilder::default()
21    }
22}
23
24/// A builder for [`Tagging`](crate::types::Tagging).
25#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
26#[non_exhaustive]
27pub struct TaggingBuilder {
28    pub(crate) tag_set: ::std::option::Option<::std::vec::Vec<crate::types::S3Tag>>,
29}
30impl TaggingBuilder {
31    /// Appends an item to `tag_set`.
32    ///
33    /// To override the contents of this collection use [`set_tag_set`](Self::set_tag_set).
34    ///
35    /// <p>A collection for a set of tags.</p>
36    pub fn tag_set(mut self, input: crate::types::S3Tag) -> Self {
37        let mut v = self.tag_set.unwrap_or_default();
38        v.push(input);
39        self.tag_set = ::std::option::Option::Some(v);
40        self
41    }
42    /// <p>A collection for a set of tags.</p>
43    pub fn set_tag_set(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::S3Tag>>) -> Self {
44        self.tag_set = input;
45        self
46    }
47    /// <p>A collection for a set of tags.</p>
48    pub fn get_tag_set(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::S3Tag>> {
49        &self.tag_set
50    }
51    /// Consumes the builder and constructs a [`Tagging`](crate::types::Tagging).
52    /// This method will fail if any of the following fields are not set:
53    /// - [`tag_set`](crate::types::builders::TaggingBuilder::tag_set)
54    pub fn build(self) -> ::std::result::Result<crate::types::Tagging, ::aws_smithy_types::error::operation::BuildError> {
55        ::std::result::Result::Ok(crate::types::Tagging {
56            tag_set: self.tag_set.ok_or_else(|| {
57                ::aws_smithy_types::error::operation::BuildError::missing_field(
58                    "tag_set",
59                    "tag_set was not specified but it is required when building Tagging",
60                )
61            })?,
62        })
63    }
64}