aws_sdk_personalize/operation/create_campaign/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::create_campaign::_create_campaign_output::CreateCampaignOutputBuilder;
3
4pub use crate::operation::create_campaign::_create_campaign_input::CreateCampaignInputBuilder;
5
6impl crate::operation::create_campaign::builders::CreateCampaignInputBuilder {
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_campaign::CreateCampaignOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::create_campaign::CreateCampaignError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.create_campaign();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `CreateCampaign`.
24///
25/// <important>
26/// <p>You incur campaign costs while it is active. To avoid unnecessary costs, make sure to delete the campaign when you are finished. For information about campaign costs, see <a href="https://aws.amazon.com/personalize/pricing/">Amazon Personalize pricing</a>.</p>
27/// </important>
28/// <p>Creates a campaign that deploys a solution version. When a client calls the <a href="https://docs.aws.amazon.com/personalize/latest/dg/API_RS_GetRecommendations.html">GetRecommendations</a> and <a href="https://docs.aws.amazon.com/personalize/latest/dg/API_RS_GetPersonalizedRanking.html">GetPersonalizedRanking</a> APIs, a campaign is specified in the request.</p>
29/// <p><b>Minimum Provisioned TPS and Auto-Scaling</b></p><important>
30/// <p>A high <code>minProvisionedTPS</code> will increase your cost. We recommend starting with 1 for <code>minProvisionedTPS</code> (the default). Track your usage using Amazon CloudWatch metrics, and increase the <code>minProvisionedTPS</code> as necessary.</p>
31/// </important>
32/// <p>When you create an Amazon Personalize campaign, you can specify the minimum provisioned transactions per second (<code>minProvisionedTPS</code>) for the campaign. This is the baseline transaction throughput for the campaign provisioned by Amazon Personalize. It sets the minimum billing charge for the campaign while it is active. A transaction is a single <code>GetRecommendations</code> or <code>GetPersonalizedRanking</code> request. The default <code>minProvisionedTPS</code> is 1.</p>
33/// <p>If your TPS increases beyond the <code>minProvisionedTPS</code>, Amazon Personalize auto-scales the provisioned capacity up and down, but never below <code>minProvisionedTPS</code>. There's a short time delay while the capacity is increased that might cause loss of transactions. When your traffic reduces, capacity returns to the <code>minProvisionedTPS</code>.</p>
34/// <p>You are charged for the the minimum provisioned TPS or, if your requests exceed the <code>minProvisionedTPS</code>, the actual TPS. The actual TPS is the total number of recommendation requests you make. We recommend starting with a low <code>minProvisionedTPS</code>, track your usage using Amazon CloudWatch metrics, and then increase the <code>minProvisionedTPS</code> as necessary.</p>
35/// <p>For more information about campaign costs, see <a href="https://aws.amazon.com/personalize/pricing/">Amazon Personalize pricing</a>.</p>
36/// <p><b>Status</b></p>
37/// <p>A campaign can be in one of the following states:</p>
38/// <ul>
39/// <li>
40/// <p>CREATE PENDING &gt; CREATE IN_PROGRESS &gt; ACTIVE -or- CREATE FAILED</p></li>
41/// <li>
42/// <p>DELETE PENDING &gt; DELETE IN_PROGRESS</p></li>
43/// </ul>
44/// <p>To get the campaign status, call <a href="https://docs.aws.amazon.com/personalize/latest/dg/API_DescribeCampaign.html">DescribeCampaign</a>.</p><note>
45/// <p>Wait until the <code>status</code> of the campaign is <code>ACTIVE</code> before asking the campaign for recommendations.</p>
46/// </note>
47/// <p class="title"><b>Related APIs</b></p>
48/// <ul>
49/// <li>
50/// <p><a href="https://docs.aws.amazon.com/personalize/latest/dg/API_ListCampaigns.html">ListCampaigns</a></p></li>
51/// <li>
52/// <p><a href="https://docs.aws.amazon.com/personalize/latest/dg/API_DescribeCampaign.html">DescribeCampaign</a></p></li>
53/// <li>
54/// <p><a href="https://docs.aws.amazon.com/personalize/latest/dg/API_UpdateCampaign.html">UpdateCampaign</a></p></li>
55/// <li>
56/// <p><a href="https://docs.aws.amazon.com/personalize/latest/dg/API_DeleteCampaign.html">DeleteCampaign</a></p></li>
57/// </ul>
58#[derive(::std::clone::Clone, ::std::fmt::Debug)]
59pub struct CreateCampaignFluentBuilder {
60    handle: ::std::sync::Arc<crate::client::Handle>,
61    inner: crate::operation::create_campaign::builders::CreateCampaignInputBuilder,
62    config_override: ::std::option::Option<crate::config::Builder>,
63}
64impl
65    crate::client::customize::internal::CustomizableSend<
66        crate::operation::create_campaign::CreateCampaignOutput,
67        crate::operation::create_campaign::CreateCampaignError,
68    > for CreateCampaignFluentBuilder
69{
70    fn send(
71        self,
72        config_override: crate::config::Builder,
73    ) -> crate::client::customize::internal::BoxFuture<
74        crate::client::customize::internal::SendResult<
75            crate::operation::create_campaign::CreateCampaignOutput,
76            crate::operation::create_campaign::CreateCampaignError,
77        >,
78    > {
79        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
80    }
81}
82impl CreateCampaignFluentBuilder {
83    /// Creates a new `CreateCampaignFluentBuilder`.
84    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
85        Self {
86            handle,
87            inner: ::std::default::Default::default(),
88            config_override: ::std::option::Option::None,
89        }
90    }
91    /// Access the CreateCampaign as a reference.
92    pub fn as_input(&self) -> &crate::operation::create_campaign::builders::CreateCampaignInputBuilder {
93        &self.inner
94    }
95    /// Sends the request and returns the response.
96    ///
97    /// If an error occurs, an `SdkError` will be returned with additional details that
98    /// can be matched against.
99    ///
100    /// By default, any retryable failures will be retried twice. Retry behavior
101    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
102    /// set when configuring the client.
103    pub async fn send(
104        self,
105    ) -> ::std::result::Result<
106        crate::operation::create_campaign::CreateCampaignOutput,
107        ::aws_smithy_runtime_api::client::result::SdkError<
108            crate::operation::create_campaign::CreateCampaignError,
109            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
110        >,
111    > {
112        let input = self
113            .inner
114            .build()
115            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
116        let runtime_plugins = crate::operation::create_campaign::CreateCampaign::operation_runtime_plugins(
117            self.handle.runtime_plugins.clone(),
118            &self.handle.conf,
119            self.config_override,
120        );
121        crate::operation::create_campaign::CreateCampaign::orchestrate(&runtime_plugins, input).await
122    }
123
124    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
125    pub fn customize(
126        self,
127    ) -> crate::client::customize::CustomizableOperation<
128        crate::operation::create_campaign::CreateCampaignOutput,
129        crate::operation::create_campaign::CreateCampaignError,
130        Self,
131    > {
132        crate::client::customize::CustomizableOperation::new(self)
133    }
134    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
135        self.set_config_override(::std::option::Option::Some(config_override.into()));
136        self
137    }
138
139    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
140        self.config_override = config_override;
141        self
142    }
143    /// <p>A name for the new campaign. The campaign name must be unique within your account.</p>
144    pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
145        self.inner = self.inner.name(input.into());
146        self
147    }
148    /// <p>A name for the new campaign. The campaign name must be unique within your account.</p>
149    pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
150        self.inner = self.inner.set_name(input);
151        self
152    }
153    /// <p>A name for the new campaign. The campaign name must be unique within your account.</p>
154    pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
155        self.inner.get_name()
156    }
157    /// <p>The Amazon Resource Name (ARN) of the trained model to deploy with the campaign. To specify the latest solution version of your solution, specify the ARN of your <i>solution</i> in <code>SolutionArn/$LATEST</code> format. You must use this format if you set <code>syncWithLatestSolutionVersion</code> to <code>True</code> in the <a href="https://docs.aws.amazon.com/personalize/latest/dg/API_CampaignConfig.html">CampaignConfig</a>.</p>
158    /// <p>To deploy a model that isn't the latest solution version of your solution, specify the ARN of the solution version.</p>
159    /// <p>For more information about automatic campaign updates, see <a href="https://docs.aws.amazon.com/personalize/latest/dg/campaigns.html#create-campaign-automatic-latest-sv-update">Enabling automatic campaign updates</a>.</p>
160    pub fn solution_version_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
161        self.inner = self.inner.solution_version_arn(input.into());
162        self
163    }
164    /// <p>The Amazon Resource Name (ARN) of the trained model to deploy with the campaign. To specify the latest solution version of your solution, specify the ARN of your <i>solution</i> in <code>SolutionArn/$LATEST</code> format. You must use this format if you set <code>syncWithLatestSolutionVersion</code> to <code>True</code> in the <a href="https://docs.aws.amazon.com/personalize/latest/dg/API_CampaignConfig.html">CampaignConfig</a>.</p>
165    /// <p>To deploy a model that isn't the latest solution version of your solution, specify the ARN of the solution version.</p>
166    /// <p>For more information about automatic campaign updates, see <a href="https://docs.aws.amazon.com/personalize/latest/dg/campaigns.html#create-campaign-automatic-latest-sv-update">Enabling automatic campaign updates</a>.</p>
167    pub fn set_solution_version_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
168        self.inner = self.inner.set_solution_version_arn(input);
169        self
170    }
171    /// <p>The Amazon Resource Name (ARN) of the trained model to deploy with the campaign. To specify the latest solution version of your solution, specify the ARN of your <i>solution</i> in <code>SolutionArn/$LATEST</code> format. You must use this format if you set <code>syncWithLatestSolutionVersion</code> to <code>True</code> in the <a href="https://docs.aws.amazon.com/personalize/latest/dg/API_CampaignConfig.html">CampaignConfig</a>.</p>
172    /// <p>To deploy a model that isn't the latest solution version of your solution, specify the ARN of the solution version.</p>
173    /// <p>For more information about automatic campaign updates, see <a href="https://docs.aws.amazon.com/personalize/latest/dg/campaigns.html#create-campaign-automatic-latest-sv-update">Enabling automatic campaign updates</a>.</p>
174    pub fn get_solution_version_arn(&self) -> &::std::option::Option<::std::string::String> {
175        self.inner.get_solution_version_arn()
176    }
177    /// <p>Specifies the requested minimum provisioned transactions (recommendations) per second that Amazon Personalize will support. A high <code>minProvisionedTPS</code> will increase your bill. We recommend starting with 1 for <code>minProvisionedTPS</code> (the default). Track your usage using Amazon CloudWatch metrics, and increase the <code>minProvisionedTPS</code> as necessary.</p>
178    pub fn min_provisioned_tps(mut self, input: i32) -> Self {
179        self.inner = self.inner.min_provisioned_tps(input);
180        self
181    }
182    /// <p>Specifies the requested minimum provisioned transactions (recommendations) per second that Amazon Personalize will support. A high <code>minProvisionedTPS</code> will increase your bill. We recommend starting with 1 for <code>minProvisionedTPS</code> (the default). Track your usage using Amazon CloudWatch metrics, and increase the <code>minProvisionedTPS</code> as necessary.</p>
183    pub fn set_min_provisioned_tps(mut self, input: ::std::option::Option<i32>) -> Self {
184        self.inner = self.inner.set_min_provisioned_tps(input);
185        self
186    }
187    /// <p>Specifies the requested minimum provisioned transactions (recommendations) per second that Amazon Personalize will support. A high <code>minProvisionedTPS</code> will increase your bill. We recommend starting with 1 for <code>minProvisionedTPS</code> (the default). Track your usage using Amazon CloudWatch metrics, and increase the <code>minProvisionedTPS</code> as necessary.</p>
188    pub fn get_min_provisioned_tps(&self) -> &::std::option::Option<i32> {
189        self.inner.get_min_provisioned_tps()
190    }
191    /// <p>The configuration details of a campaign.</p>
192    pub fn campaign_config(mut self, input: crate::types::CampaignConfig) -> Self {
193        self.inner = self.inner.campaign_config(input);
194        self
195    }
196    /// <p>The configuration details of a campaign.</p>
197    pub fn set_campaign_config(mut self, input: ::std::option::Option<crate::types::CampaignConfig>) -> Self {
198        self.inner = self.inner.set_campaign_config(input);
199        self
200    }
201    /// <p>The configuration details of a campaign.</p>
202    pub fn get_campaign_config(&self) -> &::std::option::Option<crate::types::CampaignConfig> {
203        self.inner.get_campaign_config()
204    }
205    ///
206    /// Appends an item to `tags`.
207    ///
208    /// To override the contents of this collection use [`set_tags`](Self::set_tags).
209    ///
210    /// <p>A list of <a href="https://docs.aws.amazon.com/personalize/latest/dg/tagging-resources.html">tags</a> to apply to the campaign.</p>
211    pub fn tags(mut self, input: crate::types::Tag) -> Self {
212        self.inner = self.inner.tags(input);
213        self
214    }
215    /// <p>A list of <a href="https://docs.aws.amazon.com/personalize/latest/dg/tagging-resources.html">tags</a> to apply to the campaign.</p>
216    pub fn set_tags(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>) -> Self {
217        self.inner = self.inner.set_tags(input);
218        self
219    }
220    /// <p>A list of <a href="https://docs.aws.amazon.com/personalize/latest/dg/tagging-resources.html">tags</a> to apply to the campaign.</p>
221    pub fn get_tags(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Tag>> {
222        self.inner.get_tags()
223    }
224}