aws_db_esdk/deps/aws_cryptography_materialProviders/conversions/
decryption_materials.rs

1// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
2// SPDX-License-Identifier: Apache-2.0
3// Do not modify this file. This file is machine generated, and any changes to it will be overwritten.
4#[allow(dead_code)]
5pub fn to_dafny(
6    value: &crate::deps::aws_cryptography_materialProviders::types::DecryptionMaterials,
7) -> ::dafny_runtime::Rc<
8    crate::r#software::amazon::cryptography::materialproviders::internaldafny::types::DecryptionMaterials,
9>{
10    ::dafny_runtime::Rc::new(to_dafny_plain(value.clone()))
11}
12
13#[allow(dead_code)]
14pub fn to_dafny_plain(
15    value: crate::deps::aws_cryptography_materialProviders::types::DecryptionMaterials,
16) -> crate::r#software::amazon::cryptography::materialproviders::internaldafny::types::DecryptionMaterials{
17    crate::r#software::amazon::cryptography::materialproviders::internaldafny::types::DecryptionMaterials::DecryptionMaterials {
18        algorithmSuite: crate::deps::aws_cryptography_materialProviders::conversions::algorithm_suite_info::to_dafny(&value.algorithm_suite.clone().unwrap())
19,
20 encryptionContext: ::dafny_runtime::dafny_runtime_conversions::hashmap_to_dafny_map(&value.encryption_context.clone().unwrap(),
21    |k| dafny_runtime::dafny_runtime_conversions::vec_to_dafny_sequence(&k.as_bytes().to_vec(), |b| *b),
22    |v| dafny_runtime::dafny_runtime_conversions::vec_to_dafny_sequence(&v.as_bytes().to_vec(), |b| *b),
23)
24,
25 requiredEncryptionContextKeys: ::dafny_runtime::dafny_runtime_conversions::vec_to_dafny_sequence(&value.required_encryption_context_keys.clone().unwrap(),
26    |e| dafny_runtime::dafny_runtime_conversions::vec_to_dafny_sequence(&e.as_bytes().to_vec(), |b| *b),
27)
28,
29 plaintextDataKey: crate::standard_library_conversions::oblob_to_dafny(&value.plaintext_data_key),
30 verificationKey: crate::standard_library_conversions::oblob_to_dafny(&value.verification_key),
31 symmetricSigningKey: crate::standard_library_conversions::oblob_to_dafny(&value.symmetric_signing_key),
32    }
33}
34
35#[allow(dead_code)]
36pub fn option_to_dafny(
37  value: ::std::option::Option<crate::deps::aws_cryptography_materialProviders::types::DecryptionMaterials>,
38) -> ::dafny_runtime::Rc<crate::_Wrappers_Compile::Option<::dafny_runtime::Rc<
39  crate::r#software::amazon::cryptography::materialproviders::internaldafny::types::DecryptionMaterials,
40>>>{
41    ::dafny_runtime::Rc::new(match value {
42        ::std::option::Option::None => crate::_Wrappers_Compile::Option::None {},
43        ::std::option::Option::Some(x) => crate::_Wrappers_Compile::Option::Some {
44            value: ::dafny_runtime::Rc::new(to_dafny_plain(x)),
45        },
46    })
47}
48
49#[allow(dead_code)]
50pub fn from_dafny(
51    dafny_value: ::dafny_runtime::Rc<
52        crate::r#software::amazon::cryptography::materialproviders::internaldafny::types::DecryptionMaterials,
53    >,
54) -> crate::deps::aws_cryptography_materialProviders::types::DecryptionMaterials {
55    plain_from_dafny(&*dafny_value)
56}
57
58#[allow(dead_code)]
59pub fn plain_from_dafny(
60    dafny_value: &crate::r#software::amazon::cryptography::materialproviders::internaldafny::types::DecryptionMaterials,
61) -> crate::deps::aws_cryptography_materialProviders::types::DecryptionMaterials {
62    match dafny_value {
63        crate::r#software::amazon::cryptography::materialproviders::internaldafny::types::DecryptionMaterials::DecryptionMaterials {..} =>
64            crate::deps::aws_cryptography_materialProviders::types::DecryptionMaterials::builder()
65                .set_algorithm_suite(Some( crate::deps::aws_cryptography_materialProviders::conversions::algorithm_suite_info::from_dafny(dafny_value.algorithmSuite().clone())
66 ))
67 .set_encryption_context(Some( ::dafny_runtime::dafny_runtime_conversions::dafny_map_to_hashmap(&dafny_value.encryptionContext(),
68    |k: &::dafny_runtime::dafny_runtime_conversions::DafnySequence<u8>| ::std::string::String::from_utf8(dafny_runtime::dafny_runtime_conversions::dafny_sequence_to_vec(&::std::borrow::Borrow::borrow(k), |b| *b)).unwrap(),
69    |v: &::dafny_runtime::dafny_runtime_conversions::DafnySequence<u8>| ::std::string::String::from_utf8(dafny_runtime::dafny_runtime_conversions::dafny_sequence_to_vec(&::std::borrow::Borrow::borrow(v), |b| *b)).unwrap(),
70)
71 ))
72 .set_required_encryption_context_keys(Some( ::dafny_runtime::dafny_runtime_conversions::dafny_sequence_to_vec(dafny_value.requiredEncryptionContextKeys(),
73    |e: &::dafny_runtime::dafny_runtime_conversions::DafnySequence<u8>| ::std::string::String::from_utf8(dafny_runtime::dafny_runtime_conversions::dafny_sequence_to_vec(&::std::borrow::Borrow::borrow(e), |b| *b)).unwrap(),
74)
75 ))
76 .set_plaintext_data_key(crate::standard_library_conversions::oblob_from_dafny(dafny_value.plaintextDataKey().clone()))
77 .set_verification_key(crate::standard_library_conversions::oblob_from_dafny(dafny_value.verificationKey().clone()))
78 .set_symmetric_signing_key(crate::standard_library_conversions::oblob_from_dafny(dafny_value.symmetricSigningKey().clone()))
79                .build()
80                .unwrap()
81    }
82}
83
84#[allow(dead_code)]
85pub fn option_from_dafny(
86    dafny_value: ::dafny_runtime::Rc<crate::_Wrappers_Compile::Option<::dafny_runtime::Rc<
87        crate::r#software::amazon::cryptography::materialproviders::internaldafny::types::DecryptionMaterials,
88    >>>,
89) -> ::std::option::Option<
90    crate::deps::aws_cryptography_materialProviders::types::DecryptionMaterials,
91> {
92    match &*dafny_value {
93        crate::_Wrappers_Compile::Option::Some { value } => {
94            ::std::option::Option::Some(plain_from_dafny(value))
95        }
96        _ => ::std::option::Option::None,
97    }
98}