aws_sdk_personalize/operation/create_recommender/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::create_recommender::_create_recommender_output::CreateRecommenderOutputBuilder;
3
4pub use crate::operation::create_recommender::_create_recommender_input::CreateRecommenderInputBuilder;
5
6impl crate::operation::create_recommender::builders::CreateRecommenderInputBuilder {
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_recommender::CreateRecommenderOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::create_recommender::CreateRecommenderError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.create_recommender();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `CreateRecommender`.
24///
25/// <p>Creates a recommender with the recipe (a Domain dataset group use case) you specify. You create recommenders for a Domain dataset group and specify the recommender's Amazon Resource Name (ARN) when you make a <a href="https://docs.aws.amazon.com/personalize/latest/dg/API_RS_GetRecommendations.html">GetRecommendations</a> request.</p>
26/// <p><b>Minimum recommendation requests per second</b></p><important>
27/// <p>A high <code>minRecommendationRequestsPerSecond</code> will increase your bill. We recommend starting with 1 for <code>minRecommendationRequestsPerSecond</code> (the default). Track your usage using Amazon CloudWatch metrics, and increase the <code>minRecommendationRequestsPerSecond</code> as necessary.</p>
28/// </important>
29/// <p>When you create a recommender, you can configure the recommender's minimum recommendation requests per second. The minimum recommendation requests per second (<code>minRecommendationRequestsPerSecond</code>) specifies the baseline recommendation request throughput provisioned by Amazon Personalize. The default minRecommendationRequestsPerSecond is <code>1</code>. A recommendation request is a single <code>GetRecommendations</code> operation. Request throughput is measured in requests per second and Amazon Personalize uses your requests per second to derive your requests per hour and the price of your recommender usage.</p>
30/// <p>If your requests per second increases beyond <code>minRecommendationRequestsPerSecond</code>, Amazon Personalize auto-scales the provisioned capacity up and down, but never below <code>minRecommendationRequestsPerSecond</code>. There's a short time delay while the capacity is increased that might cause loss of requests.</p>
31/// <p>Your bill is the greater of either the minimum requests per hour (based on minRecommendationRequestsPerSecond) or the actual number of requests. The actual request throughput used is calculated as the average requests/second within a one-hour window. We recommend starting with the default <code>minRecommendationRequestsPerSecond</code>, track your usage using Amazon CloudWatch metrics, and then increase the <code>minRecommendationRequestsPerSecond</code> as necessary.</p>
32/// <p><b>Status</b></p>
33/// <p>A recommender can be in one of the following states:</p>
34/// <ul>
35/// <li>
36/// <p>CREATE PENDING &gt; CREATE IN_PROGRESS &gt; ACTIVE -or- CREATE FAILED</p></li>
37/// <li>
38/// <p>STOP PENDING &gt; STOP IN_PROGRESS &gt; INACTIVE &gt; START PENDING &gt; START IN_PROGRESS &gt; ACTIVE</p></li>
39/// <li>
40/// <p>DELETE PENDING &gt; DELETE IN_PROGRESS</p></li>
41/// </ul>
42/// <p>To get the recommender status, call <a href="https://docs.aws.amazon.com/personalize/latest/dg/API_DescribeRecommender.html">DescribeRecommender</a>.</p><note>
43/// <p>Wait until the <code>status</code> of the recommender is <code>ACTIVE</code> before asking the recommender for recommendations.</p>
44/// </note>
45/// <p class="title"><b>Related APIs</b></p>
46/// <ul>
47/// <li>
48/// <p><a href="https://docs.aws.amazon.com/personalize/latest/dg/API_ListRecommenders.html">ListRecommenders</a></p></li>
49/// <li>
50/// <p><a href="https://docs.aws.amazon.com/personalize/latest/dg/API_DescribeRecommender.html">DescribeRecommender</a></p></li>
51/// <li>
52/// <p><a href="https://docs.aws.amazon.com/personalize/latest/dg/API_UpdateRecommender.html">UpdateRecommender</a></p></li>
53/// <li>
54/// <p><a href="https://docs.aws.amazon.com/personalize/latest/dg/API_DeleteRecommender.html">DeleteRecommender</a></p></li>
55/// </ul>
56#[derive(::std::clone::Clone, ::std::fmt::Debug)]
57pub struct CreateRecommenderFluentBuilder {
58    handle: ::std::sync::Arc<crate::client::Handle>,
59    inner: crate::operation::create_recommender::builders::CreateRecommenderInputBuilder,
60    config_override: ::std::option::Option<crate::config::Builder>,
61}
62impl
63    crate::client::customize::internal::CustomizableSend<
64        crate::operation::create_recommender::CreateRecommenderOutput,
65        crate::operation::create_recommender::CreateRecommenderError,
66    > for CreateRecommenderFluentBuilder
67{
68    fn send(
69        self,
70        config_override: crate::config::Builder,
71    ) -> crate::client::customize::internal::BoxFuture<
72        crate::client::customize::internal::SendResult<
73            crate::operation::create_recommender::CreateRecommenderOutput,
74            crate::operation::create_recommender::CreateRecommenderError,
75        >,
76    > {
77        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
78    }
79}
80impl CreateRecommenderFluentBuilder {
81    /// Creates a new `CreateRecommenderFluentBuilder`.
82    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
83        Self {
84            handle,
85            inner: ::std::default::Default::default(),
86            config_override: ::std::option::Option::None,
87        }
88    }
89    /// Access the CreateRecommender as a reference.
90    pub fn as_input(&self) -> &crate::operation::create_recommender::builders::CreateRecommenderInputBuilder {
91        &self.inner
92    }
93    /// Sends the request and returns the response.
94    ///
95    /// If an error occurs, an `SdkError` will be returned with additional details that
96    /// can be matched against.
97    ///
98    /// By default, any retryable failures will be retried twice. Retry behavior
99    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
100    /// set when configuring the client.
101    pub async fn send(
102        self,
103    ) -> ::std::result::Result<
104        crate::operation::create_recommender::CreateRecommenderOutput,
105        ::aws_smithy_runtime_api::client::result::SdkError<
106            crate::operation::create_recommender::CreateRecommenderError,
107            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
108        >,
109    > {
110        let input = self
111            .inner
112            .build()
113            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
114        let runtime_plugins = crate::operation::create_recommender::CreateRecommender::operation_runtime_plugins(
115            self.handle.runtime_plugins.clone(),
116            &self.handle.conf,
117            self.config_override,
118        );
119        crate::operation::create_recommender::CreateRecommender::orchestrate(&runtime_plugins, input).await
120    }
121
122    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
123    pub fn customize(
124        self,
125    ) -> crate::client::customize::CustomizableOperation<
126        crate::operation::create_recommender::CreateRecommenderOutput,
127        crate::operation::create_recommender::CreateRecommenderError,
128        Self,
129    > {
130        crate::client::customize::CustomizableOperation::new(self)
131    }
132    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
133        self.set_config_override(::std::option::Option::Some(config_override.into()));
134        self
135    }
136
137    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
138        self.config_override = config_override;
139        self
140    }
141    /// <p>The name of the recommender.</p>
142    pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
143        self.inner = self.inner.name(input.into());
144        self
145    }
146    /// <p>The name of the recommender.</p>
147    pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
148        self.inner = self.inner.set_name(input);
149        self
150    }
151    /// <p>The name of the recommender.</p>
152    pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
153        self.inner.get_name()
154    }
155    /// <p>The Amazon Resource Name (ARN) of the destination domain dataset group for the recommender.</p>
156    pub fn dataset_group_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
157        self.inner = self.inner.dataset_group_arn(input.into());
158        self
159    }
160    /// <p>The Amazon Resource Name (ARN) of the destination domain dataset group for the recommender.</p>
161    pub fn set_dataset_group_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
162        self.inner = self.inner.set_dataset_group_arn(input);
163        self
164    }
165    /// <p>The Amazon Resource Name (ARN) of the destination domain dataset group for the recommender.</p>
166    pub fn get_dataset_group_arn(&self) -> &::std::option::Option<::std::string::String> {
167        self.inner.get_dataset_group_arn()
168    }
169    /// <p>The Amazon Resource Name (ARN) of the recipe that the recommender will use. For a recommender, a recipe is a Domain dataset group use case. Only Domain dataset group use cases can be used to create a recommender. For information about use cases see <a href="https://docs.aws.amazon.com/personalize/latest/dg/domain-use-cases.html">Choosing recommender use cases</a>.</p>
170    pub fn recipe_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
171        self.inner = self.inner.recipe_arn(input.into());
172        self
173    }
174    /// <p>The Amazon Resource Name (ARN) of the recipe that the recommender will use. For a recommender, a recipe is a Domain dataset group use case. Only Domain dataset group use cases can be used to create a recommender. For information about use cases see <a href="https://docs.aws.amazon.com/personalize/latest/dg/domain-use-cases.html">Choosing recommender use cases</a>.</p>
175    pub fn set_recipe_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
176        self.inner = self.inner.set_recipe_arn(input);
177        self
178    }
179    /// <p>The Amazon Resource Name (ARN) of the recipe that the recommender will use. For a recommender, a recipe is a Domain dataset group use case. Only Domain dataset group use cases can be used to create a recommender. For information about use cases see <a href="https://docs.aws.amazon.com/personalize/latest/dg/domain-use-cases.html">Choosing recommender use cases</a>.</p>
180    pub fn get_recipe_arn(&self) -> &::std::option::Option<::std::string::String> {
181        self.inner.get_recipe_arn()
182    }
183    /// <p>The configuration details of the recommender.</p>
184    pub fn recommender_config(mut self, input: crate::types::RecommenderConfig) -> Self {
185        self.inner = self.inner.recommender_config(input);
186        self
187    }
188    /// <p>The configuration details of the recommender.</p>
189    pub fn set_recommender_config(mut self, input: ::std::option::Option<crate::types::RecommenderConfig>) -> Self {
190        self.inner = self.inner.set_recommender_config(input);
191        self
192    }
193    /// <p>The configuration details of the recommender.</p>
194    pub fn get_recommender_config(&self) -> &::std::option::Option<crate::types::RecommenderConfig> {
195        self.inner.get_recommender_config()
196    }
197    ///
198    /// Appends an item to `tags`.
199    ///
200    /// To override the contents of this collection use [`set_tags`](Self::set_tags).
201    ///
202    /// <p>A list of <a href="https://docs.aws.amazon.com/personalize/latest/dg/tagging-resources.html">tags</a> to apply to the recommender.</p>
203    pub fn tags(mut self, input: crate::types::Tag) -> Self {
204        self.inner = self.inner.tags(input);
205        self
206    }
207    /// <p>A list of <a href="https://docs.aws.amazon.com/personalize/latest/dg/tagging-resources.html">tags</a> to apply to the recommender.</p>
208    pub fn set_tags(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>) -> Self {
209        self.inner = self.inner.set_tags(input);
210        self
211    }
212    /// <p>A list of <a href="https://docs.aws.amazon.com/personalize/latest/dg/tagging-resources.html">tags</a> to apply to the recommender.</p>
213    pub fn get_tags(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Tag>> {
214        self.inner.get_tags()
215    }
216}