aws_sdk_rekognition/operation/get_label_detection/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::get_label_detection::_get_label_detection_output::GetLabelDetectionOutputBuilder;
3
4pub use crate::operation::get_label_detection::_get_label_detection_input::GetLabelDetectionInputBuilder;
5
6impl crate::operation::get_label_detection::builders::GetLabelDetectionInputBuilder {
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::get_label_detection::GetLabelDetectionOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::get_label_detection::GetLabelDetectionError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.get_label_detection();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `GetLabelDetection`.
24///
25/// <p>Gets the label detection results of a Amazon Rekognition Video analysis started by <code>StartLabelDetection</code>.</p>
26/// <p>The label detection operation is started by a call to <code>StartLabelDetection</code> which returns a job identifier (<code>JobId</code>). When the label detection operation finishes, Amazon Rekognition publishes a completion status to the Amazon Simple Notification Service topic registered in the initial call to <code>StartlabelDetection</code>.</p>
27/// <p>To get the results of the label detection operation, first check that the status value published to the Amazon SNS topic is <code>SUCCEEDED</code>. If so, call <code>GetLabelDetection</code> and pass the job identifier (<code>JobId</code>) from the initial call to <code>StartLabelDetection</code>.</p>
28/// <p><code>GetLabelDetection</code> returns an array of detected labels (<code>Labels</code>) sorted by the time the labels were detected. You can also sort by the label name by specifying <code>NAME</code> for the <code>SortBy</code> input parameter. If there is no <code>NAME</code> specified, the default sort is by timestamp.</p>
29/// <p>You can select how results are aggregated by using the <code>AggregateBy</code> input parameter. The default aggregation method is <code>TIMESTAMPS</code>. You can also aggregate by <code>SEGMENTS</code>, which aggregates all instances of labels detected in a given segment.</p>
30/// <p>The returned Labels array may include the following attributes:</p>
31/// <ul>
32/// <li>
33/// <p>Name - The name of the detected label.</p></li>
34/// <li>
35/// <p>Confidence - The level of confidence in the label assigned to a detected object.</p></li>
36/// <li>
37/// <p>Parents - The ancestor labels for a detected label. GetLabelDetection returns a hierarchical taxonomy of detected labels. For example, a detected car might be assigned the label car. The label car has two parent labels: Vehicle (its parent) and Transportation (its grandparent). The response includes the all ancestors for a label, where every ancestor is a unique label. In the previous example, Car, Vehicle, and Transportation are returned as unique labels in the response.</p></li>
38/// <li>
39/// <p>Aliases - Possible Aliases for the label.</p></li>
40/// <li>
41/// <p>Categories - The label categories that the detected label belongs to.</p></li>
42/// <li>
43/// <p>BoundingBox — Bounding boxes are described for all instances of detected common object labels, returned in an array of Instance objects. An Instance object contains a BoundingBox object, describing the location of the label on the input image. It also includes the confidence for the accuracy of the detected bounding box.</p></li>
44/// <li>
45/// <p>Timestamp - Time, in milliseconds from the start of the video, that the label was detected. For aggregation by <code>SEGMENTS</code>, the <code>StartTimestampMillis</code>, <code>EndTimestampMillis</code>, and <code>DurationMillis</code> structures are what define a segment. Although the “Timestamp” structure is still returned with each label, its value is set to be the same as <code>StartTimestampMillis</code>.</p></li>
46/// </ul>
47/// <p>Timestamp and Bounding box information are returned for detected Instances, only if aggregation is done by <code>TIMESTAMPS</code>. If aggregating by <code>SEGMENTS</code>, information about detected instances isn’t returned.</p>
48/// <p>The version of the label model used for the detection is also returned.</p>
49/// <p><b>Note <code>DominantColors</code> isn't returned for <code>Instances</code>, although it is shown as part of the response in the sample seen below.</b></p>
50/// <p>Use <code>MaxResults</code> parameter to limit the number of labels returned. If there are more results than specified in <code>MaxResults</code>, the value of <code>NextToken</code> in the operation response contains a pagination token for getting the next set of results. To get the next page of results, call <code>GetlabelDetection</code> and populate the <code>NextToken</code> request parameter with the token value returned from the previous call to <code>GetLabelDetection</code>.</p>
51/// <p>If you are retrieving results while using the Amazon Simple Notification Service, note that you will receive an "ERROR" notification if the job encounters an issue.</p>
52#[derive(::std::clone::Clone, ::std::fmt::Debug)]
53pub struct GetLabelDetectionFluentBuilder {
54    handle: ::std::sync::Arc<crate::client::Handle>,
55    inner: crate::operation::get_label_detection::builders::GetLabelDetectionInputBuilder,
56    config_override: ::std::option::Option<crate::config::Builder>,
57}
58impl
59    crate::client::customize::internal::CustomizableSend<
60        crate::operation::get_label_detection::GetLabelDetectionOutput,
61        crate::operation::get_label_detection::GetLabelDetectionError,
62    > for GetLabelDetectionFluentBuilder
63{
64    fn send(
65        self,
66        config_override: crate::config::Builder,
67    ) -> crate::client::customize::internal::BoxFuture<
68        crate::client::customize::internal::SendResult<
69            crate::operation::get_label_detection::GetLabelDetectionOutput,
70            crate::operation::get_label_detection::GetLabelDetectionError,
71        >,
72    > {
73        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
74    }
75}
76impl GetLabelDetectionFluentBuilder {
77    /// Creates a new `GetLabelDetectionFluentBuilder`.
78    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
79        Self {
80            handle,
81            inner: ::std::default::Default::default(),
82            config_override: ::std::option::Option::None,
83        }
84    }
85    /// Access the GetLabelDetection as a reference.
86    pub fn as_input(&self) -> &crate::operation::get_label_detection::builders::GetLabelDetectionInputBuilder {
87        &self.inner
88    }
89    /// Sends the request and returns the response.
90    ///
91    /// If an error occurs, an `SdkError` will be returned with additional details that
92    /// can be matched against.
93    ///
94    /// By default, any retryable failures will be retried twice. Retry behavior
95    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
96    /// set when configuring the client.
97    pub async fn send(
98        self,
99    ) -> ::std::result::Result<
100        crate::operation::get_label_detection::GetLabelDetectionOutput,
101        ::aws_smithy_runtime_api::client::result::SdkError<
102            crate::operation::get_label_detection::GetLabelDetectionError,
103            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
104        >,
105    > {
106        let input = self
107            .inner
108            .build()
109            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
110        let runtime_plugins = crate::operation::get_label_detection::GetLabelDetection::operation_runtime_plugins(
111            self.handle.runtime_plugins.clone(),
112            &self.handle.conf,
113            self.config_override,
114        );
115        crate::operation::get_label_detection::GetLabelDetection::orchestrate(&runtime_plugins, input).await
116    }
117
118    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
119    pub fn customize(
120        self,
121    ) -> crate::client::customize::CustomizableOperation<
122        crate::operation::get_label_detection::GetLabelDetectionOutput,
123        crate::operation::get_label_detection::GetLabelDetectionError,
124        Self,
125    > {
126        crate::client::customize::CustomizableOperation::new(self)
127    }
128    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
129        self.set_config_override(::std::option::Option::Some(config_override.into()));
130        self
131    }
132
133    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
134        self.config_override = config_override;
135        self
136    }
137    /// Create a paginator for this request
138    ///
139    /// Paginators are used by calling [`send().await`](crate::operation::get_label_detection::paginator::GetLabelDetectionPaginator::send) which returns a [`PaginationStream`](aws_smithy_async::future::pagination_stream::PaginationStream).
140    pub fn into_paginator(self) -> crate::operation::get_label_detection::paginator::GetLabelDetectionPaginator {
141        crate::operation::get_label_detection::paginator::GetLabelDetectionPaginator::new(self.handle, self.inner)
142    }
143    /// <p>Job identifier for the label detection operation for which you want results returned. You get the job identifer from an initial call to <code>StartlabelDetection</code>.</p>
144    pub fn job_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
145        self.inner = self.inner.job_id(input.into());
146        self
147    }
148    /// <p>Job identifier for the label detection operation for which you want results returned. You get the job identifer from an initial call to <code>StartlabelDetection</code>.</p>
149    pub fn set_job_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
150        self.inner = self.inner.set_job_id(input);
151        self
152    }
153    /// <p>Job identifier for the label detection operation for which you want results returned. You get the job identifer from an initial call to <code>StartlabelDetection</code>.</p>
154    pub fn get_job_id(&self) -> &::std::option::Option<::std::string::String> {
155        self.inner.get_job_id()
156    }
157    /// <p>Maximum number of results to return per paginated call. The largest value you can specify is 1000. If you specify a value greater than 1000, a maximum of 1000 results is returned. The default value is 1000.</p>
158    pub fn max_results(mut self, input: i32) -> Self {
159        self.inner = self.inner.max_results(input);
160        self
161    }
162    /// <p>Maximum number of results to return per paginated call. The largest value you can specify is 1000. If you specify a value greater than 1000, a maximum of 1000 results is returned. The default value is 1000.</p>
163    pub fn set_max_results(mut self, input: ::std::option::Option<i32>) -> Self {
164        self.inner = self.inner.set_max_results(input);
165        self
166    }
167    /// <p>Maximum number of results to return per paginated call. The largest value you can specify is 1000. If you specify a value greater than 1000, a maximum of 1000 results is returned. The default value is 1000.</p>
168    pub fn get_max_results(&self) -> &::std::option::Option<i32> {
169        self.inner.get_max_results()
170    }
171    /// <p>If the previous response was incomplete (because there are more labels to retrieve), Amazon Rekognition Video returns a pagination token in the response. You can use this pagination token to retrieve the next set of labels.</p>
172    pub fn next_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
173        self.inner = self.inner.next_token(input.into());
174        self
175    }
176    /// <p>If the previous response was incomplete (because there are more labels to retrieve), Amazon Rekognition Video returns a pagination token in the response. You can use this pagination token to retrieve the next set of labels.</p>
177    pub fn set_next_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
178        self.inner = self.inner.set_next_token(input);
179        self
180    }
181    /// <p>If the previous response was incomplete (because there are more labels to retrieve), Amazon Rekognition Video returns a pagination token in the response. You can use this pagination token to retrieve the next set of labels.</p>
182    pub fn get_next_token(&self) -> &::std::option::Option<::std::string::String> {
183        self.inner.get_next_token()
184    }
185    /// <p>Sort to use for elements in the <code>Labels</code> array. Use <code>TIMESTAMP</code> to sort array elements by the time labels are detected. Use <code>NAME</code> to alphabetically group elements for a label together. Within each label group, the array element are sorted by detection confidence. The default sort is by <code>TIMESTAMP</code>.</p>
186    pub fn sort_by(mut self, input: crate::types::LabelDetectionSortBy) -> Self {
187        self.inner = self.inner.sort_by(input);
188        self
189    }
190    /// <p>Sort to use for elements in the <code>Labels</code> array. Use <code>TIMESTAMP</code> to sort array elements by the time labels are detected. Use <code>NAME</code> to alphabetically group elements for a label together. Within each label group, the array element are sorted by detection confidence. The default sort is by <code>TIMESTAMP</code>.</p>
191    pub fn set_sort_by(mut self, input: ::std::option::Option<crate::types::LabelDetectionSortBy>) -> Self {
192        self.inner = self.inner.set_sort_by(input);
193        self
194    }
195    /// <p>Sort to use for elements in the <code>Labels</code> array. Use <code>TIMESTAMP</code> to sort array elements by the time labels are detected. Use <code>NAME</code> to alphabetically group elements for a label together. Within each label group, the array element are sorted by detection confidence. The default sort is by <code>TIMESTAMP</code>.</p>
196    pub fn get_sort_by(&self) -> &::std::option::Option<crate::types::LabelDetectionSortBy> {
197        self.inner.get_sort_by()
198    }
199    /// <p>Defines how to aggregate the returned results. Results can be aggregated by timestamps or segments.</p>
200    pub fn aggregate_by(mut self, input: crate::types::LabelDetectionAggregateBy) -> Self {
201        self.inner = self.inner.aggregate_by(input);
202        self
203    }
204    /// <p>Defines how to aggregate the returned results. Results can be aggregated by timestamps or segments.</p>
205    pub fn set_aggregate_by(mut self, input: ::std::option::Option<crate::types::LabelDetectionAggregateBy>) -> Self {
206        self.inner = self.inner.set_aggregate_by(input);
207        self
208    }
209    /// <p>Defines how to aggregate the returned results. Results can be aggregated by timestamps or segments.</p>
210    pub fn get_aggregate_by(&self) -> &::std::option::Option<crate::types::LabelDetectionAggregateBy> {
211        self.inner.get_aggregate_by()
212    }
213}