aws-sdk-ebs 1.119.0

AWS SDK for Amazon Elastic Block Store
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
#[allow(missing_docs)] // documentation missing in model
#[non_exhaustive]
pub struct PutSnapshotBlockInput {
    /// <p>The ID of the snapshot.</p><important>
    /// <p>If the specified snapshot is encrypted, you must have permission to use the KMS key that was used to encrypt the snapshot. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebsapis-using-encryption.html"> Using encryption</a> in the <i>Amazon Elastic Compute Cloud User Guide</i>..</p>
    /// </important>
    pub snapshot_id: ::std::option::Option<::std::string::String>,
    /// <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>
    pub block_index: ::std::option::Option<i32>,
    /// <p>The data to write to the block.</p>
    /// <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>
    pub block_data: ::aws_smithy_types::byte_stream::ByteStream,
    /// <p>The size of the data to write to the block, in bytes. Currently, the only supported size is <code>524288</code> bytes.</p>
    /// <p>Valid values: <code>524288</code></p>
    pub data_length: ::std::option::Option<i32>,
    /// <p>The progress of the write process, as a percentage.</p>
    pub progress: ::std::option::Option<i32>,
    /// <p>A Base64-encoded SHA256 checksum of the data. Only SHA256 checksums are supported.</p>
    pub checksum: ::std::option::Option<::std::string::String>,
    /// <p>The algorithm used to generate the checksum. Currently, the only supported algorithm is <code>SHA256</code>.</p>
    pub checksum_algorithm: ::std::option::Option<crate::types::ChecksumAlgorithm>,
}
impl PutSnapshotBlockInput {
    /// <p>The ID of the snapshot.</p><important>
    /// <p>If the specified snapshot is encrypted, you must have permission to use the KMS key that was used to encrypt the snapshot. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebsapis-using-encryption.html"> Using encryption</a> in the <i>Amazon Elastic Compute Cloud User Guide</i>..</p>
    /// </important>
    pub fn snapshot_id(&self) -> ::std::option::Option<&str> {
        self.snapshot_id.as_deref()
    }
    /// <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>
    pub fn block_index(&self) -> ::std::option::Option<i32> {
        self.block_index
    }
    /// <p>The data to write to the block.</p>
    /// <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>
    pub fn block_data(&self) -> &::aws_smithy_types::byte_stream::ByteStream {
        &self.block_data
    }
    /// <p>The size of the data to write to the block, in bytes. Currently, the only supported size is <code>524288</code> bytes.</p>
    /// <p>Valid values: <code>524288</code></p>
    pub fn data_length(&self) -> ::std::option::Option<i32> {
        self.data_length
    }
    /// <p>The progress of the write process, as a percentage.</p>
    pub fn progress(&self) -> ::std::option::Option<i32> {
        self.progress
    }
    /// <p>A Base64-encoded SHA256 checksum of the data. Only SHA256 checksums are supported.</p>
    pub fn checksum(&self) -> ::std::option::Option<&str> {
        self.checksum.as_deref()
    }
    /// <p>The algorithm used to generate the checksum. Currently, the only supported algorithm is <code>SHA256</code>.</p>
    pub fn checksum_algorithm(&self) -> ::std::option::Option<&crate::types::ChecksumAlgorithm> {
        self.checksum_algorithm.as_ref()
    }
}
impl ::std::fmt::Debug for PutSnapshotBlockInput {
    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
        let mut formatter = f.debug_struct("PutSnapshotBlockInput");
        formatter.field("snapshot_id", &self.snapshot_id);
        formatter.field("block_index", &self.block_index);
        formatter.field("block_data", &"*** Sensitive Data Redacted ***");
        formatter.field("data_length", &self.data_length);
        formatter.field("progress", &self.progress);
        formatter.field("checksum", &self.checksum);
        formatter.field("checksum_algorithm", &self.checksum_algorithm);
        formatter.finish()
    }
}
static PUTSNAPSHOTBLOCKINPUT_MEMBER_SNAPSHOT_ID: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
    ::aws_smithy_schema::ShapeId::from_parts(
        "com.amazonaws.ebs.synthetic#PutSnapshotBlockInput$SnapshotId",
        "com.amazonaws.ebs.synthetic",
        "PutSnapshotBlockInput",
    ),
    ::aws_smithy_schema::ShapeType::String,
    "SnapshotId",
    0,
)
.with_http_label();
static PUTSNAPSHOTBLOCKINPUT_MEMBER_BLOCK_INDEX: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
    ::aws_smithy_schema::ShapeId::from_parts(
        "com.amazonaws.ebs.synthetic#PutSnapshotBlockInput$BlockIndex",
        "com.amazonaws.ebs.synthetic",
        "PutSnapshotBlockInput",
    ),
    ::aws_smithy_schema::ShapeType::Integer,
    "BlockIndex",
    1,
)
.with_http_label();
static PUTSNAPSHOTBLOCKINPUT_MEMBER_BLOCK_DATA: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
    ::aws_smithy_schema::ShapeId::from_parts(
        "com.amazonaws.ebs.synthetic#PutSnapshotBlockInput$BlockData",
        "com.amazonaws.ebs.synthetic",
        "PutSnapshotBlockInput",
    ),
    ::aws_smithy_schema::ShapeType::Blob,
    "BlockData",
    2,
)
.with_http_payload()
.with_streaming();
static PUTSNAPSHOTBLOCKINPUT_MEMBER_DATA_LENGTH: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
    ::aws_smithy_schema::ShapeId::from_parts(
        "com.amazonaws.ebs.synthetic#PutSnapshotBlockInput$DataLength",
        "com.amazonaws.ebs.synthetic",
        "PutSnapshotBlockInput",
    ),
    ::aws_smithy_schema::ShapeType::Integer,
    "DataLength",
    3,
)
.with_http_header("x-amz-Data-Length");
static PUTSNAPSHOTBLOCKINPUT_MEMBER_PROGRESS: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
    ::aws_smithy_schema::ShapeId::from_parts(
        "com.amazonaws.ebs.synthetic#PutSnapshotBlockInput$Progress",
        "com.amazonaws.ebs.synthetic",
        "PutSnapshotBlockInput",
    ),
    ::aws_smithy_schema::ShapeType::Integer,
    "Progress",
    4,
)
.with_http_header("x-amz-Progress");
static PUTSNAPSHOTBLOCKINPUT_MEMBER_CHECKSUM: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
    ::aws_smithy_schema::ShapeId::from_parts(
        "com.amazonaws.ebs.synthetic#PutSnapshotBlockInput$Checksum",
        "com.amazonaws.ebs.synthetic",
        "PutSnapshotBlockInput",
    ),
    ::aws_smithy_schema::ShapeType::String,
    "Checksum",
    5,
)
.with_http_header("x-amz-Checksum");
static PUTSNAPSHOTBLOCKINPUT_MEMBER_CHECKSUM_ALGORITHM: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
    ::aws_smithy_schema::ShapeId::from_parts(
        "com.amazonaws.ebs.synthetic#PutSnapshotBlockInput$ChecksumAlgorithm",
        "com.amazonaws.ebs.synthetic",
        "PutSnapshotBlockInput",
    ),
    ::aws_smithy_schema::ShapeType::String,
    "ChecksumAlgorithm",
    6,
)
.with_http_header("x-amz-Checksum-Algorithm");
static PUTSNAPSHOTBLOCKINPUT_SCHEMA: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_struct(
    ::aws_smithy_schema::ShapeId::from_parts(
        "com.amazonaws.ebs.synthetic#PutSnapshotBlockInput",
        "com.amazonaws.ebs.synthetic",
        "PutSnapshotBlockInput",
    ),
    ::aws_smithy_schema::ShapeType::Structure,
    &[
        &PUTSNAPSHOTBLOCKINPUT_MEMBER_SNAPSHOT_ID,
        &PUTSNAPSHOTBLOCKINPUT_MEMBER_BLOCK_INDEX,
        &PUTSNAPSHOTBLOCKINPUT_MEMBER_BLOCK_DATA,
        &PUTSNAPSHOTBLOCKINPUT_MEMBER_DATA_LENGTH,
        &PUTSNAPSHOTBLOCKINPUT_MEMBER_PROGRESS,
        &PUTSNAPSHOTBLOCKINPUT_MEMBER_CHECKSUM,
        &PUTSNAPSHOTBLOCKINPUT_MEMBER_CHECKSUM_ALGORITHM,
    ],
)
.with_http(aws_smithy_schema::traits::HttpTrait::new(
    "PUT",
    "/snapshots/{SnapshotId}/blocks/{BlockIndex}",
    Some(201),
))
.with_no_body_members()
.with_payload_hint(::aws_smithy_schema::PayloadHint::NoStructPayload)
.with_original_name("PutSnapshotBlockRequest");
impl PutSnapshotBlockInput {
    /// The schema for this shape.
    pub const SCHEMA: &'static ::aws_smithy_schema::Schema<'static> = &PUTSNAPSHOTBLOCKINPUT_SCHEMA;
}
impl ::aws_smithy_schema::serde::SerializableStruct for PutSnapshotBlockInput {
    fn schema(&self) -> &::aws_smithy_schema::Schema<'_> {
        Self::SCHEMA
    }

    #[allow(unused_variables, clippy::diverging_sub_expression)]
    fn serialize_members(
        &self,
        ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer,
    ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
        if let Some(ref val) = self.snapshot_id {
            ser.write_string(&PUTSNAPSHOTBLOCKINPUT_MEMBER_SNAPSHOT_ID, val)?;
        }
        if let Some(ref val) = self.block_index {
            ser.write_integer(&PUTSNAPSHOTBLOCKINPUT_MEMBER_BLOCK_INDEX, *val)?;
        }
        if let Some(ref val) = self.data_length {
            ser.write_integer(&PUTSNAPSHOTBLOCKINPUT_MEMBER_DATA_LENGTH, *val)?;
        }
        if let Some(ref val) = self.progress {
            ser.write_integer(&PUTSNAPSHOTBLOCKINPUT_MEMBER_PROGRESS, *val)?;
        }
        if let Some(ref val) = self.checksum {
            ser.write_string(&PUTSNAPSHOTBLOCKINPUT_MEMBER_CHECKSUM, val)?;
        }
        if let Some(ref val) = self.checksum_algorithm {
            ser.write_string(&PUTSNAPSHOTBLOCKINPUT_MEMBER_CHECKSUM_ALGORITHM, val.as_str())?;
        }
        Ok(())
    }
}
impl crate::operation::put_snapshot_block::builders::PutSnapshotBlockInputBuilder {
    #[allow(
        unused_variables,
        unreachable_code,
        clippy::single_match,
        clippy::match_single_binding,
        clippy::diverging_sub_expression
    )]
    pub(crate) fn deserialize_members(
        &mut self,
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
    ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
        deserializer.read_struct(&PUTSNAPSHOTBLOCKINPUT_SCHEMA, &mut |member, deser| {
            match member.member_index() {
                Some(0) => {
                    if deser.is_null() {
                        deser.read_null()?;
                    } else {
                        self.snapshot_id = Some(deser.read_string(member)?);
                    }
                }
                Some(1) => {
                    if deser.is_null() {
                        deser.read_null()?;
                    } else {
                        self.block_index = Some(deser.read_integer(member)?);
                    }
                }
                Some(2) => {
                    deser.skip_value()?;
                }
                Some(3) => {
                    if deser.is_null() {
                        deser.read_null()?;
                    } else {
                        self.data_length = Some(deser.read_integer(member)?);
                    }
                }
                Some(4) => {
                    if deser.is_null() {
                        deser.read_null()?;
                    } else {
                        self.progress = Some(deser.read_integer(member)?);
                    }
                }
                Some(5) => {
                    if deser.is_null() {
                        deser.read_null()?;
                    } else {
                        self.checksum = Some(deser.read_string(member)?);
                    }
                }
                Some(6) => {
                    if deser.is_null() {
                        deser.read_null()?;
                    } else {
                        self.checksum_algorithm = Some(crate::types::ChecksumAlgorithm::from(deser.read_string(member)?.as_str()));
                    }
                }
                _ => {}
            }
            Ok(())
        })
    }
}

