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
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
use serde::{
de::{self, MapAccess, Visitor},
ser::SerializeMap,
Deserialize, Deserializer, Serialize, Serializer,
};
use std::{collections::HashMap, fmt};
use strum_macros::Display;
use crate::util::B2FileStream;
#[derive(Debug, Display, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
#[strum(serialize_all = "snake_case")]
pub enum B2Endpoint {
B2AuthorizeAccount,
B2CancelLargeFile,
B2CopyFile,
B2CopyPart,
B2CreateBucket,
B2CreateKey,
B2DeleteBucket,
B2DeleteFileVersion,
B2DeleteKey,
B2DownloadFileById,
B2DownloadFileByName,
B2FinishLargeFile,
B2GetBucketNotificationRules,
B2GetDownloadAuthorization,
B2GetFileInfo,
B2GetUploadPartUrl,
B2GetUploadUrl,
B2HideFile,
B2ListBuckets,
B2ListFileNames,
B2ListFileVersions,
B2ListKeys,
B2ListParts,
B2ListUnfinishedLargeFiles,
B2SetBucketNotificationRules,
B2StartLargeFile,
B2UpdateBucket,
B2UpdateFileLegalHold,
B2UpdateFileRetention,
B2UploadFile,
B2UploadPart,
}
#[derive(Debug, Display, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum B2KeyCapability {
ListKeys,
WriteKeys,
DeleteKeys,
ListBuckets,
ListAllBucketNames,
ReadBuckets,
WriteBuckets,
DeleteBuckets,
ReadBucketRetentions,
WriteBucketRetentions,
ReadBucketEncryption,
WriteBucketEncryption,
ListFiles,
ReadFiles,
ShareFiles,
WriteFiles,
DeleteFiles,
ReadFileLegalHolds,
WriteFileLegalHolds,
ReadFileRetentions,
WriteFileRetentions,
BypassGovernance,
ReadBucketReplications,
WriteBucketReplications,
WriteBucketNotifications,
ReadBucketNotifications,
ReadBucketLogging,
WriteBucketLogging,
}
#[derive(Debug, Display, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum B2Action {
/// file that was uploaded to B2 Cloud Storage.
Upload,
/// large file has been started, but not finished or canceled.
Start,
/// file version marking the file as hidden, so that it will not show up in b2_list_file_names.
Hide,
/// is used to indicate a virtual folder when listing files.
Folder,
}
#[derive(Clone, Deserialize, Serialize, Debug)]
#[serde(rename_all = "camelCase")]
pub struct B2LifeCycleRules {
pub days_from_hiding_to_deleting: Option<u32>,
pub days_from_uploading_to_hiding: Option<u32>,
pub file_name_prefix: Box<str>,
}
#[derive(Clone, Deserialize, Debug, Serialize)]
#[serde(rename_all = "UPPERCASE")]
pub enum B2ReplicationStatus {
Pending,
Completed,
Failed,
Replica,
}
// #[derive(Clone, Deserialize, Debug, Serialize)]
// #[serde(rename_all = "camelCase")]
// pub struct B2ServerSideEncryption {
// pub mode: Option<String>,
// pub algorithm: Option<B2ServerSideEncryptionAlgorithm>,
// }
#[derive(Clone, Debug)]
pub enum B2ServerSideEncryption {
/// Disable SSC, similar to
Disabled,
SseB2 {
algorithm: B2ServerSideEncryptionAlgorithm,
},
SseC {
algorithm: B2ServerSideEncryptionAlgorithm,
customer_key: String,
customer_key_md5: String,
},
}
impl Serialize for B2ServerSideEncryption {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: Serializer,
{
use B2ServerSideEncryption::*;
match self {
Disabled => {
let mut map = serializer.serialize_map(Some(1))?;
map.serialize_entry("mode", &Option::<String>::None)?;
map.end()
}
SseB2 { algorithm } => {
let mut map = serializer.serialize_map(Some(2))?;
map.serialize_entry("mode", "SSE-B2")?;
map.serialize_entry("algorithm", algorithm)?;
map.end()
}
SseC {
algorithm,
customer_key,
customer_key_md5,
} => {
let mut map = serializer.serialize_map(Some(4))?;
map.serialize_entry("mode", "SSE-C")?;
map.serialize_entry("algorithm", algorithm)?;
map.serialize_entry("customerKey", customer_key)?;
map.serialize_entry("customerKeyMd5", customer_key_md5)?;
map.end()
}
}
}
}
impl<'de> Deserialize<'de> for B2ServerSideEncryption {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
D: Deserializer<'de>,
{
struct B2ServerSideEncryptionVisitor;
impl<'de> Visitor<'de> for B2ServerSideEncryptionVisitor {
type Value = B2ServerSideEncryption;
fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
formatter.write_str("a B2ServerSideEncryption object")
}
fn visit_map<M>(self, mut map: M) -> Result<B2ServerSideEncryption, M::Error>
where
M: MapAccess<'de>,
{
let mut mode: Option<String> = None;
let mut algorithm = None;
let mut customer_key = None;
let mut customer_key_md5 = None;
while let Some(key) = map.next_key()? {
match key {
"mode" => mode = map.next_value()?,
"algorithm" => algorithm = map.next_value()?,
"customerKey" => customer_key = map.next_value()?,
"customerKeyMd5" => customer_key_md5 = map.next_value()?,
_ => continue,
}
}
match mode {
Some(mode_str) => match mode_str.as_str() {
"SSE-B2" => {
let algorithm =
algorithm.ok_or_else(|| de::Error::missing_field("algorithm"))?;
Ok(B2ServerSideEncryption::SseB2 { algorithm })
}
"SSE-C" => {
let algorithm =
algorithm.ok_or_else(|| de::Error::missing_field("algorithm"))?;
let customer_key = customer_key
.ok_or_else(|| de::Error::missing_field("customerKey"))?;
let customer_key_md5 = customer_key_md5
.ok_or_else(|| de::Error::missing_field("customerKeyMd5"))?;
Ok(B2ServerSideEncryption::SseC {
algorithm,
customer_key,
customer_key_md5,
})
}
_ => Err(de::Error::unknown_variant(
mode_str.as_str(),
&["SSE-B2", "SSE-C"],
)),
},
None => Ok(B2ServerSideEncryption::Disabled),
}
}
}
deserializer.deserialize_map(B2ServerSideEncryptionVisitor)
}
}
#[derive(Clone, Deserialize, Debug, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct B2FileRetentionPeriod {
pub duration: u64,
pub unit: String,
}
pub struct B2DownloadFileContent {
pub file: B2FileStream,
pub file_details: B2FileDownloadDetails,
pub remaining_headers: HashMap<String, String>,
}
#[derive(Clone, Deserialize, Serialize, Debug)]
#[serde(rename_all = "camelCase")]
pub struct B2BucketRetention {
pub mode: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub period: Option<B2FileRetentionPeriod>,
}
#[derive(Clone, Deserialize, Debug, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct B2ObjectLockValue {
pub default_retention: B2BucketRetention,
pub is_file_lock_enabled: bool,
}
#[derive(Clone, Deserialize, Debug, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct B2BucketFileRetention {
/// Retention mode
pub mode: Option<B2FileRetentionMode>,
/// Timestamp for time in the future, in milliseconds
pub retain_until_timestamp: Option<u64>,
}
#[derive(Clone, Deserialize, Debug, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct B2ObjectLock<T> {
pub is_client_authorized_to_read: bool,
pub value: Option<T>,
}
#[derive(Clone, Deserialize, Debug, Serialize)]
#[serde(rename_all = "camelCase")]
pub enum B2FileAction {
Start,
Upload,
Hide,
Folder,
}
#[derive(Clone, Deserialize, Debug, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct B2File {
/// The account that owns the file.
pub account_id: String,
// The B2 file action
pub action: B2Action,
/// The unique identifier of the bucket.
pub bucket_id: String,
/// The number of bytes stored in the file. Only useful when the action is ["upload"](B2Action::Upload).
/// Always 0 when the action is ["start"](B2Action::Start), ["hide"](B2Action::Hide), or ["folder"](B2Action::Folder).
pub content_length: u64,
/// The SHA1 of the bytes stored in the file as a 40-digit hex string.
/// Large files do not have SHA1 checksums, and the value is "none". The value is null when the action is ["hide"](B2Action::Hide), or ["folder"](B2Action::Folder).
pub content_sha1: Option<String>,
/// The MD5 of the bytes stored in the file as a 32-digit hex string.
/// Not all files have an MD5 checksum, so this field is optional, and set to null for files that do not have one.
/// Large files do not have MD5 checksums, and the value is null. The value is also null when the action is ["hide"](B2Action::Hide), or ["folder"](B2Action::Folder).
pub content_md5: Option<String>,
/// When the action is ["upload"](B2Action::Upload) or ["start"](B2Action::Start), the MIME type of the file, as specified when the file was uploaded.
/// For ["hide"](B2Action::Hide) action, always "application/x-bz-hide-marker". For ["folder"](B2Action::Folder) action, always null.
pub content_type: Option<String>,
/// The unique identifier for this version of this file.
/// Used with b2_get_file_info, b2_download_file_by_id, and b2_delete_file_version.
/// The value is null when for action ["folder"](B2Action::Folder).
pub file_id: String,
/// The custom information that was uploaded with the file. This is a JSON object, holding the name/value pairs that were uploaded with the file.
pub file_info: HashMap<String, String>,
/// The name of this file, which can be used with b2_download_file_by_name.
pub file_name: String,
/// The Object Lock retention settings for this file, if any.
/// This field is filtered based on application key capabilities; the [`readFileRetentions`](B2KeyCapability::ReadFileRetentions) capability is required to access the value.
/// See [Object Lock](https://www.backblaze.com/docs/cloud-storage-enable-object-lock-with-the-native-api)
/// for more details on response structure. This field is omitted when the action is ["hide"](B2Action::Hide), or ["folder"](B2Action::Folder).
pub file_retention: Option<B2ObjectLock<B2BucketFileRetention>>,
/// The Object Lock legal hold status for this file, if any.
/// This field is filtered based on application key capabilities; the [`readFileLegalHolds`](B2KeyCapability::ReadFileLegalHolds) capability is required to access the value.
/// See [Object Lock](https://www.backblaze.com/docs/cloud-storage-enable-object-lock-with-the-native-api)
/// for more details on response structure. This field is omitted when the action is ["hide"](B2Action::Hide), or ["folder"](B2Action::Folder).
pub legal_hold: Option<B2ObjectLock<B2FileLegalHold>>,
/// The Replication Status for this file, if any. This field is omitted when the file is not part of a replication rule.
pub replication_status: Option<B2ReplicationStatus>,
/// When the file is encrypted with [Server-Side Encryption](https://www.backblaze.com/docs/cloud-storage-enable-server-side-encryption-with-the-native-api),
/// the mode ("SSE-B2" or "SSE-C") and algorithm used to encrypt the data.
/// If the file is not encrypted with Server-Side Encryption, then both mode and algorithm will be null.
/// This field is omitted when the action is ["hide"](B2Action::Hide), or ["folder"](B2Action::Folder).
pub server_side_encryption: Option<B2ServerSideEncryption>,
/// This is a UTC time when this file was uploaded.
/// It is a base 10 number of milliseconds since midnight, January 1, 1970 UTC.
/// This fits in a 64 bit integer such as the type "long" in the programming language Java.
/// It is intended to be compatible with Java's time long.
/// For example, it can be passed directly into the java call Date.setTime(long time).
/// Always 0 when the action is ["folder"](B2Action::Folder).
pub upload_timestamp: u64,
}
#[derive(Clone, Deserialize, Serialize, Debug)]
pub enum B2ServerSideEncryptionAlgorithm {
AES256,
}
#[derive(Clone, Deserialize, Serialize, Debug)]
#[serde(rename_all = "camelCase")]
pub enum B2FileRetentionMode {
Governance,
Compliance,
}
#[derive(Clone, Serialize, Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum B2FileLegalHold {
On,
Off,
}
#[derive(Clone, Serialize, Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum B2BucketType {
/// Anybody can download the files is the bucket
AllPublic,
/// You need an authorization token to download the files is the bucket
AllPrivate,
Restricted,
/// Private bucket containing snapshots created in the Backblaze web UI
Snapshot,
Shared,
}
#[derive(Clone, Serialize, Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum B2BucketTypeUpdate {
/// Anybody can download the files is the bucket
AllPublic,
/// You need an authorization token to download the files is the bucket
AllPrivate,
}
#[derive(Clone, Serialize, Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct B2CorsRule {
pub cors_rule_name: String,
pub allowed_origins: Vec<String>,
pub allowed_operations: Vec<B2Endpoint>,
pub expose_headers: Vec<String>,
pub max_age_seconds: u32,
}
#[derive(Clone, Serialize, Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct B2ReplicationRule {
pub destination_bucket_id: String,
pub file_name_prefix: String,
pub include_existing_files: bool,
pub is_enabled: bool,
pub priority: u16,
pub replication_rule_name: String,
}
#[derive(Clone, Serialize, Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum B2ReplicationConfig {
#[serde(rename_all = "camelCase")]
AsReplicationSource {
replication_rules: Vec<B2ReplicationRule>,
source_application_key_id: String,
},
#[serde(rename_all = "camelCase")]
AsReplicationDestination {
source_application_key_id: HashMap<String, String>,
},
}
#[derive(Clone, Serialize, Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
/// At least one of the two keys must be set
pub enum B2BucketOption {
S3,
#[serde(untagged)]
Unknown(String),
}
#[derive(Clone, Serialize, Debug, Deserialize)]
/// References https://www.backblaze.com/docs/cloud-storage-event-notifications-reference-guide#:~:text=for%20more%20details.-,event%20types,-Backblaze%20B2%20currently
pub enum B2EventNotificationEventType {
/// A new object that is uploaded to Backblaze B2 that is not copied or replicated. This does not include multipart objects.
/// <br> Resolves to `b2:ObjectCreated:Upload`
#[serde(rename = "b2:ObjectCreated:Upload")]
ObjectCreatedUpload,
/// A multipart object that was completed in Backblaze B2 that was not replicated.
/// <br> Resolves to `b2:ObjectCreated:MultipartUpload`
#[serde(rename = "b2:ObjectCreated:MultipartUpload")]
ObjectCreatedMultipartUpload,
/// A copied object in Backblaze B2.
/// <br> Resolves to `b2:ObjectCreated:Copy`
#[serde(rename = "b2:ObjectCreated:Copy")]
ObjectCreatedCopy,
/// An object that was replicated in Backblaze B2. This does not include multipart objects. This is the replicated object, and not the source object.
/// <br> Resolves to `b2:ObjectCreated:Replica`
#[serde(rename = "b2:ObjectCreated:Replica")]
ObjectCreatedReplica,
/// A multipart object that was replicated in Backblaze B2. This is the replicated object, and not the source object.
/// <br> Resolves to `b2:ObjectCreated:MultipartReplica`
#[serde(rename = "b2:ObjectCreated:MultipartReplica")]
ObjectMultipartReplica,
/// Listens to all object creation events.
/// <br> Resolves to `b2:ObjectCreated:*`
#[serde(rename = "b2:ObjectCreated:*")]
ObjectCreatedAll,
/// An object that was deleted by user action, such as with an API call or by using the Backblaze web console.
/// <br> Resolves to `b2:ObjectDeleted:Delete`
#[serde(rename = "b2:ObjectDeleted:Delete")]
ObjectDeleted,
/// An object that was deleted by a Lifecycle Rule.
/// <br> Resolves to `b2:ObjectDeleted:LifecycleRule`
#[serde(rename = "b2:ObjectDeleted:LifecycleRule")]
ObjectDeletedLifecycle,
/// Listens to all object deletion events.
/// <br> Resolves to `b2:ObjectCreated:*`
#[serde(rename = "b2:ObjectDeleted:*")]
ObjectDeletedAll,
/// A hide marker that was created by user action, such as with an API call.
/// <br> Resolves to `b2:HideMarkerCreated:Hide`
#[serde(rename = "b2:HideMarkerCreated:Hide")]
HideMarkerCreated,
/// A hide marker that was created by a Lifecycle Rule.
/// <br> Resolves to `b2:ObjectCreated:*`
#[serde(rename = "b2:HideMarkerCreated:LifecycleRule")]
HideMarkerCreatedLifeCycle,
/// Listens to all object hide marker creation events.
/// <br> Resolves to `b2:HideMarkerCreated:*`
#[serde(rename = "b2:HideMarkerCreated:*")]
HideMarkerAll,
/// A multipart upload that was started from the S3-Compatible API with Live Read enabled.
/// <br> Resolves to `b2:MultipartUploadCreated:LiveRead`
#[serde(rename = "b2:MultipartUploadCreated:LiveRead")]
MultiPartUploadCreatedLiveRead,
/// Listens to all object hide marker creation events.
/// <br> Resolves to `b2:MultipartUploadCreated:*`
#[serde(rename = "b2:MultipartUploadCreated:*")]
MultiPartUploadCreatedAll,
}
#[derive(Clone, Serialize, Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum B2EventNotificationTargetType {
Webhook,
}
#[derive(Clone, Serialize, Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct B2EventNotificationRule {
/// The list of event types for the event notification rule.
pub event_types: Vec<B2EventNotificationEventType>,
/// Whether the event notification rule is enabled.
pub is_enabled: bool,
/// A name for the event notification rule. The name must be unique among the bucket's notification rules.
pub name: String,
/// Specifies which object(s) in the bucket the event notification rule applies to.
pub object_name_prefix: String,
/// Whether the event notification rule is suspended.
pub is_suspended: Option<bool>,
/// Represents the maximum number of events a user will receive per webhook invocation. The value must be a number between 1 and 50. The default value is 1.
pub max_events_per_batch: Option<u8>,
/// A brief description of why the event notification rule was suspended.
pub suspension_reason: Option<String>,
/// The target configuration for the event notification rule.
/// <br><br>This object will always contain the `targetType`` field. Currently, the only valid value for `targetType`` is "webhook."
/// <br><br>The fields for "webhook" objects are defined below. However, other `targetType`` values and collections of fields will be available in the future.
pub target_configuration: B2NotificationConfiguration,
}
#[derive(Clone, Serialize, Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct B2NotificationConfiguration {
/// The URL for the webhook.
pub url: String,
/// The type of the target configuration, currently "webhook" only.
pub target_type: B2EventNotificationTargetType,
/// The signing secret for use in verifying the `X-Bz-Event-Notification-Signature``.
pub hmac_sha256_signing_secret: Option<String>,
/// When present, additional header name/value pairs to be sent on the webhook invocation.
pub custom_headers: Option<HashMap<String, String>>,
}
#[derive(Clone, Serialize, Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct B2FilePart {
pub file_id: String,
pub part_number: u32,
pub content_length: u64,
pub content_sha1: String,
pub content_md5: Option<String>,
pub server_side_encryption: B2ServerSideEncryption,
pub upload_timestamp: u64,
}
#[derive(Clone, Serialize, Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct B2AppKey {
/// Your account ID.
pub account_id: String,
/// The ID of the newly created key.
pub application_key_id: String,
/// The secret part of the key. Only returned when creating a new key with [b2_create_key](crate::simple_client::B2SimpleClient::create_key).
pub application_key: Option<String>,
/// When present, restricts access to one bucket.
pub bucket_id: Option<String>,
/// The list of capabilities this key has.
pub capabilities: Vec<B2KeyCapability>,
/// When present, says when this key will expire, in milliseconds since 1970.
pub expiration_timestamp: Option<u64>,
/// The name assigned when the key was created.
pub key_name: String,
/// When present, restricts access to files whose names start with the prefix.
pub name_prefix: Option<String>,
/// When present and set to s3, the key can be used to sign requests to the [S3 Compatible API](https://www.backblaze.com/apidocs/introduction-to-the-s3-compatible-api).
pub options: Option<Vec<B2BucketOption>>,
}
#[derive(Clone, Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct B2Bucket {
/// Your account ID.
pub account_id: String,
/// The unique identifier of the bucket.
pub bucket_id: String,
/// The unique name of the bucket.
pub bucket_name: String,
/// The bucket type.
pub bucket_type: B2BucketType,
/// The user data stored with this bucket.
pub bucket_info: HashMap<String, String>,
/// The initial list of CORS rules for this bucket.
/// See [CORS Rules](https://www.backblaze.com/docs/cloud-storage-cross-origin-resource-sharing-rules) for an overview and the rule structure.
pub cors_rules: Vec<B2CorsRule>,
/// The Object Lock configuration for this bucket.
/// This field is filtered based on application key capabilities; the [`readBucketRetentions`](B2KeyCapability::ReadBucketRetentions) capability is required to access the value.
/// See [Object Lock](https://www.backblaze.com/docs/cloud-storage-enable-object-lock-with-the-native-api) for more details on response structure.
pub file_lock_configuration: B2ObjectLock<B2BucketFileRetention>,
/// The default bucket Server-Side Encryption settings for new files uploaded to this bucket.
/// This field is filtered based on application key capabilities; the [`readBucketEncryption`](B2KeyCapability::ReadBucketEncryption) capability is required to access the value.
/// See [ Server-Side Encryption](https://www.backblaze.com/docs/cloud-storage-enable-server-side-encryption-with-the-native-api) for more details on response structure
pub default_server_side_encryption: B2ServerSideEncryption,
/// The initial list of lifecycle rules for this bucket.
/// See [Lifecycle Rules](https://www.backblaze.com/docs/cloud-storage-lifecycle-rules) for an overview and the rule structure.
pub life_cycle_rules: Option<Vec<B2LifeCycleRules>>,
/// The list of replication rules for this bucket. See [Cloud Replication](https://www.backblaze.com/docs/cloud-storage-create-a-cloud-replication-rule-with-the-native-api) Rules.
/// <br><br> NOTE: The first time that you configure Cloud Replication, complete the following tasks to ensure that you have the correct permission:
/// - Verify your email address.
/// - Have a payment history on file or make a payment.
pub replication_configuration: B2ReplicationConfig,
/// A counter that is updated every time the bucket is modified,
/// and can be used with the [`ifRevisionIs`](super::bodies::B2UpdateBucketBody::if_revision_is) parameter to b2_update_bucket to prevent colliding, simultaneous updates.
pub revision: u32,
/// When present and set to s3, the bucket can be accessed through the [`S3 Compatible API`](https://www.backblaze.com/apidocs/introduction-to-the-s3-compatible-api).
pub options: Option<Vec<B2BucketOption>>,
}
#[derive(Clone, Debug, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct B2CustomerAgnosticServerSideEncryption {
pub customer_key: String,
pub customer_key_md5: String,
#[serde(flatten)]
pub server_side_encryption: B2ServerSideEncryption,
}
#[derive(Clone, Debug, Deserialize, Serialize)]
#[serde(rename_all = "UPPERCASE")]
pub enum B2MetadataDirective {
Copy,
}
#[derive(Clone, Debug, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct B2FileDownloadDetails {
pub content_length: u64,
pub content_type: String,
pub file_id: String,
pub file_name: String,
pub content_sha1: Option<String>,
pub upload_timestamp: u64,
pub file_info: Option<HashMap<String, String>>,
}