azure_storage_queue 0.5.0

Microsoft Azure Queue client library for Rust
Documentation
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
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
//
// Code generated by Microsoft (R) Rust Code Generator. DO NOT EDIT.

use super::{
    models_serde,
    xml_helpers::{CorsCorsRule, Queue_itemsQueue},
    GeoReplicationStatus,
};
use azure_core::{fmt::SafeDebug, time::OffsetDateTime};
use serde::{Deserialize, Serialize};
use std::collections::HashMap;

/// The access policy.
#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)]
pub struct AccessPolicy {
    /// The date-time the policy expires.
    #[serde(
        default,
        rename = "Expiry",
        skip_serializing_if = "Option::is_none",
        with = "models_serde::option_offset_date_time_rfc3339_fixed_width"
    )]
    pub expiry: Option<OffsetDateTime>,

    /// The permissions for the policy.
    #[serde(rename = "Permission", skip_serializing_if = "Option::is_none")]
    pub permission: Option<String>,

    /// The date-time the policy is active.
    #[serde(
        default,
        rename = "Start",
        skip_serializing_if = "Option::is_none",
        with = "models_serde::option_offset_date_time_rfc3339_fixed_width"
    )]
    pub start: Option<OffsetDateTime>,
}

/// The CORS rules.
#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)]
#[serde(rename = "CorsRule")]
pub struct CorsRule {
    /// The allowed headers.
    #[serde(rename = "AllowedHeaders", skip_serializing_if = "Option::is_none")]
    pub allowed_headers: Option<String>,

    /// The allowed methods.
    #[serde(rename = "AllowedMethods", skip_serializing_if = "Option::is_none")]
    pub allowed_methods: Option<String>,

    /// The allowed origins.
    #[serde(rename = "AllowedOrigins", skip_serializing_if = "Option::is_none")]
    pub allowed_origins: Option<String>,

    /// The exposed headers.
    #[serde(rename = "ExposedHeaders", skip_serializing_if = "Option::is_none")]
    pub exposed_headers: Option<String>,

    /// The maximum age in seconds.
    #[serde(rename = "MaxAgeInSeconds", skip_serializing_if = "Option::is_none")]
    pub max_age_in_seconds: Option<i32>,
}

/// The error response.
#[derive(Clone, Deserialize, SafeDebug, Serialize)]
pub struct Error {
    /// The error code.
    #[serde(rename = "Code", skip_serializing_if = "Option::is_none")]
    pub code: Option<String>,

    /// Copy source error code.
    #[serde(
        rename = "CopySourceErrorCode",
        skip_serializing_if = "Option::is_none"
    )]
    pub copy_source_error_code: Option<String>,

    /// Copy source error message.
    #[serde(
        rename = "CopySourceErrorMessage",
        skip_serializing_if = "Option::is_none"
    )]
    pub copy_source_error_message: Option<String>,

    /// Copy source status code.
    #[serde(
        rename = "CopySourceStatusCode",
        skip_serializing_if = "Option::is_none"
    )]
    pub copy_source_status_code: Option<i32>,

    /// The error code.
    #[serde(rename = "errorCode", skip_serializing_if = "Option::is_none")]
    pub error_code: Option<String>,

    /// The error message.
    #[serde(rename = "Message", skip_serializing_if = "Option::is_none")]
    pub message: Option<String>,

    /// The error code for the copy source.
    #[serde(
        rename = "xMsCopySourceErrorCode",
        skip_serializing_if = "Option::is_none"
    )]
    pub x_ms_copy_source_error_code: Option<String>,

    /// The status code for the copy source.
    #[serde(
        rename = "xMsCopySourceStatusCode",
        skip_serializing_if = "Option::is_none"
    )]
    pub x_ms_copy_source_status_code: Option<i32>,
}

/// Geo replication information for the secondary storage location.
#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)]
#[non_exhaustive]
pub struct GeoReplication {
    /// A GMT date/time value, to the second. All primary writes preceding this value are guaranteed to be available
    /// for read operations at the secondary. Primary writes after this point in time may or may not be available
    /// for reads.
    #[serde(
        default,
        rename = "LastSyncTime",
        skip_serializing_if = "Option::is_none",
        with = "azure_core::time::rfc7231::option"
    )]
    pub last_sync_time: Option<OffsetDateTime>,

    /// The status of the secondary location.
    #[serde(rename = "Status", skip_serializing_if = "Option::is_none")]
    pub status: Option<GeoReplicationStatus>,
}

/// The list queues response.
#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)]
#[non_exhaustive]
#[serde(rename = "EnumerationResults")]
pub struct ListQueuesResponse {
    /// Identifies the current position in the list queues operation.
    #[serde(rename = "Marker", skip_serializing_if = "Option::is_none")]
    pub marker: Option<String>,

    /// The max results.
    #[serde(rename = "MaxResults", skip_serializing_if = "Option::is_none")]
    pub max_results: Option<i32>,

    /// Identifies the portion of the list of queues to be returned with the next listing operation.
    #[serde(rename = "NextMarker", skip_serializing_if = "Option::is_none")]
    pub next_marker: Option<String>,

