rustack-kms-model 0.6.0

KMS model types for Rustack (auto-generated from Smithy)
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
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
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
//! Auto-generated from AWS KMS Smithy model. DO NOT EDIT.

use std::collections::HashMap;

use serde::{Deserialize, Serialize};

/// KMS CustomerMasterKeySpec enum.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Default, Serialize, Deserialize)]
pub enum CustomerMasterKeySpec {
    /// Default variant.
    #[default]
    #[serde(rename = "ECC_NIST_P256")]
    EccNistP256,
    #[serde(rename = "ECC_NIST_P384")]
    EccNistP384,
    #[serde(rename = "ECC_NIST_P521")]
    EccNistP521,
    #[serde(rename = "ECC_SECG_P256K1")]
    EccSecgP256k1,
    #[serde(rename = "HMAC_224")]
    Hmac224,
    #[serde(rename = "HMAC_256")]
    Hmac256,
    #[serde(rename = "HMAC_384")]
    Hmac384,
    #[serde(rename = "HMAC_512")]
    Hmac512,
    #[serde(rename = "RSA_2048")]
    Rsa2048,
    #[serde(rename = "RSA_3072")]
    Rsa3072,
    #[serde(rename = "RSA_4096")]
    Rsa4096,
    #[serde(rename = "SM2")]
    Sm2,
    #[serde(rename = "SYMMETRIC_DEFAULT")]
    SymmetricDefault,
}

impl CustomerMasterKeySpec {
    /// Returns the string value of this enum variant.
    #[must_use]
    pub fn as_str(&self) -> &'static str {
        match self {
            Self::EccNistP256 => "ECC_NIST_P256",
            Self::EccNistP384 => "ECC_NIST_P384",
            Self::EccNistP521 => "ECC_NIST_P521",
            Self::EccSecgP256k1 => "ECC_SECG_P256K1",
            Self::Hmac224 => "HMAC_224",
            Self::Hmac256 => "HMAC_256",
            Self::Hmac384 => "HMAC_384",
            Self::Hmac512 => "HMAC_512",
            Self::Rsa2048 => "RSA_2048",
            Self::Rsa3072 => "RSA_3072",
            Self::Rsa4096 => "RSA_4096",
            Self::Sm2 => "SM2",
            Self::SymmetricDefault => "SYMMETRIC_DEFAULT",
        }
    }
}

impl std::fmt::Display for CustomerMasterKeySpec {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(self.as_str())
    }
}

impl From<&str> for CustomerMasterKeySpec {
    fn from(s: &str) -> Self {
        match s {
            "ECC_NIST_P256" => Self::EccNistP256,
            "ECC_NIST_P384" => Self::EccNistP384,
            "ECC_NIST_P521" => Self::EccNistP521,
            "ECC_SECG_P256K1" => Self::EccSecgP256k1,
            "HMAC_224" => Self::Hmac224,
            "HMAC_256" => Self::Hmac256,
            "HMAC_384" => Self::Hmac384,
            "HMAC_512" => Self::Hmac512,
            "RSA_2048" => Self::Rsa2048,
            "RSA_3072" => Self::Rsa3072,
            "RSA_4096" => Self::Rsa4096,
            "SM2" => Self::Sm2,
            "SYMMETRIC_DEFAULT" => Self::SymmetricDefault,
            _ => Self::default(),
        }
    }
}

/// KMS DataKeyPairSpec enum.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Default, Serialize, Deserialize)]
pub enum DataKeyPairSpec {
    /// Default variant.
    #[default]
    #[serde(rename = "ECC_NIST_EDWARDS25519")]
    EccNistEdwards25519,
    #[serde(rename = "ECC_NIST_P256")]
    EccNistP256,
    #[serde(rename = "ECC_NIST_P384")]
    EccNistP384,
    #[serde(rename = "ECC_NIST_P521")]
    EccNistP521,
    #[serde(rename = "ECC_SECG_P256K1")]
    EccSecgP256k1,
    #[serde(rename = "RSA_2048")]
    Rsa2048,
    #[serde(rename = "RSA_3072")]
    Rsa3072,
    #[serde(rename = "RSA_4096")]
    Rsa4096,
    #[serde(rename = "SM2")]
    Sm2,
}

