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
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
#[allow(missing_docs)] // documentation missing in model
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct GetSnapshotBlockInput {
/// <p>The ID of the snapshot containing the block from which to get data.</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 read 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 block token of the block from which to get data. You can obtain the <code>BlockToken</code> by running the <code>ListChangedBlocks</code> or <code>ListSnapshotBlocks</code> operations.</p>
pub block_token: ::std::option::Option<::std::string::String>,
}
impl GetSnapshotBlockInput {
/// <p>The ID of the snapshot containing the block from which to get data.</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 read 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 block token of the block from which to get data. You can obtain the <code>BlockToken</code> by running the <code>ListChangedBlocks</code> or <code>ListSnapshotBlocks</code> operations.</p>
pub fn block_token(&self) -> ::std::option::Option<&str> {
self.block_token.as_deref()
}
}
static GETSNAPSHOTBLOCKINPUT_MEMBER_SNAPSHOT_ID: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
::aws_smithy_schema::ShapeId::from_parts(
"com.amazonaws.ebs.synthetic#GetSnapshotBlockInput$SnapshotId",
"com.amazonaws.ebs.synthetic",
"GetSnapshotBlockInput",
),
::aws_smithy_schema::ShapeType::String,
"SnapshotId",
0,
)
.with_http_label();
static GETSNAPSHOTBLOCKINPUT_MEMBER_BLOCK_INDEX: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
::aws_smithy_schema::ShapeId::from_parts(
"com.amazonaws.ebs.synthetic#GetSnapshotBlockInput$BlockIndex",
"com.amazonaws.ebs.synthetic",
"GetSnapshotBlockInput",
),
::aws_smithy_schema::ShapeType::Integer,
"BlockIndex",
1,
)
.with_http_label();
static GETSNAPSHOTBLOCKINPUT_MEMBER_BLOCK_TOKEN: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
::aws_smithy_schema::ShapeId::from_parts(
"com.amazonaws.ebs.synthetic#GetSnapshotBlockInput$BlockToken",
"com.amazonaws.ebs.synthetic",
"GetSnapshotBlockInput",
),
::aws_smithy_schema::ShapeType::String,
"BlockToken",
2,
)
.with_http_query("blockToken");
static GETSNAPSHOTBLOCKINPUT_SCHEMA: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_struct(
::aws_smithy_schema::ShapeId::from_parts(
"com.amazonaws.ebs.synthetic#GetSnapshotBlockInput",
"com.amazonaws.ebs.synthetic",
"GetSnapshotBlockInput",
),
::aws_smithy_schema::ShapeType::Structure,
&[
&GETSNAPSHOTBLOCKINPUT_MEMBER_SNAPSHOT_ID,
&GETSNAPSHOTBLOCKINPUT_MEMBER_BLOCK_INDEX,
&GETSNAPSHOTBLOCKINPUT_MEMBER_BLOCK_TOKEN,
],
)
.with_http(aws_smithy_schema::traits::HttpTrait::new(
"GET",
"/snapshots/{SnapshotId}/blocks/{BlockIndex}",
None,
))
.with_no_body_members()
.with_payload_hint(::aws_smithy_schema::PayloadHint::NoStructPayload)
.with_original_name("GetSnapshotBlockRequest");
impl GetSnapshotBlockInput {
/// The schema for this shape.
pub const SCHEMA: &'static ::aws_smithy_schema::Schema<'static> = &GETSNAPSHOTBLOCKINPUT_SCHEMA;
}
impl ::aws_smithy_schema::serde::SerializableStruct for GetSnapshotBlockInput {
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(&GETSNAPSHOTBLOCKINPUT_MEMBER_SNAPSHOT_ID, val)?;
}
if let Some(ref val) = self.block_index {
ser.write_integer(&GETSNAPSHOTBLOCKINPUT_MEMBER_BLOCK_INDEX, *val)?;
}
if let Some(ref val) = self.block_token {
ser.write_string(&GETSNAPSHOTBLOCKINPUT_MEMBER_BLOCK_TOKEN, val)?;
}
Ok(())
}
}
impl crate::operation::get_snapshot_block::builders::GetSnapshotBlockInputBuilder {
#[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(&GETSNAPSHOTBLOCKINPUT_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) => {
if deser.is_null() {
deser.read_null()?;
} else {
self.block_token = Some(deser.read_string(member)?);
}
}
_ => {}
}
Ok(())
})
}
}
impl GetSnapshotBlockInput {
/// 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.block_token = builder.block_token.or(Some(String::new()));
builder.build().map_err(|e| aws_smithy_schema::serde::SerdeError::custom(e.to_string()))
}
}
impl GetSnapshotBlockInput {
/// Creates a new builder-style object to manufacture [`GetSnapshotBlockInput`](crate::operation::get_snapshot_block::GetSnapshotBlockInput).
pub fn builder() -> crate::operation::get_snapshot_block::builders::GetSnapshotBlockInputBuilder {
crate::operation::get_snapshot_block::builders::GetSnapshotBlockInputBuilder::default()
}
}
/// A builder for [`GetSnapshotBlockInput`](crate::operation::get_snapshot_block::GetSnapshotBlockInput).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct GetSnapshotBlockInputBuilder {
pub(crate) snapshot_id: ::std::option::Option<::std::string::String>,
pub(crate) block_index: ::std::option::Option<i32>,
pub(crate) block_token: ::std::option::Option<::std::string::String>,
}
impl GetSnapshotBlockInputBuilder {
/// <p>The ID of the snapshot containing the block from which to get data.</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 containing the block from which to get data.</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 containing the block from which to get data.</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 read 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 read 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 read 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 block token of the block from which to get data. You can obtain the <code>BlockToken</code> by running the <code>ListChangedBlocks</code> or <code>ListSnapshotBlocks</code> operations.</p>
/// This field is required.
pub fn block_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.block_token = ::std::option::Option::Some(input.into());
self
}
/// <p>The block token of the block from which to get data. You can obtain the <code>BlockToken</code> by running the <code>ListChangedBlocks</code> or <code>ListSnapshotBlocks</code> operations.</p>
pub fn set_block_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.block_token = input;
self
}
/// <p>The block token of the block from which to get data. You can obtain the <code>BlockToken</code> by running the <code>ListChangedBlocks</code> or <code>ListSnapshotBlocks</code> operations.</p>
pub fn get_block_token(&self) -> &::std::option::Option<::std::string::String> {
&self.block_token
}
/// Consumes the builder and constructs a [`GetSnapshotBlockInput`](crate::operation::get_snapshot_block::GetSnapshotBlockInput).
pub fn build(
self,
) -> ::std::result::Result<crate::operation::get_snapshot_block::GetSnapshotBlockInput, ::aws_smithy_types::error::operation::BuildError> {
::std::result::Result::Ok(crate::operation::get_snapshot_block::GetSnapshotBlockInput {
snapshot_id: self.snapshot_id,
block_index: self.block_index,
block_token: self.block_token,
})
}
}