aws_sdk_rekognition/operation/index_faces/builders.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::index_faces::_index_faces_output::IndexFacesOutputBuilder;
3
4pub use crate::operation::index_faces::_index_faces_input::IndexFacesInputBuilder;
5
6impl crate::operation::index_faces::builders::IndexFacesInputBuilder {
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::index_faces::IndexFacesOutput,
13 ::aws_smithy_runtime_api::client::result::SdkError<
14 crate::operation::index_faces::IndexFacesError,
15 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16 >,
17 > {
18 let mut fluent_builder = client.index_faces();
19 fluent_builder.inner = self;
20 fluent_builder.send().await
21 }
22}
23/// Fluent builder constructing a request to `IndexFaces`.
24///
25/// <p>Detects faces in the input image and adds them to the specified collection.</p>
26/// <p>Amazon Rekognition doesn't save the actual faces that are detected. Instead, the underlying detection algorithm first detects the faces in the input image. For each face, the algorithm extracts facial features into a feature vector, and stores it in the backend database. Amazon Rekognition uses feature vectors when it performs face match and search operations using the <code>SearchFaces</code> and <code>SearchFacesByImage</code> operations.</p>
27/// <p>For more information, see Adding faces to a collection in the Amazon Rekognition Developer Guide.</p>
28/// <p>To get the number of faces in a collection, call <code>DescribeCollection</code>.</p>
29/// <p>If you're using version 1.0 of the face detection model, <code>IndexFaces</code> indexes the 15 largest faces in the input image. Later versions of the face detection model index the 100 largest faces in the input image.</p>
30/// <p>If you're using version 4 or later of the face model, image orientation information is not returned in the <code>OrientationCorrection</code> field.</p>
31/// <p>To determine which version of the model you're using, call <code>DescribeCollection</code> and supply the collection ID. You can also get the model version from the value of <code>FaceModelVersion</code> in the response from <code>IndexFaces</code></p>
32/// <p>For more information, see Model Versioning in the Amazon Rekognition Developer Guide.</p>
33/// <p>If you provide the optional <code>ExternalImageId</code> for the input image you provided, Amazon Rekognition associates this ID with all faces that it detects. When you call the <code>ListFaces</code> operation, the response returns the external ID. You can use this external image ID to create a client-side index to associate the faces with each image. You can then use the index to find all faces in an image.</p>
34/// <p>You can specify the maximum number of faces to index with the <code>MaxFaces</code> input parameter. This is useful when you want to index the largest faces in an image and don't want to index smaller faces, such as those belonging to people standing in the background.</p>
35/// <p>The <code>QualityFilter</code> input parameter allows you to filter out detected faces that don’t meet a required quality bar. The quality bar is based on a variety of common use cases. By default, <code>IndexFaces</code> chooses the quality bar that's used to filter faces. You can also explicitly choose the quality bar. Use <code>QualityFilter</code>, to set the quality bar by specifying <code>LOW</code>, <code>MEDIUM</code>, or <code>HIGH</code>. If you do not want to filter detected faces, specify <code>NONE</code>.</p><note>
36/// <p>To use quality filtering, you need a collection associated with version 3 of the face model or higher. To get the version of the face model associated with a collection, call <code>DescribeCollection</code>.</p>
37/// </note>
38/// <p>Information about faces detected in an image, but not indexed, is returned in an array of <code>UnindexedFace</code> objects, <code>UnindexedFaces</code>. Faces aren't indexed for reasons such as:</p>
39/// <ul>
40/// <li>
41/// <p>The number of faces detected exceeds the value of the <code>MaxFaces</code> request parameter.</p></li>
42/// <li>
43/// <p>The face is too small compared to the image dimensions.</p></li>
44/// <li>
45/// <p>The face is too blurry.</p></li>
46/// <li>
47/// <p>The image is too dark.</p></li>
48/// <li>
49/// <p>The face has an extreme pose.</p></li>
50/// <li>
51/// <p>The face doesn’t have enough detail to be suitable for face search.</p></li>
52/// </ul>
53/// <p>In response, the <code>IndexFaces</code> operation returns an array of metadata for all detected faces, <code>FaceRecords</code>. This includes:</p>
54/// <ul>
55/// <li>
56/// <p>The bounding box, <code>BoundingBox</code>, of the detected face.</p></li>
57/// <li>
58/// <p>A confidence value, <code>Confidence</code>, which indicates the confidence that the bounding box contains a face.</p></li>
59/// <li>
60/// <p>A face ID, <code>FaceId</code>, assigned by the service for each face that's detected and stored.</p></li>
61/// <li>
62/// <p>An image ID, <code>ImageId</code>, assigned by the service for the input image.</p></li>
63/// </ul>
64/// <p>If you request <code>ALL</code> or specific facial attributes (e.g., <code>FACE_OCCLUDED</code>) by using the detectionAttributes parameter, Amazon Rekognition returns detailed facial attributes, such as facial landmarks (for example, location of eye and mouth), facial occlusion, and other facial attributes.</p>
65/// <p>If you provide the same image, specify the same collection, and use the same external ID in the <code>IndexFaces</code> operation, Amazon Rekognition doesn't save duplicate face metadata.</p>
66/// <p></p>
67/// <p>The input image is passed either as base64-encoded image bytes, or as a reference to an image in an Amazon S3 bucket. If you use the AWS CLI to call Amazon Rekognition operations, passing image bytes isn't supported. The image must be formatted as a PNG or JPEG file.</p>
68/// <p>This operation requires permissions to perform the <code>rekognition:IndexFaces</code> action.</p>
69#[derive(::std::clone::Clone, ::std::fmt::Debug)]
70pub struct IndexFacesFluentBuilder {
71 handle: ::std::sync::Arc<crate::client::Handle>,
72 inner: crate::operation::index_faces::builders::IndexFacesInputBuilder,
73 config_override: ::std::option::Option<crate::config::Builder>,
74}
75impl
76 crate::client::customize::internal::CustomizableSend<
77 crate::operation::index_faces::IndexFacesOutput,
78 crate::operation::index_faces::IndexFacesError,
79 > for IndexFacesFluentBuilder
80{
81 fn send(
82 self,
83 config_override: crate::config::Builder,
84 ) -> crate::client::customize::internal::BoxFuture<
85 crate::client::customize::internal::SendResult<
86 crate::operation::index_faces::IndexFacesOutput,
87 crate::operation::index_faces::IndexFacesError,
88 >,
89 > {
90 ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
91 }
92}
93impl IndexFacesFluentBuilder {
94 /// Creates a new `IndexFacesFluentBuilder`.
95 pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
96 Self {
97 handle,
98 inner: ::std::default::Default::default(),
99 config_override: ::std::option::Option::None,
100 }
101 }
102 /// Access the IndexFaces as a reference.
103 pub fn as_input(&self) -> &crate::operation::index_faces::builders::IndexFacesInputBuilder {
104 &self.inner
105 }
106 /// Sends the request and returns the response.
107 ///
108 /// If an error occurs, an `SdkError` will be returned with additional details that
109 /// can be matched against.
110 ///
111 /// By default, any retryable failures will be retried twice. Retry behavior
112 /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
113 /// set when configuring the client.
114 pub async fn send(
115 self,
116 ) -> ::std::result::Result<
117 crate::operation::index_faces::IndexFacesOutput,
118 ::aws_smithy_runtime_api::client::result::SdkError<
119 crate::operation::index_faces::IndexFacesError,
120 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
121 >,
122 > {
123 let input = self
124 .inner
125 .build()
126 .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
127 let runtime_plugins = crate::operation::index_faces::IndexFaces::operation_runtime_plugins(
128 self.handle.runtime_plugins.clone(),
129 &self.handle.conf,
130 self.config_override,
131 );
132 crate::operation::index_faces::IndexFaces::orchestrate(&runtime_plugins, input).await
133 }
134
135 /// Consumes this builder, creating a customizable operation that can be modified before being sent.
136 pub fn customize(
137 self,
138 ) -> crate::client::customize::CustomizableOperation<
139 crate::operation::index_faces::IndexFacesOutput,
140 crate::operation::index_faces::IndexFacesError,
141 Self,
142 > {
143 crate::client::customize::CustomizableOperation::new(self)
144 }
145 pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
146 self.set_config_override(::std::option::Option::Some(config_override.into()));
147 self
148 }
149
150 pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
151 self.config_override = config_override;
152 self
153 }
154 /// <p>The ID of an existing collection to which you want to add the faces that are detected in the input images.</p>
155 pub fn collection_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
156 self.inner = self.inner.collection_id(input.into());
157 self
158 }
159 /// <p>The ID of an existing collection to which you want to add the faces that are detected in the input images.</p>
160 pub fn set_collection_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
161 self.inner = self.inner.set_collection_id(input);
162 self
163 }
164 /// <p>The ID of an existing collection to which you want to add the faces that are detected in the input images.</p>
165 pub fn get_collection_id(&self) -> &::std::option::Option<::std::string::String> {
166 self.inner.get_collection_id()
167 }
168 /// <p>The input image as base64-encoded bytes or an S3 object. If you use the AWS CLI to call Amazon Rekognition operations, passing base64-encoded image bytes isn't supported.</p>
169 /// <p>If you are using an AWS SDK to call Amazon Rekognition, you might not need to base64-encode image bytes passed using the <code>Bytes</code> field. For more information, see Images in the Amazon Rekognition developer guide.</p>
170 pub fn image(mut self, input: crate::types::Image) -> Self {
171 self.inner = self.inner.image(input);
172 self
173 }
174 /// <p>The input image as base64-encoded bytes or an S3 object. If you use the AWS CLI to call Amazon Rekognition operations, passing base64-encoded image bytes isn't supported.</p>
175 /// <p>If you are using an AWS SDK to call Amazon Rekognition, you might not need to base64-encode image bytes passed using the <code>Bytes</code> field. For more information, see Images in the Amazon Rekognition developer guide.</p>
176 pub fn set_image(mut self, input: ::std::option::Option<crate::types::Image>) -> Self {
177 self.inner = self.inner.set_image(input);
178 self
179 }
180 /// <p>The input image as base64-encoded bytes or an S3 object. If you use the AWS CLI to call Amazon Rekognition operations, passing base64-encoded image bytes isn't supported.</p>
181 /// <p>If you are using an AWS SDK to call Amazon Rekognition, you might not need to base64-encode image bytes passed using the <code>Bytes</code> field. For more information, see Images in the Amazon Rekognition developer guide.</p>
182 pub fn get_image(&self) -> &::std::option::Option<crate::types::Image> {
183 self.inner.get_image()
184 }
185 /// <p>The ID you want to assign to all the faces detected in the image.</p>
186 pub fn external_image_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
187 self.inner = self.inner.external_image_id(input.into());
188 self
189 }
190 /// <p>The ID you want to assign to all the faces detected in the image.</p>
191 pub fn set_external_image_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
192 self.inner = self.inner.set_external_image_id(input);
193 self
194 }
195 /// <p>The ID you want to assign to all the faces detected in the image.</p>
196 pub fn get_external_image_id(&self) -> &::std::option::Option<::std::string::String> {
197 self.inner.get_external_image_id()
198 }
199 ///
200 /// Appends an item to `DetectionAttributes`.
201 ///
202 /// To override the contents of this collection use [`set_detection_attributes`](Self::set_detection_attributes).
203 ///
204 /// <p>An array of facial attributes you want to be returned. A <code>DEFAULT</code> subset of facial attributes - <code>BoundingBox</code>, <code>Confidence</code>, <code>Pose</code>, <code>Quality</code>, and <code>Landmarks</code> - will always be returned. You can request for specific facial attributes (in addition to the default list) - by using <code>\["DEFAULT", "FACE_OCCLUDED"\]</code> or just <code>\["FACE_OCCLUDED"\]</code>. You can request for all facial attributes by using <code>\["ALL"\]</code>. Requesting more attributes may increase response time.</p>
205 /// <p>If you provide both, <code>\["ALL", "DEFAULT"\]</code>, the service uses a logical AND operator to determine which attributes to return (in this case, all attributes).</p>
206 pub fn detection_attributes(mut self, input: crate::types::Attribute) -> Self {
207 self.inner = self.inner.detection_attributes(input);
208 self
209 }
210 /// <p>An array of facial attributes you want to be returned. A <code>DEFAULT</code> subset of facial attributes - <code>BoundingBox</code>, <code>Confidence</code>, <code>Pose</code>, <code>Quality</code>, and <code>Landmarks</code> - will always be returned. You can request for specific facial attributes (in addition to the default list) - by using <code>\["DEFAULT", "FACE_OCCLUDED"\]</code> or just <code>\["FACE_OCCLUDED"\]</code>. You can request for all facial attributes by using <code>\["ALL"\]</code>. Requesting more attributes may increase response time.</p>
211 /// <p>If you provide both, <code>\["ALL", "DEFAULT"\]</code>, the service uses a logical AND operator to determine which attributes to return (in this case, all attributes).</p>
212 pub fn set_detection_attributes(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Attribute>>) -> Self {
213 self.inner = self.inner.set_detection_attributes(input);
214 self
215 }
216 /// <p>An array of facial attributes you want to be returned. A <code>DEFAULT</code> subset of facial attributes - <code>BoundingBox</code>, <code>Confidence</code>, <code>Pose</code>, <code>Quality</code>, and <code>Landmarks</code> - will always be returned. You can request for specific facial attributes (in addition to the default list) - by using <code>\["DEFAULT", "FACE_OCCLUDED"\]</code> or just <code>\["FACE_OCCLUDED"\]</code>. You can request for all facial attributes by using <code>\["ALL"\]</code>. Requesting more attributes may increase response time.</p>
217 /// <p>If you provide both, <code>\["ALL", "DEFAULT"\]</code>, the service uses a logical AND operator to determine which attributes to return (in this case, all attributes).</p>
218 pub fn get_detection_attributes(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Attribute>> {
219 self.inner.get_detection_attributes()
220 }
221 /// <p>The maximum number of faces to index. The value of <code>MaxFaces</code> must be greater than or equal to 1. <code>IndexFaces</code> returns no more than 100 detected faces in an image, even if you specify a larger value for <code>MaxFaces</code>.</p>
222 /// <p>If <code>IndexFaces</code> detects more faces than the value of <code>MaxFaces</code>, the faces with the lowest quality are filtered out first. If there are still more faces than the value of <code>MaxFaces</code>, the faces with the smallest bounding boxes are filtered out (up to the number that's needed to satisfy the value of <code>MaxFaces</code>). Information about the unindexed faces is available in the <code>UnindexedFaces</code> array.</p>
223 /// <p>The faces that are returned by <code>IndexFaces</code> are sorted by the largest face bounding box size to the smallest size, in descending order.</p>
224 /// <p><code>MaxFaces</code> can be used with a collection associated with any version of the face model.</p>
225 pub fn max_faces(mut self, input: i32) -> Self {
226 self.inner = self.inner.max_faces(input);
227 self
228 }
229 /// <p>The maximum number of faces to index. The value of <code>MaxFaces</code> must be greater than or equal to 1. <code>IndexFaces</code> returns no more than 100 detected faces in an image, even if you specify a larger value for <code>MaxFaces</code>.</p>
230 /// <p>If <code>IndexFaces</code> detects more faces than the value of <code>MaxFaces</code>, the faces with the lowest quality are filtered out first. If there are still more faces than the value of <code>MaxFaces</code>, the faces with the smallest bounding boxes are filtered out (up to the number that's needed to satisfy the value of <code>MaxFaces</code>). Information about the unindexed faces is available in the <code>UnindexedFaces</code> array.</p>
231 /// <p>The faces that are returned by <code>IndexFaces</code> are sorted by the largest face bounding box size to the smallest size, in descending order.</p>
232 /// <p><code>MaxFaces</code> can be used with a collection associated with any version of the face model.</p>
233 pub fn set_max_faces(mut self, input: ::std::option::Option<i32>) -> Self {
234 self.inner = self.inner.set_max_faces(input);
235 self
236 }
237 /// <p>The maximum number of faces to index. The value of <code>MaxFaces</code> must be greater than or equal to 1. <code>IndexFaces</code> returns no more than 100 detected faces in an image, even if you specify a larger value for <code>MaxFaces</code>.</p>
238 /// <p>If <code>IndexFaces</code> detects more faces than the value of <code>MaxFaces</code>, the faces with the lowest quality are filtered out first. If there are still more faces than the value of <code>MaxFaces</code>, the faces with the smallest bounding boxes are filtered out (up to the number that's needed to satisfy the value of <code>MaxFaces</code>). Information about the unindexed faces is available in the <code>UnindexedFaces</code> array.</p>
239 /// <p>The faces that are returned by <code>IndexFaces</code> are sorted by the largest face bounding box size to the smallest size, in descending order.</p>
240 /// <p><code>MaxFaces</code> can be used with a collection associated with any version of the face model.</p>
241 pub fn get_max_faces(&self) -> &::std::option::Option<i32> {
242 self.inner.get_max_faces()
243 }
244 /// <p>A filter that specifies a quality bar for how much filtering is done to identify faces. Filtered faces aren't indexed. If you specify <code>AUTO</code>, Amazon Rekognition chooses the quality bar. If you specify <code>LOW</code>, <code>MEDIUM</code>, or <code>HIGH</code>, filtering removes all faces that don’t meet the chosen quality bar. The default value is <code>AUTO</code>. The quality bar is based on a variety of common use cases. Low-quality detections can occur for a number of reasons. Some examples are an object that's misidentified as a face, a face that's too blurry, or a face with a pose that's too extreme to use. If you specify <code>NONE</code>, no filtering is performed.</p>
245 /// <p>To use quality filtering, the collection you are using must be associated with version 3 of the face model or higher.</p>
246 pub fn quality_filter(mut self, input: crate::types::QualityFilter) -> Self {
247 self.inner = self.inner.quality_filter(input);
248 self
249 }
250 /// <p>A filter that specifies a quality bar for how much filtering is done to identify faces. Filtered faces aren't indexed. If you specify <code>AUTO</code>, Amazon Rekognition chooses the quality bar. If you specify <code>LOW</code>, <code>MEDIUM</code>, or <code>HIGH</code>, filtering removes all faces that don’t meet the chosen quality bar. The default value is <code>AUTO</code>. The quality bar is based on a variety of common use cases. Low-quality detections can occur for a number of reasons. Some examples are an object that's misidentified as a face, a face that's too blurry, or a face with a pose that's too extreme to use. If you specify <code>NONE</code>, no filtering is performed.</p>
251 /// <p>To use quality filtering, the collection you are using must be associated with version 3 of the face model or higher.</p>
252 pub fn set_quality_filter(mut self, input: ::std::option::Option<crate::types::QualityFilter>) -> Self {
253 self.inner = self.inner.set_quality_filter(input);
254 self
255 }
256 /// <p>A filter that specifies a quality bar for how much filtering is done to identify faces. Filtered faces aren't indexed. If you specify <code>AUTO</code>, Amazon Rekognition chooses the quality bar. If you specify <code>LOW</code>, <code>MEDIUM</code>, or <code>HIGH</code>, filtering removes all faces that don’t meet the chosen quality bar. The default value is <code>AUTO</code>. The quality bar is based on a variety of common use cases. Low-quality detections can occur for a number of reasons. Some examples are an object that's misidentified as a face, a face that's too blurry, or a face with a pose that's too extreme to use. If you specify <code>NONE</code>, no filtering is performed.</p>
257 /// <p>To use quality filtering, the collection you are using must be associated with version 3 of the face model or higher.</p>
258 pub fn get_quality_filter(&self) -> &::std::option::Option<crate::types::QualityFilter> {
259 self.inner.get_quality_filter()
260 }
261}