azure_storage_blobs/blob/operations/
put_page_blob.rs1use crate::{blob::operations::PutBlobResponse, prelude::*};
2use azure_core::{
3 headers::{Headers, BLOB_CONTENT_LENGTH, BLOB_TYPE},
4 prelude::*,
5};
6
7operation! {
8 PutPageBlob,
9 client: BlobClient,
10 length: u128,
11 ?content_type: BlobContentType,
12 ?content_encoding: BlobContentEncoding,
13 ?content_language: BlobContentLanguage,
14 ?content_disposition: BlobContentDisposition,
15 ?metadata: Metadata,
16 ?tags: Tags,
17 ?lease_id: LeaseId,
18 ?sequence_number: SequenceNumber
19}
20
21impl PutPageBlobBuilder {
22 pub fn into_future(mut self) -> PutPageBlob {
23 Box::pin(async move {
24 let url = self.client.url()?;
25
26 let mut headers = Headers::new();
27 headers.insert(BLOB_TYPE, "PageBlob");
28 headers.insert(BLOB_CONTENT_LENGTH, format!("{}", self.length));
29 headers.add(self.content_type);
30 headers.add(self.content_encoding);
31 headers.add(self.content_language);
32 headers.add(self.content_disposition);
33 headers.add(self.tags);
34 if let Some(metadata) = &self.metadata {
35 for m in metadata.iter() {
36 headers.add(m);
37 }
38 }
39 headers.add(self.lease_id);
40 headers.add(self.sequence_number);
41
42 let mut request =
43 BlobClient::finalize_request(url, azure_core::Method::Put, headers, None)?;
44
45 let response = self.client.send(&mut self.context, &mut request).await?;
46 PutBlobResponse::from_headers(response.headers())
47 })
48 }
49}
50
51type PutPageBlobResponse = PutBlobResponse;