impl DataKeyPairSpec {
    /// Returns the string value of this enum variant.
    #[must_use]
    pub fn as_str(&self) -> &'static str {
        match self {
            Self::EccNistEdwards25519 => "ECC_NIST_EDWARDS25519",
            Self::EccNistP256 => "ECC_NIST_P256",
            Self::EccNistP384 => "ECC_NIST_P384",
            Self::EccNistP521 => "ECC_NIST_P521",
            Self::EccSecgP256k1 => "ECC_SECG_P256K1",
            Self::Rsa2048 => "RSA_2048",
            Self::Rsa3072 => "RSA_3072",
            Self::Rsa4096 => "RSA_4096",
            Self::Sm2 => "SM2",
        }
    }
}

impl std::fmt::Display for DataKeyPairSpec {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(self.as_str())
    }
}

impl From<&str> for DataKeyPairSpec {
    fn from(s: &str) -> Self {
        match s {
            "ECC_NIST_EDWARDS25519" => Self::EccNistEdwards25519,
            "ECC_NIST_P256" => Self::EccNistP256,
            "ECC_NIST_P384" => Self::EccNistP384,
            "ECC_NIST_P521" => Self::EccNistP521,
            "ECC_SECG_P256K1" => Self::EccSecgP256k1,
            "RSA_2048" => Self::Rsa2048,
            "RSA_3072" => Self::Rsa3072,
            "RSA_4096" => Self::Rsa4096,
            "SM2" => Self::Sm2,
            _ => Self::default(),
        }
    }
}

/// KMS DataKeySpec enum.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Default, Serialize, Deserialize)]
pub enum DataKeySpec {
    /// Default variant.
    #[default]
    #[serde(rename = "AES_128")]
    Aes128,
    #[serde(rename = "AES_256")]
    Aes256,
}

impl DataKeySpec {
    /// Returns the string value of this enum variant.
    #[must_use]
    pub fn as_str(&self) -> &'static str {
        match self {
            Self::Aes128 => "AES_128",
            Self::Aes256 => "AES_256",
        }
    }
}

impl std::fmt::Display for DataKeySpec {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(self.as_str())
    }
}

impl From<&str> for DataKeySpec {
    fn from(s: &str) -> Self {
        match s {
            "AES_128" => Self::Aes128,
            "AES_256" => Self::Aes256,
            _ => Self::default(),
        }
    }
}

/// KMS DryRunModifierType enum.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Default, Serialize, Deserialize)]
pub enum DryRunModifierType {
    /// Default variant.
    #[default]
    #[serde(rename = "IGNORE_CIPHERTEXT")]
    IgnoreCiphertext,
}

impl DryRunModifierType {
    /// Returns the string value of this enum variant.
    #[must_use]
    pub fn as_str(&self) -> &'static str {
        match self {
            Self::IgnoreCiphertext => "IGNORE_CIPHERTEXT",
        }
    }
}

impl std::fmt::Display for DryRunModifierType {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(self.as_str())
    }
}

impl From<&str> for DryRunModifierType {
    fn from(s: &str) -> Self {
        match s {
            "IGNORE_CIPHERTEXT" => Self::IgnoreCiphertext,
            _ => Self::default(),
        }
    }
}

/// KMS EncryptionAlgorithmSpec enum.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Default, Serialize, Deserialize)]
pub enum EncryptionAlgorithmSpec {
    /// Default variant.
    #[default]
    #[serde(rename = "RSAES_OAEP_SHA_1")]
    RsaesOaepSha1,
    #[serde(rename = "RSAES_OAEP_SHA_256")]
    RsaesOaepSha256,
    #[serde(rename = "SM2PKE")]
    Sm2pke,
    #[serde(rename = "SYMMETRIC_DEFAULT")]
    SymmetricDefault,
}

impl EncryptionAlgorithmSpec {
    /// Returns the string value of this enum variant.
    #[must_use]
    pub fn as_str(&self) -> &'static str {
        match self {
            Self::RsaesOaepSha1 => "RSAES_OAEP_SHA_1",
            Self::RsaesOaepSha256 => "RSAES_OAEP_SHA_256",
            Self::Sm2pke => "SM2PKE",
            Self::SymmetricDefault => "SYMMETRIC_DEFAULT",
        }
    }
}

impl std::fmt::Display for EncryptionAlgorithmSpec {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(self.as_str())
    }
}

impl From<&str> for EncryptionAlgorithmSpec {
    fn from(s: &str) -> Self {
        match s {
            "RSAES_OAEP_SHA_1" => Self::RsaesOaepSha1,
            "RSAES_OAEP_SHA_256" => Self::RsaesOaepSha256,
            "SM2PKE" => Self::Sm2pke,
            "SYMMETRIC_DEFAULT" => Self::SymmetricDefault,
            _ => Self::default(),
        }
    }
}

