quantrs2-device 0.2.0

Quantum device connectors for the QuantRS2 framework
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
553
554
555
556
557
//! Cloud Orchestration — Security Configuration
//!
//! Authentication, authorization, encryption, network-security, and compliance
//! configuration types for cloud orchestration.

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

/// Cloud security configuration
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct CloudSecurityConfig {
    /// Authentication configuration
    pub authentication: AuthenticationConfig,
    /// Authorization configuration
    pub authorization: AuthorizationConfig,
    /// Encryption configuration
    pub encryption: EncryptionConfig,
    /// Network security
    pub network_security: NetworkSecurityConfig,
    /// Compliance configuration
    pub compliance: ComplianceConfig,
}

/// Authentication configuration
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct AuthenticationConfig {
    /// Authentication methods
    pub methods: Vec<AuthMethod>,
    /// Multi-factor authentication
    pub mfa: MFAConfig,
    /// Single sign-on
    pub sso: SSOConfig,
}

/// Authentication methods
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub enum AuthMethod {
    Password,
    APIKey,
    Certificate,
    OAuth2,
    SAML,
    Custom(String),
}

/// MFA configuration
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct MFAConfig {
    /// Enable MFA
    pub enabled: bool,
    /// MFA methods
    pub methods: Vec<MFAMethod>,
    /// Backup codes
    pub backup_codes: bool,
}

/// MFA methods
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub enum MFAMethod {
    TOTP,
    SMS,
    Email,
    PushNotification,
    Hardware,
}

/// SSO configuration
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct SSOConfig {
    /// Enable SSO
    pub enabled: bool,
    /// SSO provider
    pub provider: SSOProvider,
    /// SAML configuration
    pub saml: SAMLConfig,
    /// OIDC configuration
    pub oidc: OIDCConfig,
}

/// SSO providers
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub enum SSOProvider {
    SAML,
    OIDC,
    LDAP,
    ActiveDirectory,
    Custom(String),
}

/// SAML configuration
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct SAMLConfig {
    /// Identity provider URL
    pub idp_url: String,
    /// Service provider ID
    pub sp_id: String,
    /// Certificate
    pub certificate: String,
}

/// OIDC configuration
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct OIDCConfig {
    /// Client ID
    pub client_id: String,
    /// Client secret
    pub client_secret: String,
    /// Discovery URL
    pub discovery_url: String,
}

/// Authorization configuration
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct AuthorizationConfig {
    /// Authorization model
    pub model: AuthorizationModel,
    /// Role definitions
    pub roles: Vec<RoleDefinition>,
    /// Permission system
    pub permissions: PermissionSystem,
}

/// Authorization models
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub enum AuthorizationModel {
    RBAC,
    ABAC,
    DAC,
    MAC,
    Custom(String),
}

/// Role definition
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct RoleDefinition {
    /// Role name
    pub name: String,
    /// Description
    pub description: String,
    /// Permissions
    pub permissions: Vec<String>,
    /// Role hierarchy
    pub parent_roles: Vec<String>,
}

/// Permission system
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct PermissionSystem {
    /// Permission model
    pub model: PermissionModel,
    /// Resource definitions
    pub resources: Vec<ResourceDefinition>,
    /// Action definitions
    pub actions: Vec<ActionDefinition>,
}

/// Permission models
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub enum PermissionModel {
    ResourceAction,
    CapabilityBased,
    AttributeBased,
    Custom(String),
}

/// Resource definition
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ResourceDefinition {
    /// Resource type
    pub resource_type: String,
    /// Resource attributes
    pub attributes: HashMap<String, String>,
    /// Access patterns
    pub access_patterns: Vec<AccessPattern>,
}

/// Access pattern
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct AccessPattern {
    /// Pattern name
    pub name: String,
    /// Allowed actions
    pub actions: Vec<String>,
    /// Conditions
    pub conditions: Vec<AccessCondition>,
}

/// Access condition
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct AccessCondition {
    /// Attribute
    pub attribute: String,
    /// Operator
    pub operator: String,
    /// Value
    pub value: String,
}

/// Action definition
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ActionDefinition {
    /// Action name
    pub name: String,
    /// Description
    pub description: String,
    /// Required permissions
    pub required_permissions: Vec<String>,
}

/// Encryption configuration
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct EncryptionConfig {
    /// Encryption at rest
    pub at_rest: EncryptionAtRestConfig,
    /// Encryption in transit
    pub in_transit: EncryptionInTransitConfig,
    /// Key management
    pub key_management: EncryptionKeyManagementConfig,
}

/// Encryption at rest configuration
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct EncryptionAtRestConfig {
    /// Enable encryption
    pub enabled: bool,
    /// Encryption algorithm
    pub algorithm: String,
    /// Key size
    pub key_size: usize,
}

/// Encryption in transit configuration
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct EncryptionInTransitConfig {
    /// Enable encryption
    pub enabled: bool,
    /// TLS version
    pub tls_version: String,
    /// Cipher suites
    pub cipher_suites: Vec<String>,
}

/// Encryption key management configuration
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct EncryptionKeyManagementConfig {
    /// Key management service
    pub service: KeyManagementService,
    /// Key rotation policy
    pub rotation_policy: EncryptionKeyRotationPolicy,
    /// Key backup policy
    pub backup_policy: EncryptionKeyBackupPolicy,
}

/// Key management services
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub enum KeyManagementService {
    AwsKms,
    AzureKeyVault,
    GoogleKms,
    HashiCorpVault,
    Custom(String),
}

/// Key rotation policy
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct EncryptionKeyRotationPolicy {
    /// Enable rotation
    pub enabled: bool,
    /// Rotation frequency
    pub frequency: Duration,
    /// Automatic rotation
    pub automatic: bool,
}

