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
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
use std::{collections::HashMap, num::NonZero};
use azure_core::{
fmt::SafeDebug,
http::{ClientMethodOptions, Etag},
};
use time::OffsetDateTime;
use crate::models::{AccessTier, EncryptionAlgorithmType, HttpRange, ImmutabilityPolicyMode};
/// Options to be passed to `BlobClient::download()`
#[derive(Clone, Default, SafeDebug)]
pub struct BlobClientDownloadOptions<'a> {
/// The algorithm used to produce the encryption key hash. Must be provided if the encryption key is provided.
pub encryption_algorithm: Option<EncryptionAlgorithmType>,
/// Specifies the encryption key to use to encrypt the data provided in the request.
pub encryption_key: Option<String>,
/// The SHA-256 hash of the provided encryption key. Must be provided if the encryption key is provided.
pub encryption_key_sha256: Option<String>,
/// Specify this value to operate only on a blob with a matching Etag value.
pub if_match: Option<Etag>,
/// Specify this value to operate only on a blob if it has been modified since the specified date-time.
pub if_modified_since: Option<OffsetDateTime>,
/// Specify this value to operate only on a blob with a non-matching Etag value.
pub if_none_match: Option<Etag>,
/// Specifies a SQL-like where clause on blob tags to operate only on a blob with matching tags.
pub if_tags: Option<String>,
/// Specify this value to operate only on a blob if it has not been modified since the specified date-time.
pub if_unmodified_since: Option<OffsetDateTime>,
/// If specified, the operation only succeeds if the resource's lease is active and matches this ID.
pub lease_id: Option<String>,
/// Allows customization of the method call.
pub method_options: ClientMethodOptions<'a>,
/// Optional. Number of concurrent network transfers to maintain for this operation.
/// A default value will be chosen if none is provided.
pub parallel: Option<NonZero<usize>>,
/// Optional. Size to partition data into.
/// A default value will be chosen if none is provided.
pub partition_size: Option<NonZero<usize>>,
/// Optional range of the blob to download.
///
/// Accepts an [`HttpRange`] value. You can convert from standard Rust range types
/// using `.into()`, for example `(0..100u64).into()` or `(100u64..).into()`.
///
/// When set to `None`, the entire blob will be downloaded.
pub range: Option<HttpRange>,
/// When set to true and the request includes a Range header, the service returns the CRC64 hash for the range, as long as
/// the range is less than or equal to 4 MiB in size.
pub range_get_content_crc64: Option<bool>,
/// When set to true and specified together with the `Range` header, the service returns the MD5 hash for the range, as long
/// as the range is less than or equal to 4 MiB in size.
pub range_get_content_md5: Option<bool>,
/// Specifies the snapshot of the blob.
pub snapshot: Option<String>,
/// The timeout parameter is expressed in seconds. For more information, see [Setting Timeouts for Blob Service Operations.](https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations)
pub timeout: Option<i32>,
/// Specifies the version ID of the blob.
pub version_id: Option<String>,
}
/// Options to be passed to `BlockBlobClient::upload()`
#[derive(Clone, Default, SafeDebug)]
pub struct BlockBlobClientUploadOptions<'a> {
/// Specifies the blob's Cache-Control. If specified, this property is stored with the blob and returned with a read request.
pub blob_cache_control: Option<String>,
/// Specifies the blob's Content-Disposition. If specified, this property is stored with the blob and returned with a read
/// request.
pub blob_content_disposition: Option<String>,
/// Specifies the blob's Content-Encoding. If specified, this property is stored with the blob and returned with a read request.
pub blob_content_encoding: Option<String>,
/// Specifies the blob's Content-Language. If specified, this property is stored with the blob and returned with a read request.
pub blob_content_language: Option<String>,
/// The MD5 hash of the blob content that is stored as a property on the blob. Note: This hash is not validated.
pub blob_content_md5: Option<Vec<u8>>,
/// Specifies the blob's Content-Type. If specified, this property is stored with the blob and returned with a read request.
pub blob_content_type: Option<String>,
/// The blob tags.
///
/// This is the percent-encoded `x-ms-tags` header value (`key=value&key2=value2`).
/// Use [`Self::with_tags`] to set this from a `HashMap<String, String>` or `BlobTags`.
pub blob_tags_string: Option<String>,
/// The algorithm used to produce the encryption key hash. Must be provided if the encryption key is provided.
pub encryption_algorithm: Option<EncryptionAlgorithmType>,
/// Specifies the encryption key to use to encrypt the data provided in the request.
pub encryption_key: Option<String>,
/// The SHA-256 hash of the provided encryption key. Must be provided if the encryption key is provided.
pub encryption_key_sha256: Option<String>,
/// Specifies the encryption scope used to encrypt the data.
pub encryption_scope: Option<String>,
/// The date-time that indicates the time at which the blob immutability policy will expire.
pub immutability_policy_expiry: Option<OffsetDateTime>,
/// Indicates the immutability policy mode of the blob.
pub immutability_policy_mode: Option<ImmutabilityPolicyMode>,
/// Specify this value to operate only on a blob with a matching Etag value.
pub if_match: Option<Etag>,
/// Specify this value to operate only on a blob if it has been modified since the specified date-time.
pub if_modified_since: Option<OffsetDateTime>,
/// Specify this value to operate only on a blob with a non-matching Etag value.
pub if_none_match: Option<Etag>,
/// Specifies a SQL-like where clause on blob tags to operate only on a blob with matching tags.
pub if_tags: Option<String>,
/// Specify this value to operate only on a blob if it has not been modified since the specified date-time.
pub if_unmodified_since: Option<OffsetDateTime>,
/// If specified, the operation only succeeds if the resource's lease is active and matches this ID.
pub lease_id: Option<String>,
/// Indicates whether the blob has a legal hold.
pub legal_hold: Option<bool>,
/// The metadata headers.
pub metadata: Option<HashMap<String, String>>,
/// Allows customization of the method call.
pub method_options: ClientMethodOptions<'a>,
/// Optional. Number of concurrent network transfers to maintain for this operation.
/// A default value will be chosen if none is provided.
pub parallel: Option<NonZero<usize>>,
/// Optional. Size to partition data into.
/// A default value will be chosen if none is provided.
pub partition_size: Option<NonZero<u64>>,
/// Optional. The server-side timeout to apply on each individual request. This is not a timeout for the whole operation.
/// The timeout parameter is expressed in seconds. For more information, see
/// [Setting Timeouts for Blob Service Operations.](https://docs.microsoft.com/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations)
pub per_request_timeout: Option<i32>,
/// The tier to be set on the blob.
pub tier: Option<AccessTier>,
}