Skip to main content

aws_esdk/deps/aws_cryptography_materialProviders/conversions/
cryptographic_materials_cache.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::cryptographic_materials_cache::CryptographicMaterialsCacheRef,
7) -> ::dafny_runtime::Object<
8  dyn crate::r#software::amazon::cryptography::materialproviders::internaldafny::types::ICryptographicMaterialsCache,
9>{
10    let wrap = CryptographicMaterialsCacheWrapper { obj: value.clone() };
11    let inner = ::dafny_runtime::Rc::new(::dafny_runtime::UnsafeCell::new(wrap));
12    ::dafny_runtime::Object(Some(inner))
13}
14
15pub struct CryptographicMaterialsCacheWrapper {
16  obj: crate::deps::aws_cryptography_materialProviders::types::cryptographic_materials_cache::CryptographicMaterialsCacheRef,
17}
18
19impl ::dafny_runtime::UpcastObject<::dafny_runtime::DynAny> for CryptographicMaterialsCacheWrapper {
20    ::dafny_runtime::UpcastObjectFn!(::dafny_runtime::DynAny);
21}
22
23#[allow(dead_code)]
24pub fn from_dafny(
25    dafny_value: ::dafny_runtime::Object<
26      dyn crate::r#software::amazon::cryptography::materialproviders::internaldafny::types::ICryptographicMaterialsCache,
27    >,
28) -> crate::deps::aws_cryptography_materialProviders::types::cryptographic_materials_cache::CryptographicMaterialsCacheRef{
29    let wrap = ICryptographicMaterialsCacheDafnyWrapper {
30        obj: dafny_value.clone(),
31    };
32    crate::deps::aws_cryptography_materialProviders::types::cryptographic_materials_cache::CryptographicMaterialsCacheRef {
33      inner: ::dafny_runtime::Rc::new(::dafny_runtime::RefCell::new(wrap))
34    }
35}
36
37#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
38pub struct ICryptographicMaterialsCacheDafnyWrapper {
39  pub(crate) obj: ::dafny_runtime::Object<
40      dyn crate::r#software::amazon::cryptography::materialproviders::internaldafny::types::ICryptographicMaterialsCache,
41  >,
42}
43
44impl crate::software::amazon::cryptography::materialproviders::internaldafny::types::ICryptographicMaterialsCache
45  for CryptographicMaterialsCacheWrapper
46{
47  fn r#_PutCacheEntry_k(
48    &self,
49    input: &::dafny_runtime::Rc<crate::software::amazon::cryptography::materialproviders::internaldafny::types::PutCacheEntryInput>,
50) -> ::dafny_runtime::Rc<
51    crate::r#_Wrappers_Compile::Result<
52        (),
53        ::dafny_runtime::Rc<crate::r#software::amazon::cryptography::materialproviders::internaldafny::types::Error>,
54    >,
55>
56{
57    let inner_input = crate::deps::aws_cryptography_materialProviders::conversions::put_cache_entry::_put_cache_entry_input::from_dafny(input.clone());
58    let inner_result = self.obj.inner.lock().unwrap().put_cache_entry(inner_input);
59    let result = match inner_result {
60        Ok(x) => crate::r#_Wrappers_Compile::Result::Success {
61            value: (),
62        },
63        Err(x) => crate::r#_Wrappers_Compile::Result::Failure {
64            error: crate::deps::aws_cryptography_materialProviders::conversions::error::to_dafny(x),
65        },
66    };
67    ::dafny_runtime::Rc::new(result)
68}
69
70fn r#_UpdateUsageMetadata_k(
71    &self,
72    input: &::dafny_runtime::Rc<crate::software::amazon::cryptography::materialproviders::internaldafny::types::UpdateUsageMetadataInput>,
73) -> ::dafny_runtime::Rc<
74    crate::r#_Wrappers_Compile::Result<
75        (),
76        ::dafny_runtime::Rc<crate::r#software::amazon::cryptography::materialproviders::internaldafny::types::Error>,
77    >,
78>
79{
80    let inner_input = crate::deps::aws_cryptography_materialProviders::conversions::update_usage_metadata::_update_usage_metadata_input::from_dafny(input.clone());
81    let inner_result = self.obj.inner.lock().unwrap().update_usage_metadata(inner_input);
82    let result = match inner_result {
83        Ok(x) => crate::r#_Wrappers_Compile::Result::Success {
84            value: (),
85        },
86        Err(x) => crate::r#_Wrappers_Compile::Result::Failure {
87            error: crate::deps::aws_cryptography_materialProviders::conversions::error::to_dafny(x),
88        },
89    };
90    ::dafny_runtime::Rc::new(result)
91}
92
93fn r#_GetCacheEntry_k(
94    &self,
95    input: &::dafny_runtime::Rc<crate::software::amazon::cryptography::materialproviders::internaldafny::types::GetCacheEntryInput>,
96) -> ::dafny_runtime::Rc<
97    crate::r#_Wrappers_Compile::Result<
98        ::dafny_runtime::Rc<crate::r#software::amazon::cryptography::materialproviders::internaldafny::types::GetCacheEntryOutput>,
99        ::dafny_runtime::Rc<crate::r#software::amazon::cryptography::materialproviders::internaldafny::types::Error>,
100    >,
101>
102{
103    let inner_input = crate::deps::aws_cryptography_materialProviders::conversions::get_cache_entry::_get_cache_entry_input::from_dafny(input.clone());
104    let inner_result = self.obj.inner.lock().unwrap().get_cache_entry(inner_input);
105    let result = match inner_result {
106        Ok(x) => crate::r#_Wrappers_Compile::Result::Success {
107            value: crate::deps::aws_cryptography_materialProviders::conversions::get_cache_entry::_get_cache_entry_output::to_dafny(x.clone()),
108        },
109        Err(x) => crate::r#_Wrappers_Compile::Result::Failure {
110            error: crate::deps::aws_cryptography_materialProviders::conversions::error::to_dafny(x),
111        },
112    };
113    ::dafny_runtime::Rc::new(result)
114}
115
116fn r#_DeleteCacheEntry_k(
117    &self,
118    input: &::dafny_runtime::Rc<crate::software::amazon::cryptography::materialproviders::internaldafny::types::DeleteCacheEntryInput>,
119) -> ::dafny_runtime::Rc<
120    crate::r#_Wrappers_Compile::Result<
121        (),
122        ::dafny_runtime::Rc<crate::r#software::amazon::cryptography::materialproviders::internaldafny::types::Error>,
123    >,
124>
125{
126    let inner_input = crate::deps::aws_cryptography_materialProviders::conversions::delete_cache_entry::_delete_cache_entry_input::from_dafny(input.clone());
127    let inner_result = self.obj.inner.lock().unwrap().delete_cache_entry(inner_input);
128    let result = match inner_result {
129        Ok(x) => crate::r#_Wrappers_Compile::Result::Success {
130            value: (),
131        },
132        Err(x) => crate::r#_Wrappers_Compile::Result::Failure {
133            error: crate::deps::aws_cryptography_materialProviders::conversions::error::to_dafny(x),
134        },
135    };
136    ::dafny_runtime::Rc::new(result)
137}
138}
139
140impl crate::deps::aws_cryptography_materialProviders::types::cryptographic_materials_cache::CryptographicMaterialsCache for ICryptographicMaterialsCacheDafnyWrapper
141{
142  fn put_cache_entry(
143  &self,
144  input: crate::deps::aws_cryptography_materialProviders::operation::put_cache_entry::PutCacheEntryInput,
145) -> Result<
146  (),
147  crate::deps::aws_cryptography_materialProviders::types::error::Error,
148> {
149  let inner_input = crate::deps::aws_cryptography_materialProviders::conversions::put_cache_entry::_put_cache_entry_input::to_dafny(input);
150  let inner_result = ::dafny_runtime::md!(self.obj.clone()).PutCacheEntry(&inner_input);
151  if matches!(
152      inner_result.as_ref(),
153      crate::r#_Wrappers_Compile::Result::Success { .. }
154  ) {
155      Ok(
156          (),
157      )
158  } else {
159      Err(crate::deps::aws_cryptography_materialProviders::conversions::error::from_dafny(
160          inner_result.error().clone(),
161      ))
162  }
163}
164
165fn update_usage_metadata(
166  &self,
167  input: crate::deps::aws_cryptography_materialProviders::operation::update_usage_metadata::UpdateUsageMetadataInput,
168) -> Result<
169  (),
170  crate::deps::aws_cryptography_materialProviders::types::error::Error,
171> {
172  let inner_input = crate::deps::aws_cryptography_materialProviders::conversions::update_usage_metadata::_update_usage_metadata_input::to_dafny(input);
173  let inner_result = ::dafny_runtime::md!(self.obj.clone()).UpdateUsageMetadata(&inner_input);
174  if matches!(
175      inner_result.as_ref(),
176      crate::r#_Wrappers_Compile::Result::Success { .. }
177  ) {
178      Ok(
179          (),
180      )
181  } else {
182      Err(crate::deps::aws_cryptography_materialProviders::conversions::error::from_dafny(
183          inner_result.error().clone(),
184      ))
185  }
186}
187
188fn get_cache_entry(
189  &self,
190  input: crate::deps::aws_cryptography_materialProviders::operation::get_cache_entry::GetCacheEntryInput,
191) -> Result<
192  crate::deps::aws_cryptography_materialProviders::operation::get_cache_entry::GetCacheEntryOutput,
193  crate::deps::aws_cryptography_materialProviders::types::error::Error,
194> {
195  let inner_input = crate::deps::aws_cryptography_materialProviders::conversions::get_cache_entry::_get_cache_entry_input::to_dafny(input);
196  let inner_result = ::dafny_runtime::md!(self.obj.clone()).GetCacheEntry(&inner_input);
197  if matches!(
198      inner_result.as_ref(),
199      crate::r#_Wrappers_Compile::Result::Success { .. }
200  ) {
201      Ok(
202          crate::deps::aws_cryptography_materialProviders::conversions::get_cache_entry::_get_cache_entry_output::from_dafny(inner_result.value().clone()),
203      )
204  } else {
205      Err(crate::deps::aws_cryptography_materialProviders::conversions::error::from_dafny(
206          inner_result.error().clone(),
207      ))
208  }
209}
210
211fn delete_cache_entry(
212  &self,
213  input: crate::deps::aws_cryptography_materialProviders::operation::delete_cache_entry::DeleteCacheEntryInput,
214) -> Result<
215  (),
216  crate::deps::aws_cryptography_materialProviders::types::error::Error,
217> {
218  let inner_input = crate::deps::aws_cryptography_materialProviders::conversions::delete_cache_entry::_delete_cache_entry_input::to_dafny(input);
219  let inner_result = ::dafny_runtime::md!(self.obj.clone()).DeleteCacheEntry(&inner_input);
220  if matches!(
221      inner_result.as_ref(),
222      crate::r#_Wrappers_Compile::Result::Success { .. }
223  ) {
224      Ok(
225          (),
226      )
227  } else {
228      Err(crate::deps::aws_cryptography_materialProviders::conversions::error::from_dafny(
229          inner_result.error().clone(),
230      ))
231  }
232}
233}