/// KMS ExpirationModelType enum.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Default, Serialize, Deserialize)]
pub enum ExpirationModelType {
    /// Default variant.
    #[default]
    #[serde(rename = "KEY_MATERIAL_DOES_NOT_EXPIRE")]
    KeyMaterialDoesNotExpire,
    #[serde(rename = "KEY_MATERIAL_EXPIRES")]
    KeyMaterialExpires,
}

impl ExpirationModelType {
    /// Returns the string value of this enum variant.
    #[must_use]
    pub fn as_str(&self) -> &'static str {
        match self {
            Self::KeyMaterialDoesNotExpire => "KEY_MATERIAL_DOES_NOT_EXPIRE",
            Self::KeyMaterialExpires => "KEY_MATERIAL_EXPIRES",
        }
    }
}

impl std::fmt::Display for ExpirationModelType {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(self.as_str())
    }
}

impl From<&str> for ExpirationModelType {
    fn from(s: &str) -> Self {
        match s {
            "KEY_MATERIAL_DOES_NOT_EXPIRE" => Self::KeyMaterialDoesNotExpire,
            "KEY_MATERIAL_EXPIRES" => Self::KeyMaterialExpires,
            _ => Self::default(),
        }
    }
}

/// KMS GrantOperation enum.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Default, Serialize, Deserialize)]
pub enum GrantOperation {
    /// Default variant.
    #[default]
    CreateGrant,
    Decrypt,
    DeriveSharedSecret,
    DescribeKey,
    Encrypt,
    GenerateDataKey,
    GenerateDataKeyPair,
    GenerateDataKeyPairWithoutPlaintext,
    GenerateDataKeyWithoutPlaintext,
    GenerateMac,
    GetPublicKey,
    ReEncryptFrom,
    ReEncryptTo,
    RetireGrant,
    Sign,
    Verify,
    VerifyMac,
}

impl GrantOperation {
    /// Returns the string value of this enum variant.
    #[must_use]
    pub fn as_str(&self) -> &'static str {
        match self {
            Self::CreateGrant => "CreateGrant",
            Self::Decrypt => "Decrypt",
            Self::DeriveSharedSecret => "DeriveSharedSecret",
            Self::DescribeKey => "DescribeKey",
            Self::Encrypt => "Encrypt",
            Self::GenerateDataKey => "GenerateDataKey",
            Self::GenerateDataKeyPair => "GenerateDataKeyPair",
            Self::GenerateDataKeyPairWithoutPlaintext => "GenerateDataKeyPairWithoutPlaintext",
            Self::GenerateDataKeyWithoutPlaintext => "GenerateDataKeyWithoutPlaintext",
            Self::GenerateMac => "GenerateMac",
            Self::GetPublicKey => "GetPublicKey",
            Self::ReEncryptFrom => "ReEncryptFrom",
            Self::ReEncryptTo => "ReEncryptTo",
            Self::RetireGrant => "RetireGrant",
            Self::Sign => "Sign",
            Self::Verify => "Verify",
            Self::VerifyMac => "VerifyMac",
        }
    }
}

impl std::fmt::Display for GrantOperation {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(self.as_str())
    }
}

impl From<&str> for GrantOperation {
    fn from(s: &str) -> Self {
        match s {
            "CreateGrant" => Self::CreateGrant,
            "Decrypt" => Self::Decrypt,
            "DeriveSharedSecret" => Self::DeriveSharedSecret,
            "DescribeKey" => Self::DescribeKey,
            "Encrypt" => Self::Encrypt,
            "GenerateDataKey" => Self::GenerateDataKey,
            "GenerateDataKeyPair" => Self::GenerateDataKeyPair,
            "GenerateDataKeyPairWithoutPlaintext" => Self::GenerateDataKeyPairWithoutPlaintext,
            "GenerateDataKeyWithoutPlaintext" => Self::GenerateDataKeyWithoutPlaintext,
            "GenerateMac" => Self::GenerateMac,
            "GetPublicKey" => Self::GetPublicKey,
            "ReEncryptFrom" => Self::ReEncryptFrom,
            "ReEncryptTo" => Self::ReEncryptTo,
            "RetireGrant" => Self::RetireGrant,
            "Sign" => Self::Sign,
            "Verify" => Self::Verify,
            "VerifyMac" => Self::VerifyMac,
            _ => Self::default(),
        }
    }
}

/// KMS KeyAgreementAlgorithmSpec enum.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Default, Serialize, Deserialize)]
pub enum KeyAgreementAlgorithmSpec {
    /// Default variant.
    #[default]
    #[serde(rename = "ECDH")]
    Ecdh,
}