    /// The prefix of the queues.
    #[serde(rename = "Prefix", skip_serializing_if = "Option::is_none")]
    pub prefix: Option<String>,

    /// The list of queues.
    #[serde(
        default,
        deserialize_with = "Queue_itemsQueue::unwrap",
        rename = "Queues",
        serialize_with = "Queue_itemsQueue::wrap"
    )]
    pub queue_items: Vec<QueueItem>,

    /// The service endpoint.
    #[serde(rename = "@ServiceEndpoint", skip_serializing_if = "Option::is_none")]
    pub service_endpoint: Option<String>,
}

/// Azure Analytics Logging settings.
#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)]
pub struct Logging {
    /// Whether delete operation is logged.
    #[serde(rename = "Delete", skip_serializing_if = "Option::is_none")]
    pub delete: Option<bool>,

    /// Whether read operation is logged.
    #[serde(rename = "Read", skip_serializing_if = "Option::is_none")]
    pub read: Option<bool>,

    /// The retention policy of the logs.
    #[serde(rename = "RetentionPolicy", skip_serializing_if = "Option::is_none")]
    pub retention_policy: Option<RetentionPolicy>,

    /// The version of the logging properties.
    #[serde(rename = "Version", skip_serializing_if = "Option::is_none")]
    pub version: Option<String>,

    /// Whether write operation is logged.
    #[serde(rename = "Write", skip_serializing_if = "Option::is_none")]
    pub write: Option<bool>,
}

/// The metrics properties.
#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)]
pub struct Metrics {
    /// Whether it is enabled.
    #[serde(rename = "Enabled", skip_serializing_if = "Option::is_none")]
    pub enabled: Option<bool>,

    /// Whether to include API in the metrics.
    #[serde(rename = "IncludeAPIs", skip_serializing_if = "Option::is_none")]
    pub include_apis: Option<bool>,

    /// The retention policy of the metrics.
    #[serde(rename = "RetentionPolicy", skip_serializing_if = "Option::is_none")]
    pub retention_policy: Option<RetentionPolicy>,

    /// The version of the metrics properties.
    #[serde(rename = "Version", skip_serializing_if = "Option::is_none")]
    pub version: Option<String>,
}

/// The peeked queue message.
#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)]
#[non_exhaustive]
#[serde(rename = "QueueMessage")]
pub struct PeekedMessage {
    /// The number of times the message has been dequeued.
    #[serde(rename = "DequeueCount", skip_serializing_if = "Option::is_none")]
    pub dequeue_count: Option<i64>,

    /// The time that the message will expire and be automatically deleted.
    #[serde(
        default,
        rename = "ExpirationTime",
        skip_serializing_if = "Option::is_none",
        with = "azure_core::time::rfc7231::option"
    )]
    pub expiration_time: Option<OffsetDateTime>,

    /// The time the message was inserted into the queue.
    #[serde(
        default,
        rename = "InsertionTime",
        skip_serializing_if = "Option::is_none",
        with = "azure_core::time::rfc7231::option"
    )]
    pub insertion_time: Option<OffsetDateTime>,

    /// The ID of the message.
    #[serde(rename = "MessageId", skip_serializing_if = "Option::is_none")]
    pub message_id: Option<String>,

    /// The content of the message.
    #[serde(rename = "MessageText", skip_serializing_if = "Option::is_none")]
    pub message_text: Option<String>,
}

/// The response of peek messages.
#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)]
#[non_exhaustive]
#[serde(rename = "QueueMessagesList")]
pub struct PeekedMessages {
    /// The list of peeked messages.
    #[serde(rename = "QueueMessage", skip_serializing_if = "Option::is_none")]
    pub items: Option<Vec<PeekedMessage>>,
}

/// Contains results for `QueueClient::get_properties()`
#[derive(SafeDebug)]
pub struct QueueClientGetPropertiesResult;

/// An Azure Storage Queue.
#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)]
#[non_exhaustive]
#[serde(rename = "Queue")]
pub struct QueueItem {
    /// The metadata of the queue.
    #[serde(rename = "Metadata", skip_serializing_if = "Option::is_none")]
    pub metadata: Option<HashMap<String, String>>,

    /// The name of the queue.
    #[serde(rename = "Name", skip_serializing_if = "Option::is_none")]
    pub name: Option<String>,
}

/// The queue message.
#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)]
pub struct QueueMessage {
    /// The content of the message.
    #[serde(rename = "MessageText", skip_serializing_if = "Option::is_none")]
    pub message_text: Option<String>,
}

/// The service properties.
#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)]
#[serde(rename = "StorageServiceProperties")]
pub struct QueueServiceProperties {
    /// The CORS properties.
    #[serde(
        default,
        deserialize_with = "CorsCorsRule::unwrap",
        rename = "Cors",
        serialize_with = "CorsCorsRule::wrap",
        skip_serializing_if = "Option::is_none"
    )]
    pub cors: Option<Vec<CorsRule>>,

    /// The hour metrics properties.
    #[serde(rename = "HourMetrics", skip_serializing_if = "Option::is_none")]
    pub hour_metrics: Option<Metrics>,

    /// The logging properties.
    #[serde(rename = "Logging", skip_serializing_if = "Option::is_none")]
    pub logging: Option<Logging>,

    /// The minute metrics properties.
    #[serde(rename = "MinuteMetrics", skip_serializing_if = "Option::is_none")]
    pub minute_metrics: Option<Metrics>,
}

