1 + | // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
|
2 + | #[allow(missing_docs)] // documentation missing in model
|
3 + | #[derive(::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::hash::Hash)]
|
4 + | pub struct StartSnapshotInput {
|
5 + | /// <p>The amount of time (in minutes) after which the snapshot is automatically cancelled if:</p>
|
6 + | /// <ul>
|
7 + | /// <li>
|
8 + | /// <p>No blocks are written to the snapshot.</p></li>
|
9 + | /// <li>
|
10 + | /// <p>The snapshot is not completed after writing the last block of data.</p></li>
|
11 + | /// </ul>
|
12 + | /// <p>If no value is specified, the timeout defaults to <code>60</code> minutes.</p>
|
13 + | pub timeout: ::std::option::Option<crate::model::Timeout>,
|
14 + | /// <p>A unique, case-sensitive identifier that you provide to ensure the idempotency of the request. Idempotency ensures that an API request completes only once. With an idempotent request, if the original request completes successfully. The subsequent retries with the same client token return the result from the original successful request and they have no additional effect.</p>
|
15 + | /// <p>If you do not specify a client token, one is automatically generated by the AWS SDK.</p>
|
16 + | /// <p>For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-direct-api-idempotency.html"> Idempotency for StartSnapshot API</a> in the <i>Amazon Elastic Compute Cloud User Guide</i>.</p>
|
17 + | pub client_token: ::std::option::Option<crate::model::IdempotencyToken>,
|
18 + | /// <p>The size of the volume, in GiB. The maximum size is <code>16384</code> GiB (16 TiB).</p>
|
19 + | pub volume_size: crate::model::VolumeSize,
|
20 + | /// <p>The tags to apply to the snapshot.</p>
|
21 + | pub tags: ::std::option::Option<::std::vec::Vec<crate::model::Tag>>,
|
22 + | /// <p>Indicates whether to encrypt the snapshot. To create an encrypted snapshot, specify <code>true</code>. To create an unencrypted snapshot, omit this parameter.</p>
|
23 + | /// <p>If you specify a value for <b>ParentSnapshotId</b>, omit this parameter.</p>
|
24 + | /// <p>If you specify <code>true</code>, the snapshot is encrypted using the CMK specified using the <b>KmsKeyArn</b> parameter. If no value is specified for <b>KmsKeyArn</b>, the default CMK for your account is used. If no default CMK has been specified for your account, the AWS managed CMK is used. To set a default CMK for your account, use <a href="https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_ModifyEbsDefaultKmsKeyId.html"> ModifyEbsDefaultKmsKeyId</a>.</p>
|
25 + | /// <p>If your account is enabled for encryption by default, you cannot set this parameter to <code>false</code>. In this case, you can omit this parameter.</p>
|
26 + | /// <p>For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-accessing-snapshot.html#ebsapis-using-encryption"> Using encryption</a> in the <i>Amazon Elastic Compute Cloud User Guide</i>.</p>
|
27 + | pub encrypted: ::std::option::Option<bool>,
|
28 + | /// <p>The Amazon Resource Name (ARN) of the AWS Key Management Service (AWS KMS) customer master key (CMK) to be used to encrypt the snapshot. If you do not specify a CMK, the default AWS managed CMK is used.</p>
|
29 + | /// <p>If you specify a <b>ParentSnapshotId</b>, omit this parameter; the snapshot will be encrypted using the same CMK that was used to encrypt the parent snapshot.</p>
|
30 + | /// <p>If <b>Encrypted</b> is set to <code>true</code>, you must specify a CMK ARN.</p>
|
31 + | pub kms_key_arn: ::std::option::Option<crate::model::KmsKeyArn>,
|
32 + | /// <p>The ID of the parent snapshot. If there is no parent snapshot, or if you are creating the first snapshot for an on-premises volume, omit this parameter.</p>
|
33 + | /// <p>If your account is enabled for encryption by default, you cannot use an unencrypted snapshot as a parent snapshot. You must first create an encrypted copy of the parent snapshot using <a href="https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_CopySnapshot.html">CopySnapshot</a>.</p>
|
34 + | pub parent_snapshot_id: ::std::option::Option<crate::model::SnapshotId>,
|
35 + | /// <p>A description for the snapshot.</p>
|
36 + | pub description: ::std::option::Option<crate::model::Description>,
|
37 + | }
|
38 + | impl StartSnapshotInput {
|
39 + | /// <p>The amount of time (in minutes) after which the snapshot is automatically cancelled if:</p>
|
40 + | /// <ul>
|
41 + | /// <li>
|
42 + | /// <p>No blocks are written to the snapshot.</p></li>
|
43 + | /// <li>
|
44 + | /// <p>The snapshot is not completed after writing the last block of data.</p></li>
|
45 + | /// </ul>
|
46 + | /// <p>If no value is specified, the timeout defaults to <code>60</code> minutes.</p>
|
47 + | pub fn timeout(&self) -> ::std::option::Option<&crate::model::Timeout> {
|
48 + | self.timeout.as_ref()
|
49 + | }
|
50 + | /// <p>A unique, case-sensitive identifier that you provide to ensure the idempotency of the request. Idempotency ensures that an API request completes only once. With an idempotent request, if the original request completes successfully. The subsequent retries with the same client token return the result from the original successful request and they have no additional effect.</p>
|
51 + | /// <p>If you do not specify a client token, one is automatically generated by the AWS SDK.</p>
|
52 + | /// <p>For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-direct-api-idempotency.html"> Idempotency for StartSnapshot API</a> in the <i>Amazon Elastic Compute Cloud User Guide</i>.</p>
|
53 + | pub fn client_token(&self) -> ::std::option::Option<&crate::model::IdempotencyToken> {
|
54 + | self.client_token.as_ref()
|
55 + | }
|
56 + | /// <p>The size of the volume, in GiB. The maximum size is <code>16384</code> GiB (16 TiB).</p>
|
57 + | pub fn volume_size(&self) -> &crate::model::VolumeSize {
|
58 + | &self.volume_size
|
59 + | }
|
60 + | /// <p>The tags to apply to the snapshot.</p>
|
61 + | pub fn tags(&self) -> ::std::option::Option<&[crate::model::Tag]> {
|
62 + | self.tags.as_deref()
|
63 + | }
|
64 + | /// <p>Indicates whether to encrypt the snapshot. To create an encrypted snapshot, specify <code>true</code>. To create an unencrypted snapshot, omit this parameter.</p>
|
65 + | /// <p>If you specify a value for <b>ParentSnapshotId</b>, omit this parameter.</p>
|
66 + | /// <p>If you specify <code>true</code>, the snapshot is encrypted using the CMK specified using the <b>KmsKeyArn</b> parameter. If no value is specified for <b>KmsKeyArn</b>, the default CMK for your account is used. If no default CMK has been specified for your account, the AWS managed CMK is used. To set a default CMK for your account, use <a href="https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_ModifyEbsDefaultKmsKeyId.html"> ModifyEbsDefaultKmsKeyId</a>.</p>
|
67 + | /// <p>If your account is enabled for encryption by default, you cannot set this parameter to <code>false</code>. In this case, you can omit this parameter.</p>
|
68 + | /// <p>For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-accessing-snapshot.html#ebsapis-using-encryption"> Using encryption</a> in the <i>Amazon Elastic Compute Cloud User Guide</i>.</p>
|
69 + | pub fn encrypted(&self) -> ::std::option::Option<bool> {
|
70 + | self.encrypted
|
71 + | }
|
72 + | /// <p>The Amazon Resource Name (ARN) of the AWS Key Management Service (AWS KMS) customer master key (CMK) to be used to encrypt the snapshot. If you do not specify a CMK, the default AWS managed CMK is used.</p>
|
73 + | /// <p>If you specify a <b>ParentSnapshotId</b>, omit this parameter; the snapshot will be encrypted using the same CMK that was used to encrypt the parent snapshot.</p>
|
74 + | /// <p>If <b>Encrypted</b> is set to <code>true</code>, you must specify a CMK ARN.</p>
|
75 + | pub fn kms_key_arn(&self) -> ::std::option::Option<&crate::model::KmsKeyArn> {
|
76 + | self.kms_key_arn.as_ref()
|
77 + | }
|
78 + | /// <p>The ID of the parent snapshot. If there is no parent snapshot, or if you are creating the first snapshot for an on-premises volume, omit this parameter.</p>
|
79 + | /// <p>If your account is enabled for encryption by default, you cannot use an unencrypted snapshot as a parent snapshot. You must first create an encrypted copy of the parent snapshot using <a href="https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_CopySnapshot.html">CopySnapshot</a>.</p>
|
80 + | pub fn parent_snapshot_id(&self) -> ::std::option::Option<&crate::model::SnapshotId> {
|
81 + | self.parent_snapshot_id.as_ref()
|
82 + | }
|
83 + | /// <p>A description for the snapshot.</p>
|
84 + | pub fn description(&self) -> ::std::option::Option<&crate::model::Description> {
|
85 + | self.description.as_ref()
|
86 + | }
|
87 + | }
|
88 + | impl ::std::fmt::Debug for StartSnapshotInput {
|
89 + | fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
|
90 + | let mut formatter = f.debug_struct("StartSnapshotInput");
|
91 + | formatter.field("timeout", &self.timeout);
|
92 + | formatter.field("client_token", &self.client_token);
|
93 + | formatter.field("volume_size", &self.volume_size);
|
94 + | formatter.field("tags", &self.tags);
|
95 + | formatter.field("encrypted", &self.encrypted);
|
96 + | formatter.field("kms_key_arn", &"*** Sensitive Data Redacted ***");
|
97 + | formatter.field("parent_snapshot_id", &self.parent_snapshot_id);
|
98 + | formatter.field("description", &self.description);
|
99 + | formatter.finish()
|
100 + | }
|
101 + | }
|
102 + | impl StartSnapshotInput {
|
103 + | /// Creates a new builder-style object to manufacture [`StartSnapshotInput`](crate::input::StartSnapshotInput).
|
104 + | pub fn builder() -> crate::input::start_snapshot_input::Builder {
|
105 + | crate::input::start_snapshot_input::Builder::default()
|
106 + | }
|
107 + | }
|
108 + | impl crate::constrained::Constrained for crate::input::StartSnapshotInput {
|
109 + | type Unconstrained = crate::input::start_snapshot_input::Builder;
|
110 + | }
|
111 + |
|
112 + | #[allow(missing_docs)] // documentation missing in model
|
113 + | pub struct PutSnapshotBlockInput {
|
114 + | /// <p>The ID of the snapshot.</p>
|
115 + | pub snapshot_id: crate::model::SnapshotId,
|
116 + | /// <p>The block index of the block in which to write the data. A block index is a logical index in units of <code>512</code> KiB blocks. To identify the block index, divide the logical offset of the data in the logical volume by the block size (logical offset of data/<code>524288</code>). The logical offset of the data must be <code>512</code> KiB aligned.</p>
|
117 + | pub block_index: crate::model::BlockIndex,
|
118 + | /// <p>A Base64-encoded SHA256 checksum of the data. Only SHA256 checksums are supported.</p>
|
119 + | pub checksum: crate::model::Checksum,
|
120 + | /// <p>The progress of the write process, as a percentage.</p>
|
121 + | pub progress: ::std::option::Option<crate::model::Progress>,
|
122 + | /// <p>The data to write to the block.</p>
|
123 + | /// <p>The block data is not signed as part of the Signature Version 4 signing process. As a result, you must generate and provide a Base64-encoded SHA256 checksum for the block data using the <b>x-amz-Checksum</b> header. Also, you must specify the checksum algorithm using the <b>x-amz-Checksum-Algorithm</b> header. The checksum that you provide is part of the Signature Version 4 signing process. It is validated against a checksum generated by Amazon EBS to ensure the validity and authenticity of the data. If the checksums do not correspond, the request fails. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-accessing-snapshot.html#ebsapis-using-checksums"> Using checksums with the EBS direct APIs</a> in the <i>Amazon Elastic Compute Cloud User Guide</i>.</p>
|
124 + | pub block_data: ::aws_smithy_types::byte_stream::ByteStream,
|
125 + | /// <p>The size of the data to write to the block, in bytes. Currently, the only supported size is <code>524288</code>.</p>
|
126 + | /// <p>Valid values: <code>524288</code></p>
|
127 + | pub data_length: i32,
|
128 + | /// <p>The algorithm used to generate the checksum. Currently, the only supported algorithm is <code>SHA256</code>.</p>
|
129 + | pub checksum_algorithm: crate::model::ChecksumAlgorithm,
|
130 + | }
|
131 + | impl PutSnapshotBlockInput {
|
132 + | /// <p>The ID of the snapshot.</p>
|
133 + | pub fn snapshot_id(&self) -> &crate::model::SnapshotId {
|
134 + | &self.snapshot_id
|
135 + | }
|
136 + | /// <p>The block index of the block in which to write the data. A block index is a logical index in units of <code>512</code> KiB blocks. To identify the block index, divide the logical offset of the data in the logical volume by the block size (logical offset of data/<code>524288</code>). The logical offset of the data must be <code>512</code> KiB aligned.</p>
|
137 + | pub fn block_index(&self) -> &crate::model::BlockIndex {
|
138 + | &self.block_index
|
139 + | }
|
140 + | /// <p>A Base64-encoded SHA256 checksum of the data. Only SHA256 checksums are supported.</p>
|
141 + | pub fn checksum(&self) -> &crate::model::Checksum {
|
142 + | &self.checksum
|
143 + | }
|
144 + | /// <p>The progress of the write process, as a percentage.</p>
|
145 + | pub fn progress(&self) -> ::std::option::Option<&crate::model::Progress> {
|
146 + | self.progress.as_ref()
|
147 + | }
|
148 + | /// <p>The data to write to the block.</p>
|
149 + | /// <p>The block data is not signed as part of the Signature Version 4 signing process. As a result, you must generate and provide a Base64-encoded SHA256 checksum for the block data using the <b>x-amz-Checksum</b> header. Also, you must specify the checksum algorithm using the <b>x-amz-Checksum-Algorithm</b> header. The checksum that you provide is part of the Signature Version 4 signing process. It is validated against a checksum generated by Amazon EBS to ensure the validity and authenticity of the data. If the checksums do not correspond, the request fails. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-accessing-snapshot.html#ebsapis-using-checksums"> Using checksums with the EBS direct APIs</a> in the <i>Amazon Elastic Compute Cloud User Guide</i>.</p>
|
150 + | pub fn block_data(&self) -> &::aws_smithy_types::byte_stream::ByteStream {
|
151 + | &self.block_data
|
152 + | }
|
153 + | /// <p>The size of the data to write to the block, in bytes. Currently, the only supported size is <code>524288</code>.</p>
|
154 + | /// <p>Valid values: <code>524288</code></p>
|
155 + | pub fn data_length(&self) -> i32 {
|
156 + | self.data_length
|
157 + | }
|
158 + | /// <p>The algorithm used to generate the checksum. Currently, the only supported algorithm is <code>SHA256</code>.</p>
|
159 + | pub fn checksum_algorithm(&self) -> &crate::model::ChecksumAlgorithm {
|
160 + | &self.checksum_algorithm
|
161 + | }
|
162 + | }
|
163 + | impl ::std::fmt::Debug for PutSnapshotBlockInput {
|
164 + | fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
|
165 + | let mut formatter = f.debug_struct("PutSnapshotBlockInput");
|
166 + | formatter.field("snapshot_id", &self.snapshot_id);
|
167 + | formatter.field("block_index", &self.block_index);
|
168 + | formatter.field("checksum", &self.checksum);
|
169 + | formatter.field("progress", &self.progress);
|
170 + | formatter.field("block_data", &"*** Sensitive Data Redacted ***");
|
171 + | formatter.field("data_length", &self.data_length);
|
172 + | formatter.field("checksum_algorithm", &self.checksum_algorithm);
|
173 + | formatter.finish()
|
174 + | }
|
175 + | }
|
176 + | impl PutSnapshotBlockInput {
|
177 + | /// Creates a new builder-style object to manufacture [`PutSnapshotBlockInput`](crate::input::PutSnapshotBlockInput).
|
178 + | pub fn builder() -> crate::input::put_snapshot_block_input::Builder {
|
179 + | crate::input::put_snapshot_block_input::Builder::default()
|
180 + | }
|
181 + | }
|
182 + | impl crate::constrained::Constrained for crate::input::PutSnapshotBlockInput {
|
183 + | type Unconstrained = crate::input::put_snapshot_block_input::Builder;
|
184 + | }
|
185 + |
|
186 + | #[allow(missing_docs)] // documentation missing in model
|
187 + | #[derive(
|
188 + | ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
|
189 + | )]
|
190 + | pub struct ListSnapshotBlocksInput {
|
191 + | /// <p>The number of results to return.</p>
|
192 + | pub max_results: ::std::option::Option<crate::model::MaxResults>,
|
193 + | /// <p>The block index from which the list should start. The list in the response will start from this block index or the next valid block index in the snapshot.</p>
|
194 + | pub starting_block_index: ::std::option::Option<crate::model::BlockIndex>,
|
195 + | /// <p>The token to request the next page of results.</p>
|
196 + | pub next_token: ::std::option::Option<crate::model::PageToken>,
|
197 + | /// <p>The ID of the snapshot from which to get block indexes and block tokens.</p>
|
198 + | pub snapshot_id: crate::model::SnapshotId,
|
199 + | }
|
200 + | impl ListSnapshotBlocksInput {
|
201 + | /// <p>The number of results to return.</p>
|
202 + | pub fn max_results(&self) -> ::std::option::Option<&crate::model::MaxResults> {
|
203 + | self.max_results.as_ref()
|
204 + | }
|
205 + | /// <p>The block index from which the list should start. The list in the response will start from this block index or the next valid block index in the snapshot.</p>
|
206 + | pub fn starting_block_index(&self) -> ::std::option::Option<&crate::model::BlockIndex> {
|
207 + | self.starting_block_index.as_ref()
|
208 + | }
|
209 + | /// <p>The token to request the next page of results.</p>
|
210 + | pub fn next_token(&self) -> ::std::option::Option<&crate::model::PageToken> {
|
211 + | self.next_token.as_ref()
|
212 + | }
|
213 + | /// <p>The ID of the snapshot from which to get block indexes and block tokens.</p>
|
214 + | pub fn snapshot_id(&self) -> &crate::model::SnapshotId {
|
215 + | &self.snapshot_id
|
216 + | }
|
217 + | }
|
218 + | impl ListSnapshotBlocksInput {
|
219 + | /// Creates a new builder-style object to manufacture [`ListSnapshotBlocksInput`](crate::input::ListSnapshotBlocksInput).
|
220 + | pub fn builder() -> crate::input::list_snapshot_blocks_input::Builder {
|
221 + | crate::input::list_snapshot_blocks_input::Builder::default()
|
222 + | }
|
223 + | }
|
224 + | impl crate::constrained::Constrained for crate::input::ListSnapshotBlocksInput {
|
225 + | type Unconstrained = crate::input::list_snapshot_blocks_input::Builder;
|
226 + | }
|
227 + |
|
228 + | #[allow(missing_docs)] // documentation missing in model
|
229 + | #[derive(
|
230 + | ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
|
231 + | )]
|
232 + | pub struct ListChangedBlocksInput {
|
233 + | /// <p>The ID of the second snapshot to use for the comparison.</p><important>
|
234 + | /// <p>The <code>SecondSnapshotId</code> parameter must be specified with a <code>FirstSnapshotID</code> parameter; otherwise, an error occurs.</p>
|
235 + | /// </important>
|
236 + | pub second_snapshot_id: crate::model::SnapshotId,
|
237 + | /// <p>The ID of the first snapshot to use for the comparison.</p><important>
|
238 + | /// <p>The <code>FirstSnapshotID</code> parameter must be specified with a <code>SecondSnapshotId</code> parameter; otherwise, an error occurs.</p>
|
239 + | /// </important>
|
240 + | pub first_snapshot_id: ::std::option::Option<crate::model::SnapshotId>,
|
241 + | /// <p>The token to request the next page of results.</p>
|
242 + | pub next_token: ::std::option::Option<crate::model::PageToken>,
|
243 + | /// <p>The number of results to return.</p>
|
244 + | pub max_results: ::std::option::Option<crate::model::MaxResults>,
|
245 + | /// <p>The block index from which the comparison should start.</p>
|
246 + | /// <p>The list in the response will start from this block index or the next valid block index in the snapshots.</p>
|
247 + | pub starting_block_index: ::std::option::Option<crate::model::BlockIndex>,
|
248 + | }
|
249 + | impl ListChangedBlocksInput {
|
250 + | /// <p>The ID of the second snapshot to use for the comparison.</p><important>
|
251 + | /// <p>The <code>SecondSnapshotId</code> parameter must be specified with a <code>FirstSnapshotID</code> parameter; otherwise, an error occurs.</p>
|
252 + | /// </important>
|
253 + | pub fn second_snapshot_id(&self) -> &crate::model::SnapshotId {
|
254 + | &self.second_snapshot_id
|
255 + | }
|
256 + | /// <p>The ID of the first snapshot to use for the comparison.</p><important>
|
257 + | /// <p>The <code>FirstSnapshotID</code> parameter must be specified with a <code>SecondSnapshotId</code> parameter; otherwise, an error occurs.</p>
|
258 + | /// </important>
|
259 + | pub fn first_snapshot_id(&self) -> ::std::option::Option<&crate::model::SnapshotId> {
|
260 + | self.first_snapshot_id.as_ref()
|
261 + | }
|
262 + | /// <p>The token to request the next page of results.</p>
|
263 + | pub fn next_token(&self) -> ::std::option::Option<&crate::model::PageToken> {
|
264 + | self.next_token.as_ref()
|
265 + | }
|
266 + | /// <p>The number of results to return.</p>
|
267 + | pub fn max_results(&self) -> ::std::option::Option<&crate::model::MaxResults> {
|
268 + | self.max_results.as_ref()
|
269 + | }
|
270 + | /// <p>The block index from which the comparison should start.</p>
|
271 + | /// <p>The list in the response will start from this block index or the next valid block index in the snapshots.</p>
|
272 + | pub fn starting_block_index(&self) -> ::std::option::Option<&crate::model::BlockIndex> {
|
273 + | self.starting_block_index.as_ref()
|
274 + | }
|
275 + | }
|
276 + | impl ListChangedBlocksInput {
|
277 + | /// Creates a new builder-style object to manufacture [`ListChangedBlocksInput`](crate::input::ListChangedBlocksInput).
|
278 + | pub fn builder() -> crate::input::list_changed_blocks_input::Builder {
|
279 + | crate::input::list_changed_blocks_input::Builder::default()
|
280 + | }
|
281 + | }
|
282 + | impl crate::constrained::Constrained for crate::input::ListChangedBlocksInput {
|
283 + | type Unconstrained = crate::input::list_changed_blocks_input::Builder;
|
284 + | }
|
285 + |
|
286 + | #[allow(missing_docs)] // documentation missing in model
|
287 + | #[derive(
|
288 + | ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
|
289 + | )]
|
290 + | pub struct GetSnapshotBlockInput {
|
291 + | /// <p>The ID of the snapshot containing the block from which to get data.</p>
|
292 + | pub snapshot_id: crate::model::SnapshotId,
|
293 + | /// <p>The block token of the block from which to get data.</p>
|
294 + | /// <p>Obtain the <code>BlockToken</code> by running the <code>ListChangedBlocks</code> or <code>ListSnapshotBlocks</code> operations.</p>
|
295 + | pub block_token: crate::model::BlockToken,
|
296 + | /// <p>The block index of the block from which to get data.</p>
|
297 + | /// <p>Obtain the <code>BlockIndex</code> by running the <code>ListChangedBlocks</code> or <code>ListSnapshotBlocks</code> operations.</p>
|
298 + | pub block_index: crate::model::BlockIndex,
|
299 + | }
|
300 + | impl GetSnapshotBlockInput {
|
301 + | /// <p>The ID of the snapshot containing the block from which to get data.</p>
|
302 + | pub fn snapshot_id(&self) -> &crate::model::SnapshotId {
|
303 + | &self.snapshot_id
|
304 + | }
|
305 + | /// <p>The block token of the block from which to get data.</p>
|
306 + | /// <p>Obtain the <code>BlockToken</code> by running the <code>ListChangedBlocks</code> or <code>ListSnapshotBlocks</code> operations.</p>
|
307 + | pub fn block_token(&self) -> &crate::model::BlockToken {
|
308 + | &self.block_token
|
309 + | }
|
310 + | /// <p>The block index of the block from which to get data.</p>
|
311 + | /// <p>Obtain the <code>BlockIndex</code> by running the <code>ListChangedBlocks</code> or <code>ListSnapshotBlocks</code> operations.</p>
|
312 + | pub fn block_index(&self) -> &crate::model::BlockIndex {
|
313 + | &self.block_index
|
314 + | }
|
315 + | }
|
316 + | impl GetSnapshotBlockInput {
|
317 + | /// Creates a new builder-style object to manufacture [`GetSnapshotBlockInput`](crate::input::GetSnapshotBlockInput).
|
318 + | pub fn builder() -> crate::input::get_snapshot_block_input::Builder {
|
319 + | crate::input::get_snapshot_block_input::Builder::default()
|
320 + | }
|
321 + | }
|
322 + | impl crate::constrained::Constrained for crate::input::GetSnapshotBlockInput {
|
323 + | type Unconstrained = crate::input::get_snapshot_block_input::Builder;
|
324 + | }
|
325 + |
|
326 + | #[allow(missing_docs)] // documentation missing in model
|
327 + | #[derive(
|
328 + | ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
|
329 + | )]
|
330 + | pub struct CompleteSnapshotInput {
|
331 + | /// <p>The number of blocks that were written to the snapshot.</p>
|
332 + | pub changed_blocks_count: crate::model::ChangedBlocksCount,
|
333 + | /// <p>The aggregation method used to generate the checksum. Currently, the only supported aggregation method is <code>LINEAR</code>.</p>
|
334 + | pub checksum_aggregation_method: ::std::option::Option<crate::model::ChecksumAggregationMethod>,
|
335 + | /// <p>The algorithm used to generate the checksum. Currently, the only supported algorithm is <code>SHA256</code>.</p>
|
336 + | pub checksum_algorithm: ::std::option::Option<crate::model::ChecksumAlgorithm>,
|
337 + | /// <p>The ID of the snapshot.</p>
|
338 + | pub snapshot_id: crate::model::SnapshotId,
|
339 + | /// <p>An aggregated Base-64 SHA256 checksum based on the checksums of each written block.</p>
|
340 + | /// <p>To generate the aggregated checksum using the linear aggregation method, arrange the checksums for each written block in ascending order of their block index, concatenate them to form a single string, and then generate the checksum on the entire string using the SHA256 algorithm.</p>
|
341 + | pub checksum: ::std::option::Option<crate::model::Checksum>,
|
342 + | }
|
343 + | impl CompleteSnapshotInput {
|
344 + | /// <p>The number of blocks that were written to the snapshot.</p>
|
345 + | pub fn changed_blocks_count(&self) -> &crate::model::ChangedBlocksCount {
|
346 + | &self.changed_blocks_count
|
347 + | }
|
348 + | /// <p>The aggregation method used to generate the checksum. Currently, the only supported aggregation method is <code>LINEAR</code>.</p>
|
349 + | pub fn checksum_aggregation_method(
|
350 + | &self,
|
351 + | ) -> ::std::option::Option<&crate::model::ChecksumAggregationMethod> {
|
352 + | self.checksum_aggregation_method.as_ref()
|
353 + | }
|
354 + | /// <p>The algorithm used to generate the checksum. Currently, the only supported algorithm is <code>SHA256</code>.</p>
|
355 + | pub fn checksum_algorithm(&self) -> ::std::option::Option<&crate::model::ChecksumAlgorithm> {
|
356 + | self.checksum_algorithm.as_ref()
|
357 + | }
|
358 + | /// <p>The ID of the snapshot.</p>
|
359 + | pub fn snapshot_id(&self) -> &crate::model::SnapshotId {
|
360 + | &self.snapshot_id
|
361 + | }
|
362 + | /// <p>An aggregated Base-64 SHA256 checksum based on the checksums of each written block.</p>
|
363 + | /// <p>To generate the aggregated checksum using the linear aggregation method, arrange the checksums for each written block in ascending order of their block index, concatenate them to form a single string, and then generate the checksum on the entire string using the SHA256 algorithm.</p>
|
364 + | pub fn checksum(&self) -> ::std::option::Option<&crate::model::Checksum> {
|
365 + | self.checksum.as_ref()
|
366 + | }
|
367 + | }
|
368 + | impl CompleteSnapshotInput {
|
369 + | /// Creates a new builder-style object to manufacture [`CompleteSnapshotInput`](crate::input::CompleteSnapshotInput).
|
370 + | pub fn builder() -> crate::input::complete_snapshot_input::Builder {
|
371 + | crate::input::complete_snapshot_input::Builder::default()
|
372 + | }
|
373 + | }
|
374 + | impl crate::constrained::Constrained for crate::input::CompleteSnapshotInput {
|
375 + | type Unconstrained = crate::input::complete_snapshot_input::Builder;
|
376 + | }
|
377 + | /// See [`StartSnapshotInput`](crate::input::StartSnapshotInput).
|
378 + | pub mod start_snapshot_input {
|
379 + |
|
380 + | #[derive(::std::cmp::PartialEq, ::std::fmt::Debug)]
|
381 + | /// Holds one variant for each of the ways the builder can fail.
|
382 + | #[non_exhaustive]
|
383 + | #[allow(clippy::enum_variant_names)]
|
384 + | pub enum ConstraintViolation {
|
385 + | /// Constraint violation occurred building member `timeout` when building `StartSnapshotInput`.
|
386 + | #[doc(hidden)]
|
387 + | Timeout(crate::model::timeout::ConstraintViolation),
|
388 + | /// Constraint violation occurred building member `client_token` when building `StartSnapshotInput`.
|
389 + | #[doc(hidden)]
|
390 + | ClientToken(crate::model::idempotency_token::ConstraintViolation),
|
391 + | /// `volume_size` was not provided but it is required when building `StartSnapshotInput`.
|
392 + | MissingVolumeSize,
|
393 + | /// Constraint violation occurred building member `volume_size` when building `StartSnapshotInput`.
|
394 + | #[doc(hidden)]
|
395 + | VolumeSize(crate::model::volume_size::ConstraintViolation),
|
396 + | /// Constraint violation occurred building member `tags` when building `StartSnapshotInput`.
|
397 + | #[doc(hidden)]
|
398 + | Tags(crate::model::tags::ConstraintViolation),
|
399 + | /// Constraint violation occurred building member `kms_key_arn` when building `StartSnapshotInput`.
|
400 + | #[doc(hidden)]
|
401 + | KmsKeyArn(crate::model::kms_key_arn::ConstraintViolation),
|
402 + | /// Constraint violation occurred building member `parent_snapshot_id` when building `StartSnapshotInput`.
|
403 + | #[doc(hidden)]
|
404 + | ParentSnapshotId(crate::model::snapshot_id::ConstraintViolation),
|
405 + | /// Constraint violation occurred building member `description` when building `StartSnapshotInput`.
|
406 + | #[doc(hidden)]
|
407 + | Description(crate::model::description::ConstraintViolation),
|
408 + | }
|
409 + | impl ::std::fmt::Display for ConstraintViolation {
|
410 + | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
411 + | match self {
|
412 + | ConstraintViolation::Timeout(_) => write!(f, "constraint violation occurred building member `timeout` when building `StartSnapshotInput`"),
|
413 + | ConstraintViolation::ClientToken(_) => write!(f, "constraint violation occurred building member `client_token` when building `StartSnapshotInput`"),
|
414 + | ConstraintViolation::MissingVolumeSize => write!(f, "`volume_size` was not provided but it is required when building `StartSnapshotInput`"),
|
415 + | ConstraintViolation::VolumeSize(_) => write!(f, "constraint violation occurred building member `volume_size` when building `StartSnapshotInput`"),
|
416 + | ConstraintViolation::Tags(_) => write!(f, "constraint violation occurred building member `tags` when building `StartSnapshotInput`"),
|
417 + | ConstraintViolation::KmsKeyArn(_) => write!(f, "constraint violation occurred building member `kms_key_arn` when building `StartSnapshotInput`"),
|
418 + | ConstraintViolation::ParentSnapshotId(_) => write!(f, "constraint violation occurred building member `parent_snapshot_id` when building `StartSnapshotInput`"),
|
419 + | ConstraintViolation::Description(_) => write!(f, "constraint violation occurred building member `description` when building `StartSnapshotInput`"),
|
420 + | }
|
421 + | }
|
422 + | }
|
423 + | impl ::std::error::Error for ConstraintViolation {}
|
424 + | impl ConstraintViolation {
|
425 + | pub(crate) fn as_validation_exception_field(
|
426 + | self,
|
427 + | path: ::std::string::String,
|
428 + | ) -> crate::model::ValidationExceptionField {
|
429 + | match self {
|
430 + | ConstraintViolation::Timeout(inner) => inner.as_validation_exception_field(path + "/Timeout"),
|
431 + | ConstraintViolation::ClientToken(inner) => inner.as_validation_exception_field(path + "/ClientToken"),
|
432 + | ConstraintViolation::MissingVolumeSize => crate::model::ValidationExceptionField {
|
433 + | message: format!("Value at '{}/VolumeSize' failed to satisfy constraint: Member must not be null", path),
|
434 + | path: path + "/VolumeSize",
|
435 + | },
|
436 + | ConstraintViolation::VolumeSize(inner) => inner.as_validation_exception_field(path + "/VolumeSize"),
|
437 + | ConstraintViolation::Tags(inner) => inner.as_validation_exception_field(path + "/Tags"),
|
438 + | ConstraintViolation::KmsKeyArn(inner) => inner.as_validation_exception_field(path + "/KmsKeyArn"),
|
439 + | ConstraintViolation::ParentSnapshotId(inner) => inner.as_validation_exception_field(path + "/ParentSnapshotId"),
|
440 + | ConstraintViolation::Description(inner) => inner.as_validation_exception_field(path + "/Description"),
|
441 + | }
|
442 + | }
|
443 + | }
|
444 + | impl ::std::convert::From<ConstraintViolation>
|
445 + | for ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection
|
446 + | {
|
447 + | fn from(constraint_violation: ConstraintViolation) -> Self {
|
448 + | let first_validation_exception_field =
|
449 + | constraint_violation.as_validation_exception_field("".to_owned());
|
450 + | let validation_exception = crate::error::ValidationException {
|
451 + | message: format!(
|
452 + | "1 validation error detected. {}",
|
453 + | &first_validation_exception_field.message
|
454 + | ),
|
455 + | field_list: Some(vec![first_validation_exception_field]),
|
456 + | };
|
457 + | Self::ConstraintViolation(
|
458 + | crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(&validation_exception)
|
459 + | .expect("validation exceptions should never fail to serialize; please file a bug report under https://github.com/smithy-lang/smithy-rs/issues")
|
460 + | )
|
461 + | }
|
462 + | }
|
463 + | impl ::std::convert::From<Builder>
|
464 + | for crate::constrained::MaybeConstrained<crate::input::StartSnapshotInput>
|
465 + | {
|
466 + | fn from(builder: Builder) -> Self {
|
467 + | Self::Unconstrained(builder)
|
468 + | }
|
469 + | }
|
470 + | impl ::std::convert::TryFrom<Builder> for crate::input::StartSnapshotInput {
|
471 + | type Error = ConstraintViolation;
|
472 + |
|
473 + | fn try_from(builder: Builder) -> ::std::result::Result<Self, Self::Error> {
|
474 + | builder.build()
|
475 + | }
|
476 + | }
|
477 + | /// A builder for [`StartSnapshotInput`](crate::input::StartSnapshotInput).
|
478 + | #[derive(::std::clone::Clone, ::std::default::Default)]
|
479 + | pub struct Builder {
|
480 + | pub(crate) timeout:
|
481 + | ::std::option::Option<crate::constrained::MaybeConstrained<crate::model::Timeout>>,
|
482 + | pub(crate) client_token: ::std::option::Option<
|
483 + | crate::constrained::MaybeConstrained<crate::model::IdempotencyToken>,
|
484 + | >,
|
485 + | pub(crate) volume_size:
|
486 + | ::std::option::Option<crate::constrained::MaybeConstrained<crate::model::VolumeSize>>,
|
487 + | pub(crate) tags: ::std::option::Option<
|
488 + | crate::constrained::MaybeConstrained<
|
489 + | crate::constrained::tags_constrained::TagsConstrained,
|
490 + | >,
|
491 + | >,
|
492 + | pub(crate) encrypted: ::std::option::Option<bool>,
|
493 + | pub(crate) kms_key_arn:
|
494 + | ::std::option::Option<crate::constrained::MaybeConstrained<crate::model::KmsKeyArn>>,
|
495 + | pub(crate) parent_snapshot_id:
|
496 + | ::std::option::Option<crate::constrained::MaybeConstrained<crate::model::SnapshotId>>,
|
497 + | pub(crate) description:
|
498 + | ::std::option::Option<crate::constrained::MaybeConstrained<crate::model::Description>>,
|
499 + | }
|
500 + | impl Builder {
|
501 + | /// <p>The amount of time (in minutes) after which the snapshot is automatically cancelled if:</p>
|
502 + | /// <ul>
|
503 + | /// <li>
|
504 + | /// <p>No blocks are written to the snapshot.</p></li>
|
505 + | /// <li>
|
506 + | /// <p>The snapshot is not completed after writing the last block of data.</p></li>
|
507 + | /// </ul>
|
508 + | /// <p>If no value is specified, the timeout defaults to <code>60</code> minutes.</p>
|
509 + | pub fn timeout(mut self, input: ::std::option::Option<crate::model::Timeout>) -> Self {
|
510 + | self.timeout = input.map(crate::constrained::MaybeConstrained::Constrained);
|
511 + | self
|
512 + | }
|
513 + | /// <p>The amount of time (in minutes) after which the snapshot is automatically cancelled if:</p>
|
514 + | /// <ul>
|
515 + | /// <li>
|
516 + | /// <p>No blocks are written to the snapshot.</p></li>
|
517 + | /// <li>
|
518 + | /// <p>The snapshot is not completed after writing the last block of data.</p></li>
|
519 + | /// </ul>
|
520 + | /// <p>If no value is specified, the timeout defaults to <code>60</code> minutes.</p>
|
521 + | pub(crate) fn set_timeout(
|
522 + | mut self,
|
523 + | input: Option<
|
524 + | impl ::std::convert::Into<crate::constrained::MaybeConstrained<crate::model::Timeout>>,
|
525 + | >,
|
526 + | ) -> Self {
|
527 + | self.timeout = input.map(|v| v.into());
|
528 + | self
|
529 + | }
|
530 + | /// <p>A unique, case-sensitive identifier that you provide to ensure the idempotency of the request. Idempotency ensures that an API request completes only once. With an idempotent request, if the original request completes successfully. The subsequent retries with the same client token return the result from the original successful request and they have no additional effect.</p>
|
531 + | /// <p>If you do not specify a client token, one is automatically generated by the AWS SDK.</p>
|
532 + | /// <p>For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-direct-api-idempotency.html"> Idempotency for StartSnapshot API</a> in the <i>Amazon Elastic Compute Cloud User Guide</i>.</p>
|
533 + | pub fn client_token(
|
534 + | mut self,
|
535 + | input: ::std::option::Option<crate::model::IdempotencyToken>,
|
536 + | ) -> Self {
|
537 + | self.client_token = input.map(crate::constrained::MaybeConstrained::Constrained);
|
538 + | self
|
539 + | }
|
540 + | /// <p>A unique, case-sensitive identifier that you provide to ensure the idempotency of the request. Idempotency ensures that an API request completes only once. With an idempotent request, if the original request completes successfully. The subsequent retries with the same client token return the result from the original successful request and they have no additional effect.</p>
|
541 + | /// <p>If you do not specify a client token, one is automatically generated by the AWS SDK.</p>
|
542 + | /// <p>For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-direct-api-idempotency.html"> Idempotency for StartSnapshot API</a> in the <i>Amazon Elastic Compute Cloud User Guide</i>.</p>
|
543 + | pub(crate) fn set_client_token(
|
544 + | mut self,
|
545 + | input: Option<
|
546 + | impl ::std::convert::Into<
|
547 + | crate::constrained::MaybeConstrained<crate::model::IdempotencyToken>,
|
548 + | >,
|
549 + | >,
|
550 + | ) -> Self {
|
551 + | self.client_token = input.map(|v| v.into());
|
552 + | self
|
553 + | }
|
554 + | /// <p>The size of the volume, in GiB. The maximum size is <code>16384</code> GiB (16 TiB).</p>
|
555 + | pub fn volume_size(mut self, input: crate::model::VolumeSize) -> Self {
|
556 + | self.volume_size = Some(crate::constrained::MaybeConstrained::Constrained(input));
|
557 + | self
|
558 + | }
|
559 + | /// <p>The size of the volume, in GiB. The maximum size is <code>16384</code> GiB (16 TiB).</p>
|
560 + | pub(crate) fn set_volume_size(
|
561 + | mut self,
|
562 + | input: impl ::std::convert::Into<
|
563 + | crate::constrained::MaybeConstrained<crate::model::VolumeSize>,
|
564 + | >,
|
565 + | ) -> Self {
|
566 + | self.volume_size = Some(input.into());
|
567 + | self
|
568 + | }
|
569 + | /// <p>The tags to apply to the snapshot.</p>
|
570 + | pub fn tags(
|
571 + | mut self,
|
572 + | input: ::std::option::Option<::std::vec::Vec<crate::model::Tag>>,
|
573 + | ) -> Self {
|
574 + | self.tags =
|
575 + | input.map(|v| crate::constrained::MaybeConstrained::Constrained((v).into()));
|
576 + | self
|
577 + | }
|
578 + | /// <p>The tags to apply to the snapshot.</p>
|
579 + | pub(crate) fn set_tags(
|
580 + | mut self,
|
581 + | input: Option<
|
582 + | impl ::std::convert::Into<
|
583 + | crate::constrained::MaybeConstrained<
|
584 + | crate::constrained::tags_constrained::TagsConstrained,
|
585 + | >,
|
586 + | >,
|
587 + | >,
|
588 + | ) -> Self {
|
589 + | self.tags = input.map(|v| v.into());
|
590 + | self
|
591 + | }
|
592 + | /// <p>Indicates whether to encrypt the snapshot. To create an encrypted snapshot, specify <code>true</code>. To create an unencrypted snapshot, omit this parameter.</p>
|
593 + | /// <p>If you specify a value for <b>ParentSnapshotId</b>, omit this parameter.</p>
|
594 + | /// <p>If you specify <code>true</code>, the snapshot is encrypted using the CMK specified using the <b>KmsKeyArn</b> parameter. If no value is specified for <b>KmsKeyArn</b>, the default CMK for your account is used. If no default CMK has been specified for your account, the AWS managed CMK is used. To set a default CMK for your account, use <a href="https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_ModifyEbsDefaultKmsKeyId.html"> ModifyEbsDefaultKmsKeyId</a>.</p>
|
595 + | /// <p>If your account is enabled for encryption by default, you cannot set this parameter to <code>false</code>. In this case, you can omit this parameter.</p>
|
596 + | /// <p>For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-accessing-snapshot.html#ebsapis-using-encryption"> Using encryption</a> in the <i>Amazon Elastic Compute Cloud User Guide</i>.</p>
|
597 + | pub fn encrypted(mut self, input: ::std::option::Option<bool>) -> Self {
|
598 + | self.encrypted = input;
|
599 + | self
|
600 + | }
|
601 + | /// <p>Indicates whether to encrypt the snapshot. To create an encrypted snapshot, specify <code>true</code>. To create an unencrypted snapshot, omit this parameter.</p>
|
602 + | /// <p>If you specify a value for <b>ParentSnapshotId</b>, omit this parameter.</p>
|
603 + | /// <p>If you specify <code>true</code>, the snapshot is encrypted using the CMK specified using the <b>KmsKeyArn</b> parameter. If no value is specified for <b>KmsKeyArn</b>, the default CMK for your account is used. If no default CMK has been specified for your account, the AWS managed CMK is used. To set a default CMK for your account, use <a href="https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_ModifyEbsDefaultKmsKeyId.html"> ModifyEbsDefaultKmsKeyId</a>.</p>
|
604 + | /// <p>If your account is enabled for encryption by default, you cannot set this parameter to <code>false</code>. In this case, you can omit this parameter.</p>
|
605 + | /// <p>For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-accessing-snapshot.html#ebsapis-using-encryption"> Using encryption</a> in the <i>Amazon Elastic Compute Cloud User Guide</i>.</p>
|
606 + | pub(crate) fn set_encrypted(
|
607 + | mut self,
|
608 + | input: Option<impl ::std::convert::Into<bool>>,
|
609 + | ) -> Self {
|
610 + | self.encrypted = input.map(|v| v.into());
|
611 + | self
|
612 + | }
|
613 + | /// <p>The Amazon Resource Name (ARN) of the AWS Key Management Service (AWS KMS) customer master key (CMK) to be used to encrypt the snapshot. If you do not specify a CMK, the default AWS managed CMK is used.</p>
|
614 + | /// <p>If you specify a <b>ParentSnapshotId</b>, omit this parameter; the snapshot will be encrypted using the same CMK that was used to encrypt the parent snapshot.</p>
|
615 + | /// <p>If <b>Encrypted</b> is set to <code>true</code>, you must specify a CMK ARN.</p>
|
616 + | pub fn kms_key_arn(
|
617 + | mut self,
|
618 + | input: ::std::option::Option<crate::model::KmsKeyArn>,
|
619 + | ) -> Self {
|
620 + | self.kms_key_arn = input.map(crate::constrained::MaybeConstrained::Constrained);
|
621 + | self
|
622 + | }
|
623 + | /// <p>The Amazon Resource Name (ARN) of the AWS Key Management Service (AWS KMS) customer master key (CMK) to be used to encrypt the snapshot. If you do not specify a CMK, the default AWS managed CMK is used.</p>
|
624 + | /// <p>If you specify a <b>ParentSnapshotId</b>, omit this parameter; the snapshot will be encrypted using the same CMK that was used to encrypt the parent snapshot.</p>
|
625 + | /// <p>If <b>Encrypted</b> is set to <code>true</code>, you must specify a CMK ARN.</p>
|
626 + | pub(crate) fn set_kms_key_arn(
|
627 + | mut self,
|
628 + | input: Option<
|
629 + | impl ::std::convert::Into<crate::constrained::MaybeConstrained<crate::model::KmsKeyArn>>,
|
630 + | >,
|
631 + | ) -> Self {
|
632 + | self.kms_key_arn = input.map(|v| v.into());
|
633 + | self
|
634 + | }
|
635 + | /// <p>The ID of the parent snapshot. If there is no parent snapshot, or if you are creating the first snapshot for an on-premises volume, omit this parameter.</p>
|
636 + | /// <p>If your account is enabled for encryption by default, you cannot use an unencrypted snapshot as a parent snapshot. You must first create an encrypted copy of the parent snapshot using <a href="https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_CopySnapshot.html">CopySnapshot</a>.</p>
|
637 + | pub fn parent_snapshot_id(
|
638 + | mut self,
|
639 + | input: ::std::option::Option<crate::model::SnapshotId>,
|
640 + | ) -> Self {
|
641 + | self.parent_snapshot_id = input.map(crate::constrained::MaybeConstrained::Constrained);
|
642 + | self
|
643 + | }
|
644 + | /// <p>The ID of the parent snapshot. If there is no parent snapshot, or if you are creating the first snapshot for an on-premises volume, omit this parameter.</p>
|
645 + | /// <p>If your account is enabled for encryption by default, you cannot use an unencrypted snapshot as a parent snapshot. You must first create an encrypted copy of the parent snapshot using <a href="https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_CopySnapshot.html">CopySnapshot</a>.</p>
|
646 + | pub(crate) fn set_parent_snapshot_id(
|
647 + | mut self,
|
648 + | input: Option<
|
649 + | impl ::std::convert::Into<
|
650 + | crate::constrained::MaybeConstrained<crate::model::SnapshotId>,
|
651 + | >,
|
652 + | >,
|
653 + | ) -> Self {
|
654 + | self.parent_snapshot_id = input.map(|v| v.into());
|
655 + | self
|
656 + | }
|
657 + | /// <p>A description for the snapshot.</p>
|
658 + | pub fn description(
|
659 + | mut self,
|
660 + | input: ::std::option::Option<crate::model::Description>,
|
661 + | ) -> Self {
|
662 + | self.description = input.map(crate::constrained::MaybeConstrained::Constrained);
|
663 + | self
|
664 + | }
|
665 + | /// <p>A description for the snapshot.</p>
|
666 + | pub(crate) fn set_description(
|
667 + | mut self,
|
668 + | input: Option<
|
669 + | impl ::std::convert::Into<
|
670 + | crate::constrained::MaybeConstrained<crate::model::Description>,
|
671 + | >,
|
672 + | >,
|
673 + | ) -> Self {
|
674 + | self.description = input.map(|v| v.into());
|
675 + | self
|
676 + | }
|
677 + | /// Consumes the builder and constructs a [`StartSnapshotInput`](crate::input::StartSnapshotInput).
|
678 + | ///
|
679 + | /// The builder fails to construct a [`StartSnapshotInput`](crate::input::StartSnapshotInput) if a [`ConstraintViolation`] occurs.
|
680 + | ///
|
681 + | /// If the builder fails, it will return the _first_ encountered [`ConstraintViolation`].
|
682 + | pub fn build(self) -> Result<crate::input::StartSnapshotInput, ConstraintViolation> {
|
683 + | self.build_enforcing_all_constraints()
|
684 + | }
|
685 + | fn build_enforcing_all_constraints(
|
686 + | self,
|
687 + | ) -> Result<crate::input::StartSnapshotInput, ConstraintViolation> {
|
688 + | Ok(crate::input::StartSnapshotInput {
|
689 + | timeout: self
|
690 + | .timeout
|
691 + | .map(|v| match v {
|
692 + | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
693 + | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
694 + | })
|
695 + | .map(|res| res.map_err(ConstraintViolation::Timeout))
|
696 + | .transpose()?,
|
697 + | client_token: self
|
698 + | .client_token
|
699 + | .map(|v| match v {
|
700 + | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
701 + | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
702 + | })
|
703 + | .map(|res| res.map_err(ConstraintViolation::ClientToken))
|
704 + | .transpose()?,
|
705 + | volume_size: self
|
706 + | .volume_size
|
707 + | .map(|v| match v {
|
708 + | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
709 + | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
710 + | })
|
711 + | .map(|res| res.map_err(ConstraintViolation::VolumeSize))
|
712 + | .transpose()?
|
713 + | .ok_or(ConstraintViolation::MissingVolumeSize)?,
|
714 + | tags: self
|
715 + | .tags
|
716 + | .map(|v| match v {
|
717 + | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
718 + | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
719 + | })
|
720 + | .map(|res| res.map(|v| v.into()).map_err(ConstraintViolation::Tags))
|
721 + | .transpose()?,
|
722 + | encrypted: self.encrypted,
|
723 + | kms_key_arn: self
|
724 + | .kms_key_arn
|
725 + | .map(|v| match v {
|
726 + | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
727 + | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
728 + | })
|
729 + | .map(|res| res.map_err(ConstraintViolation::KmsKeyArn))
|
730 + | .transpose()?,
|
731 + | parent_snapshot_id: self
|
732 + | .parent_snapshot_id
|
733 + | .map(|v| match v {
|
734 + | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
735 + | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
736 + | })
|
737 + | .map(|res| res.map_err(ConstraintViolation::ParentSnapshotId))
|
738 + | .transpose()?,
|
739 + | description: self
|
740 + | .description
|
741 + | .map(|v| match v {
|
742 + | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
743 + | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
744 + | })
|
745 + | .map(|res| res.map_err(ConstraintViolation::Description))
|
746 + | .transpose()?,
|
747 + | })
|
748 + | }
|
749 + | }
|
750 + | impl ::std::fmt::Debug for Builder {
|
751 + | fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
|
752 + | let mut formatter = f.debug_struct("Builder");
|
753 + | formatter.field("timeout", &self.timeout);
|
754 + | formatter.field("client_token", &self.client_token);
|
755 + | formatter.field("volume_size", &self.volume_size);
|
756 + | formatter.field("tags", &self.tags);
|
757 + | formatter.field("encrypted", &self.encrypted);
|
758 + | formatter.field("kms_key_arn", &"*** Sensitive Data Redacted ***");
|
759 + | formatter.field("parent_snapshot_id", &self.parent_snapshot_id);
|
760 + | formatter.field("description", &self.description);
|
761 + | formatter.finish()
|
762 + | }
|
763 + | }
|
764 + | }
|
765 + | /// See [`PutSnapshotBlockInput`](crate::input::PutSnapshotBlockInput).
|
766 + | pub mod put_snapshot_block_input {
|
767 + |
|
768 + | #[derive(::std::cmp::PartialEq, ::std::fmt::Debug)]
|
769 + | /// Holds one variant for each of the ways the builder can fail.
|
770 + | #[non_exhaustive]
|
771 + | #[allow(clippy::enum_variant_names)]
|
772 + | pub enum ConstraintViolation {
|
773 + | /// `snapshot_id` was not provided but it is required when building `PutSnapshotBlockInput`.
|
774 + | MissingSnapshotId,
|
775 + | /// Constraint violation occurred building member `snapshot_id` when building `PutSnapshotBlockInput`.
|
776 + | #[doc(hidden)]
|
777 + | SnapshotId(crate::model::snapshot_id::ConstraintViolation),
|
778 + | /// `block_index` was not provided but it is required when building `PutSnapshotBlockInput`.
|
779 + | MissingBlockIndex,
|
780 + | /// Constraint violation occurred building member `block_index` when building `PutSnapshotBlockInput`.
|
781 + | #[doc(hidden)]
|
782 + | BlockIndex(crate::model::block_index::ConstraintViolation),
|
783 + | /// `checksum` was not provided but it is required when building `PutSnapshotBlockInput`.
|
784 + | MissingChecksum,
|
785 + | /// Constraint violation occurred building member `checksum` when building `PutSnapshotBlockInput`.
|
786 + | #[doc(hidden)]
|
787 + | Checksum(crate::model::checksum::ConstraintViolation),
|
788 + | /// Constraint violation occurred building member `progress` when building `PutSnapshotBlockInput`.
|
789 + | #[doc(hidden)]
|
790 + | Progress(crate::model::progress::ConstraintViolation),
|
791 + | /// `block_data` was not provided but it is required when building `PutSnapshotBlockInput`.
|
792 + | MissingBlockData,
|
793 + | /// `data_length` was not provided but it is required when building `PutSnapshotBlockInput`.
|
794 + | MissingDataLength,
|
795 + | /// `checksum_algorithm` was not provided but it is required when building `PutSnapshotBlockInput`.
|
796 + | MissingChecksumAlgorithm,
|
797 + | /// Constraint violation occurred building member `checksum_algorithm` when building `PutSnapshotBlockInput`.
|
798 + | #[doc(hidden)]
|
799 + | ChecksumAlgorithm(crate::model::checksum_algorithm::ConstraintViolation),
|
800 + | }
|
801 + | impl ::std::fmt::Display for ConstraintViolation {
|
802 + | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
803 + | match self {
|
804 + | ConstraintViolation::MissingSnapshotId => write!(f, "`snapshot_id` was not provided but it is required when building `PutSnapshotBlockInput`"),
|
805 + | ConstraintViolation::SnapshotId(_) => write!(f, "constraint violation occurred building member `snapshot_id` when building `PutSnapshotBlockInput`"),
|
806 + | ConstraintViolation::MissingBlockIndex => write!(f, "`block_index` was not provided but it is required when building `PutSnapshotBlockInput`"),
|
807 + | ConstraintViolation::BlockIndex(_) => write!(f, "constraint violation occurred building member `block_index` when building `PutSnapshotBlockInput`"),
|
808 + | ConstraintViolation::MissingChecksum => write!(f, "`checksum` was not provided but it is required when building `PutSnapshotBlockInput`"),
|
809 + | ConstraintViolation::Checksum(_) => write!(f, "constraint violation occurred building member `checksum` when building `PutSnapshotBlockInput`"),
|
810 + | ConstraintViolation::Progress(_) => write!(f, "constraint violation occurred building member `progress` when building `PutSnapshotBlockInput`"),
|
811 + | ConstraintViolation::MissingBlockData => write!(f, "`block_data` was not provided but it is required when building `PutSnapshotBlockInput`"),
|
812 + | ConstraintViolation::MissingDataLength => write!(f, "`data_length` was not provided but it is required when building `PutSnapshotBlockInput`"),
|
813 + | ConstraintViolation::MissingChecksumAlgorithm => write!(f, "`checksum_algorithm` was not provided but it is required when building `PutSnapshotBlockInput`"),
|
814 + | ConstraintViolation::ChecksumAlgorithm(_) => write!(f, "constraint violation occurred building member `checksum_algorithm` when building `PutSnapshotBlockInput`"),
|
815 + | }
|
816 + | }
|
817 + | }
|
818 + | impl ::std::error::Error for ConstraintViolation {}
|
819 + | impl ConstraintViolation {
|
820 + | pub(crate) fn as_validation_exception_field(
|
821 + | self,
|
822 + | path: ::std::string::String,
|
823 + | ) -> crate::model::ValidationExceptionField {
|
824 + | match self {
|
825 + | ConstraintViolation::MissingSnapshotId => crate::model::ValidationExceptionField {
|
826 + | message: format!("Value at '{}/SnapshotId' failed to satisfy constraint: Member must not be null", path),
|
827 + | path: path + "/SnapshotId",
|
828 + | },
|
829 + | ConstraintViolation::SnapshotId(inner) => inner.as_validation_exception_field(path + "/SnapshotId"),
|
830 + | ConstraintViolation::MissingBlockIndex => crate::model::ValidationExceptionField {
|
831 + | message: format!("Value at '{}/BlockIndex' failed to satisfy constraint: Member must not be null", path),
|
832 + | path: path + "/BlockIndex",
|
833 + | },
|
834 + | ConstraintViolation::BlockIndex(inner) => inner.as_validation_exception_field(path + "/BlockIndex"),
|
835 + | ConstraintViolation::MissingChecksum => crate::model::ValidationExceptionField {
|
836 + | message: format!("Value at '{}/Checksum' failed to satisfy constraint: Member must not be null", path),
|
837 + | path: path + "/Checksum",
|
838 + | },
|
839 + | ConstraintViolation::Checksum(inner) => inner.as_validation_exception_field(path + "/Checksum"),
|
840 + | ConstraintViolation::Progress(inner) => inner.as_validation_exception_field(path + "/Progress"),
|
841 + | ConstraintViolation::MissingBlockData => crate::model::ValidationExceptionField {
|
842 + | message: format!("Value at '{}/BlockData' failed to satisfy constraint: Member must not be null", path),
|
843 + | path: path + "/BlockData",
|
844 + | },
|
845 + | ConstraintViolation::MissingDataLength => crate::model::ValidationExceptionField {
|
846 + | message: format!("Value at '{}/DataLength' failed to satisfy constraint: Member must not be null", path),
|
847 + | path: path + "/DataLength",
|
848 + | },
|
849 + | ConstraintViolation::MissingChecksumAlgorithm => crate::model::ValidationExceptionField {
|
850 + | message: format!("Value at '{}/ChecksumAlgorithm' failed to satisfy constraint: Member must not be null", path),
|
851 + | path: path + "/ChecksumAlgorithm",
|
852 + | },
|
853 + | ConstraintViolation::ChecksumAlgorithm(inner) => inner.as_validation_exception_field(path + "/ChecksumAlgorithm"),
|
854 + | }
|
855 + | }
|
856 + | }
|
857 + | impl ::std::convert::From<ConstraintViolation>
|
858 + | for ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection
|
859 + | {
|
860 + | fn from(constraint_violation: ConstraintViolation) -> Self {
|
861 + | let first_validation_exception_field =
|
862 + | constraint_violation.as_validation_exception_field("".to_owned());
|
863 + | let validation_exception = crate::error::ValidationException {
|
864 + | message: format!(
|
865 + | "1 validation error detected. {}",
|
866 + | &first_validation_exception_field.message
|
867 + | ),
|
868 + | field_list: Some(vec![first_validation_exception_field]),
|
869 + | };
|
870 + | Self::ConstraintViolation(
|
871 + | crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(&validation_exception)
|
872 + | .expect("validation exceptions should never fail to serialize; please file a bug report under https://github.com/smithy-lang/smithy-rs/issues")
|
873 + | )
|
874 + | }
|
875 + | }
|
876 + | impl ::std::convert::From<Builder>
|
877 + | for crate::constrained::MaybeConstrained<crate::input::PutSnapshotBlockInput>
|
878 + | {
|
879 + | fn from(builder: Builder) -> Self {
|
880 + | Self::Unconstrained(builder)
|
881 + | }
|
882 + | }
|
883 + | impl ::std::convert::TryFrom<Builder> for crate::input::PutSnapshotBlockInput {
|
884 + | type Error = ConstraintViolation;
|
885 + |
|
886 + | fn try_from(builder: Builder) -> ::std::result::Result<Self, Self::Error> {
|
887 + | builder.build()
|
888 + | }
|
889 + | }
|
890 + | /// A builder for [`PutSnapshotBlockInput`](crate::input::PutSnapshotBlockInput).
|
891 + | #[derive(::std::default::Default)]
|
892 + | pub struct Builder {
|
893 + | pub(crate) snapshot_id:
|
894 + | ::std::option::Option<crate::constrained::MaybeConstrained<crate::model::SnapshotId>>,
|
895 + | pub(crate) block_index:
|
896 + | ::std::option::Option<crate::constrained::MaybeConstrained<crate::model::BlockIndex>>,
|
897 + | pub(crate) checksum:
|
898 + | ::std::option::Option<crate::constrained::MaybeConstrained<crate::model::Checksum>>,
|
899 + | pub(crate) progress:
|
900 + | ::std::option::Option<crate::constrained::MaybeConstrained<crate::model::Progress>>,
|
901 + | pub(crate) block_data: ::std::option::Option<::aws_smithy_types::byte_stream::ByteStream>,
|
902 + | pub(crate) data_length: ::std::option::Option<i32>,
|
903 + | pub(crate) checksum_algorithm: ::std::option::Option<
|
904 + | crate::constrained::MaybeConstrained<crate::model::ChecksumAlgorithm>,
|
905 + | >,
|
906 + | }
|
907 + | impl Builder {
|
908 + | /// <p>The ID of the snapshot.</p>
|
909 + | pub fn snapshot_id(mut self, input: crate::model::SnapshotId) -> Self {
|
910 + | self.snapshot_id = Some(crate::constrained::MaybeConstrained::Constrained(input));
|
911 + | self
|
912 + | }
|
913 + | /// <p>The ID of the snapshot.</p>
|
914 + | pub(crate) fn set_snapshot_id(
|
915 + | mut self,
|
916 + | input: impl ::std::convert::Into<
|
917 + | crate::constrained::MaybeConstrained<crate::model::SnapshotId>,
|
918 + | >,
|
919 + | ) -> Self {
|
920 + | self.snapshot_id = Some(input.into());
|
921 + | self
|
922 + | }
|
923 + | /// <p>The block index of the block in which to write the data. A block index is a logical index in units of <code>512</code> KiB blocks. To identify the block index, divide the logical offset of the data in the logical volume by the block size (logical offset of data/<code>524288</code>). The logical offset of the data must be <code>512</code> KiB aligned.</p>
|
924 + | pub fn block_index(mut self, input: crate::model::BlockIndex) -> Self {
|
925 + | self.block_index = Some(crate::constrained::MaybeConstrained::Constrained(input));
|
926 + | self
|
927 + | }
|
928 + | /// <p>The block index of the block in which to write the data. A block index is a logical index in units of <code>512</code> KiB blocks. To identify the block index, divide the logical offset of the data in the logical volume by the block size (logical offset of data/<code>524288</code>). The logical offset of the data must be <code>512</code> KiB aligned.</p>
|
929 + | pub(crate) fn set_block_index(
|
930 + | mut self,
|
931 + | input: impl ::std::convert::Into<
|
932 + | crate::constrained::MaybeConstrained<crate::model::BlockIndex>,
|
933 + | >,
|
934 + | ) -> Self {
|
935 + | self.block_index = Some(input.into());
|
936 + | self
|
937 + | }
|
938 + | /// <p>A Base64-encoded SHA256 checksum of the data. Only SHA256 checksums are supported.</p>
|
939 + | pub fn checksum(mut self, input: crate::model::Checksum) -> Self {
|
940 + | self.checksum = Some(crate::constrained::MaybeConstrained::Constrained(input));
|
941 + | self
|
942 + | }
|
943 + | /// <p>A Base64-encoded SHA256 checksum of the data. Only SHA256 checksums are supported.</p>
|
944 + | pub(crate) fn set_checksum(
|
945 + | mut self,
|
946 + | input: impl ::std::convert::Into<
|
947 + | crate::constrained::MaybeConstrained<crate::model::Checksum>,
|
948 + | >,
|
949 + | ) -> Self {
|
950 + | self.checksum = Some(input.into());
|
951 + | self
|
952 + | }
|
953 + | /// <p>The progress of the write process, as a percentage.</p>
|
954 + | pub fn progress(mut self, input: ::std::option::Option<crate::model::Progress>) -> Self {
|
955 + | self.progress = input.map(crate::constrained::MaybeConstrained::Constrained);
|
956 + | self
|
957 + | }
|
958 + | /// <p>The progress of the write process, as a percentage.</p>
|
959 + | pub(crate) fn set_progress(
|
960 + | mut self,
|
961 + | input: Option<
|
962 + | impl ::std::convert::Into<crate::constrained::MaybeConstrained<crate::model::Progress>>,
|
963 + | >,
|
964 + | ) -> Self {
|
965 + | self.progress = input.map(|v| v.into());
|
966 + | self
|
967 + | }
|
968 + | /// <p>The data to write to the block.</p>
|
969 + | /// <p>The block data is not signed as part of the Signature Version 4 signing process. As a result, you must generate and provide a Base64-encoded SHA256 checksum for the block data using the <b>x-amz-Checksum</b> header. Also, you must specify the checksum algorithm using the <b>x-amz-Checksum-Algorithm</b> header. The checksum that you provide is part of the Signature Version 4 signing process. It is validated against a checksum generated by Amazon EBS to ensure the validity and authenticity of the data. If the checksums do not correspond, the request fails. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-accessing-snapshot.html#ebsapis-using-checksums"> Using checksums with the EBS direct APIs</a> in the <i>Amazon Elastic Compute Cloud User Guide</i>.</p>
|
970 + | pub fn block_data(mut self, input: ::aws_smithy_types::byte_stream::ByteStream) -> Self {
|
971 + | self.block_data = Some(input);
|
972 + | self
|
973 + | }
|
974 + | /// <p>The data to write to the block.</p>
|
975 + | /// <p>The block data is not signed as part of the Signature Version 4 signing process. As a result, you must generate and provide a Base64-encoded SHA256 checksum for the block data using the <b>x-amz-Checksum</b> header. Also, you must specify the checksum algorithm using the <b>x-amz-Checksum-Algorithm</b> header. The checksum that you provide is part of the Signature Version 4 signing process. It is validated against a checksum generated by Amazon EBS to ensure the validity and authenticity of the data. If the checksums do not correspond, the request fails. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-accessing-snapshot.html#ebsapis-using-checksums"> Using checksums with the EBS direct APIs</a> in the <i>Amazon Elastic Compute Cloud User Guide</i>.</p>
|
976 + | pub(crate) fn set_block_data(
|
977 + | mut self,
|
978 + | input: impl ::std::convert::Into<::aws_smithy_types::byte_stream::ByteStream>,
|
979 + | ) -> Self {
|
980 + | self.block_data = Some(input.into());
|
981 + | self
|
982 + | }
|
983 + | /// <p>The size of the data to write to the block, in bytes. Currently, the only supported size is <code>524288</code>.</p>
|
984 + | /// <p>Valid values: <code>524288</code></p>
|
985 + | pub fn data_length(mut self, input: i32) -> Self {
|
986 + | self.data_length = Some(input);
|
987 + | self
|
988 + | }
|
989 + | /// <p>The size of the data to write to the block, in bytes. Currently, the only supported size is <code>524288</code>.</p>
|
990 + | /// <p>Valid values: <code>524288</code></p>
|
991 + | pub(crate) fn set_data_length(mut self, input: impl ::std::convert::Into<i32>) -> Self {
|
992 + | self.data_length = Some(input.into());
|
993 + | self
|
994 + | }
|
995 + | /// <p>The algorithm used to generate the checksum. Currently, the only supported algorithm is <code>SHA256</code>.</p>
|
996 + | pub fn checksum_algorithm(mut self, input: crate::model::ChecksumAlgorithm) -> Self {
|
997 + | self.checksum_algorithm =
|
998 + | Some(crate::constrained::MaybeConstrained::Constrained(input));
|
999 + | self
|
1000 + | }
|
1001 + | /// <p>The algorithm used to generate the checksum. Currently, the only supported algorithm is <code>SHA256</code>.</p>
|
1002 + | pub(crate) fn set_checksum_algorithm(
|
1003 + | mut self,
|
1004 + | input: impl ::std::convert::Into<
|
1005 + | crate::constrained::MaybeConstrained<crate::model::ChecksumAlgorithm>,
|
1006 + | >,
|
1007 + | ) -> Self {
|
1008 + | self.checksum_algorithm = Some(input.into());
|
1009 + | self
|
1010 + | }
|
1011 + | /// Consumes the builder and constructs a [`PutSnapshotBlockInput`](crate::input::PutSnapshotBlockInput).
|
1012 + | ///
|
1013 + | /// The builder fails to construct a [`PutSnapshotBlockInput`](crate::input::PutSnapshotBlockInput) if a [`ConstraintViolation`] occurs.
|
1014 + | ///
|
1015 + | /// If the builder fails, it will return the _first_ encountered [`ConstraintViolation`].
|
1016 + | pub fn build(self) -> Result<crate::input::PutSnapshotBlockInput, ConstraintViolation> {
|
1017 + | self.build_enforcing_all_constraints()
|
1018 + | }
|
1019 + | fn build_enforcing_all_constraints(
|
1020 + | self,
|
1021 + | ) -> Result<crate::input::PutSnapshotBlockInput, ConstraintViolation> {
|
1022 + | Ok(crate::input::PutSnapshotBlockInput {
|
1023 + | snapshot_id: self
|
1024 + | .snapshot_id
|
1025 + | .map(|v| match v {
|
1026 + | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
1027 + | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
1028 + | })
|
1029 + | .map(|res| res.map_err(ConstraintViolation::SnapshotId))
|
1030 + | .transpose()?
|
1031 + | .ok_or(ConstraintViolation::MissingSnapshotId)?,
|
1032 + | block_index: self
|
1033 + | .block_index
|
1034 + | .map(|v| match v {
|
1035 + | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
1036 + | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
1037 + | })
|
1038 + | .map(|res| res.map_err(ConstraintViolation::BlockIndex))
|
1039 + | .transpose()?
|
1040 + | .ok_or(ConstraintViolation::MissingBlockIndex)?,
|
1041 + | checksum: self
|
1042 + | .checksum
|
1043 + | .map(|v| match v {
|
1044 + | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
1045 + | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
1046 + | })
|
1047 + | .map(|res| res.map_err(ConstraintViolation::Checksum))
|
1048 + | .transpose()?
|
1049 + | .ok_or(ConstraintViolation::MissingChecksum)?,
|
1050 + | progress: self
|
1051 + | .progress
|
1052 + | .map(|v| match v {
|
1053 + | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
1054 + | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
1055 + | })
|
1056 + | .map(|res| res.map_err(ConstraintViolation::Progress))
|
1057 + | .transpose()?,
|
1058 + | block_data: self
|
1059 + | .block_data
|
1060 + | .ok_or(ConstraintViolation::MissingBlockData)?,
|
1061 + | data_length: self
|
1062 + | .data_length
|
1063 + | .ok_or(ConstraintViolation::MissingDataLength)?,
|
1064 + | checksum_algorithm: self
|
1065 + | .checksum_algorithm
|
1066 + | .map(|v| match v {
|
1067 + | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
1068 + | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
1069 + | })
|
1070 + | .map(|res| res.map_err(ConstraintViolation::ChecksumAlgorithm))
|
1071 + | .transpose()?
|
1072 + | .ok_or(ConstraintViolation::MissingChecksumAlgorithm)?,
|
1073 + | })
|
1074 + | }
|
1075 + | }
|
1076 + | impl ::std::fmt::Debug for Builder {
|
1077 + | fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
|
1078 + | let mut formatter = f.debug_struct("Builder");
|
1079 + | formatter.field("snapshot_id", &self.snapshot_id);
|
1080 + | formatter.field("block_index", &self.block_index);
|
1081 + | formatter.field("checksum", &self.checksum);
|
1082 + | formatter.field("progress", &self.progress);
|
1083 + | formatter.field("block_data", &"*** Sensitive Data Redacted ***");
|
1084 + | formatter.field("data_length", &self.data_length);
|
1085 + | formatter.field("checksum_algorithm", &self.checksum_algorithm);
|
1086 + | formatter.finish()
|
1087 + | }
|
1088 + | }
|
1089 + | }
|
1090 + | /// See [`ListSnapshotBlocksInput`](crate::input::ListSnapshotBlocksInput).
|
1091 + | pub mod list_snapshot_blocks_input {
|
1092 + |
|
1093 + | #[derive(::std::cmp::PartialEq, ::std::fmt::Debug)]
|
1094 + | /// Holds one variant for each of the ways the builder can fail.
|
1095 + | #[non_exhaustive]
|
1096 + | #[allow(clippy::enum_variant_names)]
|
1097 + | pub enum ConstraintViolation {
|
1098 + | /// Constraint violation occurred building member `max_results` when building `ListSnapshotBlocksInput`.
|
1099 + | #[doc(hidden)]
|
1100 + | MaxResults(crate::model::max_results::ConstraintViolation),
|
1101 + | /// Constraint violation occurred building member `starting_block_index` when building `ListSnapshotBlocksInput`.
|
1102 + | #[doc(hidden)]
|
1103 + | StartingBlockIndex(crate::model::block_index::ConstraintViolation),
|
1104 + | /// Constraint violation occurred building member `next_token` when building `ListSnapshotBlocksInput`.
|
1105 + | #[doc(hidden)]
|
1106 + | NextToken(crate::model::page_token::ConstraintViolation),
|
1107 + | /// `snapshot_id` was not provided but it is required when building `ListSnapshotBlocksInput`.
|
1108 + | MissingSnapshotId,
|
1109 + | /// Constraint violation occurred building member `snapshot_id` when building `ListSnapshotBlocksInput`.
|
1110 + | #[doc(hidden)]
|
1111 + | SnapshotId(crate::model::snapshot_id::ConstraintViolation),
|
1112 + | }
|
1113 + | impl ::std::fmt::Display for ConstraintViolation {
|
1114 + | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
1115 + | match self {
|
1116 + | ConstraintViolation::MaxResults(_) => write!(f, "constraint violation occurred building member `max_results` when building `ListSnapshotBlocksInput`"),
|
1117 + | ConstraintViolation::StartingBlockIndex(_) => write!(f, "constraint violation occurred building member `starting_block_index` when building `ListSnapshotBlocksInput`"),
|
1118 + | ConstraintViolation::NextToken(_) => write!(f, "constraint violation occurred building member `next_token` when building `ListSnapshotBlocksInput`"),
|
1119 + | ConstraintViolation::MissingSnapshotId => write!(f, "`snapshot_id` was not provided but it is required when building `ListSnapshotBlocksInput`"),
|
1120 + | ConstraintViolation::SnapshotId(_) => write!(f, "constraint violation occurred building member `snapshot_id` when building `ListSnapshotBlocksInput`"),
|
1121 + | }
|
1122 + | }
|
1123 + | }
|
1124 + | impl ::std::error::Error for ConstraintViolation {}
|
1125 + | impl ConstraintViolation {
|
1126 + | pub(crate) fn as_validation_exception_field(
|
1127 + | self,
|
1128 + | path: ::std::string::String,
|
1129 + | ) -> crate::model::ValidationExceptionField {
|
1130 + | match self {
|
1131 + | ConstraintViolation::MaxResults(inner) => inner.as_validation_exception_field(path + "/MaxResults"),
|
1132 + | ConstraintViolation::StartingBlockIndex(inner) => inner.as_validation_exception_field(path + "/StartingBlockIndex"),
|
1133 + | ConstraintViolation::NextToken(inner) => inner.as_validation_exception_field(path + "/NextToken"),
|
1134 + | ConstraintViolation::MissingSnapshotId => crate::model::ValidationExceptionField {
|
1135 + | message: format!("Value at '{}/SnapshotId' failed to satisfy constraint: Member must not be null", path),
|
1136 + | path: path + "/SnapshotId",
|
1137 + | },
|
1138 + | ConstraintViolation::SnapshotId(inner) => inner.as_validation_exception_field(path + "/SnapshotId"),
|
1139 + | }
|
1140 + | }
|
1141 + | }
|
1142 + | impl ::std::convert::From<ConstraintViolation>
|
1143 + | for ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection
|
1144 + | {
|
1145 + | fn from(constraint_violation: ConstraintViolation) -> Self {
|
1146 + | let first_validation_exception_field =
|
1147 + | constraint_violation.as_validation_exception_field("".to_owned());
|
1148 + | let validation_exception = crate::error::ValidationException {
|
1149 + | message: format!(
|
1150 + | "1 validation error detected. {}",
|
1151 + | &first_validation_exception_field.message
|
1152 + | ),
|
1153 + | field_list: Some(vec![first_validation_exception_field]),
|
1154 + | };
|
1155 + | Self::ConstraintViolation(
|
1156 + | crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(&validation_exception)
|
1157 + | .expect("validation exceptions should never fail to serialize; please file a bug report under https://github.com/smithy-lang/smithy-rs/issues")
|
1158 + | )
|
1159 + | }
|
1160 + | }
|
1161 + | impl ::std::convert::From<Builder>
|
1162 + | for crate::constrained::MaybeConstrained<crate::input::ListSnapshotBlocksInput>
|
1163 + | {
|
1164 + | fn from(builder: Builder) -> Self {
|
1165 + | Self::Unconstrained(builder)
|
1166 + | }
|
1167 + | }
|
1168 + | impl ::std::convert::TryFrom<Builder> for crate::input::ListSnapshotBlocksInput {
|
1169 + | type Error = ConstraintViolation;
|
1170 + |
|
1171 + | fn try_from(builder: Builder) -> ::std::result::Result<Self, Self::Error> {
|
1172 + | builder.build()
|
1173 + | }
|
1174 + | }
|
1175 + | /// A builder for [`ListSnapshotBlocksInput`](crate::input::ListSnapshotBlocksInput).
|
1176 + | #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
|
1177 + | pub struct Builder {
|
1178 + | pub(crate) max_results:
|
1179 + | ::std::option::Option<crate::constrained::MaybeConstrained<crate::model::MaxResults>>,
|
1180 + | pub(crate) starting_block_index:
|
1181 + | ::std::option::Option<crate::constrained::MaybeConstrained<crate::model::BlockIndex>>,
|
1182 + | pub(crate) next_token:
|
1183 + | ::std::option::Option<crate::constrained::MaybeConstrained<crate::model::PageToken>>,
|
1184 + | pub(crate) snapshot_id:
|
1185 + | ::std::option::Option<crate::constrained::MaybeConstrained<crate::model::SnapshotId>>,
|
1186 + | }
|
1187 + | impl Builder {
|
1188 + | /// <p>The number of results to return.</p>
|
1189 + | pub fn max_results(
|
1190 + | mut self,
|
1191 + | input: ::std::option::Option<crate::model::MaxResults>,
|
1192 + | ) -> Self {
|
1193 + | self.max_results = input.map(crate::constrained::MaybeConstrained::Constrained);
|
1194 + | self
|
1195 + | }
|
1196 + | /// <p>The number of results to return.</p>
|
1197 + | pub(crate) fn set_max_results(
|
1198 + | mut self,
|
1199 + | input: Option<
|
1200 + | impl ::std::convert::Into<
|
1201 + | crate::constrained::MaybeConstrained<crate::model::MaxResults>,
|
1202 + | >,
|
1203 + | >,
|
1204 + | ) -> Self {
|
1205 + | self.max_results = input.map(|v| v.into());
|
1206 + | self
|
1207 + | }
|
1208 + | /// <p>The block index from which the list should start. The list in the response will start from this block index or the next valid block index in the snapshot.</p>
|
1209 + | pub fn starting_block_index(
|
1210 + | mut self,
|
1211 + | input: ::std::option::Option<crate::model::BlockIndex>,
|
1212 + | ) -> Self {
|
1213 + | self.starting_block_index =
|
1214 + | input.map(crate::constrained::MaybeConstrained::Constrained);
|
1215 + | self
|
1216 + | }
|
1217 + | /// <p>The block index from which the list should start. The list in the response will start from this block index or the next valid block index in the snapshot.</p>
|
1218 + | pub(crate) fn set_starting_block_index(
|
1219 + | mut self,
|
1220 + | input: Option<
|
1221 + | impl ::std::convert::Into<
|
1222 + | crate::constrained::MaybeConstrained<crate::model::BlockIndex>,
|
1223 + | >,
|
1224 + | >,
|
1225 + | ) -> Self {
|
1226 + | self.starting_block_index = input.map(|v| v.into());
|
1227 + | self
|
1228 + | }
|
1229 + | /// <p>The token to request the next page of results.</p>
|
1230 + | pub fn next_token(mut self, input: ::std::option::Option<crate::model::PageToken>) -> Self {
|
1231 + | self.next_token = input.map(crate::constrained::MaybeConstrained::Constrained);
|
1232 + | self
|
1233 + | }
|
1234 + | /// <p>The token to request the next page of results.</p>
|
1235 + | pub(crate) fn set_next_token(
|
1236 + | mut self,
|
1237 + | input: Option<
|
1238 + | impl ::std::convert::Into<crate::constrained::MaybeConstrained<crate::model::PageToken>>,
|
1239 + | >,
|
1240 + | ) -> Self {
|
1241 + | self.next_token = input.map(|v| v.into());
|
1242 + | self
|
1243 + | }
|
1244 + | /// <p>The ID of the snapshot from which to get block indexes and block tokens.</p>
|
1245 + | pub fn snapshot_id(mut self, input: crate::model::SnapshotId) -> Self {
|
1246 + | self.snapshot_id = Some(crate::constrained::MaybeConstrained::Constrained(input));
|
1247 + | self
|
1248 + | }
|
1249 + | /// <p>The ID of the snapshot from which to get block indexes and block tokens.</p>
|
1250 + | pub(crate) fn set_snapshot_id(
|
1251 + | mut self,
|
1252 + | input: impl ::std::convert::Into<
|
1253 + | crate::constrained::MaybeConstrained<crate::model::SnapshotId>,
|
1254 + | >,
|
1255 + | ) -> Self {
|
1256 + | self.snapshot_id = Some(input.into());
|
1257 + | self
|
1258 + | }
|
1259 + | /// Consumes the builder and constructs a [`ListSnapshotBlocksInput`](crate::input::ListSnapshotBlocksInput).
|
1260 + | ///
|
1261 + | /// The builder fails to construct a [`ListSnapshotBlocksInput`](crate::input::ListSnapshotBlocksInput) if a [`ConstraintViolation`] occurs.
|
1262 + | ///
|
1263 + | /// If the builder fails, it will return the _first_ encountered [`ConstraintViolation`].
|
1264 + | pub fn build(self) -> Result<crate::input::ListSnapshotBlocksInput, ConstraintViolation> {
|
1265 + | self.build_enforcing_all_constraints()
|
1266 + | }
|
1267 + | fn build_enforcing_all_constraints(
|
1268 + | self,
|
1269 + | ) -> Result<crate::input::ListSnapshotBlocksInput, ConstraintViolation> {
|
1270 + | Ok(crate::input::ListSnapshotBlocksInput {
|
1271 + | max_results: self
|
1272 + | .max_results
|
1273 + | .map(|v| match v {
|
1274 + | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
1275 + | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
1276 + | })
|
1277 + | .map(|res| res.map_err(ConstraintViolation::MaxResults))
|
1278 + | .transpose()?,
|
1279 + | starting_block_index: self
|
1280 + | .starting_block_index
|
1281 + | .map(|v| match v {
|
1282 + | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
1283 + | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
1284 + | })
|
1285 + | .map(|res| res.map_err(ConstraintViolation::StartingBlockIndex))
|
1286 + | .transpose()?,
|
1287 + | next_token: self
|
1288 + | .next_token
|
1289 + | .map(|v| match v {
|
1290 + | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
1291 + | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
1292 + | })
|
1293 + | .map(|res| res.map_err(ConstraintViolation::NextToken))
|
1294 + | .transpose()?,
|
1295 + | snapshot_id: self
|
1296 + | .snapshot_id
|
1297 + | .map(|v| match v {
|
1298 + | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
1299 + | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
1300 + | })
|
1301 + | .map(|res| res.map_err(ConstraintViolation::SnapshotId))
|
1302 + | .transpose()?
|
1303 + | .ok_or(ConstraintViolation::MissingSnapshotId)?,
|
1304 + | })
|
1305 + | }
|
1306 + | }
|
1307 + | }
|
1308 + | /// See [`ListChangedBlocksInput`](crate::input::ListChangedBlocksInput).
|
1309 + | pub mod list_changed_blocks_input {
|
1310 + |
|
1311 + | #[derive(::std::cmp::PartialEq, ::std::fmt::Debug)]
|
1312 + | /// Holds one variant for each of the ways the builder can fail.
|
1313 + | #[non_exhaustive]
|
1314 + | #[allow(clippy::enum_variant_names)]
|
1315 + | pub enum ConstraintViolation {
|
1316 + | /// `second_snapshot_id` was not provided but it is required when building `ListChangedBlocksInput`.
|
1317 + | MissingSecondSnapshotId,
|
1318 + | /// Constraint violation occurred building member `second_snapshot_id` when building `ListChangedBlocksInput`.
|
1319 + | #[doc(hidden)]
|
1320 + | SecondSnapshotId(crate::model::snapshot_id::ConstraintViolation),
|
1321 + | /// Constraint violation occurred building member `first_snapshot_id` when building `ListChangedBlocksInput`.
|
1322 + | #[doc(hidden)]
|
1323 + | FirstSnapshotId(crate::model::snapshot_id::ConstraintViolation),
|
1324 + | /// Constraint violation occurred building member `next_token` when building `ListChangedBlocksInput`.
|
1325 + | #[doc(hidden)]
|
1326 + | NextToken(crate::model::page_token::ConstraintViolation),
|
1327 + | /// Constraint violation occurred building member `max_results` when building `ListChangedBlocksInput`.
|
1328 + | #[doc(hidden)]
|
1329 + | MaxResults(crate::model::max_results::ConstraintViolation),
|
1330 + | /// Constraint violation occurred building member `starting_block_index` when building `ListChangedBlocksInput`.
|
1331 + | #[doc(hidden)]
|
1332 + | StartingBlockIndex(crate::model::block_index::ConstraintViolation),
|
1333 + | }
|
1334 + | impl ::std::fmt::Display for ConstraintViolation {
|
1335 + | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
1336 + | match self {
|
1337 + | ConstraintViolation::MissingSecondSnapshotId => write!(f, "`second_snapshot_id` was not provided but it is required when building `ListChangedBlocksInput`"),
|
1338 + | ConstraintViolation::SecondSnapshotId(_) => write!(f, "constraint violation occurred building member `second_snapshot_id` when building `ListChangedBlocksInput`"),
|
1339 + | ConstraintViolation::FirstSnapshotId(_) => write!(f, "constraint violation occurred building member `first_snapshot_id` when building `ListChangedBlocksInput`"),
|
1340 + | ConstraintViolation::NextToken(_) => write!(f, "constraint violation occurred building member `next_token` when building `ListChangedBlocksInput`"),
|
1341 + | ConstraintViolation::MaxResults(_) => write!(f, "constraint violation occurred building member `max_results` when building `ListChangedBlocksInput`"),
|
1342 + | ConstraintViolation::StartingBlockIndex(_) => write!(f, "constraint violation occurred building member `starting_block_index` when building `ListChangedBlocksInput`"),
|
1343 + | }
|
1344 + | }
|
1345 + | }
|
1346 + | impl ::std::error::Error for ConstraintViolation {}
|
1347 + | impl ConstraintViolation {
|
1348 + | pub(crate) fn as_validation_exception_field(
|
1349 + | self,
|
1350 + | path: ::std::string::String,
|
1351 + | ) -> crate::model::ValidationExceptionField {
|
1352 + | match self {
|
1353 + | ConstraintViolation::MissingSecondSnapshotId => crate::model::ValidationExceptionField {
|
1354 + | message: format!("Value at '{}/SecondSnapshotId' failed to satisfy constraint: Member must not be null", path),
|
1355 + | path: path + "/SecondSnapshotId",
|
1356 + | },
|
1357 + | ConstraintViolation::SecondSnapshotId(inner) => inner.as_validation_exception_field(path + "/SecondSnapshotId"),
|
1358 + | ConstraintViolation::FirstSnapshotId(inner) => inner.as_validation_exception_field(path + "/FirstSnapshotId"),
|
1359 + | ConstraintViolation::NextToken(inner) => inner.as_validation_exception_field(path + "/NextToken"),
|
1360 + | ConstraintViolation::MaxResults(inner) => inner.as_validation_exception_field(path + "/MaxResults"),
|
1361 + | ConstraintViolation::StartingBlockIndex(inner) => inner.as_validation_exception_field(path + "/StartingBlockIndex"),
|
1362 + | }
|
1363 + | }
|
1364 + | }
|
1365 + | impl ::std::convert::From<ConstraintViolation>
|
1366 + | for ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection
|
1367 + | {
|
1368 + | fn from(constraint_violation: ConstraintViolation) -> Self {
|
1369 + | let first_validation_exception_field =
|
1370 + | constraint_violation.as_validation_exception_field("".to_owned());
|
1371 + | let validation_exception = crate::error::ValidationException {
|
1372 + | message: format!(
|
1373 + | "1 validation error detected. {}",
|
1374 + | &first_validation_exception_field.message
|
1375 + | ),
|
1376 + | field_list: Some(vec![first_validation_exception_field]),
|
1377 + | };
|
1378 + | Self::ConstraintViolation(
|
1379 + | crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(&validation_exception)
|
1380 + | .expect("validation exceptions should never fail to serialize; please file a bug report under https://github.com/smithy-lang/smithy-rs/issues")
|
1381 + | )
|
1382 + | }
|
1383 + | }
|
1384 + | impl ::std::convert::From<Builder>
|
1385 + | for crate::constrained::MaybeConstrained<crate::input::ListChangedBlocksInput>
|
1386 + | {
|
1387 + | fn from(builder: Builder) -> Self {
|
1388 + | Self::Unconstrained(builder)
|
1389 + | }
|
1390 + | }
|
1391 + | impl ::std::convert::TryFrom<Builder> for crate::input::ListChangedBlocksInput {
|
1392 + | type Error = ConstraintViolation;
|
1393 + |
|
1394 + | fn try_from(builder: Builder) -> ::std::result::Result<Self, Self::Error> {
|
1395 + | builder.build()
|
1396 + | }
|
1397 + | }
|
1398 + | /// A builder for [`ListChangedBlocksInput`](crate::input::ListChangedBlocksInput).
|
1399 + | #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
|
1400 + | pub struct Builder {
|
1401 + | pub(crate) second_snapshot_id:
|
1402 + | ::std::option::Option<crate::constrained::MaybeConstrained<crate::model::SnapshotId>>,
|
1403 + | pub(crate) first_snapshot_id:
|
1404 + | ::std::option::Option<crate::constrained::MaybeConstrained<crate::model::SnapshotId>>,
|
1405 + | pub(crate) next_token:
|
1406 + | ::std::option::Option<crate::constrained::MaybeConstrained<crate::model::PageToken>>,
|
1407 + | pub(crate) max_results:
|
1408 + | ::std::option::Option<crate::constrained::MaybeConstrained<crate::model::MaxResults>>,
|
1409 + | pub(crate) starting_block_index:
|
1410 + | ::std::option::Option<crate::constrained::MaybeConstrained<crate::model::BlockIndex>>,
|
1411 + | }
|
1412 + | impl Builder {
|
1413 + | /// <p>The ID of the second snapshot to use for the comparison.</p><important>
|
1414 + | /// <p>The <code>SecondSnapshotId</code> parameter must be specified with a <code>FirstSnapshotID</code> parameter; otherwise, an error occurs.</p>
|
1415 + | /// </important>
|
1416 + | pub fn second_snapshot_id(mut self, input: crate::model::SnapshotId) -> Self {
|
1417 + | self.second_snapshot_id =
|
1418 + | Some(crate::constrained::MaybeConstrained::Constrained(input));
|
1419 + | self
|
1420 + | }
|
1421 + | /// <p>The ID of the second snapshot to use for the comparison.</p><important>
|
1422 + | /// <p>The <code>SecondSnapshotId</code> parameter must be specified with a <code>FirstSnapshotID</code> parameter; otherwise, an error occurs.</p>
|
1423 + | /// </important>
|
1424 + | pub(crate) fn set_second_snapshot_id(
|
1425 + | mut self,
|
1426 + | input: impl ::std::convert::Into<
|
1427 + | crate::constrained::MaybeConstrained<crate::model::SnapshotId>,
|
1428 + | >,
|
1429 + | ) -> Self {
|
1430 + | self.second_snapshot_id = Some(input.into());
|
1431 + | self
|
1432 + | }
|
1433 + | /// <p>The ID of the first snapshot to use for the comparison.</p><important>
|
1434 + | /// <p>The <code>FirstSnapshotID</code> parameter must be specified with a <code>SecondSnapshotId</code> parameter; otherwise, an error occurs.</p>
|
1435 + | /// </important>
|
1436 + | pub fn first_snapshot_id(
|
1437 + | mut self,
|
1438 + | input: ::std::option::Option<crate::model::SnapshotId>,
|
1439 + | ) -> Self {
|
1440 + | self.first_snapshot_id = input.map(crate::constrained::MaybeConstrained::Constrained);
|
1441 + | self
|
1442 + | }
|
1443 + | /// <p>The ID of the first snapshot to use for the comparison.</p><important>
|
1444 + | /// <p>The <code>FirstSnapshotID</code> parameter must be specified with a <code>SecondSnapshotId</code> parameter; otherwise, an error occurs.</p>
|
1445 + | /// </important>
|
1446 + | pub(crate) fn set_first_snapshot_id(
|
1447 + | mut self,
|
1448 + | input: Option<
|
1449 + | impl ::std::convert::Into<
|
1450 + | crate::constrained::MaybeConstrained<crate::model::SnapshotId>,
|
1451 + | >,
|
1452 + | >,
|
1453 + | ) -> Self {
|
1454 + | self.first_snapshot_id = input.map(|v| v.into());
|
1455 + | self
|
1456 + | }
|
1457 + | /// <p>The token to request the next page of results.</p>
|
1458 + | pub fn next_token(mut self, input: ::std::option::Option<crate::model::PageToken>) -> Self {
|
1459 + | self.next_token = input.map(crate::constrained::MaybeConstrained::Constrained);
|
1460 + | self
|
1461 + | }
|
1462 + | /// <p>The token to request the next page of results.</p>
|
1463 + | pub(crate) fn set_next_token(
|
1464 + | mut self,
|
1465 + | input: Option<
|
1466 + | impl ::std::convert::Into<crate::constrained::MaybeConstrained<crate::model::PageToken>>,
|
1467 + | >,
|
1468 + | ) -> Self {
|
1469 + | self.next_token = input.map(|v| v.into());
|
1470 + | self
|
1471 + | }
|
1472 + | /// <p>The number of results to return.</p>
|
1473 + | pub fn max_results(
|
1474 + | mut self,
|
1475 + | input: ::std::option::Option<crate::model::MaxResults>,
|
1476 + | ) -> Self {
|
1477 + | self.max_results = input.map(crate::constrained::MaybeConstrained::Constrained);
|
1478 + | self
|
1479 + | }
|
1480 + | /// <p>The number of results to return.</p>
|
1481 + | pub(crate) fn set_max_results(
|
1482 + | mut self,
|
1483 + | input: Option<
|
1484 + | impl ::std::convert::Into<
|
1485 + | crate::constrained::MaybeConstrained<crate::model::MaxResults>,
|
1486 + | >,
|
1487 + | >,
|
1488 + | ) -> Self {
|
1489 + | self.max_results = input.map(|v| v.into());
|
1490 + | self
|
1491 + | }
|
1492 + | /// <p>The block index from which the comparison should start.</p>
|
1493 + | /// <p>The list in the response will start from this block index or the next valid block index in the snapshots.</p>
|
1494 + | pub fn starting_block_index(
|
1495 + | mut self,
|
1496 + | input: ::std::option::Option<crate::model::BlockIndex>,
|
1497 + | ) -> Self {
|
1498 + | self.starting_block_index =
|
1499 + | input.map(crate::constrained::MaybeConstrained::Constrained);
|
1500 + | self
|
1501 + | }
|
1502 + | /// <p>The block index from which the comparison should start.</p>
|
1503 + | /// <p>The list in the response will start from this block index or the next valid block index in the snapshots.</p>
|
1504 + | pub(crate) fn set_starting_block_index(
|
1505 + | mut self,
|
1506 + | input: Option<
|
1507 + | impl ::std::convert::Into<
|
1508 + | crate::constrained::MaybeConstrained<crate::model::BlockIndex>,
|
1509 + | >,
|
1510 + | >,
|
1511 + | ) -> Self {
|
1512 + | self.starting_block_index = input.map(|v| v.into());
|
1513 + | self
|
1514 + | }
|
1515 + | /// Consumes the builder and constructs a [`ListChangedBlocksInput`](crate::input::ListChangedBlocksInput).
|
1516 + | ///
|
1517 + | /// The builder fails to construct a [`ListChangedBlocksInput`](crate::input::ListChangedBlocksInput) if a [`ConstraintViolation`] occurs.
|
1518 + | ///
|
1519 + | /// If the builder fails, it will return the _first_ encountered [`ConstraintViolation`].
|
1520 + | pub fn build(self) -> Result<crate::input::ListChangedBlocksInput, ConstraintViolation> {
|
1521 + | self.build_enforcing_all_constraints()
|
1522 + | }
|
1523 + | fn build_enforcing_all_constraints(
|
1524 + | self,
|
1525 + | ) -> Result<crate::input::ListChangedBlocksInput, ConstraintViolation> {
|
1526 + | Ok(crate::input::ListChangedBlocksInput {
|
1527 + | second_snapshot_id: self
|
1528 + | .second_snapshot_id
|
1529 + | .map(|v| match v {
|
1530 + | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
1531 + | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
1532 + | })
|
1533 + | .map(|res| res.map_err(ConstraintViolation::SecondSnapshotId))
|
1534 + | .transpose()?
|
1535 + | .ok_or(ConstraintViolation::MissingSecondSnapshotId)?,
|
1536 + | first_snapshot_id: self
|
1537 + | .first_snapshot_id
|
1538 + | .map(|v| match v {
|
1539 + | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
1540 + | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
1541 + | })
|
1542 + | .map(|res| res.map_err(ConstraintViolation::FirstSnapshotId))
|
1543 + | .transpose()?,
|
1544 + | next_token: self
|
1545 + | .next_token
|
1546 + | .map(|v| match v {
|
1547 + | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
1548 + | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
1549 + | })
|
1550 + | .map(|res| res.map_err(ConstraintViolation::NextToken))
|
1551 + | .transpose()?,
|
1552 + | max_results: self
|
1553 + | .max_results
|
1554 + | .map(|v| match v {
|
1555 + | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
1556 + | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
1557 + | })
|
1558 + | .map(|res| res.map_err(ConstraintViolation::MaxResults))
|
1559 + | .transpose()?,
|
1560 + | starting_block_index: self
|
1561 + | .starting_block_index
|
1562 + | .map(|v| match v {
|
1563 + | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
1564 + | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
1565 + | })
|
1566 + | .map(|res| res.map_err(ConstraintViolation::StartingBlockIndex))
|
1567 + | .transpose()?,
|
1568 + | })
|
1569 + | }
|
1570 + | }
|
1571 + | }
|
1572 + | /// See [`GetSnapshotBlockInput`](crate::input::GetSnapshotBlockInput).
|
1573 + | pub mod get_snapshot_block_input {
|
1574 + |
|
1575 + | #[derive(::std::cmp::PartialEq, ::std::fmt::Debug)]
|
1576 + | /// Holds one variant for each of the ways the builder can fail.
|
1577 + | #[non_exhaustive]
|
1578 + | #[allow(clippy::enum_variant_names)]
|
1579 + | pub enum ConstraintViolation {
|
1580 + | /// `snapshot_id` was not provided but it is required when building `GetSnapshotBlockInput`.
|
1581 + | MissingSnapshotId,
|
1582 + | /// Constraint violation occurred building member `snapshot_id` when building `GetSnapshotBlockInput`.
|
1583 + | #[doc(hidden)]
|
1584 + | SnapshotId(crate::model::snapshot_id::ConstraintViolation),
|
1585 + | /// `block_token` was not provided but it is required when building `GetSnapshotBlockInput`.
|
1586 + | MissingBlockToken,
|
1587 + | /// Constraint violation occurred building member `block_token` when building `GetSnapshotBlockInput`.
|
1588 + | #[doc(hidden)]
|
1589 + | BlockToken(crate::model::block_token::ConstraintViolation),
|
1590 + | /// `block_index` was not provided but it is required when building `GetSnapshotBlockInput`.
|
1591 + | MissingBlockIndex,
|
1592 + | /// Constraint violation occurred building member `block_index` when building `GetSnapshotBlockInput`.
|
1593 + | #[doc(hidden)]
|
1594 + | BlockIndex(crate::model::block_index::ConstraintViolation),
|
1595 + | }
|
1596 + | impl ::std::fmt::Display for ConstraintViolation {
|
1597 + | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
1598 + | match self {
|
1599 + | ConstraintViolation::MissingSnapshotId => write!(f, "`snapshot_id` was not provided but it is required when building `GetSnapshotBlockInput`"),
|
1600 + | ConstraintViolation::SnapshotId(_) => write!(f, "constraint violation occurred building member `snapshot_id` when building `GetSnapshotBlockInput`"),
|
1601 + | ConstraintViolation::MissingBlockToken => write!(f, "`block_token` was not provided but it is required when building `GetSnapshotBlockInput`"),
|
1602 + | ConstraintViolation::BlockToken(_) => write!(f, "constraint violation occurred building member `block_token` when building `GetSnapshotBlockInput`"),
|
1603 + | ConstraintViolation::MissingBlockIndex => write!(f, "`block_index` was not provided but it is required when building `GetSnapshotBlockInput`"),
|
1604 + | ConstraintViolation::BlockIndex(_) => write!(f, "constraint violation occurred building member `block_index` when building `GetSnapshotBlockInput`"),
|
1605 + | }
|
1606 + | }
|
1607 + | }
|
1608 + | impl ::std::error::Error for ConstraintViolation {}
|
1609 + | impl ConstraintViolation {
|
1610 + | pub(crate) fn as_validation_exception_field(
|
1611 + | self,
|
1612 + | path: ::std::string::String,
|
1613 + | ) -> crate::model::ValidationExceptionField {
|
1614 + | match self {
|
1615 + | ConstraintViolation::MissingSnapshotId => crate::model::ValidationExceptionField {
|
1616 + | message: format!("Value at '{}/SnapshotId' failed to satisfy constraint: Member must not be null", path),
|
1617 + | path: path + "/SnapshotId",
|
1618 + | },
|
1619 + | ConstraintViolation::SnapshotId(inner) => inner.as_validation_exception_field(path + "/SnapshotId"),
|
1620 + | ConstraintViolation::MissingBlockToken => crate::model::ValidationExceptionField {
|
1621 + | message: format!("Value at '{}/BlockToken' failed to satisfy constraint: Member must not be null", path),
|
1622 + | path: path + "/BlockToken",
|
1623 + | },
|
1624 + | ConstraintViolation::BlockToken(inner) => inner.as_validation_exception_field(path + "/BlockToken"),
|
1625 + | ConstraintViolation::MissingBlockIndex => crate::model::ValidationExceptionField {
|
1626 + | message: format!("Value at '{}/BlockIndex' failed to satisfy constraint: Member must not be null", path),
|
1627 + | path: path + "/BlockIndex",
|
1628 + | },
|
1629 + | ConstraintViolation::BlockIndex(inner) => inner.as_validation_exception_field(path + "/BlockIndex"),
|
1630 + | }
|
1631 + | }
|
1632 + | }
|
1633 + | impl ::std::convert::From<ConstraintViolation>
|
1634 + | for ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection
|
1635 + | {
|
1636 + | fn from(constraint_violation: ConstraintViolation) -> Self {
|
1637 + | let first_validation_exception_field =
|
1638 + | constraint_violation.as_validation_exception_field("".to_owned());
|
1639 + | let validation_exception = crate::error::ValidationException {
|
1640 + | message: format!(
|
1641 + | "1 validation error detected. {}",
|
1642 + | &first_validation_exception_field.message
|
1643 + | ),
|
1644 + | field_list: Some(vec![first_validation_exception_field]),
|
1645 + | };
|
1646 + | Self::ConstraintViolation(
|
1647 + | crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(&validation_exception)
|
1648 + | .expect("validation exceptions should never fail to serialize; please file a bug report under https://github.com/smithy-lang/smithy-rs/issues")
|
1649 + | )
|
1650 + | }
|
1651 + | }
|
1652 + | impl ::std::convert::From<Builder>
|
1653 + | for crate::constrained::MaybeConstrained<crate::input::GetSnapshotBlockInput>
|
1654 + | {
|
1655 + | fn from(builder: Builder) -> Self {
|
1656 + | Self::Unconstrained(builder)
|
1657 + | }
|
1658 + | }
|
1659 + | impl ::std::convert::TryFrom<Builder> for crate::input::GetSnapshotBlockInput {
|
1660 + | type Error = ConstraintViolation;
|
1661 + |
|
1662 + | fn try_from(builder: Builder) -> ::std::result::Result<Self, Self::Error> {
|
1663 + | builder.build()
|
1664 + | }
|
1665 + | }
|
1666 + | /// A builder for [`GetSnapshotBlockInput`](crate::input::GetSnapshotBlockInput).
|
1667 + | #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
|
1668 + | pub struct Builder {
|
1669 + | pub(crate) snapshot_id:
|
1670 + | ::std::option::Option<crate::constrained::MaybeConstrained<crate::model::SnapshotId>>,
|
1671 + | pub(crate) block_token:
|
1672 + | ::std::option::Option<crate::constrained::MaybeConstrained<crate::model::BlockToken>>,
|
1673 + | pub(crate) block_index:
|
1674 + | ::std::option::Option<crate::constrained::MaybeConstrained<crate::model::BlockIndex>>,
|
1675 + | }
|
1676 + | impl Builder {
|
1677 + | /// <p>The ID of the snapshot containing the block from which to get data.</p>
|
1678 + | pub fn snapshot_id(mut self, input: crate::model::SnapshotId) -> Self {
|
1679 + | self.snapshot_id = Some(crate::constrained::MaybeConstrained::Constrained(input));
|
1680 + | self
|
1681 + | }
|
1682 + | /// <p>The ID of the snapshot containing the block from which to get data.</p>
|
1683 + | pub(crate) fn set_snapshot_id(
|
1684 + | mut self,
|
1685 + | input: impl ::std::convert::Into<
|
1686 + | crate::constrained::MaybeConstrained<crate::model::SnapshotId>,
|
1687 + | >,
|
1688 + | ) -> Self {
|
1689 + | self.snapshot_id = Some(input.into());
|
1690 + | self
|
1691 + | }
|
1692 + | /// <p>The block token of the block from which to get data.</p>
|
1693 + | /// <p>Obtain the <code>BlockToken</code> by running the <code>ListChangedBlocks</code> or <code>ListSnapshotBlocks</code> operations.</p>
|
1694 + | pub fn block_token(mut self, input: crate::model::BlockToken) -> Self {
|
1695 + | self.block_token = Some(crate::constrained::MaybeConstrained::Constrained(input));
|
1696 + | self
|
1697 + | }
|
1698 + | /// <p>The block token of the block from which to get data.</p>
|
1699 + | /// <p>Obtain the <code>BlockToken</code> by running the <code>ListChangedBlocks</code> or <code>ListSnapshotBlocks</code> operations.</p>
|
1700 + | pub(crate) fn set_block_token(
|
1701 + | mut self,
|
1702 + | input: impl ::std::convert::Into<
|
1703 + | crate::constrained::MaybeConstrained<crate::model::BlockToken>,
|
1704 + | >,
|
1705 + | ) -> Self {
|
1706 + | self.block_token = Some(input.into());
|
1707 + | self
|
1708 + | }
|
1709 + | /// <p>The block index of the block from which to get data.</p>
|
1710 + | /// <p>Obtain the <code>BlockIndex</code> by running the <code>ListChangedBlocks</code> or <code>ListSnapshotBlocks</code> operations.</p>
|
1711 + | pub fn block_index(mut self, input: crate::model::BlockIndex) -> Self {
|
1712 + | self.block_index = Some(crate::constrained::MaybeConstrained::Constrained(input));
|
1713 + | self
|
1714 + | }
|
1715 + | /// <p>The block index of the block from which to get data.</p>
|
1716 + | /// <p>Obtain the <code>BlockIndex</code> by running the <code>ListChangedBlocks</code> or <code>ListSnapshotBlocks</code> operations.</p>
|
1717 + | pub(crate) fn set_block_index(
|
1718 + | mut self,
|
1719 + | input: impl ::std::convert::Into<
|
1720 + | crate::constrained::MaybeConstrained<crate::model::BlockIndex>,
|
1721 + | >,
|
1722 + | ) -> Self {
|
1723 + | self.block_index = Some(input.into());
|
1724 + | self
|
1725 + | }
|
1726 + | /// Consumes the builder and constructs a [`GetSnapshotBlockInput`](crate::input::GetSnapshotBlockInput).
|
1727 + | ///
|
1728 + | /// The builder fails to construct a [`GetSnapshotBlockInput`](crate::input::GetSnapshotBlockInput) if a [`ConstraintViolation`] occurs.
|
1729 + | ///
|
1730 + | /// If the builder fails, it will return the _first_ encountered [`ConstraintViolation`].
|
1731 + | pub fn build(self) -> Result<crate::input::GetSnapshotBlockInput, ConstraintViolation> {
|
1732 + | self.build_enforcing_all_constraints()
|
1733 + | }
|
1734 + | fn build_enforcing_all_constraints(
|
1735 + | self,
|
1736 + | ) -> Result<crate::input::GetSnapshotBlockInput, ConstraintViolation> {
|
1737 + | Ok(crate::input::GetSnapshotBlockInput {
|
1738 + | snapshot_id: self
|
1739 + | .snapshot_id
|
1740 + | .map(|v| match v {
|
1741 + | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
1742 + | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
1743 + | })
|
1744 + | .map(|res| res.map_err(ConstraintViolation::SnapshotId))
|
1745 + | .transpose()?
|
1746 + | .ok_or(ConstraintViolation::MissingSnapshotId)?,
|
1747 + | block_token: self
|
1748 + | .block_token
|
1749 + | .map(|v| match v {
|
1750 + | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
1751 + | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
1752 + | })
|
1753 + | .map(|res| res.map_err(ConstraintViolation::BlockToken))
|
1754 + | .transpose()?
|
1755 + | .ok_or(ConstraintViolation::MissingBlockToken)?,
|
1756 + | block_index: self
|
1757 + | .block_index
|
1758 + | .map(|v| match v {
|
1759 + | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
1760 + | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
1761 + | })
|
1762 + | .map(|res| res.map_err(ConstraintViolation::BlockIndex))
|
1763 + | .transpose()?
|
1764 + | .ok_or(ConstraintViolation::MissingBlockIndex)?,
|
1765 + | })
|
1766 + | }
|
1767 + | }
|
1768 + | }
|
1769 + | /// See [`CompleteSnapshotInput`](crate::input::CompleteSnapshotInput).
|
1770 + | pub mod complete_snapshot_input {
|
1771 + |
|
1772 + | #[derive(::std::cmp::PartialEq, ::std::fmt::Debug)]
|
1773 + | /// Holds one variant for each of the ways the builder can fail.
|
1774 + | #[non_exhaustive]
|
1775 + | #[allow(clippy::enum_variant_names)]
|
1776 + | pub enum ConstraintViolation {
|
1777 + | /// `changed_blocks_count` was not provided but it is required when building `CompleteSnapshotInput`.
|
1778 + | MissingChangedBlocksCount,
|
1779 + | /// Constraint violation occurred building member `changed_blocks_count` when building `CompleteSnapshotInput`.
|
1780 + | #[doc(hidden)]
|
1781 + | ChangedBlocksCount(crate::model::changed_blocks_count::ConstraintViolation),
|
1782 + | /// Constraint violation occurred building member `checksum_aggregation_method` when building `CompleteSnapshotInput`.
|
1783 + | #[doc(hidden)]
|
1784 + | ChecksumAggregationMethod(crate::model::checksum_aggregation_method::ConstraintViolation),
|
1785 + | /// Constraint violation occurred building member `checksum_algorithm` when building `CompleteSnapshotInput`.
|
1786 + | #[doc(hidden)]
|
1787 + | ChecksumAlgorithm(crate::model::checksum_algorithm::ConstraintViolation),
|
1788 + | /// `snapshot_id` was not provided but it is required when building `CompleteSnapshotInput`.
|
1789 + | MissingSnapshotId,
|
1790 + | /// Constraint violation occurred building member `snapshot_id` when building `CompleteSnapshotInput`.
|
1791 + | #[doc(hidden)]
|
1792 + | SnapshotId(crate::model::snapshot_id::ConstraintViolation),
|
1793 + | /// Constraint violation occurred building member `checksum` when building `CompleteSnapshotInput`.
|
1794 + | #[doc(hidden)]
|
1795 + | Checksum(crate::model::checksum::ConstraintViolation),
|
1796 + | }
|
1797 + | impl ::std::fmt::Display for ConstraintViolation {
|
1798 + | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
1799 + | match self {
|
1800 + | ConstraintViolation::MissingChangedBlocksCount => write!(f, "`changed_blocks_count` was not provided but it is required when building `CompleteSnapshotInput`"),
|
1801 + | ConstraintViolation::ChangedBlocksCount(_) => write!(f, "constraint violation occurred building member `changed_blocks_count` when building `CompleteSnapshotInput`"),
|
1802 + | ConstraintViolation::ChecksumAggregationMethod(_) => write!(f, "constraint violation occurred building member `checksum_aggregation_method` when building `CompleteSnapshotInput`"),
|
1803 + | ConstraintViolation::ChecksumAlgorithm(_) => write!(f, "constraint violation occurred building member `checksum_algorithm` when building `CompleteSnapshotInput`"),
|
1804 + | ConstraintViolation::MissingSnapshotId => write!(f, "`snapshot_id` was not provided but it is required when building `CompleteSnapshotInput`"),
|
1805 + | ConstraintViolation::SnapshotId(_) => write!(f, "constraint violation occurred building member `snapshot_id` when building `CompleteSnapshotInput`"),
|
1806 + | ConstraintViolation::Checksum(_) => write!(f, "constraint violation occurred building member `checksum` when building `CompleteSnapshotInput`"),
|
1807 + | }
|
1808 + | }
|
1809 + | }
|
1810 + | impl ::std::error::Error for ConstraintViolation {}
|
1811 + | impl ConstraintViolation {
|
1812 + | pub(crate) fn as_validation_exception_field(
|
1813 + | self,
|
1814 + | path: ::std::string::String,
|
1815 + | ) -> crate::model::ValidationExceptionField {
|
1816 + | match self {
|
1817 + | ConstraintViolation::MissingChangedBlocksCount => crate::model::ValidationExceptionField {
|
1818 + | message: format!("Value at '{}/ChangedBlocksCount' failed to satisfy constraint: Member must not be null", path),
|
1819 + | path: path + "/ChangedBlocksCount",
|
1820 + | },
|
1821 + | ConstraintViolation::ChangedBlocksCount(inner) => inner.as_validation_exception_field(path + "/ChangedBlocksCount"),
|
1822 + | ConstraintViolation::ChecksumAggregationMethod(inner) => inner.as_validation_exception_field(path + "/ChecksumAggregationMethod"),
|
1823 + | ConstraintViolation::ChecksumAlgorithm(inner) => inner.as_validation_exception_field(path + "/ChecksumAlgorithm"),
|
1824 + | ConstraintViolation::MissingSnapshotId => crate::model::ValidationExceptionField {
|
1825 + | message: format!("Value at '{}/SnapshotId' failed to satisfy constraint: Member must not be null", path),
|
1826 + | path: path + "/SnapshotId",
|
1827 + | },
|
1828 + | ConstraintViolation::SnapshotId(inner) => inner.as_validation_exception_field(path + "/SnapshotId"),
|
1829 + | ConstraintViolation::Checksum(inner) => inner.as_validation_exception_field(path + "/Checksum"),
|
1830 + | }
|
1831 + | }
|
1832 + | }
|
1833 + | impl ::std::convert::From<ConstraintViolation>
|
1834 + | for ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection
|
1835 + | {
|
1836 + | fn from(constraint_violation: ConstraintViolation) -> Self {
|
1837 + | let first_validation_exception_field =
|
1838 + | constraint_violation.as_validation_exception_field("".to_owned());
|
1839 + | let validation_exception = crate::error::ValidationException {
|
1840 + | message: format!(
|
1841 + | "1 validation error detected. {}",
|
1842 + | &first_validation_exception_field.message
|
1843 + | ),
|
1844 + | field_list: Some(vec![first_validation_exception_field]),
|
1845 + | };
|
1846 + | Self::ConstraintViolation(
|
1847 + | crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(&validation_exception)
|
1848 + | .expect("validation exceptions should never fail to serialize; please file a bug report under https://github.com/smithy-lang/smithy-rs/issues")
|
1849 + | )
|
1850 + | }
|
1851 + | }
|
1852 + | impl ::std::convert::From<Builder>
|
1853 + | for crate::constrained::MaybeConstrained<crate::input::CompleteSnapshotInput>
|
1854 + | {
|
1855 + | fn from(builder: Builder) -> Self {
|
1856 + | Self::Unconstrained(builder)
|
1857 + | }
|
1858 + | }
|
1859 + | impl ::std::convert::TryFrom<Builder> for crate::input::CompleteSnapshotInput {
|
1860 + | type Error = ConstraintViolation;
|
1861 + |
|
1862 + | fn try_from(builder: Builder) -> ::std::result::Result<Self, Self::Error> {
|
1863 + | builder.build()
|
1864 + | }
|
1865 + | }
|
1866 + | /// A builder for [`CompleteSnapshotInput`](crate::input::CompleteSnapshotInput).
|
1867 + | #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
|
1868 + | pub struct Builder {
|
1869 + | pub(crate) changed_blocks_count: ::std::option::Option<
|
1870 + | crate::constrained::MaybeConstrained<crate::model::ChangedBlocksCount>,
|
1871 + | >,
|
1872 + | pub(crate) checksum_aggregation_method: ::std::option::Option<
|
1873 + | crate::constrained::MaybeConstrained<crate::model::ChecksumAggregationMethod>,
|
1874 + | >,
|
1875 + | pub(crate) checksum_algorithm: ::std::option::Option<
|
1876 + | crate::constrained::MaybeConstrained<crate::model::ChecksumAlgorithm>,
|
1877 + | >,
|
1878 + | pub(crate) snapshot_id:
|
1879 + | ::std::option::Option<crate::constrained::MaybeConstrained<crate::model::SnapshotId>>,
|
1880 + | pub(crate) checksum:
|
1881 + | ::std::option::Option<crate::constrained::MaybeConstrained<crate::model::Checksum>>,
|
1882 + | }
|
1883 + | impl Builder {
|
1884 + | /// <p>The number of blocks that were written to the snapshot.</p>
|
1885 + | pub fn changed_blocks_count(mut self, input: crate::model::ChangedBlocksCount) -> Self {
|
1886 + | self.changed_blocks_count =
|
1887 + | Some(crate::constrained::MaybeConstrained::Constrained(input));
|
1888 + | self
|
1889 + | }
|
1890 + | /// <p>The number of blocks that were written to the snapshot.</p>
|
1891 + | pub(crate) fn set_changed_blocks_count(
|
1892 + | mut self,
|
1893 + | input: impl ::std::convert::Into<
|
1894 + | crate::constrained::MaybeConstrained<crate::model::ChangedBlocksCount>,
|
1895 + | >,
|
1896 + | ) -> Self {
|
1897 + | self.changed_blocks_count = Some(input.into());
|
1898 + | self
|
1899 + | }
|
1900 + | /// <p>The aggregation method used to generate the checksum. Currently, the only supported aggregation method is <code>LINEAR</code>.</p>
|
1901 + | pub fn checksum_aggregation_method(
|
1902 + | mut self,
|
1903 + | input: ::std::option::Option<crate::model::ChecksumAggregationMethod>,
|
1904 + | ) -> Self {
|
1905 + | self.checksum_aggregation_method =
|
1906 + | input.map(crate::constrained::MaybeConstrained::Constrained);
|
1907 + | self
|
1908 + | }
|
1909 + | /// <p>The aggregation method used to generate the checksum. Currently, the only supported aggregation method is <code>LINEAR</code>.</p>
|
1910 + | pub(crate) fn set_checksum_aggregation_method(
|
1911 + | mut self,
|
1912 + | input: Option<
|
1913 + | impl ::std::convert::Into<
|
1914 + | crate::constrained::MaybeConstrained<crate::model::ChecksumAggregationMethod>,
|
1915 + | >,
|
1916 + | >,
|
1917 + | ) -> Self {
|
1918 + | self.checksum_aggregation_method = input.map(|v| v.into());
|
1919 + | self
|
1920 + | }
|
1921 + | /// <p>The algorithm used to generate the checksum. Currently, the only supported algorithm is <code>SHA256</code>.</p>
|
1922 + | pub fn checksum_algorithm(
|
1923 + | mut self,
|
1924 + | input: ::std::option::Option<crate::model::ChecksumAlgorithm>,
|
1925 + | ) -> Self {
|
1926 + | self.checksum_algorithm = input.map(crate::constrained::MaybeConstrained::Constrained);
|
1927 + | self
|
1928 + | }
|
1929 + | /// <p>The algorithm used to generate the checksum. Currently, the only supported algorithm is <code>SHA256</code>.</p>
|
1930 + | pub(crate) fn set_checksum_algorithm(
|
1931 + | mut self,
|
1932 + | input: Option<
|
1933 + | impl ::std::convert::Into<
|
1934 + | crate::constrained::MaybeConstrained<crate::model::ChecksumAlgorithm>,
|
1935 + | >,
|
1936 + | >,
|
1937 + | ) -> Self {
|
1938 + | self.checksum_algorithm = input.map(|v| v.into());
|
1939 + | self
|
1940 + | }
|
1941 + | /// <p>The ID of the snapshot.</p>
|
1942 + | pub fn snapshot_id(mut self, input: crate::model::SnapshotId) -> Self {
|
1943 + | self.snapshot_id = Some(crate::constrained::MaybeConstrained::Constrained(input));
|
1944 + | self
|
1945 + | }
|
1946 + | /// <p>The ID of the snapshot.</p>
|
1947 + | pub(crate) fn set_snapshot_id(
|
1948 + | mut self,
|
1949 + | input: impl ::std::convert::Into<
|
1950 + | crate::constrained::MaybeConstrained<crate::model::SnapshotId>,
|
1951 + | >,
|
1952 + | ) -> Self {
|
1953 + | self.snapshot_id = Some(input.into());
|
1954 + | self
|
1955 + | }
|
1956 + | /// <p>An aggregated Base-64 SHA256 checksum based on the checksums of each written block.</p>
|
1957 + | /// <p>To generate the aggregated checksum using the linear aggregation method, arrange the checksums for each written block in ascending order of their block index, concatenate them to form a single string, and then generate the checksum on the entire string using the SHA256 algorithm.</p>
|
1958 + | pub fn checksum(mut self, input: ::std::option::Option<crate::model::Checksum>) -> Self {
|
1959 + | self.checksum = input.map(crate::constrained::MaybeConstrained::Constrained);
|
1960 + | self
|
1961 + | }
|
1962 + | /// <p>An aggregated Base-64 SHA256 checksum based on the checksums of each written block.</p>
|
1963 + | /// <p>To generate the aggregated checksum using the linear aggregation method, arrange the checksums for each written block in ascending order of their block index, concatenate them to form a single string, and then generate the checksum on the entire string using the SHA256 algorithm.</p>
|
1964 + | pub(crate) fn set_checksum(
|
1965 + | mut self,
|
1966 + | input: Option<
|
1967 + | impl ::std::convert::Into<crate::constrained::MaybeConstrained<crate::model::Checksum>>,
|
1968 + | >,
|
1969 + | ) -> Self {
|
1970 + | self.checksum = input.map(|v| v.into());
|
1971 + | self
|
1972 + | }
|
1973 + | /// Consumes the builder and constructs a [`CompleteSnapshotInput`](crate::input::CompleteSnapshotInput).
|
1974 + | ///
|
1975 + | /// The builder fails to construct a [`CompleteSnapshotInput`](crate::input::CompleteSnapshotInput) if a [`ConstraintViolation`] occurs.
|
1976 + | ///
|
1977 + | /// If the builder fails, it will return the _first_ encountered [`ConstraintViolation`].
|
1978 + | pub fn build(self) -> Result<crate::input::CompleteSnapshotInput, ConstraintViolation> {
|
1979 + | self.build_enforcing_all_constraints()
|
1980 + | }
|
1981 + | fn build_enforcing_all_constraints(
|
1982 + | self,
|
1983 + | ) -> Result<crate::input::CompleteSnapshotInput, ConstraintViolation> {
|
1984 + | Ok(crate::input::CompleteSnapshotInput {
|
1985 + | changed_blocks_count: self
|
1986 + | .changed_blocks_count
|
1987 + | .map(|v| match v {
|
1988 + | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
1989 + | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
1990 + | })
|
1991 + | .map(|res| res.map_err(ConstraintViolation::ChangedBlocksCount))
|
1992 + | .transpose()?
|
1993 + | .ok_or(ConstraintViolation::MissingChangedBlocksCount)?,
|
1994 + | checksum_aggregation_method: self
|
1995 + | .checksum_aggregation_method
|
1996 + | .map(|v| match v {
|
1997 + | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
1998 + | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
1999 + | })
|
2000 + | .map(|res| res.map_err(ConstraintViolation::ChecksumAggregationMethod))
|
2001 + | .transpose()?,
|
2002 + | checksum_algorithm: self
|
2003 + | .checksum_algorithm
|
2004 + | .map(|v| match v {
|
2005 + | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
2006 + | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
2007 + | })
|
2008 + | .map(|res| res.map_err(ConstraintViolation::ChecksumAlgorithm))
|
2009 + | .transpose()?,
|
2010 + | snapshot_id: self
|
2011 + | .snapshot_id
|
2012 + | .map(|v| match v {
|
2013 + | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
2014 + | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
2015 + | })
|
2016 + | .map(|res| res.map_err(ConstraintViolation::SnapshotId))
|
2017 + | .transpose()?
|
2018 + | .ok_or(ConstraintViolation::MissingSnapshotId)?,
|
2019 + | checksum: self
|
2020 + | .checksum
|
2021 + | .map(|v| match v {
|
2022 + | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
2023 + | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
2024 + | })
|
2025 + | .map(|res| res.map_err(ConstraintViolation::Checksum))
|
2026 + | .transpose()?,
|
2027 + | })
|
2028 + | }
|
2029 + | }
|
2030 + | }
|