/// Key backup policy
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct EncryptionKeyBackupPolicy {
    /// Enable backup
    pub enabled: bool,
    /// Backup frequency
    pub frequency: Duration,
    /// Backup locations
    pub locations: Vec<String>,
}

/// Network security configuration
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct NetworkSecurityConfig {
    /// Firewall configuration
    pub firewall: FirewallConfig,
    /// VPN configuration
    pub vpn: VPNConfig,
    /// DDoS protection
    pub ddos_protection: DDoSProtectionConfig,
}

/// Firewall configuration
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct FirewallConfig {
    /// Enable firewall
    pub enabled: bool,
    /// Firewall rules
    pub rules: Vec<FirewallRule>,
    /// Default policy
    pub default_policy: FirewallPolicy,
}

/// Firewall rule
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct FirewallRule {
    /// Rule name
    pub name: String,
    /// Source
    pub source: String,
    /// Destination
    pub destination: String,
    /// Port
    pub port: String,
    /// Protocol
    pub protocol: String,
    /// Action
    pub action: FirewallAction,
}

/// Firewall policies
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub enum FirewallPolicy {
    Allow,
    Deny,
    Log,
}

/// Firewall actions
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub enum FirewallAction {
    Allow,
    Deny,
    Log,
}

/// VPN configuration
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct VPNConfig {
    /// Enable VPN
    pub enabled: bool,
    /// VPN type
    pub vpn_type: VPNType,
    /// Connection settings
    pub connection: VPNConnectionConfig,
}

/// VPN types
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub enum VPNType {
    SiteToSite,
    PointToSite,
    PointToPoint,
    Custom(String),
}

/// VPN connection configuration
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct VPNConnectionConfig {
    /// Gateway address
    pub gateway: String,
    /// Pre-shared key
    pub psk: String,
    /// Encryption
    pub encryption: String,
}

/// DDoS protection configuration
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct DDoSProtectionConfig {
    /// Enable protection
    pub enabled: bool,
    /// Protection level
    pub level: DDoSProtectionLevel,
    /// Rate limiting
    pub rate_limiting: RateLimitingConfig,
}

/// DDoS protection levels
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub enum DDoSProtectionLevel {
    Basic,
    Standard,
    Premium,
    Custom(String),
}

/// Rate limiting configuration
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct RateLimitingConfig {
    /// Enable rate limiting
    pub enabled: bool,
    /// Request limits
    pub limits: HashMap<String, usize>,
    /// Time windows
    pub windows: HashMap<String, Duration>,
}

/// Compliance configuration
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ComplianceConfig {
    /// Compliance frameworks
    pub frameworks: Vec<ComplianceFramework>,
    /// Audit configuration
    pub audit: AuditConfig,
    /// Data governance
    pub data_governance: DataGovernanceConfig,
}

/// Compliance frameworks
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub enum ComplianceFramework {
    SOC2,
    ISO27001,
    GDPR,
    HIPAA,
    PciDss,
    Custom(String),
}

/// Audit configuration
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct AuditConfig {
    /// Enable auditing
    pub enabled: bool,
    /// Audit events
    pub events: Vec<AuditEvent>,
    /// Log retention
    pub retention: Duration,
}

/// Audit events
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub enum AuditEvent {
    Authentication,
    Authorization,
    DataAccess,
    ConfigChange,
    SecurityEvent,
    Custom(String),
}

/// Data governance configuration
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct DataGovernanceConfig {
    /// Data classification
    pub classification: DataClassificationConfig,
    /// Data retention
    pub retention: DataRetentionConfig,
    /// Data privacy
    pub privacy: DataPrivacyConfig,
}

/// Data classification configuration
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct DataClassificationConfig {
    /// Classification levels
    pub levels: Vec<ClassificationLevel>,
    /// Auto-classification
    pub auto_classification: bool,
}

/// Classification level
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ClassificationLevel {
    /// Level name
    pub name: String,
    /// Sensitivity score
    pub sensitivity: u8,
    /// Handling requirements
    pub requirements: Vec<String>,
}

/// Data retention configuration
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct DataRetentionConfig {
    /// Retention policies
    pub policies: Vec<RetentionPolicy>,
    /// Default retention
    pub default_retention: Duration,
}

/// Retention policy
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct RetentionPolicy {
    /// Data type
    pub data_type: String,
    /// Retention period
    pub retention_period: Duration,
    /// Disposal method
    pub disposal_method: DisposalMethod,
}

/// Disposal methods
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub enum DisposalMethod {
    Delete,
    Archive,
    Anonymize,
    Custom(String),
}

/// Data privacy configuration
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct DataPrivacyConfig {
    /// Privacy controls
    pub controls: Vec<PrivacyControl>,
    /// Consent management
    pub consent: ConsentManagementConfig,
}

/// Privacy controls
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub enum PrivacyControl {
    Anonymization,
    Pseudonymization,
    DataMinimization,
    AccessControl,
    Custom(String),
}

/// Consent management configuration
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ConsentManagementConfig {
    /// Enable consent management
    pub enabled: bool,
    /// Consent types
    pub consent_types: Vec<String>,
    /// Withdrawal process
    pub withdrawal_process: WithdrawalProcess,
}

/// Withdrawal process
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct WithdrawalProcess {
    /// Methods available
    pub methods: Vec<WithdrawalMethod>,
    /// Processing time
    pub processing_time: Duration,
    /// Confirmation required
    pub confirmation_required: bool,
}

/// Withdrawal methods
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub enum WithdrawalMethod {
    Online,
    Email,
    Phone,
    Mail,
    Custom(String),
}