azure_storage_blobs/blob/operations/
append_block.rs1use crate::{blob::operations::put_block::PutBlockResponse, prelude::*};
2use azure_core::{headers::*, prelude::*, Body};
3
4operation! {
5 AppendBlock,
6 client: BlobClient,
7 body: Body,
8 ?hash: Hash,
9 ?condition_max_size: ConditionMaxSize,
10 ?condition_append_position: ConditionAppendPosition,
11 ?if_modified_since: IfModifiedSinceCondition,
12 ?if_match: IfMatchCondition,
13 ?if_tags: IfTags,
14 ?lease_id: LeaseId
15}
16
17impl AppendBlockBuilder {
18 pub fn into_future(mut self) -> AppendBlock {
19 Box::pin(async move {
20 let mut url = self.client.url()?;
21
22 url.query_pairs_mut().append_pair("comp", "appendblock");
23
24 let mut headers = Headers::new();
25 headers.add(self.hash);
26 headers.add(self.condition_max_size);
27 headers.add(self.condition_append_position);
28 headers.add(self.if_modified_since);
29 headers.add(self.if_match);
30 headers.add(self.if_tags);
31 headers.add(self.lease_id);
32
33 let mut request = BlobClient::finalize_request(
34 url,
35 azure_core::Method::Put,
36 headers,
37 Some(self.body),
38 )?;
39
40 let response = self.client.send(&mut self.context, &mut request).await?;
41
42 PutBlockResponse::from_headers(response.headers())
43 })
44 }
45}
46
47type AppendBlockResponse = PutBlockResponse;