aws_sdk_rekognition/operation/create_collection/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::create_collection::_create_collection_output::CreateCollectionOutputBuilder;
3
4pub use crate::operation::create_collection::_create_collection_input::CreateCollectionInputBuilder;
5
6impl crate::operation::create_collection::builders::CreateCollectionInputBuilder {
7    /// Sends a request with this input using the given client.
8    pub async fn send_with(
9        self,
10        client: &crate::Client,
11    ) -> ::std::result::Result<
12        crate::operation::create_collection::CreateCollectionOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::create_collection::CreateCollectionError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.create_collection();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `CreateCollection`.
24///
25/// <p>Creates a collection in an AWS Region. You can add faces to the collection using the <code>IndexFaces</code> operation.</p>
26/// <p>For example, you might create collections, one for each of your application users. A user can then index faces using the <code>IndexFaces</code> operation and persist results in a specific collection. Then, a user can search the collection for faces in the user-specific container.</p>
27/// <p>When you create a collection, it is associated with the latest version of the face model version.</p><note>
28/// <p>Collection names are case-sensitive.</p>
29/// </note>
30/// <p>This operation requires permissions to perform the <code>rekognition:CreateCollection</code> action. If you want to tag your collection, you also require permission to perform the <code>rekognition:TagResource</code> operation.</p>
31#[derive(::std::clone::Clone, ::std::fmt::Debug)]
32pub struct CreateCollectionFluentBuilder {
33    handle: ::std::sync::Arc<crate::client::Handle>,
34    inner: crate::operation::create_collection::builders::CreateCollectionInputBuilder,
35    config_override: ::std::option::Option<crate::config::Builder>,
36}
37impl
38    crate::client::customize::internal::CustomizableSend<
39        crate::operation::create_collection::CreateCollectionOutput,
40        crate::operation::create_collection::CreateCollectionError,
41    > for CreateCollectionFluentBuilder
42{
43    fn send(
44        self,
45        config_override: crate::config::Builder,
46    ) -> crate::client::customize::internal::BoxFuture<
47        crate::client::customize::internal::SendResult<
48            crate::operation::create_collection::CreateCollectionOutput,
49            crate::operation::create_collection::CreateCollectionError,
50        >,
51    > {
52        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
53    }
54}
55impl CreateCollectionFluentBuilder {
56    /// Creates a new `CreateCollectionFluentBuilder`.
57    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
58        Self {
59            handle,
60            inner: ::std::default::Default::default(),
61            config_override: ::std::option::Option::None,
62        }
63    }
64    /// Access the CreateCollection as a reference.
65    pub fn as_input(&self) -> &crate::operation::create_collection::builders::CreateCollectionInputBuilder {
66        &self.inner
67    }
68    /// Sends the request and returns the response.
69    ///
70    /// If an error occurs, an `SdkError` will be returned with additional details that
71    /// can be matched against.
72    ///
73    /// By default, any retryable failures will be retried twice. Retry behavior
74    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
75    /// set when configuring the client.
76    pub async fn send(
77        self,
78    ) -> ::std::result::Result<
79        crate::operation::create_collection::CreateCollectionOutput,
80        ::aws_smithy_runtime_api::client::result::SdkError<
81            crate::operation::create_collection::CreateCollectionError,
82            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
83        >,
84    > {
85        let input = self
86            .inner
87            .build()
88            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
89        let runtime_plugins = crate::operation::create_collection::CreateCollection::operation_runtime_plugins(
90            self.handle.runtime_plugins.clone(),
91            &self.handle.conf,
92            self.config_override,
93        );
94        crate::operation::create_collection::CreateCollection::orchestrate(&runtime_plugins, input).await
95    }
96
97    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
98    pub fn customize(
99        self,
100    ) -> crate::client::customize::CustomizableOperation<
101        crate::operation::create_collection::CreateCollectionOutput,
102        crate::operation::create_collection::CreateCollectionError,
103        Self,
104    > {
105        crate::client::customize::CustomizableOperation::new(self)
106    }
107    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
108        self.set_config_override(::std::option::Option::Some(config_override.into()));
109        self
110    }
111
112    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
113        self.config_override = config_override;
114        self
115    }
116    /// <p>ID for the collection that you are creating.</p>
117    pub fn collection_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
118        self.inner = self.inner.collection_id(input.into());
119        self
120    }
121    /// <p>ID for the collection that you are creating.</p>
122    pub fn set_collection_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
123        self.inner = self.inner.set_collection_id(input);
124        self
125    }
126    /// <p>ID for the collection that you are creating.</p>
127    pub fn get_collection_id(&self) -> &::std::option::Option<::std::string::String> {
128        self.inner.get_collection_id()
129    }
130    ///
131    /// Adds a key-value pair to `Tags`.
132    ///
133    /// To override the contents of this collection use [`set_tags`](Self::set_tags).
134    ///
135    /// <p>A set of tags (key-value pairs) that you want to attach to the collection.</p>
136    pub fn tags(mut self, k: impl ::std::convert::Into<::std::string::String>, v: impl ::std::convert::Into<::std::string::String>) -> Self {
137        self.inner = self.inner.tags(k.into(), v.into());
138        self
139    }
140    /// <p>A set of tags (key-value pairs) that you want to attach to the collection.</p>
141    pub fn set_tags(mut self, input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>) -> Self {
142        self.inner = self.inner.set_tags(input);
143        self
144    }
145    /// <p>A set of tags (key-value pairs) that you want to attach to the collection.</p>
146    pub fn get_tags(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
147        self.inner.get_tags()
148    }
149}