impl KeyAgreementAlgorithmSpec {
    /// Returns the string value of this enum variant.
    #[must_use]
    pub fn as_str(&self) -> &'static str {
        match self {
            Self::Ecdh => "ECDH",
        }
    }
}

impl std::fmt::Display for KeyAgreementAlgorithmSpec {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(self.as_str())
    }
}

impl From<&str> for KeyAgreementAlgorithmSpec {
    fn from(s: &str) -> Self {
        match s {
            "ECDH" => Self::Ecdh,
            _ => Self::default(),
        }
    }
}

/// KMS KeyEncryptionMechanism enum.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Default, Serialize, Deserialize)]
pub enum KeyEncryptionMechanism {
    /// Default variant.
    #[default]
    #[serde(rename = "RSAES_OAEP_SHA_256")]
    RsaesOaepSha256,
}

impl KeyEncryptionMechanism {
    /// Returns the string value of this enum variant.
    #[must_use]
    pub fn as_str(&self) -> &'static str {
        match self {
            Self::RsaesOaepSha256 => "RSAES_OAEP_SHA_256",
        }
    }
}

impl std::fmt::Display for KeyEncryptionMechanism {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(self.as_str())
    }
}

impl From<&str> for KeyEncryptionMechanism {
    fn from(s: &str) -> Self {
        match s {
            "RSAES_OAEP_SHA_256" => Self::RsaesOaepSha256,
            _ => Self::default(),
        }
    }
}

/// KMS KeyManagerType enum.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Default, Serialize, Deserialize)]
pub enum KeyManagerType {
    /// Default variant.
    #[default]
    #[serde(rename = "AWS")]
    Aws,
    #[serde(rename = "CUSTOMER")]
    Customer,
}

impl KeyManagerType {
    /// Returns the string value of this enum variant.
    #[must_use]
    pub fn as_str(&self) -> &'static str {
        match self {
            Self::Aws => "AWS",
            Self::Customer => "CUSTOMER",
        }
    }
}

impl std::fmt::Display for KeyManagerType {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(self.as_str())
    }
}

impl From<&str> for KeyManagerType {
    fn from(s: &str) -> Self {
        match s {
            "AWS" => Self::Aws,
            "CUSTOMER" => Self::Customer,
            _ => Self::default(),
        }
    }
}

/// KMS KeySpec enum.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Default, Serialize, Deserialize)]
pub enum KeySpec {
    /// Default variant.
    #[default]
    #[serde(rename = "ECC_NIST_EDWARDS25519")]
    EccNistEdwards25519,
    #[serde(rename = "ECC_NIST_P256")]
    EccNistP256,
    #[serde(rename = "ECC_NIST_P384")]
    EccNistP384,
    #[serde(rename = "ECC_NIST_P521")]
    EccNistP521,
    #[serde(rename = "ECC_SECG_P256K1")]
    EccSecgP256k1,
    #[serde(rename = "HMAC_224")]
    Hmac224,
    #[serde(rename = "HMAC_256")]
    Hmac256,
    #[serde(rename = "HMAC_384")]
    Hmac384,
    #[serde(rename = "HMAC_512")]
    Hmac512,
    #[serde(rename = "ML_DSA_44")]
    MlDsa44,
    #[serde(rename = "ML_DSA_65")]
    MlDsa65,
    #[serde(rename = "ML_DSA_87")]
    MlDsa87,
    #[serde(rename = "RSA_2048")]
    Rsa2048,
    #[serde(rename = "RSA_3072")]
    Rsa3072,
    #[serde(rename = "RSA_4096")]
    Rsa4096,
    #[serde(rename = "SM2")]
    Sm2,
    #[serde(rename = "SYMMETRIC_DEFAULT")]
    SymmetricDefault,
}

impl KeySpec {
    /// Returns the string value of this enum variant.
    #[must_use]
    pub fn as_str(&self) -> &'static str {
        match self {
            Self::EccNistEdwards25519 => "ECC_NIST_EDWARDS25519",
            Self::EccNistP256 => "ECC_NIST_P256",
            Self::EccNistP384 => "ECC_NIST_P384",
            Self::EccNistP521 => "ECC_NIST_P521",
            Self::EccSecgP256k1 => "ECC_SECG_P256K1",
            Self::Hmac224 => "HMAC_224",
            Self::Hmac256 => "HMAC_256",
            Self::Hmac384 => "HMAC_384",
            Self::Hmac512 => "HMAC_512",
            Self::MlDsa44 => "ML_DSA_44",
            Self::MlDsa65 => "ML_DSA_65",
            Self::MlDsa87 => "ML_DSA_87",
            Self::Rsa2048 => "RSA_2048",
            Self::Rsa3072 => "RSA_3072",
            Self::Rsa4096 => "RSA_4096",
            Self::Sm2 => "SM2",
            Self::SymmetricDefault => "SYMMETRIC_DEFAULT",
        }
    }
}