impl PutSnapshotBlockInput {
    /// Deserializes this structure from a [`ShapeDeserializer`].
    pub fn deserialize(
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
        let mut builder = Self::builder();
        builder.deserialize_members(deserializer)?;
        builder.snapshot_id = builder.snapshot_id.or(Some(String::new()));
        builder.block_index = builder.block_index.or(Some(0i32));
        builder.data_length = builder.data_length.or(Some(0i32));
        builder.checksum = builder.checksum.or(Some(String::new()));
        builder.build().map_err(|e| aws_smithy_schema::serde::SerdeError::custom(e.to_string()))
    }
}
impl PutSnapshotBlockInput {
    /// Creates a new builder-style object to manufacture [`PutSnapshotBlockInput`](crate::operation::put_snapshot_block::PutSnapshotBlockInput).
    pub fn builder() -> crate::operation::put_snapshot_block::builders::PutSnapshotBlockInputBuilder {
        crate::operation::put_snapshot_block::builders::PutSnapshotBlockInputBuilder::default()
    }
}

/// A builder for [`PutSnapshotBlockInput`](crate::operation::put_snapshot_block::PutSnapshotBlockInput).
#[derive(::std::default::Default)]
#[non_exhaustive]
pub struct PutSnapshotBlockInputBuilder {
    pub(crate) snapshot_id: ::std::option::Option<::std::string::String>,
    pub(crate) block_index: ::std::option::Option<i32>,
    pub(crate) block_data: ::std::option::Option<::aws_smithy_types::byte_stream::ByteStream>,
    pub(crate) data_length: ::std::option::Option<i32>,
    pub(crate) progress: ::std::option::Option<i32>,
    pub(crate) checksum: ::std::option::Option<::std::string::String>,
    pub(crate) checksum_algorithm: ::std::option::Option<crate::types::ChecksumAlgorithm>,
}
impl PutSnapshotBlockInputBuilder {
    /// <p>The ID of the snapshot.</p><important>
    /// <p>If the specified snapshot is encrypted, you must have permission to use the KMS key that was used to encrypt the snapshot. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebsapis-using-encryption.html"> Using encryption</a> in the <i>Amazon Elastic Compute Cloud User Guide</i>..</p>
    /// </important>
    /// This field is required.
    pub fn snapshot_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.snapshot_id = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The ID of the snapshot.</p><important>
    /// <p>If the specified snapshot is encrypted, you must have permission to use the KMS key that was used to encrypt the snapshot. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebsapis-using-encryption.html"> Using encryption</a> in the <i>Amazon Elastic Compute Cloud User Guide</i>..</p>
    /// </important>
    pub fn set_snapshot_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.snapshot_id = input;
        self
    }
    /// <p>The ID of the snapshot.</p><important>
    /// <p>If the specified snapshot is encrypted, you must have permission to use the KMS key that was used to encrypt the snapshot. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebsapis-using-encryption.html"> Using encryption</a> in the <i>Amazon Elastic Compute Cloud User Guide</i>..</p>
    /// </important>
    pub fn get_snapshot_id(&self) -> &::std::option::Option<::std::string::String> {
        &self.snapshot_id
    }
    /// <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>
    /// This field is required.
    pub fn block_index(mut self, input: i32) -> Self {
        self.block_index = ::std::option::Option::Some(input);
        self
    }
    /// <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>
    pub fn set_block_index(mut self, input: ::std::option::Option<i32>) -> Self {
        self.block_index = input;
        self
    }
    /// <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>
    pub fn get_block_index(&self) -> &::std::option::Option<i32> {
        &self.block_index
    }
    /// <p>The data to write to the block.</p>
    /// <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>
    /// This field is required.
    pub fn block_data(mut self, input: ::aws_smithy_types::byte_stream::ByteStream) -> Self {
        self.block_data = ::std::option::Option::Some(input);
        self
    }
    /// <p>The data to write to the block.</p>
    /// <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>
    pub fn set_block_data(mut self, input: ::std::option::Option<::aws_smithy_types::byte_stream::ByteStream>) -> Self {
        self.block_data = input;
        self
    }
    /// <p>The data to write to the block.</p>
    /// <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>
    pub fn get_block_data(&self) -> &::std::option::Option<::aws_smithy_types::byte_stream::ByteStream> {
        &self.block_data
    }
    /// <p>The size of the data to write to the block, in bytes. Currently, the only supported size is <code>524288</code> bytes.</p>
    /// <p>Valid values: <code>524288</code></p>
    /// This field is required.
    pub fn data_length(mut self, input: i32) -> Self {
        self.data_length = ::std::option::Option::Some(input);
        self
    }
    /// <p>The size of the data to write to the block, in bytes. Currently, the only supported size is <code>524288</code> bytes.</p>
    /// <p>Valid values: <code>524288</code></p>
    pub fn set_data_length(mut self, input: ::std::option::Option<i32>) -> Self {
        self.data_length = input;
        self
    }
    /// <p>The size of the data to write to the block, in bytes. Currently, the only supported size is <code>524288</code> bytes.</p>
    /// <p>Valid values: <code>524288</code></p>
    pub fn get_data_length(&self) -> &::std::option::Option<i32> {
        &self.data_length
    }
    /// <p>The progress of the write process, as a percentage.</p>
    pub fn progress(mut self, input: i32) -> Self {
        self.progress = ::std::option::Option::Some(input);
        self
    }
    /// <p>The progress of the write process, as a percentage.</p>
    pub fn set_progress(mut self, input: ::std::option::Option<i32>) -> Self {
        self.progress = input;
        self
    }
    /// <p>The progress of the write process, as a percentage.</p>
    pub fn get_progress(&self) -> &::std::option::Option<i32> {
        &self.progress
    }
    /// <p>A Base64-encoded SHA256 checksum of the data. Only SHA256 checksums are supported.</p>
    /// This field is required.
    pub fn checksum(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.checksum = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>A Base64-encoded SHA256 checksum of the data. Only SHA256 checksums are supported.</p>
    pub fn set_checksum(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.checksum = input;
        self
    }
    /// <p>A Base64-encoded SHA256 checksum of the data. Only SHA256 checksums are supported.</p>
    pub fn get_checksum(&self) -> &::std::option::Option<::std::string::String> {
        &self.checksum
    }
    /// <p>The algorithm used to generate the checksum. Currently, the only supported algorithm is <code>SHA256</code>.</p>
    /// This field is required.
    pub fn checksum_algorithm(mut self, input: crate::types::ChecksumAlgorithm) -> Self {
        self.checksum_algorithm = ::std::option::Option::Some(input);
        self
    }
    /// <p>The algorithm used to generate the checksum. Currently, the only supported algorithm is <code>SHA256</code>.</p>
    pub fn set_checksum_algorithm(mut self, input: ::std::option::Option<crate::types::ChecksumAlgorithm>) -> Self {
        self.checksum_algorithm = input;
        self
    }
    /// <p>The algorithm used to generate the checksum. Currently, the only supported algorithm is <code>SHA256</code>.</p>
    pub fn get_checksum_algorithm(&self) -> &::std::option::Option<crate::types::ChecksumAlgorithm> {
        &self.checksum_algorithm
    }
    /// Consumes the builder and constructs a [`PutSnapshotBlockInput`](crate::operation::put_snapshot_block::PutSnapshotBlockInput).
    pub fn build(
        self,
    ) -> ::std::result::Result<crate::operation::put_snapshot_block::PutSnapshotBlockInput, ::aws_smithy_types::error::operation::BuildError> {
        ::std::result::Result::Ok(crate::operation::put_snapshot_block::PutSnapshotBlockInput {
            snapshot_id: self.snapshot_id,
            block_index: self.block_index,
            block_data: self.block_data.unwrap_or_default(),
            data_length: self.data_length,
            progress: self.progress,
            checksum: self.checksum,
            checksum_algorithm: self.checksum_algorithm,
        })
    }
}
impl ::std::fmt::Debug for PutSnapshotBlockInputBuilder {
    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
        let mut formatter = f.debug_struct("PutSnapshotBlockInputBuilder");
        formatter.field("snapshot_id", &self.snapshot_id);
        formatter.field("block_index", &self.block_index);
        formatter.field("block_data", &"*** Sensitive Data Redacted ***");
        formatter.field("data_length", &self.data_length);
        formatter.field("progress", &self.progress);
        formatter.field("checksum", &self.checksum);
        formatter.field("checksum_algorithm", &self.checksum_algorithm);
        formatter.finish()
    }
}