aws_sdk_lookoutvision/operation/detect_anomalies/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::detect_anomalies::_detect_anomalies_output::DetectAnomaliesOutputBuilder;
3
4pub use crate::operation::detect_anomalies::_detect_anomalies_input::DetectAnomaliesInputBuilder;
5
6impl crate::operation::detect_anomalies::builders::DetectAnomaliesInputBuilder {
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::detect_anomalies::DetectAnomaliesOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::detect_anomalies::DetectAnomaliesError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.detect_anomalies();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `DetectAnomalies`.
24///
25/// <p>Detects anomalies in an image that you supply.</p>
26/// <p>The response from <code>DetectAnomalies</code> includes a boolean prediction that the image contains one or more anomalies and a confidence value for the prediction. If the model is an image segmentation model, the response also includes segmentation information for each type of anomaly found in the image.</p><note>
27/// <p>Before calling <code>DetectAnomalies</code>, you must first start your model with the <code>StartModel</code> operation. You are charged for the amount of time, in minutes, that a model runs and for the number of anomaly detection units that your model uses. If you are not using a model, use the <code>StopModel</code> operation to stop your model.</p>
28/// </note>
29/// <p>For more information, see <i>Detecting anomalies in an image</i> in the Amazon Lookout for Vision developer guide.</p>
30/// <p>This operation requires permissions to perform the <code>lookoutvision:DetectAnomalies</code> operation.</p>
31#[derive(::std::fmt::Debug)]
32pub struct DetectAnomaliesFluentBuilder {
33    handle: ::std::sync::Arc<crate::client::Handle>,
34    inner: crate::operation::detect_anomalies::builders::DetectAnomaliesInputBuilder,
35    config_override: ::std::option::Option<crate::config::Builder>,
36}
37impl
38    crate::client::customize::internal::CustomizableSend<
39        crate::operation::detect_anomalies::DetectAnomaliesOutput,
40        crate::operation::detect_anomalies::DetectAnomaliesError,
41    > for DetectAnomaliesFluentBuilder
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::detect_anomalies::DetectAnomaliesOutput,
49            crate::operation::detect_anomalies::DetectAnomaliesError,
50        >,
51    > {
52        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
53    }
54}
55impl DetectAnomaliesFluentBuilder {
56    /// Creates a new `DetectAnomaliesFluentBuilder`.
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 DetectAnomalies as a reference.
65    pub fn as_input(&self) -> &crate::operation::detect_anomalies::builders::DetectAnomaliesInputBuilder {
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::detect_anomalies::DetectAnomaliesOutput,
80        ::aws_smithy_runtime_api::client::result::SdkError<
81            crate::operation::detect_anomalies::DetectAnomaliesError,
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::detect_anomalies::DetectAnomalies::operation_runtime_plugins(
90            self.handle.runtime_plugins.clone(),
91            &self.handle.conf,
92            self.config_override,
93        );
94        crate::operation::detect_anomalies::DetectAnomalies::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::detect_anomalies::DetectAnomaliesOutput,
102        crate::operation::detect_anomalies::DetectAnomaliesError,
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>The name of the project that contains the model version that you want to use.</p>
117    pub fn project_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
118        self.inner = self.inner.project_name(input.into());
119        self
120    }
121    /// <p>The name of the project that contains the model version that you want to use.</p>
122    pub fn set_project_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
123        self.inner = self.inner.set_project_name(input);
124        self
125    }
126    /// <p>The name of the project that contains the model version that you want to use.</p>
127    pub fn get_project_name(&self) -> &::std::option::Option<::std::string::String> {
128        self.inner.get_project_name()
129    }
130    /// <p>The version of the model that you want to use.</p>
131    pub fn model_version(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
132        self.inner = self.inner.model_version(input.into());
133        self
134    }
135    /// <p>The version of the model that you want to use.</p>
136    pub fn set_model_version(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
137        self.inner = self.inner.set_model_version(input);
138        self
139    }
140    /// <p>The version of the model that you want to use.</p>
141    pub fn get_model_version(&self) -> &::std::option::Option<::std::string::String> {
142        self.inner.get_model_version()
143    }
144    /// <p>The unencrypted image bytes that you want to analyze.</p>
145    pub fn body(mut self, input: ::aws_smithy_types::byte_stream::ByteStream) -> Self {
146        self.inner = self.inner.body(input);
147        self
148    }
149    /// <p>The unencrypted image bytes that you want to analyze.</p>
150    pub fn set_body(mut self, input: ::std::option::Option<::aws_smithy_types::byte_stream::ByteStream>) -> Self {
151        self.inner = self.inner.set_body(input);
152        self
153    }
154    /// <p>The unencrypted image bytes that you want to analyze.</p>
155    pub fn get_body(&self) -> &::std::option::Option<::aws_smithy_types::byte_stream::ByteStream> {
156        self.inner.get_body()
157    }
158    /// <p>The type of the image passed in <code>Body</code>. Valid values are <code>image/png</code> (PNG format images) and <code>image/jpeg</code> (JPG format images).</p>
159    pub fn content_type(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
160        self.inner = self.inner.content_type(input.into());
161        self
162    }
163    /// <p>The type of the image passed in <code>Body</code>. Valid values are <code>image/png</code> (PNG format images) and <code>image/jpeg</code> (JPG format images).</p>
164    pub fn set_content_type(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
165        self.inner = self.inner.set_content_type(input);
166        self
167    }
168    /// <p>The type of the image passed in <code>Body</code>. Valid values are <code>image/png</code> (PNG format images) and <code>image/jpeg</code> (JPG format images).</p>
169    pub fn get_content_type(&self) -> &::std::option::Option<::std::string::String> {
170        self.inner.get_content_type()
171    }
172}