impl std::fmt::Display for KeySpec {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(self.as_str())
    }
}

impl From<&str> for KeySpec {
    fn from(s: &str) -> Self {
        match s {
            "ECC_NIST_EDWARDS25519" => Self::EccNistEdwards25519,
            "ECC_NIST_P256" => Self::EccNistP256,
            "ECC_NIST_P384" => Self::EccNistP384,
            "ECC_NIST_P521" => Self::EccNistP521,
            "ECC_SECG_P256K1" => Self::EccSecgP256k1,
            "HMAC_224" => Self::Hmac224,
            "HMAC_256" => Self::Hmac256,
            "HMAC_384" => Self::Hmac384,
            "HMAC_512" => Self::Hmac512,
            "ML_DSA_44" => Self::MlDsa44,
            "ML_DSA_65" => Self::MlDsa65,
            "ML_DSA_87" => Self::MlDsa87,
            "RSA_2048" => Self::Rsa2048,
            "RSA_3072" => Self::Rsa3072,
            "RSA_4096" => Self::Rsa4096,
            "SM2" => Self::Sm2,
            "SYMMETRIC_DEFAULT" => Self::SymmetricDefault,
            _ => Self::default(),
        }
    }
}

/// KMS KeyState enum.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Default, Serialize, Deserialize)]
pub enum KeyState {
    /// Default variant.
    #[default]
    Creating,
    Disabled,
    Enabled,
    PendingDeletion,
    PendingImport,
    PendingReplicaDeletion,
    Unavailable,
    Updating,
}

impl KeyState {
    /// Returns the string value of this enum variant.
    #[must_use]
    pub fn as_str(&self) -> &'static str {
        match self {
            Self::Creating => "Creating",
            Self::Disabled => "Disabled",
            Self::Enabled => "Enabled",
            Self::PendingDeletion => "PendingDeletion",
            Self::PendingImport => "PendingImport",
            Self::PendingReplicaDeletion => "PendingReplicaDeletion",
            Self::Unavailable => "Unavailable",
            Self::Updating => "Updating",
        }
    }
}

impl std::fmt::Display for KeyState {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(self.as_str())
    }
}

impl From<&str> for KeyState {
    fn from(s: &str) -> Self {
        match s {
            "Creating" => Self::Creating,
            "Disabled" => Self::Disabled,
            "Enabled" => Self::Enabled,
            "PendingDeletion" => Self::PendingDeletion,
            "PendingImport" => Self::PendingImport,
            "PendingReplicaDeletion" => Self::PendingReplicaDeletion,
            "Unavailable" => Self::Unavailable,
            "Updating" => Self::Updating,
            _ => Self::default(),
        }
    }
}

/// KMS KeyUsageType enum.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Default, Serialize, Deserialize)]
pub enum KeyUsageType {
    /// Default variant.
    #[default]
    #[serde(rename = "ENCRYPT_DECRYPT")]
    EncryptDecrypt,
    #[serde(rename = "GENERATE_VERIFY_MAC")]
    GenerateVerifyMac,
    #[serde(rename = "KEY_AGREEMENT")]
    KeyAgreement,
    #[serde(rename = "SIGN_VERIFY")]
    SignVerify,
}

impl KeyUsageType {
    /// Returns the string value of this enum variant.
    #[must_use]
    pub fn as_str(&self) -> &'static str {
        match self {
            Self::EncryptDecrypt => "ENCRYPT_DECRYPT",
            Self::GenerateVerifyMac => "GENERATE_VERIFY_MAC",
            Self::KeyAgreement => "KEY_AGREEMENT",
            Self::SignVerify => "SIGN_VERIFY",
        }
    }
}

impl std::fmt::Display for KeyUsageType {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(self.as_str())
    }
}

impl From<&str> for KeyUsageType {
    fn from(s: &str) -> Self {
        match s {
            "ENCRYPT_DECRYPT" => Self::EncryptDecrypt,
            "GENERATE_VERIFY_MAC" => Self::GenerateVerifyMac,
            "KEY_AGREEMENT" => Self::KeyAgreement,
            "SIGN_VERIFY" => Self::SignVerify,
            _ => Self::default(),
        }
    }
}

