rust_az_wrapper 0.2.0

Type-safe Rust wrapper for Azure CLI focused on Cosmos DB operations
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
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
//! Data models for Azure resources focused on Cosmos DB

use serde::{Deserialize, Serialize};
use std::collections::HashMap;

/// Azure Subscription information
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Subscription {
    /// Subscription ID
    pub id: String,
    /// Subscription name
    #[serde(alias = "name")]
    pub display_name: String,
    /// Subscription state
    pub state: String,
    /// Tenant ID
    #[serde(alias = "tenantId")]
    pub tenant_id: String,
    /// Whether this is the default subscription
    #[serde(alias = "isDefault")]
    pub is_default: Option<bool>,
}

/// Resource Group information
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ResourceGroup {
    /// Resource group name
    pub name: String,
    /// Resource group ID
    pub id: String,
    /// Resource group location
    pub location: String,
    /// Associated tags
    pub tags: Option<HashMap<String, String>>,
    /// Provisioning state within properties
    pub properties: Option<ResourceGroupProperties>,
}

/// Resource Group properties
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ResourceGroupProperties {
    /// Provisioning state
    #[serde(alias = "provisioningState", alias = "provisioning_state")]
    pub provisioning_state: String,
}

/// Cosmos DB Account information
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct CosmosAccount {
    /// Account name
    pub name: String,
    /// Resource ID
    pub id: String,
    /// Account location
    pub location: String,
    /// Resource group
    #[serde(alias = "resourceGroup", alias = "resource_group")]
    pub resource_group: String,
    /// Resource type
    #[serde(rename = "type", alias = "resourceType", alias = "resource_type")]
    pub resource_type: String,
    /// Account type (SQL, MongoDB, etc.)
    pub kind: String,
    /// Provisioning status
    #[serde(alias = "provisioningState", alias = "provisioning_state")]
    pub provisioning_state: String,
    /// Endpoint URI
    #[serde(alias = "documentEndpoint", alias = "document_endpoint")]
    pub document_endpoint: String,
    /// Associated tags
    pub tags: Option<HashMap<String, String>>,
    
    // Cosmos DB specific fields directly at root level
    /// Backup policy
    #[serde(alias = "backupPolicy")]
    pub backup_policy: Option<BackupPolicy>,
    /// Analytical storage configuration
    #[serde(alias = "analyticalStorageConfiguration")]
    pub analytical_storage_configuration: Option<AnalyticalStorageConfiguration>,
    /// API properties
    #[serde(alias = "apiProperties")]
    pub api_properties: Option<ApiProperties>,
    /// Account capabilities
    pub capabilities: Option<Vec<Capability>>,
    /// Capacity configuration
    pub capacity: Option<CapacitySettings>,
    /// Consistency policy
    #[serde(alias = "consistencyPolicy")]
    pub consistency_policy: Option<ConsistencyPolicy>,
    /// CORS settings
    pub cors: Option<Vec<CorsPolicy>>,
    /// Creation mode
    #[serde(alias = "createMode")]
    pub create_mode: Option<String>,
    /// Customer managed key status
    #[serde(alias = "customerManagedKeyStatus")]
    pub customer_managed_key_status: Option<String>,
    /// Database account offer type
    #[serde(alias = "databaseAccountOfferType")]
    pub database_account_offer_type: Option<String>,
    /// Default identity
    #[serde(alias = "defaultIdentity")]
    pub default_identity: Option<String>,
    /// Whether key-based metadata write access is disabled
    #[serde(alias = "disableKeyBasedMetadataWriteAccess")]
    pub disable_key_based_metadata_write_access: Option<bool>,
    /// Whether local authentication is disabled
    #[serde(alias = "disableLocalAuth")]
    pub disable_local_auth: Option<bool>,
    /// Whether analytical storage is enabled
    #[serde(alias = "enableAnalyticalStorage")]
    pub enable_analytical_storage: Option<bool>,
    /// Whether automatic failover is enabled
    #[serde(alias = "enableAutomaticFailover")]
    pub enable_automatic_failover: Option<bool>,
    /// Whether burst capacity is enabled
    #[serde(alias = "enableBurstCapacity")]
    pub enable_burst_capacity: Option<bool>,
    /// Whether Cassandra connector is enabled
    #[serde(alias = "enableCassandraConnector")]
    pub enable_cassandra_connector: Option<bool>,
    /// Whether free tier is enabled
    #[serde(alias = "enableFreeTier")]
    pub enable_free_tier: Option<bool>,
    /// Whether multiple write locations are enabled
    #[serde(alias = "enableMultipleWriteLocations")]
    pub enable_multiple_write_locations: Option<bool>,
    /// Whether partition merge is enabled
    #[serde(alias = "enablePartitionMerge")]
    pub enable_partition_merge: Option<bool>,
    /// Whether per-region per-partition autoscale is enabled
    #[serde(alias = "enablePerRegionPerPartitionAutoscale")]
    pub enable_per_region_per_partition_autoscale: Option<bool>,
    /// Failover policies
    #[serde(alias = "failoverPolicies")]
    pub failover_policies: Option<Vec<FailoverPolicy>>,
    /// Identity configuration
    pub identity: Option<AccountIdentity>,
    /// Instance ID
    #[serde(alias = "instanceId")]
    pub instance_id: Option<String>,
    /// IP rules
    #[serde(alias = "ipRules")]
    pub ip_rules: Option<Vec<IpRule>>,
    /// Whether virtual network filter is enabled
    #[serde(alias = "isVirtualNetworkFilterEnabled")]
    pub is_virtual_network_filter_enabled: Option<bool>,
    /// Key Vault key URI
    #[serde(alias = "keyVaultKeyUri")]
    pub key_vault_key_uri: Option<String>,
    /// Keys metadata
    #[serde(alias = "keysMetadata")]
    pub keys_metadata: Option<KeysMetadata>,
    /// Account locations
    pub locations: Option<Vec<AccountLocation>>,
    /// Minimal TLS version
    #[serde(alias = "minimalTlsVersion")]
    pub minimal_tls_version: Option<String>,
    /// Network ACL bypass
    #[serde(alias = "networkAclBypass")]
    pub network_acl_bypass: Option<String>,
    /// Resource IDs for network ACL bypass
    #[serde(alias = "networkAclBypassResourceIds")]
    pub network_acl_bypass_resource_ids: Option<Vec<String>>,
    /// Private endpoint connections
    #[serde(alias = "privateEndpointConnections")]
    pub private_endpoint_connections: Option<Vec<PrivateEndpointConnection>>,
    /// Public network access
    #[serde(alias = "publicNetworkAccess")]
    pub public_network_access: Option<String>,
    /// Read locations
    #[serde(alias = "readLocations")]
    pub read_locations: Option<Vec<AccountLocation>>,
    /// Restore parameters
    #[serde(alias = "restoreParameters")]
    pub restore_parameters: Option<RestoreParameters>,
    /// System data
    #[serde(alias = "systemData")]
    pub system_data: Option<SystemData>,
    /// Virtual network rules
    #[serde(alias = "virtualNetworkRules")]
    pub virtual_network_rules: Option<Vec<VirtualNetworkRule>>,
    /// Write locations
    #[serde(alias = "writeLocations")]
    pub write_locations: Option<Vec<AccountLocation>>,
}

