Skip to main content

aws_sdk_pricingplanmanager/operation/create_subscription/
_create_subscription_input.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2#[allow(missing_docs)] // documentation missing in model
3#[non_exhaustive]
4#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
5pub struct CreateSubscriptionInput {
6    /// <p>The pricing plan family to subscribe to, such as <code>CloudFront</code>.</p>
7    pub plan_family: ::std::option::Option<::std::string::String>,
8    /// <p>The tier level for the subscription, such as <code>FREE</code>, <code>PRO</code>, <code>BUSINESS</code>, or <code>PREMIUM</code>.</p>
9    pub plan_tier: ::std::option::Option<::std::string::String>,
10    /// <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>
11    pub usage_level: ::std::option::Option<::std::string::String>,
12    /// <p>The ARNs of the AWS resources to include in the subscription. Specify one or more supported resources.</p><note>
13    /// <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>
14    /// </note>
15    pub resource_arns: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
16    /// <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>
17    pub approval_mode: ::std::option::Option<crate::types::ApprovalMode>,
18    /// <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>
19    pub client_token: ::std::option::Option<::std::string::String>,
20}
21impl CreateSubscriptionInput {
22    /// <p>The pricing plan family to subscribe to, such as <code>CloudFront</code>.</p>
23    pub fn plan_family(&self) -> ::std::option::Option<&str> {
24        self.plan_family.as_deref()
25    }
26    /// <p>The tier level for the subscription, such as <code>FREE</code>, <code>PRO</code>, <code>BUSINESS</code>, or <code>PREMIUM</code>.</p>
27    pub fn plan_tier(&self) -> ::std::option::Option<&str> {
28        self.plan_tier.as_deref()
29    }
30    /// <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>
31    pub fn usage_level(&self) -> ::std::option::Option<&str> {
32        self.usage_level.as_deref()
33    }
34    /// <p>The ARNs of the AWS resources to include in the subscription. Specify one or more supported resources.</p><note>
35    /// <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>
36    /// </note>
37    ///
38    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.resource_arns.is_none()`.
39    pub fn resource_arns(&self) -> &[::std::string::String] {
40        self.resource_arns.as_deref().unwrap_or_default()
41    }
42    /// <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>
43    pub fn approval_mode(&self) -> ::std::option::Option<&crate::types::ApprovalMode> {
44        self.approval_mode.as_ref()
45    }
46    /// <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>
47    pub fn client_token(&self) -> ::std::option::Option<&str> {
48        self.client_token.as_deref()
49    }
50}
51impl CreateSubscriptionInput {
52    /// Creates a new builder-style object to manufacture [`CreateSubscriptionInput`](crate::operation::create_subscription::CreateSubscriptionInput).
53    pub fn builder() -> crate::operation::create_subscription::builders::CreateSubscriptionInputBuilder {
54        crate::operation::create_subscription::builders::CreateSubscriptionInputBuilder::default()
55    }
56}
57
58/// A builder for [`CreateSubscriptionInput`](crate::operation::create_subscription::CreateSubscriptionInput).
59#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
60#[non_exhaustive]
61pub struct CreateSubscriptionInputBuilder {
62    pub(crate) plan_family: ::std::option::Option<::std::string::String>,
63    pub(crate) plan_tier: ::std::option::Option<::std::string::String>,
64    pub(crate) usage_level: ::std::option::Option<::std::string::String>,
65    pub(crate) resource_arns: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
66    pub(crate) approval_mode: ::std::option::Option<crate::types::ApprovalMode>,
67    pub(crate) client_token: ::std::option::Option<::std::string::String>,
68}
69impl CreateSubscriptionInputBuilder {
70    /// <p>The pricing plan family to subscribe to, such as <code>CloudFront</code>.</p>
71    /// This field is required.
72    pub fn plan_family(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
73        self.plan_family = ::std::option::Option::Some(input.into());
74        self
75    }
76    /// <p>The pricing plan family to subscribe to, such as <code>CloudFront</code>.</p>
77    pub fn set_plan_family(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
78        self.plan_family = input;
79        self
80    }
81    /// <p>The pricing plan family to subscribe to, such as <code>CloudFront</code>.</p>
82    pub fn get_plan_family(&self) -> &::std::option::Option<::std::string::String> {
83        &self.plan_family
84    }
85    /// <p>The tier level for the subscription, such as <code>FREE</code>, <code>PRO</code>, <code>BUSINESS</code>, or <code>PREMIUM</code>.</p>
86    /// This field is required.
87    pub fn plan_tier(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
88        self.plan_tier = ::std::option::Option::Some(input.into());
89        self
90    }
91    /// <p>The tier level for the subscription, such as <code>FREE</code>, <code>PRO</code>, <code>BUSINESS</code>, or <code>PREMIUM</code>.</p>
92    pub fn set_plan_tier(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
93        self.plan_tier = input;
94        self
95    }
96    /// <p>The tier level for the subscription, such as <code>FREE</code>, <code>PRO</code>, <code>BUSINESS</code>, or <code>PREMIUM</code>.</p>
97    pub fn get_plan_tier(&self) -> &::std::option::Option<::std::string::String> {
98        &self.plan_tier
99    }
100    /// <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>
101    pub fn usage_level(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
102        self.usage_level = ::std::option::Option::Some(input.into());
103        self
104    }
105    /// <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>
106    pub fn set_usage_level(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
107        self.usage_level = input;
108        self
109    }
110    /// <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>
111    pub fn get_usage_level(&self) -> &::std::option::Option<::std::string::String> {
112        &self.usage_level
113    }
114    /// Appends an item to `resource_arns`.
115    ///
116    /// To override the contents of this collection use [`set_resource_arns`](Self::set_resource_arns).
117    ///
118    /// <p>The ARNs of the AWS resources to include in the subscription. Specify one or more supported resources.</p><note>
119    /// <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>
120    /// </note>
121    pub fn resource_arns(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
122        let mut v = self.resource_arns.unwrap_or_default();
123        v.push(input.into());
124        self.resource_arns = ::std::option::Option::Some(v);
125        self
126    }
127    /// <p>The ARNs of the AWS resources to include in the subscription. Specify one or more supported resources.</p><note>
128    /// <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>
129    /// </note>
130    pub fn set_resource_arns(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
131        self.resource_arns = input;
132        self
133    }
134    /// <p>The ARNs of the AWS resources to include in the subscription. Specify one or more supported resources.</p><note>
135    /// <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>
136    /// </note>
137    pub fn get_resource_arns(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
138        &self.resource_arns
139    }
140    /// <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>
141    pub fn approval_mode(mut self, input: crate::types::ApprovalMode) -> Self {
142        self.approval_mode = ::std::option::Option::Some(input);
143        self
144    }
145    /// <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>
146    pub fn set_approval_mode(mut self, input: ::std::option::Option<crate::types::ApprovalMode>) -> Self {
147        self.approval_mode = input;
148        self
149    }
150    /// <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>
151    pub fn get_approval_mode(&self) -> &::std::option::Option<crate::types::ApprovalMode> {
152        &self.approval_mode
153    }
154    /// <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>
155    pub fn client_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
156        self.client_token = ::std::option::Option::Some(input.into());
157        self
158    }
159    /// <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>
160    pub fn set_client_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
161        self.client_token = input;
162        self
163    }
164    /// <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>
165    pub fn get_client_token(&self) -> &::std::option::Option<::std::string::String> {
166        &self.client_token
167    }
168    /// Consumes the builder and constructs a [`CreateSubscriptionInput`](crate::operation::create_subscription::CreateSubscriptionInput).
169    pub fn build(
170        self,
171    ) -> ::std::result::Result<crate::operation::create_subscription::CreateSubscriptionInput, ::aws_smithy_types::error::operation::BuildError> {
172        ::std::result::Result::Ok(crate::operation::create_subscription::CreateSubscriptionInput {
173            plan_family: self.plan_family,
174            plan_tier: self.plan_tier,
175            usage_level: self.usage_level,
176            resource_arns: self.resource_arns,
177            approval_mode: self.approval_mode,
178            client_token: self.client_token,
179        })
180    }
181}