/// Statistics for the storage queue service.
#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)]
#[non_exhaustive]
pub struct QueueServiceStats {
    /// The geo replication stats.
    #[serde(rename = "GeoReplication", skip_serializing_if = "Option::is_none")]
    pub geo_replication: Option<GeoReplication>,
}

/// The received queue message.
#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)]
#[non_exhaustive]
#[serde(rename = "QueueMessage")]
pub struct ReceivedMessage {
    /// The number of times the message has been dequeued.
    #[serde(rename = "DequeueCount", skip_serializing_if = "Option::is_none")]
    pub dequeue_count: Option<i64>,

    /// The time that the message will expire and be automatically deleted.
    #[serde(
        default,
        rename = "ExpirationTime",
        skip_serializing_if = "Option::is_none",
        with = "azure_core::time::rfc7231::option"
    )]
    pub expiration_time: Option<OffsetDateTime>,

    /// The time the message was inserted into the queue.
    #[serde(
        default,
        rename = "InsertionTime",
        skip_serializing_if = "Option::is_none",
        with = "azure_core::time::rfc7231::option"
    )]
    pub insertion_time: Option<OffsetDateTime>,

    /// The ID of the message.
    #[serde(rename = "MessageId", skip_serializing_if = "Option::is_none")]
    pub message_id: Option<String>,

    /// The content of the message.
    #[serde(rename = "MessageText", skip_serializing_if = "Option::is_none")]
    pub message_text: Option<String>,

    /// An opaque value required to delete the message. If deletion fails using this
    /// PopReceipt then the message has been dequeued by another client.
    #[serde(rename = "PopReceipt", skip_serializing_if = "Option::is_none")]
    pub pop_receipt: Option<String>,

    /// The time that the message will again become visible in the queue.
    #[serde(
        default,
        rename = "TimeNextVisible",
        skip_serializing_if = "Option::is_none",
        with = "azure_core::time::rfc7231::option"
    )]
    pub time_next_visible: Option<OffsetDateTime>,
}

/// The response of receive messages.
#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)]
#[non_exhaustive]
#[serde(rename = "QueueMessagesList")]
pub struct ReceivedMessages {
    /// The list of received messages.
    #[serde(rename = "QueueMessage", skip_serializing_if = "Option::is_none")]
    pub items: Option<Vec<ReceivedMessage>>,
}

/// The retention policy.
#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)]
pub struct RetentionPolicy {
    /// The number of days to retain the logs.
    #[serde(rename = "Days", skip_serializing_if = "Option::is_none")]
    pub days: Option<i32>,

    /// Whether to enable the retention policy.
    #[serde(rename = "Enabled", skip_serializing_if = "Option::is_none")]
    pub enabled: Option<bool>,
}

/// The sent queue message.
#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)]
#[non_exhaustive]
#[serde(rename = "QueueMessage")]
pub struct SentMessageInternal {
    /// The time that the message will expire and be automatically deleted.
    #[serde(
        default,
        rename = "ExpirationTime",
        skip_serializing_if = "Option::is_none",
        with = "azure_core::time::rfc7231::option"
    )]
    pub expiration_time: Option<OffsetDateTime>,

    /// The time the message was inserted into the queue.
    #[serde(
        default,
        rename = "InsertionTime",
        skip_serializing_if = "Option::is_none",
        with = "azure_core::time::rfc7231::option"
    )]
    pub insertion_time: Option<OffsetDateTime>,

    /// The ID of the message.
    #[serde(rename = "MessageId", skip_serializing_if = "Option::is_none")]
    pub message_id: Option<String>,

    /// An opaque value required to delete the message. If deletion fails using this
    /// PopReceipt then the message has been dequeued by another client.
    #[serde(rename = "PopReceipt", skip_serializing_if = "Option::is_none")]
    pub pop_receipt: Option<String>,

    /// The time that the message will again become visible in the queue.
    #[serde(
        default,
        rename = "TimeNextVisible",
        skip_serializing_if = "Option::is_none",
        with = "azure_core::time::rfc7231::option"
    )]
    pub time_next_visible: Option<OffsetDateTime>,
}

/// The signed identifier.
#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)]
pub struct SignedIdentifier {
    /// The access policy for the signed identifier.
    #[serde(rename = "AccessPolicy", skip_serializing_if = "Option::is_none")]
    pub access_policy: Option<AccessPolicy>,

    /// The unique ID for the signed identifier.
    #[serde(rename = "Id", skip_serializing_if = "Option::is_none")]
    pub id: Option<String>,
}

/// An array of signed identifiers.
#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)]
#[serde(rename = "SignedIdentifiers")]
pub struct SignedIdentifiers {
    /// The list of signed identifiers.
    #[serde(rename = "SignedIdentifier", skip_serializing_if = "Option::is_none")]
    pub items: Option<Vec<SignedIdentifier>>,
}