/// Analytical storage configuration
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct AnalyticalStorageConfiguration {
    /// Schema type
    pub schema_type: Option<String>,
}

/// API properties
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct ApiProperties {
    /// Server version (for MongoDB)
    pub server_version: Option<String>,
}

/// Account capability
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Capability {
    /// Capability name
    pub name: String,
}

/// Backup policy
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct BackupPolicy {
    /// Backup type
    #[serde(rename = "type")]
    pub backup_type: String,
    /// Migration state
    pub migration_state: Option<String>,
    /// Periodic mode properties
    pub periodic_mode_properties: Option<PeriodicBackupProperties>,
    /// Continuous mode properties
    pub continuous_mode_properties: Option<ContinuousBackupProperties>,
}

/// Periodic backup properties
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct PeriodicBackupProperties {
    /// Backup interval in minutes
    pub backup_interval_in_minutes: Option<i32>,
    /// Backup retention interval in hours
    pub backup_retention_interval_in_hours: Option<i32>,
    /// Backup storage redundancy
    pub backup_storage_redundancy: Option<String>,
}

/// Continuous backup properties
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct ContinuousBackupProperties {
    /// Continuous backup tier (e.g., Continuous7Days, Continuous30Days)
    pub tier: Option<String>,
}

/// Failover policy
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct FailoverPolicy {
    /// Failover priority
    pub failover_priority: i32,
    /// Location ID
    pub id: Option<String>,
    /// Location name
    pub location_name: String,
}

/// Account identity
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct AccountIdentity {
    /// Principal ID
    pub principal_id: Option<String>,
    /// Tenant ID
    pub tenant_id: Option<String>,
    /// Identity type
    #[serde(rename = "type")]
    pub identity_type: Option<String>,
    /// User assigned identities
    pub user_assigned_identities: Option<HashMap<String, serde_json::Value>>,
}

/// IP rule
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct IpRule {
    /// IP address or range
    pub ip_address_or_range: String,
}

/// Keys metadata
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct KeysMetadata {
    /// Primary master key
    pub primary_master_key: Option<KeyMetadata>,
    /// Primary readonly master key
    pub primary_readonly_master_key: Option<KeyMetadata>,
    /// Secondary master key
    pub secondary_master_key: Option<KeyMetadata>,
    /// Secondary readonly master key
    pub secondary_readonly_master_key: Option<KeyMetadata>,
}

/// Key metadata
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct KeyMetadata {
    /// Generation time
    pub generation_time: Option<String>,
}

/// Private endpoint connection
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct PrivateEndpointConnection {
    /// Connection ID
    pub id: Option<String>,
    /// Connection name
    pub name: Option<String>,
    /// Connection type
    #[serde(rename = "type")]
    pub connection_type: Option<String>,
    /// Group ID
    pub group_id: Option<String>,
    /// Private endpoint
    pub private_endpoint: Option<PrivateEndpoint>,
    /// Private link service connection state
    pub private_link_service_connection_state: Option<PrivateLinkServiceConnectionState>,
    /// Provisioning state
    pub provisioning_state: Option<String>,
    /// Resource group
    pub resource_group: Option<String>,
}