/// KMS MacAlgorithmSpec enum.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Default, Serialize, Deserialize)]
pub enum MacAlgorithmSpec {
    /// Default variant.
    #[default]
    #[serde(rename = "HMAC_SHA_224")]
    HmacSha224,
    #[serde(rename = "HMAC_SHA_256")]
    HmacSha256,
    #[serde(rename = "HMAC_SHA_384")]
    HmacSha384,
    #[serde(rename = "HMAC_SHA_512")]
    HmacSha512,
}

impl MacAlgorithmSpec {
    /// Returns the string value of this enum variant.
    #[must_use]
    pub fn as_str(&self) -> &'static str {
        match self {
            Self::HmacSha224 => "HMAC_SHA_224",
            Self::HmacSha256 => "HMAC_SHA_256",
            Self::HmacSha384 => "HMAC_SHA_384",
            Self::HmacSha512 => "HMAC_SHA_512",
        }
    }
}

impl std::fmt::Display for MacAlgorithmSpec {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(self.as_str())
    }
}

impl From<&str> for MacAlgorithmSpec {
    fn from(s: &str) -> Self {
        match s {
            "HMAC_SHA_224" => Self::HmacSha224,
            "HMAC_SHA_256" => Self::HmacSha256,
            "HMAC_SHA_384" => Self::HmacSha384,
            "HMAC_SHA_512" => Self::HmacSha512,
            _ => Self::default(),
        }
    }
}

/// KMS MessageType enum.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Default, Serialize, Deserialize)]
pub enum MessageType {
    /// Default variant.
    #[default]
    #[serde(rename = "DIGEST")]
    Digest,
    #[serde(rename = "EXTERNAL_MU")]
    ExternalMu,
    #[serde(rename = "RAW")]
    Raw,
}

impl MessageType {
    /// Returns the string value of this enum variant.
    #[must_use]
    pub fn as_str(&self) -> &'static str {
        match self {
            Self::Digest => "DIGEST",
            Self::ExternalMu => "EXTERNAL_MU",
            Self::Raw => "RAW",
        }
    }
}

impl std::fmt::Display for MessageType {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(self.as_str())
    }
}

impl From<&str> for MessageType {
    fn from(s: &str) -> Self {
        match s {
            "DIGEST" => Self::Digest,
            "EXTERNAL_MU" => Self::ExternalMu,
            "RAW" => Self::Raw,
            _ => Self::default(),
        }
    }
}

/// KMS MultiRegionKeyType enum.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Default, Serialize, Deserialize)]
pub enum MultiRegionKeyType {
    /// Default variant.
    #[default]
    #[serde(rename = "PRIMARY")]
    Primary,
    #[serde(rename = "REPLICA")]
    Replica,
}

impl MultiRegionKeyType {
    /// Returns the string value of this enum variant.
    #[must_use]
    pub fn as_str(&self) -> &'static str {
        match self {
            Self::Primary => "PRIMARY",
            Self::Replica => "REPLICA",
        }
    }
}

impl std::fmt::Display for MultiRegionKeyType {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(self.as_str())
    }
}

impl From<&str> for MultiRegionKeyType {
    fn from(s: &str) -> Self {
        match s {
            "PRIMARY" => Self::Primary,
            "REPLICA" => Self::Replica,
            _ => Self::default(),
        }
    }
}

/// KMS OriginType enum.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Default, Serialize, Deserialize)]
pub enum OriginType {
    /// Default variant.
    #[default]
    #[serde(rename = "AWS_CLOUDHSM")]
    AwsCloudhsm,
    #[serde(rename = "AWS_KMS")]
    AwsKms,
    #[serde(rename = "EXTERNAL")]
    External,
    #[serde(rename = "EXTERNAL_KEY_STORE")]
    ExternalKeyStore,
}

impl OriginType {
    /// Returns the string value of this enum variant.
    #[must_use]
    pub fn as_str(&self) -> &'static str {
        match self {
            Self::AwsCloudhsm => "AWS_CLOUDHSM",
            Self::AwsKms => "AWS_KMS",
            Self::External => "EXTERNAL",
            Self::ExternalKeyStore => "EXTERNAL_KEY_STORE",
        }
    }
}

impl std::fmt::Display for OriginType {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(self.as_str())
    }
}

impl From<&str> for OriginType {
    fn from(s: &str) -> Self {
        match s {
            "AWS_CLOUDHSM" => Self::AwsCloudhsm,
            "AWS_KMS" => Self::AwsKms,
            "EXTERNAL" => Self::External,
            "EXTERNAL_KEY_STORE" => Self::ExternalKeyStore,
            _ => Self::default(),
        }
    }
}

