aws_sdk_lookoutvision/operation/stop_model/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::stop_model::_stop_model_output::StopModelOutputBuilder;
3
4pub use crate::operation::stop_model::_stop_model_input::StopModelInputBuilder;
5
6impl crate::operation::stop_model::builders::StopModelInputBuilder {
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::stop_model::StopModelOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::stop_model::StopModelError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.stop_model();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `StopModel`.
24///
25/// <p>Stops the hosting of a running model. The operation might take a while to complete. To check the current status, call <code>DescribeModel</code>.</p>
26/// <p>After the model hosting stops, the <code>Status</code> of the model is <code>TRAINED</code>.</p>
27/// <p>This operation requires permissions to perform the <code>lookoutvision:StopModel</code> operation.</p>
28#[derive(::std::clone::Clone, ::std::fmt::Debug)]
29pub struct StopModelFluentBuilder {
30    handle: ::std::sync::Arc<crate::client::Handle>,
31    inner: crate::operation::stop_model::builders::StopModelInputBuilder,
32    config_override: ::std::option::Option<crate::config::Builder>,
33}
34impl crate::client::customize::internal::CustomizableSend<crate::operation::stop_model::StopModelOutput, crate::operation::stop_model::StopModelError>
35    for StopModelFluentBuilder
36{
37    fn send(
38        self,
39        config_override: crate::config::Builder,
40    ) -> crate::client::customize::internal::BoxFuture<
41        crate::client::customize::internal::SendResult<crate::operation::stop_model::StopModelOutput, crate::operation::stop_model::StopModelError>,
42    > {
43        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
44    }
45}
46impl StopModelFluentBuilder {
47    /// Creates a new `StopModelFluentBuilder`.
48    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
49        Self {
50            handle,
51            inner: ::std::default::Default::default(),
52            config_override: ::std::option::Option::None,
53        }
54    }
55    /// Access the StopModel as a reference.
56    pub fn as_input(&self) -> &crate::operation::stop_model::builders::StopModelInputBuilder {
57        &self.inner
58    }
59    /// Sends the request and returns the response.
60    ///
61    /// If an error occurs, an `SdkError` will be returned with additional details that
62    /// can be matched against.
63    ///
64    /// By default, any retryable failures will be retried twice. Retry behavior
65    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
66    /// set when configuring the client.
67    pub async fn send(
68        self,
69    ) -> ::std::result::Result<
70        crate::operation::stop_model::StopModelOutput,
71        ::aws_smithy_runtime_api::client::result::SdkError<
72            crate::operation::stop_model::StopModelError,
73            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
74        >,
75    > {
76        let input = self
77            .inner
78            .build()
79            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
80        let runtime_plugins = crate::operation::stop_model::StopModel::operation_runtime_plugins(
81            self.handle.runtime_plugins.clone(),
82            &self.handle.conf,
83            self.config_override,
84        );
85        crate::operation::stop_model::StopModel::orchestrate(&runtime_plugins, input).await
86    }
87
88    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
89    pub fn customize(
90        self,
91    ) -> crate::client::customize::CustomizableOperation<
92        crate::operation::stop_model::StopModelOutput,
93        crate::operation::stop_model::StopModelError,
94        Self,
95    > {
96        crate::client::customize::CustomizableOperation::new(self)
97    }
98    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
99        self.set_config_override(::std::option::Option::Some(config_override.into()));
100        self
101    }
102
103    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
104        self.config_override = config_override;
105        self
106    }
107    /// <p>The name of the project that contains the model that you want to stop.</p>
108    pub fn project_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
109        self.inner = self.inner.project_name(input.into());
110        self
111    }
112    /// <p>The name of the project that contains the model that you want to stop.</p>
113    pub fn set_project_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
114        self.inner = self.inner.set_project_name(input);
115        self
116    }
117    /// <p>The name of the project that contains the model that you want to stop.</p>
118    pub fn get_project_name(&self) -> &::std::option::Option<::std::string::String> {
119        self.inner.get_project_name()
120    }
121    /// <p>The version of the model that you want to stop.</p>
122    pub fn model_version(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
123        self.inner = self.inner.model_version(input.into());
124        self
125    }
126    /// <p>The version of the model that you want to stop.</p>
127    pub fn set_model_version(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
128        self.inner = self.inner.set_model_version(input);
129        self
130    }
131    /// <p>The version of the model that you want to stop.</p>
132    pub fn get_model_version(&self) -> &::std::option::Option<::std::string::String> {
133        self.inner.get_model_version()
134    }
135    /// <p>ClientToken is an idempotency token that ensures a call to <code>StopModel</code> completes only once. You choose the value to pass. For example, An issue might prevent you from getting a response from <code>StopModel</code>. In this case, safely retry your call to <code>StopModel</code> by using the same <code>ClientToken</code> parameter value.</p>
136    /// <p>If you don't supply a value for <code>ClientToken</code>, the AWS SDK you are using inserts a value for you. This prevents retries after a network error from making multiple stop requests. You'll need to provide your own value for other use cases.</p>
137    /// <p>An error occurs if the other input parameters are not the same as in the first request. Using a different value for <code>ClientToken</code> is considered a new call to <code>StopModel</code>. An idempotency token is active for 8 hours.</p>
138    pub fn client_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
139        self.inner = self.inner.client_token(input.into());
140        self
141    }
142    /// <p>ClientToken is an idempotency token that ensures a call to <code>StopModel</code> completes only once. You choose the value to pass. For example, An issue might prevent you from getting a response from <code>StopModel</code>. In this case, safely retry your call to <code>StopModel</code> by using the same <code>ClientToken</code> parameter value.</p>
143    /// <p>If you don't supply a value for <code>ClientToken</code>, the AWS SDK you are using inserts a value for you. This prevents retries after a network error from making multiple stop requests. You'll need to provide your own value for other use cases.</p>
144    /// <p>An error occurs if the other input parameters are not the same as in the first request. Using a different value for <code>ClientToken</code> is considered a new call to <code>StopModel</code>. An idempotency token is active for 8 hours.</p>
145    pub fn set_client_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
146        self.inner = self.inner.set_client_token(input);
147        self
148    }
149    /// <p>ClientToken is an idempotency token that ensures a call to <code>StopModel</code> completes only once. You choose the value to pass. For example, An issue might prevent you from getting a response from <code>StopModel</code>. In this case, safely retry your call to <code>StopModel</code> by using the same <code>ClientToken</code> parameter value.</p>
150    /// <p>If you don't supply a value for <code>ClientToken</code>, the AWS SDK you are using inserts a value for you. This prevents retries after a network error from making multiple stop requests. You'll need to provide your own value for other use cases.</p>
151    /// <p>An error occurs if the other input parameters are not the same as in the first request. Using a different value for <code>ClientToken</code> is considered a new call to <code>StopModel</code>. An idempotency token is active for 8 hours.</p>
152    pub fn get_client_token(&self) -> &::std::option::Option<::std::string::String> {
153        self.inner.get_client_token()
154    }
155}