/// Private endpoint
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct PrivateEndpoint {
    /// Private endpoint ID
    pub id: String,
    /// Resource group
    pub resource_group: Option<String>,
}

/// Private link service connection state
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct PrivateLinkServiceConnectionState {
    /// Actions required
    pub actions_required: Option<String>,
    /// Description
    pub description: Option<String>,
    /// Status
    pub status: Option<String>,
}

/// Restore parameters
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct RestoreParameters {
    /// Restore mode
    pub restore_mode: Option<String>,
    /// Restore source
    pub restore_source: Option<String>,
    /// Restore timestamp in UTC
    pub restore_timestamp_in_utc: Option<String>,
}

/// System data
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct SystemData {
    /// Creation date
    pub created_at: Option<String>,
    /// Created by
    pub created_by: Option<String>,
    /// Created by type
    pub created_by_type: Option<String>,
    /// Last modification date
    pub last_modified_at: Option<String>,
    /// Last modified by
    pub last_modified_by: Option<String>,
    /// Last modified by type
    pub last_modified_by_type: Option<String>,
}

/// Virtual network rule
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct VirtualNetworkRule {
    /// Virtual network ID
    pub id: String,
    /// Whether to ignore missing VNet service endpoint
    pub ignore_missing_vnet_service_endpoint: Option<bool>,
    /// Resource group
    pub resource_group: Option<String>,
}

/// Capacity settings
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct CapacitySettings {
    /// Total provisioned throughput limit
    pub total_throughput_limit: Option<i32>,
}

/// Consistency policy
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct ConsistencyPolicy {
    /// Default consistency level
    pub default_consistency_level: String,
    /// Maximum tolerated staleness
    pub max_staleness_prefix: Option<i64>,
    /// Maximum staleness interval
    pub max_interval_in_seconds: Option<i32>,
}

/// CORS policy
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct CorsPolicy {
    /// Allowed origins
    pub allowed_origins: String,
    /// Allowed methods
    pub allowed_methods: String,
    /// Allowed headers
    pub allowed_headers: String,
    /// Exposed headers
    pub exposed_headers: String,
    /// Maximum age
    pub max_age_in_seconds: Option<i32>,
}

/// Account location
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct AccountLocation {
    /// Location name
    pub location_name: String,
    /// Provisioning status
    pub provisioning_state: String,
    /// Failover status
    pub failover_priority: i32,
    /// Whether it's a write region
    pub is_zone_redundant: Option<bool>,
    /// Location ID
    pub id: Option<String>,
    /// Document endpoint URI
    pub document_endpoint: Option<String>,
}

/// Cosmos DB Database information
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct CosmosDatabase {
    /// Database name
    pub name: String,
    /// Database ID
    pub id: String,
    /// Throughput settings
    pub throughput_settings: Option<ThroughputSettings>,
}

/// Throughput settings
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct ThroughputSettings {
    /// Manual throughput
    pub throughput: Option<i32>,
    /// Autoscale settings
    pub autoscale_settings: Option<AutoscaleSettings>,
}

/// Autoscale settings
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct AutoscaleSettings {
    /// Maximum throughput
    pub max_throughput: i32,
}

/// Cosmos DB Container information
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct CosmosContainer {
    /// Container name
    pub name: String,
    /// Container ID
    pub id: String,
    /// Partition key
    pub partition_key: Option<PartitionKey>,
    /// Throughput settings
    pub throughput_settings: Option<ThroughputSettings>,
    /// Indexing policy
    pub indexing_policy: Option<IndexingPolicy>,
}

/// Partition key
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct PartitionKey {
    /// Partition key paths
    pub paths: Vec<String>,
    /// Partition key type
    pub kind: String,
}

/// Indexing policy
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct IndexingPolicy {
    /// Whether automatic indexing is enabled
    pub automatic: Option<bool>,
    /// Indexing mode
    pub indexing_mode: Option<String>,
    /// Included paths
    pub included_paths: Option<Vec<IndexPath>>,
    /// Excluded paths
    pub excluded_paths: Option<Vec<IndexPath>>,
}

/// Index path
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct IndexPath {
    /// Path
    pub path: String,
}

/// Cosmos Account access keys
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct CosmosKeys {
    /// Primary master key
    pub primary_master_key: String,
    /// Secondary master key
    pub secondary_master_key: String,
    /// Primary readonly master key
    pub primary_readonly_master_key: String,
    /// Secondary readonly master key
    pub secondary_readonly_master_key: String,
}

/// Cosmos Account connection strings
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct CosmosConnectionStrings {
    /// Connection strings
    pub connection_strings: Vec<ConnectionString>,
}

/// Individual connection string
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct ConnectionString {
    /// Connection description
    pub description: String,
    /// Connection string
    pub connection_string: String,
}