/// KMS SigningAlgorithmSpec enum.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Default, Serialize, Deserialize)]
pub enum SigningAlgorithmSpec {
    /// Default variant.
    #[default]
    #[serde(rename = "ECDSA_SHA_256")]
    EcdsaSha256,
    #[serde(rename = "ECDSA_SHA_384")]
    EcdsaSha384,
    #[serde(rename = "ECDSA_SHA_512")]
    EcdsaSha512,
    #[serde(rename = "ED25519_PH_SHA_512")]
    Ed25519PhSha512,
    #[serde(rename = "ED25519_SHA_512")]
    Ed25519Sha512,
    #[serde(rename = "ML_DSA_SHAKE_256")]
    MlDsaShake256,
    #[serde(rename = "RSASSA_PKCS1_V1_5_SHA_256")]
    RsassaPkcs1V15Sha256,
    #[serde(rename = "RSASSA_PKCS1_V1_5_SHA_384")]
    RsassaPkcs1V15Sha384,
    #[serde(rename = "RSASSA_PKCS1_V1_5_SHA_512")]
    RsassaPkcs1V15Sha512,
    #[serde(rename = "RSASSA_PSS_SHA_256")]
    RsassaPssSha256,
    #[serde(rename = "RSASSA_PSS_SHA_384")]
    RsassaPssSha384,
    #[serde(rename = "RSASSA_PSS_SHA_512")]
    RsassaPssSha512,
    #[serde(rename = "SM2DSA")]
    Sm2dsa,
}

impl SigningAlgorithmSpec {
    /// Returns the string value of this enum variant.
    #[must_use]
    pub fn as_str(&self) -> &'static str {
        match self {
            Self::EcdsaSha256 => "ECDSA_SHA_256",
            Self::EcdsaSha384 => "ECDSA_SHA_384",
            Self::EcdsaSha512 => "ECDSA_SHA_512",
            Self::Ed25519PhSha512 => "ED25519_PH_SHA_512",
            Self::Ed25519Sha512 => "ED25519_SHA_512",
            Self::MlDsaShake256 => "ML_DSA_SHAKE_256",
            Self::RsassaPkcs1V15Sha256 => "RSASSA_PKCS1_V1_5_SHA_256",
            Self::RsassaPkcs1V15Sha384 => "RSASSA_PKCS1_V1_5_SHA_384",
            Self::RsassaPkcs1V15Sha512 => "RSASSA_PKCS1_V1_5_SHA_512",
            Self::RsassaPssSha256 => "RSASSA_PSS_SHA_256",
            Self::RsassaPssSha384 => "RSASSA_PSS_SHA_384",
            Self::RsassaPssSha512 => "RSASSA_PSS_SHA_512",
            Self::Sm2dsa => "SM2DSA",
        }
    }
}

impl std::fmt::Display for SigningAlgorithmSpec {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(self.as_str())
    }
}

impl From<&str> for SigningAlgorithmSpec {
    fn from(s: &str) -> Self {
        match s {
            "ECDSA_SHA_256" => Self::EcdsaSha256,
            "ECDSA_SHA_384" => Self::EcdsaSha384,
            "ECDSA_SHA_512" => Self::EcdsaSha512,
            "ED25519_PH_SHA_512" => Self::Ed25519PhSha512,
            "ED25519_SHA_512" => Self::Ed25519Sha512,
            "ML_DSA_SHAKE_256" => Self::MlDsaShake256,
            "RSASSA_PKCS1_V1_5_SHA_256" => Self::RsassaPkcs1V15Sha256,
            "RSASSA_PKCS1_V1_5_SHA_384" => Self::RsassaPkcs1V15Sha384,
            "RSASSA_PKCS1_V1_5_SHA_512" => Self::RsassaPkcs1V15Sha512,
            "RSASSA_PSS_SHA_256" => Self::RsassaPssSha256,
            "RSASSA_PSS_SHA_384" => Self::RsassaPssSha384,
            "RSASSA_PSS_SHA_512" => Self::RsassaPssSha512,
            "SM2DSA" => Self::Sm2dsa,
            _ => Self::default(),
        }
    }
}

/// KMS AliasListEntry.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct AliasListEntry {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub alias_arn: Option<String>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub alias_name: Option<String>,
    #[serde(
        skip_serializing_if = "Option::is_none",
        serialize_with = "crate::epoch_seconds::option::serialize",
        deserialize_with = "crate::epoch_seconds::option::deserialize"
    )]
    pub creation_date: Option<chrono::DateTime<chrono::Utc>>,
    #[serde(
        skip_serializing_if = "Option::is_none",
        serialize_with = "crate::epoch_seconds::option::serialize",
        deserialize_with = "crate::epoch_seconds::option::deserialize"
    )]
    pub last_updated_date: Option<chrono::DateTime<chrono::Utc>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub target_key_id: Option<String>,
}

