aws_sdk_cloudhsmv2/operation/create_cluster/
_create_cluster_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 CreateClusterInput {
6    /// <p>A policy that defines how the service retains backups.</p>
7    pub backup_retention_policy: ::std::option::Option<crate::types::BackupRetentionPolicy>,
8    /// <p>The type of HSM to use in the cluster. The allowed values are <code>hsm1.medium</code> and <code>hsm2m.medium</code>.</p>
9    pub hsm_type: ::std::option::Option<::std::string::String>,
10    /// <p>The identifier (ID) or the Amazon Resource Name (ARN) of the cluster backup to restore. Use this value to restore the cluster from a backup instead of creating a new cluster. To find the backup ID or ARN, use <code>DescribeBackups</code>. <i>If using a backup in another account, the full ARN must be supplied.</i></p>
11    pub source_backup_id: ::std::option::Option<::std::string::String>,
12    /// <p>The identifiers (IDs) of the subnets where you are creating the cluster. You must specify at least one subnet. If you specify multiple subnets, they must meet the following criteria:</p>
13    /// <ul>
14    /// <li>
15    /// <p>All subnets must be in the same virtual private cloud (VPC).</p></li>
16    /// <li>
17    /// <p>You can specify only one subnet per Availability Zone.</p></li>
18    /// </ul>
19    pub subnet_ids: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
20    /// <p>The NetworkType to create a cluster with. The allowed values are <code>IPV4</code> and <code>DUALSTACK</code>.</p>
21    pub network_type: ::std::option::Option<crate::types::NetworkType>,
22    /// <p>Tags to apply to the CloudHSM cluster during creation.</p>
23    pub tag_list: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>,
24    /// <p>The mode to use in the cluster. The allowed values are <code>FIPS</code> and <code>NON_FIPS</code>.</p>
25    pub mode: ::std::option::Option<crate::types::ClusterMode>,
26}
27impl CreateClusterInput {
28    /// <p>A policy that defines how the service retains backups.</p>
29    pub fn backup_retention_policy(&self) -> ::std::option::Option<&crate::types::BackupRetentionPolicy> {
30        self.backup_retention_policy.as_ref()
31    }
32    /// <p>The type of HSM to use in the cluster. The allowed values are <code>hsm1.medium</code> and <code>hsm2m.medium</code>.</p>
33    pub fn hsm_type(&self) -> ::std::option::Option<&str> {
34        self.hsm_type.as_deref()
35    }
36    /// <p>The identifier (ID) or the Amazon Resource Name (ARN) of the cluster backup to restore. Use this value to restore the cluster from a backup instead of creating a new cluster. To find the backup ID or ARN, use <code>DescribeBackups</code>. <i>If using a backup in another account, the full ARN must be supplied.</i></p>
37    pub fn source_backup_id(&self) -> ::std::option::Option<&str> {
38        self.source_backup_id.as_deref()
39    }
40    /// <p>The identifiers (IDs) of the subnets where you are creating the cluster. You must specify at least one subnet. If you specify multiple subnets, they must meet the following criteria:</p>
41    /// <ul>
42    /// <li>
43    /// <p>All subnets must be in the same virtual private cloud (VPC).</p></li>
44    /// <li>
45    /// <p>You can specify only one subnet per Availability Zone.</p></li>
46    /// </ul>
47    ///
48    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.subnet_ids.is_none()`.
49    pub fn subnet_ids(&self) -> &[::std::string::String] {
50        self.subnet_ids.as_deref().unwrap_or_default()
51    }
52    /// <p>The NetworkType to create a cluster with. The allowed values are <code>IPV4</code> and <code>DUALSTACK</code>.</p>
53    pub fn network_type(&self) -> ::std::option::Option<&crate::types::NetworkType> {
54        self.network_type.as_ref()
55    }
56    /// <p>Tags to apply to the CloudHSM cluster during creation.</p>
57    ///
58    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.tag_list.is_none()`.
59    pub fn tag_list(&self) -> &[crate::types::Tag] {
60        self.tag_list.as_deref().unwrap_or_default()
61    }
62    /// <p>The mode to use in the cluster. The allowed values are <code>FIPS</code> and <code>NON_FIPS</code>.</p>
63    pub fn mode(&self) -> ::std::option::Option<&crate::types::ClusterMode> {
64        self.mode.as_ref()
65    }
66}
67impl CreateClusterInput {
68    /// Creates a new builder-style object to manufacture [`CreateClusterInput`](crate::operation::create_cluster::CreateClusterInput).
69    pub fn builder() -> crate::operation::create_cluster::builders::CreateClusterInputBuilder {
70        crate::operation::create_cluster::builders::CreateClusterInputBuilder::default()
71    }
72}
73
74/// A builder for [`CreateClusterInput`](crate::operation::create_cluster::CreateClusterInput).
75#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
76#[non_exhaustive]
77pub struct CreateClusterInputBuilder {
78    pub(crate) backup_retention_policy: ::std::option::Option<crate::types::BackupRetentionPolicy>,
79    pub(crate) hsm_type: ::std::option::Option<::std::string::String>,
80    pub(crate) source_backup_id: ::std::option::Option<::std::string::String>,
81    pub(crate) subnet_ids: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
82    pub(crate) network_type: ::std::option::Option<crate::types::NetworkType>,
83    pub(crate) tag_list: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>,
84    pub(crate) mode: ::std::option::Option<crate::types::ClusterMode>,
85}
86impl CreateClusterInputBuilder {
87    /// <p>A policy that defines how the service retains backups.</p>
88    pub fn backup_retention_policy(mut self, input: crate::types::BackupRetentionPolicy) -> Self {
89        self.backup_retention_policy = ::std::option::Option::Some(input);
90        self
91    }
92    /// <p>A policy that defines how the service retains backups.</p>
93    pub fn set_backup_retention_policy(mut self, input: ::std::option::Option<crate::types::BackupRetentionPolicy>) -> Self {
94        self.backup_retention_policy = input;
95        self
96    }
97    /// <p>A policy that defines how the service retains backups.</p>
98    pub fn get_backup_retention_policy(&self) -> &::std::option::Option<crate::types::BackupRetentionPolicy> {
99        &self.backup_retention_policy
100    }
101    /// <p>The type of HSM to use in the cluster. The allowed values are <code>hsm1.medium</code> and <code>hsm2m.medium</code>.</p>
102    /// This field is required.
103    pub fn hsm_type(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
104        self.hsm_type = ::std::option::Option::Some(input.into());
105        self
106    }
107    /// <p>The type of HSM to use in the cluster. The allowed values are <code>hsm1.medium</code> and <code>hsm2m.medium</code>.</p>
108    pub fn set_hsm_type(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
109        self.hsm_type = input;
110        self
111    }
112    /// <p>The type of HSM to use in the cluster. The allowed values are <code>hsm1.medium</code> and <code>hsm2m.medium</code>.</p>
113    pub fn get_hsm_type(&self) -> &::std::option::Option<::std::string::String> {
114        &self.hsm_type
115    }
116    /// <p>The identifier (ID) or the Amazon Resource Name (ARN) of the cluster backup to restore. Use this value to restore the cluster from a backup instead of creating a new cluster. To find the backup ID or ARN, use <code>DescribeBackups</code>. <i>If using a backup in another account, the full ARN must be supplied.</i></p>
117    pub fn source_backup_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
118        self.source_backup_id = ::std::option::Option::Some(input.into());
119        self
120    }
121    /// <p>The identifier (ID) or the Amazon Resource Name (ARN) of the cluster backup to restore. Use this value to restore the cluster from a backup instead of creating a new cluster. To find the backup ID or ARN, use <code>DescribeBackups</code>. <i>If using a backup in another account, the full ARN must be supplied.</i></p>
122    pub fn set_source_backup_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
123        self.source_backup_id = input;
124        self
125    }
126    /// <p>The identifier (ID) or the Amazon Resource Name (ARN) of the cluster backup to restore. Use this value to restore the cluster from a backup instead of creating a new cluster. To find the backup ID or ARN, use <code>DescribeBackups</code>. <i>If using a backup in another account, the full ARN must be supplied.</i></p>
127    pub fn get_source_backup_id(&self) -> &::std::option::Option<::std::string::String> {
128        &self.source_backup_id
129    }
130    /// Appends an item to `subnet_ids`.
131    ///
132    /// To override the contents of this collection use [`set_subnet_ids`](Self::set_subnet_ids).
133    ///
134    /// <p>The identifiers (IDs) of the subnets where you are creating the cluster. You must specify at least one subnet. If you specify multiple subnets, they must meet the following criteria:</p>
135    /// <ul>
136    /// <li>
137    /// <p>All subnets must be in the same virtual private cloud (VPC).</p></li>
138    /// <li>
139    /// <p>You can specify only one subnet per Availability Zone.</p></li>
140    /// </ul>
141    pub fn subnet_ids(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
142        let mut v = self.subnet_ids.unwrap_or_default();
143        v.push(input.into());
144        self.subnet_ids = ::std::option::Option::Some(v);
145        self
146    }
147    /// <p>The identifiers (IDs) of the subnets where you are creating the cluster. You must specify at least one subnet. If you specify multiple subnets, they must meet the following criteria:</p>
148    /// <ul>
149    /// <li>
150    /// <p>All subnets must be in the same virtual private cloud (VPC).</p></li>
151    /// <li>
152    /// <p>You can specify only one subnet per Availability Zone.</p></li>
153    /// </ul>
154    pub fn set_subnet_ids(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
155        self.subnet_ids = input;
156        self
157    }
158    /// <p>The identifiers (IDs) of the subnets where you are creating the cluster. You must specify at least one subnet. If you specify multiple subnets, they must meet the following criteria:</p>
159    /// <ul>
160    /// <li>
161    /// <p>All subnets must be in the same virtual private cloud (VPC).</p></li>
162    /// <li>
163    /// <p>You can specify only one subnet per Availability Zone.</p></li>
164    /// </ul>
165    pub fn get_subnet_ids(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
166        &self.subnet_ids
167    }
168    /// <p>The NetworkType to create a cluster with. The allowed values are <code>IPV4</code> and <code>DUALSTACK</code>.</p>
169    pub fn network_type(mut self, input: crate::types::NetworkType) -> Self {
170        self.network_type = ::std::option::Option::Some(input);
171        self
172    }
173    /// <p>The NetworkType to create a cluster with. The allowed values are <code>IPV4</code> and <code>DUALSTACK</code>.</p>
174    pub fn set_network_type(mut self, input: ::std::option::Option<crate::types::NetworkType>) -> Self {
175        self.network_type = input;
176        self
177    }
178    /// <p>The NetworkType to create a cluster with. The allowed values are <code>IPV4</code> and <code>DUALSTACK</code>.</p>
179    pub fn get_network_type(&self) -> &::std::option::Option<crate::types::NetworkType> {
180        &self.network_type
181    }
182    /// Appends an item to `tag_list`.
183    ///
184    /// To override the contents of this collection use [`set_tag_list`](Self::set_tag_list).
185    ///
186    /// <p>Tags to apply to the CloudHSM cluster during creation.</p>
187    pub fn tag_list(mut self, input: crate::types::Tag) -> Self {
188        let mut v = self.tag_list.unwrap_or_default();
189        v.push(input);
190        self.tag_list = ::std::option::Option::Some(v);
191        self
192    }
193    /// <p>Tags to apply to the CloudHSM cluster during creation.</p>
194    pub fn set_tag_list(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>) -> Self {
195        self.tag_list = input;
196        self
197    }
198    /// <p>Tags to apply to the CloudHSM cluster during creation.</p>
199    pub fn get_tag_list(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Tag>> {
200        &self.tag_list
201    }
202    /// <p>The mode to use in the cluster. The allowed values are <code>FIPS</code> and <code>NON_FIPS</code>.</p>
203    pub fn mode(mut self, input: crate::types::ClusterMode) -> Self {
204        self.mode = ::std::option::Option::Some(input);
205        self
206    }
207    /// <p>The mode to use in the cluster. The allowed values are <code>FIPS</code> and <code>NON_FIPS</code>.</p>
208    pub fn set_mode(mut self, input: ::std::option::Option<crate::types::ClusterMode>) -> Self {
209        self.mode = input;
210        self
211    }
212    /// <p>The mode to use in the cluster. The allowed values are <code>FIPS</code> and <code>NON_FIPS</code>.</p>
213    pub fn get_mode(&self) -> &::std::option::Option<crate::types::ClusterMode> {
214        &self.mode
215    }
216    /// Consumes the builder and constructs a [`CreateClusterInput`](crate::operation::create_cluster::CreateClusterInput).
217    pub fn build(
218        self,
219    ) -> ::std::result::Result<crate::operation::create_cluster::CreateClusterInput, ::aws_smithy_types::error::operation::BuildError> {
220        ::std::result::Result::Ok(crate::operation::create_cluster::CreateClusterInput {
221            backup_retention_policy: self.backup_retention_policy,
222            hsm_type: self.hsm_type,
223            source_backup_id: self.source_backup_id,
224            subnet_ids: self.subnet_ids,
225            network_type: self.network_type,
226            tag_list: self.tag_list,
227            mode: self.mode,
228        })
229    }
230}