aws_sdk_pricingplanmanager/operation/create_subscription/builders.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::create_subscription::_create_subscription_input::CreateSubscriptionInputBuilder;
3
4pub use crate::operation::create_subscription::_create_subscription_output::CreateSubscriptionOutputBuilder;
5
6impl crate::operation::create_subscription::builders::CreateSubscriptionInputBuilder {
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_subscription::CreateSubscriptionOutput,
13 ::aws_smithy_runtime_api::client::result::SdkError<
14 crate::operation::create_subscription::CreateSubscriptionError,
15 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16 >,
17 > {
18 let mut fluent_builder = client.create_subscription();
19 fluent_builder.inner = self;
20 fluent_builder.send().await
21 }
22}
23/// Fluent builder constructing a request to `CreateSubscription`.
24///
25/// <p>Creates a flat-rate pricing subscription for the specified resources.</p><note>
26/// <p>When <code>approvalMode</code> is set to <code>MANUAL</code>, paid-tier subscriptions are created in <code>PENDING_APPROVAL</code> status and require a separate <code>ApprovePaidSubscription</code> call before billing starts. Free-tier subscriptions are always activated immediately regardless of approval mode.</p>
27/// <p>When <code>approvalMode</code> is set to <code>IMMEDIATE</code> or is not specified, the subscription is activated immediately.</p>
28/// </note>
29#[derive(::std::clone::Clone, ::std::fmt::Debug)]
30pub struct CreateSubscriptionFluentBuilder {
31 handle: ::std::sync::Arc<crate::client::Handle>,
32 inner: crate::operation::create_subscription::builders::CreateSubscriptionInputBuilder,
33 config_override: ::std::option::Option<crate::config::Builder>,
34}
35impl
36 crate::client::customize::internal::CustomizableSend<
37 crate::operation::create_subscription::CreateSubscriptionOutput,
38 crate::operation::create_subscription::CreateSubscriptionError,
39 > for CreateSubscriptionFluentBuilder
40{
41 fn send(
42 self,
43 config_override: crate::config::Builder,
44 ) -> crate::client::customize::internal::BoxFuture<
45 crate::client::customize::internal::SendResult<
46 crate::operation::create_subscription::CreateSubscriptionOutput,
47 crate::operation::create_subscription::CreateSubscriptionError,
48 >,
49 > {
50 ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
51 }
52}
53impl CreateSubscriptionFluentBuilder {
54 /// Creates a new `CreateSubscriptionFluentBuilder`.
55 pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
56 Self {
57 handle,
58 inner: ::std::default::Default::default(),
59 config_override: ::std::option::Option::None,
60 }
61 }
62 /// Access the CreateSubscription as a reference.
63 pub fn as_input(&self) -> &crate::operation::create_subscription::builders::CreateSubscriptionInputBuilder {
64 &self.inner
65 }
66 /// Sends the request and returns the response.
67 ///
68 /// If an error occurs, an `SdkError` will be returned with additional details that
69 /// can be matched against.
70 ///
71 /// By default, any retryable failures will be retried twice. Retry behavior
72 /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
73 /// set when configuring the client.
74 pub async fn send(
75 self,
76 ) -> ::std::result::Result<
77 crate::operation::create_subscription::CreateSubscriptionOutput,
78 ::aws_smithy_runtime_api::client::result::SdkError<
79 crate::operation::create_subscription::CreateSubscriptionError,
80 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
81 >,
82 > {
83 let input = self
84 .inner
85 .build()
86 .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
87 let runtime_plugins = crate::operation::create_subscription::CreateSubscription::operation_runtime_plugins(
88 self.handle.runtime_plugins.clone(),
89 &self.handle.conf,
90 self.config_override,
91 );
92 crate::operation::create_subscription::CreateSubscription::orchestrate(&runtime_plugins, input).await
93 }
94
95 /// Consumes this builder, creating a customizable operation that can be modified before being sent.
96 pub fn customize(
97 self,
98 ) -> crate::client::customize::CustomizableOperation<
99 crate::operation::create_subscription::CreateSubscriptionOutput,
100 crate::operation::create_subscription::CreateSubscriptionError,
101 Self,
102 > {
103 crate::client::customize::CustomizableOperation::new(self)
104 }
105 pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
106 self.set_config_override(::std::option::Option::Some(config_override.into()));
107 self
108 }
109
110 pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
111 self.config_override = config_override;
112 self
113 }
114 /// <p>The pricing plan family to subscribe to, such as <code>CloudFront</code>.</p>
115 pub fn plan_family(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
116 self.inner = self.inner.plan_family(input.into());
117 self
118 }
119 /// <p>The pricing plan family to subscribe to, such as <code>CloudFront</code>.</p>
120 pub fn set_plan_family(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
121 self.inner = self.inner.set_plan_family(input);
122 self
123 }
124 /// <p>The pricing plan family to subscribe to, such as <code>CloudFront</code>.</p>
125 pub fn get_plan_family(&self) -> &::std::option::Option<::std::string::String> {
126 self.inner.get_plan_family()
127 }
128 /// <p>The tier level for the subscription, such as <code>FREE</code>, <code>PRO</code>, <code>BUSINESS</code>, or <code>PREMIUM</code>.</p>
129 pub fn plan_tier(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
130 self.inner = self.inner.plan_tier(input.into());
131 self
132 }
133 /// <p>The tier level for the subscription, such as <code>FREE</code>, <code>PRO</code>, <code>BUSINESS</code>, or <code>PREMIUM</code>.</p>
134 pub fn set_plan_tier(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
135 self.inner = self.inner.set_plan_tier(input);
136 self
137 }
138 /// <p>The tier level for the subscription, such as <code>FREE</code>, <code>PRO</code>, <code>BUSINESS</code>, or <code>PREMIUM</code>.</p>
139 pub fn get_plan_tier(&self) -> &::std::option::Option<::std::string::String> {
140 self.inner.get_plan_tier()
141 }
142 /// <p>The usage level within the plan tier. Specify <code>DEFAULT</code> for the base configuration, or a higher level if your plan tier supports it.</p>
143 pub fn usage_level(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
144 self.inner = self.inner.usage_level(input.into());
145 self
146 }
147 /// <p>The usage level within the plan tier. Specify <code>DEFAULT</code> for the base configuration, or a higher level if your plan tier supports it.</p>
148 pub fn set_usage_level(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
149 self.inner = self.inner.set_usage_level(input);
150 self
151 }
152 /// <p>The usage level within the plan tier. Specify <code>DEFAULT</code> for the base configuration, or a higher level if your plan tier supports it.</p>
153 pub fn get_usage_level(&self) -> &::std::option::Option<::std::string::String> {
154 self.inner.get_usage_level()
155 }
156 ///
157 /// Appends an item to `resourceArns`.
158 ///
159 /// To override the contents of this collection use [`set_resource_arns`](Self::set_resource_arns).
160 ///
161 /// <p>The ARNs of the AWS resources to include in the subscription. Specify one or more supported resources.</p><note>
162 /// <p>For subscriptions in the CloudFront plan family, the resources must include exactly one Amazon CloudFront distribution and exactly one AWS WAF web ACL. You can also include other supported resources, such as Amazon Route 53 hosted zones and CloudFront KeyValueStores.</p>
163 /// </note>
164 pub fn resource_arns(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
165 self.inner = self.inner.resource_arns(input.into());
166 self
167 }
168 /// <p>The ARNs of the AWS resources to include in the subscription. Specify one or more supported resources.</p><note>
169 /// <p>For subscriptions in the CloudFront plan family, the resources must include exactly one Amazon CloudFront distribution and exactly one AWS WAF web ACL. You can also include other supported resources, such as Amazon Route 53 hosted zones and CloudFront KeyValueStores.</p>
170 /// </note>
171 pub fn set_resource_arns(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
172 self.inner = self.inner.set_resource_arns(input);
173 self
174 }
175 /// <p>The ARNs of the AWS resources to include in the subscription. Specify one or more supported resources.</p><note>
176 /// <p>For subscriptions in the CloudFront plan family, the resources must include exactly one Amazon CloudFront distribution and exactly one AWS WAF web ACL. You can also include other supported resources, such as Amazon Route 53 hosted zones and CloudFront KeyValueStores.</p>
177 /// </note>
178 pub fn get_resource_arns(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
179 self.inner.get_resource_arns()
180 }
181 /// <p>Determines whether the subscription requires explicit approval before billing starts. Set to <code>MANUAL</code> to require a separate <code>ApprovePaidSubscription</code> call, or <code>IMMEDIATE</code> to activate the subscription right away. Defaults to <code>IMMEDIATE</code> if not specified.</p>
182 pub fn approval_mode(mut self, input: crate::types::ApprovalMode) -> Self {
183 self.inner = self.inner.approval_mode(input);
184 self
185 }
186 /// <p>Determines whether the subscription requires explicit approval before billing starts. Set to <code>MANUAL</code> to require a separate <code>ApprovePaidSubscription</code> call, or <code>IMMEDIATE</code> to activate the subscription right away. Defaults to <code>IMMEDIATE</code> if not specified.</p>
187 pub fn set_approval_mode(mut self, input: ::std::option::Option<crate::types::ApprovalMode>) -> Self {
188 self.inner = self.inner.set_approval_mode(input);
189 self
190 }
191 /// <p>Determines whether the subscription requires explicit approval before billing starts. Set to <code>MANUAL</code> to require a separate <code>ApprovePaidSubscription</code> call, or <code>IMMEDIATE</code> to activate the subscription right away. Defaults to <code>IMMEDIATE</code> if not specified.</p>
192 pub fn get_approval_mode(&self) -> &::std::option::Option<crate::types::ApprovalMode> {
193 self.inner.get_approval_mode()
194 }
195 /// <p>A unique, case-sensitive identifier that you provide to ensure that the request is handled only once. If you send the same request with the same client token, the API returns the original response without creating a duplicate subscription.</p>
196 pub fn client_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
197 self.inner = self.inner.client_token(input.into());
198 self
199 }
200 /// <p>A unique, case-sensitive identifier that you provide to ensure that the request is handled only once. If you send the same request with the same client token, the API returns the original response without creating a duplicate subscription.</p>
201 pub fn set_client_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
202 self.inner = self.inner.set_client_token(input);
203 self
204 }
205 /// <p>A unique, case-sensitive identifier that you provide to ensure that the request is handled only once. If you send the same request with the same client token, the API returns the original response without creating a duplicate subscription.</p>
206 pub fn get_client_token(&self) -> &::std::option::Option<::std::string::String> {
207 self.inner.get_client_token()
208 }
209}