/// KMS GrantConstraints.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct GrantConstraints {
    #[serde(default, skip_serializing_if = "HashMap::is_empty")]
    pub encryption_context_equals: HashMap<String, String>,
    #[serde(default, skip_serializing_if = "HashMap::is_empty")]
    pub encryption_context_subset: HashMap<String, String>,
}

/// KMS GrantListEntry.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct GrantListEntry {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub constraints: Option<GrantConstraints>,
    #[serde(
        skip_serializing_if = "Option::is_none",
        serialize_with = "crate::epoch_seconds::option::serialize",
        deserialize_with = "crate::epoch_seconds::option::deserialize"
    )]
    pub creation_date: Option<chrono::DateTime<chrono::Utc>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub grant_id: Option<String>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub grantee_principal: Option<String>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub issuing_account: Option<String>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub key_id: Option<String>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub name: Option<String>,
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    pub operations: Vec<GrantOperation>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub retiring_principal: Option<String>,
}

/// KMS KeyListEntry.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct KeyListEntry {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub key_arn: Option<String>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub key_id: Option<String>,
}

/// KMS KeyMetadata.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct KeyMetadata {
    #[serde(rename = "AWSAccountId")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub aws_account_id: Option<String>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub arn: Option<String>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub cloud_hsm_cluster_id: Option<String>,
    #[serde(
        skip_serializing_if = "Option::is_none",
        serialize_with = "crate::epoch_seconds::option::serialize",
        deserialize_with = "crate::epoch_seconds::option::deserialize"
    )]
    pub creation_date: Option<chrono::DateTime<chrono::Utc>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub current_key_material_id: Option<String>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub custom_key_store_id: Option<String>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub customer_master_key_spec: Option<CustomerMasterKeySpec>,
    #[serde(
        skip_serializing_if = "Option::is_none",
        serialize_with = "crate::epoch_seconds::option::serialize",
        deserialize_with = "crate::epoch_seconds::option::deserialize"
    )]
    pub deletion_date: Option<chrono::DateTime<chrono::Utc>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub description: Option<String>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub enabled: Option<bool>,
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    pub encryption_algorithms: Vec<EncryptionAlgorithmSpec>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub expiration_model: Option<ExpirationModelType>,
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    pub key_agreement_algorithms: Vec<KeyAgreementAlgorithmSpec>,
    pub key_id: String,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub key_manager: Option<KeyManagerType>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub key_spec: Option<KeySpec>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub key_state: Option<KeyState>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub key_usage: Option<KeyUsageType>,
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    pub mac_algorithms: Vec<MacAlgorithmSpec>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub multi_region: Option<bool>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub multi_region_configuration: Option<MultiRegionConfiguration>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub origin: Option<OriginType>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub pending_deletion_window_in_days: Option<i32>,
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    pub signing_algorithms: Vec<SigningAlgorithmSpec>,
    #[serde(
        skip_serializing_if = "Option::is_none",
        serialize_with = "crate::epoch_seconds::option::serialize",
        deserialize_with = "crate::epoch_seconds::option::deserialize"
    )]
    pub valid_to: Option<chrono::DateTime<chrono::Utc>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub xks_key_configuration: Option<XksKeyConfigurationType>,
}

/// KMS MultiRegionConfiguration.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct MultiRegionConfiguration {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub multi_region_key_type: Option<MultiRegionKeyType>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub primary_key: Option<MultiRegionKey>,
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    pub replica_keys: Vec<MultiRegionKey>,
}

/// KMS MultiRegionKey.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct MultiRegionKey {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub arn: Option<String>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub region: Option<String>,
}

/// KMS RecipientInfo.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct RecipientInfo {
    #[serde(
        skip_serializing_if = "Option::is_none",
        serialize_with = "crate::blob::option::serialize",
        deserialize_with = "crate::blob::option::deserialize"
    )]
    pub attestation_document: Option<bytes::Bytes>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub key_encryption_algorithm: Option<KeyEncryptionMechanism>,
}

/// KMS Tag.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct Tag {
    pub tag_key: String,
    pub tag_value: String,
}

/// KMS XksKeyConfigurationType.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct XksKeyConfigurationType {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub id: Option<String>,
}