aws_sdk_rekognition/operation/create_collection/
_create_collection_input.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2#[allow(missing_docs)] // documentation missing in model
3#[non_exhaustive]
4#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
5pub struct CreateCollectionInput {
6    /// <p>ID for the collection that you are creating.</p>
7    pub collection_id: ::std::option::Option<::std::string::String>,
8    /// <p>A set of tags (key-value pairs) that you want to attach to the collection.</p>
9    pub tags: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
10}
11impl CreateCollectionInput {
12    /// <p>ID for the collection that you are creating.</p>
13    pub fn collection_id(&self) -> ::std::option::Option<&str> {
14        self.collection_id.as_deref()
15    }
16    /// <p>A set of tags (key-value pairs) that you want to attach to the collection.</p>
17    pub fn tags(&self) -> ::std::option::Option<&::std::collections::HashMap<::std::string::String, ::std::string::String>> {
18        self.tags.as_ref()
19    }
20}
21impl CreateCollectionInput {
22    /// Creates a new builder-style object to manufacture [`CreateCollectionInput`](crate::operation::create_collection::CreateCollectionInput).
23    pub fn builder() -> crate::operation::create_collection::builders::CreateCollectionInputBuilder {
24        crate::operation::create_collection::builders::CreateCollectionInputBuilder::default()
25    }
26}
27
28/// A builder for [`CreateCollectionInput`](crate::operation::create_collection::CreateCollectionInput).
29#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
30#[non_exhaustive]
31pub struct CreateCollectionInputBuilder {
32    pub(crate) collection_id: ::std::option::Option<::std::string::String>,
33    pub(crate) tags: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
34}
35impl CreateCollectionInputBuilder {
36    /// <p>ID for the collection that you are creating.</p>
37    /// This field is required.
38    pub fn collection_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
39        self.collection_id = ::std::option::Option::Some(input.into());
40        self
41    }
42    /// <p>ID for the collection that you are creating.</p>
43    pub fn set_collection_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
44        self.collection_id = input;
45        self
46    }
47    /// <p>ID for the collection that you are creating.</p>
48    pub fn get_collection_id(&self) -> &::std::option::Option<::std::string::String> {
49        &self.collection_id
50    }
51    /// Adds a key-value pair to `tags`.
52    ///
53    /// To override the contents of this collection use [`set_tags`](Self::set_tags).
54    ///
55    /// <p>A set of tags (key-value pairs) that you want to attach to the collection.</p>
56    pub fn tags(mut self, k: impl ::std::convert::Into<::std::string::String>, v: impl ::std::convert::Into<::std::string::String>) -> Self {
57        let mut hash_map = self.tags.unwrap_or_default();
58        hash_map.insert(k.into(), v.into());
59        self.tags = ::std::option::Option::Some(hash_map);
60        self
61    }
62    /// <p>A set of tags (key-value pairs) that you want to attach to the collection.</p>
63    pub fn set_tags(mut self, input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>) -> Self {
64        self.tags = input;
65        self
66    }
67    /// <p>A set of tags (key-value pairs) that you want to attach to the collection.</p>
68    pub fn get_tags(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
69        &self.tags
70    }
71    /// Consumes the builder and constructs a [`CreateCollectionInput`](crate::operation::create_collection::CreateCollectionInput).
72    pub fn build(
73        self,
74    ) -> ::std::result::Result<crate::operation::create_collection::CreateCollectionInput, ::aws_smithy_types::error::operation::BuildError> {
75        ::std::result::Result::Ok(crate::operation::create_collection::CreateCollectionInput {
76            collection_id: self.collection_id,
77            tags: self.tags,
78        })
79    }
80}