diff --git a/.github/actions/build_dafny_from_source/action.yml b/.github/actions/build_dafny_from_source/action.yml index 5a61e39ee..0d542da34 100644 --- a/.github/actions/build_dafny_from_source/action.yml +++ b/.github/actions/build_dafny_from_source/action.yml @@ -56,8 +56,12 @@ runs: # update the copy of the Rust runtime we have inside TestModels # (since it's not published yet) - - name: Update dafny_runtime_rust - shell: bash - run: | - rm -rf TestModels/dafny-dependencies/dafny_runtime_rust - cp -r dafny/Source/DafnyRuntime/DafnyRuntimeRust TestModels/dafny-dependencies/dafny_runtime_rust + # TODO: Temporarily not doing this because we need a targeted fix to the runtime, + # but can't pick it up by moving to a newer Dafny commit because that would pull in + # other breaking changes. + +# - name: Update dafny_runtime_rust +# shell: bash +# run: | +# rm -rf TestModels/dafny-dependencies/dafny_runtime_rust +# cp -r dafny/Source/DafnyRuntime/DafnyRuntimeRust TestModels/dafny-dependencies/dafny_runtime_rust diff --git a/SmithyDafnyMakefile.mk b/SmithyDafnyMakefile.mk index 18fe6614e..06bc1fa55 100644 --- a/SmithyDafnyMakefile.mk +++ b/SmithyDafnyMakefile.mk @@ -288,7 +288,7 @@ _polymorph: --dependent-model $(PROJECT_ROOT)/$(SMITHY_DEPS) \ $(patsubst %, --dependent-model $(PROJECT_ROOT)/%/Model, $($(service_deps_var))) \ $(DEPENDENCY_MODULE_NAMES) \ - --namespace $($(namespace_var)) \ + $(patsubst %, --namespace %, $($(namespace_var))) \ $(OUTPUT_LOCAL_SERVICE_$(SERVICE)) \ $(AWS_SDK_CMD) \ $(POLYMORPH_OPTIONS) \ @@ -428,20 +428,15 @@ setup_prettier: npm i --no-save prettier@3 prettier-plugin-java@2.5 # Generates rust code for all namespaces in this project -# Note that we rely on the patching feature of polymorph -# to also patch the results of transpile_rust, -# so we assume that is run first! .PHONY: polymorph_rust -polymorph_rust: POLYMORPH_LANGUAGE_TARGET=rust -polymorph_rust: _polymorph_dependencies + polymorph_rust: - set -e; for service in $(PROJECT_SERVICES) ; do \ - export service_deps_var=SERVICE_DEPS_$${service} ; \ - export namespace_var=SERVICE_NAMESPACE_$${service} ; \ - export SERVICE=$${service} ; \ - $(MAKE) _polymorph_rust ; \ - done + $(MAKE) _polymorph_rust +_polymorph_rust: POLYMORPH_LANGUAGE_TARGET=rust +_polymorph_rust: service_deps_var=SERVICE_DEPS_$(MAIN_SERVICE_FOR_RUST) +_polymorph_rust: namespace_var=SERVICE_NAMESPACE_$(MAIN_SERVICE_FOR_RUST) +_polymorph_rust: SERVICE=$(MAIN_SERVICE_FOR_RUST) _polymorph_rust: OUTPUT_RUST=--output-rust $(LIBRARY_ROOT)/runtimes/rust # For several TestModels we've just manually written the code generation target, # So we just want to ensure we can transpile and pass the tests in CI. @@ -562,7 +557,7 @@ rust: polymorph_dafny transpile_rust polymorph_rust test_rust # The Dafny Rust code generator only supports a single crate for everything, # so (among other consequences) we compile src and test code together. -transpile_rust: | transpile_implementation_rust transpile_dependencies_rust +transpile_rust: | transpile_implementation_rust transpile_implementation_rust: TARGET=rs transpile_implementation_rust: OUT=implementation_from_dafny @@ -589,17 +584,15 @@ _mv_implementation_rust: # rustfmt has a recurring bug where it leaves behind trailing spaces and then complains about it. # Pre-process the Dafny-generated Rust code to remove them. sed -i -e 's/[[:space:]]*$$//' runtimes/rust/src/implementation_from_dafny.rs - + rm -f runtimes/rust/src/implementation_from_dafny.rs-e rustfmt --edition 2021 runtimes/rust/src/implementation_from_dafny.rs rm -rf implementation_from_dafny-rust patch_after_transpile_rust: - set -e; for service in $(PROJECT_SERVICES) ; do \ - export service_deps_var=SERVICE_DEPS_$${service} ; \ - export namespace_var=SERVICE_NAMESPACE_$${service} ; \ - export SERVICE=$${service} ; \ - $(MAKE) _patch_after_transpile_rust ; \ - done + export service_deps_var=SERVICE_DEPS_$(MAIN_SERVICE_FOR_RUST) ; \ + export namespace_var=SERVICE_NAMESPACE_$(MAIN_SERVICE_FOR_RUST) ; \ + export SERVICE=$(MAIN_SERVICE_FOR_RUST) ; \ + $(MAKE) _patch_after_transpile_rust ; \ _patch_after_transpile_rust: OUTPUT_RUST=--output-rust $(LIBRARY_ROOT)/runtimes/rust _patch_after_transpile_rust: @@ -615,6 +608,7 @@ _patch_after_transpile_rust: --namespace $($(namespace_var)) \ $(AWS_SDK_CMD) \ $(POLYMORPH_OPTIONS) \ + $(if $(TRANSPILE_TESTS_IN_RUST), --local-service-test, ) \ "; build_rust: @@ -726,12 +720,28 @@ local_transpile_impl_net_single: TARGET=cs local_transpile_impl_net_single: OUT=runtimes/net/ImplementationFromDafny local_transpile_impl_net_single: local_transpile_impl_single +local_transpile_impl_rust_single: TARGET=rs +local_transpile_impl_rust_single: OUT=implementation_from_dafny +local_transpile_impl_rust_single: SRC_INDEX=$(RUST_SRC_INDEX) +local_transpile_impl_rust_single: TEST_INDEX=$(RUST_TEST_INDEX) +local_transpile_impl_rust_single: DAFNY_OPTIONS=--emit-uncompilable-code --allow-warnings --compile-suffix +local_transpile_impl_rust_single: TRANSPILE_DEPENDENCIES= +local_transpile_impl_rust_single: STD_LIBRARY= +local_transpile_impl_rust_single: SRC_INDEX_TRANSPILE=$(if $(SRC_INDEX),$(SRC_INDEX),src) +local_transpile_impl_rust_single: TEST_INDEX_TRANSPILE=$(if $(TEST_INDEX),$(TEST_INDEX),test) +local_transpile_impl_rust_single: DAFNY_OTHER_FILES=$(RUST_OTHER_FILES) +local_transpile_impl_rust_single: deps_var=SERVICE_DEPS_$(SERVICE) +local_transpile_impl_rust_single: service_deps_var=SERVICE_DEPS_$(SERVICE) +local_transpile_impl_rust_single: namespace_var=SERVICE_NAMESPACE_$(SERVICE) +local_transpile_impl_rust_single: $(if $(TRANSPILE_TESTS_IN_RUST), transpile_test, transpile_implementation) _mv_implementation_rust _patch_after_transpile_rust + + local_transpile_impl_single: deps_var=SERVICE_DEPS_$(SERVICE) local_transpile_impl_single: TRANSPILE_TARGETS=./dafny/$(SERVICE)/src/$(FILE) local_transpile_impl_single: TRANSPILE_DEPENDENCIES= \ - $(patsubst %, -library:$(PROJECT_ROOT)/%/src/Index.dfy, $($(deps_var))) \ - $(patsubst %, -library:$(PROJECT_ROOT)/%, $(PROJECT_INDEX)) \ - -library:$(PROJECT_ROOT)/$(STD_LIBRARY)/src/Index.dfy + $(patsubst %, --library:$(PROJECT_ROOT)/%/src/Index.dfy, $($(deps_var))) \ + $(patsubst %, --library:$(PROJECT_ROOT)/%, $(PROJECT_INDEX)) \ + --library:$(PROJECT_ROOT)/$(STD_LIBRARY)/src/Index.dfy local_transpile_impl_single: transpile_implementation # Targets to transpile single local service for convenience. @@ -766,4 +776,4 @@ local_polymorph_rust_single: local_polymorph_single local_polymorph_single: service_deps_var=SERVICE_DEPS_$(SERVICE) local_polymorph_single: namespace_var=SERVICE_NAMESPACE_$(SERVICE) local_polymorph_single: PROJECT_DEPENDENCIES= -local_polymorph_single: _polymorph \ No newline at end of file +local_polymorph_single: _polymorph diff --git a/TestModels/Aggregate/Makefile b/TestModels/Aggregate/Makefile index 197d6ee16..9ce5b8967 100644 --- a/TestModels/Aggregate/Makefile +++ b/TestModels/Aggregate/Makefile @@ -12,6 +12,8 @@ include ../SharedMakefile.mk PROJECT_SERVICES := \ SimpleAggregate +MAIN_SERVICE_FOR_RUST := SimpleAggregate + TRANSLATION_RECORD_PYTHON := \ --translation-record ../dafny-dependencies/StandardLibrary/runtimes/python/src/smithy_dafny_standard_library/internaldafny/generated/dafny_src-py.dtr diff --git a/TestModels/Constructor/Makefile b/TestModels/Constructor/Makefile index 642034792..87d47fdea 100644 --- a/TestModels/Constructor/Makefile +++ b/TestModels/Constructor/Makefile @@ -14,6 +14,8 @@ NAMESPACE=simple.constructor PROJECT_SERVICES := \ SimpleConstructor +MAIN_SERVICE_FOR_RUST := SimpleConstructor + SERVICE_NAMESPACE_SimpleConstructor=simple.constructor SERVICE_DEPS_SimpleConstructor := diff --git a/TestModels/Dependencies/Makefile b/TestModels/Dependencies/Makefile index 398f0b535..81dc8626d 100644 --- a/TestModels/Dependencies/Makefile +++ b/TestModels/Dependencies/Makefile @@ -5,11 +5,15 @@ CORES=2 ENABLE_EXTERN_PROCESSING=1 +TRANSPILE_TESTS_IN_RUST=1 + include ../SharedMakefile.mk PROJECT_SERVICES := \ SimpleDependencies +MAIN_SERVICE_FOR_RUST := SimpleDependencies + # Dependencies external to this project # Order is important # In java they MUST be built diff --git a/TestModels/Dependencies/runtimes/rust/Cargo.toml b/TestModels/Dependencies/runtimes/rust/Cargo.toml new file mode 100644 index 000000000..08c2371a4 --- /dev/null +++ b/TestModels/Dependencies/runtimes/rust/Cargo.toml @@ -0,0 +1,24 @@ +[package] +name = "dependencies" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[features] +wrapped-client = [] + +[dependencies] +aws-smithy-runtime-api = {version = "1.7.0", features = ["client"] } +aws-smithy-types = "1.2.0" +dafny_runtime = { path = "../../../dafny-dependencies/dafny_runtime_rust"} + +[dev-dependencies] +dependencies = { path = ".", features = ["wrapped-client"] } + +[dependencies.tokio] +version = "1.26.0" +features = ["full"] + +[lib] +path = "src/implementation_from_dafny.rs" diff --git a/TestModels/Errors/Makefile b/TestModels/Errors/Makefile index 842bdda2d..a725328a0 100644 --- a/TestModels/Errors/Makefile +++ b/TestModels/Errors/Makefile @@ -12,6 +12,8 @@ include ../SharedMakefile.mk PROJECT_SERVICES := \ SimpleErrors +MAIN_SERVICE_FOR_RUST := SimpleErrors + SERVICE_NAMESPACE_SimpleErrors=simple.errors SERVICE_DEPS_SimpleErrors := diff --git a/TestModels/LanguageSpecificLogic/Makefile b/TestModels/LanguageSpecificLogic/Makefile index 7313f7d92..7b1c1ee2f 100644 --- a/TestModels/LanguageSpecificLogic/Makefile +++ b/TestModels/LanguageSpecificLogic/Makefile @@ -10,6 +10,8 @@ include ../SharedMakefile.mk PROJECT_SERVICES := \ LanguageSpecificLogic +MAIN_SERVICE_FOR_RUST := LanguageSpecificLogic + SERVICE_NAMESPACE_LanguageSpecificLogic=language.specific.logic SERVICE_DEPS_LanguageSpecificLogic := diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/client.rs b/TestModels/LanguageSpecificLogic/runtimes/rust/src/deps.rs similarity index 81% rename from TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/client.rs rename to TestModels/LanguageSpecificLogic/runtimes/rust/src/deps.rs index 5fbbbaa0f..a5d3381b0 100644 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/client.rs +++ b/TestModels/LanguageSpecificLogic/runtimes/rust/src/deps.rs @@ -1,3 +1,3 @@ // Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. \ No newline at end of file diff --git a/TestModels/LocalService/Makefile b/TestModels/LocalService/Makefile index f01880288..94f3cf5e8 100644 --- a/TestModels/LocalService/Makefile +++ b/TestModels/LocalService/Makefile @@ -13,6 +13,8 @@ NAMESPACE=simple.localService PROJECT_SERVICES := \ SimpleLocalService +MAIN_SERVICE_FOR_RUST := SimpleLocalService + SERVICE_NAMESPACE_SimpleLocalService=simple.localService SERVICE_DEPS_SimpleLocalService := diff --git a/TestModels/MultipleModels/Makefile b/TestModels/MultipleModels/Makefile index ff3982c5e..4a62183be 100644 --- a/TestModels/MultipleModels/Makefile +++ b/TestModels/MultipleModels/Makefile @@ -4,6 +4,7 @@ CORES=2 ENABLE_EXTERN_PROCESSING=1 +TRANSPILE_TESTS_IN_RUST=1 include ../SharedMakefile.mk @@ -14,6 +15,8 @@ PROJECT_SERVICES := \ DependencyProject \ PrimaryProject \ +MAIN_SERVICE_FOR_RUST := PrimaryProject + SERVICE_NAMESPACE_PrimaryProject=simple.multiplemodels.primaryproject SERVICE_NAMESPACE_DependencyProject=simple.multiplemodels.dependencyproject diff --git a/TestModels/MultipleModels/dafny/DependencyProject/Model/dependency-project.smithy b/TestModels/MultipleModels/dafny/DependencyProject/Model/dependency-project.smithy index 1ad0de0d4..43fc2b4ff 100644 --- a/TestModels/MultipleModels/dafny/DependencyProject/Model/dependency-project.smithy +++ b/TestModels/MultipleModels/dafny/DependencyProject/Model/dependency-project.smithy @@ -5,7 +5,8 @@ namespace simple.multiplemodels.dependencyproject @aws.polymorph#localService( sdkId: "DependencyProject", config: DependencyProjectConfig, -) service DependencyProject { +) +service DependencyProject { version: "2021-11-01", resources: [], operations: [ SomeDependencyOperation ], diff --git a/TestModels/MultipleModels/dafny/DependencyProject/src/Index.dfy b/TestModels/MultipleModels/dafny/DependencyProject/src/Index.dfy index f76aed9e4..a5128373f 100644 --- a/TestModels/MultipleModels/dafny/DependencyProject/src/Index.dfy +++ b/TestModels/MultipleModels/dafny/DependencyProject/src/Index.dfy @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 include "SimpleMultiplemodelsDependencyprojectImpl.dfy" -module DependencyProject refines AbstractSimpleMultiplemodelsDependencyprojectService { +module {:extern "simple.multiplemodels.dependencyproject.internaldafny" } DependencyProject refines AbstractSimpleMultiplemodelsDependencyprojectService { import Operations = SimpleMultiplemodelsDependencyprojectImpl function method DefaultDependencyProjectConfig(): DependencyProjectConfig { diff --git a/TestModels/MultipleModels/dafny/DependencyProject/src/WrappedSimpleMultiplemodelsDependencyprojectImpl.dfy b/TestModels/MultipleModels/dafny/DependencyProject/src/WrappedSimpleMultiplemodelsDependencyprojectImpl.dfy index f3ade876c..1c1be062e 100644 --- a/TestModels/MultipleModels/dafny/DependencyProject/src/WrappedSimpleMultiplemodelsDependencyprojectImpl.dfy +++ b/TestModels/MultipleModels/dafny/DependencyProject/src/WrappedSimpleMultiplemodelsDependencyprojectImpl.dfy @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 include "../Model/SimpleMultiplemodelsDependencyprojectTypesWrapped.dfy" -module WrappedSimpleMultiplemodelsDependencyprojectService refines WrappedAbstractSimpleMultiplemodelsDependencyprojectService { +module {:extern "simple.multiplemodels.dependencyproject.internaldafny.wrapped"} WrappedSimpleMultiplemodelsDependencyprojectService refines WrappedAbstractSimpleMultiplemodelsDependencyprojectService { import WrappedService = DependencyProject function method WrappedDefaultDependencyProjectConfig(): DependencyProjectConfig { DependencyProjectConfig diff --git a/TestModels/MultipleModels/dafny/PrimaryProject/Model/primary-project.smithy b/TestModels/MultipleModels/dafny/PrimaryProject/Model/primary-project.smithy index 6e7a08186..c21984ee6 100644 --- a/TestModels/MultipleModels/dafny/PrimaryProject/Model/primary-project.smithy +++ b/TestModels/MultipleModels/dafny/PrimaryProject/Model/primary-project.smithy @@ -7,6 +7,7 @@ use simple.multiplemodels.dependencyproject#SomeDependencyOperation @aws.polymorph#localService( sdkId: "PrimaryProject", config: PrimaryProjectConfig, + dependencies: [ simple.multiplemodels.dependencyproject#DependencyProject ] ) service PrimaryProject { version: "2021-11-01", resources: [], diff --git a/TestModels/MultipleModels/dafny/PrimaryProject/src/Index.dfy b/TestModels/MultipleModels/dafny/PrimaryProject/src/Index.dfy index 7fb678ab8..b2c37bf6d 100644 --- a/TestModels/MultipleModels/dafny/PrimaryProject/src/Index.dfy +++ b/TestModels/MultipleModels/dafny/PrimaryProject/src/Index.dfy @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 include "SimpleMultiplemodelsPrimaryprojectImpl.dfy" -module PrimaryProject refines AbstractSimpleMultiplemodelsPrimaryprojectService { +module {:extern "simple.multiplemodels.primaryproject.internaldafny" } PrimaryProject refines AbstractSimpleMultiplemodelsPrimaryprojectService { import Operations = SimpleMultiplemodelsPrimaryprojectImpl function method DefaultPrimaryProjectConfig(): PrimaryProjectConfig { diff --git a/TestModels/MultipleModels/dafny/PrimaryProject/src/WrappedSimpleMultiplemodelsPrimaryprojectImpl.dfy b/TestModels/MultipleModels/dafny/PrimaryProject/src/WrappedSimpleMultiplemodelsPrimaryprojectImpl.dfy index 5ad326f59..b6311eb98 100644 --- a/TestModels/MultipleModels/dafny/PrimaryProject/src/WrappedSimpleMultiplemodelsPrimaryprojectImpl.dfy +++ b/TestModels/MultipleModels/dafny/PrimaryProject/src/WrappedSimpleMultiplemodelsPrimaryprojectImpl.dfy @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 include "../Model/SimpleMultiplemodelsPrimaryprojectTypesWrapped.dfy" -module WrappedSimpleMultiplemodelsPrimaryprojectService refines WrappedAbstractSimpleMultiplemodelsPrimaryprojectService { +module {:extern "simple.multiplemodels.primaryproject.internaldafny.wrapped"} WrappedSimpleMultiplemodelsPrimaryprojectService refines WrappedAbstractSimpleMultiplemodelsPrimaryprojectService { import WrappedService = PrimaryProject function method WrappedDefaultPrimaryProjectConfig(): PrimaryProjectConfig { PrimaryProjectConfig diff --git a/TestModels/MultipleModels/runtimes/rust/Cargo.toml b/TestModels/MultipleModels/runtimes/rust/Cargo.toml new file mode 100644 index 000000000..b0112a274 --- /dev/null +++ b/TestModels/MultipleModels/runtimes/rust/Cargo.toml @@ -0,0 +1,24 @@ +[package] +name = "multiple_models" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[features] +wrapped-client = [] + +[dependencies] +aws-smithy-runtime-api = {version = "1.7.0", features = ["client"] } +aws-smithy-types = "1.2.0" +dafny_runtime = { path = "../../../dafny-dependencies/dafny_runtime_rust"} + +[dev-dependencies] +multiple_models = { path = ".", features = ["wrapped-client"] } + +[dependencies.tokio] +version = "1.26.0" +features = ["full"] + +[lib] +path = "src/implementation_from_dafny.rs" diff --git a/TestModels/Positional/Makefile b/TestModels/Positional/Makefile index e65bbaa7f..b39ff1434 100644 --- a/TestModels/Positional/Makefile +++ b/TestModels/Positional/Makefile @@ -13,6 +13,8 @@ NAMESPACE=simple.positional PROJECT_SERVICES := \ SimplePositional +MAIN_SERVICE_FOR_RUST := SimplePositional + SERVICE_NAMESPACE_SimplePositional=simple.positional SERVICE_DEPS_SimplePositional := diff --git a/TestModels/Positional/runtimes/rust/src/client.rs b/TestModels/Positional/runtimes/rust/src/client.rs deleted file mode 100644 index 0e3092d92..000000000 --- a/TestModels/Positional/runtimes/rust/src/client.rs +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -use aws_smithy_types::error::operation::BuildError; - -#[derive(::std::clone::Clone, ::std::fmt::Debug, ::std::cmp::PartialEq)] -pub struct Client { - pub(crate) dafny_client: ::dafny_runtime::Object -} - -impl Client { - /// Creates a new client from the service [`Config`](crate::Config). - #[track_caller] - pub fn from_conf( - conf: crate::types::simple_positional_config::SimplePositionalConfig, - ) -> Result { - let inner = - crate::simple::positional::internaldafny::_default::SimplePositional( - &crate::conversions::simple_positional_config::_simple_positional_config::to_dafny(conf), - ); - if matches!( - inner.as_ref(), - crate::_Wrappers_Compile::Result::Failure { .. } - ) { - // TODO: convert error - the potential types are not modeled! - return Err(BuildError::other( - ::aws_smithy_types::error::metadata::ErrorMetadata::builder() - .message("Invalid client config") - .build(), - )); - } - Ok(Self { - dafny_client: ::dafny_runtime::upcast_object()(inner.Extract()) - }) - } -} - -mod get_resource; - -mod get_resource_positional; diff --git a/TestModels/Positional/runtimes/rust/src/client/get_resource.rs b/TestModels/Positional/runtimes/rust/src/client/get_resource.rs deleted file mode 100644 index d544b8739..000000000 --- a/TestModels/Positional/runtimes/rust/src/client/get_resource.rs +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -impl crate::client::Client { - /// Constructs a fluent builder for the [`GetResource`](crate::operation::get_resource::builders::GetResourceFluentBuilder) operation. - /// - /// - The fluent builder is configurable: - /// - [`name(impl Into>)`](crate::operation::get_resource::builders::GetResourceFluentBuilder::name) / [`set_name(Option<::std::string::String>)`](crate::operation::get_resource::builders::GetResourceFluentBuilder::set_name): (undocumented)
- /// - On success, responds with [`GetResourceOutput`](crate::operation::get_resource::GetResourceOutput) with field(s): - /// - [`output(Option)`](crate::operation::get_resource::GetResourceOutput::output): (undocumented) - /// - On failure, responds with [`SdkError`](crate::operation::get_resource::GetResourceError) - pub fn get_resource(&self) -> crate::operation::get_resource::builders::GetResourceFluentBuilder { - crate::operation::get_resource::builders::GetResourceFluentBuilder::new(self.clone()) - } -} diff --git a/TestModels/Positional/runtimes/rust/src/client/get_resource_positional.rs b/TestModels/Positional/runtimes/rust/src/client/get_resource_positional.rs deleted file mode 100644 index 3d30beb2c..000000000 --- a/TestModels/Positional/runtimes/rust/src/client/get_resource_positional.rs +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -impl crate::client::Client { - /// Constructs a fluent builder for the [`GetResourcePositional`](crate::operation::get_resource_positional::builders::GetResourcePositionalFluentBuilder) operation. - /// - /// - The fluent builder is configurable: - /// - [`name(impl Into>)`](crate::operation::get_resource_positional::builders::GetResourcePositionalFluentBuilder::name) / [`set_name(Option<::std::string::String>)`](crate::operation::get_resource_positional::builders::GetResourcePositionalFluentBuilder::set_name): (undocumented)
- /// - On success, responds with [`GetResourcePositionalOutput`](crate::operation::get_resource_positional::GetResourcePositionalOutput) with field(s): - /// - [`output(Option)`](crate::operation::get_resource_positional::GetResourcePositionalOutput::output): (undocumented) - /// - On failure, responds with [`SdkError`](crate::operation::get_resource_positional::GetResourcePositionalError) - pub fn get_resource_positional(&self) -> crate::operation::get_resource_positional::builders::GetResourcePositionalFluentBuilder { - crate::operation::get_resource_positional::builders::GetResourcePositionalFluentBuilder::new(self.clone()) - } -} diff --git a/TestModels/Positional/runtimes/rust/src/conversions.rs b/TestModels/Positional/runtimes/rust/src/conversions.rs deleted file mode 100644 index 72b05936c..000000000 --- a/TestModels/Positional/runtimes/rust/src/conversions.rs +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -pub mod client; - - pub mod error; - - pub mod get_name; - - pub mod get_resource; - - pub mod get_resource_positional; - - pub mod simple_resource; - -pub mod simple_positional_config; diff --git a/TestModels/Positional/runtimes/rust/src/conversions/client.rs b/TestModels/Positional/runtimes/rust/src/conversions/client.rs deleted file mode 100644 index fe6212bc3..000000000 --- a/TestModels/Positional/runtimes/rust/src/conversions/client.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] - -pub fn to_dafny( - value: &crate::client::Client, -) -> - ::dafny_runtime::Object -{ - value.dafny_client.clone() -} - -#[allow(dead_code)] -pub fn from_dafny( - dafny_value: ::dafny_runtime::Object< - dyn crate::r#simple::positional::internaldafny::types::ISimplePositionalClient - >, -) -> crate::client::Client { - crate::client::Client { dafny_client: dafny_value } -} diff --git a/TestModels/Positional/runtimes/rust/src/conversions/error.rs b/TestModels/Positional/runtimes/rust/src/conversions/error.rs deleted file mode 100644 index a24385b0b..000000000 --- a/TestModels/Positional/runtimes/rust/src/conversions/error.rs +++ /dev/null @@ -1,99 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -/// Wraps up an arbitrary Rust Error value as a Dafny Error -pub fn to_opaque_error(value: E) -> - ::std::rc::Rc -{ - let error_obj: ::dafny_runtime::Object = ::dafny_runtime::Object(Some( - ::std::rc::Rc::new(::std::cell::UnsafeCell::new(value)), - )); - ::std::rc::Rc::new( - crate::r#simple::positional::internaldafny::types::Error::Opaque { - obj: error_obj, - }, - ) -} - -/// Wraps up an arbitrary Rust Error value as a Dafny Result.Failure -pub fn to_opaque_error_result(value: E) -> - ::std::rc::Rc< - crate::_Wrappers_Compile::Result< - T, - ::std::rc::Rc - > - > -{ - ::std::rc::Rc::new(crate::_Wrappers_Compile::Result::Failure { - error: to_opaque_error(value), - }) -} -pub fn to_dafny( - value: crate::types::error::Error, -) -> ::std::rc::Rc { - ::std::rc::Rc::new(match value { - crate::types::error::Error::SimplePositionalException { message } => - crate::r#simple::positional::internaldafny::types::Error::SimplePositionalException { - message: ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&message), - }, - crate::types::error::Error::CollectionOfErrors { list, message } => - crate::r#simple::positional::internaldafny::types::Error::CollectionOfErrors { - message: ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&message), - list: ::dafny_runtime::dafny_runtime_conversions::vec_to_dafny_sequence(&list, |e| to_dafny(e.clone())) - }, - crate::types::error::Error::ValidationError(inner) => - crate::r#simple::positional::internaldafny::types::Error::Opaque { - obj: { - let rc = ::std::rc::Rc::new(inner) as ::std::rc::Rc; - // safety: `rc` is new, ensuring it has refcount 1 and is uniquely owned. - // we should use `dafny_runtime_conversions::rc_struct_to_dafny_class` once it - // accepts unsized types (https://github.com/dafny-lang/dafny/pull/5769) - unsafe { ::dafny_runtime::Object::from_rc(rc) } - }, - }, - crate::types::error::Error::Opaque { obj } => - crate::r#simple::positional::internaldafny::types::Error::Opaque { - obj: ::dafny_runtime::Object(obj.0) - }, - }) -} - -#[allow(dead_code)] -pub fn from_dafny( - dafny_value: ::std::rc::Rc< - crate::r#simple::positional::internaldafny::types::Error, - >, -) -> crate::types::error::Error { - match ::std::borrow::Borrow::borrow(&dafny_value) { - crate::r#simple::positional::internaldafny::types::Error::SimplePositionalException { message } => - crate::types::error::Error::SimplePositionalException { - message: ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(&message), - }, - crate::r#simple::positional::internaldafny::types::Error::CollectionOfErrors { list, message } => - crate::types::error::Error::CollectionOfErrors { - message: ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(&message), - list: ::dafny_runtime::dafny_runtime_conversions::dafny_sequence_to_vec(&list, |e| from_dafny(e.clone())) - }, - crate::r#simple::positional::internaldafny::types::Error::Opaque { obj } => - crate::types::error::Error::Opaque { - obj: obj.clone() - }, - crate::r#simple::positional::internaldafny::types::Error::Opaque { obj } => - { - use ::std::any::Any; - if ::dafny_runtime::is_object!(obj, crate::types::error::ValidationError) { - let typed = ::dafny_runtime::cast_object!(obj.clone(), crate::types::error::ValidationError); - crate::types::error::Error::ValidationError( - // safety: dafny_class_to_struct will increment ValidationError's Rc - unsafe { - ::dafny_runtime::dafny_runtime_conversions::object::dafny_class_to_struct(typed) - } - ) - } else { - crate::types::error::Error::Opaque { - obj: obj.clone() - } - } - }, - } -} diff --git a/TestModels/Positional/runtimes/rust/src/conversions/get_name.rs b/TestModels/Positional/runtimes/rust/src/conversions/get_name.rs deleted file mode 100644 index 7acc20499..000000000 --- a/TestModels/Positional/runtimes/rust/src/conversions/get_name.rs +++ /dev/null @@ -1,6 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -pub mod _get_name_input; - - pub mod _get_name_output; diff --git a/TestModels/Positional/runtimes/rust/src/conversions/get_name/_get_name_input.rs b/TestModels/Positional/runtimes/rust/src/conversions/get_name/_get_name_input.rs deleted file mode 100644 index 7688e4a01..000000000 --- a/TestModels/Positional/runtimes/rust/src/conversions/get_name/_get_name_input.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: crate::operation::get_name::GetNameInput, -) -> ::std::rc::Rc< - crate::r#simple::positional::internaldafny::types::GetNameInput, ->{ - ::std::rc::Rc::new(crate::r#simple::positional::internaldafny::types::GetNameInput::GetNameInput { - - }) -} - #[allow(dead_code)] -pub fn from_dafny( - dafny_value: ::std::rc::Rc< - crate::r#simple::positional::internaldafny::types::GetNameInput, - >, -) -> crate::operation::get_name::GetNameInput { - crate::operation::get_name::GetNameInput::builder() - - .build() - .unwrap() -} diff --git a/TestModels/Positional/runtimes/rust/src/conversions/get_name/_get_name_output.rs b/TestModels/Positional/runtimes/rust/src/conversions/get_name/_get_name_output.rs deleted file mode 100644 index e16c795df..000000000 --- a/TestModels/Positional/runtimes/rust/src/conversions/get_name/_get_name_output.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: crate::operation::get_name::GetNameOutput, -) -> ::std::rc::Rc< - crate::r#simple::positional::internaldafny::types::GetNameOutput, ->{ - ::std::rc::Rc::new(crate::r#simple::positional::internaldafny::types::GetNameOutput::GetNameOutput { - name: crate::standard_library_conversions::ostring_to_dafny(&value.name) .Extract(), - }) -} - #[allow(dead_code)] -pub fn from_dafny( - dafny_value: ::std::rc::Rc< - crate::r#simple::positional::internaldafny::types::GetNameOutput, - >, -) -> crate::operation::get_name::GetNameOutput { - crate::operation::get_name::GetNameOutput::builder() - .set_name(Some( dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(dafny_value.name()) )) - .build() - .unwrap() -} diff --git a/TestModels/Positional/runtimes/rust/src/conversions/get_resource.rs b/TestModels/Positional/runtimes/rust/src/conversions/get_resource.rs deleted file mode 100644 index b7f471d0c..000000000 --- a/TestModels/Positional/runtimes/rust/src/conversions/get_resource.rs +++ /dev/null @@ -1,6 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -pub mod _get_resource_input; - - pub mod _get_resource_output; diff --git a/TestModels/Positional/runtimes/rust/src/conversions/get_resource/_get_resource_input.rs b/TestModels/Positional/runtimes/rust/src/conversions/get_resource/_get_resource_input.rs deleted file mode 100644 index 6f2319daa..000000000 --- a/TestModels/Positional/runtimes/rust/src/conversions/get_resource/_get_resource_input.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: crate::operation::get_resource::GetResourceInput, -) -> ::std::rc::Rc< - crate::r#simple::positional::internaldafny::types::GetResourceInput, ->{ - ::std::rc::Rc::new(crate::r#simple::positional::internaldafny::types::GetResourceInput::GetResourceInput { - name: crate::standard_library_conversions::ostring_to_dafny(&value.name) .Extract(), - }) -} - #[allow(dead_code)] -pub fn from_dafny( - dafny_value: ::std::rc::Rc< - crate::r#simple::positional::internaldafny::types::GetResourceInput, - >, -) -> crate::operation::get_resource::GetResourceInput { - crate::operation::get_resource::GetResourceInput::builder() - .set_name(Some( dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(dafny_value.name()) )) - .build() - .unwrap() -} diff --git a/TestModels/Positional/runtimes/rust/src/conversions/get_resource/_get_resource_output.rs b/TestModels/Positional/runtimes/rust/src/conversions/get_resource/_get_resource_output.rs deleted file mode 100644 index f0493c670..000000000 --- a/TestModels/Positional/runtimes/rust/src/conversions/get_resource/_get_resource_output.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: crate::operation::get_resource::GetResourceOutput, -) -> ::std::rc::Rc< - crate::r#simple::positional::internaldafny::types::GetResourceOutput, ->{ - ::std::rc::Rc::new(crate::r#simple::positional::internaldafny::types::GetResourceOutput::GetResourceOutput { - output: crate::conversions::simple_resource::to_dafny(value.output.clone().unwrap()) -, - }) -} - #[allow(dead_code)] -pub fn from_dafny( - dafny_value: ::std::rc::Rc< - crate::r#simple::positional::internaldafny::types::GetResourceOutput, - >, -) -> crate::operation::get_resource::GetResourceOutput { - crate::operation::get_resource::GetResourceOutput::builder() - .set_output(Some( crate::conversions::simple_resource::from_dafny(dafny_value.output().clone()) - )) - .build() - .unwrap() -} diff --git a/TestModels/Positional/runtimes/rust/src/conversions/get_resource_positional.rs b/TestModels/Positional/runtimes/rust/src/conversions/get_resource_positional.rs deleted file mode 100644 index 5fbbbaa0f..000000000 --- a/TestModels/Positional/runtimes/rust/src/conversions/get_resource_positional.rs +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. diff --git a/TestModels/Positional/runtimes/rust/src/conversions/simple_positional_config.rs b/TestModels/Positional/runtimes/rust/src/conversions/simple_positional_config.rs deleted file mode 100644 index a119c8127..000000000 --- a/TestModels/Positional/runtimes/rust/src/conversions/simple_positional_config.rs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -pub mod _simple_positional_config; diff --git a/TestModels/Positional/runtimes/rust/src/conversions/simple_positional_config/_simple_positional_config.rs b/TestModels/Positional/runtimes/rust/src/conversions/simple_positional_config/_simple_positional_config.rs deleted file mode 100644 index e80603837..000000000 --- a/TestModels/Positional/runtimes/rust/src/conversions/simple_positional_config/_simple_positional_config.rs +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] - -pub fn to_dafny( - value: crate::types::simple_positional_config::SimplePositionalConfig, -) -> ::std::rc::Rc< - crate::r#simple::positional::internaldafny::types::SimplePositionalConfig, -> { - ::std::rc::Rc::new(to_dafny_plain(value)) -} - -#[allow(dead_code)] -pub fn from_dafny( - dafny_value: ::std::rc::Rc< - crate::r#simple::positional::internaldafny::types::SimplePositionalConfig, - >, -) -> crate::types::simple_positional_config::SimplePositionalConfig { - plain_from_dafny(&*dafny_value) -} - - -#[allow(dead_code)] -pub fn to_dafny_plain( - value: crate::types::simple_positional_config::SimplePositionalConfig, -) -> crate::r#simple::positional::internaldafny::types::SimplePositionalConfig { - crate::r#simple::positional::internaldafny::types::SimplePositionalConfig::SimplePositionalConfig { - - } -} - -#[allow(dead_code)] -pub fn plain_from_dafny( - dafny_value: &crate::r#simple::positional::internaldafny::types::SimplePositionalConfig, -) -> crate::types::simple_positional_config::SimplePositionalConfig { - match dafny_value { - crate::r#simple::positional::internaldafny::types::SimplePositionalConfig::SimplePositionalConfig {..} => - crate::types::simple_positional_config::SimplePositionalConfig::builder() - - .build() - .unwrap() - } -} diff --git a/TestModels/Positional/runtimes/rust/src/conversions/simple_resource.rs b/TestModels/Positional/runtimes/rust/src/conversions/simple_resource.rs deleted file mode 100644 index b3125aa99..000000000 --- a/TestModels/Positional/runtimes/rust/src/conversions/simple_resource.rs +++ /dev/null @@ -1,109 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: crate::types::simple_resource::SimpleResourceRef, -) -> ::dafny_runtime::Object< - dyn crate::r#simple::positional::internaldafny::types::ISimpleResource, -> { - let wrap = SimpleResourceWrapper { - obj: value.clone(), - }; - let inner = ::std::rc::Rc::new(::std::cell::UnsafeCell::new(wrap)); - ::dafny_runtime::Object (Some(inner) ) -} - -pub struct SimpleResourceWrapper { - obj: crate::types::simple_resource::SimpleResourceRef, -} - -impl ::dafny_runtime::UpcastObject for SimpleResourceWrapper { - ::dafny_runtime::UpcastObjectFn!(dyn ::std::any::Any); -} - -#[allow(dead_code)] -pub fn from_dafny( - dafny_value: ::dafny_runtime::Object< - dyn crate::r#simple::positional::internaldafny::types::ISimpleResource, - >, -) -> crate::types::simple_resource::SimpleResourceRef { - let wrap = ISimpleResourceDafnyWrapper { - obj: dafny_value.clone(), - }; - crate::types::simple_resource::SimpleResourceRef { - inner: ::std::rc::Rc::new(::std::cell::RefCell::new(wrap)) - } -} - -#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] -pub struct ISimpleResourceDafnyWrapper { - pub(crate) obj: ::dafny_runtime::Object< - dyn crate::r#simple::positional::internaldafny::types::ISimpleResource, - >, -} - - -impl crate::simple::positional::internaldafny::types::ISimpleResource - for SimpleResourceWrapper -{ - fn r#_GetName_k( - &mut self, - input: &::std::rc::Rc< - crate::r#simple::positional::internaldafny::types::GetNameInput, - >, - ) -> ::std::rc::Rc< - crate::r#_Wrappers_Compile::Result< - ::std::rc::Rc< - crate::r#simple::positional::internaldafny::types::GetNameOutput, - >, - ::std::rc::Rc, - >, - > - { - let inner_input = - crate::conversions::get_name::_get_name_input::from_dafny( - input.clone(), - ); - let inner_result = self.obj.inner.borrow_mut().get_name(inner_input); - let result = match inner_result { - Ok(x) => crate::r#_Wrappers_Compile::Result::Success { - value: crate::conversions::get_name::_get_name_output::to_dafny( - x, - ), - }, - Err(x) => crate::r#_Wrappers_Compile::Result::Failure { - error: crate::conversions::error::to_dafny(x), - }, - }; - ::std::rc::Rc::new(result) - } -} - -impl crate::types::simple_resource::SimpleResource for ISimpleResourceDafnyWrapper { - fn get_name( - &mut self, - input: crate::operation::get_name::GetNameInput, - ) -> Result< - crate::operation::get_name::GetNameOutput, - crate::types::error::Error, - > { - let inner_input = - crate::conversions::get_name::_get_name_input::to_dafny(input); - let inner_result = ::dafny_runtime::md!(self.obj.clone()).GetName(&inner_input); - if matches!( - inner_result.as_ref(), - crate::r#_Wrappers_Compile::Result::Success { .. } - ) { - Ok( - crate::conversions::get_name::_get_name_output::from_dafny( - inner_result.value().clone(), - ), - ) - } else { - Err(crate::conversions::error::from_dafny( - inner_result.error().clone(), - )) - } - } -} diff --git a/TestModels/Positional/runtimes/rust/src/error.rs b/TestModels/Positional/runtimes/rust/src/error.rs deleted file mode 100644 index 4cddaa7c3..000000000 --- a/TestModels/Positional/runtimes/rust/src/error.rs +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -pub use ::aws_smithy_runtime_api::box_error::BoxError; - -/// Error type returned by the client. -pub type SdkError = - ::aws_smithy_runtime_api::client::result::SdkError; -pub use ::aws_smithy_runtime_api::client::result::ConnectorError; -pub use ::aws_smithy_types::error::operation::BuildError; - -pub use ::aws_smithy_types::error::display::DisplayErrorContext; -pub use ::aws_smithy_types::error::metadata::ErrorMetadata; -pub use ::aws_smithy_types::error::metadata::ProvideErrorMetadata; - -pub(crate) mod sealed_unhandled; diff --git a/TestModels/Positional/runtimes/rust/src/error/sealed_unhandled.rs b/TestModels/Positional/runtimes/rust/src/error/sealed_unhandled.rs deleted file mode 100644 index eae800729..000000000 --- a/TestModels/Positional/runtimes/rust/src/error/sealed_unhandled.rs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -use std::any::Any; - -use dafny_runtime::UpcastObject; - -/// This struct is not intended to be used. -/// -/// This struct holds information about an unhandled error, -/// but that information should be obtained by using the -/// [`ProvideErrorMetadata`](::aws_smithy_types::error::metadata::ProvideErrorMetadata) trait -/// on the error type. -/// -/// This struct intentionally doesn't yield any useful information itself. -#[deprecated( - note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \ -variable wildcard pattern and check `.code()`: - \ -   `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }` - \ -See [`ProvideErrorMetadata`](::aws_smithy_types::error::metadata::ProvideErrorMetadata) for what information is available for the error." -)] -#[derive(Debug)] -pub struct Unhandled { - pub(crate) source: ::aws_smithy_runtime_api::box_error::BoxError, - pub(crate) meta: ::aws_smithy_types::error::metadata::ErrorMetadata, -} - -impl UpcastObject for Unhandled { - ::dafny_runtime::UpcastObjectFn!(dyn ::std::any::Any); -} diff --git a/TestModels/Positional/runtimes/rust/src/operation.rs b/TestModels/Positional/runtimes/rust/src/operation.rs deleted file mode 100644 index 3fbef49ff..000000000 --- a/TestModels/Positional/runtimes/rust/src/operation.rs +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -/// Types for the `GetName` operation. -pub mod get_name; - -/// Types for the `GetResource` operation. -pub mod get_resource; - -/// Types for the `GetResourcePositional` operation. -pub mod get_resource_positional; diff --git a/TestModels/Positional/runtimes/rust/src/operation/get_name.rs b/TestModels/Positional/runtimes/rust/src/operation/get_name.rs deleted file mode 100644 index 6952c937e..000000000 --- a/TestModels/Positional/runtimes/rust/src/operation/get_name.rs +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -/// Orchestration and serialization glue logic for `GetName`. -#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)] -#[non_exhaustive] -pub struct GetName; -impl GetName { - /// Creates a new `GetName` - pub fn new() -> Self { - Self - } - - pub(crate) async fn send( - simple_resource: &crate::types::simple_resource::SimpleResourceRef, - input: crate::operation::get_name::GetNameInput, - ) -> ::std::result::Result< - crate::operation::get_name::GetNameOutput, - crate::types::error::Error, - > { - - simple_resource.inner.borrow_mut().get_name(input) - } -} - -pub use crate::operation::get_name::_get_name_output::GetNameOutput; - -pub use crate::operation::get_name::_get_name_input::GetNameInput; - -pub(crate) mod _get_name_output; - -pub(crate) mod _get_name_input; - -/// Builders -pub mod builders; diff --git a/TestModels/Positional/runtimes/rust/src/operation/get_name/_get_name_input.rs b/TestModels/Positional/runtimes/rust/src/operation/get_name/_get_name_input.rs deleted file mode 100644 index 7b8ed07bf..000000000 --- a/TestModels/Positional/runtimes/rust/src/operation/get_name/_get_name_input.rs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(missing_docs)] // documentation missing in model -#[non_exhaustive] -#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] -pub struct GetNameInput { - -} -impl GetNameInput { - -} -impl GetNameInput { - /// Creates a new builder-style object to manufacture [`GetNameInput`](crate::operation::get_name::builders::GetNameInput). - pub fn builder() -> crate::operation::get_name::builders::GetNameInputBuilder { - crate::operation::get_name::builders::GetNameInputBuilder::default() - } -} - -/// A builder for [`GetNameInput`](crate::operation::operation::GetNameInput). -#[non_exhaustive] -#[derive( - ::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug, -)] -pub struct GetNameInputBuilder { - -} -impl GetNameInputBuilder { - - /// Consumes the builder and constructs a [`GetNameInput`](crate::operation::operation::GetNameInput). - pub fn build( - self, - ) -> ::std::result::Result< - crate::operation::get_name::GetNameInput, - ::aws_smithy_types::error::operation::BuildError, - > { - ::std::result::Result::Ok(crate::operation::get_name::GetNameInput { - - }) - } -} diff --git a/TestModels/Positional/runtimes/rust/src/operation/get_name/_get_name_output.rs b/TestModels/Positional/runtimes/rust/src/operation/get_name/_get_name_output.rs deleted file mode 100644 index 4934d169f..000000000 --- a/TestModels/Positional/runtimes/rust/src/operation/get_name/_get_name_output.rs +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(missing_docs)] // documentation missing in model -#[non_exhaustive] -#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] -pub struct GetNameOutput { - #[allow(missing_docs)] // documentation missing in model -pub name: ::std::option::Option<::std::string::String>, -} -impl GetNameOutput { - #[allow(missing_docs)] // documentation missing in model -pub fn name(&self) -> &::std::option::Option<::std::string::String> { - &self.name -} -} -impl GetNameOutput { - /// Creates a new builder-style object to manufacture [`GetNameOutput`](crate::operation::get_name::builders::GetNameOutput). - pub fn builder() -> crate::operation::get_name::builders::GetNameOutputBuilder { - crate::operation::get_name::builders::GetNameOutputBuilder::default() - } -} - -/// A builder for [`GetNameOutput`](crate::operation::operation::GetNameOutput). -#[non_exhaustive] -#[derive( - ::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug, -)] -pub struct GetNameOutputBuilder { - pub(crate) name: ::std::option::Option<::std::string::String>, -} -impl GetNameOutputBuilder { - #[allow(missing_docs)] // documentation missing in model -pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { - self.name = ::std::option::Option::Some(input.into()); - self -} -#[allow(missing_docs)] // documentation missing in model -pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self { - self.name = input; - self -} -#[allow(missing_docs)] // documentation missing in model -pub fn get_name(&self) -> &::std::option::Option<::std::string::String> { - &self.name -} - /// Consumes the builder and constructs a [`GetNameOutput`](crate::operation::operation::GetNameOutput). - pub fn build( - self, - ) -> ::std::result::Result< - crate::operation::get_name::GetNameOutput, - ::aws_smithy_types::error::operation::BuildError, - > { - ::std::result::Result::Ok(crate::operation::get_name::GetNameOutput { - name: self.name, - }) - } -} diff --git a/TestModels/Positional/runtimes/rust/src/operation/get_name/builders.rs b/TestModels/Positional/runtimes/rust/src/operation/get_name/builders.rs deleted file mode 100644 index 76d401021..000000000 --- a/TestModels/Positional/runtimes/rust/src/operation/get_name/builders.rs +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -pub use crate::operation::get_name::_get_name_output::GetNameOutputBuilder; - -pub use crate::operation::get_name::_get_name_input::GetNameInputBuilder; - -impl GetNameInputBuilder { - /// Sends a request with this input using the given client. - pub async fn send_with( - self, - simple_resource: &crate::types::simple_resource::SimpleResourceRef, - ) -> ::std::result::Result< - crate::operation::get_name::GetNameOutput, - crate::types::error::Error, - > { - let mut fluent_builder = simple_resource.get_name(); - fluent_builder.inner = self; - fluent_builder.send().await - } -} -/// Fluent builder constructing a request to `GetName`. -/// -#[derive(::std::clone::Clone, ::std::fmt::Debug)] -pub struct GetNameFluentBuilder { - simple_resource: crate::types::simple_resource::SimpleResourceRef, - pub(crate) inner: crate::operation::get_name::builders::GetNameInputBuilder, -} -impl GetNameFluentBuilder { - /// Creates a new `GetName`. - pub(crate) fn new(simple_resource: crate::types::simple_resource::SimpleResourceRef) -> Self { - Self { - simple_resource, - inner: ::std::default::Default::default(), - } - } - /// Access the GetName as a reference. - pub fn as_input(&self) -> &crate::operation::get_name::builders::GetNameInputBuilder { - &self.inner - } - /// Sends the request and returns the response. - pub async fn send( - self, - ) -> ::std::result::Result< - crate::operation::get_name::GetNameOutput, - crate::types::error::Error, - > { - let input = self - .inner - .build() - // Using Opaque since we don't have a validation-specific error yet. - // Operations' models don't declare their own validation error, - // and smithy-rs seems to not generate a ValidationError case unless there is. - // Vanilla smithy-rs uses SdkError::construction_failure, but we aren't using SdkError. - .map_err(|mut e| crate::types::error::Error::Opaque { - obj: ::dafny_runtime::Object::from_ref(&mut e as &mut dyn ::std::any::Any) - })?; - crate::operation::get_name::GetName::send(&self.simple_resource, input).await - } - - -} diff --git a/TestModels/Positional/runtimes/rust/src/operation/get_resource.rs b/TestModels/Positional/runtimes/rust/src/operation/get_resource.rs deleted file mode 100644 index cc11676e4..000000000 --- a/TestModels/Positional/runtimes/rust/src/operation/get_resource.rs +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -/// Orchestration and serialization glue logic for `GetResource`. -#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)] -#[non_exhaustive] -pub struct GetResource; -impl GetResource { - /// Creates a new `GetResource` - pub fn new() -> Self { - Self - } - - pub(crate) async fn send( - client: &crate::client::Client, - input: crate::operation::get_resource::GetResourceInput, - ) -> ::std::result::Result< - crate::operation::get_resource::GetResourceOutput, - crate::types::error::Error, - > { - if input.name.is_none() { - return ::std::result::Result::Err(::aws_smithy_types::error::operation::BuildError::missing_field( - "name", - "name was not specified but it is required when building GetResourceInput", - )).map_err(crate::types::error::Error::wrap_validation_err); -} - let inner_input = crate::conversions::get_resource::_get_resource_input::to_dafny(input); - let inner_result = - ::dafny_runtime::md!(client.dafny_client.clone()).GetResource(&inner_input); - if matches!( - inner_result.as_ref(), - crate::r#_Wrappers_Compile::Result::Success { .. } - ) { - Ok( - crate::conversions::get_resource::_get_resource_output::from_dafny(inner_result.value().clone()), - ) - } else { - Err(crate::conversions::error::from_dafny( - inner_result.error().clone(), - )) - } - } -} - -pub use crate::operation::get_resource::_get_resource_output::GetResourceOutput; - -pub use crate::operation::get_resource::_get_resource_input::GetResourceInput; - -pub(crate) mod _get_resource_output; - -pub(crate) mod _get_resource_input; - -/// Builders -pub mod builders; diff --git a/TestModels/Positional/runtimes/rust/src/operation/get_resource/_get_resource_input.rs b/TestModels/Positional/runtimes/rust/src/operation/get_resource/_get_resource_input.rs deleted file mode 100644 index b6f3a7c3c..000000000 --- a/TestModels/Positional/runtimes/rust/src/operation/get_resource/_get_resource_input.rs +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(missing_docs)] // documentation missing in model -#[non_exhaustive] -#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] -pub struct GetResourceInput { - #[allow(missing_docs)] // documentation missing in model -pub name: ::std::option::Option<::std::string::String>, -} -impl GetResourceInput { - #[allow(missing_docs)] // documentation missing in model -pub fn name(&self) -> &::std::option::Option<::std::string::String> { - &self.name -} -} -impl GetResourceInput { - /// Creates a new builder-style object to manufacture [`GetResourceInput`](crate::operation::get_resource::builders::GetResourceInput). - pub fn builder() -> crate::operation::get_resource::builders::GetResourceInputBuilder { - crate::operation::get_resource::builders::GetResourceInputBuilder::default() - } -} - -/// A builder for [`GetResourceInput`](crate::operation::operation::GetResourceInput). -#[non_exhaustive] -#[derive( - ::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug, -)] -pub struct GetResourceInputBuilder { - pub(crate) name: ::std::option::Option<::std::string::String>, -} -impl GetResourceInputBuilder { - #[allow(missing_docs)] // documentation missing in model -pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { - self.name = ::std::option::Option::Some(input.into()); - self -} -#[allow(missing_docs)] // documentation missing in model -pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self { - self.name = input; - self -} -#[allow(missing_docs)] // documentation missing in model -pub fn get_name(&self) -> &::std::option::Option<::std::string::String> { - &self.name -} - /// Consumes the builder and constructs a [`GetResourceInput`](crate::operation::operation::GetResourceInput). - pub fn build( - self, - ) -> ::std::result::Result< - crate::operation::get_resource::GetResourceInput, - ::aws_smithy_types::error::operation::BuildError, - > { - ::std::result::Result::Ok(crate::operation::get_resource::GetResourceInput { - name: self.name, - }) - } -} diff --git a/TestModels/Positional/runtimes/rust/src/operation/get_resource/_get_resource_output.rs b/TestModels/Positional/runtimes/rust/src/operation/get_resource/_get_resource_output.rs deleted file mode 100644 index be413f1e2..000000000 --- a/TestModels/Positional/runtimes/rust/src/operation/get_resource/_get_resource_output.rs +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(missing_docs)] // documentation missing in model -#[non_exhaustive] -#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] -pub struct GetResourceOutput { - #[allow(missing_docs)] // documentation missing in model -pub output: ::std::option::Option, -} -impl GetResourceOutput { - #[allow(missing_docs)] // documentation missing in model -pub fn output(&self) -> &::std::option::Option { - &self.output -} -} -impl GetResourceOutput { - /// Creates a new builder-style object to manufacture [`GetResourceOutput`](crate::operation::get_resource::builders::GetResourceOutput). - pub fn builder() -> crate::operation::get_resource::builders::GetResourceOutputBuilder { - crate::operation::get_resource::builders::GetResourceOutputBuilder::default() - } -} - -/// A builder for [`GetResourceOutput`](crate::operation::operation::GetResourceOutput). -#[non_exhaustive] -#[derive( - ::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug, -)] -pub struct GetResourceOutputBuilder { - pub(crate) output: ::std::option::Option, -} -impl GetResourceOutputBuilder { - #[allow(missing_docs)] // documentation missing in model -pub fn output(mut self, input: impl ::std::convert::Into) -> Self { - self.output = ::std::option::Option::Some(input.into()); - self -} -#[allow(missing_docs)] // documentation missing in model -pub fn set_output(mut self, input: ::std::option::Option) -> Self { - self.output = input; - self -} -#[allow(missing_docs)] // documentation missing in model -pub fn get_output(&self) -> &::std::option::Option { - &self.output -} - /// Consumes the builder and constructs a [`GetResourceOutput`](crate::operation::operation::GetResourceOutput). - pub fn build( - self, - ) -> ::std::result::Result< - crate::operation::get_resource::GetResourceOutput, - ::aws_smithy_types::error::operation::BuildError, - > { - ::std::result::Result::Ok(crate::operation::get_resource::GetResourceOutput { - output: self.output, - }) - } -} diff --git a/TestModels/Positional/runtimes/rust/src/operation/get_resource/builders.rs b/TestModels/Positional/runtimes/rust/src/operation/get_resource/builders.rs deleted file mode 100644 index 55991c469..000000000 --- a/TestModels/Positional/runtimes/rust/src/operation/get_resource/builders.rs +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -pub use crate::operation::get_resource::_get_resource_output::GetResourceOutputBuilder; - -pub use crate::operation::get_resource::_get_resource_input::GetResourceInputBuilder; - -impl GetResourceInputBuilder { - /// Sends a request with this input using the given client. - pub async fn send_with( - self, - client: &crate::client::Client, - ) -> ::std::result::Result< - crate::operation::get_resource::GetResourceOutput, - crate::types::error::Error, - > { - let mut fluent_builder = client.get_resource(); - fluent_builder.inner = self; - fluent_builder.send().await - } -} -/// Fluent builder constructing a request to `GetResource`. -/// -#[derive(::std::clone::Clone, ::std::fmt::Debug)] -pub struct GetResourceFluentBuilder { - client: crate::client::Client, - pub(crate) inner: crate::operation::get_resource::builders::GetResourceInputBuilder, -} -impl GetResourceFluentBuilder { - /// Creates a new `GetResource`. - pub(crate) fn new(client: crate::client::Client) -> Self { - Self { - client, - inner: ::std::default::Default::default(), - } - } - /// Access the GetResource as a reference. - pub fn as_input(&self) -> &crate::operation::get_resource::builders::GetResourceInputBuilder { - &self.inner - } - /// Sends the request and returns the response. - pub async fn send( - self, - ) -> ::std::result::Result< - crate::operation::get_resource::GetResourceOutput, - crate::types::error::Error, - > { - let input = self - .inner - .build() - // Using Opaque since we don't have a validation-specific error yet. - // Operations' models don't declare their own validation error, - // and smithy-rs seems to not generate a ValidationError case unless there is. - // Vanilla smithy-rs uses SdkError::construction_failure, but we aren't using SdkError. - .map_err(|mut e| crate::types::error::Error::Opaque { - obj: ::dafny_runtime::Object::from_ref(&mut e as &mut dyn ::std::any::Any) - })?; - crate::operation::get_resource::GetResource::send(&self.client, input).await - } - - #[allow(missing_docs)] // documentation missing in model -pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { - self.inner = self.inner.name(input.into()); - self -} -#[allow(missing_docs)] // documentation missing in model -pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self { - self.inner = self.inner.set_name(input); - self -} -#[allow(missing_docs)] // documentation missing in model -pub fn get_name(&self) -> &::std::option::Option<::std::string::String> { - self.inner.get_name() -} -} diff --git a/TestModels/Positional/runtimes/rust/src/operation/get_resource_positional.rs b/TestModels/Positional/runtimes/rust/src/operation/get_resource_positional.rs deleted file mode 100644 index 9fb668a91..000000000 --- a/TestModels/Positional/runtimes/rust/src/operation/get_resource_positional.rs +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -/// Orchestration and serialization glue logic for `GetResourcePositional`. -#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)] -#[non_exhaustive] -pub struct GetResourcePositional; -impl GetResourcePositional { - /// Creates a new `GetResourcePositional` - pub fn new() -> Self { - Self - } - - pub(crate) async fn send( - client: &crate::client::Client, - input: crate::operation::get_resource_positional::GetResourcePositionalInput, - ) -> ::std::result::Result< - crate::types::simple_resource::SimpleResourceRef, - crate::types::error::Error, - > { - if input.name.is_none() { - return ::std::result::Result::Err(::aws_smithy_types::error::operation::BuildError::missing_field( - "name", - "name was not specified but it is required when building GetResourcePositionalInput", - )).map_err(crate::types::error::Error::wrap_validation_err); -} - let inner_input = crate::standard_library_conversions::ostring_to_dafny(&input.name) .Extract(); - let inner_result = - ::dafny_runtime::md!(client.dafny_client.clone()).GetResourcePositional(&inner_input); - if matches!( - inner_result.as_ref(), - crate::r#_Wrappers_Compile::Result::Success { .. } - ) { - Ok( - crate::conversions::simple_resource::from_dafny(inner_result.value().clone()) -, - ) - } else { - Err(crate::conversions::error::from_dafny( - inner_result.error().clone(), - )) - } - } -} - -pub use crate::operation::get_resource_positional::_get_resource_positional_output::GetResourcePositionalOutput; - -pub use crate::operation::get_resource_positional::_get_resource_positional_input::GetResourcePositionalInput; - -pub(crate) mod _get_resource_positional_output; - -pub(crate) mod _get_resource_positional_input; - -/// Builders -pub mod builders; diff --git a/TestModels/Positional/runtimes/rust/src/operation/get_resource_positional/_get_resource_positional_input.rs b/TestModels/Positional/runtimes/rust/src/operation/get_resource_positional/_get_resource_positional_input.rs deleted file mode 100644 index 4979acb65..000000000 --- a/TestModels/Positional/runtimes/rust/src/operation/get_resource_positional/_get_resource_positional_input.rs +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(missing_docs)] // documentation missing in model -#[non_exhaustive] -#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] -pub struct GetResourcePositionalInput { - #[allow(missing_docs)] // documentation missing in model -pub name: ::std::option::Option<::std::string::String>, -} -impl GetResourcePositionalInput { - #[allow(missing_docs)] // documentation missing in model -pub fn name(&self) -> &::std::option::Option<::std::string::String> { - &self.name -} -} -impl GetResourcePositionalInput { - /// Creates a new builder-style object to manufacture [`GetResourcePositionalInput`](crate::operation::get_resource_positional::builders::GetResourcePositionalInput). - pub fn builder() -> crate::operation::get_resource_positional::builders::GetResourcePositionalInputBuilder { - crate::operation::get_resource_positional::builders::GetResourcePositionalInputBuilder::default() - } -} - -/// A builder for [`GetResourcePositionalInput`](crate::operation::operation::GetResourcePositionalInput). -#[non_exhaustive] -#[derive( - ::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug, -)] -pub struct GetResourcePositionalInputBuilder { - pub(crate) name: ::std::option::Option<::std::string::String>, -} -impl GetResourcePositionalInputBuilder { - #[allow(missing_docs)] // documentation missing in model -pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { - self.name = ::std::option::Option::Some(input.into()); - self -} -#[allow(missing_docs)] // documentation missing in model -pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self { - self.name = input; - self -} -#[allow(missing_docs)] // documentation missing in model -pub fn get_name(&self) -> &::std::option::Option<::std::string::String> { - &self.name -} - /// Consumes the builder and constructs a [`GetResourcePositionalInput`](crate::operation::operation::GetResourcePositionalInput). - pub fn build( - self, - ) -> ::std::result::Result< - crate::operation::get_resource_positional::GetResourcePositionalInput, - ::aws_smithy_types::error::operation::BuildError, - > { - ::std::result::Result::Ok(crate::operation::get_resource_positional::GetResourcePositionalInput { - name: self.name, - }) - } -} diff --git a/TestModels/Positional/runtimes/rust/src/operation/get_resource_positional/_get_resource_positional_output.rs b/TestModels/Positional/runtimes/rust/src/operation/get_resource_positional/_get_resource_positional_output.rs deleted file mode 100644 index 1deb9a7be..000000000 --- a/TestModels/Positional/runtimes/rust/src/operation/get_resource_positional/_get_resource_positional_output.rs +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(missing_docs)] // documentation missing in model -#[non_exhaustive] -#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] -pub struct GetResourcePositionalOutput { - #[allow(missing_docs)] // documentation missing in model -pub output: ::std::option::Option, -} -impl GetResourcePositionalOutput { - #[allow(missing_docs)] // documentation missing in model -pub fn output(&self) -> &::std::option::Option { - &self.output -} -} -impl GetResourcePositionalOutput { - /// Creates a new builder-style object to manufacture [`GetResourcePositionalOutput`](crate::operation::get_resource_positional::builders::GetResourcePositionalOutput). - pub fn builder() -> crate::operation::get_resource_positional::builders::GetResourcePositionalOutputBuilder { - crate::operation::get_resource_positional::builders::GetResourcePositionalOutputBuilder::default() - } -} - -/// A builder for [`GetResourcePositionalOutput`](crate::operation::operation::GetResourcePositionalOutput). -#[non_exhaustive] -#[derive( - ::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug, -)] -pub struct GetResourcePositionalOutputBuilder { - pub(crate) output: ::std::option::Option, -} -impl GetResourcePositionalOutputBuilder { - #[allow(missing_docs)] // documentation missing in model -pub fn output(mut self, input: impl ::std::convert::Into) -> Self { - self.output = ::std::option::Option::Some(input.into()); - self -} -#[allow(missing_docs)] // documentation missing in model -pub fn set_output(mut self, input: ::std::option::Option) -> Self { - self.output = input; - self -} -#[allow(missing_docs)] // documentation missing in model -pub fn get_output(&self) -> &::std::option::Option { - &self.output -} - /// Consumes the builder and constructs a [`GetResourcePositionalOutput`](crate::operation::operation::GetResourcePositionalOutput). - pub fn build( - self, - ) -> ::std::result::Result< - crate::operation::get_resource_positional::GetResourcePositionalOutput, - ::aws_smithy_types::error::operation::BuildError, - > { - ::std::result::Result::Ok(crate::operation::get_resource_positional::GetResourcePositionalOutput { - output: self.output, - }) - } -} diff --git a/TestModels/Positional/runtimes/rust/src/operation/get_resource_positional/builders.rs b/TestModels/Positional/runtimes/rust/src/operation/get_resource_positional/builders.rs deleted file mode 100644 index 5d8e41c8d..000000000 --- a/TestModels/Positional/runtimes/rust/src/operation/get_resource_positional/builders.rs +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -pub use crate::operation::get_resource_positional::_get_resource_positional_output::GetResourcePositionalOutputBuilder; - -pub use crate::operation::get_resource_positional::_get_resource_positional_input::GetResourcePositionalInputBuilder; - -impl GetResourcePositionalInputBuilder { - /// Sends a request with this input using the given client. - pub async fn send_with( - self, - client: &crate::client::Client, - ) -> ::std::result::Result< - crate::types::simple_resource::SimpleResourceRef, - crate::types::error::Error, - > { - let mut fluent_builder = client.get_resource_positional(); - fluent_builder.inner = self; - fluent_builder.send().await - } -} -/// Fluent builder constructing a request to `GetResourcePositional`. -/// -#[derive(::std::clone::Clone, ::std::fmt::Debug)] -pub struct GetResourcePositionalFluentBuilder { - client: crate::client::Client, - pub(crate) inner: crate::operation::get_resource_positional::builders::GetResourcePositionalInputBuilder, -} -impl GetResourcePositionalFluentBuilder { - /// Creates a new `GetResourcePositional`. - pub(crate) fn new(client: crate::client::Client) -> Self { - Self { - client, - inner: ::std::default::Default::default(), - } - } - /// Access the GetResourcePositional as a reference. - pub fn as_input(&self) -> &crate::operation::get_resource_positional::builders::GetResourcePositionalInputBuilder { - &self.inner - } - /// Sends the request and returns the response. - pub async fn send( - self, - ) -> ::std::result::Result< - crate::types::simple_resource::SimpleResourceRef, - crate::types::error::Error, - > { - let input = self - .inner - .build() - // Using Opaque since we don't have a validation-specific error yet. - // Operations' models don't declare their own validation error, - // and smithy-rs seems to not generate a ValidationError case unless there is. - // Vanilla smithy-rs uses SdkError::construction_failure, but we aren't using SdkError. - .map_err(|mut e| crate::types::error::Error::Opaque { - obj: ::dafny_runtime::Object::from_ref(&mut e as &mut dyn ::std::any::Any) - })?; - crate::operation::get_resource_positional::GetResourcePositional::send(&self.client, input).await - } - - #[allow(missing_docs)] // documentation missing in model -pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { - self.inner = self.inner.name(input.into()); - self -} -#[allow(missing_docs)] // documentation missing in model -pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self { - self.inner = self.inner.set_name(input); - self -} -#[allow(missing_docs)] // documentation missing in model -pub fn get_name(&self) -> &::std::option::Option<::std::string::String> { - self.inner.get_name() -} -} diff --git a/TestModels/Positional/runtimes/rust/src/standard_library_conversions.rs b/TestModels/Positional/runtimes/rust/src/standard_library_conversions.rs deleted file mode 100644 index 6bf8297d8..000000000 --- a/TestModels/Positional/runtimes/rust/src/standard_library_conversions.rs +++ /dev/null @@ -1,266 +0,0 @@ -pub fn ostring_to_dafny( - input: &Option, -) -> ::std::rc::Rc< - crate::_Wrappers_Compile::Option<::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>>, -> { - let dafny_value = match input { - Some(b) => crate::_Wrappers_Compile::Option::Some { value: - dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&b) - }, - None => crate::_Wrappers_Compile::Option::None {}, -}; - ::std::rc::Rc::new(dafny_value) -} - -pub fn ostring_from_dafny( - input: ::std::rc::Rc< - crate::_Wrappers_Compile::Option< - ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, - >, - >, -) -> Option { - if matches!( - input.as_ref(), - crate::_Wrappers_Compile::Option::Some { .. } - ) { - Some( - dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string( - &input.Extract(), - ), - ) - } else { - None - } -} - -pub fn obool_to_dafny( - input: &Option, -) -> ::std::rc::Rc> { - let dafny_value = match input { - Some(b) => crate::_Wrappers_Compile::Option::Some { value: *b }, - None => crate::_Wrappers_Compile::Option::None {}, - }; - ::std::rc::Rc::new(dafny_value) -} - -pub fn obool_from_dafny( - input: ::std::rc::Rc>, -) -> Option { - if matches!( - input.as_ref(), - crate::_Wrappers_Compile::Option::Some { .. } - ) { - Some(input.Extract()) - } else { - None - } -} - -pub fn oint_to_dafny(input: Option) -> ::std::rc::Rc> { - let dafny_value = match input { - Some(b) => crate::_Wrappers_Compile::Option::Some { value: b }, - None => crate::_Wrappers_Compile::Option::None {}, - }; - ::std::rc::Rc::new(dafny_value) -} - -pub fn oint_from_dafny(input: ::std::rc::Rc>) -> Option { - if matches!( - input.as_ref(), - crate::_Wrappers_Compile::Option::Some { .. } - ) { - Some(input.Extract()) - } else { - None - } -} - -pub fn olong_to_dafny(input: &Option) -> ::std::rc::Rc> { - let dafny_value = match input { - Some(b) => crate::_Wrappers_Compile::Option::Some { value: *b }, - None => crate::_Wrappers_Compile::Option::None {}, - }; - ::std::rc::Rc::new(dafny_value) -} - -pub fn olong_from_dafny( - input: ::std::rc::Rc>, -) -> Option { - if matches!( - input.as_ref(), - crate::_Wrappers_Compile::Option::Some { .. } - ) { - Some(input.Extract()) - } else { - None - } -} - -pub fn blob_to_dafny(input: &::aws_smithy_types::Blob) -> ::dafny_runtime::Sequence { - ::dafny_runtime::dafny_runtime_conversions::vec_to_dafny_sequence(&input.clone().into_inner(), |x| *x) -} - -pub fn oblob_to_dafny( - input: &Option<::aws_smithy_types::Blob>, -) -> ::std::rc::Rc>> { - let dafny_value = match input { - Some(b) => crate::_Wrappers_Compile::Option::Some { - value: blob_to_dafny(&b), - }, - None => crate::_Wrappers_Compile::Option::None {}, - }; - ::std::rc::Rc::new(dafny_value) -} - -pub fn blob_from_dafny(input: ::dafny_runtime::Sequence) -> ::aws_smithy_types::Blob { - ::aws_smithy_types::Blob::new( - ::std::rc::Rc::try_unwrap(input.to_array()).unwrap_or_else(|rc| (*rc).clone()), - ) -} - -pub fn oblob_from_dafny( - input: ::std::rc::Rc>>, -) -> Option<::aws_smithy_types::Blob> { - if matches!( - input.as_ref(), - crate::_Wrappers_Compile::Option::Some { .. } - ) { - Some(blob_from_dafny(input.Extract())) - } else { - None - } -} - -pub fn double_to_dafny(input: f64) -> ::dafny_runtime::Sequence { - ::dafny_runtime::dafny_runtime_conversions::vec_to_dafny_sequence( - &f64::to_be_bytes(input).to_vec(), - |x| *x, - ) -} - -pub fn odouble_to_dafny( - input: &Option, -) -> ::std::rc::Rc>> { - let dafny_value = match input { - Some(f) => crate::_Wrappers_Compile::Option::Some { - value: double_to_dafny(*f), - }, - None => crate::_Wrappers_Compile::Option::None {}, - }; - ::std::rc::Rc::new(dafny_value) -} - -pub fn double_from_dafny(input: &::dafny_runtime::Sequence) -> f64 { - let v = ::dafny_runtime::dafny_runtime_conversions::dafny_sequence_to_vec(input, |x| *x); - f64::from_be_bytes(v.try_into().expect("Error converting Sequence to f64")) -} - -pub fn odouble_from_dafny( - input: ::std::rc::Rc>>, -) -> Option { - if matches!( - input.as_ref(), - crate::_Wrappers_Compile::Option::Some { .. } - ) { - Some(double_from_dafny(&input.Extract())) - } else { - None - } -} - -pub fn timestamp_to_dafny( - input: &::aws_smithy_types::DateTime, -) -> ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16> { - ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string( - &input.to_string(), - ) -} - -pub fn otimestamp_to_dafny( - input: &Option<::aws_smithy_types::DateTime>, -) -> ::std::rc::Rc< - crate::_Wrappers_Compile::Option<::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>>, -> { - let dafny_value = match input { - Some(f) => crate::_Wrappers_Compile::Option::Some { - value: timestamp_to_dafny(f), - }, - None => crate::_Wrappers_Compile::Option::None {}, - }; - ::std::rc::Rc::new(dafny_value) -} - -pub fn timestamp_from_dafny( - input: ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, -) -> ::aws_smithy_types::DateTime { - let s = dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string( - &input, - ); - ::aws_smithy_types::DateTime::from_str(&s, aws_smithy_types::date_time::Format::DateTime) - .unwrap() -} - -pub fn otimestamp_from_dafny( - input: ::std::rc::Rc< - crate::_Wrappers_Compile::Option< - ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, - >, - >, -) -> Option<::aws_smithy_types::DateTime> { - if matches!( - input.as_ref(), - crate::_Wrappers_Compile::Option::Some { .. } - ) { - Some(timestamp_from_dafny(input.Extract())) - } else { - None - } -} - -pub fn option_from_dafny( - input: ::std::rc::Rc>, - converter: fn(&T) -> TR, -) -> Option { - match &*input { - crate::_Wrappers_Compile::Option::Some { value } => Some(converter(value)), - crate::_Wrappers_Compile::Option::None {} => None, - } -} - -pub fn option_to_dafny( - input: &Option, - converter: fn(&TR) -> T, -) -> ::std::rc::Rc> { - match input { - Some(value) => ::std::rc::Rc::new(crate::_Wrappers_Compile::Option::Some { - value: converter(&value), - }), - None => ::std::rc::Rc::new(crate::_Wrappers_Compile::Option::None {}), - } -} - -pub fn result_from_dafny( - input: ::std::rc::Rc>, - converter_t: fn(&T) -> TR, - converter_e: fn(&E) -> ER, -) -> Result { - match &*input { - crate::_Wrappers_Compile::Result::Success { value } => Ok(converter_t(value)), - crate::_Wrappers_Compile::Result::Failure { error } => Err(converter_e(error)), - } -} - -pub fn result_to_dafny( - input: &Result, - converter_t: fn(&TR) -> T, - converter_e: fn(&ER) -> E, -) -> ::std::rc::Rc> { - match input { - Ok(value) => ::std::rc::Rc::new(crate::_Wrappers_Compile::Result::Success { - value: converter_t(&value), - }), - Err(error) => ::std::rc::Rc::new(crate::_Wrappers_Compile::Result::Failure { - error: converter_e(&error), - }), - } -} diff --git a/TestModels/Positional/runtimes/rust/src/standard_library_externs.rs b/TestModels/Positional/runtimes/rust/src/standard_library_externs.rs deleted file mode 100644 index eca6a2980..000000000 --- a/TestModels/Positional/runtimes/rust/src/standard_library_externs.rs +++ /dev/null @@ -1,80 +0,0 @@ -// Annotation to ignore the case of this module -use crate::r#_Wrappers_Compile; -use crate::UTF8; - -impl crate::UTF8::_default { - pub fn Encode( - s: &::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, - ) -> ::std::rc::Rc< - r#_Wrappers_Compile::Result< - UTF8::ValidUTF8Bytes, - ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, - >, - > { - let v = s.to_array(); - let mut _accumulator: Vec = vec![]; - // Use of .encode_utf8 method. - let mut surrogate: Option = None; - for c in v.iter() { - let s = if let Some(s) = surrogate { - String::from_utf16(&[s, c.0]) - } else { - String::from_utf16(&[c.0]) - }; - surrogate = None; - match s { - Ok(value) => { - _accumulator.extend(value.as_bytes()); - continue; - } - Err(e) => { - if 0xD800 <= c.0 && c.0 <= 0xDFFF { - surrogate = Some(c.0); - continue; - } - return ::std::rc::Rc::new(r#_Wrappers_Compile::Result::>::Failure { - error: ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string( - &e.to_string()) - }); - } - } - } - if let Some(s) = surrogate { - return ::std::rc::Rc::new(r#_Wrappers_Compile::Result::>::Failure { - error: ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string( - &format!("Surrogate pair missing: 0x{:04x}", s)) - }); - } - ::std::rc::Rc::new(r#_Wrappers_Compile::Result::< - UTF8::ValidUTF8Bytes, - ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, - >::Success { - value: ::dafny_runtime::Sequence::from_array_owned(_accumulator), - }) - } - pub fn Decode( - b: &::dafny_runtime::Sequence, - ) -> ::std::rc::Rc< - r#_Wrappers_Compile::Result< - ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, - ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, - >, - > { - let b = String::from_utf8(b.to_array().as_ref().clone()); - match b { - Ok(s) => { - ::std::rc::Rc::new(r#_Wrappers_Compile::Result::<::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, - ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>>::Success { - value: ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&s) - }) - }, - Err(e) => { - return ::std::rc::Rc::new(r#_Wrappers_Compile::Result::<::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, - ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>>::Failure { - error: ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string( - &e.to_string()) - }) - } - } - } -} diff --git a/TestModels/Positional/runtimes/rust/src/types.rs b/TestModels/Positional/runtimes/rust/src/types.rs deleted file mode 100644 index 4f80ec298..000000000 --- a/TestModels/Positional/runtimes/rust/src/types.rs +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -/// Types for the `SimplePositionalConfig` -pub mod simple_positional_config; - -pub mod builders; - -pub mod simple_resource; -pub use simple_resource::SimpleResource; - - - -pub mod error; - - - diff --git a/TestModels/Positional/runtimes/rust/src/types/error.rs b/TestModels/Positional/runtimes/rust/src/types/error.rs deleted file mode 100644 index 4100dbd36..000000000 --- a/TestModels/Positional/runtimes/rust/src/types/error.rs +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[derive(::std::clone::Clone, ::std::fmt::Debug, ::std::cmp::PartialEq)] -pub enum Error { - SimplePositionalException { - message: ::std::string::String, -}, - CollectionOfErrors { - list: ::std::vec::Vec, - message: ::std::string::String, - }, - ValidationError(ValidationError), - Opaque { - obj: ::dafny_runtime::Object, - }, -} - -impl ::std::cmp::Eq for Error {} - -impl ::std::fmt::Display for Error { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - match self { - Self::ValidationError(err) => ::std::fmt::Display::fmt(err, f), - _ => ::std::fmt::Debug::fmt(self, f), - } - } -} - -impl ::std::error::Error for Error { - fn source(&self) -> Option<&(dyn std::error::Error + 'static)> { - match self { - Self::ValidationError(err) => Some(err), - _ => None, - } - } -} - -impl Error { - pub fn wrap_validation_err(err: E) -> Self - where - E: ::std::error::Error + 'static, - { - Self::ValidationError(ValidationError(::std::rc::Rc::new(err))) - } -} - -#[derive(::std::clone::Clone, ::std::fmt::Debug)] -pub(crate) struct ValidationError(::std::rc::Rc); - -impl ::std::cmp::PartialEq for ValidationError { - fn eq(&self, other: &Self) -> bool { - ::std::rc::Rc::<(dyn std::error::Error + 'static)>::ptr_eq(&self.0, &other.0) - } -} - -impl ::std::fmt::Display for ValidationError { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - ::std::fmt::Display::fmt(&self.0, f) - } -} - -impl ::std::error::Error for ValidationError { - fn source(&self) -> ::std::option::Option<&(dyn ::std::error::Error + 'static)> { - ::std::option::Option::Some(self.0.as_ref()) - } -} diff --git a/TestModels/Positional/runtimes/rust/src/types/simple_positional_config.rs b/TestModels/Positional/runtimes/rust/src/types/simple_positional_config.rs deleted file mode 100644 index fabdf061b..000000000 --- a/TestModels/Positional/runtimes/rust/src/types/simple_positional_config.rs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(missing_docs)] // documentation missing in model -#[non_exhaustive] -#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] -pub struct SimplePositionalConfig { - -} -impl SimplePositionalConfig { - -} -impl SimplePositionalConfig { - /// Creates a new builder-style object to manufacture [`SimplePositionalConfig`](crate::types::SimplePositionalConfig). - pub fn builder() -> crate::types::simple_positional_config::SimplePositionalConfigBuilder { - crate::types::simple_positional_config::SimplePositionalConfigBuilder::default() - } -} - -/// A builder for [`SimplePositionalConfig`](crate::types::SimplePositionalConfig). -#[non_exhaustive] -#[derive( - ::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug, -)] -pub struct SimplePositionalConfigBuilder { - -} -impl SimplePositionalConfigBuilder { - - /// Consumes the builder and constructs a [`SimplePositionalConfig`](crate::types::SimplePositionalConfig). - pub fn build( - self, - ) -> ::std::result::Result< - crate::types::simple_positional_config::SimplePositionalConfig, - ::aws_smithy_types::error::operation::BuildError, - > { - ::std::result::Result::Ok(crate::types::simple_positional_config::SimplePositionalConfig { - - }) - } -} diff --git a/TestModels/Positional/runtimes/rust/src/types/simple_resource.rs b/TestModels/Positional/runtimes/rust/src/types/simple_resource.rs deleted file mode 100644 index 736abe4ca..000000000 --- a/TestModels/Positional/runtimes/rust/src/types/simple_resource.rs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. - -pub trait SimpleResource { - fn get_name( - &mut self, - input: crate::operation::get_name::GetNameInput, - ) -> Result< - crate::operation::get_name::GetNameOutput, - crate::types::error::Error, - >; -} - -#[derive(::std::clone::Clone)] -pub struct SimpleResourceRef { - pub inner: ::std::rc::Rc> -} - -impl ::std::cmp::PartialEq for SimpleResourceRef { - fn eq(&self, other: &SimpleResourceRef) -> bool { - ::std::rc::Rc::ptr_eq(&self.inner, &other.inner) - } -} - -impl ::std::fmt::Debug for SimpleResourceRef { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(f, "") - } -} - -mod get_name; diff --git a/TestModels/Positional/runtimes/rust/src/types/simple_resource/get_name.rs b/TestModels/Positional/runtimes/rust/src/types/simple_resource/get_name.rs deleted file mode 100644 index b8d9830dc..000000000 --- a/TestModels/Positional/runtimes/rust/src/types/simple_resource/get_name.rs +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -impl crate::types::simple_resource::SimpleResourceRef { - /// Constructs a fluent builder for the [`GetName`](crate::operation::get_name::builders::GetNameFluentBuilder) operation. - /// - /// - The fluent builder is configurable: - - /// - On success, responds with [`GetNameOutput`](crate::operation::get_name::GetNameOutput) with field(s): - /// - [`name(Option<::std::string::String>)`](crate::operation::get_name::GetNameOutput::name): (undocumented) - /// - On failure, responds with [`SdkError`](crate::operation::get_name::GetNameError) - pub fn get_name(&self) -> crate::operation::get_name::builders::GetNameFluentBuilder { - crate::operation::get_name::builders::GetNameFluentBuilder::new(self.clone()) - } -} diff --git a/TestModels/Positional/runtimes/rust/src/wrapped.rs b/TestModels/Positional/runtimes/rust/src/wrapped.rs deleted file mode 100644 index 1825cf913..000000000 --- a/TestModels/Positional/runtimes/rust/src/wrapped.rs +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -pub mod client; - -impl crate::r#simple::positional::internaldafny::wrapped::_default { - pub fn WrappedSimplePositional(config: &::std::rc::Rc< - crate::r#simple::positional::internaldafny::types::SimplePositionalConfig, - >) -> ::std::rc::Rc, - ::std::rc::Rc - >>{ - crate::wrapped::client::Client::from_conf(config) - } -} diff --git a/TestModels/Positional/runtimes/rust/src/wrapped/client.rs b/TestModels/Positional/runtimes/rust/src/wrapped/client.rs deleted file mode 100644 index afb989813..000000000 --- a/TestModels/Positional/runtimes/rust/src/wrapped/client.rs +++ /dev/null @@ -1,113 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -use std::sync::LazyLock; - -pub struct Client { - wrapped: crate::client::Client -} - -/// A runtime for executing operations on the asynchronous client in a blocking manner. -/// Necessary because Dafny only generates synchronous code. -static dafny_tokio_runtime: LazyLock = LazyLock::new(|| { - tokio::runtime::Builder::new_multi_thread() - .enable_all() - .build() - .unwrap() -}); - -impl dafny_runtime::UpcastObject for Client { - ::dafny_runtime::UpcastObjectFn!(dyn crate::r#simple::positional::internaldafny::types::ISimplePositionalClient); -} - -impl dafny_runtime::UpcastObject for Client { - ::dafny_runtime::UpcastObjectFn!(dyn ::std::any::Any); -} - -impl Client { - pub fn from_conf(config: &::std::rc::Rc< - crate::r#simple::positional::internaldafny::types::SimplePositionalConfig, - >) -> -::std::rc::Rc, - ::std::rc::Rc ->> { - let result = crate::client::Client::from_conf( - crate::conversions::simple_positional_config::_simple_positional_config::from_dafny( - config.clone(), - ), - ); - match result { - Ok(client) => { - let wrap = crate::wrapped::client::Client { - wrapped: client - }; - std::rc::Rc::new( - crate::_Wrappers_Compile::Result::Success { - value: ::dafny_runtime::upcast_object()(::dafny_runtime::object::new(wrap)) - } - ) - }, - Err(error) => crate::conversions::error::to_opaque_error_result(error) - } - } -} - -impl crate::r#simple::positional::internaldafny::types::ISimplePositionalClient for Client { - fn GetResource( - &mut self, - input: &::std::rc::Rc, - ) -> std::rc::Rc< - crate::r#_Wrappers_Compile::Result< - ::std::rc::Rc, - std::rc::Rc, - >, - >{ - let inner_input = crate::conversions::get_resource::_get_resource_input::from_dafny(input.clone()); - let result = tokio::task::block_in_place(|| { - dafny_tokio_runtime.block_on(crate::operation::get_resource::GetResource::send(&self.wrapped, inner_input)) - }); - match result { - Err(error) => ::std::rc::Rc::new( - crate::_Wrappers_Compile::Result::Failure { - error: crate::conversions::error::to_dafny(error), - }, - ), - Ok(inner_result) => ::std::rc::Rc::new( - crate::_Wrappers_Compile::Result::Success { - value: crate::conversions::get_resource::_get_resource_output::to_dafny(inner_result), - }, - ), - } - } - - fn GetResourcePositional( - &mut self, - input: &::dafny_runtime::dafny_runtime_conversions::DafnySequence<::dafny_runtime::dafny_runtime_conversions::DafnyCharUTF16>, - ) -> std::rc::Rc< - crate::r#_Wrappers_Compile::Result< - ::dafny_runtime::Object, - std::rc::Rc, - >, - >{ - let inner_input = crate::operation::get_resource_positional::_get_resource_positional_input::GetResourcePositionalInput { - name: Some( dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(input) ) -}; - let result = tokio::task::block_in_place(|| { - dafny_tokio_runtime.block_on(crate::operation::get_resource_positional::GetResourcePositional::send(&self.wrapped, inner_input)) - }); - match result { - Err(error) => ::std::rc::Rc::new( - crate::_Wrappers_Compile::Result::Failure { - error: crate::conversions::error::to_dafny(error), - }, - ), - Ok(inner_result) => ::std::rc::Rc::new( - crate::_Wrappers_Compile::Result::Success { - value: crate::conversions::simple_resource::to_dafny(inner_result.clone()) -, - }, - ), - } - } -} diff --git a/TestModels/Refinement/Makefile b/TestModels/Refinement/Makefile index 75785a31b..cd5d6d080 100644 --- a/TestModels/Refinement/Makefile +++ b/TestModels/Refinement/Makefile @@ -13,6 +13,8 @@ NAMESPACE=simple.refinement PROJECT_SERVICES := \ SimpleRefinement +MAIN_SERVICE_FOR_RUST := SimpleRefinement + SERVICE_NAMESPACE_SimpleRefinement=simple.refinement SERVICE_DEPS_SimpleRefinement := diff --git a/TestModels/Positional/runtimes/rust/src/types/builders.rs b/TestModels/Refinement/runtimes/rust/src/deps.rs similarity index 81% rename from TestModels/Positional/runtimes/rust/src/types/builders.rs rename to TestModels/Refinement/runtimes/rust/src/deps.rs index 5fbbbaa0f..a5d3381b0 100644 --- a/TestModels/Positional/runtimes/rust/src/types/builders.rs +++ b/TestModels/Refinement/runtimes/rust/src/deps.rs @@ -1,3 +1,3 @@ // Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. \ No newline at end of file diff --git a/TestModels/Resource/Makefile b/TestModels/Resource/Makefile index 8fb52ed4c..b46d7cb7e 100644 --- a/TestModels/Resource/Makefile +++ b/TestModels/Resource/Makefile @@ -14,6 +14,8 @@ NAMESPACE=simple.resources PROJECT_SERVICES := \ SimpleResources +MAIN_SERVICE_FOR_RUST := SimpleResources + SERVICE_NAMESPACE_SimpleResources=simple.resources SERVICE_DEPS_SimpleResources := diff --git a/TestModels/Resource/runtimes/rust/tests/simple_resources_test.rs b/TestModels/Resource/runtimes/rust/tests/simple_resources_test.rs index a2b1d2e0e..8ae2617c9 100644 --- a/TestModels/Resource/runtimes/rust/tests/simple_resources_test.rs +++ b/TestModels/Resource/runtimes/rust/tests/simple_resources_test.rs @@ -1,6 +1,5 @@ -use simple_resource::SimpleResourceRef; +use simple_resources::types::simple_resource::SimpleResourceRef; use simple_resources::operation::get_resource_data::*; -use simple_resources::types::*; use simple_resources::*; #[tokio::test] diff --git a/TestModels/SharedMakefile.mk b/TestModels/SharedMakefile.mk index 54c93b5c0..fca8add34 100644 --- a/TestModels/SharedMakefile.mk +++ b/TestModels/SharedMakefile.mk @@ -76,14 +76,11 @@ _polymorph_python: _polymorph _polymorph_python: OUTPUT_PYTHON_WRAPPED=--output-python $(LIBRARY_ROOT)/runtimes/python/src/$(PYTHON_MODULE_NAME)/smithygenerated _polymorph_python: _polymorph_wrapped -_polymorph_rust: OUTPUT_RUST=--output-rust $(LIBRARY_ROOT)/runtimes/rust +_polymorph_rust: OUTPUT_RUST_WRAPPED=--output-rust $(LIBRARY_ROOT)/runtimes/rust _polymorph_rust: INPUT_DAFNY=\ --include-dafny $(PROJECT_ROOT)/$(STD_LIBRARY)/src/Index.dfy # For several TestModels we've just manually written the code generation target, # So we just want to ensure we can transpile and pass the tests in CI. # For those, make polymorph_rust should just be a no-op. -_polymorph_rust: $(if $(RUST_BENERATED), , _polymorph) -# TODO: This doesn't yet work for Rust because we are patching transpiled code, -# so this target will complain about "patch does not apply" because it was already applied. -# _polymorph_rust: OUTPUT_RUST_WRAPPED=--output-rust $(LIBRARY_ROOT)/runtimes/rust -# _polymorph_rust: _polymorph_wrapped +# We call _polymorph_wrapped directly because Rust builds everything at once. +_polymorph_rust: $(if $(RUST_BENERATED), , _polymorph_wrapped) diff --git a/TestModels/SimpleTypes/SimpleBlob/Makefile b/TestModels/SimpleTypes/SimpleBlob/Makefile index 02558869b..fa49668f5 100644 --- a/TestModels/SimpleTypes/SimpleBlob/Makefile +++ b/TestModels/SimpleTypes/SimpleBlob/Makefile @@ -14,6 +14,8 @@ NAMESPACE=simple.types.blob PROJECT_SERVICES := \ SimpleBlob +MAIN_SERVICE_FOR_RUST := SimpleBlob + SERVICE_NAMESPACE_SimpleBlob=simple.types.blob SERVICE_DEPS_SimpleBlob := diff --git a/TestModels/SimpleTypes/SimpleBoolean/Makefile b/TestModels/SimpleTypes/SimpleBoolean/Makefile index b36373b33..3b7e92dd4 100644 --- a/TestModels/SimpleTypes/SimpleBoolean/Makefile +++ b/TestModels/SimpleTypes/SimpleBoolean/Makefile @@ -14,6 +14,8 @@ NAMESPACE=simple.types.boolean PROJECT_SERVICES := \ SimpleBoolean +MAIN_SERVICE_FOR_RUST := SimpleBoolean + SERVICE_NAMESPACE_SimpleBoolean=simple.types.boolean SERVICE_DEPS_SimpleBoolean := diff --git a/TestModels/SimpleTypes/SimpleDouble/Makefile b/TestModels/SimpleTypes/SimpleDouble/Makefile index 2234e4d7d..6a7f80c3f 100644 --- a/TestModels/SimpleTypes/SimpleDouble/Makefile +++ b/TestModels/SimpleTypes/SimpleDouble/Makefile @@ -14,6 +14,8 @@ NAMESPACE=simple.types.smithyDouble PROJECT_SERVICES := \ SimpleDouble +MAIN_SERVICE_FOR_RUST := SimpleDouble + SERVICE_NAMESPACE_SimpleDouble=simple.types.smithyDouble SERVICE_DEPS_SimpleDouble := diff --git a/TestModels/SimpleTypes/SimpleEnum/Makefile b/TestModels/SimpleTypes/SimpleEnum/Makefile index e7b8fa0c6..84dcf9b98 100644 --- a/TestModels/SimpleTypes/SimpleEnum/Makefile +++ b/TestModels/SimpleTypes/SimpleEnum/Makefile @@ -14,6 +14,8 @@ NAMESPACE=simple.types.smithyEnum PROJECT_SERVICES := \ SimpleEnum +MAIN_SERVICE_FOR_RUST := SimpleEnum + SERVICE_NAMESPACE_SimpleEnum=simple.types.smithyEnum SERVICE_DEPS_SimpleEnum := diff --git a/TestModels/SimpleTypes/SimpleEnumV2/Makefile b/TestModels/SimpleTypes/SimpleEnumV2/Makefile index e2e94c319..469afd749 100644 --- a/TestModels/SimpleTypes/SimpleEnumV2/Makefile +++ b/TestModels/SimpleTypes/SimpleEnumV2/Makefile @@ -14,6 +14,8 @@ NAMESPACE=simple.types.enumV2 PROJECT_SERVICES := \ SimpleTypesEnumV2 +MAIN_SERVICE_FOR_RUST := SimpleTypesEnumV2 + SERVICE_NAMESPACE_SimpleTypesEnumV2=simple.types.enumV2 SERVICE_DEPS_SimpleTypesEnumV2 := diff --git a/TestModels/SimpleTypes/SimpleInteger/Makefile b/TestModels/SimpleTypes/SimpleInteger/Makefile index 4dd8bdbc1..79bc71a92 100644 --- a/TestModels/SimpleTypes/SimpleInteger/Makefile +++ b/TestModels/SimpleTypes/SimpleInteger/Makefile @@ -14,6 +14,8 @@ NAMESPACE=simple.types.integer PROJECT_SERVICES := \ SimpleInteger +MAIN_SERVICE_FOR_RUST := SimpleInteger + SERVICE_NAMESPACE_SimpleInteger=simple.types.integer SERVICE_DEPS_SimpleInteger := diff --git a/TestModels/SimpleTypes/SimpleLong/Makefile b/TestModels/SimpleTypes/SimpleLong/Makefile index 179bc2723..37158e304 100644 --- a/TestModels/SimpleTypes/SimpleLong/Makefile +++ b/TestModels/SimpleTypes/SimpleLong/Makefile @@ -14,6 +14,8 @@ NAMESPACE=simple.types.smithyLong PROJECT_SERVICES := \ SimpleLong +MAIN_SERVICE_FOR_RUST := SimpleLong + SERVICE_NAMESPACE_SimpleLong=simple.types.smithyLong SERVICE_DEPS_SimpleLong := diff --git a/TestModels/SimpleTypes/SimpleString/Makefile b/TestModels/SimpleTypes/SimpleString/Makefile index e8c1696f5..2488bdda5 100644 --- a/TestModels/SimpleTypes/SimpleString/Makefile +++ b/TestModels/SimpleTypes/SimpleString/Makefile @@ -14,6 +14,8 @@ NAMESPACE=simple.types.smithyString PROJECT_SERVICES := \ SimpleString +MAIN_SERVICE_FOR_RUST := SimpleString + SERVICE_NAMESPACE_SimpleString=simple.types.smithyString SERVICE_DEPS_SimpleString := diff --git a/TestModels/SimpleTypes/SimpleTimestamp/Makefile b/TestModels/SimpleTypes/SimpleTimestamp/Makefile index 55d0f10c8..dc98ff2ab 100644 --- a/TestModels/SimpleTypes/SimpleTimestamp/Makefile +++ b/TestModels/SimpleTypes/SimpleTimestamp/Makefile @@ -14,6 +14,8 @@ NAMESPACE=simple.types.timestamp PROJECT_SERVICES := \ SimpleTypesTimestamp +MAIN_SERVICE_FOR_RUST := SimpleTypesTimestamp + SERVICE_NAMESPACE_SimpleTypesTimestamp=simple.types.timestamp SERVICE_DEPS_SimpleTypesTimestamp := diff --git a/TestModels/Union/Makefile b/TestModels/Union/Makefile index 34f9d4e33..8590c0abc 100644 --- a/TestModels/Union/Makefile +++ b/TestModels/Union/Makefile @@ -14,6 +14,8 @@ NAMESPACE=simple.union PROJECT_SERVICES := \ SimpleUnion +MAIN_SERVICE_FOR_RUST := SimpleUnion + SERVICE_NAMESPACE_SimpleUnion=simple.union SERVICE_DEPS_SimpleUnion := diff --git a/TestModels/aws-sdks/ddb-lite/Makefile b/TestModels/aws-sdks/ddb-lite/Makefile index 4f86ac17f..66b48376a 100644 --- a/TestModels/aws-sdks/ddb-lite/Makefile +++ b/TestModels/aws-sdks/ddb-lite/Makefile @@ -16,6 +16,8 @@ include ../../SharedMakefile.mk PROJECT_SERVICES := \ ComAmazonawsDynamodb +MAIN_SERVICE_FOR_RUST := ComAmazonawsDynamodb + SERVICE_NAMESPACE_ComAmazonawsDynamodb=com.amazonaws.dynamodb SERVICE_DEPS_ComAmazonawsDynamodb := diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/client.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/client.rs index 879c0f2da..4b7199447 100644 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/client.rs +++ b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/client.rs @@ -4,10 +4,23 @@ use std::sync::LazyLock; use crate::conversions; +#[derive(::std::clone::Clone, ::std::fmt::Debug)] pub struct Client { pub inner: aws_sdk_dynamodb::Client } +impl ::std::cmp::PartialEq for Client { + fn eq(&self, other: &Self) -> bool { + false + } +} + +impl ::std::convert::Into for aws_sdk_dynamodb::Client { + fn into(self) -> Client { + Client { inner: self } + } +} + /// A runtime for executing operations on the asynchronous client in a blocking manner. /// Necessary because Dafny only generates synchronous code. static dafny_tokio_runtime: LazyLock = LazyLock::new(|| { @@ -33,11 +46,19 @@ impl crate::r#software::amazon::cryptography::services::dynamodb::internaldafny: std::rc::Rc > > { - let native_result = - dafny_tokio_runtime.block_on(conversions::batch_execute_statement::_batch_execute_statement_request::from_dafny(input.clone(), self.inner.clone()).send()); + let inner_input = crate::conversions::batch_execute_statement::_batch_execute_statement_request::from_dafny(input.clone()); + let native_result = tokio::task::block_in_place(|| { + dafny_tokio_runtime.block_on(async { + self.inner.batch_execute_statement() + .set_statements(inner_input.statements) +.set_return_consumed_capacity(inner_input.return_consumed_capacity) + .send() + .await + }) + }); crate::standard_library_conversions::result_to_dafny(&native_result, - conversions::batch_execute_statement::_batch_execute_statement_response::to_dafny, - conversions::batch_execute_statement::to_dafny_error) + crate::conversions::batch_execute_statement::_batch_execute_statement_response::to_dafny, + crate::conversions::batch_execute_statement::to_dafny_error) } fn BatchGetItem(&mut self, input: &std::rc::Rc) -> std::rc::Rc > > { - let native_result = - dafny_tokio_runtime.block_on(conversions::batch_get_item::_batch_get_item_request::from_dafny(input.clone(), self.inner.clone()).send()); + let inner_input = crate::conversions::batch_get_item::_batch_get_item_request::from_dafny(input.clone()); + let native_result = tokio::task::block_in_place(|| { + dafny_tokio_runtime.block_on(async { + self.inner.batch_get_item() + .set_request_items(inner_input.request_items) +.set_return_consumed_capacity(inner_input.return_consumed_capacity) + .send() + .await + }) + }); crate::standard_library_conversions::result_to_dafny(&native_result, - conversions::batch_get_item::_batch_get_item_response::to_dafny, - conversions::batch_get_item::to_dafny_error) + crate::conversions::batch_get_item::_batch_get_item_response::to_dafny, + crate::conversions::batch_get_item::to_dafny_error) } fn BatchWriteItem(&mut self, input: &std::rc::Rc) -> std::rc::Rc > > { - let native_result = - dafny_tokio_runtime.block_on(conversions::batch_write_item::_batch_write_item_request::from_dafny(input.clone(), self.inner.clone()).send()); + let inner_input = crate::conversions::batch_write_item::_batch_write_item_request::from_dafny(input.clone()); + let native_result = tokio::task::block_in_place(|| { + dafny_tokio_runtime.block_on(async { + self.inner.batch_write_item() + .set_request_items(inner_input.request_items) +.set_return_consumed_capacity(inner_input.return_consumed_capacity) +.set_return_item_collection_metrics(inner_input.return_item_collection_metrics) + .send() + .await + }) + }); crate::standard_library_conversions::result_to_dafny(&native_result, - conversions::batch_write_item::_batch_write_item_response::to_dafny, - conversions::batch_write_item::to_dafny_error) + crate::conversions::batch_write_item::_batch_write_item_response::to_dafny, + crate::conversions::batch_write_item::to_dafny_error) } fn CreateTable(&mut self, input: &std::rc::Rc) -> std::rc::Rc > > { - let native_result = - dafny_tokio_runtime.block_on(conversions::create_table::_create_table_request::from_dafny(input.clone(), self.inner.clone()).send()); + let inner_input = crate::conversions::create_table::_create_table_request::from_dafny(input.clone()); + let native_result = tokio::task::block_in_place(|| { + dafny_tokio_runtime.block_on(async { + self.inner.create_table() + .set_attribute_definitions(inner_input.attribute_definitions) +.set_table_name(inner_input.table_name) +.set_key_schema(inner_input.key_schema) +.set_local_secondary_indexes(inner_input.local_secondary_indexes) +.set_global_secondary_indexes(inner_input.global_secondary_indexes) +.set_billing_mode(inner_input.billing_mode) +.set_provisioned_throughput(inner_input.provisioned_throughput) +.set_stream_specification(inner_input.stream_specification) +.set_sse_specification(inner_input.sse_specification) +.set_tags(inner_input.tags) +.set_table_class(inner_input.table_class) + .send() + .await + }) + }); crate::standard_library_conversions::result_to_dafny(&native_result, - conversions::create_table::_create_table_response::to_dafny, - conversions::create_table::to_dafny_error) + crate::conversions::create_table::_create_table_response::to_dafny, + crate::conversions::create_table::to_dafny_error) } fn DeleteItem(&mut self, input: &std::rc::Rc) -> std::rc::Rc > > { - let native_result = - dafny_tokio_runtime.block_on(conversions::delete_item::_delete_item_request::from_dafny(input.clone(), self.inner.clone()).send()); + let inner_input = crate::conversions::delete_item::_delete_item_request::from_dafny(input.clone()); + let native_result = tokio::task::block_in_place(|| { + dafny_tokio_runtime.block_on(async { + self.inner.delete_item() + .set_table_name(inner_input.table_name) +.set_key(inner_input.key) +.set_expected(inner_input.expected) +.set_conditional_operator(inner_input.conditional_operator) +.set_return_values(inner_input.return_values) +.set_return_consumed_capacity(inner_input.return_consumed_capacity) +.set_return_item_collection_metrics(inner_input.return_item_collection_metrics) +.set_condition_expression(inner_input.condition_expression) +.set_expression_attribute_names(inner_input.expression_attribute_names) +.set_expression_attribute_values(inner_input.expression_attribute_values) + .send() + .await + }) + }); crate::standard_library_conversions::result_to_dafny(&native_result, - conversions::delete_item::_delete_item_response::to_dafny, - conversions::delete_item::to_dafny_error) + crate::conversions::delete_item::_delete_item_response::to_dafny, + crate::conversions::delete_item::to_dafny_error) } fn DescribeTable(&mut self, input: &std::rc::Rc) -> std::rc::Rc > > { - let native_result = - dafny_tokio_runtime.block_on(conversions::describe_table::_describe_table_request::from_dafny(input.clone(), self.inner.clone()).send()); + let inner_input = crate::conversions::describe_table::_describe_table_request::from_dafny(input.clone()); + let native_result = tokio::task::block_in_place(|| { + dafny_tokio_runtime.block_on(async { + self.inner.describe_table() + .set_table_name(inner_input.table_name) + .send() + .await + }) + }); crate::standard_library_conversions::result_to_dafny(&native_result, - conversions::describe_table::_describe_table_response::to_dafny, - conversions::describe_table::to_dafny_error) + crate::conversions::describe_table::_describe_table_response::to_dafny, + crate::conversions::describe_table::to_dafny_error) } fn ExecuteStatement(&mut self, input: &std::rc::Rc) -> std::rc::Rc > > { - let native_result = - dafny_tokio_runtime.block_on(conversions::execute_statement::_execute_statement_request::from_dafny(input.clone(), self.inner.clone()).send()); + let inner_input = crate::conversions::execute_statement::_execute_statement_request::from_dafny(input.clone()); + let native_result = tokio::task::block_in_place(|| { + dafny_tokio_runtime.block_on(async { + self.inner.execute_statement() + .set_statement(inner_input.statement) +.set_parameters(inner_input.parameters) +.set_consistent_read(inner_input.consistent_read) +.set_next_token(inner_input.next_token) +.set_return_consumed_capacity(inner_input.return_consumed_capacity) +.set_limit(inner_input.limit) + .send() + .await + }) + }); crate::standard_library_conversions::result_to_dafny(&native_result, - conversions::execute_statement::_execute_statement_response::to_dafny, - conversions::execute_statement::to_dafny_error) + crate::conversions::execute_statement::_execute_statement_response::to_dafny, + crate::conversions::execute_statement::to_dafny_error) } fn ExecuteTransaction(&mut self, input: &std::rc::Rc) -> std::rc::Rc > > { - let native_result = - dafny_tokio_runtime.block_on(conversions::execute_transaction::_execute_transaction_request::from_dafny(input.clone(), self.inner.clone()).send()); + let inner_input = crate::conversions::execute_transaction::_execute_transaction_request::from_dafny(input.clone()); + let native_result = tokio::task::block_in_place(|| { + dafny_tokio_runtime.block_on(async { + self.inner.execute_transaction() + .set_transact_statements(inner_input.transact_statements) +.set_client_request_token(inner_input.client_request_token) +.set_return_consumed_capacity(inner_input.return_consumed_capacity) + .send() + .await + }) + }); crate::standard_library_conversions::result_to_dafny(&native_result, - conversions::execute_transaction::_execute_transaction_response::to_dafny, - conversions::execute_transaction::to_dafny_error) + crate::conversions::execute_transaction::_execute_transaction_response::to_dafny, + crate::conversions::execute_transaction::to_dafny_error) } fn GetItem(&mut self, input: &std::rc::Rc) -> std::rc::Rc > > { - let native_result = - dafny_tokio_runtime.block_on(conversions::get_item::_get_item_request::from_dafny(input.clone(), self.inner.clone()).send()); + let inner_input = crate::conversions::get_item::_get_item_request::from_dafny(input.clone()); + let native_result = tokio::task::block_in_place(|| { + dafny_tokio_runtime.block_on(async { + self.inner.get_item() + .set_table_name(inner_input.table_name) +.set_key(inner_input.key) +.set_attributes_to_get(inner_input.attributes_to_get) +.set_consistent_read(inner_input.consistent_read) +.set_return_consumed_capacity(inner_input.return_consumed_capacity) +.set_projection_expression(inner_input.projection_expression) +.set_expression_attribute_names(inner_input.expression_attribute_names) + .send() + .await + }) + }); crate::standard_library_conversions::result_to_dafny(&native_result, - conversions::get_item::_get_item_response::to_dafny, - conversions::get_item::to_dafny_error) + crate::conversions::get_item::_get_item_response::to_dafny, + crate::conversions::get_item::to_dafny_error) } fn PutItem(&mut self, input: &std::rc::Rc) -> std::rc::Rc > > { - let native_result = - dafny_tokio_runtime.block_on(conversions::put_item::_put_item_request::from_dafny(input.clone(), self.inner.clone()).send()); + let inner_input = crate::conversions::put_item::_put_item_request::from_dafny(input.clone()); + let native_result = tokio::task::block_in_place(|| { + dafny_tokio_runtime.block_on(async { + self.inner.put_item() + .set_table_name(inner_input.table_name) +.set_item(inner_input.item) +.set_expected(inner_input.expected) +.set_return_values(inner_input.return_values) +.set_return_consumed_capacity(inner_input.return_consumed_capacity) +.set_return_item_collection_metrics(inner_input.return_item_collection_metrics) +.set_conditional_operator(inner_input.conditional_operator) +.set_condition_expression(inner_input.condition_expression) +.set_expression_attribute_names(inner_input.expression_attribute_names) +.set_expression_attribute_values(inner_input.expression_attribute_values) + .send() + .await + }) + }); crate::standard_library_conversions::result_to_dafny(&native_result, - conversions::put_item::_put_item_response::to_dafny, - conversions::put_item::to_dafny_error) + crate::conversions::put_item::_put_item_response::to_dafny, + crate::conversions::put_item::to_dafny_error) } fn Query(&mut self, input: &std::rc::Rc) -> std::rc::Rc > > { - let native_result = - dafny_tokio_runtime.block_on(conversions::query::_query_request::from_dafny(input.clone(), self.inner.clone()).send()); + let inner_input = crate::conversions::query::_query_request::from_dafny(input.clone()); + let native_result = tokio::task::block_in_place(|| { + dafny_tokio_runtime.block_on(async { + self.inner.query() + .set_table_name(inner_input.table_name) +.set_index_name(inner_input.index_name) +.set_select(inner_input.select) +.set_attributes_to_get(inner_input.attributes_to_get) +.set_limit(inner_input.limit) +.set_consistent_read(inner_input.consistent_read) +.set_key_conditions(inner_input.key_conditions) +.set_query_filter(inner_input.query_filter) +.set_conditional_operator(inner_input.conditional_operator) +.set_scan_index_forward(inner_input.scan_index_forward) +.set_exclusive_start_key(inner_input.exclusive_start_key) +.set_return_consumed_capacity(inner_input.return_consumed_capacity) +.set_projection_expression(inner_input.projection_expression) +.set_filter_expression(inner_input.filter_expression) +.set_key_condition_expression(inner_input.key_condition_expression) +.set_expression_attribute_names(inner_input.expression_attribute_names) +.set_expression_attribute_values(inner_input.expression_attribute_values) + .send() + .await + }) + }); crate::standard_library_conversions::result_to_dafny(&native_result, - conversions::query::_query_response::to_dafny, - conversions::query::to_dafny_error) + crate::conversions::query::_query_response::to_dafny, + crate::conversions::query::to_dafny_error) } fn Scan(&mut self, input: &std::rc::Rc) -> std::rc::Rc > > { - let native_result = - dafny_tokio_runtime.block_on(conversions::scan::_scan_request::from_dafny(input.clone(), self.inner.clone()).send()); + let inner_input = crate::conversions::scan::_scan_request::from_dafny(input.clone()); + let native_result = tokio::task::block_in_place(|| { + dafny_tokio_runtime.block_on(async { + self.inner.scan() + .set_table_name(inner_input.table_name) +.set_index_name(inner_input.index_name) +.set_attributes_to_get(inner_input.attributes_to_get) +.set_limit(inner_input.limit) +.set_select(inner_input.select) +.set_scan_filter(inner_input.scan_filter) +.set_conditional_operator(inner_input.conditional_operator) +.set_exclusive_start_key(inner_input.exclusive_start_key) +.set_return_consumed_capacity(inner_input.return_consumed_capacity) +.set_total_segments(inner_input.total_segments) +.set_segment(inner_input.segment) +.set_projection_expression(inner_input.projection_expression) +.set_filter_expression(inner_input.filter_expression) +.set_expression_attribute_names(inner_input.expression_attribute_names) +.set_expression_attribute_values(inner_input.expression_attribute_values) +.set_consistent_read(inner_input.consistent_read) + .send() + .await + }) + }); crate::standard_library_conversions::result_to_dafny(&native_result, - conversions::scan::_scan_response::to_dafny, - conversions::scan::to_dafny_error) + crate::conversions::scan::_scan_response::to_dafny, + crate::conversions::scan::to_dafny_error) } fn TransactGetItems(&mut self, input: &std::rc::Rc) -> std::rc::Rc > > { - let native_result = - dafny_tokio_runtime.block_on(conversions::transact_get_items::_transact_get_items_request::from_dafny(input.clone(), self.inner.clone()).send()); + let inner_input = crate::conversions::transact_get_items::_transact_get_items_request::from_dafny(input.clone()); + let native_result = tokio::task::block_in_place(|| { + dafny_tokio_runtime.block_on(async { + self.inner.transact_get_items() + .set_transact_items(inner_input.transact_items) +.set_return_consumed_capacity(inner_input.return_consumed_capacity) + .send() + .await + }) + }); crate::standard_library_conversions::result_to_dafny(&native_result, - conversions::transact_get_items::_transact_get_items_response::to_dafny, - conversions::transact_get_items::to_dafny_error) + crate::conversions::transact_get_items::_transact_get_items_response::to_dafny, + crate::conversions::transact_get_items::to_dafny_error) } fn TransactWriteItems(&mut self, input: &std::rc::Rc) -> std::rc::Rc > > { - let native_result = - dafny_tokio_runtime.block_on(conversions::transact_write_items::_transact_write_items_request::from_dafny(input.clone(), self.inner.clone()).send()); + let inner_input = crate::conversions::transact_write_items::_transact_write_items_request::from_dafny(input.clone()); + let native_result = tokio::task::block_in_place(|| { + dafny_tokio_runtime.block_on(async { + self.inner.transact_write_items() + .set_transact_items(inner_input.transact_items) +.set_return_consumed_capacity(inner_input.return_consumed_capacity) +.set_return_item_collection_metrics(inner_input.return_item_collection_metrics) +.set_client_request_token(inner_input.client_request_token) + .send() + .await + }) + }); crate::standard_library_conversions::result_to_dafny(&native_result, - conversions::transact_write_items::_transact_write_items_response::to_dafny, - conversions::transact_write_items::to_dafny_error) + crate::conversions::transact_write_items::_transact_write_items_response::to_dafny, + crate::conversions::transact_write_items::to_dafny_error) } fn UpdateItem(&mut self, input: &std::rc::Rc) -> std::rc::Rc > > { - let native_result = - dafny_tokio_runtime.block_on(conversions::update_item::_update_item_request::from_dafny(input.clone(), self.inner.clone()).send()); + let inner_input = crate::conversions::update_item::_update_item_request::from_dafny(input.clone()); + let native_result = tokio::task::block_in_place(|| { + dafny_tokio_runtime.block_on(async { + self.inner.update_item() + .set_table_name(inner_input.table_name) +.set_key(inner_input.key) +.set_attribute_updates(inner_input.attribute_updates) +.set_expected(inner_input.expected) +.set_conditional_operator(inner_input.conditional_operator) +.set_return_values(inner_input.return_values) +.set_return_consumed_capacity(inner_input.return_consumed_capacity) +.set_return_item_collection_metrics(inner_input.return_item_collection_metrics) +.set_update_expression(inner_input.update_expression) +.set_condition_expression(inner_input.condition_expression) +.set_expression_attribute_names(inner_input.expression_attribute_names) +.set_expression_attribute_values(inner_input.expression_attribute_values) + .send() + .await + }) + }); crate::standard_library_conversions::result_to_dafny(&native_result, - conversions::update_item::_update_item_response::to_dafny, - conversions::update_item::to_dafny_error) + crate::conversions::update_item::_update_item_response::to_dafny, + crate::conversions::update_item::to_dafny_error) } } #[allow(non_snake_case)] impl crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::_default { diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions.rs deleted file mode 100644 index cf77d3818..000000000 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions.rs +++ /dev/null @@ -1,166 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -pub mod archival_summary; - - pub mod attribute_action; - - pub mod attribute_definition; - - pub mod attribute_value; - - pub mod attribute_value_update; - - pub mod batch_execute_statement; - - pub mod batch_get_item; - - pub mod batch_statement_error; - - pub mod batch_statement_error_code_enum; - - pub mod batch_statement_request; - - pub mod batch_statement_response; - - pub mod batch_write_item; - - pub mod billing_mode; - - pub mod billing_mode_summary; - - pub mod cancellation_reason; - - pub mod capacity; - - pub mod client; - - pub mod comparison_operator; - - pub mod condition; - - pub mod condition_check; - - pub mod conditional_operator; - - pub mod consumed_capacity; - - pub mod create_table; - - pub mod delete; - - pub mod delete_item; - - pub mod delete_request; - - pub mod describe_table; - - pub mod error; - - pub mod execute_statement; - - pub mod execute_transaction; - - pub mod expected_attribute_value; - - pub mod get; - - pub mod get_item; - - pub mod global_secondary_index; - - pub mod global_secondary_index_description; - - pub mod index_status; - - pub mod item_collection_metrics; - - pub mod item_response; - - pub mod key_schema_element; - - pub mod key_type; - - pub mod keys_and_attributes; - - pub mod local_secondary_index; - - pub mod local_secondary_index_description; - - pub mod parameterized_statement; - - pub mod projection; - - pub mod projection_type; - - pub mod provisioned_throughput; - - pub mod provisioned_throughput_description; - - pub mod provisioned_throughput_override; - - pub mod put; - - pub mod put_item; - - pub mod put_request; - - pub mod query; - - pub mod replica_description; - - pub mod replica_global_secondary_index_description; - - pub mod replica_status; - - pub mod restore_summary; - - pub mod return_consumed_capacity; - - pub mod return_item_collection_metrics; - - pub mod return_value; - - pub mod return_values_on_condition_check_failure; - - pub mod scalar_attribute_type; - - pub mod scan; - - pub mod select; - - pub mod sse_description; - - pub mod sse_specification; - - pub mod sse_status; - - pub mod sse_type; - - pub mod stream_specification; - - pub mod stream_view_type; - - pub mod table_class; - - pub mod table_class_summary; - - pub mod table_description; - - pub mod table_status; - - pub mod tag; - - pub mod transact_get_item; - - pub mod transact_get_items; - - pub mod transact_write_item; - - pub mod transact_write_items; - - pub mod update; - - pub mod update_item; - - pub mod write_request; diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/archival_summary.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/archival_summary.rs deleted file mode 100644 index 2bd909c7c..000000000 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/archival_summary.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: &aws_sdk_dynamodb::types::ArchivalSummary, -) -> ::std::rc::Rc{ - ::std::rc::Rc::new( - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ArchivalSummary::ArchivalSummary { - ArchivalDateTime: crate::standard_library_conversions::otimestamp_to_dafny(&value.archival_date_time), - ArchivalReason: crate::standard_library_conversions::ostring_to_dafny(&value.archival_reason), - ArchivalBackupArn: crate::standard_library_conversions::ostring_to_dafny(&value.archival_backup_arn), - } - ) -} #[allow(dead_code)] -pub fn from_dafny( - dafny_value: ::std::rc::Rc< - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ArchivalSummary, - >, -) -> aws_sdk_dynamodb::types::ArchivalSummary { - aws_sdk_dynamodb::types::ArchivalSummary::builder() - .set_archival_date_time(crate::standard_library_conversions::otimestamp_from_dafny(dafny_value.ArchivalDateTime().clone())) - .set_archival_reason(crate::standard_library_conversions::ostring_from_dafny(dafny_value.ArchivalReason().clone())) - .set_archival_backup_arn(crate::standard_library_conversions::ostring_from_dafny(dafny_value.ArchivalBackupArn().clone())) - .build() - -} diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/attribute_action.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/attribute_action.rs deleted file mode 100644 index 86959a17b..000000000 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/attribute_action.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] - -pub fn to_dafny( - value: aws_sdk_dynamodb::types::AttributeAction, -) -> ::std::rc::Rc{ - ::std::rc::Rc::new(match value { - aws_sdk_dynamodb::types::AttributeAction::Add => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::AttributeAction::ADD {}, -aws_sdk_dynamodb::types::AttributeAction::Put => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::AttributeAction::PUT {}, -aws_sdk_dynamodb::types::AttributeAction::Delete => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::AttributeAction::DELETE {}, - _ => panic!("Unknown enum variant: {}", value), - }) -} - #[allow(dead_code)] -pub fn from_dafny( - dafny_value: &crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::AttributeAction, -) -> aws_sdk_dynamodb::types::AttributeAction { - match dafny_value { - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::AttributeAction::ADD {} => aws_sdk_dynamodb::types::AttributeAction::Add, -crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::AttributeAction::PUT {} => aws_sdk_dynamodb::types::AttributeAction::Put, -crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::AttributeAction::DELETE {} => aws_sdk_dynamodb::types::AttributeAction::Delete, - } -} diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/attribute_definition.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/attribute_definition.rs deleted file mode 100644 index f10e04337..000000000 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/attribute_definition.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: &aws_sdk_dynamodb::types::AttributeDefinition, -) -> ::std::rc::Rc{ - ::std::rc::Rc::new( - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::AttributeDefinition::AttributeDefinition { - AttributeName: dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&value.attribute_name), - AttributeType: crate::conversions::scalar_attribute_type::to_dafny(value.attribute_type.clone()), - } - ) -} #[allow(dead_code)] -pub fn from_dafny( - dafny_value: ::std::rc::Rc< - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::AttributeDefinition, - >, -) -> aws_sdk_dynamodb::types::AttributeDefinition { - aws_sdk_dynamodb::types::AttributeDefinition::builder() - .set_attribute_name(Some( dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(dafny_value.AttributeName()) )) - .set_attribute_type(Some( crate::conversions::scalar_attribute_type::from_dafny(dafny_value.AttributeType()) )) - .build() - .unwrap() -} diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/attribute_value.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/attribute_value.rs deleted file mode 100644 index f587a7cc9..000000000 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/attribute_value.rs +++ /dev/null @@ -1,129 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: &aws_sdk_dynamodb::types::AttributeValue, -) -> ::std::rc::Rc< - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::AttributeValue, -> { - ::std::rc::Rc::new(match value { - aws_sdk_dynamodb::types::AttributeValue::S(x) => - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::AttributeValue::S { - S: dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&x), - }, -aws_sdk_dynamodb::types::AttributeValue::N(x) => - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::AttributeValue::N { - N: dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&x), - }, -aws_sdk_dynamodb::types::AttributeValue::B(x) => - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::AttributeValue::B { - B: crate::standard_library_conversions::blob_to_dafny(&x), - }, -aws_sdk_dynamodb::types::AttributeValue::Ss(x) => - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::AttributeValue::SS { - SS: ::dafny_runtime::dafny_runtime_conversions::vec_to_dafny_sequence(&x, - |e| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&e), -) -, - }, -aws_sdk_dynamodb::types::AttributeValue::Ns(x) => - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::AttributeValue::NS { - NS: ::dafny_runtime::dafny_runtime_conversions::vec_to_dafny_sequence(&x, - |e| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&e), -) -, - }, -aws_sdk_dynamodb::types::AttributeValue::Bs(x) => - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::AttributeValue::BS { - BS: ::dafny_runtime::dafny_runtime_conversions::vec_to_dafny_sequence(&x, - |e| crate::standard_library_conversions::blob_to_dafny(&e), -) -, - }, -aws_sdk_dynamodb::types::AttributeValue::M(x) => - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::AttributeValue::M { - M: ::dafny_runtime::dafny_runtime_conversions::hashmap_to_dafny_map(&x.clone(), - |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&k), - |v| crate::conversions::attribute_value::to_dafny(&v) -, -) -, - }, -aws_sdk_dynamodb::types::AttributeValue::L(x) => - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::AttributeValue::L { - L: ::dafny_runtime::dafny_runtime_conversions::vec_to_dafny_sequence(&x, - |e| crate::conversions::attribute_value::to_dafny(&e) -, -) -, - }, -aws_sdk_dynamodb::types::AttributeValue::Null(x) => - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::AttributeValue::NULL { - NULL: x.clone(), - }, -aws_sdk_dynamodb::types::AttributeValue::Bool(x) => - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::AttributeValue::BOOL { - BOOL: x.clone(), - }, - _ => panic!("Unknown union variant: {:?}", value), - }) -} - -#[allow(dead_code)] -pub fn from_dafny( - dafny_value: ::std::rc::Rc< - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::AttributeValue, - >, -) -> aws_sdk_dynamodb::types::AttributeValue { - match &::std::rc::Rc::unwrap_or_clone(dafny_value) { - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::AttributeValue::S { - S: x @ _, -} => aws_sdk_dynamodb::types::AttributeValue::S(dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(x)), -crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::AttributeValue::N { - N: x @ _, -} => aws_sdk_dynamodb::types::AttributeValue::N(dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(x)), -crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::AttributeValue::B { - B: x @ _, -} => aws_sdk_dynamodb::types::AttributeValue::B(crate::standard_library_conversions::blob_from_dafny(x.clone())), -crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::AttributeValue::SS { - SS: x @ _, -} => aws_sdk_dynamodb::types::AttributeValue::Ss(::dafny_runtime::dafny_runtime_conversions::dafny_sequence_to_vec(x, - |e| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(e), -) -), -crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::AttributeValue::NS { - NS: x @ _, -} => aws_sdk_dynamodb::types::AttributeValue::Ns(::dafny_runtime::dafny_runtime_conversions::dafny_sequence_to_vec(x, - |e| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(e), -) -), -crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::AttributeValue::BS { - BS: x @ _, -} => aws_sdk_dynamodb::types::AttributeValue::Bs(::dafny_runtime::dafny_runtime_conversions::dafny_sequence_to_vec(x, - |e| crate::standard_library_conversions::blob_from_dafny(e.clone()), -) -), -crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::AttributeValue::M { - M: x @ _, -} => aws_sdk_dynamodb::types::AttributeValue::M(::dafny_runtime::dafny_runtime_conversions::dafny_map_to_hashmap(&x, - |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(k), - |v| crate::conversions::attribute_value::from_dafny(v.clone()) -, -) -), -crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::AttributeValue::L { - L: x @ _, -} => aws_sdk_dynamodb::types::AttributeValue::L(::dafny_runtime::dafny_runtime_conversions::dafny_sequence_to_vec(x, - |e| crate::conversions::attribute_value::from_dafny(e.clone()) -, -) -), -crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::AttributeValue::NULL { - NULL: x @ _, -} => aws_sdk_dynamodb::types::AttributeValue::Null(x .clone()), -crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::AttributeValue::BOOL { - BOOL: x @ _, -} => aws_sdk_dynamodb::types::AttributeValue::Bool(x .clone()), - } -} diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/attribute_value_update.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/attribute_value_update.rs deleted file mode 100644 index f2178c927..000000000 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/attribute_value_update.rs +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: &aws_sdk_dynamodb::types::AttributeValueUpdate, -) -> ::std::rc::Rc{ - ::std::rc::Rc::new( - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::AttributeValueUpdate::AttributeValueUpdate { - Value: ::std::rc::Rc::new(match &value.value { - Some(x) => crate::_Wrappers_Compile::Option::Some { value: crate::conversions::attribute_value::to_dafny(&x) }, - None => crate::_Wrappers_Compile::Option::None { } -}) -, - Action: ::std::rc::Rc::new(match &value.action { - Some(x) => crate::_Wrappers_Compile::Option::Some { value: crate::conversions::attribute_action::to_dafny(x.clone()) }, - None => crate::_Wrappers_Compile::Option::None { } -}) -, - } - ) -} #[allow(dead_code)] -pub fn from_dafny( - dafny_value: ::std::rc::Rc< - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::AttributeValueUpdate, - >, -) -> aws_sdk_dynamodb::types::AttributeValueUpdate { - aws_sdk_dynamodb::types::AttributeValueUpdate::builder() - .set_value(match (*dafny_value.Value()).as_ref() { - crate::r#_Wrappers_Compile::Option::Some { value } => - Some(crate::conversions::attribute_value::from_dafny(value.clone())), - _ => None, -} -) - .set_action(match &**dafny_value.Action() { - crate::r#_Wrappers_Compile::Option::Some { value } => Some( - crate::conversions::attribute_action::from_dafny(value) - ), - _ => None, -} -) - .build() - -} diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/batch_execute_statement.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/batch_execute_statement.rs deleted file mode 100644 index 68e75f199..000000000 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/batch_execute_statement.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -pub mod _batch_execute_statement_request; - - pub mod _batch_execute_statement_response; - #[allow(dead_code)] -pub fn to_dafny_error( - value: &::aws_smithy_runtime_api::client::result::SdkError< - aws_sdk_dynamodb::operation::batch_execute_statement::BatchExecuteStatementError, - ::aws_smithy_runtime_api::client::orchestrator::HttpResponse, - >, -) -> ::std::rc::Rc { - match value { - aws_sdk_dynamodb::error::SdkError::ServiceError(service_error) => match service_error.err() { - aws_sdk_dynamodb::operation::batch_execute_statement::BatchExecuteStatementError::InternalServerError(e) => - crate::conversions::error::internal_server_error::to_dafny(e.clone()), - aws_sdk_dynamodb::operation::batch_execute_statement::BatchExecuteStatementError::RequestLimitExceeded(e) => - crate::conversions::error::request_limit_exceeded::to_dafny(e.clone()), - e => crate::conversions::error::to_opaque_error(e.to_string()), - }, - _ => { - crate::conversions::error::to_opaque_error(value.to_string()) - } - } -} diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/batch_execute_statement/_batch_execute_statement_request.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/batch_execute_statement/_batch_execute_statement_request.rs deleted file mode 100644 index 1680275de..000000000 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/batch_execute_statement/_batch_execute_statement_request.rs +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: &aws_sdk_dynamodb::operation::batch_execute_statement::BatchExecuteStatementInput, -) -> ::std::rc::Rc< - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::BatchExecuteStatementInput, ->{ - ::std::rc::Rc::new(crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::BatchExecuteStatementInput::BatchExecuteStatementInput { - Statements: ::dafny_runtime::dafny_runtime_conversions::vec_to_dafny_sequence(&value.statements.clone().unwrap(), - |e| crate::conversions::batch_statement_request::to_dafny(&e) -, -) -, - ReturnConsumedCapacity: ::std::rc::Rc::new(match &value.return_consumed_capacity { - Some(x) => crate::_Wrappers_Compile::Option::Some { value: crate::conversions::return_consumed_capacity::to_dafny(x.clone()) }, - None => crate::_Wrappers_Compile::Option::None { } -}) -, - }) -} - #[allow(dead_code)] -pub fn from_dafny( - dafny_value: ::std::rc::Rc< - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::BatchExecuteStatementInput, - >, - client: aws_sdk_dynamodb::Client, -) -> aws_sdk_dynamodb::operation::batch_execute_statement::builders::BatchExecuteStatementFluentBuilder { - client.batch_execute_statement() - .set_statements(Some( ::dafny_runtime::dafny_runtime_conversions::dafny_sequence_to_vec(dafny_value.Statements(), - |e| crate::conversions::batch_statement_request::from_dafny(e.clone()) -, -) - )) - .set_return_consumed_capacity(match &**dafny_value.ReturnConsumedCapacity() { - crate::r#_Wrappers_Compile::Option::Some { value } => Some( - crate::conversions::return_consumed_capacity::from_dafny(value) - ), - _ => None, -} -) -} diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/batch_execute_statement/_batch_execute_statement_response.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/batch_execute_statement/_batch_execute_statement_response.rs deleted file mode 100644 index 56cae1bdc..000000000 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/batch_execute_statement/_batch_execute_statement_response.rs +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: &aws_sdk_dynamodb::operation::batch_execute_statement::BatchExecuteStatementOutput -) -> ::std::rc::Rc< - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::BatchExecuteStatementOutput, ->{ - ::std::rc::Rc::new(crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::BatchExecuteStatementOutput::BatchExecuteStatementOutput { - Responses: ::std::rc::Rc::new(match &value.responses { - Some(x) => crate::r#_Wrappers_Compile::Option::Some { value : - ::dafny_runtime::dafny_runtime_conversions::vec_to_dafny_sequence(x, - |e| crate::conversions::batch_statement_response::to_dafny(&e) -, - ) - }, - None => crate::r#_Wrappers_Compile::Option::None {} -}) -, - ConsumedCapacity: ::std::rc::Rc::new(match &value.consumed_capacity { - Some(x) => crate::r#_Wrappers_Compile::Option::Some { value : - ::dafny_runtime::dafny_runtime_conversions::vec_to_dafny_sequence(x, - |e| crate::conversions::consumed_capacity::to_dafny(&e) -, - ) - }, - None => crate::r#_Wrappers_Compile::Option::None {} -}) -, - }) -} - diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/batch_get_item.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/batch_get_item.rs deleted file mode 100644 index 52d40b8c8..000000000 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/batch_get_item.rs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -pub mod _batch_get_item_request; - - pub mod _batch_get_item_response; - #[allow(dead_code)] -pub fn to_dafny_error( - value: &::aws_smithy_runtime_api::client::result::SdkError< - aws_sdk_dynamodb::operation::batch_get_item::BatchGetItemError, - ::aws_smithy_runtime_api::client::orchestrator::HttpResponse, - >, -) -> ::std::rc::Rc { - match value { - aws_sdk_dynamodb::error::SdkError::ServiceError(service_error) => match service_error.err() { - aws_sdk_dynamodb::operation::batch_get_item::BatchGetItemError::InternalServerError(e) => - crate::conversions::error::internal_server_error::to_dafny(e.clone()), - aws_sdk_dynamodb::operation::batch_get_item::BatchGetItemError::InvalidEndpointException(e) => - crate::conversions::error::invalid_endpoint_exception::to_dafny(e.clone()), - aws_sdk_dynamodb::operation::batch_get_item::BatchGetItemError::ResourceNotFoundException(e) => - crate::conversions::error::resource_not_found_exception::to_dafny(e.clone()), - aws_sdk_dynamodb::operation::batch_get_item::BatchGetItemError::RequestLimitExceeded(e) => - crate::conversions::error::request_limit_exceeded::to_dafny(e.clone()), - aws_sdk_dynamodb::operation::batch_get_item::BatchGetItemError::ProvisionedThroughputExceededException(e) => - crate::conversions::error::provisioned_throughput_exceeded_exception::to_dafny(e.clone()), - e => crate::conversions::error::to_opaque_error(e.to_string()), - }, - _ => { - crate::conversions::error::to_opaque_error(value.to_string()) - } - } -} diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/batch_get_item/_batch_get_item_request.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/batch_get_item/_batch_get_item_request.rs deleted file mode 100644 index 96e770b44..000000000 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/batch_get_item/_batch_get_item_request.rs +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: &aws_sdk_dynamodb::operation::batch_get_item::BatchGetItemInput, -) -> ::std::rc::Rc< - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::BatchGetItemInput, ->{ - ::std::rc::Rc::new(crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::BatchGetItemInput::BatchGetItemInput { - RequestItems: ::dafny_runtime::dafny_runtime_conversions::hashmap_to_dafny_map(&value.request_items.clone().unwrap(), - |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&k), - |v| crate::conversions::keys_and_attributes::to_dafny(&v) -, -) -, - ReturnConsumedCapacity: ::std::rc::Rc::new(match &value.return_consumed_capacity { - Some(x) => crate::_Wrappers_Compile::Option::Some { value: crate::conversions::return_consumed_capacity::to_dafny(x.clone()) }, - None => crate::_Wrappers_Compile::Option::None { } -}) -, - }) -} - #[allow(dead_code)] -pub fn from_dafny( - dafny_value: ::std::rc::Rc< - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::BatchGetItemInput, - >, - client: aws_sdk_dynamodb::Client, -) -> aws_sdk_dynamodb::operation::batch_get_item::builders::BatchGetItemFluentBuilder { - client.batch_get_item() - .set_request_items(Some( ::dafny_runtime::dafny_runtime_conversions::dafny_map_to_hashmap(&dafny_value.RequestItems(), - |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(k), - |v| crate::conversions::keys_and_attributes::from_dafny(v.clone()) -, -) - )) - .set_return_consumed_capacity(match &**dafny_value.ReturnConsumedCapacity() { - crate::r#_Wrappers_Compile::Option::Some { value } => Some( - crate::conversions::return_consumed_capacity::from_dafny(value) - ), - _ => None, -} -) -} diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/batch_get_item/_batch_get_item_response.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/batch_get_item/_batch_get_item_response.rs deleted file mode 100644 index a905095ef..000000000 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/batch_get_item/_batch_get_item_response.rs +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: &aws_sdk_dynamodb::operation::batch_get_item::BatchGetItemOutput -) -> ::std::rc::Rc< - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::BatchGetItemOutput, ->{ - ::std::rc::Rc::new(crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::BatchGetItemOutput::BatchGetItemOutput { - Responses: -::std::rc::Rc::new(match &value.responses { - Some(x) => crate::r#_Wrappers_Compile::Option::Some { value : - ::dafny_runtime::dafny_runtime_conversions::hashmap_to_dafny_map(x, - |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&k), - |v| ::dafny_runtime::dafny_runtime_conversions::vec_to_dafny_sequence(&v, - |e| ::dafny_runtime::dafny_runtime_conversions::hashmap_to_dafny_map(&e.clone(), - |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&k), - |v| crate::conversions::attribute_value::to_dafny(&v) -, -) -, -) -, - ) - }, - None => crate::r#_Wrappers_Compile::Option::None {} -}) -, - UnprocessedKeys: -::std::rc::Rc::new(match &value.unprocessed_keys { - Some(x) => crate::r#_Wrappers_Compile::Option::Some { value : - ::dafny_runtime::dafny_runtime_conversions::hashmap_to_dafny_map(x, - |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&k), - |v| crate::conversions::keys_and_attributes::to_dafny(&v) -, - ) - }, - None => crate::r#_Wrappers_Compile::Option::None {} -}) -, - ConsumedCapacity: ::std::rc::Rc::new(match &value.consumed_capacity { - Some(x) => crate::r#_Wrappers_Compile::Option::Some { value : - ::dafny_runtime::dafny_runtime_conversions::vec_to_dafny_sequence(x, - |e| crate::conversions::consumed_capacity::to_dafny(&e) -, - ) - }, - None => crate::r#_Wrappers_Compile::Option::None {} -}) -, - }) -} - diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/batch_statement_error.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/batch_statement_error.rs deleted file mode 100644 index 529e1d892..000000000 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/batch_statement_error.rs +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: &aws_sdk_dynamodb::types::BatchStatementError, -) -> ::std::rc::Rc{ - ::std::rc::Rc::new( - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::BatchStatementError::BatchStatementError { - Code: ::std::rc::Rc::new(match &value.code { - Some(x) => crate::_Wrappers_Compile::Option::Some { value: crate::conversions::batch_statement_error_code_enum::to_dafny(x.clone()) }, - None => crate::_Wrappers_Compile::Option::None { } -}) -, - Message: crate::standard_library_conversions::ostring_to_dafny(&value.message), - } - ) -} #[allow(dead_code)] -pub fn from_dafny( - dafny_value: ::std::rc::Rc< - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::BatchStatementError, - >, -) -> aws_sdk_dynamodb::types::BatchStatementError { - aws_sdk_dynamodb::types::BatchStatementError::builder() - .set_code(match &**dafny_value.Code() { - crate::r#_Wrappers_Compile::Option::Some { value } => Some( - crate::conversions::batch_statement_error_code_enum::from_dafny(value) - ), - _ => None, -} -) - .set_message(crate::standard_library_conversions::ostring_from_dafny(dafny_value.Message().clone())) - .build() - -} diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/batch_statement_error_code_enum.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/batch_statement_error_code_enum.rs deleted file mode 100644 index fd53a818a..000000000 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/batch_statement_error_code_enum.rs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] - -pub fn to_dafny( - value: aws_sdk_dynamodb::types::BatchStatementErrorCodeEnum, -) -> ::std::rc::Rc{ - ::std::rc::Rc::new(match value { - aws_sdk_dynamodb::types::BatchStatementErrorCodeEnum::ConditionalCheckFailed => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::BatchStatementErrorCodeEnum::ConditionalCheckFailed {}, -aws_sdk_dynamodb::types::BatchStatementErrorCodeEnum::ItemCollectionSizeLimitExceeded => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::BatchStatementErrorCodeEnum::ItemCollectionSizeLimitExceeded {}, -aws_sdk_dynamodb::types::BatchStatementErrorCodeEnum::RequestLimitExceeded => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::BatchStatementErrorCodeEnum::RequestLimitExceeded {}, -aws_sdk_dynamodb::types::BatchStatementErrorCodeEnum::ValidationError => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::BatchStatementErrorCodeEnum::ValidationError {}, -aws_sdk_dynamodb::types::BatchStatementErrorCodeEnum::ProvisionedThroughputExceeded => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::BatchStatementErrorCodeEnum::ProvisionedThroughputExceeded {}, -aws_sdk_dynamodb::types::BatchStatementErrorCodeEnum::TransactionConflict => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::BatchStatementErrorCodeEnum::TransactionConflict {}, -aws_sdk_dynamodb::types::BatchStatementErrorCodeEnum::ThrottlingError => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::BatchStatementErrorCodeEnum::ThrottlingError {}, -aws_sdk_dynamodb::types::BatchStatementErrorCodeEnum::InternalServerError => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::BatchStatementErrorCodeEnum::InternalServerError {}, -aws_sdk_dynamodb::types::BatchStatementErrorCodeEnum::ResourceNotFound => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::BatchStatementErrorCodeEnum::ResourceNotFound {}, -aws_sdk_dynamodb::types::BatchStatementErrorCodeEnum::AccessDenied => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::BatchStatementErrorCodeEnum::AccessDenied {}, -aws_sdk_dynamodb::types::BatchStatementErrorCodeEnum::DuplicateItem => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::BatchStatementErrorCodeEnum::DuplicateItem {}, - _ => panic!("Unknown enum variant: {}", value), - }) -} - #[allow(dead_code)] -pub fn from_dafny( - dafny_value: &crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::BatchStatementErrorCodeEnum, -) -> aws_sdk_dynamodb::types::BatchStatementErrorCodeEnum { - match dafny_value { - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::BatchStatementErrorCodeEnum::ConditionalCheckFailed {} => aws_sdk_dynamodb::types::BatchStatementErrorCodeEnum::ConditionalCheckFailed, -crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::BatchStatementErrorCodeEnum::ItemCollectionSizeLimitExceeded {} => aws_sdk_dynamodb::types::BatchStatementErrorCodeEnum::ItemCollectionSizeLimitExceeded, -crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::BatchStatementErrorCodeEnum::RequestLimitExceeded {} => aws_sdk_dynamodb::types::BatchStatementErrorCodeEnum::RequestLimitExceeded, -crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::BatchStatementErrorCodeEnum::ValidationError {} => aws_sdk_dynamodb::types::BatchStatementErrorCodeEnum::ValidationError, -crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::BatchStatementErrorCodeEnum::ProvisionedThroughputExceeded {} => aws_sdk_dynamodb::types::BatchStatementErrorCodeEnum::ProvisionedThroughputExceeded, -crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::BatchStatementErrorCodeEnum::TransactionConflict {} => aws_sdk_dynamodb::types::BatchStatementErrorCodeEnum::TransactionConflict, -crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::BatchStatementErrorCodeEnum::ThrottlingError {} => aws_sdk_dynamodb::types::BatchStatementErrorCodeEnum::ThrottlingError, -crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::BatchStatementErrorCodeEnum::InternalServerError {} => aws_sdk_dynamodb::types::BatchStatementErrorCodeEnum::InternalServerError, -crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::BatchStatementErrorCodeEnum::ResourceNotFound {} => aws_sdk_dynamodb::types::BatchStatementErrorCodeEnum::ResourceNotFound, -crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::BatchStatementErrorCodeEnum::AccessDenied {} => aws_sdk_dynamodb::types::BatchStatementErrorCodeEnum::AccessDenied, -crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::BatchStatementErrorCodeEnum::DuplicateItem {} => aws_sdk_dynamodb::types::BatchStatementErrorCodeEnum::DuplicateItem, - } -} diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/batch_statement_request.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/batch_statement_request.rs deleted file mode 100644 index 60caba238..000000000 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/batch_statement_request.rs +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: &aws_sdk_dynamodb::types::BatchStatementRequest, -) -> ::std::rc::Rc{ - ::std::rc::Rc::new( - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::BatchStatementRequest::BatchStatementRequest { - Statement: dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&value.statement), - Parameters: ::std::rc::Rc::new(match &value.parameters { - Some(x) => crate::r#_Wrappers_Compile::Option::Some { value : - ::dafny_runtime::dafny_runtime_conversions::vec_to_dafny_sequence(x, - |e| crate::conversions::attribute_value::to_dafny(&e) -, - ) - }, - None => crate::r#_Wrappers_Compile::Option::None {} -}) -, - ConsistentRead: crate::standard_library_conversions::obool_to_dafny(&value.consistent_read), - } - ) -} #[allow(dead_code)] -pub fn from_dafny( - dafny_value: ::std::rc::Rc< - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::BatchStatementRequest, - >, -) -> aws_sdk_dynamodb::types::BatchStatementRequest { - aws_sdk_dynamodb::types::BatchStatementRequest::builder() - .set_statement(Some( dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(dafny_value.Statement()) )) - .set_parameters(match (*dafny_value.Parameters()).as_ref() { - crate::r#_Wrappers_Compile::Option::Some { value } => - Some( - ::dafny_runtime::dafny_runtime_conversions::dafny_sequence_to_vec(value, - |e| crate::conversions::attribute_value::from_dafny(e.clone()) -, - ) - ), - _ => None -} -) - .set_consistent_read(crate::standard_library_conversions::obool_from_dafny(dafny_value.ConsistentRead().clone())) - .build() - .unwrap() -} diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/batch_statement_response.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/batch_statement_response.rs deleted file mode 100644 index bc392ae9e..000000000 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/batch_statement_response.rs +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: &aws_sdk_dynamodb::types::BatchStatementResponse, -) -> ::std::rc::Rc{ - ::std::rc::Rc::new( - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::BatchStatementResponse::BatchStatementResponse { - Error: ::std::rc::Rc::new(match &value.error { - Some(x) => crate::_Wrappers_Compile::Option::Some { value: crate::conversions::batch_statement_error::to_dafny(&x) }, - None => crate::_Wrappers_Compile::Option::None { } -}) -, - TableName: crate::standard_library_conversions::ostring_to_dafny(&value.table_name), - Item: -::std::rc::Rc::new(match &value.item { - Some(x) => crate::r#_Wrappers_Compile::Option::Some { value : - ::dafny_runtime::dafny_runtime_conversions::hashmap_to_dafny_map(x, - |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&k), - |v| crate::conversions::attribute_value::to_dafny(&v) -, - ) - }, - None => crate::r#_Wrappers_Compile::Option::None {} -}) -, - } - ) -} #[allow(dead_code)] -pub fn from_dafny( - dafny_value: ::std::rc::Rc< - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::BatchStatementResponse, - >, -) -> aws_sdk_dynamodb::types::BatchStatementResponse { - aws_sdk_dynamodb::types::BatchStatementResponse::builder() - .set_error(match (*dafny_value.Error()).as_ref() { - crate::r#_Wrappers_Compile::Option::Some { value } => - Some(crate::conversions::batch_statement_error::from_dafny(value.clone())), - _ => None, -} -) - .set_table_name(crate::standard_library_conversions::ostring_from_dafny(dafny_value.TableName().clone())) - .set_item(match (*dafny_value.Item()).as_ref() { - crate::r#_Wrappers_Compile::Option::Some { value } => - Some( - ::dafny_runtime::dafny_runtime_conversions::dafny_map_to_hashmap(value, - |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(k), - |v| crate::conversions::attribute_value::from_dafny(v.clone()) -, - ) - ), - _ => None -} -) - .build() - -} diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/batch_write_item.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/batch_write_item.rs deleted file mode 100644 index 14082361d..000000000 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/batch_write_item.rs +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -pub mod _batch_write_item_request; - - pub mod _batch_write_item_response; - #[allow(dead_code)] -pub fn to_dafny_error( - value: &::aws_smithy_runtime_api::client::result::SdkError< - aws_sdk_dynamodb::operation::batch_write_item::BatchWriteItemError, - ::aws_smithy_runtime_api::client::orchestrator::HttpResponse, - >, -) -> ::std::rc::Rc { - match value { - aws_sdk_dynamodb::error::SdkError::ServiceError(service_error) => match service_error.err() { - aws_sdk_dynamodb::operation::batch_write_item::BatchWriteItemError::InternalServerError(e) => - crate::conversions::error::internal_server_error::to_dafny(e.clone()), - aws_sdk_dynamodb::operation::batch_write_item::BatchWriteItemError::InvalidEndpointException(e) => - crate::conversions::error::invalid_endpoint_exception::to_dafny(e.clone()), - aws_sdk_dynamodb::operation::batch_write_item::BatchWriteItemError::ResourceNotFoundException(e) => - crate::conversions::error::resource_not_found_exception::to_dafny(e.clone()), - aws_sdk_dynamodb::operation::batch_write_item::BatchWriteItemError::RequestLimitExceeded(e) => - crate::conversions::error::request_limit_exceeded::to_dafny(e.clone()), - aws_sdk_dynamodb::operation::batch_write_item::BatchWriteItemError::ItemCollectionSizeLimitExceededException(e) => - crate::conversions::error::item_collection_size_limit_exceeded_exception::to_dafny(e.clone()), - aws_sdk_dynamodb::operation::batch_write_item::BatchWriteItemError::ProvisionedThroughputExceededException(e) => - crate::conversions::error::provisioned_throughput_exceeded_exception::to_dafny(e.clone()), - e => crate::conversions::error::to_opaque_error(e.to_string()), - }, - _ => { - crate::conversions::error::to_opaque_error(value.to_string()) - } - } -} diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/batch_write_item/_batch_write_item_request.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/batch_write_item/_batch_write_item_request.rs deleted file mode 100644 index 8273ddb16..000000000 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/batch_write_item/_batch_write_item_request.rs +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: &aws_sdk_dynamodb::operation::batch_write_item::BatchWriteItemInput, -) -> ::std::rc::Rc< - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::BatchWriteItemInput, ->{ - ::std::rc::Rc::new(crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::BatchWriteItemInput::BatchWriteItemInput { - RequestItems: ::dafny_runtime::dafny_runtime_conversions::hashmap_to_dafny_map(&value.request_items.clone().unwrap(), - |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&k), - |v| ::dafny_runtime::dafny_runtime_conversions::vec_to_dafny_sequence(&v, - |e| crate::conversions::write_request::to_dafny(&e) -, -) -, -) -, - ReturnConsumedCapacity: ::std::rc::Rc::new(match &value.return_consumed_capacity { - Some(x) => crate::_Wrappers_Compile::Option::Some { value: crate::conversions::return_consumed_capacity::to_dafny(x.clone()) }, - None => crate::_Wrappers_Compile::Option::None { } -}) -, - ReturnItemCollectionMetrics: ::std::rc::Rc::new(match &value.return_item_collection_metrics { - Some(x) => crate::_Wrappers_Compile::Option::Some { value: crate::conversions::return_item_collection_metrics::to_dafny(x.clone()) }, - None => crate::_Wrappers_Compile::Option::None { } -}) -, - }) -} - #[allow(dead_code)] -pub fn from_dafny( - dafny_value: ::std::rc::Rc< - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::BatchWriteItemInput, - >, - client: aws_sdk_dynamodb::Client, -) -> aws_sdk_dynamodb::operation::batch_write_item::builders::BatchWriteItemFluentBuilder { - client.batch_write_item() - .set_request_items(Some( ::dafny_runtime::dafny_runtime_conversions::dafny_map_to_hashmap(&dafny_value.RequestItems(), - |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(k), - |v| ::dafny_runtime::dafny_runtime_conversions::dafny_sequence_to_vec(v, - |e| crate::conversions::write_request::from_dafny(e.clone()) -, -) -, -) - )) - .set_return_consumed_capacity(match &**dafny_value.ReturnConsumedCapacity() { - crate::r#_Wrappers_Compile::Option::Some { value } => Some( - crate::conversions::return_consumed_capacity::from_dafny(value) - ), - _ => None, -} -) - .set_return_item_collection_metrics(match &**dafny_value.ReturnItemCollectionMetrics() { - crate::r#_Wrappers_Compile::Option::Some { value } => Some( - crate::conversions::return_item_collection_metrics::from_dafny(value) - ), - _ => None, -} -) -} diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/batch_write_item/_batch_write_item_response.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/batch_write_item/_batch_write_item_response.rs deleted file mode 100644 index 1896a75b6..000000000 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/batch_write_item/_batch_write_item_response.rs +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: &aws_sdk_dynamodb::operation::batch_write_item::BatchWriteItemOutput -) -> ::std::rc::Rc< - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::BatchWriteItemOutput, ->{ - ::std::rc::Rc::new(crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::BatchWriteItemOutput::BatchWriteItemOutput { - UnprocessedItems: -::std::rc::Rc::new(match &value.unprocessed_items { - Some(x) => crate::r#_Wrappers_Compile::Option::Some { value : - ::dafny_runtime::dafny_runtime_conversions::hashmap_to_dafny_map(x, - |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&k), - |v| ::dafny_runtime::dafny_runtime_conversions::vec_to_dafny_sequence(&v, - |e| crate::conversions::write_request::to_dafny(&e) -, -) -, - ) - }, - None => crate::r#_Wrappers_Compile::Option::None {} -}) -, - ItemCollectionMetrics: -::std::rc::Rc::new(match &value.item_collection_metrics { - Some(x) => crate::r#_Wrappers_Compile::Option::Some { value : - ::dafny_runtime::dafny_runtime_conversions::hashmap_to_dafny_map(x, - |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&k), - |v| ::dafny_runtime::dafny_runtime_conversions::vec_to_dafny_sequence(&v, - |e| crate::conversions::item_collection_metrics::to_dafny(&e) -, -) -, - ) - }, - None => crate::r#_Wrappers_Compile::Option::None {} -}) -, - ConsumedCapacity: ::std::rc::Rc::new(match &value.consumed_capacity { - Some(x) => crate::r#_Wrappers_Compile::Option::Some { value : - ::dafny_runtime::dafny_runtime_conversions::vec_to_dafny_sequence(x, - |e| crate::conversions::consumed_capacity::to_dafny(&e) -, - ) - }, - None => crate::r#_Wrappers_Compile::Option::None {} -}) -, - }) -} - diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/billing_mode.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/billing_mode.rs deleted file mode 100644 index a29d5b356..000000000 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/billing_mode.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] - -pub fn to_dafny( - value: aws_sdk_dynamodb::types::BillingMode, -) -> ::std::rc::Rc{ - ::std::rc::Rc::new(match value { - aws_sdk_dynamodb::types::BillingMode::Provisioned => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::BillingMode::PROVISIONED {}, -aws_sdk_dynamodb::types::BillingMode::PayPerRequest => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::BillingMode::PAY_PER_REQUEST {}, - _ => panic!("Unknown enum variant: {}", value), - }) -} - #[allow(dead_code)] -pub fn from_dafny( - dafny_value: &crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::BillingMode, -) -> aws_sdk_dynamodb::types::BillingMode { - match dafny_value { - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::BillingMode::PROVISIONED {} => aws_sdk_dynamodb::types::BillingMode::Provisioned, -crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::BillingMode::PAY_PER_REQUEST {} => aws_sdk_dynamodb::types::BillingMode::PayPerRequest, - } -} diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/billing_mode_summary.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/billing_mode_summary.rs deleted file mode 100644 index 1b5741406..000000000 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/billing_mode_summary.rs +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: &aws_sdk_dynamodb::types::BillingModeSummary, -) -> ::std::rc::Rc{ - ::std::rc::Rc::new( - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::BillingModeSummary::BillingModeSummary { - BillingMode: ::std::rc::Rc::new(match &value.billing_mode { - Some(x) => crate::_Wrappers_Compile::Option::Some { value: crate::conversions::billing_mode::to_dafny(x.clone()) }, - None => crate::_Wrappers_Compile::Option::None { } -}) -, - LastUpdateToPayPerRequestDateTime: crate::standard_library_conversions::otimestamp_to_dafny(&value.last_update_to_pay_per_request_date_time), - } - ) -} #[allow(dead_code)] -pub fn from_dafny( - dafny_value: ::std::rc::Rc< - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::BillingModeSummary, - >, -) -> aws_sdk_dynamodb::types::BillingModeSummary { - aws_sdk_dynamodb::types::BillingModeSummary::builder() - .set_billing_mode(match &**dafny_value.BillingMode() { - crate::r#_Wrappers_Compile::Option::Some { value } => Some( - crate::conversions::billing_mode::from_dafny(value) - ), - _ => None, -} -) - .set_last_update_to_pay_per_request_date_time(crate::standard_library_conversions::otimestamp_from_dafny(dafny_value.LastUpdateToPayPerRequestDateTime().clone())) - .build() - -} diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/cancellation_reason.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/cancellation_reason.rs deleted file mode 100644 index 02def6098..000000000 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/cancellation_reason.rs +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: &aws_sdk_dynamodb::types::CancellationReason, -) -> ::std::rc::Rc{ - ::std::rc::Rc::new( - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::CancellationReason::CancellationReason { - Item: -::std::rc::Rc::new(match &value.item { - Some(x) => crate::r#_Wrappers_Compile::Option::Some { value : - ::dafny_runtime::dafny_runtime_conversions::hashmap_to_dafny_map(x, - |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&k), - |v| crate::conversions::attribute_value::to_dafny(&v) -, - ) - }, - None => crate::r#_Wrappers_Compile::Option::None {} -}) -, - Code: crate::standard_library_conversions::ostring_to_dafny(&value.code), - Message: crate::standard_library_conversions::ostring_to_dafny(&value.message), - } - ) -} #[allow(dead_code)] -pub fn from_dafny( - dafny_value: ::std::rc::Rc< - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::CancellationReason, - >, -) -> aws_sdk_dynamodb::types::CancellationReason { - aws_sdk_dynamodb::types::CancellationReason::builder() - .set_item(match (*dafny_value.Item()).as_ref() { - crate::r#_Wrappers_Compile::Option::Some { value } => - Some( - ::dafny_runtime::dafny_runtime_conversions::dafny_map_to_hashmap(value, - |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(k), - |v| crate::conversions::attribute_value::from_dafny(v.clone()) -, - ) - ), - _ => None -} -) - .set_code(crate::standard_library_conversions::ostring_from_dafny(dafny_value.Code().clone())) - .set_message(crate::standard_library_conversions::ostring_from_dafny(dafny_value.Message().clone())) - .build() - -} diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/capacity.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/capacity.rs deleted file mode 100644 index 67c651928..000000000 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/capacity.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: &aws_sdk_dynamodb::types::Capacity, -) -> ::std::rc::Rc{ - ::std::rc::Rc::new( - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::Capacity::Capacity { - ReadCapacityUnits: crate::standard_library_conversions::odouble_to_dafny(&value.read_capacity_units), - WriteCapacityUnits: crate::standard_library_conversions::odouble_to_dafny(&value.write_capacity_units), - CapacityUnits: crate::standard_library_conversions::odouble_to_dafny(&value.capacity_units), - } - ) -} #[allow(dead_code)] -pub fn from_dafny( - dafny_value: ::std::rc::Rc< - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::Capacity, - >, -) -> aws_sdk_dynamodb::types::Capacity { - aws_sdk_dynamodb::types::Capacity::builder() - .set_read_capacity_units(crate::standard_library_conversions::odouble_from_dafny(dafny_value.ReadCapacityUnits().clone())) - .set_write_capacity_units(crate::standard_library_conversions::odouble_from_dafny(dafny_value.WriteCapacityUnits().clone())) - .set_capacity_units(crate::standard_library_conversions::odouble_from_dafny(dafny_value.CapacityUnits().clone())) - .build() - -} diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/comparison_operator.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/comparison_operator.rs deleted file mode 100644 index a18dec568..000000000 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/comparison_operator.rs +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] - -pub fn to_dafny( - value: aws_sdk_dynamodb::types::ComparisonOperator, -) -> ::std::rc::Rc{ - ::std::rc::Rc::new(match value { - aws_sdk_dynamodb::types::ComparisonOperator::Eq => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ComparisonOperator::EQ {}, -aws_sdk_dynamodb::types::ComparisonOperator::Ne => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ComparisonOperator::NE {}, -aws_sdk_dynamodb::types::ComparisonOperator::In => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ComparisonOperator::IN {}, -aws_sdk_dynamodb::types::ComparisonOperator::Le => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ComparisonOperator::LE {}, -aws_sdk_dynamodb::types::ComparisonOperator::Lt => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ComparisonOperator::LT {}, -aws_sdk_dynamodb::types::ComparisonOperator::Ge => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ComparisonOperator::GE {}, -aws_sdk_dynamodb::types::ComparisonOperator::Gt => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ComparisonOperator::GT {}, -aws_sdk_dynamodb::types::ComparisonOperator::Between => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ComparisonOperator::BETWEEN {}, -aws_sdk_dynamodb::types::ComparisonOperator::NotNull => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ComparisonOperator::NOT_NULL {}, -aws_sdk_dynamodb::types::ComparisonOperator::Null => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ComparisonOperator::NULL {}, -aws_sdk_dynamodb::types::ComparisonOperator::Contains => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ComparisonOperator::CONTAINS {}, -aws_sdk_dynamodb::types::ComparisonOperator::NotContains => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ComparisonOperator::NOT_CONTAINS {}, -aws_sdk_dynamodb::types::ComparisonOperator::BeginsWith => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ComparisonOperator::BEGINS_WITH {}, - _ => panic!("Unknown enum variant: {}", value), - }) -} - #[allow(dead_code)] -pub fn from_dafny( - dafny_value: &crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ComparisonOperator, -) -> aws_sdk_dynamodb::types::ComparisonOperator { - match dafny_value { - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ComparisonOperator::EQ {} => aws_sdk_dynamodb::types::ComparisonOperator::Eq, -crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ComparisonOperator::NE {} => aws_sdk_dynamodb::types::ComparisonOperator::Ne, -crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ComparisonOperator::IN {} => aws_sdk_dynamodb::types::ComparisonOperator::In, -crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ComparisonOperator::LE {} => aws_sdk_dynamodb::types::ComparisonOperator::Le, -crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ComparisonOperator::LT {} => aws_sdk_dynamodb::types::ComparisonOperator::Lt, -crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ComparisonOperator::GE {} => aws_sdk_dynamodb::types::ComparisonOperator::Ge, -crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ComparisonOperator::GT {} => aws_sdk_dynamodb::types::ComparisonOperator::Gt, -crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ComparisonOperator::BETWEEN {} => aws_sdk_dynamodb::types::ComparisonOperator::Between, -crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ComparisonOperator::NOT_NULL {} => aws_sdk_dynamodb::types::ComparisonOperator::NotNull, -crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ComparisonOperator::NULL {} => aws_sdk_dynamodb::types::ComparisonOperator::Null, -crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ComparisonOperator::CONTAINS {} => aws_sdk_dynamodb::types::ComparisonOperator::Contains, -crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ComparisonOperator::NOT_CONTAINS {} => aws_sdk_dynamodb::types::ComparisonOperator::NotContains, -crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ComparisonOperator::BEGINS_WITH {} => aws_sdk_dynamodb::types::ComparisonOperator::BeginsWith, - } -} diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/condition.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/condition.rs deleted file mode 100644 index 78de17aa7..000000000 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/condition.rs +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: &aws_sdk_dynamodb::types::Condition, -) -> ::std::rc::Rc{ - ::std::rc::Rc::new( - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::Condition::Condition { - AttributeValueList: ::std::rc::Rc::new(match &value.attribute_value_list { - Some(x) => crate::r#_Wrappers_Compile::Option::Some { value : - ::dafny_runtime::dafny_runtime_conversions::vec_to_dafny_sequence(x, - |e| crate::conversions::attribute_value::to_dafny(&e) -, - ) - }, - None => crate::r#_Wrappers_Compile::Option::None {} -}) -, - ComparisonOperator: crate::conversions::comparison_operator::to_dafny(value.comparison_operator.clone()), - } - ) -} #[allow(dead_code)] -pub fn from_dafny( - dafny_value: ::std::rc::Rc< - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::Condition, - >, -) -> aws_sdk_dynamodb::types::Condition { - aws_sdk_dynamodb::types::Condition::builder() - .set_attribute_value_list(match (*dafny_value.AttributeValueList()).as_ref() { - crate::r#_Wrappers_Compile::Option::Some { value } => - Some( - ::dafny_runtime::dafny_runtime_conversions::dafny_sequence_to_vec(value, - |e| crate::conversions::attribute_value::from_dafny(e.clone()) -, - ) - ), - _ => None -} -) - .set_comparison_operator(Some( crate::conversions::comparison_operator::from_dafny(dafny_value.ComparisonOperator()) )) - .build() - .unwrap() -} diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/condition_check.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/condition_check.rs deleted file mode 100644 index b73a3f866..000000000 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/condition_check.rs +++ /dev/null @@ -1,95 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: &aws_sdk_dynamodb::types::ConditionCheck, -) -> ::std::rc::Rc{ - ::std::rc::Rc::new( - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ConditionCheck::ConditionCheck { - Key: ::dafny_runtime::dafny_runtime_conversions::hashmap_to_dafny_map(&value.key.clone(), - |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&k), - |v| crate::conversions::attribute_value::to_dafny(&v) -, -) -, - TableName: dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&value.table_name), - ConditionExpression: dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&value.condition_expression), - ExpressionAttributeNames: -::std::rc::Rc::new(match &value.expression_attribute_names { - Some(x) => crate::r#_Wrappers_Compile::Option::Some { value : - ::dafny_runtime::dafny_runtime_conversions::hashmap_to_dafny_map(x, - |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&k), - |v| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&v), - ) - }, - None => crate::r#_Wrappers_Compile::Option::None {} -}) -, - ExpressionAttributeValues: -::std::rc::Rc::new(match &value.expression_attribute_values { - Some(x) => crate::r#_Wrappers_Compile::Option::Some { value : - ::dafny_runtime::dafny_runtime_conversions::hashmap_to_dafny_map(x, - |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&k), - |v| crate::conversions::attribute_value::to_dafny(&v) -, - ) - }, - None => crate::r#_Wrappers_Compile::Option::None {} -}) -, - ReturnValuesOnConditionCheckFailure: ::std::rc::Rc::new(match &value.return_values_on_condition_check_failure { - Some(x) => crate::_Wrappers_Compile::Option::Some { value: crate::conversions::return_values_on_condition_check_failure::to_dafny(x.clone()) }, - None => crate::_Wrappers_Compile::Option::None { } -}) -, - } - ) -} #[allow(dead_code)] -pub fn from_dafny( - dafny_value: ::std::rc::Rc< - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ConditionCheck, - >, -) -> aws_sdk_dynamodb::types::ConditionCheck { - aws_sdk_dynamodb::types::ConditionCheck::builder() - .set_key(Some( ::dafny_runtime::dafny_runtime_conversions::dafny_map_to_hashmap(&dafny_value.Key(), - |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(k), - |v| crate::conversions::attribute_value::from_dafny(v.clone()) -, -) - )) - .set_table_name(Some( dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(dafny_value.TableName()) )) - .set_condition_expression(Some( dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(dafny_value.ConditionExpression()) )) - .set_expression_attribute_names(match (*dafny_value.ExpressionAttributeNames()).as_ref() { - crate::r#_Wrappers_Compile::Option::Some { value } => - Some( - ::dafny_runtime::dafny_runtime_conversions::dafny_map_to_hashmap(value, - |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(k), - |v| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(v), - ) - ), - _ => None -} -) - .set_expression_attribute_values(match (*dafny_value.ExpressionAttributeValues()).as_ref() { - crate::r#_Wrappers_Compile::Option::Some { value } => - Some( - ::dafny_runtime::dafny_runtime_conversions::dafny_map_to_hashmap(value, - |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(k), - |v| crate::conversions::attribute_value::from_dafny(v.clone()) -, - ) - ), - _ => None -} -) - .set_return_values_on_condition_check_failure(match &**dafny_value.ReturnValuesOnConditionCheckFailure() { - crate::r#_Wrappers_Compile::Option::Some { value } => Some( - crate::conversions::return_values_on_condition_check_failure::from_dafny(value) - ), - _ => None, -} -) - .build() - .unwrap() -} diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/conditional_operator.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/conditional_operator.rs deleted file mode 100644 index 216ac006f..000000000 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/conditional_operator.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] - -pub fn to_dafny( - value: aws_sdk_dynamodb::types::ConditionalOperator, -) -> ::std::rc::Rc{ - ::std::rc::Rc::new(match value { - aws_sdk_dynamodb::types::ConditionalOperator::And => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ConditionalOperator::AND {}, -aws_sdk_dynamodb::types::ConditionalOperator::Or => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ConditionalOperator::OR {}, - _ => panic!("Unknown enum variant: {}", value), - }) -} - #[allow(dead_code)] -pub fn from_dafny( - dafny_value: &crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ConditionalOperator, -) -> aws_sdk_dynamodb::types::ConditionalOperator { - match dafny_value { - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ConditionalOperator::AND {} => aws_sdk_dynamodb::types::ConditionalOperator::And, -crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ConditionalOperator::OR {} => aws_sdk_dynamodb::types::ConditionalOperator::Or, - } -} diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/consumed_capacity.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/consumed_capacity.rs deleted file mode 100644 index 474227783..000000000 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/consumed_capacity.rs +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: &aws_sdk_dynamodb::types::ConsumedCapacity, -) -> ::std::rc::Rc{ - ::std::rc::Rc::new( - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ConsumedCapacity::ConsumedCapacity { - TableName: crate::standard_library_conversions::ostring_to_dafny(&value.table_name), - CapacityUnits: crate::standard_library_conversions::odouble_to_dafny(&value.capacity_units), - ReadCapacityUnits: crate::standard_library_conversions::odouble_to_dafny(&value.read_capacity_units), - WriteCapacityUnits: crate::standard_library_conversions::odouble_to_dafny(&value.write_capacity_units), - Table: ::std::rc::Rc::new(match &value.table { - Some(x) => crate::_Wrappers_Compile::Option::Some { value: crate::conversions::capacity::to_dafny(&x) }, - None => crate::_Wrappers_Compile::Option::None { } -}) -, - LocalSecondaryIndexes: -::std::rc::Rc::new(match &value.local_secondary_indexes { - Some(x) => crate::r#_Wrappers_Compile::Option::Some { value : - ::dafny_runtime::dafny_runtime_conversions::hashmap_to_dafny_map(x, - |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&k), - |v| crate::conversions::capacity::to_dafny(&v) -, - ) - }, - None => crate::r#_Wrappers_Compile::Option::None {} -}) -, - GlobalSecondaryIndexes: -::std::rc::Rc::new(match &value.global_secondary_indexes { - Some(x) => crate::r#_Wrappers_Compile::Option::Some { value : - ::dafny_runtime::dafny_runtime_conversions::hashmap_to_dafny_map(x, - |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&k), - |v| crate::conversions::capacity::to_dafny(&v) -, - ) - }, - None => crate::r#_Wrappers_Compile::Option::None {} -}) -, - } - ) -} #[allow(dead_code)] -pub fn from_dafny( - dafny_value: ::std::rc::Rc< - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ConsumedCapacity, - >, -) -> aws_sdk_dynamodb::types::ConsumedCapacity { - aws_sdk_dynamodb::types::ConsumedCapacity::builder() - .set_table_name(crate::standard_library_conversions::ostring_from_dafny(dafny_value.TableName().clone())) - .set_capacity_units(crate::standard_library_conversions::odouble_from_dafny(dafny_value.CapacityUnits().clone())) - .set_read_capacity_units(crate::standard_library_conversions::odouble_from_dafny(dafny_value.ReadCapacityUnits().clone())) - .set_write_capacity_units(crate::standard_library_conversions::odouble_from_dafny(dafny_value.WriteCapacityUnits().clone())) - .set_table(match (*dafny_value.Table()).as_ref() { - crate::r#_Wrappers_Compile::Option::Some { value } => - Some(crate::conversions::capacity::from_dafny(value.clone())), - _ => None, -} -) - .set_local_secondary_indexes(match (*dafny_value.LocalSecondaryIndexes()).as_ref() { - crate::r#_Wrappers_Compile::Option::Some { value } => - Some( - ::dafny_runtime::dafny_runtime_conversions::dafny_map_to_hashmap(value, - |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(k), - |v| crate::conversions::capacity::from_dafny(v.clone()) -, - ) - ), - _ => None -} -) - .set_global_secondary_indexes(match (*dafny_value.GlobalSecondaryIndexes()).as_ref() { - crate::r#_Wrappers_Compile::Option::Some { value } => - Some( - ::dafny_runtime::dafny_runtime_conversions::dafny_map_to_hashmap(value, - |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(k), - |v| crate::conversions::capacity::from_dafny(v.clone()) -, - ) - ), - _ => None -} -) - .build() - -} diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/create_table.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/create_table.rs deleted file mode 100644 index 20182a565..000000000 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/create_table.rs +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -pub mod _create_table_request; - - pub mod _create_table_response; - #[allow(dead_code)] -pub fn to_dafny_error( - value: &::aws_smithy_runtime_api::client::result::SdkError< - aws_sdk_dynamodb::operation::create_table::CreateTableError, - ::aws_smithy_runtime_api::client::orchestrator::HttpResponse, - >, -) -> ::std::rc::Rc { - match value { - aws_sdk_dynamodb::error::SdkError::ServiceError(service_error) => match service_error.err() { - aws_sdk_dynamodb::operation::create_table::CreateTableError::InternalServerError(e) => - crate::conversions::error::internal_server_error::to_dafny(e.clone()), - aws_sdk_dynamodb::operation::create_table::CreateTableError::InvalidEndpointException(e) => - crate::conversions::error::invalid_endpoint_exception::to_dafny(e.clone()), - aws_sdk_dynamodb::operation::create_table::CreateTableError::LimitExceededException(e) => - crate::conversions::error::limit_exceeded_exception::to_dafny(e.clone()), - aws_sdk_dynamodb::operation::create_table::CreateTableError::ResourceInUseException(e) => - crate::conversions::error::resource_in_use_exception::to_dafny(e.clone()), - e => crate::conversions::error::to_opaque_error(e.to_string()), - }, - _ => { - crate::conversions::error::to_opaque_error(value.to_string()) - } - } -} diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/create_table/_create_table_request.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/create_table/_create_table_request.rs deleted file mode 100644 index 12aefbb73..000000000 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/create_table/_create_table_request.rs +++ /dev/null @@ -1,163 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: &aws_sdk_dynamodb::operation::create_table::CreateTableInput, -) -> ::std::rc::Rc< - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::CreateTableInput, ->{ - ::std::rc::Rc::new(crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::CreateTableInput::CreateTableInput { - AttributeDefinitions: ::dafny_runtime::dafny_runtime_conversions::vec_to_dafny_sequence(&value.attribute_definitions.clone().unwrap(), - |e| crate::conversions::attribute_definition::to_dafny(&e) -, -) -, - TableName: crate::standard_library_conversions::ostring_to_dafny(&value.table_name) .Extract(), - KeySchema: ::dafny_runtime::dafny_runtime_conversions::vec_to_dafny_sequence(&value.key_schema.clone().unwrap(), - |e| crate::conversions::key_schema_element::to_dafny(&e) -, -) -, - LocalSecondaryIndexes: ::std::rc::Rc::new(match &value.local_secondary_indexes { - Some(x) => crate::r#_Wrappers_Compile::Option::Some { value : - ::dafny_runtime::dafny_runtime_conversions::vec_to_dafny_sequence(x, - |e| crate::conversions::local_secondary_index::to_dafny(&e) -, - ) - }, - None => crate::r#_Wrappers_Compile::Option::None {} -}) -, - GlobalSecondaryIndexes: ::std::rc::Rc::new(match &value.global_secondary_indexes { - Some(x) => crate::r#_Wrappers_Compile::Option::Some { value : - ::dafny_runtime::dafny_runtime_conversions::vec_to_dafny_sequence(x, - |e| crate::conversions::global_secondary_index::to_dafny(&e) -, - ) - }, - None => crate::r#_Wrappers_Compile::Option::None {} -}) -, - BillingMode: ::std::rc::Rc::new(match &value.billing_mode { - Some(x) => crate::_Wrappers_Compile::Option::Some { value: crate::conversions::billing_mode::to_dafny(x.clone()) }, - None => crate::_Wrappers_Compile::Option::None { } -}) -, - ProvisionedThroughput: ::std::rc::Rc::new(match &value.provisioned_throughput { - Some(x) => crate::_Wrappers_Compile::Option::Some { value: crate::conversions::provisioned_throughput::to_dafny(&x) }, - None => crate::_Wrappers_Compile::Option::None { } -}) -, - StreamSpecification: ::std::rc::Rc::new(match &value.stream_specification { - Some(x) => crate::_Wrappers_Compile::Option::Some { value: crate::conversions::stream_specification::to_dafny(&x) }, - None => crate::_Wrappers_Compile::Option::None { } -}) -, - SSESpecification: ::std::rc::Rc::new(match &value.sse_specification { - Some(x) => crate::_Wrappers_Compile::Option::Some { value: crate::conversions::sse_specification::to_dafny(&x) }, - None => crate::_Wrappers_Compile::Option::None { } -}) -, - Tags: ::std::rc::Rc::new(match &value.tags { - Some(x) => crate::r#_Wrappers_Compile::Option::Some { value : - ::dafny_runtime::dafny_runtime_conversions::vec_to_dafny_sequence(x, - |e| crate::conversions::tag::to_dafny(&e) -, - ) - }, - None => crate::r#_Wrappers_Compile::Option::None {} -}) -, - TableClass: ::std::rc::Rc::new(match &value.table_class { - Some(x) => crate::_Wrappers_Compile::Option::Some { value: crate::conversions::table_class::to_dafny(x.clone()) }, - None => crate::_Wrappers_Compile::Option::None { } -}) -, - }) -} - #[allow(dead_code)] -pub fn from_dafny( - dafny_value: ::std::rc::Rc< - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::CreateTableInput, - >, - client: aws_sdk_dynamodb::Client, -) -> aws_sdk_dynamodb::operation::create_table::builders::CreateTableFluentBuilder { - client.create_table() - .set_attribute_definitions(Some( ::dafny_runtime::dafny_runtime_conversions::dafny_sequence_to_vec(dafny_value.AttributeDefinitions(), - |e| crate::conversions::attribute_definition::from_dafny(e.clone()) -, -) - )) - .set_table_name(Some( dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(dafny_value.TableName()) )) - .set_key_schema(Some( ::dafny_runtime::dafny_runtime_conversions::dafny_sequence_to_vec(dafny_value.KeySchema(), - |e| crate::conversions::key_schema_element::from_dafny(e.clone()) -, -) - )) - .set_local_secondary_indexes(match (*dafny_value.LocalSecondaryIndexes()).as_ref() { - crate::r#_Wrappers_Compile::Option::Some { value } => - Some( - ::dafny_runtime::dafny_runtime_conversions::dafny_sequence_to_vec(value, - |e| crate::conversions::local_secondary_index::from_dafny(e.clone()) -, - ) - ), - _ => None -} -) - .set_global_secondary_indexes(match (*dafny_value.GlobalSecondaryIndexes()).as_ref() { - crate::r#_Wrappers_Compile::Option::Some { value } => - Some( - ::dafny_runtime::dafny_runtime_conversions::dafny_sequence_to_vec(value, - |e| crate::conversions::global_secondary_index::from_dafny(e.clone()) -, - ) - ), - _ => None -} -) - .set_billing_mode(match &**dafny_value.BillingMode() { - crate::r#_Wrappers_Compile::Option::Some { value } => Some( - crate::conversions::billing_mode::from_dafny(value) - ), - _ => None, -} -) - .set_provisioned_throughput(match (*dafny_value.ProvisionedThroughput()).as_ref() { - crate::r#_Wrappers_Compile::Option::Some { value } => - Some(crate::conversions::provisioned_throughput::from_dafny(value.clone())), - _ => None, -} -) - .set_stream_specification(match (*dafny_value.StreamSpecification()).as_ref() { - crate::r#_Wrappers_Compile::Option::Some { value } => - Some(crate::conversions::stream_specification::from_dafny(value.clone())), - _ => None, -} -) - .set_sse_specification(match (*dafny_value.SSESpecification()).as_ref() { - crate::r#_Wrappers_Compile::Option::Some { value } => - Some(crate::conversions::sse_specification::from_dafny(value.clone())), - _ => None, -} -) - .set_tags(match (*dafny_value.Tags()).as_ref() { - crate::r#_Wrappers_Compile::Option::Some { value } => - Some( - ::dafny_runtime::dafny_runtime_conversions::dafny_sequence_to_vec(value, - |e| crate::conversions::tag::from_dafny(e.clone()) -, - ) - ), - _ => None -} -) - .set_table_class(match &**dafny_value.TableClass() { - crate::r#_Wrappers_Compile::Option::Some { value } => Some( - crate::conversions::table_class::from_dafny(value) - ), - _ => None, -} -) -} diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/create_table/_create_table_response.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/create_table/_create_table_response.rs deleted file mode 100644 index ee61b5a61..000000000 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/create_table/_create_table_response.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: &aws_sdk_dynamodb::operation::create_table::CreateTableOutput -) -> ::std::rc::Rc< - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::CreateTableOutput, ->{ - ::std::rc::Rc::new(crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::CreateTableOutput::CreateTableOutput { - TableDescription: ::std::rc::Rc::new(match &value.table_description { - Some(x) => crate::_Wrappers_Compile::Option::Some { value: crate::conversions::table_description::to_dafny(&x) }, - None => crate::_Wrappers_Compile::Option::None { } -}) -, - }) -} - diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/delete.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/delete.rs deleted file mode 100644 index eeee3a6da..000000000 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/delete.rs +++ /dev/null @@ -1,95 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: &aws_sdk_dynamodb::types::Delete, -) -> ::std::rc::Rc{ - ::std::rc::Rc::new( - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::Delete::Delete { - Key: ::dafny_runtime::dafny_runtime_conversions::hashmap_to_dafny_map(&value.key.clone(), - |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&k), - |v| crate::conversions::attribute_value::to_dafny(&v) -, -) -, - TableName: dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&value.table_name), - ConditionExpression: crate::standard_library_conversions::ostring_to_dafny(&value.condition_expression), - ExpressionAttributeNames: -::std::rc::Rc::new(match &value.expression_attribute_names { - Some(x) => crate::r#_Wrappers_Compile::Option::Some { value : - ::dafny_runtime::dafny_runtime_conversions::hashmap_to_dafny_map(x, - |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&k), - |v| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&v), - ) - }, - None => crate::r#_Wrappers_Compile::Option::None {} -}) -, - ExpressionAttributeValues: -::std::rc::Rc::new(match &value.expression_attribute_values { - Some(x) => crate::r#_Wrappers_Compile::Option::Some { value : - ::dafny_runtime::dafny_runtime_conversions::hashmap_to_dafny_map(x, - |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&k), - |v| crate::conversions::attribute_value::to_dafny(&v) -, - ) - }, - None => crate::r#_Wrappers_Compile::Option::None {} -}) -, - ReturnValuesOnConditionCheckFailure: ::std::rc::Rc::new(match &value.return_values_on_condition_check_failure { - Some(x) => crate::_Wrappers_Compile::Option::Some { value: crate::conversions::return_values_on_condition_check_failure::to_dafny(x.clone()) }, - None => crate::_Wrappers_Compile::Option::None { } -}) -, - } - ) -} #[allow(dead_code)] -pub fn from_dafny( - dafny_value: ::std::rc::Rc< - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::Delete, - >, -) -> aws_sdk_dynamodb::types::Delete { - aws_sdk_dynamodb::types::Delete::builder() - .set_key(Some( ::dafny_runtime::dafny_runtime_conversions::dafny_map_to_hashmap(&dafny_value.Key(), - |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(k), - |v| crate::conversions::attribute_value::from_dafny(v.clone()) -, -) - )) - .set_table_name(Some( dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(dafny_value.TableName()) )) - .set_condition_expression(crate::standard_library_conversions::ostring_from_dafny(dafny_value.ConditionExpression().clone())) - .set_expression_attribute_names(match (*dafny_value.ExpressionAttributeNames()).as_ref() { - crate::r#_Wrappers_Compile::Option::Some { value } => - Some( - ::dafny_runtime::dafny_runtime_conversions::dafny_map_to_hashmap(value, - |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(k), - |v| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(v), - ) - ), - _ => None -} -) - .set_expression_attribute_values(match (*dafny_value.ExpressionAttributeValues()).as_ref() { - crate::r#_Wrappers_Compile::Option::Some { value } => - Some( - ::dafny_runtime::dafny_runtime_conversions::dafny_map_to_hashmap(value, - |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(k), - |v| crate::conversions::attribute_value::from_dafny(v.clone()) -, - ) - ), - _ => None -} -) - .set_return_values_on_condition_check_failure(match &**dafny_value.ReturnValuesOnConditionCheckFailure() { - crate::r#_Wrappers_Compile::Option::Some { value } => Some( - crate::conversions::return_values_on_condition_check_failure::from_dafny(value) - ), - _ => None, -} -) - .build() - .unwrap() -} diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/delete_item.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/delete_item.rs deleted file mode 100644 index c4f3b25c5..000000000 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/delete_item.rs +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -pub mod _delete_item_request; - - pub mod _delete_item_response; - #[allow(dead_code)] -pub fn to_dafny_error( - value: &::aws_smithy_runtime_api::client::result::SdkError< - aws_sdk_dynamodb::operation::delete_item::DeleteItemError, - ::aws_smithy_runtime_api::client::orchestrator::HttpResponse, - >, -) -> ::std::rc::Rc { - match value { - aws_sdk_dynamodb::error::SdkError::ServiceError(service_error) => match service_error.err() { - aws_sdk_dynamodb::operation::delete_item::DeleteItemError::InternalServerError(e) => - crate::conversions::error::internal_server_error::to_dafny(e.clone()), - aws_sdk_dynamodb::operation::delete_item::DeleteItemError::InvalidEndpointException(e) => - crate::conversions::error::invalid_endpoint_exception::to_dafny(e.clone()), - aws_sdk_dynamodb::operation::delete_item::DeleteItemError::ResourceNotFoundException(e) => - crate::conversions::error::resource_not_found_exception::to_dafny(e.clone()), - aws_sdk_dynamodb::operation::delete_item::DeleteItemError::RequestLimitExceeded(e) => - crate::conversions::error::request_limit_exceeded::to_dafny(e.clone()), - aws_sdk_dynamodb::operation::delete_item::DeleteItemError::TransactionConflictException(e) => - crate::conversions::error::transaction_conflict_exception::to_dafny(e.clone()), - aws_sdk_dynamodb::operation::delete_item::DeleteItemError::ConditionalCheckFailedException(e) => - crate::conversions::error::conditional_check_failed_exception::to_dafny(e.clone()), - aws_sdk_dynamodb::operation::delete_item::DeleteItemError::ItemCollectionSizeLimitExceededException(e) => - crate::conversions::error::item_collection_size_limit_exceeded_exception::to_dafny(e.clone()), - aws_sdk_dynamodb::operation::delete_item::DeleteItemError::ProvisionedThroughputExceededException(e) => - crate::conversions::error::provisioned_throughput_exceeded_exception::to_dafny(e.clone()), - e => crate::conversions::error::to_opaque_error(e.to_string()), - }, - _ => { - crate::conversions::error::to_opaque_error(value.to_string()) - } - } -} diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/delete_item/_delete_item_request.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/delete_item/_delete_item_request.rs deleted file mode 100644 index 27d98b407..000000000 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/delete_item/_delete_item_request.rs +++ /dev/null @@ -1,155 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: &aws_sdk_dynamodb::operation::delete_item::DeleteItemInput, -) -> ::std::rc::Rc< - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::DeleteItemInput, ->{ - ::std::rc::Rc::new(crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::DeleteItemInput::DeleteItemInput { - TableName: crate::standard_library_conversions::ostring_to_dafny(&value.table_name) .Extract(), - Key: ::dafny_runtime::dafny_runtime_conversions::hashmap_to_dafny_map(&value.key.clone().unwrap(), - |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&k), - |v| crate::conversions::attribute_value::to_dafny(&v) -, -) -, - Expected: -::std::rc::Rc::new(match &value.expected { - Some(x) => crate::r#_Wrappers_Compile::Option::Some { value : - ::dafny_runtime::dafny_runtime_conversions::hashmap_to_dafny_map(x, - |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&k), - |v| crate::conversions::expected_attribute_value::to_dafny(&v) -, - ) - }, - None => crate::r#_Wrappers_Compile::Option::None {} -}) -, - ConditionalOperator: ::std::rc::Rc::new(match &value.conditional_operator { - Some(x) => crate::_Wrappers_Compile::Option::Some { value: crate::conversions::conditional_operator::to_dafny(x.clone()) }, - None => crate::_Wrappers_Compile::Option::None { } -}) -, - ReturnValues: ::std::rc::Rc::new(match &value.return_values { - Some(x) => crate::_Wrappers_Compile::Option::Some { value: crate::conversions::return_value::to_dafny(x.clone()) }, - None => crate::_Wrappers_Compile::Option::None { } -}) -, - ReturnConsumedCapacity: ::std::rc::Rc::new(match &value.return_consumed_capacity { - Some(x) => crate::_Wrappers_Compile::Option::Some { value: crate::conversions::return_consumed_capacity::to_dafny(x.clone()) }, - None => crate::_Wrappers_Compile::Option::None { } -}) -, - ReturnItemCollectionMetrics: ::std::rc::Rc::new(match &value.return_item_collection_metrics { - Some(x) => crate::_Wrappers_Compile::Option::Some { value: crate::conversions::return_item_collection_metrics::to_dafny(x.clone()) }, - None => crate::_Wrappers_Compile::Option::None { } -}) -, - ConditionExpression: crate::standard_library_conversions::ostring_to_dafny(&value.condition_expression), - ExpressionAttributeNames: -::std::rc::Rc::new(match &value.expression_attribute_names { - Some(x) => crate::r#_Wrappers_Compile::Option::Some { value : - ::dafny_runtime::dafny_runtime_conversions::hashmap_to_dafny_map(x, - |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&k), - |v| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&v), - ) - }, - None => crate::r#_Wrappers_Compile::Option::None {} -}) -, - ExpressionAttributeValues: -::std::rc::Rc::new(match &value.expression_attribute_values { - Some(x) => crate::r#_Wrappers_Compile::Option::Some { value : - ::dafny_runtime::dafny_runtime_conversions::hashmap_to_dafny_map(x, - |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&k), - |v| crate::conversions::attribute_value::to_dafny(&v) -, - ) - }, - None => crate::r#_Wrappers_Compile::Option::None {} -}) -, - }) -} - #[allow(dead_code)] -pub fn from_dafny( - dafny_value: ::std::rc::Rc< - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::DeleteItemInput, - >, - client: aws_sdk_dynamodb::Client, -) -> aws_sdk_dynamodb::operation::delete_item::builders::DeleteItemFluentBuilder { - client.delete_item() - .set_table_name(Some( dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(dafny_value.TableName()) )) - .set_key(Some( ::dafny_runtime::dafny_runtime_conversions::dafny_map_to_hashmap(&dafny_value.Key(), - |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(k), - |v| crate::conversions::attribute_value::from_dafny(v.clone()) -, -) - )) - .set_expected(match (*dafny_value.Expected()).as_ref() { - crate::r#_Wrappers_Compile::Option::Some { value } => - Some( - ::dafny_runtime::dafny_runtime_conversions::dafny_map_to_hashmap(value, - |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(k), - |v| crate::conversions::expected_attribute_value::from_dafny(v.clone()) -, - ) - ), - _ => None -} -) - .set_conditional_operator(match &**dafny_value.ConditionalOperator() { - crate::r#_Wrappers_Compile::Option::Some { value } => Some( - crate::conversions::conditional_operator::from_dafny(value) - ), - _ => None, -} -) - .set_return_values(match &**dafny_value.ReturnValues() { - crate::r#_Wrappers_Compile::Option::Some { value } => Some( - crate::conversions::return_value::from_dafny(value) - ), - _ => None, -} -) - .set_return_consumed_capacity(match &**dafny_value.ReturnConsumedCapacity() { - crate::r#_Wrappers_Compile::Option::Some { value } => Some( - crate::conversions::return_consumed_capacity::from_dafny(value) - ), - _ => None, -} -) - .set_return_item_collection_metrics(match &**dafny_value.ReturnItemCollectionMetrics() { - crate::r#_Wrappers_Compile::Option::Some { value } => Some( - crate::conversions::return_item_collection_metrics::from_dafny(value) - ), - _ => None, -} -) - .set_condition_expression(crate::standard_library_conversions::ostring_from_dafny(dafny_value.ConditionExpression().clone())) - .set_expression_attribute_names(match (*dafny_value.ExpressionAttributeNames()).as_ref() { - crate::r#_Wrappers_Compile::Option::Some { value } => - Some( - ::dafny_runtime::dafny_runtime_conversions::dafny_map_to_hashmap(value, - |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(k), - |v| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(v), - ) - ), - _ => None -} -) - .set_expression_attribute_values(match (*dafny_value.ExpressionAttributeValues()).as_ref() { - crate::r#_Wrappers_Compile::Option::Some { value } => - Some( - ::dafny_runtime::dafny_runtime_conversions::dafny_map_to_hashmap(value, - |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(k), - |v| crate::conversions::attribute_value::from_dafny(v.clone()) -, - ) - ), - _ => None -} -) -} diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/delete_item/_delete_item_response.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/delete_item/_delete_item_response.rs deleted file mode 100644 index e22195757..000000000 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/delete_item/_delete_item_response.rs +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: &aws_sdk_dynamodb::operation::delete_item::DeleteItemOutput -) -> ::std::rc::Rc< - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::DeleteItemOutput, ->{ - ::std::rc::Rc::new(crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::DeleteItemOutput::DeleteItemOutput { - Attributes: -::std::rc::Rc::new(match &value.attributes { - Some(x) => crate::r#_Wrappers_Compile::Option::Some { value : - ::dafny_runtime::dafny_runtime_conversions::hashmap_to_dafny_map(x, - |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&k), - |v| crate::conversions::attribute_value::to_dafny(&v) -, - ) - }, - None => crate::r#_Wrappers_Compile::Option::None {} -}) -, - ConsumedCapacity: ::std::rc::Rc::new(match &value.consumed_capacity { - Some(x) => crate::_Wrappers_Compile::Option::Some { value: crate::conversions::consumed_capacity::to_dafny(&x) }, - None => crate::_Wrappers_Compile::Option::None { } -}) -, - ItemCollectionMetrics: ::std::rc::Rc::new(match &value.item_collection_metrics { - Some(x) => crate::_Wrappers_Compile::Option::Some { value: crate::conversions::item_collection_metrics::to_dafny(&x) }, - None => crate::_Wrappers_Compile::Option::None { } -}) -, - }) -} - diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/delete_request.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/delete_request.rs deleted file mode 100644 index 9b0b59c5f..000000000 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/delete_request.rs +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: &aws_sdk_dynamodb::types::DeleteRequest, -) -> ::std::rc::Rc{ - ::std::rc::Rc::new( - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::DeleteRequest::DeleteRequest { - Key: ::dafny_runtime::dafny_runtime_conversions::hashmap_to_dafny_map(&value.key.clone(), - |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&k), - |v| crate::conversions::attribute_value::to_dafny(&v) -, -) -, - } - ) -} #[allow(dead_code)] -pub fn from_dafny( - dafny_value: ::std::rc::Rc< - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::DeleteRequest, - >, -) -> aws_sdk_dynamodb::types::DeleteRequest { - aws_sdk_dynamodb::types::DeleteRequest::builder() - .set_key(Some( ::dafny_runtime::dafny_runtime_conversions::dafny_map_to_hashmap(&dafny_value.Key(), - |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(k), - |v| crate::conversions::attribute_value::from_dafny(v.clone()) -, -) - )) - .build() - .unwrap() -} diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/describe_table.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/describe_table.rs deleted file mode 100644 index ed39e1270..000000000 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/describe_table.rs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -pub mod _describe_table_request; - - pub mod _describe_table_response; - #[allow(dead_code)] -pub fn to_dafny_error( - value: &::aws_smithy_runtime_api::client::result::SdkError< - aws_sdk_dynamodb::operation::describe_table::DescribeTableError, - ::aws_smithy_runtime_api::client::orchestrator::HttpResponse, - >, -) -> ::std::rc::Rc { - match value { - aws_sdk_dynamodb::error::SdkError::ServiceError(service_error) => match service_error.err() { - aws_sdk_dynamodb::operation::describe_table::DescribeTableError::InternalServerError(e) => - crate::conversions::error::internal_server_error::to_dafny(e.clone()), - aws_sdk_dynamodb::operation::describe_table::DescribeTableError::InvalidEndpointException(e) => - crate::conversions::error::invalid_endpoint_exception::to_dafny(e.clone()), - aws_sdk_dynamodb::operation::describe_table::DescribeTableError::ResourceNotFoundException(e) => - crate::conversions::error::resource_not_found_exception::to_dafny(e.clone()), - e => crate::conversions::error::to_opaque_error(e.to_string()), - }, - _ => { - crate::conversions::error::to_opaque_error(value.to_string()) - } - } -} diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/describe_table/_describe_table_request.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/describe_table/_describe_table_request.rs deleted file mode 100644 index a8e580c94..000000000 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/describe_table/_describe_table_request.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: &aws_sdk_dynamodb::operation::describe_table::DescribeTableInput, -) -> ::std::rc::Rc< - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::DescribeTableInput, ->{ - ::std::rc::Rc::new(crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::DescribeTableInput::DescribeTableInput { - TableName: crate::standard_library_conversions::ostring_to_dafny(&value.table_name) .Extract(), - }) -} - #[allow(dead_code)] -pub fn from_dafny( - dafny_value: ::std::rc::Rc< - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::DescribeTableInput, - >, - client: aws_sdk_dynamodb::Client, -) -> aws_sdk_dynamodb::operation::describe_table::builders::DescribeTableFluentBuilder { - client.describe_table() - .set_table_name(Some( dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(dafny_value.TableName()) )) -} diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/describe_table/_describe_table_response.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/describe_table/_describe_table_response.rs deleted file mode 100644 index 1ab636bfa..000000000 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/describe_table/_describe_table_response.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: &aws_sdk_dynamodb::operation::describe_table::DescribeTableOutput -) -> ::std::rc::Rc< - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::DescribeTableOutput, ->{ - ::std::rc::Rc::new(crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::DescribeTableOutput::DescribeTableOutput { - Table: ::std::rc::Rc::new(match &value.table { - Some(x) => crate::_Wrappers_Compile::Option::Some { value: crate::conversions::table_description::to_dafny(&x) }, - None => crate::_Wrappers_Compile::Option::None { } -}) -, - }) -} - diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/error.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/error.rs deleted file mode 100644 index 2a35a7fdc..000000000 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/error.rs +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -pub mod conditional_check_failed_exception; - - pub mod duplicate_item_exception; - - pub mod idempotent_parameter_mismatch_exception; - - pub mod internal_server_error; - - pub mod invalid_endpoint_exception; - - pub mod item_collection_size_limit_exceeded_exception; - - pub mod limit_exceeded_exception; - - pub mod provisioned_throughput_exceeded_exception; - - pub mod request_limit_exceeded; - - pub mod resource_in_use_exception; - - pub mod resource_not_found_exception; - - pub mod transaction_canceled_exception; - - pub mod transaction_conflict_exception; - - pub mod transaction_in_progress_exception; - /// Wraps up an arbitrary Rust Error value as a Dafny Error -pub fn to_opaque_error(value: E) -> - ::std::rc::Rc -{ - let error_obj: ::dafny_runtime::Object = ::dafny_runtime::Object(Some( - ::std::rc::Rc::new(::std::cell::UnsafeCell::new(value)), - )); - ::std::rc::Rc::new( - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::Error::Opaque { - obj: error_obj, - }, - ) -} - -/// Wraps up an arbitrary Rust Error value as a Dafny Result.Failure -pub fn to_opaque_error_result(value: E) -> - ::std::rc::Rc< - crate::_Wrappers_Compile::Result< - T, - ::std::rc::Rc - > - > -{ - ::std::rc::Rc::new(crate::_Wrappers_Compile::Result::Failure { - error: to_opaque_error(value), - }) -} diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/error/conditional_check_failed_exception.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/error/conditional_check_failed_exception.rs deleted file mode 100644 index 1cbf04965..000000000 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/error/conditional_check_failed_exception.rs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: aws_sdk_dynamodb::types::error::ConditionalCheckFailedException, -) -> ::std::rc::Rc{ - ::std::rc::Rc::new( - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::Error::ConditionalCheckFailedException { - message: crate::standard_library_conversions::ostring_to_dafny(&value.message), - } - ) -} diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/error/duplicate_item_exception.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/error/duplicate_item_exception.rs deleted file mode 100644 index c1783796f..000000000 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/error/duplicate_item_exception.rs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: aws_sdk_dynamodb::types::error::DuplicateItemException, -) -> ::std::rc::Rc{ - ::std::rc::Rc::new( - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::Error::DuplicateItemException { - message: crate::standard_library_conversions::ostring_to_dafny(&value.message), - } - ) -} diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/error/idempotent_parameter_mismatch_exception.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/error/idempotent_parameter_mismatch_exception.rs deleted file mode 100644 index 870de4f3f..000000000 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/error/idempotent_parameter_mismatch_exception.rs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: aws_sdk_dynamodb::types::error::IdempotentParameterMismatchException, -) -> ::std::rc::Rc{ - ::std::rc::Rc::new( - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::Error::IdempotentParameterMismatchException { - Message: crate::standard_library_conversions::ostring_to_dafny(&value.message), - } - ) -} diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/error/internal_server_error.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/error/internal_server_error.rs deleted file mode 100644 index a3816ac79..000000000 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/error/internal_server_error.rs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: aws_sdk_dynamodb::types::error::InternalServerError, -) -> ::std::rc::Rc{ - ::std::rc::Rc::new( - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::Error::InternalServerError { - message: crate::standard_library_conversions::ostring_to_dafny(&value.message), - } - ) -} diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/error/invalid_endpoint_exception.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/error/invalid_endpoint_exception.rs deleted file mode 100644 index a96d93843..000000000 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/error/invalid_endpoint_exception.rs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: aws_sdk_dynamodb::types::error::InvalidEndpointException, -) -> ::std::rc::Rc{ - ::std::rc::Rc::new( - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::Error::InvalidEndpointException { - Message: crate::standard_library_conversions::ostring_to_dafny(&value.message), - } - ) -} diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/error/item_collection_size_limit_exceeded_exception.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/error/item_collection_size_limit_exceeded_exception.rs deleted file mode 100644 index 867f55c57..000000000 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/error/item_collection_size_limit_exceeded_exception.rs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: aws_sdk_dynamodb::types::error::ItemCollectionSizeLimitExceededException, -) -> ::std::rc::Rc{ - ::std::rc::Rc::new( - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::Error::ItemCollectionSizeLimitExceededException { - message: crate::standard_library_conversions::ostring_to_dafny(&value.message), - } - ) -} diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/error/limit_exceeded_exception.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/error/limit_exceeded_exception.rs deleted file mode 100644 index ee15bff66..000000000 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/error/limit_exceeded_exception.rs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: aws_sdk_dynamodb::types::error::LimitExceededException, -) -> ::std::rc::Rc{ - ::std::rc::Rc::new( - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::Error::LimitExceededException { - message: crate::standard_library_conversions::ostring_to_dafny(&value.message), - } - ) -} diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/error/provisioned_throughput_exceeded_exception.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/error/provisioned_throughput_exceeded_exception.rs deleted file mode 100644 index bc2a2a249..000000000 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/error/provisioned_throughput_exceeded_exception.rs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: aws_sdk_dynamodb::types::error::ProvisionedThroughputExceededException, -) -> ::std::rc::Rc{ - ::std::rc::Rc::new( - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::Error::ProvisionedThroughputExceededException { - message: crate::standard_library_conversions::ostring_to_dafny(&value.message), - } - ) -} diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/error/request_limit_exceeded.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/error/request_limit_exceeded.rs deleted file mode 100644 index f3e140f33..000000000 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/error/request_limit_exceeded.rs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: aws_sdk_dynamodb::types::error::RequestLimitExceeded, -) -> ::std::rc::Rc{ - ::std::rc::Rc::new( - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::Error::RequestLimitExceeded { - message: crate::standard_library_conversions::ostring_to_dafny(&value.message), - } - ) -} diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/error/resource_in_use_exception.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/error/resource_in_use_exception.rs deleted file mode 100644 index d1380a0c3..000000000 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/error/resource_in_use_exception.rs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: aws_sdk_dynamodb::types::error::ResourceInUseException, -) -> ::std::rc::Rc{ - ::std::rc::Rc::new( - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::Error::ResourceInUseException { - message: crate::standard_library_conversions::ostring_to_dafny(&value.message), - } - ) -} diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/error/resource_not_found_exception.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/error/resource_not_found_exception.rs deleted file mode 100644 index 01f18020d..000000000 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/error/resource_not_found_exception.rs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: aws_sdk_dynamodb::types::error::ResourceNotFoundException, -) -> ::std::rc::Rc{ - ::std::rc::Rc::new( - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::Error::ResourceNotFoundException { - message: crate::standard_library_conversions::ostring_to_dafny(&value.message), - } - ) -} diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/error/transaction_canceled_exception.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/error/transaction_canceled_exception.rs deleted file mode 100644 index 8f58cbb23..000000000 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/error/transaction_canceled_exception.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: aws_sdk_dynamodb::types::error::TransactionCanceledException, -) -> ::std::rc::Rc{ - ::std::rc::Rc::new( - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::Error::TransactionCanceledException { - Message: crate::standard_library_conversions::ostring_to_dafny(&value.message), - CancellationReasons: ::std::rc::Rc::new(match &value.cancellation_reasons { - Some(x) => crate::r#_Wrappers_Compile::Option::Some { value : - ::dafny_runtime::dafny_runtime_conversions::vec_to_dafny_sequence(x, - |e| crate::conversions::cancellation_reason::to_dafny(&e) -, - ) - }, - None => crate::r#_Wrappers_Compile::Option::None {} -}) -, - } - ) -} diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/error/transaction_conflict_exception.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/error/transaction_conflict_exception.rs deleted file mode 100644 index 28376e335..000000000 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/error/transaction_conflict_exception.rs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: aws_sdk_dynamodb::types::error::TransactionConflictException, -) -> ::std::rc::Rc{ - ::std::rc::Rc::new( - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::Error::TransactionConflictException { - message: crate::standard_library_conversions::ostring_to_dafny(&value.message), - } - ) -} diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/error/transaction_in_progress_exception.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/error/transaction_in_progress_exception.rs deleted file mode 100644 index 753ada5f9..000000000 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/error/transaction_in_progress_exception.rs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: aws_sdk_dynamodb::types::error::TransactionInProgressException, -) -> ::std::rc::Rc{ - ::std::rc::Rc::new( - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::Error::TransactionInProgressException { - Message: crate::standard_library_conversions::ostring_to_dafny(&value.message), - } - ) -} diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/execute_statement.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/execute_statement.rs deleted file mode 100644 index 7e872a28d..000000000 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/execute_statement.rs +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -pub mod _execute_statement_request; - - pub mod _execute_statement_response; - #[allow(dead_code)] -pub fn to_dafny_error( - value: &::aws_smithy_runtime_api::client::result::SdkError< - aws_sdk_dynamodb::operation::execute_statement::ExecuteStatementError, - ::aws_smithy_runtime_api::client::orchestrator::HttpResponse, - >, -) -> ::std::rc::Rc { - match value { - aws_sdk_dynamodb::error::SdkError::ServiceError(service_error) => match service_error.err() { - aws_sdk_dynamodb::operation::execute_statement::ExecuteStatementError::InternalServerError(e) => - crate::conversions::error::internal_server_error::to_dafny(e.clone()), - aws_sdk_dynamodb::operation::execute_statement::ExecuteStatementError::ResourceNotFoundException(e) => - crate::conversions::error::resource_not_found_exception::to_dafny(e.clone()), - aws_sdk_dynamodb::operation::execute_statement::ExecuteStatementError::DuplicateItemException(e) => - crate::conversions::error::duplicate_item_exception::to_dafny(e.clone()), - aws_sdk_dynamodb::operation::execute_statement::ExecuteStatementError::RequestLimitExceeded(e) => - crate::conversions::error::request_limit_exceeded::to_dafny(e.clone()), - aws_sdk_dynamodb::operation::execute_statement::ExecuteStatementError::TransactionConflictException(e) => - crate::conversions::error::transaction_conflict_exception::to_dafny(e.clone()), - aws_sdk_dynamodb::operation::execute_statement::ExecuteStatementError::ConditionalCheckFailedException(e) => - crate::conversions::error::conditional_check_failed_exception::to_dafny(e.clone()), - aws_sdk_dynamodb::operation::execute_statement::ExecuteStatementError::ItemCollectionSizeLimitExceededException(e) => - crate::conversions::error::item_collection_size_limit_exceeded_exception::to_dafny(e.clone()), - aws_sdk_dynamodb::operation::execute_statement::ExecuteStatementError::ProvisionedThroughputExceededException(e) => - crate::conversions::error::provisioned_throughput_exceeded_exception::to_dafny(e.clone()), - e => crate::conversions::error::to_opaque_error(e.to_string()), - }, - _ => { - crate::conversions::error::to_opaque_error(value.to_string()) - } - } -} diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/execute_statement/_execute_statement_request.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/execute_statement/_execute_statement_request.rs deleted file mode 100644 index a43043c55..000000000 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/execute_statement/_execute_statement_request.rs +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: &aws_sdk_dynamodb::operation::execute_statement::ExecuteStatementInput, -) -> ::std::rc::Rc< - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ExecuteStatementInput, ->{ - ::std::rc::Rc::new(crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ExecuteStatementInput::ExecuteStatementInput { - Statement: crate::standard_library_conversions::ostring_to_dafny(&value.statement) .Extract(), - Parameters: ::std::rc::Rc::new(match &value.parameters { - Some(x) => crate::r#_Wrappers_Compile::Option::Some { value : - ::dafny_runtime::dafny_runtime_conversions::vec_to_dafny_sequence(x, - |e| crate::conversions::attribute_value::to_dafny(&e) -, - ) - }, - None => crate::r#_Wrappers_Compile::Option::None {} -}) -, - ConsistentRead: crate::standard_library_conversions::obool_to_dafny(&value.consistent_read), - NextToken: crate::standard_library_conversions::ostring_to_dafny(&value.next_token), - ReturnConsumedCapacity: ::std::rc::Rc::new(match &value.return_consumed_capacity { - Some(x) => crate::_Wrappers_Compile::Option::Some { value: crate::conversions::return_consumed_capacity::to_dafny(x.clone()) }, - None => crate::_Wrappers_Compile::Option::None { } -}) -, - Limit: crate::standard_library_conversions::oint_to_dafny(value.limit), - }) -} - #[allow(dead_code)] -pub fn from_dafny( - dafny_value: ::std::rc::Rc< - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ExecuteStatementInput, - >, - client: aws_sdk_dynamodb::Client, -) -> aws_sdk_dynamodb::operation::execute_statement::builders::ExecuteStatementFluentBuilder { - client.execute_statement() - .set_statement(Some( dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(dafny_value.Statement()) )) - .set_parameters(match (*dafny_value.Parameters()).as_ref() { - crate::r#_Wrappers_Compile::Option::Some { value } => - Some( - ::dafny_runtime::dafny_runtime_conversions::dafny_sequence_to_vec(value, - |e| crate::conversions::attribute_value::from_dafny(e.clone()) -, - ) - ), - _ => None -} -) - .set_consistent_read(crate::standard_library_conversions::obool_from_dafny(dafny_value.ConsistentRead().clone())) - .set_next_token(crate::standard_library_conversions::ostring_from_dafny(dafny_value.NextToken().clone())) - .set_return_consumed_capacity(match &**dafny_value.ReturnConsumedCapacity() { - crate::r#_Wrappers_Compile::Option::Some { value } => Some( - crate::conversions::return_consumed_capacity::from_dafny(value) - ), - _ => None, -} -) - .set_limit(crate::standard_library_conversions::oint_from_dafny(dafny_value.Limit().clone())) -} diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/execute_statement/_execute_statement_response.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/execute_statement/_execute_statement_response.rs deleted file mode 100644 index 8e4bf4fb6..000000000 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/execute_statement/_execute_statement_response.rs +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: &aws_sdk_dynamodb::operation::execute_statement::ExecuteStatementOutput -) -> ::std::rc::Rc< - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ExecuteStatementOutput, ->{ - ::std::rc::Rc::new(crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ExecuteStatementOutput::ExecuteStatementOutput { - Items: ::std::rc::Rc::new(match &value.items { - Some(x) => crate::r#_Wrappers_Compile::Option::Some { value : - ::dafny_runtime::dafny_runtime_conversions::vec_to_dafny_sequence(x, - |e| ::dafny_runtime::dafny_runtime_conversions::hashmap_to_dafny_map(&e.clone(), - |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&k), - |v| crate::conversions::attribute_value::to_dafny(&v) -, -) -, - ) - }, - None => crate::r#_Wrappers_Compile::Option::None {} -}) -, - NextToken: crate::standard_library_conversions::ostring_to_dafny(&value.next_token), - ConsumedCapacity: ::std::rc::Rc::new(match &value.consumed_capacity { - Some(x) => crate::_Wrappers_Compile::Option::Some { value: crate::conversions::consumed_capacity::to_dafny(&x) }, - None => crate::_Wrappers_Compile::Option::None { } -}) -, - LastEvaluatedKey: -::std::rc::Rc::new(match &value.last_evaluated_key { - Some(x) => crate::r#_Wrappers_Compile::Option::Some { value : - ::dafny_runtime::dafny_runtime_conversions::hashmap_to_dafny_map(x, - |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&k), - |v| crate::conversions::attribute_value::to_dafny(&v) -, - ) - }, - None => crate::r#_Wrappers_Compile::Option::None {} -}) -, - }) -} - diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/execute_transaction.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/execute_transaction.rs deleted file mode 100644 index ad263e4d8..000000000 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/execute_transaction.rs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -pub mod _execute_transaction_request; - - pub mod _execute_transaction_response; - #[allow(dead_code)] -pub fn to_dafny_error( - value: &::aws_smithy_runtime_api::client::result::SdkError< - aws_sdk_dynamodb::operation::execute_transaction::ExecuteTransactionError, - ::aws_smithy_runtime_api::client::orchestrator::HttpResponse, - >, -) -> ::std::rc::Rc { - match value { - aws_sdk_dynamodb::error::SdkError::ServiceError(service_error) => match service_error.err() { - aws_sdk_dynamodb::operation::execute_transaction::ExecuteTransactionError::InternalServerError(e) => - crate::conversions::error::internal_server_error::to_dafny(e.clone()), - aws_sdk_dynamodb::operation::execute_transaction::ExecuteTransactionError::ResourceNotFoundException(e) => - crate::conversions::error::resource_not_found_exception::to_dafny(e.clone()), - aws_sdk_dynamodb::operation::execute_transaction::ExecuteTransactionError::IdempotentParameterMismatchException(e) => - crate::conversions::error::idempotent_parameter_mismatch_exception::to_dafny(e.clone()), - aws_sdk_dynamodb::operation::execute_transaction::ExecuteTransactionError::TransactionCanceledException(e) => - crate::conversions::error::transaction_canceled_exception::to_dafny(e.clone()), - aws_sdk_dynamodb::operation::execute_transaction::ExecuteTransactionError::RequestLimitExceeded(e) => - crate::conversions::error::request_limit_exceeded::to_dafny(e.clone()), - aws_sdk_dynamodb::operation::execute_transaction::ExecuteTransactionError::ProvisionedThroughputExceededException(e) => - crate::conversions::error::provisioned_throughput_exceeded_exception::to_dafny(e.clone()), - aws_sdk_dynamodb::operation::execute_transaction::ExecuteTransactionError::TransactionInProgressException(e) => - crate::conversions::error::transaction_in_progress_exception::to_dafny(e.clone()), - e => crate::conversions::error::to_opaque_error(e.to_string()), - }, - _ => { - crate::conversions::error::to_opaque_error(value.to_string()) - } - } -} diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/execute_transaction/_execute_transaction_request.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/execute_transaction/_execute_transaction_request.rs deleted file mode 100644 index cb83e7474..000000000 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/execute_transaction/_execute_transaction_request.rs +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: &aws_sdk_dynamodb::operation::execute_transaction::ExecuteTransactionInput, -) -> ::std::rc::Rc< - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ExecuteTransactionInput, ->{ - ::std::rc::Rc::new(crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ExecuteTransactionInput::ExecuteTransactionInput { - TransactStatements: ::dafny_runtime::dafny_runtime_conversions::vec_to_dafny_sequence(&value.transact_statements.clone().unwrap(), - |e| crate::conversions::parameterized_statement::to_dafny(&e) -, -) -, - ClientRequestToken: crate::standard_library_conversions::ostring_to_dafny(&value.client_request_token), - ReturnConsumedCapacity: ::std::rc::Rc::new(match &value.return_consumed_capacity { - Some(x) => crate::_Wrappers_Compile::Option::Some { value: crate::conversions::return_consumed_capacity::to_dafny(x.clone()) }, - None => crate::_Wrappers_Compile::Option::None { } -}) -, - }) -} - #[allow(dead_code)] -pub fn from_dafny( - dafny_value: ::std::rc::Rc< - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ExecuteTransactionInput, - >, - client: aws_sdk_dynamodb::Client, -) -> aws_sdk_dynamodb::operation::execute_transaction::builders::ExecuteTransactionFluentBuilder { - client.execute_transaction() - .set_transact_statements(Some( ::dafny_runtime::dafny_runtime_conversions::dafny_sequence_to_vec(dafny_value.TransactStatements(), - |e| crate::conversions::parameterized_statement::from_dafny(e.clone()) -, -) - )) - .set_client_request_token(crate::standard_library_conversions::ostring_from_dafny(dafny_value.ClientRequestToken().clone())) - .set_return_consumed_capacity(match &**dafny_value.ReturnConsumedCapacity() { - crate::r#_Wrappers_Compile::Option::Some { value } => Some( - crate::conversions::return_consumed_capacity::from_dafny(value) - ), - _ => None, -} -) -} diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/execute_transaction/_execute_transaction_response.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/execute_transaction/_execute_transaction_response.rs deleted file mode 100644 index e0d211637..000000000 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/execute_transaction/_execute_transaction_response.rs +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: &aws_sdk_dynamodb::operation::execute_transaction::ExecuteTransactionOutput -) -> ::std::rc::Rc< - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ExecuteTransactionOutput, ->{ - ::std::rc::Rc::new(crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ExecuteTransactionOutput::ExecuteTransactionOutput { - Responses: ::std::rc::Rc::new(match &value.responses { - Some(x) => crate::r#_Wrappers_Compile::Option::Some { value : - ::dafny_runtime::dafny_runtime_conversions::vec_to_dafny_sequence(x, - |e| crate::conversions::item_response::to_dafny(&e) -, - ) - }, - None => crate::r#_Wrappers_Compile::Option::None {} -}) -, - ConsumedCapacity: ::std::rc::Rc::new(match &value.consumed_capacity { - Some(x) => crate::r#_Wrappers_Compile::Option::Some { value : - ::dafny_runtime::dafny_runtime_conversions::vec_to_dafny_sequence(x, - |e| crate::conversions::consumed_capacity::to_dafny(&e) -, - ) - }, - None => crate::r#_Wrappers_Compile::Option::None {} -}) -, - }) -} - diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/expected_attribute_value.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/expected_attribute_value.rs deleted file mode 100644 index d3c94f824..000000000 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/expected_attribute_value.rs +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: &aws_sdk_dynamodb::types::ExpectedAttributeValue, -) -> ::std::rc::Rc{ - ::std::rc::Rc::new( - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ExpectedAttributeValue::ExpectedAttributeValue { - Value: ::std::rc::Rc::new(match &value.value { - Some(x) => crate::_Wrappers_Compile::Option::Some { value: crate::conversions::attribute_value::to_dafny(&x) }, - None => crate::_Wrappers_Compile::Option::None { } -}) -, - Exists: crate::standard_library_conversions::obool_to_dafny(&value.exists), - ComparisonOperator: ::std::rc::Rc::new(match &value.comparison_operator { - Some(x) => crate::_Wrappers_Compile::Option::Some { value: crate::conversions::comparison_operator::to_dafny(x.clone()) }, - None => crate::_Wrappers_Compile::Option::None { } -}) -, - AttributeValueList: ::std::rc::Rc::new(match &value.attribute_value_list { - Some(x) => crate::r#_Wrappers_Compile::Option::Some { value : - ::dafny_runtime::dafny_runtime_conversions::vec_to_dafny_sequence(x, - |e| crate::conversions::attribute_value::to_dafny(&e) -, - ) - }, - None => crate::r#_Wrappers_Compile::Option::None {} -}) -, - } - ) -} #[allow(dead_code)] -pub fn from_dafny( - dafny_value: ::std::rc::Rc< - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ExpectedAttributeValue, - >, -) -> aws_sdk_dynamodb::types::ExpectedAttributeValue { - aws_sdk_dynamodb::types::ExpectedAttributeValue::builder() - .set_value(match (*dafny_value.Value()).as_ref() { - crate::r#_Wrappers_Compile::Option::Some { value } => - Some(crate::conversions::attribute_value::from_dafny(value.clone())), - _ => None, -} -) - .set_exists(crate::standard_library_conversions::obool_from_dafny(dafny_value.Exists().clone())) - .set_comparison_operator(match &**dafny_value.ComparisonOperator() { - crate::r#_Wrappers_Compile::Option::Some { value } => Some( - crate::conversions::comparison_operator::from_dafny(value) - ), - _ => None, -} -) - .set_attribute_value_list(match (*dafny_value.AttributeValueList()).as_ref() { - crate::r#_Wrappers_Compile::Option::Some { value } => - Some( - ::dafny_runtime::dafny_runtime_conversions::dafny_sequence_to_vec(value, - |e| crate::conversions::attribute_value::from_dafny(e.clone()) -, - ) - ), - _ => None -} -) - .build() - -} diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/get.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/get.rs deleted file mode 100644 index 5d3c0bd90..000000000 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/get.rs +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: &aws_sdk_dynamodb::types::Get, -) -> ::std::rc::Rc{ - ::std::rc::Rc::new( - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::Get::Get { - Key: ::dafny_runtime::dafny_runtime_conversions::hashmap_to_dafny_map(&value.key.clone(), - |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&k), - |v| crate::conversions::attribute_value::to_dafny(&v) -, -) -, - TableName: dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&value.table_name), - ProjectionExpression: crate::standard_library_conversions::ostring_to_dafny(&value.projection_expression), - ExpressionAttributeNames: -::std::rc::Rc::new(match &value.expression_attribute_names { - Some(x) => crate::r#_Wrappers_Compile::Option::Some { value : - ::dafny_runtime::dafny_runtime_conversions::hashmap_to_dafny_map(x, - |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&k), - |v| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&v), - ) - }, - None => crate::r#_Wrappers_Compile::Option::None {} -}) -, - } - ) -} #[allow(dead_code)] -pub fn from_dafny( - dafny_value: ::std::rc::Rc< - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::Get, - >, -) -> aws_sdk_dynamodb::types::Get { - aws_sdk_dynamodb::types::Get::builder() - .set_key(Some( ::dafny_runtime::dafny_runtime_conversions::dafny_map_to_hashmap(&dafny_value.Key(), - |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(k), - |v| crate::conversions::attribute_value::from_dafny(v.clone()) -, -) - )) - .set_table_name(Some( dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(dafny_value.TableName()) )) - .set_projection_expression(crate::standard_library_conversions::ostring_from_dafny(dafny_value.ProjectionExpression().clone())) - .set_expression_attribute_names(match (*dafny_value.ExpressionAttributeNames()).as_ref() { - crate::r#_Wrappers_Compile::Option::Some { value } => - Some( - ::dafny_runtime::dafny_runtime_conversions::dafny_map_to_hashmap(value, - |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(k), - |v| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(v), - ) - ), - _ => None -} -) - .build() - .unwrap() -} diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/get_item.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/get_item.rs deleted file mode 100644 index fb441c8c0..000000000 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/get_item.rs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -pub mod _get_item_request; - - pub mod _get_item_response; - #[allow(dead_code)] -pub fn to_dafny_error( - value: &::aws_smithy_runtime_api::client::result::SdkError< - aws_sdk_dynamodb::operation::get_item::GetItemError, - ::aws_smithy_runtime_api::client::orchestrator::HttpResponse, - >, -) -> ::std::rc::Rc { - match value { - aws_sdk_dynamodb::error::SdkError::ServiceError(service_error) => match service_error.err() { - aws_sdk_dynamodb::operation::get_item::GetItemError::InternalServerError(e) => - crate::conversions::error::internal_server_error::to_dafny(e.clone()), - aws_sdk_dynamodb::operation::get_item::GetItemError::InvalidEndpointException(e) => - crate::conversions::error::invalid_endpoint_exception::to_dafny(e.clone()), - aws_sdk_dynamodb::operation::get_item::GetItemError::ResourceNotFoundException(e) => - crate::conversions::error::resource_not_found_exception::to_dafny(e.clone()), - aws_sdk_dynamodb::operation::get_item::GetItemError::RequestLimitExceeded(e) => - crate::conversions::error::request_limit_exceeded::to_dafny(e.clone()), - aws_sdk_dynamodb::operation::get_item::GetItemError::ProvisionedThroughputExceededException(e) => - crate::conversions::error::provisioned_throughput_exceeded_exception::to_dafny(e.clone()), - e => crate::conversions::error::to_opaque_error(e.to_string()), - }, - _ => { - crate::conversions::error::to_opaque_error(value.to_string()) - } - } -} diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/get_item/_get_item_request.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/get_item/_get_item_request.rs deleted file mode 100644 index d9aef3e00..000000000 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/get_item/_get_item_request.rs +++ /dev/null @@ -1,92 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: &aws_sdk_dynamodb::operation::get_item::GetItemInput, -) -> ::std::rc::Rc< - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::GetItemInput, ->{ - ::std::rc::Rc::new(crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::GetItemInput::GetItemInput { - TableName: crate::standard_library_conversions::ostring_to_dafny(&value.table_name) .Extract(), - Key: ::dafny_runtime::dafny_runtime_conversions::hashmap_to_dafny_map(&value.key.clone().unwrap(), - |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&k), - |v| crate::conversions::attribute_value::to_dafny(&v) -, -) -, - AttributesToGet: ::std::rc::Rc::new(match &value.attributes_to_get { - Some(x) => crate::r#_Wrappers_Compile::Option::Some { value : - ::dafny_runtime::dafny_runtime_conversions::vec_to_dafny_sequence(x, - |e| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&e), - ) - }, - None => crate::r#_Wrappers_Compile::Option::None {} -}) -, - ConsistentRead: crate::standard_library_conversions::obool_to_dafny(&value.consistent_read), - ReturnConsumedCapacity: ::std::rc::Rc::new(match &value.return_consumed_capacity { - Some(x) => crate::_Wrappers_Compile::Option::Some { value: crate::conversions::return_consumed_capacity::to_dafny(x.clone()) }, - None => crate::_Wrappers_Compile::Option::None { } -}) -, - ProjectionExpression: crate::standard_library_conversions::ostring_to_dafny(&value.projection_expression), - ExpressionAttributeNames: -::std::rc::Rc::new(match &value.expression_attribute_names { - Some(x) => crate::r#_Wrappers_Compile::Option::Some { value : - ::dafny_runtime::dafny_runtime_conversions::hashmap_to_dafny_map(x, - |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&k), - |v| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&v), - ) - }, - None => crate::r#_Wrappers_Compile::Option::None {} -}) -, - }) -} - #[allow(dead_code)] -pub fn from_dafny( - dafny_value: ::std::rc::Rc< - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::GetItemInput, - >, - client: aws_sdk_dynamodb::Client, -) -> aws_sdk_dynamodb::operation::get_item::builders::GetItemFluentBuilder { - client.get_item() - .set_table_name(Some( dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(dafny_value.TableName()) )) - .set_key(Some( ::dafny_runtime::dafny_runtime_conversions::dafny_map_to_hashmap(&dafny_value.Key(), - |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(k), - |v| crate::conversions::attribute_value::from_dafny(v.clone()) -, -) - )) - .set_attributes_to_get(match (*dafny_value.AttributesToGet()).as_ref() { - crate::r#_Wrappers_Compile::Option::Some { value } => - Some( - ::dafny_runtime::dafny_runtime_conversions::dafny_sequence_to_vec(value, - |e| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(e), - ) - ), - _ => None -} -) - .set_consistent_read(crate::standard_library_conversions::obool_from_dafny(dafny_value.ConsistentRead().clone())) - .set_return_consumed_capacity(match &**dafny_value.ReturnConsumedCapacity() { - crate::r#_Wrappers_Compile::Option::Some { value } => Some( - crate::conversions::return_consumed_capacity::from_dafny(value) - ), - _ => None, -} -) - .set_projection_expression(crate::standard_library_conversions::ostring_from_dafny(dafny_value.ProjectionExpression().clone())) - .set_expression_attribute_names(match (*dafny_value.ExpressionAttributeNames()).as_ref() { - crate::r#_Wrappers_Compile::Option::Some { value } => - Some( - ::dafny_runtime::dafny_runtime_conversions::dafny_map_to_hashmap(value, - |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(k), - |v| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(v), - ) - ), - _ => None -} -) -} diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/get_item/_get_item_response.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/get_item/_get_item_response.rs deleted file mode 100644 index b94e8d4c7..000000000 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/get_item/_get_item_response.rs +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: &aws_sdk_dynamodb::operation::get_item::GetItemOutput -) -> ::std::rc::Rc< - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::GetItemOutput, ->{ - ::std::rc::Rc::new(crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::GetItemOutput::GetItemOutput { - Item: -::std::rc::Rc::new(match &value.item { - Some(x) => crate::r#_Wrappers_Compile::Option::Some { value : - ::dafny_runtime::dafny_runtime_conversions::hashmap_to_dafny_map(x, - |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&k), - |v| crate::conversions::attribute_value::to_dafny(&v) -, - ) - }, - None => crate::r#_Wrappers_Compile::Option::None {} -}) -, - ConsumedCapacity: ::std::rc::Rc::new(match &value.consumed_capacity { - Some(x) => crate::_Wrappers_Compile::Option::Some { value: crate::conversions::consumed_capacity::to_dafny(&x) }, - None => crate::_Wrappers_Compile::Option::None { } -}) -, - }) -} - diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/global_secondary_index.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/global_secondary_index.rs deleted file mode 100644 index 6d88e8255..000000000 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/global_secondary_index.rs +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: &aws_sdk_dynamodb::types::GlobalSecondaryIndex, -) -> ::std::rc::Rc{ - ::std::rc::Rc::new( - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::GlobalSecondaryIndex::GlobalSecondaryIndex { - IndexName: dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&value.index_name), - KeySchema: ::dafny_runtime::dafny_runtime_conversions::vec_to_dafny_sequence(&value.key_schema, - |e| crate::conversions::key_schema_element::to_dafny(&e) -, -) -, - Projection: crate::conversions::projection::to_dafny(&value.projection.clone().unwrap()) -, - ProvisionedThroughput: ::std::rc::Rc::new(match &value.provisioned_throughput { - Some(x) => crate::_Wrappers_Compile::Option::Some { value: crate::conversions::provisioned_throughput::to_dafny(&x) }, - None => crate::_Wrappers_Compile::Option::None { } -}) -, - } - ) -} #[allow(dead_code)] -pub fn from_dafny( - dafny_value: ::std::rc::Rc< - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::GlobalSecondaryIndex, - >, -) -> aws_sdk_dynamodb::types::GlobalSecondaryIndex { - aws_sdk_dynamodb::types::GlobalSecondaryIndex::builder() - .set_index_name(Some( dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(dafny_value.IndexName()) )) - .set_key_schema(Some( ::dafny_runtime::dafny_runtime_conversions::dafny_sequence_to_vec(dafny_value.KeySchema(), - |e| crate::conversions::key_schema_element::from_dafny(e.clone()) -, -) - )) - .set_projection(Some( crate::conversions::projection::from_dafny(dafny_value.Projection().clone()) - )) - .set_provisioned_throughput(match (*dafny_value.ProvisionedThroughput()).as_ref() { - crate::r#_Wrappers_Compile::Option::Some { value } => - Some(crate::conversions::provisioned_throughput::from_dafny(value.clone())), - _ => None, -} -) - .build() - .unwrap() -} diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/global_secondary_index_description.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/global_secondary_index_description.rs deleted file mode 100644 index 6f07b1db7..000000000 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/global_secondary_index_description.rs +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: &aws_sdk_dynamodb::types::GlobalSecondaryIndexDescription, -) -> ::std::rc::Rc{ - ::std::rc::Rc::new( - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::GlobalSecondaryIndexDescription::GlobalSecondaryIndexDescription { - IndexName: crate::standard_library_conversions::ostring_to_dafny(&value.index_name), - KeySchema: ::std::rc::Rc::new(match &value.key_schema { - Some(x) => crate::r#_Wrappers_Compile::Option::Some { value : - ::dafny_runtime::dafny_runtime_conversions::vec_to_dafny_sequence(x, - |e| crate::conversions::key_schema_element::to_dafny(&e) -, - ) - }, - None => crate::r#_Wrappers_Compile::Option::None {} -}) -, - Projection: ::std::rc::Rc::new(match &value.projection { - Some(x) => crate::_Wrappers_Compile::Option::Some { value: crate::conversions::projection::to_dafny(&x) }, - None => crate::_Wrappers_Compile::Option::None { } -}) -, - IndexStatus: ::std::rc::Rc::new(match &value.index_status { - Some(x) => crate::_Wrappers_Compile::Option::Some { value: crate::conversions::index_status::to_dafny(x.clone()) }, - None => crate::_Wrappers_Compile::Option::None { } -}) -, - Backfilling: crate::standard_library_conversions::obool_to_dafny(&value.backfilling), - ProvisionedThroughput: ::std::rc::Rc::new(match &value.provisioned_throughput { - Some(x) => crate::_Wrappers_Compile::Option::Some { value: crate::conversions::provisioned_throughput_description::to_dafny(&x) }, - None => crate::_Wrappers_Compile::Option::None { } -}) -, - IndexSizeBytes: crate::standard_library_conversions::olong_to_dafny(&value.index_size_bytes), - ItemCount: crate::standard_library_conversions::olong_to_dafny(&value.item_count), - IndexArn: crate::standard_library_conversions::ostring_to_dafny(&value.index_arn), - } - ) -} #[allow(dead_code)] -pub fn from_dafny( - dafny_value: ::std::rc::Rc< - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::GlobalSecondaryIndexDescription, - >, -) -> aws_sdk_dynamodb::types::GlobalSecondaryIndexDescription { - aws_sdk_dynamodb::types::GlobalSecondaryIndexDescription::builder() - .set_index_name(crate::standard_library_conversions::ostring_from_dafny(dafny_value.IndexName().clone())) - .set_key_schema(match (*dafny_value.KeySchema()).as_ref() { - crate::r#_Wrappers_Compile::Option::Some { value } => - Some( - ::dafny_runtime::dafny_runtime_conversions::dafny_sequence_to_vec(value, - |e| crate::conversions::key_schema_element::from_dafny(e.clone()) -, - ) - ), - _ => None -} -) - .set_projection(match (*dafny_value.Projection()).as_ref() { - crate::r#_Wrappers_Compile::Option::Some { value } => - Some(crate::conversions::projection::from_dafny(value.clone())), - _ => None, -} -) - .set_index_status(match &**dafny_value.IndexStatus() { - crate::r#_Wrappers_Compile::Option::Some { value } => Some( - crate::conversions::index_status::from_dafny(value) - ), - _ => None, -} -) - .set_backfilling(crate::standard_library_conversions::obool_from_dafny(dafny_value.Backfilling().clone())) - .set_provisioned_throughput(match (*dafny_value.ProvisionedThroughput()).as_ref() { - crate::r#_Wrappers_Compile::Option::Some { value } => - Some(crate::conversions::provisioned_throughput_description::from_dafny(value.clone())), - _ => None, -} -) - .set_index_size_bytes(crate::standard_library_conversions::olong_from_dafny(dafny_value.IndexSizeBytes().clone())) - .set_item_count(crate::standard_library_conversions::olong_from_dafny(dafny_value.ItemCount().clone())) - .set_index_arn(crate::standard_library_conversions::ostring_from_dafny(dafny_value.IndexArn().clone())) - .build() - -} diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/index_status.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/index_status.rs deleted file mode 100644 index df88cdcb2..000000000 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/index_status.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] - -pub fn to_dafny( - value: aws_sdk_dynamodb::types::IndexStatus, -) -> ::std::rc::Rc{ - ::std::rc::Rc::new(match value { - aws_sdk_dynamodb::types::IndexStatus::Creating => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::IndexStatus::CREATING {}, -aws_sdk_dynamodb::types::IndexStatus::Updating => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::IndexStatus::UPDATING {}, -aws_sdk_dynamodb::types::IndexStatus::Deleting => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::IndexStatus::DELETING {}, -aws_sdk_dynamodb::types::IndexStatus::Active => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::IndexStatus::ACTIVE {}, - _ => panic!("Unknown enum variant: {}", value), - }) -} - #[allow(dead_code)] -pub fn from_dafny( - dafny_value: &crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::IndexStatus, -) -> aws_sdk_dynamodb::types::IndexStatus { - match dafny_value { - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::IndexStatus::CREATING {} => aws_sdk_dynamodb::types::IndexStatus::Creating, -crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::IndexStatus::UPDATING {} => aws_sdk_dynamodb::types::IndexStatus::Updating, -crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::IndexStatus::DELETING {} => aws_sdk_dynamodb::types::IndexStatus::Deleting, -crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::IndexStatus::ACTIVE {} => aws_sdk_dynamodb::types::IndexStatus::Active, - } -} diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/item_collection_metrics.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/item_collection_metrics.rs deleted file mode 100644 index ebeaf9965..000000000 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/item_collection_metrics.rs +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: &aws_sdk_dynamodb::types::ItemCollectionMetrics, -) -> ::std::rc::Rc{ - ::std::rc::Rc::new( - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ItemCollectionMetrics::ItemCollectionMetrics { - ItemCollectionKey: -::std::rc::Rc::new(match &value.item_collection_key { - Some(x) => crate::r#_Wrappers_Compile::Option::Some { value : - ::dafny_runtime::dafny_runtime_conversions::hashmap_to_dafny_map(x, - |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&k), - |v| crate::conversions::attribute_value::to_dafny(&v) -, - ) - }, - None => crate::r#_Wrappers_Compile::Option::None {} -}) -, - SizeEstimateRangeGB: ::std::rc::Rc::new(match &value.size_estimate_range_gb { - Some(x) => crate::r#_Wrappers_Compile::Option::Some { value : - ::dafny_runtime::dafny_runtime_conversions::vec_to_dafny_sequence(x, - |e| crate::standard_library_conversions::double_to_dafny(e.clone()), - ) - }, - None => crate::r#_Wrappers_Compile::Option::None {} -}) -, - } - ) -} #[allow(dead_code)] -pub fn from_dafny( - dafny_value: ::std::rc::Rc< - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ItemCollectionMetrics, - >, -) -> aws_sdk_dynamodb::types::ItemCollectionMetrics { - aws_sdk_dynamodb::types::ItemCollectionMetrics::builder() - .set_item_collection_key(match (*dafny_value.ItemCollectionKey()).as_ref() { - crate::r#_Wrappers_Compile::Option::Some { value } => - Some( - ::dafny_runtime::dafny_runtime_conversions::dafny_map_to_hashmap(value, - |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(k), - |v| crate::conversions::attribute_value::from_dafny(v.clone()) -, - ) - ), - _ => None -} -) - .set_size_estimate_range_gb(match (*dafny_value.SizeEstimateRangeGB()).as_ref() { - crate::r#_Wrappers_Compile::Option::Some { value } => - Some( - ::dafny_runtime::dafny_runtime_conversions::dafny_sequence_to_vec(value, - |e| crate::standard_library_conversions::double_from_dafny(&e.clone()), - ) - ), - _ => None -} -) - .build() - -} diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/item_response.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/item_response.rs deleted file mode 100644 index 170bfe7cf..000000000 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/item_response.rs +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: &aws_sdk_dynamodb::types::ItemResponse, -) -> ::std::rc::Rc{ - ::std::rc::Rc::new( - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ItemResponse::ItemResponse { - Item: -::std::rc::Rc::new(match &value.item { - Some(x) => crate::r#_Wrappers_Compile::Option::Some { value : - ::dafny_runtime::dafny_runtime_conversions::hashmap_to_dafny_map(x, - |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&k), - |v| crate::conversions::attribute_value::to_dafny(&v) -, - ) - }, - None => crate::r#_Wrappers_Compile::Option::None {} -}) -, - } - ) -} #[allow(dead_code)] -pub fn from_dafny( - dafny_value: ::std::rc::Rc< - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ItemResponse, - >, -) -> aws_sdk_dynamodb::types::ItemResponse { - aws_sdk_dynamodb::types::ItemResponse::builder() - .set_item(match (*dafny_value.Item()).as_ref() { - crate::r#_Wrappers_Compile::Option::Some { value } => - Some( - ::dafny_runtime::dafny_runtime_conversions::dafny_map_to_hashmap(value, - |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(k), - |v| crate::conversions::attribute_value::from_dafny(v.clone()) -, - ) - ), - _ => None -} -) - .build() - -} diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/key_schema_element.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/key_schema_element.rs deleted file mode 100644 index f6311be98..000000000 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/key_schema_element.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: &aws_sdk_dynamodb::types::KeySchemaElement, -) -> ::std::rc::Rc{ - ::std::rc::Rc::new( - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::KeySchemaElement::KeySchemaElement { - AttributeName: dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&value.attribute_name), - KeyType: crate::conversions::key_type::to_dafny(value.key_type.clone()), - } - ) -} #[allow(dead_code)] -pub fn from_dafny( - dafny_value: ::std::rc::Rc< - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::KeySchemaElement, - >, -) -> aws_sdk_dynamodb::types::KeySchemaElement { - aws_sdk_dynamodb::types::KeySchemaElement::builder() - .set_attribute_name(Some( dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(dafny_value.AttributeName()) )) - .set_key_type(Some( crate::conversions::key_type::from_dafny(dafny_value.KeyType()) )) - .build() - .unwrap() -} diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/key_type.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/key_type.rs deleted file mode 100644 index ea86df5b0..000000000 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/key_type.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] - -pub fn to_dafny( - value: aws_sdk_dynamodb::types::KeyType, -) -> ::std::rc::Rc{ - ::std::rc::Rc::new(match value { - aws_sdk_dynamodb::types::KeyType::Hash => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::KeyType::HASH {}, -aws_sdk_dynamodb::types::KeyType::Range => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::KeyType::RANGE {}, - _ => panic!("Unknown enum variant: {}", value), - }) -} - #[allow(dead_code)] -pub fn from_dafny( - dafny_value: &crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::KeyType, -) -> aws_sdk_dynamodb::types::KeyType { - match dafny_value { - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::KeyType::HASH {} => aws_sdk_dynamodb::types::KeyType::Hash, -crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::KeyType::RANGE {} => aws_sdk_dynamodb::types::KeyType::Range, - } -} diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/keys_and_attributes.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/keys_and_attributes.rs deleted file mode 100644 index 35bf525b2..000000000 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/keys_and_attributes.rs +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: &aws_sdk_dynamodb::types::KeysAndAttributes, -) -> ::std::rc::Rc{ - ::std::rc::Rc::new( - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::KeysAndAttributes::KeysAndAttributes { - Keys: ::dafny_runtime::dafny_runtime_conversions::vec_to_dafny_sequence(&value.keys, - |e| ::dafny_runtime::dafny_runtime_conversions::hashmap_to_dafny_map(&e.clone(), - |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&k), - |v| crate::conversions::attribute_value::to_dafny(&v) -, -) -, -) -, - AttributesToGet: ::std::rc::Rc::new(match &value.attributes_to_get { - Some(x) => crate::r#_Wrappers_Compile::Option::Some { value : - ::dafny_runtime::dafny_runtime_conversions::vec_to_dafny_sequence(x, - |e| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&e), - ) - }, - None => crate::r#_Wrappers_Compile::Option::None {} -}) -, - ConsistentRead: crate::standard_library_conversions::obool_to_dafny(&value.consistent_read), - ProjectionExpression: crate::standard_library_conversions::ostring_to_dafny(&value.projection_expression), - ExpressionAttributeNames: -::std::rc::Rc::new(match &value.expression_attribute_names { - Some(x) => crate::r#_Wrappers_Compile::Option::Some { value : - ::dafny_runtime::dafny_runtime_conversions::hashmap_to_dafny_map(x, - |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&k), - |v| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&v), - ) - }, - None => crate::r#_Wrappers_Compile::Option::None {} -}) -, - } - ) -} #[allow(dead_code)] -pub fn from_dafny( - dafny_value: ::std::rc::Rc< - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::KeysAndAttributes, - >, -) -> aws_sdk_dynamodb::types::KeysAndAttributes { - aws_sdk_dynamodb::types::KeysAndAttributes::builder() - .set_keys(Some( ::dafny_runtime::dafny_runtime_conversions::dafny_sequence_to_vec(dafny_value.Keys(), - |e| ::dafny_runtime::dafny_runtime_conversions::dafny_map_to_hashmap(&e, - |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(k), - |v| crate::conversions::attribute_value::from_dafny(v.clone()) -, -) -, -) - )) - .set_attributes_to_get(match (*dafny_value.AttributesToGet()).as_ref() { - crate::r#_Wrappers_Compile::Option::Some { value } => - Some( - ::dafny_runtime::dafny_runtime_conversions::dafny_sequence_to_vec(value, - |e| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(e), - ) - ), - _ => None -} -) - .set_consistent_read(crate::standard_library_conversions::obool_from_dafny(dafny_value.ConsistentRead().clone())) - .set_projection_expression(crate::standard_library_conversions::ostring_from_dafny(dafny_value.ProjectionExpression().clone())) - .set_expression_attribute_names(match (*dafny_value.ExpressionAttributeNames()).as_ref() { - crate::r#_Wrappers_Compile::Option::Some { value } => - Some( - ::dafny_runtime::dafny_runtime_conversions::dafny_map_to_hashmap(value, - |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(k), - |v| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(v), - ) - ), - _ => None -} -) - .build() - .unwrap() -} diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/local_secondary_index.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/local_secondary_index.rs deleted file mode 100644 index d95675cf7..000000000 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/local_secondary_index.rs +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: &aws_sdk_dynamodb::types::LocalSecondaryIndex, -) -> ::std::rc::Rc{ - ::std::rc::Rc::new( - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::LocalSecondaryIndex::LocalSecondaryIndex { - IndexName: dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&value.index_name), - KeySchema: ::dafny_runtime::dafny_runtime_conversions::vec_to_dafny_sequence(&value.key_schema, - |e| crate::conversions::key_schema_element::to_dafny(&e) -, -) -, - Projection: crate::conversions::projection::to_dafny(&value.projection.clone().unwrap()) -, - } - ) -} #[allow(dead_code)] -pub fn from_dafny( - dafny_value: ::std::rc::Rc< - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::LocalSecondaryIndex, - >, -) -> aws_sdk_dynamodb::types::LocalSecondaryIndex { - aws_sdk_dynamodb::types::LocalSecondaryIndex::builder() - .set_index_name(Some( dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(dafny_value.IndexName()) )) - .set_key_schema(Some( ::dafny_runtime::dafny_runtime_conversions::dafny_sequence_to_vec(dafny_value.KeySchema(), - |e| crate::conversions::key_schema_element::from_dafny(e.clone()) -, -) - )) - .set_projection(Some( crate::conversions::projection::from_dafny(dafny_value.Projection().clone()) - )) - .build() - .unwrap() -} diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/local_secondary_index_description.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/local_secondary_index_description.rs deleted file mode 100644 index 3af48fb4f..000000000 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/local_secondary_index_description.rs +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: &aws_sdk_dynamodb::types::LocalSecondaryIndexDescription, -) -> ::std::rc::Rc{ - ::std::rc::Rc::new( - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::LocalSecondaryIndexDescription::LocalSecondaryIndexDescription { - IndexName: crate::standard_library_conversions::ostring_to_dafny(&value.index_name), - KeySchema: ::std::rc::Rc::new(match &value.key_schema { - Some(x) => crate::r#_Wrappers_Compile::Option::Some { value : - ::dafny_runtime::dafny_runtime_conversions::vec_to_dafny_sequence(x, - |e| crate::conversions::key_schema_element::to_dafny(&e) -, - ) - }, - None => crate::r#_Wrappers_Compile::Option::None {} -}) -, - Projection: ::std::rc::Rc::new(match &value.projection { - Some(x) => crate::_Wrappers_Compile::Option::Some { value: crate::conversions::projection::to_dafny(&x) }, - None => crate::_Wrappers_Compile::Option::None { } -}) -, - IndexSizeBytes: crate::standard_library_conversions::olong_to_dafny(&value.index_size_bytes), - ItemCount: crate::standard_library_conversions::olong_to_dafny(&value.item_count), - IndexArn: crate::standard_library_conversions::ostring_to_dafny(&value.index_arn), - } - ) -} #[allow(dead_code)] -pub fn from_dafny( - dafny_value: ::std::rc::Rc< - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::LocalSecondaryIndexDescription, - >, -) -> aws_sdk_dynamodb::types::LocalSecondaryIndexDescription { - aws_sdk_dynamodb::types::LocalSecondaryIndexDescription::builder() - .set_index_name(crate::standard_library_conversions::ostring_from_dafny(dafny_value.IndexName().clone())) - .set_key_schema(match (*dafny_value.KeySchema()).as_ref() { - crate::r#_Wrappers_Compile::Option::Some { value } => - Some( - ::dafny_runtime::dafny_runtime_conversions::dafny_sequence_to_vec(value, - |e| crate::conversions::key_schema_element::from_dafny(e.clone()) -, - ) - ), - _ => None -} -) - .set_projection(match (*dafny_value.Projection()).as_ref() { - crate::r#_Wrappers_Compile::Option::Some { value } => - Some(crate::conversions::projection::from_dafny(value.clone())), - _ => None, -} -) - .set_index_size_bytes(crate::standard_library_conversions::olong_from_dafny(dafny_value.IndexSizeBytes().clone())) - .set_item_count(crate::standard_library_conversions::olong_from_dafny(dafny_value.ItemCount().clone())) - .set_index_arn(crate::standard_library_conversions::ostring_from_dafny(dafny_value.IndexArn().clone())) - .build() - -} diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/parameterized_statement.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/parameterized_statement.rs deleted file mode 100644 index 4d14930e9..000000000 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/parameterized_statement.rs +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: &aws_sdk_dynamodb::types::ParameterizedStatement, -) -> ::std::rc::Rc{ - ::std::rc::Rc::new( - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ParameterizedStatement::ParameterizedStatement { - Statement: dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&value.statement), - Parameters: ::std::rc::Rc::new(match &value.parameters { - Some(x) => crate::r#_Wrappers_Compile::Option::Some { value : - ::dafny_runtime::dafny_runtime_conversions::vec_to_dafny_sequence(x, - |e| crate::conversions::attribute_value::to_dafny(&e) -, - ) - }, - None => crate::r#_Wrappers_Compile::Option::None {} -}) -, - } - ) -} #[allow(dead_code)] -pub fn from_dafny( - dafny_value: ::std::rc::Rc< - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ParameterizedStatement, - >, -) -> aws_sdk_dynamodb::types::ParameterizedStatement { - aws_sdk_dynamodb::types::ParameterizedStatement::builder() - .set_statement(Some( dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(dafny_value.Statement()) )) - .set_parameters(match (*dafny_value.Parameters()).as_ref() { - crate::r#_Wrappers_Compile::Option::Some { value } => - Some( - ::dafny_runtime::dafny_runtime_conversions::dafny_sequence_to_vec(value, - |e| crate::conversions::attribute_value::from_dafny(e.clone()) -, - ) - ), - _ => None -} -) - .build() - .unwrap() -} diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/projection.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/projection.rs deleted file mode 100644 index 706c1a7d1..000000000 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/projection.rs +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: &aws_sdk_dynamodb::types::Projection, -) -> ::std::rc::Rc{ - ::std::rc::Rc::new( - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::Projection::Projection { - ProjectionType: ::std::rc::Rc::new(match &value.projection_type { - Some(x) => crate::_Wrappers_Compile::Option::Some { value: crate::conversions::projection_type::to_dafny(x.clone()) }, - None => crate::_Wrappers_Compile::Option::None { } -}) -, - NonKeyAttributes: ::std::rc::Rc::new(match &value.non_key_attributes { - Some(x) => crate::r#_Wrappers_Compile::Option::Some { value : - ::dafny_runtime::dafny_runtime_conversions::vec_to_dafny_sequence(x, - |e| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&e), - ) - }, - None => crate::r#_Wrappers_Compile::Option::None {} -}) -, - } - ) -} #[allow(dead_code)] -pub fn from_dafny( - dafny_value: ::std::rc::Rc< - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::Projection, - >, -) -> aws_sdk_dynamodb::types::Projection { - aws_sdk_dynamodb::types::Projection::builder() - .set_projection_type(match &**dafny_value.ProjectionType() { - crate::r#_Wrappers_Compile::Option::Some { value } => Some( - crate::conversions::projection_type::from_dafny(value) - ), - _ => None, -} -) - .set_non_key_attributes(match (*dafny_value.NonKeyAttributes()).as_ref() { - crate::r#_Wrappers_Compile::Option::Some { value } => - Some( - ::dafny_runtime::dafny_runtime_conversions::dafny_sequence_to_vec(value, - |e| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(e), - ) - ), - _ => None -} -) - .build() - -} diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/projection_type.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/projection_type.rs deleted file mode 100644 index 28b89124f..000000000 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/projection_type.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] - -pub fn to_dafny( - value: aws_sdk_dynamodb::types::ProjectionType, -) -> ::std::rc::Rc{ - ::std::rc::Rc::new(match value { - aws_sdk_dynamodb::types::ProjectionType::All => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ProjectionType::ALL {}, -aws_sdk_dynamodb::types::ProjectionType::KeysOnly => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ProjectionType::KEYS_ONLY {}, -aws_sdk_dynamodb::types::ProjectionType::Include => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ProjectionType::INCLUDE {}, - _ => panic!("Unknown enum variant: {}", value), - }) -} - #[allow(dead_code)] -pub fn from_dafny( - dafny_value: &crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ProjectionType, -) -> aws_sdk_dynamodb::types::ProjectionType { - match dafny_value { - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ProjectionType::ALL {} => aws_sdk_dynamodb::types::ProjectionType::All, -crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ProjectionType::KEYS_ONLY {} => aws_sdk_dynamodb::types::ProjectionType::KeysOnly, -crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ProjectionType::INCLUDE {} => aws_sdk_dynamodb::types::ProjectionType::Include, - } -} diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/provisioned_throughput.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/provisioned_throughput.rs deleted file mode 100644 index f5090829c..000000000 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/provisioned_throughput.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: &aws_sdk_dynamodb::types::ProvisionedThroughput, -) -> ::std::rc::Rc{ - ::std::rc::Rc::new( - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ProvisionedThroughput::ProvisionedThroughput { - ReadCapacityUnits: value.read_capacity_units, - WriteCapacityUnits: value.write_capacity_units, - } - ) -} #[allow(dead_code)] -pub fn from_dafny( - dafny_value: ::std::rc::Rc< - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ProvisionedThroughput, - >, -) -> aws_sdk_dynamodb::types::ProvisionedThroughput { - aws_sdk_dynamodb::types::ProvisionedThroughput::builder() - .set_read_capacity_units(Some( dafny_value.ReadCapacityUnits() .clone() )) - .set_write_capacity_units(Some( dafny_value.WriteCapacityUnits() .clone() )) - .build() - .unwrap() -} diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/provisioned_throughput_description.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/provisioned_throughput_description.rs deleted file mode 100644 index bbac7e6fe..000000000 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/provisioned_throughput_description.rs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: &aws_sdk_dynamodb::types::ProvisionedThroughputDescription, -) -> ::std::rc::Rc{ - ::std::rc::Rc::new( - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ProvisionedThroughputDescription::ProvisionedThroughputDescription { - LastIncreaseDateTime: crate::standard_library_conversions::otimestamp_to_dafny(&value.last_increase_date_time), - LastDecreaseDateTime: crate::standard_library_conversions::otimestamp_to_dafny(&value.last_decrease_date_time), - NumberOfDecreasesToday: crate::standard_library_conversions::olong_to_dafny(&value.number_of_decreases_today), - ReadCapacityUnits: crate::standard_library_conversions::olong_to_dafny(&value.read_capacity_units), - WriteCapacityUnits: crate::standard_library_conversions::olong_to_dafny(&value.write_capacity_units), - } - ) -} #[allow(dead_code)] -pub fn from_dafny( - dafny_value: ::std::rc::Rc< - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ProvisionedThroughputDescription, - >, -) -> aws_sdk_dynamodb::types::ProvisionedThroughputDescription { - aws_sdk_dynamodb::types::ProvisionedThroughputDescription::builder() - .set_last_increase_date_time(crate::standard_library_conversions::otimestamp_from_dafny(dafny_value.LastIncreaseDateTime().clone())) - .set_last_decrease_date_time(crate::standard_library_conversions::otimestamp_from_dafny(dafny_value.LastDecreaseDateTime().clone())) - .set_number_of_decreases_today(crate::standard_library_conversions::olong_from_dafny(dafny_value.NumberOfDecreasesToday().clone())) - .set_read_capacity_units(crate::standard_library_conversions::olong_from_dafny(dafny_value.ReadCapacityUnits().clone())) - .set_write_capacity_units(crate::standard_library_conversions::olong_from_dafny(dafny_value.WriteCapacityUnits().clone())) - .build() - -} diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/provisioned_throughput_override.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/provisioned_throughput_override.rs deleted file mode 100644 index da4165734..000000000 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/provisioned_throughput_override.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: &aws_sdk_dynamodb::types::ProvisionedThroughputOverride, -) -> ::std::rc::Rc{ - ::std::rc::Rc::new( - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ProvisionedThroughputOverride::ProvisionedThroughputOverride { - ReadCapacityUnits: crate::standard_library_conversions::olong_to_dafny(&value.read_capacity_units), - } - ) -} #[allow(dead_code)] -pub fn from_dafny( - dafny_value: ::std::rc::Rc< - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ProvisionedThroughputOverride, - >, -) -> aws_sdk_dynamodb::types::ProvisionedThroughputOverride { - aws_sdk_dynamodb::types::ProvisionedThroughputOverride::builder() - .set_read_capacity_units(crate::standard_library_conversions::olong_from_dafny(dafny_value.ReadCapacityUnits().clone())) - .build() - -} diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/put.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/put.rs deleted file mode 100644 index c3b4d3f23..000000000 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/put.rs +++ /dev/null @@ -1,95 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: &aws_sdk_dynamodb::types::Put, -) -> ::std::rc::Rc{ - ::std::rc::Rc::new( - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::Put::Put { - Item: ::dafny_runtime::dafny_runtime_conversions::hashmap_to_dafny_map(&value.item.clone(), - |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&k), - |v| crate::conversions::attribute_value::to_dafny(&v) -, -) -, - TableName: dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&value.table_name), - ConditionExpression: crate::standard_library_conversions::ostring_to_dafny(&value.condition_expression), - ExpressionAttributeNames: -::std::rc::Rc::new(match &value.expression_attribute_names { - Some(x) => crate::r#_Wrappers_Compile::Option::Some { value : - ::dafny_runtime::dafny_runtime_conversions::hashmap_to_dafny_map(x, - |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&k), - |v| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&v), - ) - }, - None => crate::r#_Wrappers_Compile::Option::None {} -}) -, - ExpressionAttributeValues: -::std::rc::Rc::new(match &value.expression_attribute_values { - Some(x) => crate::r#_Wrappers_Compile::Option::Some { value : - ::dafny_runtime::dafny_runtime_conversions::hashmap_to_dafny_map(x, - |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&k), - |v| crate::conversions::attribute_value::to_dafny(&v) -, - ) - }, - None => crate::r#_Wrappers_Compile::Option::None {} -}) -, - ReturnValuesOnConditionCheckFailure: ::std::rc::Rc::new(match &value.return_values_on_condition_check_failure { - Some(x) => crate::_Wrappers_Compile::Option::Some { value: crate::conversions::return_values_on_condition_check_failure::to_dafny(x.clone()) }, - None => crate::_Wrappers_Compile::Option::None { } -}) -, - } - ) -} #[allow(dead_code)] -pub fn from_dafny( - dafny_value: ::std::rc::Rc< - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::Put, - >, -) -> aws_sdk_dynamodb::types::Put { - aws_sdk_dynamodb::types::Put::builder() - .set_item(Some( ::dafny_runtime::dafny_runtime_conversions::dafny_map_to_hashmap(&dafny_value.Item(), - |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(k), - |v| crate::conversions::attribute_value::from_dafny(v.clone()) -, -) - )) - .set_table_name(Some( dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(dafny_value.TableName()) )) - .set_condition_expression(crate::standard_library_conversions::ostring_from_dafny(dafny_value.ConditionExpression().clone())) - .set_expression_attribute_names(match (*dafny_value.ExpressionAttributeNames()).as_ref() { - crate::r#_Wrappers_Compile::Option::Some { value } => - Some( - ::dafny_runtime::dafny_runtime_conversions::dafny_map_to_hashmap(value, - |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(k), - |v| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(v), - ) - ), - _ => None -} -) - .set_expression_attribute_values(match (*dafny_value.ExpressionAttributeValues()).as_ref() { - crate::r#_Wrappers_Compile::Option::Some { value } => - Some( - ::dafny_runtime::dafny_runtime_conversions::dafny_map_to_hashmap(value, - |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(k), - |v| crate::conversions::attribute_value::from_dafny(v.clone()) -, - ) - ), - _ => None -} -) - .set_return_values_on_condition_check_failure(match &**dafny_value.ReturnValuesOnConditionCheckFailure() { - crate::r#_Wrappers_Compile::Option::Some { value } => Some( - crate::conversions::return_values_on_condition_check_failure::from_dafny(value) - ), - _ => None, -} -) - .build() - .unwrap() -} diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/put_item.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/put_item.rs deleted file mode 100644 index aa5d963ea..000000000 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/put_item.rs +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -pub mod _put_item_request; - - pub mod _put_item_response; - #[allow(dead_code)] -pub fn to_dafny_error( - value: &::aws_smithy_runtime_api::client::result::SdkError< - aws_sdk_dynamodb::operation::put_item::PutItemError, - ::aws_smithy_runtime_api::client::orchestrator::HttpResponse, - >, -) -> ::std::rc::Rc { - match value { - aws_sdk_dynamodb::error::SdkError::ServiceError(service_error) => match service_error.err() { - aws_sdk_dynamodb::operation::put_item::PutItemError::InternalServerError(e) => - crate::conversions::error::internal_server_error::to_dafny(e.clone()), - aws_sdk_dynamodb::operation::put_item::PutItemError::InvalidEndpointException(e) => - crate::conversions::error::invalid_endpoint_exception::to_dafny(e.clone()), - aws_sdk_dynamodb::operation::put_item::PutItemError::ResourceNotFoundException(e) => - crate::conversions::error::resource_not_found_exception::to_dafny(e.clone()), - aws_sdk_dynamodb::operation::put_item::PutItemError::RequestLimitExceeded(e) => - crate::conversions::error::request_limit_exceeded::to_dafny(e.clone()), - aws_sdk_dynamodb::operation::put_item::PutItemError::TransactionConflictException(e) => - crate::conversions::error::transaction_conflict_exception::to_dafny(e.clone()), - aws_sdk_dynamodb::operation::put_item::PutItemError::ConditionalCheckFailedException(e) => - crate::conversions::error::conditional_check_failed_exception::to_dafny(e.clone()), - aws_sdk_dynamodb::operation::put_item::PutItemError::ItemCollectionSizeLimitExceededException(e) => - crate::conversions::error::item_collection_size_limit_exceeded_exception::to_dafny(e.clone()), - aws_sdk_dynamodb::operation::put_item::PutItemError::ProvisionedThroughputExceededException(e) => - crate::conversions::error::provisioned_throughput_exceeded_exception::to_dafny(e.clone()), - e => crate::conversions::error::to_opaque_error(e.to_string()), - }, - _ => { - crate::conversions::error::to_opaque_error(value.to_string()) - } - } -} diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/put_item/_put_item_request.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/put_item/_put_item_request.rs deleted file mode 100644 index 2c6f0a8af..000000000 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/put_item/_put_item_request.rs +++ /dev/null @@ -1,155 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: &aws_sdk_dynamodb::operation::put_item::PutItemInput, -) -> ::std::rc::Rc< - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::PutItemInput, ->{ - ::std::rc::Rc::new(crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::PutItemInput::PutItemInput { - TableName: crate::standard_library_conversions::ostring_to_dafny(&value.table_name) .Extract(), - Item: ::dafny_runtime::dafny_runtime_conversions::hashmap_to_dafny_map(&value.item.clone().unwrap(), - |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&k), - |v| crate::conversions::attribute_value::to_dafny(&v) -, -) -, - Expected: -::std::rc::Rc::new(match &value.expected { - Some(x) => crate::r#_Wrappers_Compile::Option::Some { value : - ::dafny_runtime::dafny_runtime_conversions::hashmap_to_dafny_map(x, - |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&k), - |v| crate::conversions::expected_attribute_value::to_dafny(&v) -, - ) - }, - None => crate::r#_Wrappers_Compile::Option::None {} -}) -, - ReturnValues: ::std::rc::Rc::new(match &value.return_values { - Some(x) => crate::_Wrappers_Compile::Option::Some { value: crate::conversions::return_value::to_dafny(x.clone()) }, - None => crate::_Wrappers_Compile::Option::None { } -}) -, - ReturnConsumedCapacity: ::std::rc::Rc::new(match &value.return_consumed_capacity { - Some(x) => crate::_Wrappers_Compile::Option::Some { value: crate::conversions::return_consumed_capacity::to_dafny(x.clone()) }, - None => crate::_Wrappers_Compile::Option::None { } -}) -, - ReturnItemCollectionMetrics: ::std::rc::Rc::new(match &value.return_item_collection_metrics { - Some(x) => crate::_Wrappers_Compile::Option::Some { value: crate::conversions::return_item_collection_metrics::to_dafny(x.clone()) }, - None => crate::_Wrappers_Compile::Option::None { } -}) -, - ConditionalOperator: ::std::rc::Rc::new(match &value.conditional_operator { - Some(x) => crate::_Wrappers_Compile::Option::Some { value: crate::conversions::conditional_operator::to_dafny(x.clone()) }, - None => crate::_Wrappers_Compile::Option::None { } -}) -, - ConditionExpression: crate::standard_library_conversions::ostring_to_dafny(&value.condition_expression), - ExpressionAttributeNames: -::std::rc::Rc::new(match &value.expression_attribute_names { - Some(x) => crate::r#_Wrappers_Compile::Option::Some { value : - ::dafny_runtime::dafny_runtime_conversions::hashmap_to_dafny_map(x, - |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&k), - |v| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&v), - ) - }, - None => crate::r#_Wrappers_Compile::Option::None {} -}) -, - ExpressionAttributeValues: -::std::rc::Rc::new(match &value.expression_attribute_values { - Some(x) => crate::r#_Wrappers_Compile::Option::Some { value : - ::dafny_runtime::dafny_runtime_conversions::hashmap_to_dafny_map(x, - |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&k), - |v| crate::conversions::attribute_value::to_dafny(&v) -, - ) - }, - None => crate::r#_Wrappers_Compile::Option::None {} -}) -, - }) -} - #[allow(dead_code)] -pub fn from_dafny( - dafny_value: ::std::rc::Rc< - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::PutItemInput, - >, - client: aws_sdk_dynamodb::Client, -) -> aws_sdk_dynamodb::operation::put_item::builders::PutItemFluentBuilder { - client.put_item() - .set_table_name(Some( dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(dafny_value.TableName()) )) - .set_item(Some( ::dafny_runtime::dafny_runtime_conversions::dafny_map_to_hashmap(&dafny_value.Item(), - |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(k), - |v| crate::conversions::attribute_value::from_dafny(v.clone()) -, -) - )) - .set_expected(match (*dafny_value.Expected()).as_ref() { - crate::r#_Wrappers_Compile::Option::Some { value } => - Some( - ::dafny_runtime::dafny_runtime_conversions::dafny_map_to_hashmap(value, - |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(k), - |v| crate::conversions::expected_attribute_value::from_dafny(v.clone()) -, - ) - ), - _ => None -} -) - .set_return_values(match &**dafny_value.ReturnValues() { - crate::r#_Wrappers_Compile::Option::Some { value } => Some( - crate::conversions::return_value::from_dafny(value) - ), - _ => None, -} -) - .set_return_consumed_capacity(match &**dafny_value.ReturnConsumedCapacity() { - crate::r#_Wrappers_Compile::Option::Some { value } => Some( - crate::conversions::return_consumed_capacity::from_dafny(value) - ), - _ => None, -} -) - .set_return_item_collection_metrics(match &**dafny_value.ReturnItemCollectionMetrics() { - crate::r#_Wrappers_Compile::Option::Some { value } => Some( - crate::conversions::return_item_collection_metrics::from_dafny(value) - ), - _ => None, -} -) - .set_conditional_operator(match &**dafny_value.ConditionalOperator() { - crate::r#_Wrappers_Compile::Option::Some { value } => Some( - crate::conversions::conditional_operator::from_dafny(value) - ), - _ => None, -} -) - .set_condition_expression(crate::standard_library_conversions::ostring_from_dafny(dafny_value.ConditionExpression().clone())) - .set_expression_attribute_names(match (*dafny_value.ExpressionAttributeNames()).as_ref() { - crate::r#_Wrappers_Compile::Option::Some { value } => - Some( - ::dafny_runtime::dafny_runtime_conversions::dafny_map_to_hashmap(value, - |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(k), - |v| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(v), - ) - ), - _ => None -} -) - .set_expression_attribute_values(match (*dafny_value.ExpressionAttributeValues()).as_ref() { - crate::r#_Wrappers_Compile::Option::Some { value } => - Some( - ::dafny_runtime::dafny_runtime_conversions::dafny_map_to_hashmap(value, - |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(k), - |v| crate::conversions::attribute_value::from_dafny(v.clone()) -, - ) - ), - _ => None -} -) -} diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/put_item/_put_item_response.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/put_item/_put_item_response.rs deleted file mode 100644 index 12d79678d..000000000 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/put_item/_put_item_response.rs +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: &aws_sdk_dynamodb::operation::put_item::PutItemOutput -) -> ::std::rc::Rc< - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::PutItemOutput, ->{ - ::std::rc::Rc::new(crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::PutItemOutput::PutItemOutput { - Attributes: -::std::rc::Rc::new(match &value.attributes { - Some(x) => crate::r#_Wrappers_Compile::Option::Some { value : - ::dafny_runtime::dafny_runtime_conversions::hashmap_to_dafny_map(x, - |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&k), - |v| crate::conversions::attribute_value::to_dafny(&v) -, - ) - }, - None => crate::r#_Wrappers_Compile::Option::None {} -}) -, - ConsumedCapacity: ::std::rc::Rc::new(match &value.consumed_capacity { - Some(x) => crate::_Wrappers_Compile::Option::Some { value: crate::conversions::consumed_capacity::to_dafny(&x) }, - None => crate::_Wrappers_Compile::Option::None { } -}) -, - ItemCollectionMetrics: ::std::rc::Rc::new(match &value.item_collection_metrics { - Some(x) => crate::_Wrappers_Compile::Option::Some { value: crate::conversions::item_collection_metrics::to_dafny(&x) }, - None => crate::_Wrappers_Compile::Option::None { } -}) -, - }) -} - diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/put_request.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/put_request.rs deleted file mode 100644 index 47e6efe2d..000000000 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/put_request.rs +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: &aws_sdk_dynamodb::types::PutRequest, -) -> ::std::rc::Rc{ - ::std::rc::Rc::new( - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::PutRequest::PutRequest { - Item: ::dafny_runtime::dafny_runtime_conversions::hashmap_to_dafny_map(&value.item.clone(), - |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&k), - |v| crate::conversions::attribute_value::to_dafny(&v) -, -) -, - } - ) -} #[allow(dead_code)] -pub fn from_dafny( - dafny_value: ::std::rc::Rc< - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::PutRequest, - >, -) -> aws_sdk_dynamodb::types::PutRequest { - aws_sdk_dynamodb::types::PutRequest::builder() - .set_item(Some( ::dafny_runtime::dafny_runtime_conversions::dafny_map_to_hashmap(&dafny_value.Item(), - |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(k), - |v| crate::conversions::attribute_value::from_dafny(v.clone()) -, -) - )) - .build() - .unwrap() -} diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/query.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/query.rs deleted file mode 100644 index 6673b429d..000000000 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/query.rs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -pub mod _query_request; - - pub mod _query_response; - #[allow(dead_code)] -pub fn to_dafny_error( - value: &::aws_smithy_runtime_api::client::result::SdkError< - aws_sdk_dynamodb::operation::query::QueryError, - ::aws_smithy_runtime_api::client::orchestrator::HttpResponse, - >, -) -> ::std::rc::Rc { - match value { - aws_sdk_dynamodb::error::SdkError::ServiceError(service_error) => match service_error.err() { - aws_sdk_dynamodb::operation::query::QueryError::InternalServerError(e) => - crate::conversions::error::internal_server_error::to_dafny(e.clone()), - aws_sdk_dynamodb::operation::query::QueryError::InvalidEndpointException(e) => - crate::conversions::error::invalid_endpoint_exception::to_dafny(e.clone()), - aws_sdk_dynamodb::operation::query::QueryError::ResourceNotFoundException(e) => - crate::conversions::error::resource_not_found_exception::to_dafny(e.clone()), - aws_sdk_dynamodb::operation::query::QueryError::RequestLimitExceeded(e) => - crate::conversions::error::request_limit_exceeded::to_dafny(e.clone()), - aws_sdk_dynamodb::operation::query::QueryError::ProvisionedThroughputExceededException(e) => - crate::conversions::error::provisioned_throughput_exceeded_exception::to_dafny(e.clone()), - e => crate::conversions::error::to_opaque_error(e.to_string()), - }, - _ => { - crate::conversions::error::to_opaque_error(value.to_string()) - } - } -} diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/query/_query_request.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/query/_query_request.rs deleted file mode 100644 index 8bd79e88d..000000000 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/query/_query_request.rs +++ /dev/null @@ -1,210 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: &aws_sdk_dynamodb::operation::query::QueryInput, -) -> ::std::rc::Rc< - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::QueryInput, ->{ - ::std::rc::Rc::new(crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::QueryInput::QueryInput { - TableName: crate::standard_library_conversions::ostring_to_dafny(&value.table_name) .Extract(), - IndexName: crate::standard_library_conversions::ostring_to_dafny(&value.index_name), - Select: ::std::rc::Rc::new(match &value.select { - Some(x) => crate::_Wrappers_Compile::Option::Some { value: crate::conversions::select::to_dafny(x.clone()) }, - None => crate::_Wrappers_Compile::Option::None { } -}) -, - AttributesToGet: ::std::rc::Rc::new(match &value.attributes_to_get { - Some(x) => crate::r#_Wrappers_Compile::Option::Some { value : - ::dafny_runtime::dafny_runtime_conversions::vec_to_dafny_sequence(x, - |e| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&e), - ) - }, - None => crate::r#_Wrappers_Compile::Option::None {} -}) -, - Limit: crate::standard_library_conversions::oint_to_dafny(value.limit), - ConsistentRead: crate::standard_library_conversions::obool_to_dafny(&value.consistent_read), - KeyConditions: -::std::rc::Rc::new(match &value.key_conditions { - Some(x) => crate::r#_Wrappers_Compile::Option::Some { value : - ::dafny_runtime::dafny_runtime_conversions::hashmap_to_dafny_map(x, - |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&k), - |v| crate::conversions::condition::to_dafny(&v) -, - ) - }, - None => crate::r#_Wrappers_Compile::Option::None {} -}) -, - QueryFilter: -::std::rc::Rc::new(match &value.query_filter { - Some(x) => crate::r#_Wrappers_Compile::Option::Some { value : - ::dafny_runtime::dafny_runtime_conversions::hashmap_to_dafny_map(x, - |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&k), - |v| crate::conversions::condition::to_dafny(&v) -, - ) - }, - None => crate::r#_Wrappers_Compile::Option::None {} -}) -, - ConditionalOperator: ::std::rc::Rc::new(match &value.conditional_operator { - Some(x) => crate::_Wrappers_Compile::Option::Some { value: crate::conversions::conditional_operator::to_dafny(x.clone()) }, - None => crate::_Wrappers_Compile::Option::None { } -}) -, - ScanIndexForward: crate::standard_library_conversions::obool_to_dafny(&value.scan_index_forward), - ExclusiveStartKey: -::std::rc::Rc::new(match &value.exclusive_start_key { - Some(x) => crate::r#_Wrappers_Compile::Option::Some { value : - ::dafny_runtime::dafny_runtime_conversions::hashmap_to_dafny_map(x, - |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&k), - |v| crate::conversions::attribute_value::to_dafny(&v) -, - ) - }, - None => crate::r#_Wrappers_Compile::Option::None {} -}) -, - ReturnConsumedCapacity: ::std::rc::Rc::new(match &value.return_consumed_capacity { - Some(x) => crate::_Wrappers_Compile::Option::Some { value: crate::conversions::return_consumed_capacity::to_dafny(x.clone()) }, - None => crate::_Wrappers_Compile::Option::None { } -}) -, - ProjectionExpression: crate::standard_library_conversions::ostring_to_dafny(&value.projection_expression), - FilterExpression: crate::standard_library_conversions::ostring_to_dafny(&value.filter_expression), - KeyConditionExpression: crate::standard_library_conversions::ostring_to_dafny(&value.key_condition_expression), - ExpressionAttributeNames: -::std::rc::Rc::new(match &value.expression_attribute_names { - Some(x) => crate::r#_Wrappers_Compile::Option::Some { value : - ::dafny_runtime::dafny_runtime_conversions::hashmap_to_dafny_map(x, - |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&k), - |v| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&v), - ) - }, - None => crate::r#_Wrappers_Compile::Option::None {} -}) -, - ExpressionAttributeValues: -::std::rc::Rc::new(match &value.expression_attribute_values { - Some(x) => crate::r#_Wrappers_Compile::Option::Some { value : - ::dafny_runtime::dafny_runtime_conversions::hashmap_to_dafny_map(x, - |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&k), - |v| crate::conversions::attribute_value::to_dafny(&v) -, - ) - }, - None => crate::r#_Wrappers_Compile::Option::None {} -}) -, - }) -} - #[allow(dead_code)] -pub fn from_dafny( - dafny_value: ::std::rc::Rc< - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::QueryInput, - >, - client: aws_sdk_dynamodb::Client, -) -> aws_sdk_dynamodb::operation::query::builders::QueryFluentBuilder { - client.query() - .set_table_name(Some( dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(dafny_value.TableName()) )) - .set_index_name(crate::standard_library_conversions::ostring_from_dafny(dafny_value.IndexName().clone())) - .set_select(match &**dafny_value.Select() { - crate::r#_Wrappers_Compile::Option::Some { value } => Some( - crate::conversions::select::from_dafny(value) - ), - _ => None, -} -) - .set_attributes_to_get(match (*dafny_value.AttributesToGet()).as_ref() { - crate::r#_Wrappers_Compile::Option::Some { value } => - Some( - ::dafny_runtime::dafny_runtime_conversions::dafny_sequence_to_vec(value, - |e| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(e), - ) - ), - _ => None -} -) - .set_limit(crate::standard_library_conversions::oint_from_dafny(dafny_value.Limit().clone())) - .set_consistent_read(crate::standard_library_conversions::obool_from_dafny(dafny_value.ConsistentRead().clone())) - .set_key_conditions(match (*dafny_value.KeyConditions()).as_ref() { - crate::r#_Wrappers_Compile::Option::Some { value } => - Some( - ::dafny_runtime::dafny_runtime_conversions::dafny_map_to_hashmap(value, - |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(k), - |v| crate::conversions::condition::from_dafny(v.clone()) -, - ) - ), - _ => None -} -) - .set_query_filter(match (*dafny_value.QueryFilter()).as_ref() { - crate::r#_Wrappers_Compile::Option::Some { value } => - Some( - ::dafny_runtime::dafny_runtime_conversions::dafny_map_to_hashmap(value, - |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(k), - |v| crate::conversions::condition::from_dafny(v.clone()) -, - ) - ), - _ => None -} -) - .set_conditional_operator(match &**dafny_value.ConditionalOperator() { - crate::r#_Wrappers_Compile::Option::Some { value } => Some( - crate::conversions::conditional_operator::from_dafny(value) - ), - _ => None, -} -) - .set_scan_index_forward(crate::standard_library_conversions::obool_from_dafny(dafny_value.ScanIndexForward().clone())) - .set_exclusive_start_key(match (*dafny_value.ExclusiveStartKey()).as_ref() { - crate::r#_Wrappers_Compile::Option::Some { value } => - Some( - ::dafny_runtime::dafny_runtime_conversions::dafny_map_to_hashmap(value, - |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(k), - |v| crate::conversions::attribute_value::from_dafny(v.clone()) -, - ) - ), - _ => None -} -) - .set_return_consumed_capacity(match &**dafny_value.ReturnConsumedCapacity() { - crate::r#_Wrappers_Compile::Option::Some { value } => Some( - crate::conversions::return_consumed_capacity::from_dafny(value) - ), - _ => None, -} -) - .set_projection_expression(crate::standard_library_conversions::ostring_from_dafny(dafny_value.ProjectionExpression().clone())) - .set_filter_expression(crate::standard_library_conversions::ostring_from_dafny(dafny_value.FilterExpression().clone())) - .set_key_condition_expression(crate::standard_library_conversions::ostring_from_dafny(dafny_value.KeyConditionExpression().clone())) - .set_expression_attribute_names(match (*dafny_value.ExpressionAttributeNames()).as_ref() { - crate::r#_Wrappers_Compile::Option::Some { value } => - Some( - ::dafny_runtime::dafny_runtime_conversions::dafny_map_to_hashmap(value, - |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(k), - |v| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(v), - ) - ), - _ => None -} -) - .set_expression_attribute_values(match (*dafny_value.ExpressionAttributeValues()).as_ref() { - crate::r#_Wrappers_Compile::Option::Some { value } => - Some( - ::dafny_runtime::dafny_runtime_conversions::dafny_map_to_hashmap(value, - |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(k), - |v| crate::conversions::attribute_value::from_dafny(v.clone()) -, - ) - ), - _ => None -} -) -} diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/query/_query_response.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/query/_query_response.rs deleted file mode 100644 index 79e4dcaf5..000000000 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/query/_query_response.rs +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: &aws_sdk_dynamodb::operation::query::QueryOutput -) -> ::std::rc::Rc< - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::QueryOutput, ->{ - ::std::rc::Rc::new(crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::QueryOutput::QueryOutput { - Items: ::std::rc::Rc::new(match &value.items { - Some(x) => crate::r#_Wrappers_Compile::Option::Some { value : - ::dafny_runtime::dafny_runtime_conversions::vec_to_dafny_sequence(x, - |e| ::dafny_runtime::dafny_runtime_conversions::hashmap_to_dafny_map(&e.clone(), - |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&k), - |v| crate::conversions::attribute_value::to_dafny(&v) -, -) -, - ) - }, - None => crate::r#_Wrappers_Compile::Option::None {} -}) -, - Count: crate::standard_library_conversions::oint_to_dafny(Some(value.count)), - ScannedCount: crate::standard_library_conversions::oint_to_dafny(Some(value.scanned_count)), - LastEvaluatedKey: -::std::rc::Rc::new(match &value.last_evaluated_key { - Some(x) => crate::r#_Wrappers_Compile::Option::Some { value : - ::dafny_runtime::dafny_runtime_conversions::hashmap_to_dafny_map(x, - |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&k), - |v| crate::conversions::attribute_value::to_dafny(&v) -, - ) - }, - None => crate::r#_Wrappers_Compile::Option::None {} -}) -, - ConsumedCapacity: ::std::rc::Rc::new(match &value.consumed_capacity { - Some(x) => crate::_Wrappers_Compile::Option::Some { value: crate::conversions::consumed_capacity::to_dafny(&x) }, - None => crate::_Wrappers_Compile::Option::None { } -}) -, - }) -} - diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/replica_description.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/replica_description.rs deleted file mode 100644 index 594ddbf4d..000000000 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/replica_description.rs +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: &aws_sdk_dynamodb::types::ReplicaDescription, -) -> ::std::rc::Rc{ - ::std::rc::Rc::new( - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ReplicaDescription::ReplicaDescription { - RegionName: crate::standard_library_conversions::ostring_to_dafny(&value.region_name), - ReplicaStatus: ::std::rc::Rc::new(match &value.replica_status { - Some(x) => crate::_Wrappers_Compile::Option::Some { value: crate::conversions::replica_status::to_dafny(x.clone()) }, - None => crate::_Wrappers_Compile::Option::None { } -}) -, - ReplicaStatusDescription: crate::standard_library_conversions::ostring_to_dafny(&value.replica_status_description), - ReplicaStatusPercentProgress: crate::standard_library_conversions::ostring_to_dafny(&value.replica_status_percent_progress), - KMSMasterKeyId: crate::standard_library_conversions::ostring_to_dafny(&value.kms_master_key_id), - ProvisionedThroughputOverride: ::std::rc::Rc::new(match &value.provisioned_throughput_override { - Some(x) => crate::_Wrappers_Compile::Option::Some { value: crate::conversions::provisioned_throughput_override::to_dafny(&x) }, - None => crate::_Wrappers_Compile::Option::None { } -}) -, - GlobalSecondaryIndexes: ::std::rc::Rc::new(match &value.global_secondary_indexes { - Some(x) => crate::r#_Wrappers_Compile::Option::Some { value : - ::dafny_runtime::dafny_runtime_conversions::vec_to_dafny_sequence(x, - |e| crate::conversions::replica_global_secondary_index_description::to_dafny(&e) -, - ) - }, - None => crate::r#_Wrappers_Compile::Option::None {} -}) -, - ReplicaInaccessibleDateTime: crate::standard_library_conversions::otimestamp_to_dafny(&value.replica_inaccessible_date_time), - ReplicaTableClassSummary: ::std::rc::Rc::new(match &value.replica_table_class_summary { - Some(x) => crate::_Wrappers_Compile::Option::Some { value: crate::conversions::table_class_summary::to_dafny(&x) }, - None => crate::_Wrappers_Compile::Option::None { } -}) -, - } - ) -} #[allow(dead_code)] -pub fn from_dafny( - dafny_value: ::std::rc::Rc< - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ReplicaDescription, - >, -) -> aws_sdk_dynamodb::types::ReplicaDescription { - aws_sdk_dynamodb::types::ReplicaDescription::builder() - .set_region_name(crate::standard_library_conversions::ostring_from_dafny(dafny_value.RegionName().clone())) - .set_replica_status(match &**dafny_value.ReplicaStatus() { - crate::r#_Wrappers_Compile::Option::Some { value } => Some( - crate::conversions::replica_status::from_dafny(value) - ), - _ => None, -} -) - .set_replica_status_description(crate::standard_library_conversions::ostring_from_dafny(dafny_value.ReplicaStatusDescription().clone())) - .set_replica_status_percent_progress(crate::standard_library_conversions::ostring_from_dafny(dafny_value.ReplicaStatusPercentProgress().clone())) - .set_kms_master_key_id(crate::standard_library_conversions::ostring_from_dafny(dafny_value.KMSMasterKeyId().clone())) - .set_provisioned_throughput_override(match (*dafny_value.ProvisionedThroughputOverride()).as_ref() { - crate::r#_Wrappers_Compile::Option::Some { value } => - Some(crate::conversions::provisioned_throughput_override::from_dafny(value.clone())), - _ => None, -} -) - .set_global_secondary_indexes(match (*dafny_value.GlobalSecondaryIndexes()).as_ref() { - crate::r#_Wrappers_Compile::Option::Some { value } => - Some( - ::dafny_runtime::dafny_runtime_conversions::dafny_sequence_to_vec(value, - |e| crate::conversions::replica_global_secondary_index_description::from_dafny(e.clone()) -, - ) - ), - _ => None -} -) - .set_replica_inaccessible_date_time(crate::standard_library_conversions::otimestamp_from_dafny(dafny_value.ReplicaInaccessibleDateTime().clone())) - .set_replica_table_class_summary(match (*dafny_value.ReplicaTableClassSummary()).as_ref() { - crate::r#_Wrappers_Compile::Option::Some { value } => - Some(crate::conversions::table_class_summary::from_dafny(value.clone())), - _ => None, -} -) - .build() - -} diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/replica_global_secondary_index_description.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/replica_global_secondary_index_description.rs deleted file mode 100644 index 42873feb2..000000000 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/replica_global_secondary_index_description.rs +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: &aws_sdk_dynamodb::types::ReplicaGlobalSecondaryIndexDescription, -) -> ::std::rc::Rc{ - ::std::rc::Rc::new( - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ReplicaGlobalSecondaryIndexDescription::ReplicaGlobalSecondaryIndexDescription { - IndexName: crate::standard_library_conversions::ostring_to_dafny(&value.index_name), - ProvisionedThroughputOverride: ::std::rc::Rc::new(match &value.provisioned_throughput_override { - Some(x) => crate::_Wrappers_Compile::Option::Some { value: crate::conversions::provisioned_throughput_override::to_dafny(&x) }, - None => crate::_Wrappers_Compile::Option::None { } -}) -, - } - ) -} #[allow(dead_code)] -pub fn from_dafny( - dafny_value: ::std::rc::Rc< - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ReplicaGlobalSecondaryIndexDescription, - >, -) -> aws_sdk_dynamodb::types::ReplicaGlobalSecondaryIndexDescription { - aws_sdk_dynamodb::types::ReplicaGlobalSecondaryIndexDescription::builder() - .set_index_name(crate::standard_library_conversions::ostring_from_dafny(dafny_value.IndexName().clone())) - .set_provisioned_throughput_override(match (*dafny_value.ProvisionedThroughputOverride()).as_ref() { - crate::r#_Wrappers_Compile::Option::Some { value } => - Some(crate::conversions::provisioned_throughput_override::from_dafny(value.clone())), - _ => None, -} -) - .build() - -} diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/replica_status.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/replica_status.rs deleted file mode 100644 index fd626473a..000000000 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/replica_status.rs +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] - -pub fn to_dafny( - value: aws_sdk_dynamodb::types::ReplicaStatus, -) -> ::std::rc::Rc{ - ::std::rc::Rc::new(match value { - aws_sdk_dynamodb::types::ReplicaStatus::Creating => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ReplicaStatus::CREATING {}, -aws_sdk_dynamodb::types::ReplicaStatus::CreationFailed => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ReplicaStatus::CREATION_FAILED {}, -aws_sdk_dynamodb::types::ReplicaStatus::Updating => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ReplicaStatus::UPDATING {}, -aws_sdk_dynamodb::types::ReplicaStatus::Deleting => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ReplicaStatus::DELETING {}, -aws_sdk_dynamodb::types::ReplicaStatus::Active => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ReplicaStatus::ACTIVE {}, -aws_sdk_dynamodb::types::ReplicaStatus::RegionDisabled => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ReplicaStatus::REGION_DISABLED {}, -aws_sdk_dynamodb::types::ReplicaStatus::InaccessibleEncryptionCredentials => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ReplicaStatus::INACCESSIBLE_ENCRYPTION_CREDENTIALS {}, - _ => panic!("Unknown enum variant: {}", value), - }) -} - #[allow(dead_code)] -pub fn from_dafny( - dafny_value: &crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ReplicaStatus, -) -> aws_sdk_dynamodb::types::ReplicaStatus { - match dafny_value { - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ReplicaStatus::CREATING {} => aws_sdk_dynamodb::types::ReplicaStatus::Creating, -crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ReplicaStatus::CREATION_FAILED {} => aws_sdk_dynamodb::types::ReplicaStatus::CreationFailed, -crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ReplicaStatus::UPDATING {} => aws_sdk_dynamodb::types::ReplicaStatus::Updating, -crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ReplicaStatus::DELETING {} => aws_sdk_dynamodb::types::ReplicaStatus::Deleting, -crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ReplicaStatus::ACTIVE {} => aws_sdk_dynamodb::types::ReplicaStatus::Active, -crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ReplicaStatus::REGION_DISABLED {} => aws_sdk_dynamodb::types::ReplicaStatus::RegionDisabled, -crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ReplicaStatus::INACCESSIBLE_ENCRYPTION_CREDENTIALS {} => aws_sdk_dynamodb::types::ReplicaStatus::InaccessibleEncryptionCredentials, - } -} diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/restore_summary.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/restore_summary.rs deleted file mode 100644 index f5e889989..000000000 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/restore_summary.rs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: &aws_sdk_dynamodb::types::RestoreSummary, -) -> ::std::rc::Rc{ - ::std::rc::Rc::new( - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::RestoreSummary::RestoreSummary { - SourceBackupArn: crate::standard_library_conversions::ostring_to_dafny(&value.source_backup_arn), - SourceTableArn: crate::standard_library_conversions::ostring_to_dafny(&value.source_table_arn), - RestoreDateTime: crate::standard_library_conversions::timestamp_to_dafny(&value.restore_date_time), - RestoreInProgress: value.restore_in_progress.clone(), - } - ) -} #[allow(dead_code)] -pub fn from_dafny( - dafny_value: ::std::rc::Rc< - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::RestoreSummary, - >, -) -> aws_sdk_dynamodb::types::RestoreSummary { - aws_sdk_dynamodb::types::RestoreSummary::builder() - .set_source_backup_arn(crate::standard_library_conversions::ostring_from_dafny(dafny_value.SourceBackupArn().clone())) - .set_source_table_arn(crate::standard_library_conversions::ostring_from_dafny(dafny_value.SourceTableArn().clone())) - .set_restore_date_time(Some(crate::standard_library_conversions::timestamp_from_dafny(dafny_value.RestoreDateTime().clone()))) - .set_restore_in_progress(Some( dafny_value.RestoreInProgress() .clone() )) - .build() - .unwrap() -} diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/return_consumed_capacity.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/return_consumed_capacity.rs deleted file mode 100644 index b2526611f..000000000 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/return_consumed_capacity.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] - -pub fn to_dafny( - value: aws_sdk_dynamodb::types::ReturnConsumedCapacity, -) -> ::std::rc::Rc{ - ::std::rc::Rc::new(match value { - aws_sdk_dynamodb::types::ReturnConsumedCapacity::Indexes => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ReturnConsumedCapacity::INDEXES {}, -aws_sdk_dynamodb::types::ReturnConsumedCapacity::Total => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ReturnConsumedCapacity::TOTAL {}, -aws_sdk_dynamodb::types::ReturnConsumedCapacity::None => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ReturnConsumedCapacity::NONE {}, - _ => panic!("Unknown enum variant: {}", value), - }) -} - #[allow(dead_code)] -pub fn from_dafny( - dafny_value: &crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ReturnConsumedCapacity, -) -> aws_sdk_dynamodb::types::ReturnConsumedCapacity { - match dafny_value { - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ReturnConsumedCapacity::INDEXES {} => aws_sdk_dynamodb::types::ReturnConsumedCapacity::Indexes, -crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ReturnConsumedCapacity::TOTAL {} => aws_sdk_dynamodb::types::ReturnConsumedCapacity::Total, -crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ReturnConsumedCapacity::NONE {} => aws_sdk_dynamodb::types::ReturnConsumedCapacity::None, - } -} diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/return_item_collection_metrics.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/return_item_collection_metrics.rs deleted file mode 100644 index 685738730..000000000 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/return_item_collection_metrics.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] - -pub fn to_dafny( - value: aws_sdk_dynamodb::types::ReturnItemCollectionMetrics, -) -> ::std::rc::Rc{ - ::std::rc::Rc::new(match value { - aws_sdk_dynamodb::types::ReturnItemCollectionMetrics::Size => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ReturnItemCollectionMetrics::SIZE {}, -aws_sdk_dynamodb::types::ReturnItemCollectionMetrics::None => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ReturnItemCollectionMetrics::NONE {}, - _ => panic!("Unknown enum variant: {}", value), - }) -} - #[allow(dead_code)] -pub fn from_dafny( - dafny_value: &crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ReturnItemCollectionMetrics, -) -> aws_sdk_dynamodb::types::ReturnItemCollectionMetrics { - match dafny_value { - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ReturnItemCollectionMetrics::SIZE {} => aws_sdk_dynamodb::types::ReturnItemCollectionMetrics::Size, -crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ReturnItemCollectionMetrics::NONE {} => aws_sdk_dynamodb::types::ReturnItemCollectionMetrics::None, - } -} diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/return_value.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/return_value.rs deleted file mode 100644 index df8085df3..000000000 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/return_value.rs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] - -pub fn to_dafny( - value: aws_sdk_dynamodb::types::ReturnValue, -) -> ::std::rc::Rc{ - ::std::rc::Rc::new(match value { - aws_sdk_dynamodb::types::ReturnValue::None => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ReturnValue::NONE {}, -aws_sdk_dynamodb::types::ReturnValue::AllOld => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ReturnValue::ALL_OLD {}, -aws_sdk_dynamodb::types::ReturnValue::UpdatedOld => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ReturnValue::UPDATED_OLD {}, -aws_sdk_dynamodb::types::ReturnValue::AllNew => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ReturnValue::ALL_NEW {}, -aws_sdk_dynamodb::types::ReturnValue::UpdatedNew => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ReturnValue::UPDATED_NEW {}, - _ => panic!("Unknown enum variant: {}", value), - }) -} - #[allow(dead_code)] -pub fn from_dafny( - dafny_value: &crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ReturnValue, -) -> aws_sdk_dynamodb::types::ReturnValue { - match dafny_value { - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ReturnValue::NONE {} => aws_sdk_dynamodb::types::ReturnValue::None, -crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ReturnValue::ALL_OLD {} => aws_sdk_dynamodb::types::ReturnValue::AllOld, -crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ReturnValue::UPDATED_OLD {} => aws_sdk_dynamodb::types::ReturnValue::UpdatedOld, -crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ReturnValue::ALL_NEW {} => aws_sdk_dynamodb::types::ReturnValue::AllNew, -crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ReturnValue::UPDATED_NEW {} => aws_sdk_dynamodb::types::ReturnValue::UpdatedNew, - } -} diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/return_values_on_condition_check_failure.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/return_values_on_condition_check_failure.rs deleted file mode 100644 index 7d3380d94..000000000 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/return_values_on_condition_check_failure.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] - -pub fn to_dafny( - value: aws_sdk_dynamodb::types::ReturnValuesOnConditionCheckFailure, -) -> ::std::rc::Rc{ - ::std::rc::Rc::new(match value { - aws_sdk_dynamodb::types::ReturnValuesOnConditionCheckFailure::AllOld => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ReturnValuesOnConditionCheckFailure::ALL_OLD {}, -aws_sdk_dynamodb::types::ReturnValuesOnConditionCheckFailure::None => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ReturnValuesOnConditionCheckFailure::NONE {}, - _ => panic!("Unknown enum variant: {}", value), - }) -} - #[allow(dead_code)] -pub fn from_dafny( - dafny_value: &crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ReturnValuesOnConditionCheckFailure, -) -> aws_sdk_dynamodb::types::ReturnValuesOnConditionCheckFailure { - match dafny_value { - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ReturnValuesOnConditionCheckFailure::ALL_OLD {} => aws_sdk_dynamodb::types::ReturnValuesOnConditionCheckFailure::AllOld, -crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ReturnValuesOnConditionCheckFailure::NONE {} => aws_sdk_dynamodb::types::ReturnValuesOnConditionCheckFailure::None, - } -} diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/scalar_attribute_type.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/scalar_attribute_type.rs deleted file mode 100644 index f921f603f..000000000 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/scalar_attribute_type.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] - -pub fn to_dafny( - value: aws_sdk_dynamodb::types::ScalarAttributeType, -) -> ::std::rc::Rc{ - ::std::rc::Rc::new(match value { - aws_sdk_dynamodb::types::ScalarAttributeType::S => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ScalarAttributeType::S {}, -aws_sdk_dynamodb::types::ScalarAttributeType::N => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ScalarAttributeType::N {}, -aws_sdk_dynamodb::types::ScalarAttributeType::B => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ScalarAttributeType::B {}, - _ => panic!("Unknown enum variant: {}", value), - }) -} - #[allow(dead_code)] -pub fn from_dafny( - dafny_value: &crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ScalarAttributeType, -) -> aws_sdk_dynamodb::types::ScalarAttributeType { - match dafny_value { - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ScalarAttributeType::S {} => aws_sdk_dynamodb::types::ScalarAttributeType::S, -crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ScalarAttributeType::N {} => aws_sdk_dynamodb::types::ScalarAttributeType::N, -crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ScalarAttributeType::B {} => aws_sdk_dynamodb::types::ScalarAttributeType::B, - } -} diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/scan.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/scan.rs deleted file mode 100644 index f514ce7a6..000000000 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/scan.rs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -pub mod _scan_request; - - pub mod _scan_response; - #[allow(dead_code)] -pub fn to_dafny_error( - value: &::aws_smithy_runtime_api::client::result::SdkError< - aws_sdk_dynamodb::operation::scan::ScanError, - ::aws_smithy_runtime_api::client::orchestrator::HttpResponse, - >, -) -> ::std::rc::Rc { - match value { - aws_sdk_dynamodb::error::SdkError::ServiceError(service_error) => match service_error.err() { - aws_sdk_dynamodb::operation::scan::ScanError::InternalServerError(e) => - crate::conversions::error::internal_server_error::to_dafny(e.clone()), - aws_sdk_dynamodb::operation::scan::ScanError::InvalidEndpointException(e) => - crate::conversions::error::invalid_endpoint_exception::to_dafny(e.clone()), - aws_sdk_dynamodb::operation::scan::ScanError::ResourceNotFoundException(e) => - crate::conversions::error::resource_not_found_exception::to_dafny(e.clone()), - aws_sdk_dynamodb::operation::scan::ScanError::RequestLimitExceeded(e) => - crate::conversions::error::request_limit_exceeded::to_dafny(e.clone()), - aws_sdk_dynamodb::operation::scan::ScanError::ProvisionedThroughputExceededException(e) => - crate::conversions::error::provisioned_throughput_exceeded_exception::to_dafny(e.clone()), - e => crate::conversions::error::to_opaque_error(e.to_string()), - }, - _ => { - crate::conversions::error::to_opaque_error(value.to_string()) - } - } -} diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/scan/_scan_request.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/scan/_scan_request.rs deleted file mode 100644 index 11bbfec8c..000000000 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/scan/_scan_request.rs +++ /dev/null @@ -1,186 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: &aws_sdk_dynamodb::operation::scan::ScanInput, -) -> ::std::rc::Rc< - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ScanInput, ->{ - ::std::rc::Rc::new(crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ScanInput::ScanInput { - TableName: crate::standard_library_conversions::ostring_to_dafny(&value.table_name) .Extract(), - IndexName: crate::standard_library_conversions::ostring_to_dafny(&value.index_name), - AttributesToGet: ::std::rc::Rc::new(match &value.attributes_to_get { - Some(x) => crate::r#_Wrappers_Compile::Option::Some { value : - ::dafny_runtime::dafny_runtime_conversions::vec_to_dafny_sequence(x, - |e| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&e), - ) - }, - None => crate::r#_Wrappers_Compile::Option::None {} -}) -, - Limit: crate::standard_library_conversions::oint_to_dafny(value.limit), - Select: ::std::rc::Rc::new(match &value.select { - Some(x) => crate::_Wrappers_Compile::Option::Some { value: crate::conversions::select::to_dafny(x.clone()) }, - None => crate::_Wrappers_Compile::Option::None { } -}) -, - ScanFilter: -::std::rc::Rc::new(match &value.scan_filter { - Some(x) => crate::r#_Wrappers_Compile::Option::Some { value : - ::dafny_runtime::dafny_runtime_conversions::hashmap_to_dafny_map(x, - |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&k), - |v| crate::conversions::condition::to_dafny(&v) -, - ) - }, - None => crate::r#_Wrappers_Compile::Option::None {} -}) -, - ConditionalOperator: ::std::rc::Rc::new(match &value.conditional_operator { - Some(x) => crate::_Wrappers_Compile::Option::Some { value: crate::conversions::conditional_operator::to_dafny(x.clone()) }, - None => crate::_Wrappers_Compile::Option::None { } -}) -, - ExclusiveStartKey: -::std::rc::Rc::new(match &value.exclusive_start_key { - Some(x) => crate::r#_Wrappers_Compile::Option::Some { value : - ::dafny_runtime::dafny_runtime_conversions::hashmap_to_dafny_map(x, - |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&k), - |v| crate::conversions::attribute_value::to_dafny(&v) -, - ) - }, - None => crate::r#_Wrappers_Compile::Option::None {} -}) -, - ReturnConsumedCapacity: ::std::rc::Rc::new(match &value.return_consumed_capacity { - Some(x) => crate::_Wrappers_Compile::Option::Some { value: crate::conversions::return_consumed_capacity::to_dafny(x.clone()) }, - None => crate::_Wrappers_Compile::Option::None { } -}) -, - TotalSegments: crate::standard_library_conversions::oint_to_dafny(value.total_segments), - Segment: crate::standard_library_conversions::oint_to_dafny(value.segment), - ProjectionExpression: crate::standard_library_conversions::ostring_to_dafny(&value.projection_expression), - FilterExpression: crate::standard_library_conversions::ostring_to_dafny(&value.filter_expression), - ExpressionAttributeNames: -::std::rc::Rc::new(match &value.expression_attribute_names { - Some(x) => crate::r#_Wrappers_Compile::Option::Some { value : - ::dafny_runtime::dafny_runtime_conversions::hashmap_to_dafny_map(x, - |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&k), - |v| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&v), - ) - }, - None => crate::r#_Wrappers_Compile::Option::None {} -}) -, - ExpressionAttributeValues: -::std::rc::Rc::new(match &value.expression_attribute_values { - Some(x) => crate::r#_Wrappers_Compile::Option::Some { value : - ::dafny_runtime::dafny_runtime_conversions::hashmap_to_dafny_map(x, - |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&k), - |v| crate::conversions::attribute_value::to_dafny(&v) -, - ) - }, - None => crate::r#_Wrappers_Compile::Option::None {} -}) -, - ConsistentRead: crate::standard_library_conversions::obool_to_dafny(&value.consistent_read), - }) -} - #[allow(dead_code)] -pub fn from_dafny( - dafny_value: ::std::rc::Rc< - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ScanInput, - >, - client: aws_sdk_dynamodb::Client, -) -> aws_sdk_dynamodb::operation::scan::builders::ScanFluentBuilder { - client.scan() - .set_table_name(Some( dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(dafny_value.TableName()) )) - .set_index_name(crate::standard_library_conversions::ostring_from_dafny(dafny_value.IndexName().clone())) - .set_attributes_to_get(match (*dafny_value.AttributesToGet()).as_ref() { - crate::r#_Wrappers_Compile::Option::Some { value } => - Some( - ::dafny_runtime::dafny_runtime_conversions::dafny_sequence_to_vec(value, - |e| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(e), - ) - ), - _ => None -} -) - .set_limit(crate::standard_library_conversions::oint_from_dafny(dafny_value.Limit().clone())) - .set_select(match &**dafny_value.Select() { - crate::r#_Wrappers_Compile::Option::Some { value } => Some( - crate::conversions::select::from_dafny(value) - ), - _ => None, -} -) - .set_scan_filter(match (*dafny_value.ScanFilter()).as_ref() { - crate::r#_Wrappers_Compile::Option::Some { value } => - Some( - ::dafny_runtime::dafny_runtime_conversions::dafny_map_to_hashmap(value, - |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(k), - |v| crate::conversions::condition::from_dafny(v.clone()) -, - ) - ), - _ => None -} -) - .set_conditional_operator(match &**dafny_value.ConditionalOperator() { - crate::r#_Wrappers_Compile::Option::Some { value } => Some( - crate::conversions::conditional_operator::from_dafny(value) - ), - _ => None, -} -) - .set_exclusive_start_key(match (*dafny_value.ExclusiveStartKey()).as_ref() { - crate::r#_Wrappers_Compile::Option::Some { value } => - Some( - ::dafny_runtime::dafny_runtime_conversions::dafny_map_to_hashmap(value, - |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(k), - |v| crate::conversions::attribute_value::from_dafny(v.clone()) -, - ) - ), - _ => None -} -) - .set_return_consumed_capacity(match &**dafny_value.ReturnConsumedCapacity() { - crate::r#_Wrappers_Compile::Option::Some { value } => Some( - crate::conversions::return_consumed_capacity::from_dafny(value) - ), - _ => None, -} -) - .set_total_segments(crate::standard_library_conversions::oint_from_dafny(dafny_value.TotalSegments().clone())) - .set_segment(crate::standard_library_conversions::oint_from_dafny(dafny_value.Segment().clone())) - .set_projection_expression(crate::standard_library_conversions::ostring_from_dafny(dafny_value.ProjectionExpression().clone())) - .set_filter_expression(crate::standard_library_conversions::ostring_from_dafny(dafny_value.FilterExpression().clone())) - .set_expression_attribute_names(match (*dafny_value.ExpressionAttributeNames()).as_ref() { - crate::r#_Wrappers_Compile::Option::Some { value } => - Some( - ::dafny_runtime::dafny_runtime_conversions::dafny_map_to_hashmap(value, - |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(k), - |v| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(v), - ) - ), - _ => None -} -) - .set_expression_attribute_values(match (*dafny_value.ExpressionAttributeValues()).as_ref() { - crate::r#_Wrappers_Compile::Option::Some { value } => - Some( - ::dafny_runtime::dafny_runtime_conversions::dafny_map_to_hashmap(value, - |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(k), - |v| crate::conversions::attribute_value::from_dafny(v.clone()) -, - ) - ), - _ => None -} -) - .set_consistent_read(crate::standard_library_conversions::obool_from_dafny(dafny_value.ConsistentRead().clone())) -} diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/scan/_scan_response.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/scan/_scan_response.rs deleted file mode 100644 index e4c7c742d..000000000 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/scan/_scan_response.rs +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: &aws_sdk_dynamodb::operation::scan::ScanOutput -) -> ::std::rc::Rc< - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ScanOutput, ->{ - ::std::rc::Rc::new(crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ScanOutput::ScanOutput { - Items: ::std::rc::Rc::new(match &value.items { - Some(x) => crate::r#_Wrappers_Compile::Option::Some { value : - ::dafny_runtime::dafny_runtime_conversions::vec_to_dafny_sequence(x, - |e| ::dafny_runtime::dafny_runtime_conversions::hashmap_to_dafny_map(&e.clone(), - |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&k), - |v| crate::conversions::attribute_value::to_dafny(&v) -, -) -, - ) - }, - None => crate::r#_Wrappers_Compile::Option::None {} -}) -, - Count: crate::standard_library_conversions::oint_to_dafny(Some(value.count)), - ScannedCount: crate::standard_library_conversions::oint_to_dafny(Some(value.scanned_count)), - LastEvaluatedKey: -::std::rc::Rc::new(match &value.last_evaluated_key { - Some(x) => crate::r#_Wrappers_Compile::Option::Some { value : - ::dafny_runtime::dafny_runtime_conversions::hashmap_to_dafny_map(x, - |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&k), - |v| crate::conversions::attribute_value::to_dafny(&v) -, - ) - }, - None => crate::r#_Wrappers_Compile::Option::None {} -}) -, - ConsumedCapacity: ::std::rc::Rc::new(match &value.consumed_capacity { - Some(x) => crate::_Wrappers_Compile::Option::Some { value: crate::conversions::consumed_capacity::to_dafny(&x) }, - None => crate::_Wrappers_Compile::Option::None { } -}) -, - }) -} - diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/select.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/select.rs deleted file mode 100644 index c52b7a634..000000000 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/select.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] - -pub fn to_dafny( - value: aws_sdk_dynamodb::types::Select, -) -> ::std::rc::Rc{ - ::std::rc::Rc::new(match value { - aws_sdk_dynamodb::types::Select::AllAttributes => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::Select::ALL_ATTRIBUTES {}, -aws_sdk_dynamodb::types::Select::AllProjectedAttributes => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::Select::ALL_PROJECTED_ATTRIBUTES {}, -aws_sdk_dynamodb::types::Select::SpecificAttributes => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::Select::SPECIFIC_ATTRIBUTES {}, -aws_sdk_dynamodb::types::Select::Count => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::Select::COUNT {}, - _ => panic!("Unknown enum variant: {}", value), - }) -} - #[allow(dead_code)] -pub fn from_dafny( - dafny_value: &crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::Select, -) -> aws_sdk_dynamodb::types::Select { - match dafny_value { - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::Select::ALL_ATTRIBUTES {} => aws_sdk_dynamodb::types::Select::AllAttributes, -crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::Select::ALL_PROJECTED_ATTRIBUTES {} => aws_sdk_dynamodb::types::Select::AllProjectedAttributes, -crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::Select::SPECIFIC_ATTRIBUTES {} => aws_sdk_dynamodb::types::Select::SpecificAttributes, -crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::Select::COUNT {} => aws_sdk_dynamodb::types::Select::Count, - } -} diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/sse_description.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/sse_description.rs deleted file mode 100644 index bdea83203..000000000 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/sse_description.rs +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: &aws_sdk_dynamodb::types::SseDescription, -) -> ::std::rc::Rc{ - ::std::rc::Rc::new( - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::SSEDescription::SSEDescription { - Status: ::std::rc::Rc::new(match &value.status { - Some(x) => crate::_Wrappers_Compile::Option::Some { value: crate::conversions::sse_status::to_dafny(x.clone()) }, - None => crate::_Wrappers_Compile::Option::None { } -}) -, - SSEType: ::std::rc::Rc::new(match &value.sse_type { - Some(x) => crate::_Wrappers_Compile::Option::Some { value: crate::conversions::sse_type::to_dafny(x.clone()) }, - None => crate::_Wrappers_Compile::Option::None { } -}) -, - KMSMasterKeyArn: crate::standard_library_conversions::ostring_to_dafny(&value.kms_master_key_arn), - InaccessibleEncryptionDateTime: crate::standard_library_conversions::otimestamp_to_dafny(&value.inaccessible_encryption_date_time), - } - ) -} #[allow(dead_code)] -pub fn from_dafny( - dafny_value: ::std::rc::Rc< - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::SSEDescription, - >, -) -> aws_sdk_dynamodb::types::SseDescription { - aws_sdk_dynamodb::types::SseDescription::builder() - .set_status(match &**dafny_value.Status() { - crate::r#_Wrappers_Compile::Option::Some { value } => Some( - crate::conversions::sse_status::from_dafny(value) - ), - _ => None, -} -) - .set_sse_type(match &**dafny_value.SSEType() { - crate::r#_Wrappers_Compile::Option::Some { value } => Some( - crate::conversions::sse_type::from_dafny(value) - ), - _ => None, -} -) - .set_kms_master_key_arn(crate::standard_library_conversions::ostring_from_dafny(dafny_value.KMSMasterKeyArn().clone())) - .set_inaccessible_encryption_date_time(crate::standard_library_conversions::otimestamp_from_dafny(dafny_value.InaccessibleEncryptionDateTime().clone())) - .build() - -} diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/sse_specification.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/sse_specification.rs deleted file mode 100644 index 69894bc73..000000000 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/sse_specification.rs +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: &aws_sdk_dynamodb::types::SseSpecification, -) -> ::std::rc::Rc{ - ::std::rc::Rc::new( - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::SSESpecification::SSESpecification { - Enabled: crate::standard_library_conversions::obool_to_dafny(&value.enabled), - SSEType: ::std::rc::Rc::new(match &value.sse_type { - Some(x) => crate::_Wrappers_Compile::Option::Some { value: crate::conversions::sse_type::to_dafny(x.clone()) }, - None => crate::_Wrappers_Compile::Option::None { } -}) -, - KMSMasterKeyId: crate::standard_library_conversions::ostring_to_dafny(&value.kms_master_key_id), - } - ) -} #[allow(dead_code)] -pub fn from_dafny( - dafny_value: ::std::rc::Rc< - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::SSESpecification, - >, -) -> aws_sdk_dynamodb::types::SseSpecification { - aws_sdk_dynamodb::types::SseSpecification::builder() - .set_enabled(crate::standard_library_conversions::obool_from_dafny(dafny_value.Enabled().clone())) - .set_sse_type(match &**dafny_value.SSEType() { - crate::r#_Wrappers_Compile::Option::Some { value } => Some( - crate::conversions::sse_type::from_dafny(value) - ), - _ => None, -} -) - .set_kms_master_key_id(crate::standard_library_conversions::ostring_from_dafny(dafny_value.KMSMasterKeyId().clone())) - .build() - -} diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/sse_status.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/sse_status.rs deleted file mode 100644 index a4f20bf1c..000000000 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/sse_status.rs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] - -pub fn to_dafny( - value: aws_sdk_dynamodb::types::SseStatus, -) -> ::std::rc::Rc{ - ::std::rc::Rc::new(match value { - aws_sdk_dynamodb::types::SseStatus::Enabling => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::SSEStatus::ENABLING {}, -aws_sdk_dynamodb::types::SseStatus::Enabled => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::SSEStatus::ENABLED {}, -aws_sdk_dynamodb::types::SseStatus::Disabling => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::SSEStatus::DISABLING {}, -aws_sdk_dynamodb::types::SseStatus::Disabled => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::SSEStatus::DISABLED {}, -aws_sdk_dynamodb::types::SseStatus::Updating => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::SSEStatus::UPDATING {}, - _ => panic!("Unknown enum variant: {}", value), - }) -} - #[allow(dead_code)] -pub fn from_dafny( - dafny_value: &crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::SSEStatus, -) -> aws_sdk_dynamodb::types::SseStatus { - match dafny_value { - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::SSEStatus::ENABLING {} => aws_sdk_dynamodb::types::SseStatus::Enabling, -crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::SSEStatus::ENABLED {} => aws_sdk_dynamodb::types::SseStatus::Enabled, -crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::SSEStatus::DISABLING {} => aws_sdk_dynamodb::types::SseStatus::Disabling, -crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::SSEStatus::DISABLED {} => aws_sdk_dynamodb::types::SseStatus::Disabled, -crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::SSEStatus::UPDATING {} => aws_sdk_dynamodb::types::SseStatus::Updating, - } -} diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/sse_type.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/sse_type.rs deleted file mode 100644 index 56f69062b..000000000 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/sse_type.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] - -pub fn to_dafny( - value: aws_sdk_dynamodb::types::SseType, -) -> ::std::rc::Rc{ - ::std::rc::Rc::new(match value { - aws_sdk_dynamodb::types::SseType::Aes256 => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::SSEType::AES256 {}, -aws_sdk_dynamodb::types::SseType::Kms => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::SSEType::KMS {}, - _ => panic!("Unknown enum variant: {}", value), - }) -} - #[allow(dead_code)] -pub fn from_dafny( - dafny_value: &crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::SSEType, -) -> aws_sdk_dynamodb::types::SseType { - match dafny_value { - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::SSEType::AES256 {} => aws_sdk_dynamodb::types::SseType::Aes256, -crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::SSEType::KMS {} => aws_sdk_dynamodb::types::SseType::Kms, - } -} diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/stream_specification.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/stream_specification.rs deleted file mode 100644 index add526e05..000000000 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/stream_specification.rs +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: &aws_sdk_dynamodb::types::StreamSpecification, -) -> ::std::rc::Rc{ - ::std::rc::Rc::new( - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::StreamSpecification::StreamSpecification { - StreamEnabled: value.stream_enabled.clone(), - StreamViewType: ::std::rc::Rc::new(match &value.stream_view_type { - Some(x) => crate::_Wrappers_Compile::Option::Some { value: crate::conversions::stream_view_type::to_dafny(x.clone()) }, - None => crate::_Wrappers_Compile::Option::None { } -}) -, - } - ) -} #[allow(dead_code)] -pub fn from_dafny( - dafny_value: ::std::rc::Rc< - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::StreamSpecification, - >, -) -> aws_sdk_dynamodb::types::StreamSpecification { - aws_sdk_dynamodb::types::StreamSpecification::builder() - .set_stream_enabled(Some( dafny_value.StreamEnabled() .clone() )) - .set_stream_view_type(match &**dafny_value.StreamViewType() { - crate::r#_Wrappers_Compile::Option::Some { value } => Some( - crate::conversions::stream_view_type::from_dafny(value) - ), - _ => None, -} -) - .build() - .unwrap() -} diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/stream_view_type.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/stream_view_type.rs deleted file mode 100644 index 718b38e76..000000000 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/stream_view_type.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] - -pub fn to_dafny( - value: aws_sdk_dynamodb::types::StreamViewType, -) -> ::std::rc::Rc{ - ::std::rc::Rc::new(match value { - aws_sdk_dynamodb::types::StreamViewType::NewImage => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::StreamViewType::NEW_IMAGE {}, -aws_sdk_dynamodb::types::StreamViewType::OldImage => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::StreamViewType::OLD_IMAGE {}, -aws_sdk_dynamodb::types::StreamViewType::NewAndOldImages => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::StreamViewType::NEW_AND_OLD_IMAGES {}, -aws_sdk_dynamodb::types::StreamViewType::KeysOnly => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::StreamViewType::KEYS_ONLY {}, - _ => panic!("Unknown enum variant: {}", value), - }) -} - #[allow(dead_code)] -pub fn from_dafny( - dafny_value: &crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::StreamViewType, -) -> aws_sdk_dynamodb::types::StreamViewType { - match dafny_value { - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::StreamViewType::NEW_IMAGE {} => aws_sdk_dynamodb::types::StreamViewType::NewImage, -crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::StreamViewType::OLD_IMAGE {} => aws_sdk_dynamodb::types::StreamViewType::OldImage, -crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::StreamViewType::NEW_AND_OLD_IMAGES {} => aws_sdk_dynamodb::types::StreamViewType::NewAndOldImages, -crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::StreamViewType::KEYS_ONLY {} => aws_sdk_dynamodb::types::StreamViewType::KeysOnly, - } -} diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/table_class.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/table_class.rs deleted file mode 100644 index f0a717fc9..000000000 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/table_class.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] - -pub fn to_dafny( - value: aws_sdk_dynamodb::types::TableClass, -) -> ::std::rc::Rc{ - ::std::rc::Rc::new(match value { - aws_sdk_dynamodb::types::TableClass::Standard => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::TableClass::STANDARD {}, -aws_sdk_dynamodb::types::TableClass::StandardInfrequentAccess => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::TableClass::STANDARD_INFREQUENT_ACCESS {}, - _ => panic!("Unknown enum variant: {}", value), - }) -} - #[allow(dead_code)] -pub fn from_dafny( - dafny_value: &crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::TableClass, -) -> aws_sdk_dynamodb::types::TableClass { - match dafny_value { - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::TableClass::STANDARD {} => aws_sdk_dynamodb::types::TableClass::Standard, -crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::TableClass::STANDARD_INFREQUENT_ACCESS {} => aws_sdk_dynamodb::types::TableClass::StandardInfrequentAccess, - } -} diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/table_class_summary.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/table_class_summary.rs deleted file mode 100644 index 4dc561906..000000000 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/table_class_summary.rs +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: &aws_sdk_dynamodb::types::TableClassSummary, -) -> ::std::rc::Rc{ - ::std::rc::Rc::new( - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::TableClassSummary::TableClassSummary { - TableClass: ::std::rc::Rc::new(match &value.table_class { - Some(x) => crate::_Wrappers_Compile::Option::Some { value: crate::conversions::table_class::to_dafny(x.clone()) }, - None => crate::_Wrappers_Compile::Option::None { } -}) -, - LastUpdateDateTime: crate::standard_library_conversions::otimestamp_to_dafny(&value.last_update_date_time), - } - ) -} #[allow(dead_code)] -pub fn from_dafny( - dafny_value: ::std::rc::Rc< - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::TableClassSummary, - >, -) -> aws_sdk_dynamodb::types::TableClassSummary { - aws_sdk_dynamodb::types::TableClassSummary::builder() - .set_table_class(match &**dafny_value.TableClass() { - crate::r#_Wrappers_Compile::Option::Some { value } => Some( - crate::conversions::table_class::from_dafny(value) - ), - _ => None, -} -) - .set_last_update_date_time(crate::standard_library_conversions::otimestamp_from_dafny(dafny_value.LastUpdateDateTime().clone())) - .build() - -} diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/table_description.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/table_description.rs deleted file mode 100644 index 2a99d390c..000000000 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/table_description.rs +++ /dev/null @@ -1,233 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: &aws_sdk_dynamodb::types::TableDescription, -) -> ::std::rc::Rc{ - ::std::rc::Rc::new( - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::TableDescription::TableDescription { - AttributeDefinitions: ::std::rc::Rc::new(match &value.attribute_definitions { - Some(x) => crate::r#_Wrappers_Compile::Option::Some { value : - ::dafny_runtime::dafny_runtime_conversions::vec_to_dafny_sequence(x, - |e| crate::conversions::attribute_definition::to_dafny(&e) -, - ) - }, - None => crate::r#_Wrappers_Compile::Option::None {} -}) -, - TableName: crate::standard_library_conversions::ostring_to_dafny(&value.table_name), - KeySchema: ::std::rc::Rc::new(match &value.key_schema { - Some(x) => crate::r#_Wrappers_Compile::Option::Some { value : - ::dafny_runtime::dafny_runtime_conversions::vec_to_dafny_sequence(x, - |e| crate::conversions::key_schema_element::to_dafny(&e) -, - ) - }, - None => crate::r#_Wrappers_Compile::Option::None {} -}) -, - TableStatus: ::std::rc::Rc::new(match &value.table_status { - Some(x) => crate::_Wrappers_Compile::Option::Some { value: crate::conversions::table_status::to_dafny(x.clone()) }, - None => crate::_Wrappers_Compile::Option::None { } -}) -, - CreationDateTime: crate::standard_library_conversions::otimestamp_to_dafny(&value.creation_date_time), - ProvisionedThroughput: ::std::rc::Rc::new(match &value.provisioned_throughput { - Some(x) => crate::_Wrappers_Compile::Option::Some { value: crate::conversions::provisioned_throughput_description::to_dafny(&x) }, - None => crate::_Wrappers_Compile::Option::None { } -}) -, - TableSizeBytes: crate::standard_library_conversions::olong_to_dafny(&value.table_size_bytes), - ItemCount: crate::standard_library_conversions::olong_to_dafny(&value.item_count), - TableArn: crate::standard_library_conversions::ostring_to_dafny(&value.table_arn), - TableId: crate::standard_library_conversions::ostring_to_dafny(&value.table_id), - BillingModeSummary: ::std::rc::Rc::new(match &value.billing_mode_summary { - Some(x) => crate::_Wrappers_Compile::Option::Some { value: crate::conversions::billing_mode_summary::to_dafny(&x) }, - None => crate::_Wrappers_Compile::Option::None { } -}) -, - LocalSecondaryIndexes: ::std::rc::Rc::new(match &value.local_secondary_indexes { - Some(x) => crate::r#_Wrappers_Compile::Option::Some { value : - ::dafny_runtime::dafny_runtime_conversions::vec_to_dafny_sequence(x, - |e| crate::conversions::local_secondary_index_description::to_dafny(&e) -, - ) - }, - None => crate::r#_Wrappers_Compile::Option::None {} -}) -, - GlobalSecondaryIndexes: ::std::rc::Rc::new(match &value.global_secondary_indexes { - Some(x) => crate::r#_Wrappers_Compile::Option::Some { value : - ::dafny_runtime::dafny_runtime_conversions::vec_to_dafny_sequence(x, - |e| crate::conversions::global_secondary_index_description::to_dafny(&e) -, - ) - }, - None => crate::r#_Wrappers_Compile::Option::None {} -}) -, - StreamSpecification: ::std::rc::Rc::new(match &value.stream_specification { - Some(x) => crate::_Wrappers_Compile::Option::Some { value: crate::conversions::stream_specification::to_dafny(&x) }, - None => crate::_Wrappers_Compile::Option::None { } -}) -, - LatestStreamLabel: crate::standard_library_conversions::ostring_to_dafny(&value.latest_stream_label), - LatestStreamArn: crate::standard_library_conversions::ostring_to_dafny(&value.latest_stream_arn), - GlobalTableVersion: crate::standard_library_conversions::ostring_to_dafny(&value.global_table_version), - Replicas: ::std::rc::Rc::new(match &value.replicas { - Some(x) => crate::r#_Wrappers_Compile::Option::Some { value : - ::dafny_runtime::dafny_runtime_conversions::vec_to_dafny_sequence(x, - |e| crate::conversions::replica_description::to_dafny(&e) -, - ) - }, - None => crate::r#_Wrappers_Compile::Option::None {} -}) -, - RestoreSummary: ::std::rc::Rc::new(match &value.restore_summary { - Some(x) => crate::_Wrappers_Compile::Option::Some { value: crate::conversions::restore_summary::to_dafny(&x) }, - None => crate::_Wrappers_Compile::Option::None { } -}) -, - SSEDescription: ::std::rc::Rc::new(match &value.sse_description { - Some(x) => crate::_Wrappers_Compile::Option::Some { value: crate::conversions::sse_description::to_dafny(&x) }, - None => crate::_Wrappers_Compile::Option::None { } -}) -, - ArchivalSummary: ::std::rc::Rc::new(match &value.archival_summary { - Some(x) => crate::_Wrappers_Compile::Option::Some { value: crate::conversions::archival_summary::to_dafny(&x) }, - None => crate::_Wrappers_Compile::Option::None { } -}) -, - TableClassSummary: ::std::rc::Rc::new(match &value.table_class_summary { - Some(x) => crate::_Wrappers_Compile::Option::Some { value: crate::conversions::table_class_summary::to_dafny(&x) }, - None => crate::_Wrappers_Compile::Option::None { } -}) -, - } - ) -} #[allow(dead_code)] -pub fn from_dafny( - dafny_value: ::std::rc::Rc< - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::TableDescription, - >, -) -> aws_sdk_dynamodb::types::TableDescription { - aws_sdk_dynamodb::types::TableDescription::builder() - .set_attribute_definitions(match (*dafny_value.AttributeDefinitions()).as_ref() { - crate::r#_Wrappers_Compile::Option::Some { value } => - Some( - ::dafny_runtime::dafny_runtime_conversions::dafny_sequence_to_vec(value, - |e| crate::conversions::attribute_definition::from_dafny(e.clone()) -, - ) - ), - _ => None -} -) - .set_table_name(crate::standard_library_conversions::ostring_from_dafny(dafny_value.TableName().clone())) - .set_key_schema(match (*dafny_value.KeySchema()).as_ref() { - crate::r#_Wrappers_Compile::Option::Some { value } => - Some( - ::dafny_runtime::dafny_runtime_conversions::dafny_sequence_to_vec(value, - |e| crate::conversions::key_schema_element::from_dafny(e.clone()) -, - ) - ), - _ => None -} -) - .set_table_status(match &**dafny_value.TableStatus() { - crate::r#_Wrappers_Compile::Option::Some { value } => Some( - crate::conversions::table_status::from_dafny(value) - ), - _ => None, -} -) - .set_creation_date_time(crate::standard_library_conversions::otimestamp_from_dafny(dafny_value.CreationDateTime().clone())) - .set_provisioned_throughput(match (*dafny_value.ProvisionedThroughput()).as_ref() { - crate::r#_Wrappers_Compile::Option::Some { value } => - Some(crate::conversions::provisioned_throughput_description::from_dafny(value.clone())), - _ => None, -} -) - .set_table_size_bytes(crate::standard_library_conversions::olong_from_dafny(dafny_value.TableSizeBytes().clone())) - .set_item_count(crate::standard_library_conversions::olong_from_dafny(dafny_value.ItemCount().clone())) - .set_table_arn(crate::standard_library_conversions::ostring_from_dafny(dafny_value.TableArn().clone())) - .set_table_id(crate::standard_library_conversions::ostring_from_dafny(dafny_value.TableId().clone())) - .set_billing_mode_summary(match (*dafny_value.BillingModeSummary()).as_ref() { - crate::r#_Wrappers_Compile::Option::Some { value } => - Some(crate::conversions::billing_mode_summary::from_dafny(value.clone())), - _ => None, -} -) - .set_local_secondary_indexes(match (*dafny_value.LocalSecondaryIndexes()).as_ref() { - crate::r#_Wrappers_Compile::Option::Some { value } => - Some( - ::dafny_runtime::dafny_runtime_conversions::dafny_sequence_to_vec(value, - |e| crate::conversions::local_secondary_index_description::from_dafny(e.clone()) -, - ) - ), - _ => None -} -) - .set_global_secondary_indexes(match (*dafny_value.GlobalSecondaryIndexes()).as_ref() { - crate::r#_Wrappers_Compile::Option::Some { value } => - Some( - ::dafny_runtime::dafny_runtime_conversions::dafny_sequence_to_vec(value, - |e| crate::conversions::global_secondary_index_description::from_dafny(e.clone()) -, - ) - ), - _ => None -} -) - .set_stream_specification(match (*dafny_value.StreamSpecification()).as_ref() { - crate::r#_Wrappers_Compile::Option::Some { value } => - Some(crate::conversions::stream_specification::from_dafny(value.clone())), - _ => None, -} -) - .set_latest_stream_label(crate::standard_library_conversions::ostring_from_dafny(dafny_value.LatestStreamLabel().clone())) - .set_latest_stream_arn(crate::standard_library_conversions::ostring_from_dafny(dafny_value.LatestStreamArn().clone())) - .set_global_table_version(crate::standard_library_conversions::ostring_from_dafny(dafny_value.GlobalTableVersion().clone())) - .set_replicas(match (*dafny_value.Replicas()).as_ref() { - crate::r#_Wrappers_Compile::Option::Some { value } => - Some( - ::dafny_runtime::dafny_runtime_conversions::dafny_sequence_to_vec(value, - |e| crate::conversions::replica_description::from_dafny(e.clone()) -, - ) - ), - _ => None -} -) - .set_restore_summary(match (*dafny_value.RestoreSummary()).as_ref() { - crate::r#_Wrappers_Compile::Option::Some { value } => - Some(crate::conversions::restore_summary::from_dafny(value.clone())), - _ => None, -} -) - .set_sse_description(match (*dafny_value.SSEDescription()).as_ref() { - crate::r#_Wrappers_Compile::Option::Some { value } => - Some(crate::conversions::sse_description::from_dafny(value.clone())), - _ => None, -} -) - .set_archival_summary(match (*dafny_value.ArchivalSummary()).as_ref() { - crate::r#_Wrappers_Compile::Option::Some { value } => - Some(crate::conversions::archival_summary::from_dafny(value.clone())), - _ => None, -} -) - .set_table_class_summary(match (*dafny_value.TableClassSummary()).as_ref() { - crate::r#_Wrappers_Compile::Option::Some { value } => - Some(crate::conversions::table_class_summary::from_dafny(value.clone())), - _ => None, -} -) - .build() - -} diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/table_status.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/table_status.rs deleted file mode 100644 index e996bc880..000000000 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/table_status.rs +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] - -pub fn to_dafny( - value: aws_sdk_dynamodb::types::TableStatus, -) -> ::std::rc::Rc{ - ::std::rc::Rc::new(match value { - aws_sdk_dynamodb::types::TableStatus::Creating => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::TableStatus::CREATING {}, -aws_sdk_dynamodb::types::TableStatus::Updating => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::TableStatus::UPDATING {}, -aws_sdk_dynamodb::types::TableStatus::Deleting => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::TableStatus::DELETING {}, -aws_sdk_dynamodb::types::TableStatus::Active => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::TableStatus::ACTIVE {}, -aws_sdk_dynamodb::types::TableStatus::InaccessibleEncryptionCredentials => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::TableStatus::INACCESSIBLE_ENCRYPTION_CREDENTIALS {}, -aws_sdk_dynamodb::types::TableStatus::Archiving => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::TableStatus::ARCHIVING {}, -aws_sdk_dynamodb::types::TableStatus::Archived => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::TableStatus::ARCHIVED {}, - _ => panic!("Unknown enum variant: {}", value), - }) -} - #[allow(dead_code)] -pub fn from_dafny( - dafny_value: &crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::TableStatus, -) -> aws_sdk_dynamodb::types::TableStatus { - match dafny_value { - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::TableStatus::CREATING {} => aws_sdk_dynamodb::types::TableStatus::Creating, -crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::TableStatus::UPDATING {} => aws_sdk_dynamodb::types::TableStatus::Updating, -crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::TableStatus::DELETING {} => aws_sdk_dynamodb::types::TableStatus::Deleting, -crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::TableStatus::ACTIVE {} => aws_sdk_dynamodb::types::TableStatus::Active, -crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::TableStatus::INACCESSIBLE_ENCRYPTION_CREDENTIALS {} => aws_sdk_dynamodb::types::TableStatus::InaccessibleEncryptionCredentials, -crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::TableStatus::ARCHIVING {} => aws_sdk_dynamodb::types::TableStatus::Archiving, -crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::TableStatus::ARCHIVED {} => aws_sdk_dynamodb::types::TableStatus::Archived, - } -} diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/tag.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/tag.rs deleted file mode 100644 index 0cbbd267a..000000000 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/tag.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: &aws_sdk_dynamodb::types::Tag, -) -> ::std::rc::Rc{ - ::std::rc::Rc::new( - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::Tag::Tag { - Key: dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&value.key), - Value: dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&value.value), - } - ) -} #[allow(dead_code)] -pub fn from_dafny( - dafny_value: ::std::rc::Rc< - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::Tag, - >, -) -> aws_sdk_dynamodb::types::Tag { - aws_sdk_dynamodb::types::Tag::builder() - .set_key(Some( dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(dafny_value.Key()) )) - .set_value(Some( dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(dafny_value.Value()) )) - .build() - .unwrap() -} diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/transact_get_item.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/transact_get_item.rs deleted file mode 100644 index 007a57c09..000000000 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/transact_get_item.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: &aws_sdk_dynamodb::types::TransactGetItem, -) -> ::std::rc::Rc{ - ::std::rc::Rc::new( - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::TransactGetItem::TransactGetItem { - Get: crate::conversions::get::to_dafny(&value.get.clone().unwrap()) -, - } - ) -} #[allow(dead_code)] -pub fn from_dafny( - dafny_value: ::std::rc::Rc< - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::TransactGetItem, - >, -) -> aws_sdk_dynamodb::types::TransactGetItem { - aws_sdk_dynamodb::types::TransactGetItem::builder() - .set_get(Some( crate::conversions::get::from_dafny(dafny_value.Get().clone()) - )) - .build() - -} diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/transact_get_items.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/transact_get_items.rs deleted file mode 100644 index e66edabeb..000000000 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/transact_get_items.rs +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -pub mod _transact_get_items_request; - - pub mod _transact_get_items_response; - #[allow(dead_code)] -pub fn to_dafny_error( - value: &::aws_smithy_runtime_api::client::result::SdkError< - aws_sdk_dynamodb::operation::transact_get_items::TransactGetItemsError, - ::aws_smithy_runtime_api::client::orchestrator::HttpResponse, - >, -) -> ::std::rc::Rc { - match value { - aws_sdk_dynamodb::error::SdkError::ServiceError(service_error) => match service_error.err() { - aws_sdk_dynamodb::operation::transact_get_items::TransactGetItemsError::InternalServerError(e) => - crate::conversions::error::internal_server_error::to_dafny(e.clone()), - aws_sdk_dynamodb::operation::transact_get_items::TransactGetItemsError::InvalidEndpointException(e) => - crate::conversions::error::invalid_endpoint_exception::to_dafny(e.clone()), - aws_sdk_dynamodb::operation::transact_get_items::TransactGetItemsError::ResourceNotFoundException(e) => - crate::conversions::error::resource_not_found_exception::to_dafny(e.clone()), - aws_sdk_dynamodb::operation::transact_get_items::TransactGetItemsError::TransactionCanceledException(e) => - crate::conversions::error::transaction_canceled_exception::to_dafny(e.clone()), - aws_sdk_dynamodb::operation::transact_get_items::TransactGetItemsError::RequestLimitExceeded(e) => - crate::conversions::error::request_limit_exceeded::to_dafny(e.clone()), - aws_sdk_dynamodb::operation::transact_get_items::TransactGetItemsError::ProvisionedThroughputExceededException(e) => - crate::conversions::error::provisioned_throughput_exceeded_exception::to_dafny(e.clone()), - e => crate::conversions::error::to_opaque_error(e.to_string()), - }, - _ => { - crate::conversions::error::to_opaque_error(value.to_string()) - } - } -} diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/transact_get_items/_transact_get_items_request.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/transact_get_items/_transact_get_items_request.rs deleted file mode 100644 index c5f54a394..000000000 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/transact_get_items/_transact_get_items_request.rs +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: &aws_sdk_dynamodb::operation::transact_get_items::TransactGetItemsInput, -) -> ::std::rc::Rc< - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::TransactGetItemsInput, ->{ - ::std::rc::Rc::new(crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::TransactGetItemsInput::TransactGetItemsInput { - TransactItems: ::dafny_runtime::dafny_runtime_conversions::vec_to_dafny_sequence(&value.transact_items.clone().unwrap(), - |e| crate::conversions::transact_get_item::to_dafny(&e) -, -) -, - ReturnConsumedCapacity: ::std::rc::Rc::new(match &value.return_consumed_capacity { - Some(x) => crate::_Wrappers_Compile::Option::Some { value: crate::conversions::return_consumed_capacity::to_dafny(x.clone()) }, - None => crate::_Wrappers_Compile::Option::None { } -}) -, - }) -} - #[allow(dead_code)] -pub fn from_dafny( - dafny_value: ::std::rc::Rc< - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::TransactGetItemsInput, - >, - client: aws_sdk_dynamodb::Client, -) -> aws_sdk_dynamodb::operation::transact_get_items::builders::TransactGetItemsFluentBuilder { - client.transact_get_items() - .set_transact_items(Some( ::dafny_runtime::dafny_runtime_conversions::dafny_sequence_to_vec(dafny_value.TransactItems(), - |e| crate::conversions::transact_get_item::from_dafny(e.clone()) -, -) - )) - .set_return_consumed_capacity(match &**dafny_value.ReturnConsumedCapacity() { - crate::r#_Wrappers_Compile::Option::Some { value } => Some( - crate::conversions::return_consumed_capacity::from_dafny(value) - ), - _ => None, -} -) -} diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/transact_get_items/_transact_get_items_response.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/transact_get_items/_transact_get_items_response.rs deleted file mode 100644 index 04eeb2699..000000000 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/transact_get_items/_transact_get_items_response.rs +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: &aws_sdk_dynamodb::operation::transact_get_items::TransactGetItemsOutput -) -> ::std::rc::Rc< - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::TransactGetItemsOutput, ->{ - ::std::rc::Rc::new(crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::TransactGetItemsOutput::TransactGetItemsOutput { - ConsumedCapacity: ::std::rc::Rc::new(match &value.consumed_capacity { - Some(x) => crate::r#_Wrappers_Compile::Option::Some { value : - ::dafny_runtime::dafny_runtime_conversions::vec_to_dafny_sequence(x, - |e| crate::conversions::consumed_capacity::to_dafny(&e) -, - ) - }, - None => crate::r#_Wrappers_Compile::Option::None {} -}) -, - Responses: ::std::rc::Rc::new(match &value.responses { - Some(x) => crate::r#_Wrappers_Compile::Option::Some { value : - ::dafny_runtime::dafny_runtime_conversions::vec_to_dafny_sequence(x, - |e| crate::conversions::item_response::to_dafny(&e) -, - ) - }, - None => crate::r#_Wrappers_Compile::Option::None {} -}) -, - }) -} - diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/transact_write_item.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/transact_write_item.rs deleted file mode 100644 index 732e79df3..000000000 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/transact_write_item.rs +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: &aws_sdk_dynamodb::types::TransactWriteItem, -) -> ::std::rc::Rc{ - ::std::rc::Rc::new( - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::TransactWriteItem::TransactWriteItem { - ConditionCheck: ::std::rc::Rc::new(match &value.condition_check { - Some(x) => crate::_Wrappers_Compile::Option::Some { value: crate::conversions::condition_check::to_dafny(&x) }, - None => crate::_Wrappers_Compile::Option::None { } -}) -, - Put: ::std::rc::Rc::new(match &value.put { - Some(x) => crate::_Wrappers_Compile::Option::Some { value: crate::conversions::put::to_dafny(&x) }, - None => crate::_Wrappers_Compile::Option::None { } -}) -, - Delete: ::std::rc::Rc::new(match &value.delete { - Some(x) => crate::_Wrappers_Compile::Option::Some { value: crate::conversions::delete::to_dafny(&x) }, - None => crate::_Wrappers_Compile::Option::None { } -}) -, - Update: ::std::rc::Rc::new(match &value.update { - Some(x) => crate::_Wrappers_Compile::Option::Some { value: crate::conversions::update::to_dafny(&x) }, - None => crate::_Wrappers_Compile::Option::None { } -}) -, - } - ) -} #[allow(dead_code)] -pub fn from_dafny( - dafny_value: ::std::rc::Rc< - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::TransactWriteItem, - >, -) -> aws_sdk_dynamodb::types::TransactWriteItem { - aws_sdk_dynamodb::types::TransactWriteItem::builder() - .set_condition_check(match (*dafny_value.ConditionCheck()).as_ref() { - crate::r#_Wrappers_Compile::Option::Some { value } => - Some(crate::conversions::condition_check::from_dafny(value.clone())), - _ => None, -} -) - .set_put(match (*dafny_value.Put()).as_ref() { - crate::r#_Wrappers_Compile::Option::Some { value } => - Some(crate::conversions::put::from_dafny(value.clone())), - _ => None, -} -) - .set_delete(match (*dafny_value.Delete()).as_ref() { - crate::r#_Wrappers_Compile::Option::Some { value } => - Some(crate::conversions::delete::from_dafny(value.clone())), - _ => None, -} -) - .set_update(match (*dafny_value.Update()).as_ref() { - crate::r#_Wrappers_Compile::Option::Some { value } => - Some(crate::conversions::update::from_dafny(value.clone())), - _ => None, -} -) - .build() - -} diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/transact_write_items.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/transact_write_items.rs deleted file mode 100644 index cbc0f6efd..000000000 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/transact_write_items.rs +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -pub mod _transact_write_items_request; - - pub mod _transact_write_items_response; - #[allow(dead_code)] -pub fn to_dafny_error( - value: &::aws_smithy_runtime_api::client::result::SdkError< - aws_sdk_dynamodb::operation::transact_write_items::TransactWriteItemsError, - ::aws_smithy_runtime_api::client::orchestrator::HttpResponse, - >, -) -> ::std::rc::Rc { - match value { - aws_sdk_dynamodb::error::SdkError::ServiceError(service_error) => match service_error.err() { - aws_sdk_dynamodb::operation::transact_write_items::TransactWriteItemsError::InternalServerError(e) => - crate::conversions::error::internal_server_error::to_dafny(e.clone()), - aws_sdk_dynamodb::operation::transact_write_items::TransactWriteItemsError::InvalidEndpointException(e) => - crate::conversions::error::invalid_endpoint_exception::to_dafny(e.clone()), - aws_sdk_dynamodb::operation::transact_write_items::TransactWriteItemsError::ResourceNotFoundException(e) => - crate::conversions::error::resource_not_found_exception::to_dafny(e.clone()), - aws_sdk_dynamodb::operation::transact_write_items::TransactWriteItemsError::IdempotentParameterMismatchException(e) => - crate::conversions::error::idempotent_parameter_mismatch_exception::to_dafny(e.clone()), - aws_sdk_dynamodb::operation::transact_write_items::TransactWriteItemsError::TransactionCanceledException(e) => - crate::conversions::error::transaction_canceled_exception::to_dafny(e.clone()), - aws_sdk_dynamodb::operation::transact_write_items::TransactWriteItemsError::RequestLimitExceeded(e) => - crate::conversions::error::request_limit_exceeded::to_dafny(e.clone()), - aws_sdk_dynamodb::operation::transact_write_items::TransactWriteItemsError::ProvisionedThroughputExceededException(e) => - crate::conversions::error::provisioned_throughput_exceeded_exception::to_dafny(e.clone()), - aws_sdk_dynamodb::operation::transact_write_items::TransactWriteItemsError::TransactionInProgressException(e) => - crate::conversions::error::transaction_in_progress_exception::to_dafny(e.clone()), - e => crate::conversions::error::to_opaque_error(e.to_string()), - }, - _ => { - crate::conversions::error::to_opaque_error(value.to_string()) - } - } -} diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/transact_write_items/_transact_write_items_request.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/transact_write_items/_transact_write_items_request.rs deleted file mode 100644 index 93a0bd3cf..000000000 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/transact_write_items/_transact_write_items_request.rs +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: &aws_sdk_dynamodb::operation::transact_write_items::TransactWriteItemsInput, -) -> ::std::rc::Rc< - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::TransactWriteItemsInput, ->{ - ::std::rc::Rc::new(crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::TransactWriteItemsInput::TransactWriteItemsInput { - TransactItems: ::dafny_runtime::dafny_runtime_conversions::vec_to_dafny_sequence(&value.transact_items.clone().unwrap(), - |e| crate::conversions::transact_write_item::to_dafny(&e) -, -) -, - ReturnConsumedCapacity: ::std::rc::Rc::new(match &value.return_consumed_capacity { - Some(x) => crate::_Wrappers_Compile::Option::Some { value: crate::conversions::return_consumed_capacity::to_dafny(x.clone()) }, - None => crate::_Wrappers_Compile::Option::None { } -}) -, - ReturnItemCollectionMetrics: ::std::rc::Rc::new(match &value.return_item_collection_metrics { - Some(x) => crate::_Wrappers_Compile::Option::Some { value: crate::conversions::return_item_collection_metrics::to_dafny(x.clone()) }, - None => crate::_Wrappers_Compile::Option::None { } -}) -, - ClientRequestToken: crate::standard_library_conversions::ostring_to_dafny(&value.client_request_token), - }) -} - #[allow(dead_code)] -pub fn from_dafny( - dafny_value: ::std::rc::Rc< - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::TransactWriteItemsInput, - >, - client: aws_sdk_dynamodb::Client, -) -> aws_sdk_dynamodb::operation::transact_write_items::builders::TransactWriteItemsFluentBuilder { - client.transact_write_items() - .set_transact_items(Some( ::dafny_runtime::dafny_runtime_conversions::dafny_sequence_to_vec(dafny_value.TransactItems(), - |e| crate::conversions::transact_write_item::from_dafny(e.clone()) -, -) - )) - .set_return_consumed_capacity(match &**dafny_value.ReturnConsumedCapacity() { - crate::r#_Wrappers_Compile::Option::Some { value } => Some( - crate::conversions::return_consumed_capacity::from_dafny(value) - ), - _ => None, -} -) - .set_return_item_collection_metrics(match &**dafny_value.ReturnItemCollectionMetrics() { - crate::r#_Wrappers_Compile::Option::Some { value } => Some( - crate::conversions::return_item_collection_metrics::from_dafny(value) - ), - _ => None, -} -) - .set_client_request_token(crate::standard_library_conversions::ostring_from_dafny(dafny_value.ClientRequestToken().clone())) -} diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/transact_write_items/_transact_write_items_response.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/transact_write_items/_transact_write_items_response.rs deleted file mode 100644 index c7c245a01..000000000 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/transact_write_items/_transact_write_items_response.rs +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: &aws_sdk_dynamodb::operation::transact_write_items::TransactWriteItemsOutput -) -> ::std::rc::Rc< - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::TransactWriteItemsOutput, ->{ - ::std::rc::Rc::new(crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::TransactWriteItemsOutput::TransactWriteItemsOutput { - ConsumedCapacity: ::std::rc::Rc::new(match &value.consumed_capacity { - Some(x) => crate::r#_Wrappers_Compile::Option::Some { value : - ::dafny_runtime::dafny_runtime_conversions::vec_to_dafny_sequence(x, - |e| crate::conversions::consumed_capacity::to_dafny(&e) -, - ) - }, - None => crate::r#_Wrappers_Compile::Option::None {} -}) -, - ItemCollectionMetrics: -::std::rc::Rc::new(match &value.item_collection_metrics { - Some(x) => crate::r#_Wrappers_Compile::Option::Some { value : - ::dafny_runtime::dafny_runtime_conversions::hashmap_to_dafny_map(x, - |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&k), - |v| ::dafny_runtime::dafny_runtime_conversions::vec_to_dafny_sequence(&v, - |e| crate::conversions::item_collection_metrics::to_dafny(&e) -, -) -, - ) - }, - None => crate::r#_Wrappers_Compile::Option::None {} -}) -, - }) -} - diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/update.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/update.rs deleted file mode 100644 index 2c0bc9b1d..000000000 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/update.rs +++ /dev/null @@ -1,97 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: &aws_sdk_dynamodb::types::Update, -) -> ::std::rc::Rc{ - ::std::rc::Rc::new( - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::Update::Update { - Key: ::dafny_runtime::dafny_runtime_conversions::hashmap_to_dafny_map(&value.key.clone(), - |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&k), - |v| crate::conversions::attribute_value::to_dafny(&v) -, -) -, - UpdateExpression: dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&value.update_expression), - TableName: dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&value.table_name), - ConditionExpression: crate::standard_library_conversions::ostring_to_dafny(&value.condition_expression), - ExpressionAttributeNames: -::std::rc::Rc::new(match &value.expression_attribute_names { - Some(x) => crate::r#_Wrappers_Compile::Option::Some { value : - ::dafny_runtime::dafny_runtime_conversions::hashmap_to_dafny_map(x, - |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&k), - |v| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&v), - ) - }, - None => crate::r#_Wrappers_Compile::Option::None {} -}) -, - ExpressionAttributeValues: -::std::rc::Rc::new(match &value.expression_attribute_values { - Some(x) => crate::r#_Wrappers_Compile::Option::Some { value : - ::dafny_runtime::dafny_runtime_conversions::hashmap_to_dafny_map(x, - |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&k), - |v| crate::conversions::attribute_value::to_dafny(&v) -, - ) - }, - None => crate::r#_Wrappers_Compile::Option::None {} -}) -, - ReturnValuesOnConditionCheckFailure: ::std::rc::Rc::new(match &value.return_values_on_condition_check_failure { - Some(x) => crate::_Wrappers_Compile::Option::Some { value: crate::conversions::return_values_on_condition_check_failure::to_dafny(x.clone()) }, - None => crate::_Wrappers_Compile::Option::None { } -}) -, - } - ) -} #[allow(dead_code)] -pub fn from_dafny( - dafny_value: ::std::rc::Rc< - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::Update, - >, -) -> aws_sdk_dynamodb::types::Update { - aws_sdk_dynamodb::types::Update::builder() - .set_key(Some( ::dafny_runtime::dafny_runtime_conversions::dafny_map_to_hashmap(&dafny_value.Key(), - |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(k), - |v| crate::conversions::attribute_value::from_dafny(v.clone()) -, -) - )) - .set_update_expression(Some( dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(dafny_value.UpdateExpression()) )) - .set_table_name(Some( dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(dafny_value.TableName()) )) - .set_condition_expression(crate::standard_library_conversions::ostring_from_dafny(dafny_value.ConditionExpression().clone())) - .set_expression_attribute_names(match (*dafny_value.ExpressionAttributeNames()).as_ref() { - crate::r#_Wrappers_Compile::Option::Some { value } => - Some( - ::dafny_runtime::dafny_runtime_conversions::dafny_map_to_hashmap(value, - |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(k), - |v| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(v), - ) - ), - _ => None -} -) - .set_expression_attribute_values(match (*dafny_value.ExpressionAttributeValues()).as_ref() { - crate::r#_Wrappers_Compile::Option::Some { value } => - Some( - ::dafny_runtime::dafny_runtime_conversions::dafny_map_to_hashmap(value, - |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(k), - |v| crate::conversions::attribute_value::from_dafny(v.clone()) -, - ) - ), - _ => None -} -) - .set_return_values_on_condition_check_failure(match &**dafny_value.ReturnValuesOnConditionCheckFailure() { - crate::r#_Wrappers_Compile::Option::Some { value } => Some( - crate::conversions::return_values_on_condition_check_failure::from_dafny(value) - ), - _ => None, -} -) - .build() - .unwrap() -} diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/update_item.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/update_item.rs deleted file mode 100644 index 7258df4a3..000000000 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/update_item.rs +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -pub mod _update_item_request; - - pub mod _update_item_response; - #[allow(dead_code)] -pub fn to_dafny_error( - value: &::aws_smithy_runtime_api::client::result::SdkError< - aws_sdk_dynamodb::operation::update_item::UpdateItemError, - ::aws_smithy_runtime_api::client::orchestrator::HttpResponse, - >, -) -> ::std::rc::Rc { - match value { - aws_sdk_dynamodb::error::SdkError::ServiceError(service_error) => match service_error.err() { - aws_sdk_dynamodb::operation::update_item::UpdateItemError::InternalServerError(e) => - crate::conversions::error::internal_server_error::to_dafny(e.clone()), - aws_sdk_dynamodb::operation::update_item::UpdateItemError::InvalidEndpointException(e) => - crate::conversions::error::invalid_endpoint_exception::to_dafny(e.clone()), - aws_sdk_dynamodb::operation::update_item::UpdateItemError::ResourceNotFoundException(e) => - crate::conversions::error::resource_not_found_exception::to_dafny(e.clone()), - aws_sdk_dynamodb::operation::update_item::UpdateItemError::RequestLimitExceeded(e) => - crate::conversions::error::request_limit_exceeded::to_dafny(e.clone()), - aws_sdk_dynamodb::operation::update_item::UpdateItemError::TransactionConflictException(e) => - crate::conversions::error::transaction_conflict_exception::to_dafny(e.clone()), - aws_sdk_dynamodb::operation::update_item::UpdateItemError::ConditionalCheckFailedException(e) => - crate::conversions::error::conditional_check_failed_exception::to_dafny(e.clone()), - aws_sdk_dynamodb::operation::update_item::UpdateItemError::ItemCollectionSizeLimitExceededException(e) => - crate::conversions::error::item_collection_size_limit_exceeded_exception::to_dafny(e.clone()), - aws_sdk_dynamodb::operation::update_item::UpdateItemError::ProvisionedThroughputExceededException(e) => - crate::conversions::error::provisioned_throughput_exceeded_exception::to_dafny(e.clone()), - e => crate::conversions::error::to_opaque_error(e.to_string()), - }, - _ => { - crate::conversions::error::to_opaque_error(value.to_string()) - } - } -} diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/update_item/_update_item_request.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/update_item/_update_item_request.rs deleted file mode 100644 index d565fa848..000000000 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/update_item/_update_item_request.rs +++ /dev/null @@ -1,181 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: &aws_sdk_dynamodb::operation::update_item::UpdateItemInput, -) -> ::std::rc::Rc< - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::UpdateItemInput, ->{ - ::std::rc::Rc::new(crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::UpdateItemInput::UpdateItemInput { - TableName: crate::standard_library_conversions::ostring_to_dafny(&value.table_name) .Extract(), - Key: ::dafny_runtime::dafny_runtime_conversions::hashmap_to_dafny_map(&value.key.clone().unwrap(), - |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&k), - |v| crate::conversions::attribute_value::to_dafny(&v) -, -) -, - AttributeUpdates: -::std::rc::Rc::new(match &value.attribute_updates { - Some(x) => crate::r#_Wrappers_Compile::Option::Some { value : - ::dafny_runtime::dafny_runtime_conversions::hashmap_to_dafny_map(x, - |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&k), - |v| crate::conversions::attribute_value_update::to_dafny(&v) -, - ) - }, - None => crate::r#_Wrappers_Compile::Option::None {} -}) -, - Expected: -::std::rc::Rc::new(match &value.expected { - Some(x) => crate::r#_Wrappers_Compile::Option::Some { value : - ::dafny_runtime::dafny_runtime_conversions::hashmap_to_dafny_map(x, - |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&k), - |v| crate::conversions::expected_attribute_value::to_dafny(&v) -, - ) - }, - None => crate::r#_Wrappers_Compile::Option::None {} -}) -, - ConditionalOperator: ::std::rc::Rc::new(match &value.conditional_operator { - Some(x) => crate::_Wrappers_Compile::Option::Some { value: crate::conversions::conditional_operator::to_dafny(x.clone()) }, - None => crate::_Wrappers_Compile::Option::None { } -}) -, - ReturnValues: ::std::rc::Rc::new(match &value.return_values { - Some(x) => crate::_Wrappers_Compile::Option::Some { value: crate::conversions::return_value::to_dafny(x.clone()) }, - None => crate::_Wrappers_Compile::Option::None { } -}) -, - ReturnConsumedCapacity: ::std::rc::Rc::new(match &value.return_consumed_capacity { - Some(x) => crate::_Wrappers_Compile::Option::Some { value: crate::conversions::return_consumed_capacity::to_dafny(x.clone()) }, - None => crate::_Wrappers_Compile::Option::None { } -}) -, - ReturnItemCollectionMetrics: ::std::rc::Rc::new(match &value.return_item_collection_metrics { - Some(x) => crate::_Wrappers_Compile::Option::Some { value: crate::conversions::return_item_collection_metrics::to_dafny(x.clone()) }, - None => crate::_Wrappers_Compile::Option::None { } -}) -, - UpdateExpression: crate::standard_library_conversions::ostring_to_dafny(&value.update_expression), - ConditionExpression: crate::standard_library_conversions::ostring_to_dafny(&value.condition_expression), - ExpressionAttributeNames: -::std::rc::Rc::new(match &value.expression_attribute_names { - Some(x) => crate::r#_Wrappers_Compile::Option::Some { value : - ::dafny_runtime::dafny_runtime_conversions::hashmap_to_dafny_map(x, - |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&k), - |v| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&v), - ) - }, - None => crate::r#_Wrappers_Compile::Option::None {} -}) -, - ExpressionAttributeValues: -::std::rc::Rc::new(match &value.expression_attribute_values { - Some(x) => crate::r#_Wrappers_Compile::Option::Some { value : - ::dafny_runtime::dafny_runtime_conversions::hashmap_to_dafny_map(x, - |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&k), - |v| crate::conversions::attribute_value::to_dafny(&v) -, - ) - }, - None => crate::r#_Wrappers_Compile::Option::None {} -}) -, - }) -} - #[allow(dead_code)] -pub fn from_dafny( - dafny_value: ::std::rc::Rc< - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::UpdateItemInput, - >, - client: aws_sdk_dynamodb::Client, -) -> aws_sdk_dynamodb::operation::update_item::builders::UpdateItemFluentBuilder { - client.update_item() - .set_table_name(Some( dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(dafny_value.TableName()) )) - .set_key(Some( ::dafny_runtime::dafny_runtime_conversions::dafny_map_to_hashmap(&dafny_value.Key(), - |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(k), - |v| crate::conversions::attribute_value::from_dafny(v.clone()) -, -) - )) - .set_attribute_updates(match (*dafny_value.AttributeUpdates()).as_ref() { - crate::r#_Wrappers_Compile::Option::Some { value } => - Some( - ::dafny_runtime::dafny_runtime_conversions::dafny_map_to_hashmap(value, - |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(k), - |v| crate::conversions::attribute_value_update::from_dafny(v.clone()) -, - ) - ), - _ => None -} -) - .set_expected(match (*dafny_value.Expected()).as_ref() { - crate::r#_Wrappers_Compile::Option::Some { value } => - Some( - ::dafny_runtime::dafny_runtime_conversions::dafny_map_to_hashmap(value, - |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(k), - |v| crate::conversions::expected_attribute_value::from_dafny(v.clone()) -, - ) - ), - _ => None -} -) - .set_conditional_operator(match &**dafny_value.ConditionalOperator() { - crate::r#_Wrappers_Compile::Option::Some { value } => Some( - crate::conversions::conditional_operator::from_dafny(value) - ), - _ => None, -} -) - .set_return_values(match &**dafny_value.ReturnValues() { - crate::r#_Wrappers_Compile::Option::Some { value } => Some( - crate::conversions::return_value::from_dafny(value) - ), - _ => None, -} -) - .set_return_consumed_capacity(match &**dafny_value.ReturnConsumedCapacity() { - crate::r#_Wrappers_Compile::Option::Some { value } => Some( - crate::conversions::return_consumed_capacity::from_dafny(value) - ), - _ => None, -} -) - .set_return_item_collection_metrics(match &**dafny_value.ReturnItemCollectionMetrics() { - crate::r#_Wrappers_Compile::Option::Some { value } => Some( - crate::conversions::return_item_collection_metrics::from_dafny(value) - ), - _ => None, -} -) - .set_update_expression(crate::standard_library_conversions::ostring_from_dafny(dafny_value.UpdateExpression().clone())) - .set_condition_expression(crate::standard_library_conversions::ostring_from_dafny(dafny_value.ConditionExpression().clone())) - .set_expression_attribute_names(match (*dafny_value.ExpressionAttributeNames()).as_ref() { - crate::r#_Wrappers_Compile::Option::Some { value } => - Some( - ::dafny_runtime::dafny_runtime_conversions::dafny_map_to_hashmap(value, - |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(k), - |v| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(v), - ) - ), - _ => None -} -) - .set_expression_attribute_values(match (*dafny_value.ExpressionAttributeValues()).as_ref() { - crate::r#_Wrappers_Compile::Option::Some { value } => - Some( - ::dafny_runtime::dafny_runtime_conversions::dafny_map_to_hashmap(value, - |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(k), - |v| crate::conversions::attribute_value::from_dafny(v.clone()) -, - ) - ), - _ => None -} -) -} diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/update_item/_update_item_response.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/update_item/_update_item_response.rs deleted file mode 100644 index 7edf31aba..000000000 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/update_item/_update_item_response.rs +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: &aws_sdk_dynamodb::operation::update_item::UpdateItemOutput -) -> ::std::rc::Rc< - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::UpdateItemOutput, ->{ - ::std::rc::Rc::new(crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::UpdateItemOutput::UpdateItemOutput { - Attributes: -::std::rc::Rc::new(match &value.attributes { - Some(x) => crate::r#_Wrappers_Compile::Option::Some { value : - ::dafny_runtime::dafny_runtime_conversions::hashmap_to_dafny_map(x, - |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&k), - |v| crate::conversions::attribute_value::to_dafny(&v) -, - ) - }, - None => crate::r#_Wrappers_Compile::Option::None {} -}) -, - ConsumedCapacity: ::std::rc::Rc::new(match &value.consumed_capacity { - Some(x) => crate::_Wrappers_Compile::Option::Some { value: crate::conversions::consumed_capacity::to_dafny(&x) }, - None => crate::_Wrappers_Compile::Option::None { } -}) -, - ItemCollectionMetrics: ::std::rc::Rc::new(match &value.item_collection_metrics { - Some(x) => crate::_Wrappers_Compile::Option::Some { value: crate::conversions::item_collection_metrics::to_dafny(&x) }, - None => crate::_Wrappers_Compile::Option::None { } -}) -, - }) -} - diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/write_request.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/write_request.rs deleted file mode 100644 index b42b9c88d..000000000 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/write_request.rs +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: &aws_sdk_dynamodb::types::WriteRequest, -) -> ::std::rc::Rc{ - ::std::rc::Rc::new( - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::WriteRequest::WriteRequest { - PutRequest: ::std::rc::Rc::new(match &value.put_request { - Some(x) => crate::_Wrappers_Compile::Option::Some { value: crate::conversions::put_request::to_dafny(&x) }, - None => crate::_Wrappers_Compile::Option::None { } -}) -, - DeleteRequest: ::std::rc::Rc::new(match &value.delete_request { - Some(x) => crate::_Wrappers_Compile::Option::Some { value: crate::conversions::delete_request::to_dafny(&x) }, - None => crate::_Wrappers_Compile::Option::None { } -}) -, - } - ) -} #[allow(dead_code)] -pub fn from_dafny( - dafny_value: ::std::rc::Rc< - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::WriteRequest, - >, -) -> aws_sdk_dynamodb::types::WriteRequest { - aws_sdk_dynamodb::types::WriteRequest::builder() - .set_put_request(match (*dafny_value.PutRequest()).as_ref() { - crate::r#_Wrappers_Compile::Option::Some { value } => - Some(crate::conversions::put_request::from_dafny(value.clone())), - _ => None, -} -) - .set_delete_request(match (*dafny_value.DeleteRequest()).as_ref() { - crate::r#_Wrappers_Compile::Option::Some { value } => - Some(crate::conversions::delete_request::from_dafny(value.clone())), - _ => None, -} -) - .build() - -} diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/standard_library_conversions.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/standard_library_conversions.rs deleted file mode 100644 index 6bf8297d8..000000000 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/standard_library_conversions.rs +++ /dev/null @@ -1,266 +0,0 @@ -pub fn ostring_to_dafny( - input: &Option, -) -> ::std::rc::Rc< - crate::_Wrappers_Compile::Option<::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>>, -> { - let dafny_value = match input { - Some(b) => crate::_Wrappers_Compile::Option::Some { value: - dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&b) - }, - None => crate::_Wrappers_Compile::Option::None {}, -}; - ::std::rc::Rc::new(dafny_value) -} - -pub fn ostring_from_dafny( - input: ::std::rc::Rc< - crate::_Wrappers_Compile::Option< - ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, - >, - >, -) -> Option { - if matches!( - input.as_ref(), - crate::_Wrappers_Compile::Option::Some { .. } - ) { - Some( - dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string( - &input.Extract(), - ), - ) - } else { - None - } -} - -pub fn obool_to_dafny( - input: &Option, -) -> ::std::rc::Rc> { - let dafny_value = match input { - Some(b) => crate::_Wrappers_Compile::Option::Some { value: *b }, - None => crate::_Wrappers_Compile::Option::None {}, - }; - ::std::rc::Rc::new(dafny_value) -} - -pub fn obool_from_dafny( - input: ::std::rc::Rc>, -) -> Option { - if matches!( - input.as_ref(), - crate::_Wrappers_Compile::Option::Some { .. } - ) { - Some(input.Extract()) - } else { - None - } -} - -pub fn oint_to_dafny(input: Option) -> ::std::rc::Rc> { - let dafny_value = match input { - Some(b) => crate::_Wrappers_Compile::Option::Some { value: b }, - None => crate::_Wrappers_Compile::Option::None {}, - }; - ::std::rc::Rc::new(dafny_value) -} - -pub fn oint_from_dafny(input: ::std::rc::Rc>) -> Option { - if matches!( - input.as_ref(), - crate::_Wrappers_Compile::Option::Some { .. } - ) { - Some(input.Extract()) - } else { - None - } -} - -pub fn olong_to_dafny(input: &Option) -> ::std::rc::Rc> { - let dafny_value = match input { - Some(b) => crate::_Wrappers_Compile::Option::Some { value: *b }, - None => crate::_Wrappers_Compile::Option::None {}, - }; - ::std::rc::Rc::new(dafny_value) -} - -pub fn olong_from_dafny( - input: ::std::rc::Rc>, -) -> Option { - if matches!( - input.as_ref(), - crate::_Wrappers_Compile::Option::Some { .. } - ) { - Some(input.Extract()) - } else { - None - } -} - -pub fn blob_to_dafny(input: &::aws_smithy_types::Blob) -> ::dafny_runtime::Sequence { - ::dafny_runtime::dafny_runtime_conversions::vec_to_dafny_sequence(&input.clone().into_inner(), |x| *x) -} - -pub fn oblob_to_dafny( - input: &Option<::aws_smithy_types::Blob>, -) -> ::std::rc::Rc>> { - let dafny_value = match input { - Some(b) => crate::_Wrappers_Compile::Option::Some { - value: blob_to_dafny(&b), - }, - None => crate::_Wrappers_Compile::Option::None {}, - }; - ::std::rc::Rc::new(dafny_value) -} - -pub fn blob_from_dafny(input: ::dafny_runtime::Sequence) -> ::aws_smithy_types::Blob { - ::aws_smithy_types::Blob::new( - ::std::rc::Rc::try_unwrap(input.to_array()).unwrap_or_else(|rc| (*rc).clone()), - ) -} - -pub fn oblob_from_dafny( - input: ::std::rc::Rc>>, -) -> Option<::aws_smithy_types::Blob> { - if matches!( - input.as_ref(), - crate::_Wrappers_Compile::Option::Some { .. } - ) { - Some(blob_from_dafny(input.Extract())) - } else { - None - } -} - -pub fn double_to_dafny(input: f64) -> ::dafny_runtime::Sequence { - ::dafny_runtime::dafny_runtime_conversions::vec_to_dafny_sequence( - &f64::to_be_bytes(input).to_vec(), - |x| *x, - ) -} - -pub fn odouble_to_dafny( - input: &Option, -) -> ::std::rc::Rc>> { - let dafny_value = match input { - Some(f) => crate::_Wrappers_Compile::Option::Some { - value: double_to_dafny(*f), - }, - None => crate::_Wrappers_Compile::Option::None {}, - }; - ::std::rc::Rc::new(dafny_value) -} - -pub fn double_from_dafny(input: &::dafny_runtime::Sequence) -> f64 { - let v = ::dafny_runtime::dafny_runtime_conversions::dafny_sequence_to_vec(input, |x| *x); - f64::from_be_bytes(v.try_into().expect("Error converting Sequence to f64")) -} - -pub fn odouble_from_dafny( - input: ::std::rc::Rc>>, -) -> Option { - if matches!( - input.as_ref(), - crate::_Wrappers_Compile::Option::Some { .. } - ) { - Some(double_from_dafny(&input.Extract())) - } else { - None - } -} - -pub fn timestamp_to_dafny( - input: &::aws_smithy_types::DateTime, -) -> ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16> { - ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string( - &input.to_string(), - ) -} - -pub fn otimestamp_to_dafny( - input: &Option<::aws_smithy_types::DateTime>, -) -> ::std::rc::Rc< - crate::_Wrappers_Compile::Option<::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>>, -> { - let dafny_value = match input { - Some(f) => crate::_Wrappers_Compile::Option::Some { - value: timestamp_to_dafny(f), - }, - None => crate::_Wrappers_Compile::Option::None {}, - }; - ::std::rc::Rc::new(dafny_value) -} - -pub fn timestamp_from_dafny( - input: ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, -) -> ::aws_smithy_types::DateTime { - let s = dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string( - &input, - ); - ::aws_smithy_types::DateTime::from_str(&s, aws_smithy_types::date_time::Format::DateTime) - .unwrap() -} - -pub fn otimestamp_from_dafny( - input: ::std::rc::Rc< - crate::_Wrappers_Compile::Option< - ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, - >, - >, -) -> Option<::aws_smithy_types::DateTime> { - if matches!( - input.as_ref(), - crate::_Wrappers_Compile::Option::Some { .. } - ) { - Some(timestamp_from_dafny(input.Extract())) - } else { - None - } -} - -pub fn option_from_dafny( - input: ::std::rc::Rc>, - converter: fn(&T) -> TR, -) -> Option { - match &*input { - crate::_Wrappers_Compile::Option::Some { value } => Some(converter(value)), - crate::_Wrappers_Compile::Option::None {} => None, - } -} - -pub fn option_to_dafny( - input: &Option, - converter: fn(&TR) -> T, -) -> ::std::rc::Rc> { - match input { - Some(value) => ::std::rc::Rc::new(crate::_Wrappers_Compile::Option::Some { - value: converter(&value), - }), - None => ::std::rc::Rc::new(crate::_Wrappers_Compile::Option::None {}), - } -} - -pub fn result_from_dafny( - input: ::std::rc::Rc>, - converter_t: fn(&T) -> TR, - converter_e: fn(&E) -> ER, -) -> Result { - match &*input { - crate::_Wrappers_Compile::Result::Success { value } => Ok(converter_t(value)), - crate::_Wrappers_Compile::Result::Failure { error } => Err(converter_e(error)), - } -} - -pub fn result_to_dafny( - input: &Result, - converter_t: fn(&TR) -> T, - converter_e: fn(&ER) -> E, -) -> ::std::rc::Rc> { - match input { - Ok(value) => ::std::rc::Rc::new(crate::_Wrappers_Compile::Result::Success { - value: converter_t(&value), - }), - Err(error) => ::std::rc::Rc::new(crate::_Wrappers_Compile::Result::Failure { - error: converter_e(&error), - }), - } -} diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/standard_library_externs.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/standard_library_externs.rs deleted file mode 100644 index eca6a2980..000000000 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/standard_library_externs.rs +++ /dev/null @@ -1,80 +0,0 @@ -// Annotation to ignore the case of this module -use crate::r#_Wrappers_Compile; -use crate::UTF8; - -impl crate::UTF8::_default { - pub fn Encode( - s: &::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, - ) -> ::std::rc::Rc< - r#_Wrappers_Compile::Result< - UTF8::ValidUTF8Bytes, - ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, - >, - > { - let v = s.to_array(); - let mut _accumulator: Vec = vec![]; - // Use of .encode_utf8 method. - let mut surrogate: Option = None; - for c in v.iter() { - let s = if let Some(s) = surrogate { - String::from_utf16(&[s, c.0]) - } else { - String::from_utf16(&[c.0]) - }; - surrogate = None; - match s { - Ok(value) => { - _accumulator.extend(value.as_bytes()); - continue; - } - Err(e) => { - if 0xD800 <= c.0 && c.0 <= 0xDFFF { - surrogate = Some(c.0); - continue; - } - return ::std::rc::Rc::new(r#_Wrappers_Compile::Result::>::Failure { - error: ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string( - &e.to_string()) - }); - } - } - } - if let Some(s) = surrogate { - return ::std::rc::Rc::new(r#_Wrappers_Compile::Result::>::Failure { - error: ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string( - &format!("Surrogate pair missing: 0x{:04x}", s)) - }); - } - ::std::rc::Rc::new(r#_Wrappers_Compile::Result::< - UTF8::ValidUTF8Bytes, - ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, - >::Success { - value: ::dafny_runtime::Sequence::from_array_owned(_accumulator), - }) - } - pub fn Decode( - b: &::dafny_runtime::Sequence, - ) -> ::std::rc::Rc< - r#_Wrappers_Compile::Result< - ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, - ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, - >, - > { - let b = String::from_utf8(b.to_array().as_ref().clone()); - match b { - Ok(s) => { - ::std::rc::Rc::new(r#_Wrappers_Compile::Result::<::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, - ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>>::Success { - value: ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&s) - }) - }, - Err(e) => { - return ::std::rc::Rc::new(r#_Wrappers_Compile::Result::<::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, - ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>>::Failure { - error: ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string( - &e.to_string()) - }) - } - } - } -} diff --git a/TestModels/aws-sdks/ddb/Makefile b/TestModels/aws-sdks/ddb/Makefile index 2cc808994..2dd3f238f 100644 --- a/TestModels/aws-sdks/ddb/Makefile +++ b/TestModels/aws-sdks/ddb/Makefile @@ -15,6 +15,8 @@ include ../../SharedMakefile.mk PROJECT_SERVICES := \ ComAmazonawsDynamodb \ +MAIN_SERVICE_FOR_RUST := ComAmazonawsDynamodb + SERVICE_NAMESPACE_ComAmazonawsDynamodb=com.amazonaws.dynamodb SERVICE_DEPS_ComAmazonawsDynamodb := diff --git a/TestModels/aws-sdks/kms-lite/Makefile b/TestModels/aws-sdks/kms-lite/Makefile index 7d3f50de3..7a349d136 100644 --- a/TestModels/aws-sdks/kms-lite/Makefile +++ b/TestModels/aws-sdks/kms-lite/Makefile @@ -12,6 +12,8 @@ NAMESPACE=com.amazonaws.kms PROJECT_SERVICES := \ ComAmazonawsKms +MAIN_SERVICE_FOR_RUST := ComAmazonawsKms + SERVICE_NAMESPACE_ComAmazonawsKms=com.amazonaws.kms SERVICE_DEPS_ComAmazonawsKms := diff --git a/TestModels/aws-sdks/kms-lite/runtimes/rust/src/client.rs b/TestModels/aws-sdks/kms-lite/runtimes/rust/src/client.rs index f17b4a4f1..4882d4d1e 100644 --- a/TestModels/aws-sdks/kms-lite/runtimes/rust/src/client.rs +++ b/TestModels/aws-sdks/kms-lite/runtimes/rust/src/client.rs @@ -4,10 +4,23 @@ use std::sync::LazyLock; use crate::conversions; +#[derive(::std::clone::Clone, ::std::fmt::Debug)] pub struct Client { pub inner: aws_sdk_kms::Client } +impl ::std::cmp::PartialEq for Client { + fn eq(&self, other: &Self) -> bool { + false + } +} + +impl ::std::convert::Into for aws_sdk_kms::Client { + fn into(self) -> Client { + Client { inner: self } + } +} + /// A runtime for executing operations on the asynchronous client in a blocking manner. /// Necessary because Dafny only generates synchronous code. static dafny_tokio_runtime: LazyLock = LazyLock::new(|| { @@ -33,11 +46,24 @@ impl crate::r#software::amazon::cryptography::services::kms::internaldafny::type std::rc::Rc > > { - let native_result = - dafny_tokio_runtime.block_on(conversions::decrypt::_decrypt_request::from_dafny(input.clone(), self.inner.clone()).send()); + let inner_input = crate::conversions::decrypt::_decrypt_request::from_dafny(input.clone()); + let native_result = tokio::task::block_in_place(|| { + dafny_tokio_runtime.block_on(async { + self.inner.decrypt() + .set_ciphertext_blob(inner_input.ciphertext_blob) +.set_encryption_context(inner_input.encryption_context) +.set_grant_tokens(inner_input.grant_tokens) +.set_key_id(inner_input.key_id) +.set_encryption_algorithm(inner_input.encryption_algorithm) +.set_recipient(inner_input.recipient) +.set_dry_run(inner_input.dry_run) + .send() + .await + }) + }); crate::standard_library_conversions::result_to_dafny(&native_result, - conversions::decrypt::_decrypt_response::to_dafny, - conversions::decrypt::to_dafny_error) + crate::conversions::decrypt::_decrypt_response::to_dafny, + crate::conversions::decrypt::to_dafny_error) } fn DeriveSharedSecret(&mut self, input: &std::rc::Rc) -> std::rc::Rc > > { - let native_result = - dafny_tokio_runtime.block_on(conversions::derive_shared_secret::_derive_shared_secret_request::from_dafny(input.clone(), self.inner.clone()).send()); + let inner_input = crate::conversions::derive_shared_secret::_derive_shared_secret_request::from_dafny(input.clone()); + let native_result = tokio::task::block_in_place(|| { + dafny_tokio_runtime.block_on(async { + self.inner.derive_shared_secret() + .set_key_id(inner_input.key_id) +.set_key_agreement_algorithm(inner_input.key_agreement_algorithm) +.set_public_key(inner_input.public_key) +.set_grant_tokens(inner_input.grant_tokens) +.set_dry_run(inner_input.dry_run) +.set_recipient(inner_input.recipient) + .send() + .await + }) + }); crate::standard_library_conversions::result_to_dafny(&native_result, - conversions::derive_shared_secret::_derive_shared_secret_response::to_dafny, - conversions::derive_shared_secret::to_dafny_error) + crate::conversions::derive_shared_secret::_derive_shared_secret_response::to_dafny, + crate::conversions::derive_shared_secret::to_dafny_error) } fn Encrypt(&mut self, input: &std::rc::Rc) -> std::rc::Rc > > { - let native_result = - dafny_tokio_runtime.block_on(conversions::encrypt::_encrypt_request::from_dafny(input.clone(), self.inner.clone()).send()); + let inner_input = crate::conversions::encrypt::_encrypt_request::from_dafny(input.clone()); + let native_result = tokio::task::block_in_place(|| { + dafny_tokio_runtime.block_on(async { + self.inner.encrypt() + .set_key_id(inner_input.key_id) +.set_plaintext(inner_input.plaintext) +.set_encryption_context(inner_input.encryption_context) +.set_grant_tokens(inner_input.grant_tokens) +.set_encryption_algorithm(inner_input.encryption_algorithm) +.set_dry_run(inner_input.dry_run) + .send() + .await + }) + }); crate::standard_library_conversions::result_to_dafny(&native_result, - conversions::encrypt::_encrypt_response::to_dafny, - conversions::encrypt::to_dafny_error) + crate::conversions::encrypt::_encrypt_response::to_dafny, + crate::conversions::encrypt::to_dafny_error) } fn GenerateDataKey(&mut self, input: &std::rc::Rc) -> std::rc::Rc > > { - let native_result = - dafny_tokio_runtime.block_on(conversions::generate_data_key::_generate_data_key_request::from_dafny(input.clone(), self.inner.clone()).send()); + let inner_input = crate::conversions::generate_data_key::_generate_data_key_request::from_dafny(input.clone()); + let native_result = tokio::task::block_in_place(|| { + dafny_tokio_runtime.block_on(async { + self.inner.generate_data_key() + .set_key_id(inner_input.key_id) +.set_encryption_context(inner_input.encryption_context) +.set_number_of_bytes(inner_input.number_of_bytes) +.set_key_spec(inner_input.key_spec) +.set_grant_tokens(inner_input.grant_tokens) +.set_recipient(inner_input.recipient) +.set_dry_run(inner_input.dry_run) + .send() + .await + }) + }); crate::standard_library_conversions::result_to_dafny(&native_result, - conversions::generate_data_key::_generate_data_key_response::to_dafny, - conversions::generate_data_key::to_dafny_error) + crate::conversions::generate_data_key::_generate_data_key_response::to_dafny, + crate::conversions::generate_data_key::to_dafny_error) } fn GenerateDataKeyWithoutPlaintext(&mut self, input: &std::rc::Rc) -> std::rc::Rc > > { - let native_result = - dafny_tokio_runtime.block_on(conversions::generate_data_key_without_plaintext::_generate_data_key_without_plaintext_request::from_dafny(input.clone(), self.inner.clone()).send()); + let inner_input = crate::conversions::generate_data_key_without_plaintext::_generate_data_key_without_plaintext_request::from_dafny(input.clone()); + let native_result = tokio::task::block_in_place(|| { + dafny_tokio_runtime.block_on(async { + self.inner.generate_data_key_without_plaintext() + .set_key_id(inner_input.key_id) +.set_encryption_context(inner_input.encryption_context) +.set_key_spec(inner_input.key_spec) +.set_number_of_bytes(inner_input.number_of_bytes) +.set_grant_tokens(inner_input.grant_tokens) +.set_dry_run(inner_input.dry_run) + .send() + .await + }) + }); crate::standard_library_conversions::result_to_dafny(&native_result, - conversions::generate_data_key_without_plaintext::_generate_data_key_without_plaintext_response::to_dafny, - conversions::generate_data_key_without_plaintext::to_dafny_error) + crate::conversions::generate_data_key_without_plaintext::_generate_data_key_without_plaintext_response::to_dafny, + crate::conversions::generate_data_key_without_plaintext::to_dafny_error) } fn GetPublicKey(&mut self, input: &std::rc::Rc) -> std::rc::Rc > > { - let native_result = - dafny_tokio_runtime.block_on(conversions::get_public_key::_get_public_key_request::from_dafny(input.clone(), self.inner.clone()).send()); + let inner_input = crate::conversions::get_public_key::_get_public_key_request::from_dafny(input.clone()); + let native_result = tokio::task::block_in_place(|| { + dafny_tokio_runtime.block_on(async { + self.inner.get_public_key() + .set_key_id(inner_input.key_id) +.set_grant_tokens(inner_input.grant_tokens) + .send() + .await + }) + }); crate::standard_library_conversions::result_to_dafny(&native_result, - conversions::get_public_key::_get_public_key_response::to_dafny, - conversions::get_public_key::to_dafny_error) + crate::conversions::get_public_key::_get_public_key_response::to_dafny, + crate::conversions::get_public_key::to_dafny_error) } fn ReEncrypt(&mut self, input: &std::rc::Rc) -> std::rc::Rc > > { - let native_result = - dafny_tokio_runtime.block_on(conversions::re_encrypt::_re_encrypt_request::from_dafny(input.clone(), self.inner.clone()).send()); + let inner_input = crate::conversions::re_encrypt::_re_encrypt_request::from_dafny(input.clone()); + let native_result = tokio::task::block_in_place(|| { + dafny_tokio_runtime.block_on(async { + self.inner.re_encrypt() + .set_ciphertext_blob(inner_input.ciphertext_blob) +.set_source_encryption_context(inner_input.source_encryption_context) +.set_source_key_id(inner_input.source_key_id) +.set_destination_key_id(inner_input.destination_key_id) +.set_destination_encryption_context(inner_input.destination_encryption_context) +.set_source_encryption_algorithm(inner_input.source_encryption_algorithm) +.set_destination_encryption_algorithm(inner_input.destination_encryption_algorithm) +.set_grant_tokens(inner_input.grant_tokens) +.set_dry_run(inner_input.dry_run) + .send() + .await + }) + }); crate::standard_library_conversions::result_to_dafny(&native_result, - conversions::re_encrypt::_re_encrypt_response::to_dafny, - conversions::re_encrypt::to_dafny_error) + crate::conversions::re_encrypt::_re_encrypt_response::to_dafny, + crate::conversions::re_encrypt::to_dafny_error) } fn UpdatePrimaryRegion(&mut self, input: &std::rc::Rc) -> std::rc::Rc > > { - let native_result = - dafny_tokio_runtime.block_on(conversions::update_primary_region::_update_primary_region_request::from_dafny(input.clone(), self.inner.clone()).send()); + let inner_input = crate::conversions::update_primary_region::_update_primary_region_request::from_dafny(input.clone()); + let native_result = tokio::task::block_in_place(|| { + dafny_tokio_runtime.block_on(async { + self.inner.update_primary_region() + .set_key_id(inner_input.key_id) +.set_primary_region(inner_input.primary_region) + .send() + .await + }) + }); crate::standard_library_conversions::result_to_dafny(&native_result, - conversions::update_primary_region::_update_primary_region_response::to_dafny, - conversions::update_primary_region::to_dafny_error) + |x| (), + crate::conversions::update_primary_region::to_dafny_error) } } #[allow(non_snake_case)] impl crate::r#software::amazon::cryptography::services::kms::internaldafny::_default { diff --git a/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions.rs b/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions.rs deleted file mode 100644 index 0e2c1805a..000000000 --- a/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions.rs +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -pub mod client; - - pub mod customer_master_key_spec; - - pub mod data_key_spec; - - pub mod decrypt; - - pub mod derive_shared_secret; - - pub mod encrypt; - - pub mod encryption_algorithm_spec; - - pub mod error; - - pub mod generate_data_key; - - pub mod generate_data_key_without_plaintext; - - pub mod get_public_key; - - pub mod key_agreement_algorithm_spec; - - pub mod key_encryption_mechanism; - - pub mod key_spec; - - pub mod key_usage_type; - - pub mod origin_type; - - pub mod re_encrypt; - - pub mod recipient_info; - - pub mod signing_algorithm_spec; - - pub mod update_primary_region; diff --git a/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/client.rs b/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/client.rs deleted file mode 100644 index 5fbbbaa0f..000000000 --- a/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/client.rs +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. diff --git a/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/customer_master_key_spec.rs b/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/customer_master_key_spec.rs deleted file mode 100644 index d00e07390..000000000 --- a/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/customer_master_key_spec.rs +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] - -pub fn to_dafny( - value: aws_sdk_kms::types::CustomerMasterKeySpec, -) -> ::std::rc::Rc{ - ::std::rc::Rc::new(match value { - aws_sdk_kms::types::CustomerMasterKeySpec::Rsa2048 => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::CustomerMasterKeySpec::RSA_2048 {}, -aws_sdk_kms::types::CustomerMasterKeySpec::Rsa3072 => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::CustomerMasterKeySpec::RSA_3072 {}, -aws_sdk_kms::types::CustomerMasterKeySpec::Rsa4096 => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::CustomerMasterKeySpec::RSA_4096 {}, -aws_sdk_kms::types::CustomerMasterKeySpec::EccNistP256 => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::CustomerMasterKeySpec::ECC_NIST_P256 {}, -aws_sdk_kms::types::CustomerMasterKeySpec::EccNistP384 => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::CustomerMasterKeySpec::ECC_NIST_P384 {}, -aws_sdk_kms::types::CustomerMasterKeySpec::EccNistP521 => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::CustomerMasterKeySpec::ECC_NIST_P521 {}, -aws_sdk_kms::types::CustomerMasterKeySpec::EccSecgP256K1 => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::CustomerMasterKeySpec::ECC_SECG_P256K1 {}, -aws_sdk_kms::types::CustomerMasterKeySpec::SymmetricDefault => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::CustomerMasterKeySpec::SYMMETRIC_DEFAULT {}, -aws_sdk_kms::types::CustomerMasterKeySpec::Hmac224 => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::CustomerMasterKeySpec::HMAC_224 {}, -aws_sdk_kms::types::CustomerMasterKeySpec::Hmac256 => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::CustomerMasterKeySpec::HMAC_256 {}, -aws_sdk_kms::types::CustomerMasterKeySpec::Hmac384 => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::CustomerMasterKeySpec::HMAC_384 {}, -aws_sdk_kms::types::CustomerMasterKeySpec::Hmac512 => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::CustomerMasterKeySpec::HMAC_512 {}, -aws_sdk_kms::types::CustomerMasterKeySpec::Sm2 => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::CustomerMasterKeySpec::SM2 {}, - _ => panic!("Unknown enum variant: {}", value), - }) -} - #[allow(dead_code)] -pub fn from_dafny( - dafny_value: &crate::r#software::amazon::cryptography::services::kms::internaldafny::types::CustomerMasterKeySpec, -) -> aws_sdk_kms::types::CustomerMasterKeySpec { - match dafny_value { - crate::r#software::amazon::cryptography::services::kms::internaldafny::types::CustomerMasterKeySpec::RSA_2048 {} => aws_sdk_kms::types::CustomerMasterKeySpec::Rsa2048, -crate::r#software::amazon::cryptography::services::kms::internaldafny::types::CustomerMasterKeySpec::RSA_3072 {} => aws_sdk_kms::types::CustomerMasterKeySpec::Rsa3072, -crate::r#software::amazon::cryptography::services::kms::internaldafny::types::CustomerMasterKeySpec::RSA_4096 {} => aws_sdk_kms::types::CustomerMasterKeySpec::Rsa4096, -crate::r#software::amazon::cryptography::services::kms::internaldafny::types::CustomerMasterKeySpec::ECC_NIST_P256 {} => aws_sdk_kms::types::CustomerMasterKeySpec::EccNistP256, -crate::r#software::amazon::cryptography::services::kms::internaldafny::types::CustomerMasterKeySpec::ECC_NIST_P384 {} => aws_sdk_kms::types::CustomerMasterKeySpec::EccNistP384, -crate::r#software::amazon::cryptography::services::kms::internaldafny::types::CustomerMasterKeySpec::ECC_NIST_P521 {} => aws_sdk_kms::types::CustomerMasterKeySpec::EccNistP521, -crate::r#software::amazon::cryptography::services::kms::internaldafny::types::CustomerMasterKeySpec::ECC_SECG_P256K1 {} => aws_sdk_kms::types::CustomerMasterKeySpec::EccSecgP256K1, -crate::r#software::amazon::cryptography::services::kms::internaldafny::types::CustomerMasterKeySpec::SYMMETRIC_DEFAULT {} => aws_sdk_kms::types::CustomerMasterKeySpec::SymmetricDefault, -crate::r#software::amazon::cryptography::services::kms::internaldafny::types::CustomerMasterKeySpec::HMAC_224 {} => aws_sdk_kms::types::CustomerMasterKeySpec::Hmac224, -crate::r#software::amazon::cryptography::services::kms::internaldafny::types::CustomerMasterKeySpec::HMAC_256 {} => aws_sdk_kms::types::CustomerMasterKeySpec::Hmac256, -crate::r#software::amazon::cryptography::services::kms::internaldafny::types::CustomerMasterKeySpec::HMAC_384 {} => aws_sdk_kms::types::CustomerMasterKeySpec::Hmac384, -crate::r#software::amazon::cryptography::services::kms::internaldafny::types::CustomerMasterKeySpec::HMAC_512 {} => aws_sdk_kms::types::CustomerMasterKeySpec::Hmac512, -crate::r#software::amazon::cryptography::services::kms::internaldafny::types::CustomerMasterKeySpec::SM2 {} => aws_sdk_kms::types::CustomerMasterKeySpec::Sm2, - } -} diff --git a/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/data_key_spec.rs b/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/data_key_spec.rs deleted file mode 100644 index f26b83c13..000000000 --- a/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/data_key_spec.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] - -pub fn to_dafny( - value: aws_sdk_kms::types::DataKeySpec, -) -> ::std::rc::Rc{ - ::std::rc::Rc::new(match value { - aws_sdk_kms::types::DataKeySpec::Aes256 => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::DataKeySpec::AES_256 {}, -aws_sdk_kms::types::DataKeySpec::Aes128 => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::DataKeySpec::AES_128 {}, - _ => panic!("Unknown enum variant: {}", value), - }) -} - #[allow(dead_code)] -pub fn from_dafny( - dafny_value: &crate::r#software::amazon::cryptography::services::kms::internaldafny::types::DataKeySpec, -) -> aws_sdk_kms::types::DataKeySpec { - match dafny_value { - crate::r#software::amazon::cryptography::services::kms::internaldafny::types::DataKeySpec::AES_256 {} => aws_sdk_kms::types::DataKeySpec::Aes256, -crate::r#software::amazon::cryptography::services::kms::internaldafny::types::DataKeySpec::AES_128 {} => aws_sdk_kms::types::DataKeySpec::Aes128, - } -} diff --git a/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/decrypt.rs b/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/decrypt.rs deleted file mode 100644 index cb9dafd18..000000000 --- a/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/decrypt.rs +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -pub mod _decrypt_request; - - pub mod _decrypt_response; - #[allow(dead_code)] -pub fn to_dafny_error( - value: &::aws_smithy_runtime_api::client::result::SdkError< - aws_sdk_kms::operation::decrypt::DecryptError, - ::aws_smithy_runtime_api::client::orchestrator::HttpResponse, - >, -) -> ::std::rc::Rc { - match value { - aws_sdk_kms::error::SdkError::ServiceError(service_error) => match service_error.err() { - aws_sdk_kms::operation::decrypt::DecryptError::DryRunOperationException(e) => - crate::conversions::error::dry_run_operation_exception::to_dafny(e.clone()), - aws_sdk_kms::operation::decrypt::DecryptError::NotFoundException(e) => - crate::conversions::error::not_found_exception::to_dafny(e.clone()), - aws_sdk_kms::operation::decrypt::DecryptError::DisabledException(e) => - crate::conversions::error::disabled_exception::to_dafny(e.clone()), - aws_sdk_kms::operation::decrypt::DecryptError::KmsInternalException(e) => - crate::conversions::error::kms_internal_exception::to_dafny(e.clone()), - aws_sdk_kms::operation::decrypt::DecryptError::KmsInvalidStateException(e) => - crate::conversions::error::kms_invalid_state_exception::to_dafny(e.clone()), - aws_sdk_kms::operation::decrypt::DecryptError::InvalidKeyUsageException(e) => - crate::conversions::error::invalid_key_usage_exception::to_dafny(e.clone()), - aws_sdk_kms::operation::decrypt::DecryptError::KeyUnavailableException(e) => - crate::conversions::error::key_unavailable_exception::to_dafny(e.clone()), - aws_sdk_kms::operation::decrypt::DecryptError::InvalidCiphertextException(e) => - crate::conversions::error::invalid_ciphertext_exception::to_dafny(e.clone()), - aws_sdk_kms::operation::decrypt::DecryptError::DependencyTimeoutException(e) => - crate::conversions::error::dependency_timeout_exception::to_dafny(e.clone()), - aws_sdk_kms::operation::decrypt::DecryptError::InvalidGrantTokenException(e) => - crate::conversions::error::invalid_grant_token_exception::to_dafny(e.clone()), - aws_sdk_kms::operation::decrypt::DecryptError::IncorrectKeyException(e) => - crate::conversions::error::incorrect_key_exception::to_dafny(e.clone()), - e => crate::conversions::error::to_opaque_error(e.to_string()), - }, - _ => { - crate::conversions::error::to_opaque_error(value.to_string()) - } - } -} diff --git a/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/decrypt/_decrypt_request.rs b/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/decrypt/_decrypt_request.rs deleted file mode 100644 index c35addf12..000000000 --- a/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/decrypt/_decrypt_request.rs +++ /dev/null @@ -1,91 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: &aws_sdk_kms::operation::decrypt::DecryptInput, -) -> ::std::rc::Rc< - crate::r#software::amazon::cryptography::services::kms::internaldafny::types::DecryptRequest, ->{ - ::std::rc::Rc::new(crate::r#software::amazon::cryptography::services::kms::internaldafny::types::DecryptRequest::DecryptRequest { - CiphertextBlob: crate::standard_library_conversions::oblob_to_dafny(&value.ciphertext_blob).Extract(), - EncryptionContext: -::std::rc::Rc::new(match &value.encryption_context { - Some(x) => crate::r#_Wrappers_Compile::Option::Some { value : - ::dafny_runtime::dafny_runtime_conversions::hashmap_to_dafny_map(x, - |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&k), - |v| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&v), - ) - }, - None => crate::r#_Wrappers_Compile::Option::None {} -}) -, - GrantTokens: ::std::rc::Rc::new(match &value.grant_tokens { - Some(x) => crate::r#_Wrappers_Compile::Option::Some { value : - ::dafny_runtime::dafny_runtime_conversions::vec_to_dafny_sequence(x, - |e| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&e), - ) - }, - None => crate::r#_Wrappers_Compile::Option::None {} -}) -, - KeyId: crate::standard_library_conversions::ostring_to_dafny(&value.key_id), - EncryptionAlgorithm: ::std::rc::Rc::new(match &value.encryption_algorithm { - Some(x) => crate::_Wrappers_Compile::Option::Some { value: crate::conversions::encryption_algorithm_spec::to_dafny(x.clone()) }, - None => crate::_Wrappers_Compile::Option::None { } -}) -, - Recipient: ::std::rc::Rc::new(match &value.recipient { - Some(x) => crate::_Wrappers_Compile::Option::Some { value: crate::conversions::recipient_info::to_dafny(&x) }, - None => crate::_Wrappers_Compile::Option::None { } -}) -, - DryRun: crate::standard_library_conversions::obool_to_dafny(&value.dry_run), - }) -} - #[allow(dead_code)] -pub fn from_dafny( - dafny_value: ::std::rc::Rc< - crate::r#software::amazon::cryptography::services::kms::internaldafny::types::DecryptRequest, - >, - client: aws_sdk_kms::Client, -) -> aws_sdk_kms::operation::decrypt::builders::DecryptFluentBuilder { - client.decrypt() - .set_ciphertext_blob(Some(crate::standard_library_conversions::blob_from_dafny(dafny_value.CiphertextBlob().clone()))) - .set_encryption_context(match (*dafny_value.EncryptionContext()).as_ref() { - crate::r#_Wrappers_Compile::Option::Some { value } => - Some( - ::dafny_runtime::dafny_runtime_conversions::dafny_map_to_hashmap(value, - |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(k), - |v| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(v), - ) - ), - _ => None -} -) - .set_grant_tokens(match (*dafny_value.GrantTokens()).as_ref() { - crate::r#_Wrappers_Compile::Option::Some { value } => - Some( - ::dafny_runtime::dafny_runtime_conversions::dafny_sequence_to_vec(value, - |e| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(e), - ) - ), - _ => None -} -) - .set_key_id(crate::standard_library_conversions::ostring_from_dafny(dafny_value.KeyId().clone())) - .set_encryption_algorithm(match &**dafny_value.EncryptionAlgorithm() { - crate::r#_Wrappers_Compile::Option::Some { value } => Some( - crate::conversions::encryption_algorithm_spec::from_dafny(value) - ), - _ => None, -} -) - .set_recipient(match (*dafny_value.Recipient()).as_ref() { - crate::r#_Wrappers_Compile::Option::Some { value } => - Some(crate::conversions::recipient_info::from_dafny(value.clone())), - _ => None, -} -) - .set_dry_run(crate::standard_library_conversions::obool_from_dafny(dafny_value.DryRun().clone())) -} diff --git a/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/decrypt/_decrypt_response.rs b/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/decrypt/_decrypt_response.rs deleted file mode 100644 index a68cea948..000000000 --- a/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/decrypt/_decrypt_response.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: &aws_sdk_kms::operation::decrypt::DecryptOutput -) -> ::std::rc::Rc< - crate::r#software::amazon::cryptography::services::kms::internaldafny::types::DecryptResponse, ->{ - ::std::rc::Rc::new(crate::r#software::amazon::cryptography::services::kms::internaldafny::types::DecryptResponse::DecryptResponse { - KeyId: crate::standard_library_conversions::ostring_to_dafny(&value.key_id), - Plaintext: crate::standard_library_conversions::oblob_to_dafny(&value.plaintext), - EncryptionAlgorithm: ::std::rc::Rc::new(match &value.encryption_algorithm { - Some(x) => crate::_Wrappers_Compile::Option::Some { value: crate::conversions::encryption_algorithm_spec::to_dafny(x.clone()) }, - None => crate::_Wrappers_Compile::Option::None { } -}) -, - CiphertextForRecipient: crate::standard_library_conversions::oblob_to_dafny(&value.ciphertext_for_recipient), - }) -} - diff --git a/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/derive_shared_secret.rs b/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/derive_shared_secret.rs deleted file mode 100644 index ad9206fea..000000000 --- a/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/derive_shared_secret.rs +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -pub mod _derive_shared_secret_request; - - pub mod _derive_shared_secret_response; - #[allow(dead_code)] -pub fn to_dafny_error( - value: &::aws_smithy_runtime_api::client::result::SdkError< - aws_sdk_kms::operation::derive_shared_secret::DeriveSharedSecretError, - ::aws_smithy_runtime_api::client::orchestrator::HttpResponse, - >, -) -> ::std::rc::Rc { - match value { - aws_sdk_kms::error::SdkError::ServiceError(service_error) => match service_error.err() { - aws_sdk_kms::operation::derive_shared_secret::DeriveSharedSecretError::DryRunOperationException(e) => - crate::conversions::error::dry_run_operation_exception::to_dafny(e.clone()), - aws_sdk_kms::operation::derive_shared_secret::DeriveSharedSecretError::NotFoundException(e) => - crate::conversions::error::not_found_exception::to_dafny(e.clone()), - aws_sdk_kms::operation::derive_shared_secret::DeriveSharedSecretError::DisabledException(e) => - crate::conversions::error::disabled_exception::to_dafny(e.clone()), - aws_sdk_kms::operation::derive_shared_secret::DeriveSharedSecretError::KmsInternalException(e) => - crate::conversions::error::kms_internal_exception::to_dafny(e.clone()), - aws_sdk_kms::operation::derive_shared_secret::DeriveSharedSecretError::KmsInvalidStateException(e) => - crate::conversions::error::kms_invalid_state_exception::to_dafny(e.clone()), - aws_sdk_kms::operation::derive_shared_secret::DeriveSharedSecretError::InvalidKeyUsageException(e) => - crate::conversions::error::invalid_key_usage_exception::to_dafny(e.clone()), - aws_sdk_kms::operation::derive_shared_secret::DeriveSharedSecretError::KeyUnavailableException(e) => - crate::conversions::error::key_unavailable_exception::to_dafny(e.clone()), - aws_sdk_kms::operation::derive_shared_secret::DeriveSharedSecretError::DependencyTimeoutException(e) => - crate::conversions::error::dependency_timeout_exception::to_dafny(e.clone()), - aws_sdk_kms::operation::derive_shared_secret::DeriveSharedSecretError::InvalidGrantTokenException(e) => - crate::conversions::error::invalid_grant_token_exception::to_dafny(e.clone()), - e => crate::conversions::error::to_opaque_error(e.to_string()), - }, - _ => { - crate::conversions::error::to_opaque_error(value.to_string()) - } - } -} diff --git a/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/derive_shared_secret/_derive_shared_secret_request.rs b/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/derive_shared_secret/_derive_shared_secret_request.rs deleted file mode 100644 index f51a35e14..000000000 --- a/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/derive_shared_secret/_derive_shared_secret_request.rs +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: &aws_sdk_kms::operation::derive_shared_secret::DeriveSharedSecretInput, -) -> ::std::rc::Rc< - crate::r#software::amazon::cryptography::services::kms::internaldafny::types::DeriveSharedSecretRequest, ->{ - ::std::rc::Rc::new(crate::r#software::amazon::cryptography::services::kms::internaldafny::types::DeriveSharedSecretRequest::DeriveSharedSecretRequest { - KeyId: crate::standard_library_conversions::ostring_to_dafny(&value.key_id) .Extract(), - KeyAgreementAlgorithm: crate::conversions::key_agreement_algorithm_spec::to_dafny(value.key_agreement_algorithm.clone().unwrap()), - PublicKey: crate::standard_library_conversions::oblob_to_dafny(&value.public_key).Extract(), - GrantTokens: ::std::rc::Rc::new(match &value.grant_tokens { - Some(x) => crate::r#_Wrappers_Compile::Option::Some { value : - ::dafny_runtime::dafny_runtime_conversions::vec_to_dafny_sequence(x, - |e| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&e), - ) - }, - None => crate::r#_Wrappers_Compile::Option::None {} -}) -, - DryRun: crate::standard_library_conversions::obool_to_dafny(&value.dry_run), - Recipient: ::std::rc::Rc::new(match &value.recipient { - Some(x) => crate::_Wrappers_Compile::Option::Some { value: crate::conversions::recipient_info::to_dafny(&x) }, - None => crate::_Wrappers_Compile::Option::None { } -}) -, - }) -} - #[allow(dead_code)] -pub fn from_dafny( - dafny_value: ::std::rc::Rc< - crate::r#software::amazon::cryptography::services::kms::internaldafny::types::DeriveSharedSecretRequest, - >, - client: aws_sdk_kms::Client, -) -> aws_sdk_kms::operation::derive_shared_secret::builders::DeriveSharedSecretFluentBuilder { - client.derive_shared_secret() - .set_key_id(Some( dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(dafny_value.KeyId()) )) - .set_key_agreement_algorithm(Some( crate::conversions::key_agreement_algorithm_spec::from_dafny(dafny_value.KeyAgreementAlgorithm()) )) - .set_public_key(Some(crate::standard_library_conversions::blob_from_dafny(dafny_value.PublicKey().clone()))) - .set_grant_tokens(match (*dafny_value.GrantTokens()).as_ref() { - crate::r#_Wrappers_Compile::Option::Some { value } => - Some( - ::dafny_runtime::dafny_runtime_conversions::dafny_sequence_to_vec(value, - |e| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(e), - ) - ), - _ => None -} -) - .set_dry_run(crate::standard_library_conversions::obool_from_dafny(dafny_value.DryRun().clone())) - .set_recipient(match (*dafny_value.Recipient()).as_ref() { - crate::r#_Wrappers_Compile::Option::Some { value } => - Some(crate::conversions::recipient_info::from_dafny(value.clone())), - _ => None, -} -) -} diff --git a/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/derive_shared_secret/_derive_shared_secret_response.rs b/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/derive_shared_secret/_derive_shared_secret_response.rs deleted file mode 100644 index aa9f9a109..000000000 --- a/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/derive_shared_secret/_derive_shared_secret_response.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: &aws_sdk_kms::operation::derive_shared_secret::DeriveSharedSecretOutput -) -> ::std::rc::Rc< - crate::r#software::amazon::cryptography::services::kms::internaldafny::types::DeriveSharedSecretResponse, ->{ - ::std::rc::Rc::new(crate::r#software::amazon::cryptography::services::kms::internaldafny::types::DeriveSharedSecretResponse::DeriveSharedSecretResponse { - KeyId: crate::standard_library_conversions::ostring_to_dafny(&value.key_id), - SharedSecret: crate::standard_library_conversions::oblob_to_dafny(&value.shared_secret), - CiphertextForRecipient: crate::standard_library_conversions::oblob_to_dafny(&value.ciphertext_for_recipient), - KeyAgreementAlgorithm: ::std::rc::Rc::new(match &value.key_agreement_algorithm { - Some(x) => crate::_Wrappers_Compile::Option::Some { value: crate::conversions::key_agreement_algorithm_spec::to_dafny(x.clone()) }, - None => crate::_Wrappers_Compile::Option::None { } -}) -, - KeyOrigin: ::std::rc::Rc::new(match &value.key_origin { - Some(x) => crate::_Wrappers_Compile::Option::Some { value: crate::conversions::origin_type::to_dafny(x.clone()) }, - None => crate::_Wrappers_Compile::Option::None { } -}) -, - }) -} - diff --git a/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/encrypt.rs b/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/encrypt.rs deleted file mode 100644 index 4f2892c4f..000000000 --- a/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/encrypt.rs +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -pub mod _encrypt_request; - - pub mod _encrypt_response; - #[allow(dead_code)] -pub fn to_dafny_error( - value: &::aws_smithy_runtime_api::client::result::SdkError< - aws_sdk_kms::operation::encrypt::EncryptError, - ::aws_smithy_runtime_api::client::orchestrator::HttpResponse, - >, -) -> ::std::rc::Rc { - match value { - aws_sdk_kms::error::SdkError::ServiceError(service_error) => match service_error.err() { - aws_sdk_kms::operation::encrypt::EncryptError::DryRunOperationException(e) => - crate::conversions::error::dry_run_operation_exception::to_dafny(e.clone()), - aws_sdk_kms::operation::encrypt::EncryptError::NotFoundException(e) => - crate::conversions::error::not_found_exception::to_dafny(e.clone()), - aws_sdk_kms::operation::encrypt::EncryptError::DisabledException(e) => - crate::conversions::error::disabled_exception::to_dafny(e.clone()), - aws_sdk_kms::operation::encrypt::EncryptError::KmsInternalException(e) => - crate::conversions::error::kms_internal_exception::to_dafny(e.clone()), - aws_sdk_kms::operation::encrypt::EncryptError::KmsInvalidStateException(e) => - crate::conversions::error::kms_invalid_state_exception::to_dafny(e.clone()), - aws_sdk_kms::operation::encrypt::EncryptError::InvalidKeyUsageException(e) => - crate::conversions::error::invalid_key_usage_exception::to_dafny(e.clone()), - aws_sdk_kms::operation::encrypt::EncryptError::KeyUnavailableException(e) => - crate::conversions::error::key_unavailable_exception::to_dafny(e.clone()), - aws_sdk_kms::operation::encrypt::EncryptError::DependencyTimeoutException(e) => - crate::conversions::error::dependency_timeout_exception::to_dafny(e.clone()), - aws_sdk_kms::operation::encrypt::EncryptError::InvalidGrantTokenException(e) => - crate::conversions::error::invalid_grant_token_exception::to_dafny(e.clone()), - e => crate::conversions::error::to_opaque_error(e.to_string()), - }, - _ => { - crate::conversions::error::to_opaque_error(value.to_string()) - } - } -} diff --git a/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/encrypt/_encrypt_request.rs b/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/encrypt/_encrypt_request.rs deleted file mode 100644 index 98a6296c7..000000000 --- a/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/encrypt/_encrypt_request.rs +++ /dev/null @@ -1,80 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: &aws_sdk_kms::operation::encrypt::EncryptInput, -) -> ::std::rc::Rc< - crate::r#software::amazon::cryptography::services::kms::internaldafny::types::EncryptRequest, ->{ - ::std::rc::Rc::new(crate::r#software::amazon::cryptography::services::kms::internaldafny::types::EncryptRequest::EncryptRequest { - KeyId: crate::standard_library_conversions::ostring_to_dafny(&value.key_id) .Extract(), - Plaintext: crate::standard_library_conversions::oblob_to_dafny(&value.plaintext).Extract(), - EncryptionContext: -::std::rc::Rc::new(match &value.encryption_context { - Some(x) => crate::r#_Wrappers_Compile::Option::Some { value : - ::dafny_runtime::dafny_runtime_conversions::hashmap_to_dafny_map(x, - |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&k), - |v| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&v), - ) - }, - None => crate::r#_Wrappers_Compile::Option::None {} -}) -, - GrantTokens: ::std::rc::Rc::new(match &value.grant_tokens { - Some(x) => crate::r#_Wrappers_Compile::Option::Some { value : - ::dafny_runtime::dafny_runtime_conversions::vec_to_dafny_sequence(x, - |e| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&e), - ) - }, - None => crate::r#_Wrappers_Compile::Option::None {} -}) -, - EncryptionAlgorithm: ::std::rc::Rc::new(match &value.encryption_algorithm { - Some(x) => crate::_Wrappers_Compile::Option::Some { value: crate::conversions::encryption_algorithm_spec::to_dafny(x.clone()) }, - None => crate::_Wrappers_Compile::Option::None { } -}) -, - DryRun: crate::standard_library_conversions::obool_to_dafny(&value.dry_run), - }) -} - #[allow(dead_code)] -pub fn from_dafny( - dafny_value: ::std::rc::Rc< - crate::r#software::amazon::cryptography::services::kms::internaldafny::types::EncryptRequest, - >, - client: aws_sdk_kms::Client, -) -> aws_sdk_kms::operation::encrypt::builders::EncryptFluentBuilder { - client.encrypt() - .set_key_id(Some( dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(dafny_value.KeyId()) )) - .set_plaintext(Some(crate::standard_library_conversions::blob_from_dafny(dafny_value.Plaintext().clone()))) - .set_encryption_context(match (*dafny_value.EncryptionContext()).as_ref() { - crate::r#_Wrappers_Compile::Option::Some { value } => - Some( - ::dafny_runtime::dafny_runtime_conversions::dafny_map_to_hashmap(value, - |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(k), - |v| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(v), - ) - ), - _ => None -} -) - .set_grant_tokens(match (*dafny_value.GrantTokens()).as_ref() { - crate::r#_Wrappers_Compile::Option::Some { value } => - Some( - ::dafny_runtime::dafny_runtime_conversions::dafny_sequence_to_vec(value, - |e| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(e), - ) - ), - _ => None -} -) - .set_encryption_algorithm(match &**dafny_value.EncryptionAlgorithm() { - crate::r#_Wrappers_Compile::Option::Some { value } => Some( - crate::conversions::encryption_algorithm_spec::from_dafny(value) - ), - _ => None, -} -) - .set_dry_run(crate::standard_library_conversions::obool_from_dafny(dafny_value.DryRun().clone())) -} diff --git a/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/encrypt/_encrypt_response.rs b/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/encrypt/_encrypt_response.rs deleted file mode 100644 index 4bf453ffa..000000000 --- a/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/encrypt/_encrypt_response.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: &aws_sdk_kms::operation::encrypt::EncryptOutput -) -> ::std::rc::Rc< - crate::r#software::amazon::cryptography::services::kms::internaldafny::types::EncryptResponse, ->{ - ::std::rc::Rc::new(crate::r#software::amazon::cryptography::services::kms::internaldafny::types::EncryptResponse::EncryptResponse { - CiphertextBlob: crate::standard_library_conversions::oblob_to_dafny(&value.ciphertext_blob), - KeyId: crate::standard_library_conversions::ostring_to_dafny(&value.key_id), - EncryptionAlgorithm: ::std::rc::Rc::new(match &value.encryption_algorithm { - Some(x) => crate::_Wrappers_Compile::Option::Some { value: crate::conversions::encryption_algorithm_spec::to_dafny(x.clone()) }, - None => crate::_Wrappers_Compile::Option::None { } -}) -, - }) -} - diff --git a/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/encryption_algorithm_spec.rs b/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/encryption_algorithm_spec.rs deleted file mode 100644 index af802a8f4..000000000 --- a/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/encryption_algorithm_spec.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] - -pub fn to_dafny( - value: aws_sdk_kms::types::EncryptionAlgorithmSpec, -) -> ::std::rc::Rc{ - ::std::rc::Rc::new(match value { - aws_sdk_kms::types::EncryptionAlgorithmSpec::SymmetricDefault => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::EncryptionAlgorithmSpec::SYMMETRIC_DEFAULT {}, -aws_sdk_kms::types::EncryptionAlgorithmSpec::RsaesOaepSha1 => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::EncryptionAlgorithmSpec::RSAES_OAEP_SHA_1 {}, -aws_sdk_kms::types::EncryptionAlgorithmSpec::RsaesOaepSha256 => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::EncryptionAlgorithmSpec::RSAES_OAEP_SHA_256 {}, - _ => panic!("Unknown enum variant: {}", value), - }) -} - #[allow(dead_code)] -pub fn from_dafny( - dafny_value: &crate::r#software::amazon::cryptography::services::kms::internaldafny::types::EncryptionAlgorithmSpec, -) -> aws_sdk_kms::types::EncryptionAlgorithmSpec { - match dafny_value { - crate::r#software::amazon::cryptography::services::kms::internaldafny::types::EncryptionAlgorithmSpec::SYMMETRIC_DEFAULT {} => aws_sdk_kms::types::EncryptionAlgorithmSpec::SymmetricDefault, -crate::r#software::amazon::cryptography::services::kms::internaldafny::types::EncryptionAlgorithmSpec::RSAES_OAEP_SHA_1 {} => aws_sdk_kms::types::EncryptionAlgorithmSpec::RsaesOaepSha1, -crate::r#software::amazon::cryptography::services::kms::internaldafny::types::EncryptionAlgorithmSpec::RSAES_OAEP_SHA_256 {} => aws_sdk_kms::types::EncryptionAlgorithmSpec::RsaesOaepSha256, - } -} diff --git a/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/error.rs b/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/error.rs deleted file mode 100644 index f954d88b9..000000000 --- a/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/error.rs +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -pub mod dependency_timeout_exception; - - pub mod disabled_exception; - - pub mod dry_run_operation_exception; - - pub mod incorrect_key_exception; - - pub mod invalid_arn_exception; - - pub mod invalid_ciphertext_exception; - - pub mod invalid_grant_token_exception; - - pub mod invalid_key_usage_exception; - - pub mod key_unavailable_exception; - - pub mod kms_internal_exception; - - pub mod kms_invalid_state_exception; - - pub mod not_found_exception; - - pub mod unsupported_operation_exception; - /// Wraps up an arbitrary Rust Error value as a Dafny Error -pub fn to_opaque_error(value: E) -> - ::std::rc::Rc -{ - let error_obj: ::dafny_runtime::Object = ::dafny_runtime::Object(Some( - ::std::rc::Rc::new(::std::cell::UnsafeCell::new(value)), - )); - ::std::rc::Rc::new( - crate::r#software::amazon::cryptography::services::kms::internaldafny::types::Error::Opaque { - obj: error_obj, - }, - ) -} - -/// Wraps up an arbitrary Rust Error value as a Dafny Result.Failure -pub fn to_opaque_error_result(value: E) -> - ::std::rc::Rc< - crate::_Wrappers_Compile::Result< - T, - ::std::rc::Rc - > - > -{ - ::std::rc::Rc::new(crate::_Wrappers_Compile::Result::Failure { - error: to_opaque_error(value), - }) -} diff --git a/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/error/dependency_timeout_exception.rs b/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/error/dependency_timeout_exception.rs deleted file mode 100644 index cdf27efe1..000000000 --- a/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/error/dependency_timeout_exception.rs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: aws_sdk_kms::types::error::DependencyTimeoutException, -) -> ::std::rc::Rc{ - ::std::rc::Rc::new( - crate::r#software::amazon::cryptography::services::kms::internaldafny::types::Error::DependencyTimeoutException { - message: crate::standard_library_conversions::ostring_to_dafny(&value.message), - } - ) -} diff --git a/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/error/disabled_exception.rs b/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/error/disabled_exception.rs deleted file mode 100644 index e0349cce5..000000000 --- a/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/error/disabled_exception.rs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: aws_sdk_kms::types::error::DisabledException, -) -> ::std::rc::Rc{ - ::std::rc::Rc::new( - crate::r#software::amazon::cryptography::services::kms::internaldafny::types::Error::DisabledException { - message: crate::standard_library_conversions::ostring_to_dafny(&value.message), - } - ) -} diff --git a/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/error/dry_run_operation_exception.rs b/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/error/dry_run_operation_exception.rs deleted file mode 100644 index ead5d5f28..000000000 --- a/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/error/dry_run_operation_exception.rs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: aws_sdk_kms::types::error::DryRunOperationException, -) -> ::std::rc::Rc{ - ::std::rc::Rc::new( - crate::r#software::amazon::cryptography::services::kms::internaldafny::types::Error::DryRunOperationException { - message: crate::standard_library_conversions::ostring_to_dafny(&value.message), - } - ) -} diff --git a/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/error/incorrect_key_exception.rs b/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/error/incorrect_key_exception.rs deleted file mode 100644 index 081c111ee..000000000 --- a/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/error/incorrect_key_exception.rs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: aws_sdk_kms::types::error::IncorrectKeyException, -) -> ::std::rc::Rc{ - ::std::rc::Rc::new( - crate::r#software::amazon::cryptography::services::kms::internaldafny::types::Error::IncorrectKeyException { - message: crate::standard_library_conversions::ostring_to_dafny(&value.message), - } - ) -} diff --git a/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/error/invalid_arn_exception.rs b/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/error/invalid_arn_exception.rs deleted file mode 100644 index ff03c1b2b..000000000 --- a/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/error/invalid_arn_exception.rs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: aws_sdk_kms::types::error::InvalidArnException, -) -> ::std::rc::Rc{ - ::std::rc::Rc::new( - crate::r#software::amazon::cryptography::services::kms::internaldafny::types::Error::InvalidArnException { - message: crate::standard_library_conversions::ostring_to_dafny(&value.message), - } - ) -} diff --git a/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/error/invalid_ciphertext_exception.rs b/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/error/invalid_ciphertext_exception.rs deleted file mode 100644 index af0615254..000000000 --- a/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/error/invalid_ciphertext_exception.rs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: aws_sdk_kms::types::error::InvalidCiphertextException, -) -> ::std::rc::Rc{ - ::std::rc::Rc::new( - crate::r#software::amazon::cryptography::services::kms::internaldafny::types::Error::InvalidCiphertextException { - message: crate::standard_library_conversions::ostring_to_dafny(&value.message), - } - ) -} diff --git a/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/error/invalid_grant_token_exception.rs b/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/error/invalid_grant_token_exception.rs deleted file mode 100644 index 65e592592..000000000 --- a/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/error/invalid_grant_token_exception.rs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: aws_sdk_kms::types::error::InvalidGrantTokenException, -) -> ::std::rc::Rc{ - ::std::rc::Rc::new( - crate::r#software::amazon::cryptography::services::kms::internaldafny::types::Error::InvalidGrantTokenException { - message: crate::standard_library_conversions::ostring_to_dafny(&value.message), - } - ) -} diff --git a/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/error/invalid_key_usage_exception.rs b/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/error/invalid_key_usage_exception.rs deleted file mode 100644 index c992973d1..000000000 --- a/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/error/invalid_key_usage_exception.rs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: aws_sdk_kms::types::error::InvalidKeyUsageException, -) -> ::std::rc::Rc{ - ::std::rc::Rc::new( - crate::r#software::amazon::cryptography::services::kms::internaldafny::types::Error::InvalidKeyUsageException { - message: crate::standard_library_conversions::ostring_to_dafny(&value.message), - } - ) -} diff --git a/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/error/key_unavailable_exception.rs b/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/error/key_unavailable_exception.rs deleted file mode 100644 index 5b9d52a4f..000000000 --- a/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/error/key_unavailable_exception.rs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: aws_sdk_kms::types::error::KeyUnavailableException, -) -> ::std::rc::Rc{ - ::std::rc::Rc::new( - crate::r#software::amazon::cryptography::services::kms::internaldafny::types::Error::KeyUnavailableException { - message: crate::standard_library_conversions::ostring_to_dafny(&value.message), - } - ) -} diff --git a/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/error/kms_internal_exception.rs b/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/error/kms_internal_exception.rs deleted file mode 100644 index fae7573f9..000000000 --- a/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/error/kms_internal_exception.rs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: aws_sdk_kms::types::error::KmsInternalException, -) -> ::std::rc::Rc{ - ::std::rc::Rc::new( - crate::r#software::amazon::cryptography::services::kms::internaldafny::types::Error::KMSInternalException { - message: crate::standard_library_conversions::ostring_to_dafny(&value.message), - } - ) -} diff --git a/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/error/kms_invalid_state_exception.rs b/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/error/kms_invalid_state_exception.rs deleted file mode 100644 index 5e63d1f6e..000000000 --- a/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/error/kms_invalid_state_exception.rs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: aws_sdk_kms::types::error::KmsInvalidStateException, -) -> ::std::rc::Rc{ - ::std::rc::Rc::new( - crate::r#software::amazon::cryptography::services::kms::internaldafny::types::Error::KMSInvalidStateException { - message: crate::standard_library_conversions::ostring_to_dafny(&value.message), - } - ) -} diff --git a/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/error/not_found_exception.rs b/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/error/not_found_exception.rs deleted file mode 100644 index d5cf1dfc3..000000000 --- a/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/error/not_found_exception.rs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: aws_sdk_kms::types::error::NotFoundException, -) -> ::std::rc::Rc{ - ::std::rc::Rc::new( - crate::r#software::amazon::cryptography::services::kms::internaldafny::types::Error::NotFoundException { - message: crate::standard_library_conversions::ostring_to_dafny(&value.message), - } - ) -} diff --git a/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/error/unsupported_operation_exception.rs b/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/error/unsupported_operation_exception.rs deleted file mode 100644 index 32ebc9435..000000000 --- a/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/error/unsupported_operation_exception.rs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: aws_sdk_kms::types::error::UnsupportedOperationException, -) -> ::std::rc::Rc{ - ::std::rc::Rc::new( - crate::r#software::amazon::cryptography::services::kms::internaldafny::types::Error::UnsupportedOperationException { - message: crate::standard_library_conversions::ostring_to_dafny(&value.message), - } - ) -} diff --git a/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/generate_data_key.rs b/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/generate_data_key.rs deleted file mode 100644 index 4d2070eac..000000000 --- a/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/generate_data_key.rs +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -pub mod _generate_data_key_request; - - pub mod _generate_data_key_response; - #[allow(dead_code)] -pub fn to_dafny_error( - value: &::aws_smithy_runtime_api::client::result::SdkError< - aws_sdk_kms::operation::generate_data_key::GenerateDataKeyError, - ::aws_smithy_runtime_api::client::orchestrator::HttpResponse, - >, -) -> ::std::rc::Rc { - match value { - aws_sdk_kms::error::SdkError::ServiceError(service_error) => match service_error.err() { - aws_sdk_kms::operation::generate_data_key::GenerateDataKeyError::DryRunOperationException(e) => - crate::conversions::error::dry_run_operation_exception::to_dafny(e.clone()), - aws_sdk_kms::operation::generate_data_key::GenerateDataKeyError::NotFoundException(e) => - crate::conversions::error::not_found_exception::to_dafny(e.clone()), - aws_sdk_kms::operation::generate_data_key::GenerateDataKeyError::DisabledException(e) => - crate::conversions::error::disabled_exception::to_dafny(e.clone()), - aws_sdk_kms::operation::generate_data_key::GenerateDataKeyError::KmsInternalException(e) => - crate::conversions::error::kms_internal_exception::to_dafny(e.clone()), - aws_sdk_kms::operation::generate_data_key::GenerateDataKeyError::KmsInvalidStateException(e) => - crate::conversions::error::kms_invalid_state_exception::to_dafny(e.clone()), - aws_sdk_kms::operation::generate_data_key::GenerateDataKeyError::InvalidKeyUsageException(e) => - crate::conversions::error::invalid_key_usage_exception::to_dafny(e.clone()), - aws_sdk_kms::operation::generate_data_key::GenerateDataKeyError::KeyUnavailableException(e) => - crate::conversions::error::key_unavailable_exception::to_dafny(e.clone()), - aws_sdk_kms::operation::generate_data_key::GenerateDataKeyError::DependencyTimeoutException(e) => - crate::conversions::error::dependency_timeout_exception::to_dafny(e.clone()), - aws_sdk_kms::operation::generate_data_key::GenerateDataKeyError::InvalidGrantTokenException(e) => - crate::conversions::error::invalid_grant_token_exception::to_dafny(e.clone()), - e => crate::conversions::error::to_opaque_error(e.to_string()), - }, - _ => { - crate::conversions::error::to_opaque_error(value.to_string()) - } - } -} diff --git a/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/generate_data_key/_generate_data_key_request.rs b/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/generate_data_key/_generate_data_key_request.rs deleted file mode 100644 index 8fc481842..000000000 --- a/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/generate_data_key/_generate_data_key_request.rs +++ /dev/null @@ -1,91 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: &aws_sdk_kms::operation::generate_data_key::GenerateDataKeyInput, -) -> ::std::rc::Rc< - crate::r#software::amazon::cryptography::services::kms::internaldafny::types::GenerateDataKeyRequest, ->{ - ::std::rc::Rc::new(crate::r#software::amazon::cryptography::services::kms::internaldafny::types::GenerateDataKeyRequest::GenerateDataKeyRequest { - KeyId: crate::standard_library_conversions::ostring_to_dafny(&value.key_id) .Extract(), - EncryptionContext: -::std::rc::Rc::new(match &value.encryption_context { - Some(x) => crate::r#_Wrappers_Compile::Option::Some { value : - ::dafny_runtime::dafny_runtime_conversions::hashmap_to_dafny_map(x, - |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&k), - |v| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&v), - ) - }, - None => crate::r#_Wrappers_Compile::Option::None {} -}) -, - NumberOfBytes: crate::standard_library_conversions::oint_to_dafny(value.number_of_bytes), - KeySpec: ::std::rc::Rc::new(match &value.key_spec { - Some(x) => crate::_Wrappers_Compile::Option::Some { value: crate::conversions::data_key_spec::to_dafny(x.clone()) }, - None => crate::_Wrappers_Compile::Option::None { } -}) -, - GrantTokens: ::std::rc::Rc::new(match &value.grant_tokens { - Some(x) => crate::r#_Wrappers_Compile::Option::Some { value : - ::dafny_runtime::dafny_runtime_conversions::vec_to_dafny_sequence(x, - |e| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&e), - ) - }, - None => crate::r#_Wrappers_Compile::Option::None {} -}) -, - Recipient: ::std::rc::Rc::new(match &value.recipient { - Some(x) => crate::_Wrappers_Compile::Option::Some { value: crate::conversions::recipient_info::to_dafny(&x) }, - None => crate::_Wrappers_Compile::Option::None { } -}) -, - DryRun: crate::standard_library_conversions::obool_to_dafny(&value.dry_run), - }) -} - #[allow(dead_code)] -pub fn from_dafny( - dafny_value: ::std::rc::Rc< - crate::r#software::amazon::cryptography::services::kms::internaldafny::types::GenerateDataKeyRequest, - >, - client: aws_sdk_kms::Client, -) -> aws_sdk_kms::operation::generate_data_key::builders::GenerateDataKeyFluentBuilder { - client.generate_data_key() - .set_key_id(Some( dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(dafny_value.KeyId()) )) - .set_encryption_context(match (*dafny_value.EncryptionContext()).as_ref() { - crate::r#_Wrappers_Compile::Option::Some { value } => - Some( - ::dafny_runtime::dafny_runtime_conversions::dafny_map_to_hashmap(value, - |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(k), - |v| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(v), - ) - ), - _ => None -} -) - .set_number_of_bytes(crate::standard_library_conversions::oint_from_dafny(dafny_value.NumberOfBytes().clone())) - .set_key_spec(match &**dafny_value.KeySpec() { - crate::r#_Wrappers_Compile::Option::Some { value } => Some( - crate::conversions::data_key_spec::from_dafny(value) - ), - _ => None, -} -) - .set_grant_tokens(match (*dafny_value.GrantTokens()).as_ref() { - crate::r#_Wrappers_Compile::Option::Some { value } => - Some( - ::dafny_runtime::dafny_runtime_conversions::dafny_sequence_to_vec(value, - |e| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(e), - ) - ), - _ => None -} -) - .set_recipient(match (*dafny_value.Recipient()).as_ref() { - crate::r#_Wrappers_Compile::Option::Some { value } => - Some(crate::conversions::recipient_info::from_dafny(value.clone())), - _ => None, -} -) - .set_dry_run(crate::standard_library_conversions::obool_from_dafny(dafny_value.DryRun().clone())) -} diff --git a/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/generate_data_key/_generate_data_key_response.rs b/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/generate_data_key/_generate_data_key_response.rs deleted file mode 100644 index 308b0ac19..000000000 --- a/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/generate_data_key/_generate_data_key_response.rs +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: &aws_sdk_kms::operation::generate_data_key::GenerateDataKeyOutput -) -> ::std::rc::Rc< - crate::r#software::amazon::cryptography::services::kms::internaldafny::types::GenerateDataKeyResponse, ->{ - ::std::rc::Rc::new(crate::r#software::amazon::cryptography::services::kms::internaldafny::types::GenerateDataKeyResponse::GenerateDataKeyResponse { - CiphertextBlob: crate::standard_library_conversions::oblob_to_dafny(&value.ciphertext_blob), - Plaintext: crate::standard_library_conversions::oblob_to_dafny(&value.plaintext), - KeyId: crate::standard_library_conversions::ostring_to_dafny(&value.key_id), - CiphertextForRecipient: crate::standard_library_conversions::oblob_to_dafny(&value.ciphertext_for_recipient), - }) -} - diff --git a/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/generate_data_key_without_plaintext.rs b/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/generate_data_key_without_plaintext.rs deleted file mode 100644 index 085bbc1dc..000000000 --- a/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/generate_data_key_without_plaintext.rs +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -pub mod _generate_data_key_without_plaintext_request; - - pub mod _generate_data_key_without_plaintext_response; - #[allow(dead_code)] -pub fn to_dafny_error( - value: &::aws_smithy_runtime_api::client::result::SdkError< - aws_sdk_kms::operation::generate_data_key_without_plaintext::GenerateDataKeyWithoutPlaintextError, - ::aws_smithy_runtime_api::client::orchestrator::HttpResponse, - >, -) -> ::std::rc::Rc { - match value { - aws_sdk_kms::error::SdkError::ServiceError(service_error) => match service_error.err() { - aws_sdk_kms::operation::generate_data_key_without_plaintext::GenerateDataKeyWithoutPlaintextError::DryRunOperationException(e) => - crate::conversions::error::dry_run_operation_exception::to_dafny(e.clone()), - aws_sdk_kms::operation::generate_data_key_without_plaintext::GenerateDataKeyWithoutPlaintextError::NotFoundException(e) => - crate::conversions::error::not_found_exception::to_dafny(e.clone()), - aws_sdk_kms::operation::generate_data_key_without_plaintext::GenerateDataKeyWithoutPlaintextError::DisabledException(e) => - crate::conversions::error::disabled_exception::to_dafny(e.clone()), - aws_sdk_kms::operation::generate_data_key_without_plaintext::GenerateDataKeyWithoutPlaintextError::KmsInternalException(e) => - crate::conversions::error::kms_internal_exception::to_dafny(e.clone()), - aws_sdk_kms::operation::generate_data_key_without_plaintext::GenerateDataKeyWithoutPlaintextError::KmsInvalidStateException(e) => - crate::conversions::error::kms_invalid_state_exception::to_dafny(e.clone()), - aws_sdk_kms::operation::generate_data_key_without_plaintext::GenerateDataKeyWithoutPlaintextError::InvalidKeyUsageException(e) => - crate::conversions::error::invalid_key_usage_exception::to_dafny(e.clone()), - aws_sdk_kms::operation::generate_data_key_without_plaintext::GenerateDataKeyWithoutPlaintextError::KeyUnavailableException(e) => - crate::conversions::error::key_unavailable_exception::to_dafny(e.clone()), - aws_sdk_kms::operation::generate_data_key_without_plaintext::GenerateDataKeyWithoutPlaintextError::DependencyTimeoutException(e) => - crate::conversions::error::dependency_timeout_exception::to_dafny(e.clone()), - aws_sdk_kms::operation::generate_data_key_without_plaintext::GenerateDataKeyWithoutPlaintextError::InvalidGrantTokenException(e) => - crate::conversions::error::invalid_grant_token_exception::to_dafny(e.clone()), - e => crate::conversions::error::to_opaque_error(e.to_string()), - }, - _ => { - crate::conversions::error::to_opaque_error(value.to_string()) - } - } -} diff --git a/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/generate_data_key_without_plaintext/_generate_data_key_without_plaintext_request.rs b/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/generate_data_key_without_plaintext/_generate_data_key_without_plaintext_request.rs deleted file mode 100644 index 7dc24083d..000000000 --- a/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/generate_data_key_without_plaintext/_generate_data_key_without_plaintext_request.rs +++ /dev/null @@ -1,80 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: &aws_sdk_kms::operation::generate_data_key_without_plaintext::GenerateDataKeyWithoutPlaintextInput, -) -> ::std::rc::Rc< - crate::r#software::amazon::cryptography::services::kms::internaldafny::types::GenerateDataKeyWithoutPlaintextRequest, ->{ - ::std::rc::Rc::new(crate::r#software::amazon::cryptography::services::kms::internaldafny::types::GenerateDataKeyWithoutPlaintextRequest::GenerateDataKeyWithoutPlaintextRequest { - KeyId: crate::standard_library_conversions::ostring_to_dafny(&value.key_id) .Extract(), - EncryptionContext: -::std::rc::Rc::new(match &value.encryption_context { - Some(x) => crate::r#_Wrappers_Compile::Option::Some { value : - ::dafny_runtime::dafny_runtime_conversions::hashmap_to_dafny_map(x, - |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&k), - |v| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&v), - ) - }, - None => crate::r#_Wrappers_Compile::Option::None {} -}) -, - KeySpec: ::std::rc::Rc::new(match &value.key_spec { - Some(x) => crate::_Wrappers_Compile::Option::Some { value: crate::conversions::data_key_spec::to_dafny(x.clone()) }, - None => crate::_Wrappers_Compile::Option::None { } -}) -, - NumberOfBytes: crate::standard_library_conversions::oint_to_dafny(value.number_of_bytes), - GrantTokens: ::std::rc::Rc::new(match &value.grant_tokens { - Some(x) => crate::r#_Wrappers_Compile::Option::Some { value : - ::dafny_runtime::dafny_runtime_conversions::vec_to_dafny_sequence(x, - |e| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&e), - ) - }, - None => crate::r#_Wrappers_Compile::Option::None {} -}) -, - DryRun: crate::standard_library_conversions::obool_to_dafny(&value.dry_run), - }) -} - #[allow(dead_code)] -pub fn from_dafny( - dafny_value: ::std::rc::Rc< - crate::r#software::amazon::cryptography::services::kms::internaldafny::types::GenerateDataKeyWithoutPlaintextRequest, - >, - client: aws_sdk_kms::Client, -) -> aws_sdk_kms::operation::generate_data_key_without_plaintext::builders::GenerateDataKeyWithoutPlaintextFluentBuilder { - client.generate_data_key_without_plaintext() - .set_key_id(Some( dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(dafny_value.KeyId()) )) - .set_encryption_context(match (*dafny_value.EncryptionContext()).as_ref() { - crate::r#_Wrappers_Compile::Option::Some { value } => - Some( - ::dafny_runtime::dafny_runtime_conversions::dafny_map_to_hashmap(value, - |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(k), - |v| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(v), - ) - ), - _ => None -} -) - .set_key_spec(match &**dafny_value.KeySpec() { - crate::r#_Wrappers_Compile::Option::Some { value } => Some( - crate::conversions::data_key_spec::from_dafny(value) - ), - _ => None, -} -) - .set_number_of_bytes(crate::standard_library_conversions::oint_from_dafny(dafny_value.NumberOfBytes().clone())) - .set_grant_tokens(match (*dafny_value.GrantTokens()).as_ref() { - crate::r#_Wrappers_Compile::Option::Some { value } => - Some( - ::dafny_runtime::dafny_runtime_conversions::dafny_sequence_to_vec(value, - |e| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(e), - ) - ), - _ => None -} -) - .set_dry_run(crate::standard_library_conversions::obool_from_dafny(dafny_value.DryRun().clone())) -} diff --git a/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/generate_data_key_without_plaintext/_generate_data_key_without_plaintext_response.rs b/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/generate_data_key_without_plaintext/_generate_data_key_without_plaintext_response.rs deleted file mode 100644 index fd182dbea..000000000 --- a/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/generate_data_key_without_plaintext/_generate_data_key_without_plaintext_response.rs +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: &aws_sdk_kms::operation::generate_data_key_without_plaintext::GenerateDataKeyWithoutPlaintextOutput -) -> ::std::rc::Rc< - crate::r#software::amazon::cryptography::services::kms::internaldafny::types::GenerateDataKeyWithoutPlaintextResponse, ->{ - ::std::rc::Rc::new(crate::r#software::amazon::cryptography::services::kms::internaldafny::types::GenerateDataKeyWithoutPlaintextResponse::GenerateDataKeyWithoutPlaintextResponse { - CiphertextBlob: crate::standard_library_conversions::oblob_to_dafny(&value.ciphertext_blob), - KeyId: crate::standard_library_conversions::ostring_to_dafny(&value.key_id), - }) -} - diff --git a/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/get_public_key.rs b/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/get_public_key.rs deleted file mode 100644 index e7aeb9afb..000000000 --- a/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/get_public_key.rs +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -pub mod _get_public_key_request; - - pub mod _get_public_key_response; - #[allow(dead_code)] -pub fn to_dafny_error( - value: &::aws_smithy_runtime_api::client::result::SdkError< - aws_sdk_kms::operation::get_public_key::GetPublicKeyError, - ::aws_smithy_runtime_api::client::orchestrator::HttpResponse, - >, -) -> ::std::rc::Rc { - match value { - aws_sdk_kms::error::SdkError::ServiceError(service_error) => match service_error.err() { - aws_sdk_kms::operation::get_public_key::GetPublicKeyError::NotFoundException(e) => - crate::conversions::error::not_found_exception::to_dafny(e.clone()), - aws_sdk_kms::operation::get_public_key::GetPublicKeyError::DisabledException(e) => - crate::conversions::error::disabled_exception::to_dafny(e.clone()), - aws_sdk_kms::operation::get_public_key::GetPublicKeyError::InvalidArnException(e) => - crate::conversions::error::invalid_arn_exception::to_dafny(e.clone()), - aws_sdk_kms::operation::get_public_key::GetPublicKeyError::UnsupportedOperationException(e) => - crate::conversions::error::unsupported_operation_exception::to_dafny(e.clone()), - aws_sdk_kms::operation::get_public_key::GetPublicKeyError::KmsInternalException(e) => - crate::conversions::error::kms_internal_exception::to_dafny(e.clone()), - aws_sdk_kms::operation::get_public_key::GetPublicKeyError::KmsInvalidStateException(e) => - crate::conversions::error::kms_invalid_state_exception::to_dafny(e.clone()), - aws_sdk_kms::operation::get_public_key::GetPublicKeyError::InvalidKeyUsageException(e) => - crate::conversions::error::invalid_key_usage_exception::to_dafny(e.clone()), - aws_sdk_kms::operation::get_public_key::GetPublicKeyError::KeyUnavailableException(e) => - crate::conversions::error::key_unavailable_exception::to_dafny(e.clone()), - aws_sdk_kms::operation::get_public_key::GetPublicKeyError::DependencyTimeoutException(e) => - crate::conversions::error::dependency_timeout_exception::to_dafny(e.clone()), - aws_sdk_kms::operation::get_public_key::GetPublicKeyError::InvalidGrantTokenException(e) => - crate::conversions::error::invalid_grant_token_exception::to_dafny(e.clone()), - e => crate::conversions::error::to_opaque_error(e.to_string()), - }, - _ => { - crate::conversions::error::to_opaque_error(value.to_string()) - } - } -} diff --git a/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/get_public_key/_get_public_key_request.rs b/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/get_public_key/_get_public_key_request.rs deleted file mode 100644 index abcb27934..000000000 --- a/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/get_public_key/_get_public_key_request.rs +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: &aws_sdk_kms::operation::get_public_key::GetPublicKeyInput, -) -> ::std::rc::Rc< - crate::r#software::amazon::cryptography::services::kms::internaldafny::types::GetPublicKeyRequest, ->{ - ::std::rc::Rc::new(crate::r#software::amazon::cryptography::services::kms::internaldafny::types::GetPublicKeyRequest::GetPublicKeyRequest { - KeyId: crate::standard_library_conversions::ostring_to_dafny(&value.key_id) .Extract(), - GrantTokens: ::std::rc::Rc::new(match &value.grant_tokens { - Some(x) => crate::r#_Wrappers_Compile::Option::Some { value : - ::dafny_runtime::dafny_runtime_conversions::vec_to_dafny_sequence(x, - |e| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&e), - ) - }, - None => crate::r#_Wrappers_Compile::Option::None {} -}) -, - }) -} - #[allow(dead_code)] -pub fn from_dafny( - dafny_value: ::std::rc::Rc< - crate::r#software::amazon::cryptography::services::kms::internaldafny::types::GetPublicKeyRequest, - >, - client: aws_sdk_kms::Client, -) -> aws_sdk_kms::operation::get_public_key::builders::GetPublicKeyFluentBuilder { - client.get_public_key() - .set_key_id(Some( dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(dafny_value.KeyId()) )) - .set_grant_tokens(match (*dafny_value.GrantTokens()).as_ref() { - crate::r#_Wrappers_Compile::Option::Some { value } => - Some( - ::dafny_runtime::dafny_runtime_conversions::dafny_sequence_to_vec(value, - |e| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(e), - ) - ), - _ => None -} -) -} diff --git a/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/get_public_key/_get_public_key_response.rs b/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/get_public_key/_get_public_key_response.rs deleted file mode 100644 index c7de3e809..000000000 --- a/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/get_public_key/_get_public_key_response.rs +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: &aws_sdk_kms::operation::get_public_key::GetPublicKeyOutput -) -> ::std::rc::Rc< - crate::r#software::amazon::cryptography::services::kms::internaldafny::types::GetPublicKeyResponse, ->{ - ::std::rc::Rc::new(crate::r#software::amazon::cryptography::services::kms::internaldafny::types::GetPublicKeyResponse::GetPublicKeyResponse { - KeyId: crate::standard_library_conversions::ostring_to_dafny(&value.key_id), - PublicKey: crate::standard_library_conversions::oblob_to_dafny(&value.public_key), - CustomerMasterKeySpec: ::std::rc::Rc::new(match &value.customer_master_key_spec { - Some(x) => crate::_Wrappers_Compile::Option::Some { value: crate::conversions::customer_master_key_spec::to_dafny(x.clone()) }, - None => crate::_Wrappers_Compile::Option::None { } -}) -, - KeySpec: ::std::rc::Rc::new(match &value.key_spec { - Some(x) => crate::_Wrappers_Compile::Option::Some { value: crate::conversions::key_spec::to_dafny(x.clone()) }, - None => crate::_Wrappers_Compile::Option::None { } -}) -, - KeyUsage: ::std::rc::Rc::new(match &value.key_usage { - Some(x) => crate::_Wrappers_Compile::Option::Some { value: crate::conversions::key_usage_type::to_dafny(x.clone()) }, - None => crate::_Wrappers_Compile::Option::None { } -}) -, - EncryptionAlgorithms: ::std::rc::Rc::new(match &value.encryption_algorithms { - Some(x) => crate::r#_Wrappers_Compile::Option::Some { value : - ::dafny_runtime::dafny_runtime_conversions::vec_to_dafny_sequence(x, - |e| crate::conversions::encryption_algorithm_spec::to_dafny(e.clone()), - ) - }, - None => crate::r#_Wrappers_Compile::Option::None {} -}) -, - SigningAlgorithms: ::std::rc::Rc::new(match &value.signing_algorithms { - Some(x) => crate::r#_Wrappers_Compile::Option::Some { value : - ::dafny_runtime::dafny_runtime_conversions::vec_to_dafny_sequence(x, - |e| crate::conversions::signing_algorithm_spec::to_dafny(e.clone()), - ) - }, - None => crate::r#_Wrappers_Compile::Option::None {} -}) -, - KeyAgreementAlgorithms: ::std::rc::Rc::new(match &value.key_agreement_algorithms { - Some(x) => crate::r#_Wrappers_Compile::Option::Some { value : - ::dafny_runtime::dafny_runtime_conversions::vec_to_dafny_sequence(x, - |e| crate::conversions::key_agreement_algorithm_spec::to_dafny(e.clone()), - ) - }, - None => crate::r#_Wrappers_Compile::Option::None {} -}) -, - }) -} - diff --git a/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/key_agreement_algorithm_spec.rs b/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/key_agreement_algorithm_spec.rs deleted file mode 100644 index 1693266ff..000000000 --- a/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/key_agreement_algorithm_spec.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] - -pub fn to_dafny( - value: aws_sdk_kms::types::KeyAgreementAlgorithmSpec, -) -> ::std::rc::Rc{ - ::std::rc::Rc::new(match value { - aws_sdk_kms::types::KeyAgreementAlgorithmSpec::Ecdh => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::KeyAgreementAlgorithmSpec::ECDH {}, - _ => panic!("Unknown enum variant: {}", value), - }) -} - #[allow(dead_code)] -pub fn from_dafny( - dafny_value: &crate::r#software::amazon::cryptography::services::kms::internaldafny::types::KeyAgreementAlgorithmSpec, -) -> aws_sdk_kms::types::KeyAgreementAlgorithmSpec { - match dafny_value { - crate::r#software::amazon::cryptography::services::kms::internaldafny::types::KeyAgreementAlgorithmSpec::ECDH {} => aws_sdk_kms::types::KeyAgreementAlgorithmSpec::Ecdh, - } -} diff --git a/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/key_encryption_mechanism.rs b/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/key_encryption_mechanism.rs deleted file mode 100644 index 80c4b4d9b..000000000 --- a/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/key_encryption_mechanism.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] - -pub fn to_dafny( - value: aws_sdk_kms::types::KeyEncryptionMechanism, -) -> ::std::rc::Rc{ - ::std::rc::Rc::new(match value { - aws_sdk_kms::types::KeyEncryptionMechanism::RsaesOaepSha256 => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::KeyEncryptionMechanism::RSAES_OAEP_SHA_256 {}, - _ => panic!("Unknown enum variant: {}", value), - }) -} - #[allow(dead_code)] -pub fn from_dafny( - dafny_value: &crate::r#software::amazon::cryptography::services::kms::internaldafny::types::KeyEncryptionMechanism, -) -> aws_sdk_kms::types::KeyEncryptionMechanism { - match dafny_value { - crate::r#software::amazon::cryptography::services::kms::internaldafny::types::KeyEncryptionMechanism::RSAES_OAEP_SHA_256 {} => aws_sdk_kms::types::KeyEncryptionMechanism::RsaesOaepSha256, - } -} diff --git a/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/key_spec.rs b/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/key_spec.rs deleted file mode 100644 index 14c6136fc..000000000 --- a/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/key_spec.rs +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] - -pub fn to_dafny( - value: aws_sdk_kms::types::KeySpec, -) -> ::std::rc::Rc{ - ::std::rc::Rc::new(match value { - aws_sdk_kms::types::KeySpec::Rsa2048 => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::KeySpec::RSA_2048 {}, -aws_sdk_kms::types::KeySpec::Rsa3072 => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::KeySpec::RSA_3072 {}, -aws_sdk_kms::types::KeySpec::Rsa4096 => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::KeySpec::RSA_4096 {}, -aws_sdk_kms::types::KeySpec::EccNistP256 => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::KeySpec::ECC_NIST_P256 {}, -aws_sdk_kms::types::KeySpec::EccNistP384 => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::KeySpec::ECC_NIST_P384 {}, -aws_sdk_kms::types::KeySpec::EccNistP521 => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::KeySpec::ECC_NIST_P521 {}, -aws_sdk_kms::types::KeySpec::EccSecgP256K1 => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::KeySpec::ECC_SECG_P256K1 {}, -aws_sdk_kms::types::KeySpec::SymmetricDefault => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::KeySpec::SYMMETRIC_DEFAULT {}, -aws_sdk_kms::types::KeySpec::Hmac224 => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::KeySpec::HMAC_224 {}, -aws_sdk_kms::types::KeySpec::Hmac256 => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::KeySpec::HMAC_256 {}, -aws_sdk_kms::types::KeySpec::Hmac384 => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::KeySpec::HMAC_384 {}, -aws_sdk_kms::types::KeySpec::Hmac512 => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::KeySpec::HMAC_512 {}, -aws_sdk_kms::types::KeySpec::Sm2 => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::KeySpec::SM2 {}, - _ => panic!("Unknown enum variant: {}", value), - }) -} - #[allow(dead_code)] -pub fn from_dafny( - dafny_value: &crate::r#software::amazon::cryptography::services::kms::internaldafny::types::KeySpec, -) -> aws_sdk_kms::types::KeySpec { - match dafny_value { - crate::r#software::amazon::cryptography::services::kms::internaldafny::types::KeySpec::RSA_2048 {} => aws_sdk_kms::types::KeySpec::Rsa2048, -crate::r#software::amazon::cryptography::services::kms::internaldafny::types::KeySpec::RSA_3072 {} => aws_sdk_kms::types::KeySpec::Rsa3072, -crate::r#software::amazon::cryptography::services::kms::internaldafny::types::KeySpec::RSA_4096 {} => aws_sdk_kms::types::KeySpec::Rsa4096, -crate::r#software::amazon::cryptography::services::kms::internaldafny::types::KeySpec::ECC_NIST_P256 {} => aws_sdk_kms::types::KeySpec::EccNistP256, -crate::r#software::amazon::cryptography::services::kms::internaldafny::types::KeySpec::ECC_NIST_P384 {} => aws_sdk_kms::types::KeySpec::EccNistP384, -crate::r#software::amazon::cryptography::services::kms::internaldafny::types::KeySpec::ECC_NIST_P521 {} => aws_sdk_kms::types::KeySpec::EccNistP521, -crate::r#software::amazon::cryptography::services::kms::internaldafny::types::KeySpec::ECC_SECG_P256K1 {} => aws_sdk_kms::types::KeySpec::EccSecgP256K1, -crate::r#software::amazon::cryptography::services::kms::internaldafny::types::KeySpec::SYMMETRIC_DEFAULT {} => aws_sdk_kms::types::KeySpec::SymmetricDefault, -crate::r#software::amazon::cryptography::services::kms::internaldafny::types::KeySpec::HMAC_224 {} => aws_sdk_kms::types::KeySpec::Hmac224, -crate::r#software::amazon::cryptography::services::kms::internaldafny::types::KeySpec::HMAC_256 {} => aws_sdk_kms::types::KeySpec::Hmac256, -crate::r#software::amazon::cryptography::services::kms::internaldafny::types::KeySpec::HMAC_384 {} => aws_sdk_kms::types::KeySpec::Hmac384, -crate::r#software::amazon::cryptography::services::kms::internaldafny::types::KeySpec::HMAC_512 {} => aws_sdk_kms::types::KeySpec::Hmac512, -crate::r#software::amazon::cryptography::services::kms::internaldafny::types::KeySpec::SM2 {} => aws_sdk_kms::types::KeySpec::Sm2, - } -} diff --git a/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/key_usage_type.rs b/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/key_usage_type.rs deleted file mode 100644 index 8d2db6b3c..000000000 --- a/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/key_usage_type.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] - -pub fn to_dafny( - value: aws_sdk_kms::types::KeyUsageType, -) -> ::std::rc::Rc{ - ::std::rc::Rc::new(match value { - aws_sdk_kms::types::KeyUsageType::SignVerify => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::KeyUsageType::SIGN_VERIFY {}, -aws_sdk_kms::types::KeyUsageType::EncryptDecrypt => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::KeyUsageType::ENCRYPT_DECRYPT {}, -aws_sdk_kms::types::KeyUsageType::GenerateVerifyMac => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::KeyUsageType::GENERATE_VERIFY_MAC {}, -aws_sdk_kms::types::KeyUsageType::KeyAgreement => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::KeyUsageType::KEY_AGREEMENT {}, - _ => panic!("Unknown enum variant: {}", value), - }) -} - #[allow(dead_code)] -pub fn from_dafny( - dafny_value: &crate::r#software::amazon::cryptography::services::kms::internaldafny::types::KeyUsageType, -) -> aws_sdk_kms::types::KeyUsageType { - match dafny_value { - crate::r#software::amazon::cryptography::services::kms::internaldafny::types::KeyUsageType::SIGN_VERIFY {} => aws_sdk_kms::types::KeyUsageType::SignVerify, -crate::r#software::amazon::cryptography::services::kms::internaldafny::types::KeyUsageType::ENCRYPT_DECRYPT {} => aws_sdk_kms::types::KeyUsageType::EncryptDecrypt, -crate::r#software::amazon::cryptography::services::kms::internaldafny::types::KeyUsageType::GENERATE_VERIFY_MAC {} => aws_sdk_kms::types::KeyUsageType::GenerateVerifyMac, -crate::r#software::amazon::cryptography::services::kms::internaldafny::types::KeyUsageType::KEY_AGREEMENT {} => aws_sdk_kms::types::KeyUsageType::KeyAgreement, - } -} diff --git a/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/origin_type.rs b/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/origin_type.rs deleted file mode 100644 index 8878e10fa..000000000 --- a/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/origin_type.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] - -pub fn to_dafny( - value: aws_sdk_kms::types::OriginType, -) -> ::std::rc::Rc{ - ::std::rc::Rc::new(match value { - aws_sdk_kms::types::OriginType::AwsKms => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::OriginType::AWS_KMS {}, -aws_sdk_kms::types::OriginType::External => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::OriginType::EXTERNAL {}, -aws_sdk_kms::types::OriginType::AwsCloudhsm => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::OriginType::AWS_CLOUDHSM {}, -aws_sdk_kms::types::OriginType::ExternalKeyStore => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::OriginType::EXTERNAL_KEY_STORE {}, - _ => panic!("Unknown enum variant: {}", value), - }) -} - #[allow(dead_code)] -pub fn from_dafny( - dafny_value: &crate::r#software::amazon::cryptography::services::kms::internaldafny::types::OriginType, -) -> aws_sdk_kms::types::OriginType { - match dafny_value { - crate::r#software::amazon::cryptography::services::kms::internaldafny::types::OriginType::AWS_KMS {} => aws_sdk_kms::types::OriginType::AwsKms, -crate::r#software::amazon::cryptography::services::kms::internaldafny::types::OriginType::EXTERNAL {} => aws_sdk_kms::types::OriginType::External, -crate::r#software::amazon::cryptography::services::kms::internaldafny::types::OriginType::AWS_CLOUDHSM {} => aws_sdk_kms::types::OriginType::AwsCloudhsm, -crate::r#software::amazon::cryptography::services::kms::internaldafny::types::OriginType::EXTERNAL_KEY_STORE {} => aws_sdk_kms::types::OriginType::ExternalKeyStore, - } -} diff --git a/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/re_encrypt.rs b/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/re_encrypt.rs deleted file mode 100644 index e44f75a15..000000000 --- a/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/re_encrypt.rs +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -pub mod _re_encrypt_request; - - pub mod _re_encrypt_response; - #[allow(dead_code)] -pub fn to_dafny_error( - value: &::aws_smithy_runtime_api::client::result::SdkError< - aws_sdk_kms::operation::re_encrypt::ReEncryptError, - ::aws_smithy_runtime_api::client::orchestrator::HttpResponse, - >, -) -> ::std::rc::Rc { - match value { - aws_sdk_kms::error::SdkError::ServiceError(service_error) => match service_error.err() { - aws_sdk_kms::operation::re_encrypt::ReEncryptError::DryRunOperationException(e) => - crate::conversions::error::dry_run_operation_exception::to_dafny(e.clone()), - aws_sdk_kms::operation::re_encrypt::ReEncryptError::NotFoundException(e) => - crate::conversions::error::not_found_exception::to_dafny(e.clone()), - aws_sdk_kms::operation::re_encrypt::ReEncryptError::DisabledException(e) => - crate::conversions::error::disabled_exception::to_dafny(e.clone()), - aws_sdk_kms::operation::re_encrypt::ReEncryptError::KmsInternalException(e) => - crate::conversions::error::kms_internal_exception::to_dafny(e.clone()), - aws_sdk_kms::operation::re_encrypt::ReEncryptError::KmsInvalidStateException(e) => - crate::conversions::error::kms_invalid_state_exception::to_dafny(e.clone()), - aws_sdk_kms::operation::re_encrypt::ReEncryptError::InvalidKeyUsageException(e) => - crate::conversions::error::invalid_key_usage_exception::to_dafny(e.clone()), - aws_sdk_kms::operation::re_encrypt::ReEncryptError::KeyUnavailableException(e) => - crate::conversions::error::key_unavailable_exception::to_dafny(e.clone()), - aws_sdk_kms::operation::re_encrypt::ReEncryptError::InvalidCiphertextException(e) => - crate::conversions::error::invalid_ciphertext_exception::to_dafny(e.clone()), - aws_sdk_kms::operation::re_encrypt::ReEncryptError::DependencyTimeoutException(e) => - crate::conversions::error::dependency_timeout_exception::to_dafny(e.clone()), - aws_sdk_kms::operation::re_encrypt::ReEncryptError::InvalidGrantTokenException(e) => - crate::conversions::error::invalid_grant_token_exception::to_dafny(e.clone()), - aws_sdk_kms::operation::re_encrypt::ReEncryptError::IncorrectKeyException(e) => - crate::conversions::error::incorrect_key_exception::to_dafny(e.clone()), - e => crate::conversions::error::to_opaque_error(e.to_string()), - }, - _ => { - crate::conversions::error::to_opaque_error(value.to_string()) - } - } -} diff --git a/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/re_encrypt/_re_encrypt_request.rs b/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/re_encrypt/_re_encrypt_request.rs deleted file mode 100644 index 32c8b5648..000000000 --- a/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/re_encrypt/_re_encrypt_request.rs +++ /dev/null @@ -1,116 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: &aws_sdk_kms::operation::re_encrypt::ReEncryptInput, -) -> ::std::rc::Rc< - crate::r#software::amazon::cryptography::services::kms::internaldafny::types::ReEncryptRequest, ->{ - ::std::rc::Rc::new(crate::r#software::amazon::cryptography::services::kms::internaldafny::types::ReEncryptRequest::ReEncryptRequest { - CiphertextBlob: crate::standard_library_conversions::oblob_to_dafny(&value.ciphertext_blob).Extract(), - SourceEncryptionContext: -::std::rc::Rc::new(match &value.source_encryption_context { - Some(x) => crate::r#_Wrappers_Compile::Option::Some { value : - ::dafny_runtime::dafny_runtime_conversions::hashmap_to_dafny_map(x, - |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&k), - |v| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&v), - ) - }, - None => crate::r#_Wrappers_Compile::Option::None {} -}) -, - SourceKeyId: crate::standard_library_conversions::ostring_to_dafny(&value.source_key_id), - DestinationKeyId: crate::standard_library_conversions::ostring_to_dafny(&value.destination_key_id) .Extract(), - DestinationEncryptionContext: -::std::rc::Rc::new(match &value.destination_encryption_context { - Some(x) => crate::r#_Wrappers_Compile::Option::Some { value : - ::dafny_runtime::dafny_runtime_conversions::hashmap_to_dafny_map(x, - |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&k), - |v| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&v), - ) - }, - None => crate::r#_Wrappers_Compile::Option::None {} -}) -, - SourceEncryptionAlgorithm: ::std::rc::Rc::new(match &value.source_encryption_algorithm { - Some(x) => crate::_Wrappers_Compile::Option::Some { value: crate::conversions::encryption_algorithm_spec::to_dafny(x.clone()) }, - None => crate::_Wrappers_Compile::Option::None { } -}) -, - DestinationEncryptionAlgorithm: ::std::rc::Rc::new(match &value.destination_encryption_algorithm { - Some(x) => crate::_Wrappers_Compile::Option::Some { value: crate::conversions::encryption_algorithm_spec::to_dafny(x.clone()) }, - None => crate::_Wrappers_Compile::Option::None { } -}) -, - GrantTokens: ::std::rc::Rc::new(match &value.grant_tokens { - Some(x) => crate::r#_Wrappers_Compile::Option::Some { value : - ::dafny_runtime::dafny_runtime_conversions::vec_to_dafny_sequence(x, - |e| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&e), - ) - }, - None => crate::r#_Wrappers_Compile::Option::None {} -}) -, - DryRun: crate::standard_library_conversions::obool_to_dafny(&value.dry_run), - }) -} - #[allow(dead_code)] -pub fn from_dafny( - dafny_value: ::std::rc::Rc< - crate::r#software::amazon::cryptography::services::kms::internaldafny::types::ReEncryptRequest, - >, - client: aws_sdk_kms::Client, -) -> aws_sdk_kms::operation::re_encrypt::builders::ReEncryptFluentBuilder { - client.re_encrypt() - .set_ciphertext_blob(Some(crate::standard_library_conversions::blob_from_dafny(dafny_value.CiphertextBlob().clone()))) - .set_source_encryption_context(match (*dafny_value.SourceEncryptionContext()).as_ref() { - crate::r#_Wrappers_Compile::Option::Some { value } => - Some( - ::dafny_runtime::dafny_runtime_conversions::dafny_map_to_hashmap(value, - |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(k), - |v| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(v), - ) - ), - _ => None -} -) - .set_source_key_id(crate::standard_library_conversions::ostring_from_dafny(dafny_value.SourceKeyId().clone())) - .set_destination_key_id(Some( dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(dafny_value.DestinationKeyId()) )) - .set_destination_encryption_context(match (*dafny_value.DestinationEncryptionContext()).as_ref() { - crate::r#_Wrappers_Compile::Option::Some { value } => - Some( - ::dafny_runtime::dafny_runtime_conversions::dafny_map_to_hashmap(value, - |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(k), - |v| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(v), - ) - ), - _ => None -} -) - .set_source_encryption_algorithm(match &**dafny_value.SourceEncryptionAlgorithm() { - crate::r#_Wrappers_Compile::Option::Some { value } => Some( - crate::conversions::encryption_algorithm_spec::from_dafny(value) - ), - _ => None, -} -) - .set_destination_encryption_algorithm(match &**dafny_value.DestinationEncryptionAlgorithm() { - crate::r#_Wrappers_Compile::Option::Some { value } => Some( - crate::conversions::encryption_algorithm_spec::from_dafny(value) - ), - _ => None, -} -) - .set_grant_tokens(match (*dafny_value.GrantTokens()).as_ref() { - crate::r#_Wrappers_Compile::Option::Some { value } => - Some( - ::dafny_runtime::dafny_runtime_conversions::dafny_sequence_to_vec(value, - |e| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(e), - ) - ), - _ => None -} -) - .set_dry_run(crate::standard_library_conversions::obool_from_dafny(dafny_value.DryRun().clone())) -} diff --git a/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/re_encrypt/_re_encrypt_response.rs b/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/re_encrypt/_re_encrypt_response.rs deleted file mode 100644 index ffad49c84..000000000 --- a/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/re_encrypt/_re_encrypt_response.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: &aws_sdk_kms::operation::re_encrypt::ReEncryptOutput -) -> ::std::rc::Rc< - crate::r#software::amazon::cryptography::services::kms::internaldafny::types::ReEncryptResponse, ->{ - ::std::rc::Rc::new(crate::r#software::amazon::cryptography::services::kms::internaldafny::types::ReEncryptResponse::ReEncryptResponse { - CiphertextBlob: crate::standard_library_conversions::oblob_to_dafny(&value.ciphertext_blob), - SourceKeyId: crate::standard_library_conversions::ostring_to_dafny(&value.source_key_id), - KeyId: crate::standard_library_conversions::ostring_to_dafny(&value.key_id), - SourceEncryptionAlgorithm: ::std::rc::Rc::new(match &value.source_encryption_algorithm { - Some(x) => crate::_Wrappers_Compile::Option::Some { value: crate::conversions::encryption_algorithm_spec::to_dafny(x.clone()) }, - None => crate::_Wrappers_Compile::Option::None { } -}) -, - DestinationEncryptionAlgorithm: ::std::rc::Rc::new(match &value.destination_encryption_algorithm { - Some(x) => crate::_Wrappers_Compile::Option::Some { value: crate::conversions::encryption_algorithm_spec::to_dafny(x.clone()) }, - None => crate::_Wrappers_Compile::Option::None { } -}) -, - }) -} - diff --git a/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/recipient_info.rs b/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/recipient_info.rs deleted file mode 100644 index 74b3baf75..000000000 --- a/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/recipient_info.rs +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: &aws_sdk_kms::types::RecipientInfo, -) -> ::std::rc::Rc{ - ::std::rc::Rc::new( - crate::r#software::amazon::cryptography::services::kms::internaldafny::types::RecipientInfo::RecipientInfo { - KeyEncryptionAlgorithm: ::std::rc::Rc::new(match &value.key_encryption_algorithm { - Some(x) => crate::_Wrappers_Compile::Option::Some { value: crate::conversions::key_encryption_mechanism::to_dafny(x.clone()) }, - None => crate::_Wrappers_Compile::Option::None { } -}) -, - AttestationDocument: crate::standard_library_conversions::oblob_to_dafny(&value.attestation_document), - } - ) -} #[allow(dead_code)] -pub fn from_dafny( - dafny_value: ::std::rc::Rc< - crate::r#software::amazon::cryptography::services::kms::internaldafny::types::RecipientInfo, - >, -) -> aws_sdk_kms::types::RecipientInfo { - aws_sdk_kms::types::RecipientInfo::builder() - .set_key_encryption_algorithm(match &**dafny_value.KeyEncryptionAlgorithm() { - crate::r#_Wrappers_Compile::Option::Some { value } => Some( - crate::conversions::key_encryption_mechanism::from_dafny(value) - ), - _ => None, -} -) - .set_attestation_document(crate::standard_library_conversions::oblob_from_dafny(dafny_value.AttestationDocument().clone())) - .build() - -} diff --git a/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/signing_algorithm_spec.rs b/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/signing_algorithm_spec.rs deleted file mode 100644 index 4fcc04f84..000000000 --- a/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/signing_algorithm_spec.rs +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] - -pub fn to_dafny( - value: aws_sdk_kms::types::SigningAlgorithmSpec, -) -> ::std::rc::Rc{ - ::std::rc::Rc::new(match value { - aws_sdk_kms::types::SigningAlgorithmSpec::RsassaPssSha256 => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::SigningAlgorithmSpec::RSASSA_PSS_SHA_256 {}, -aws_sdk_kms::types::SigningAlgorithmSpec::RsassaPssSha384 => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::SigningAlgorithmSpec::RSASSA_PSS_SHA_384 {}, -aws_sdk_kms::types::SigningAlgorithmSpec::RsassaPssSha512 => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::SigningAlgorithmSpec::RSASSA_PSS_SHA_512 {}, -aws_sdk_kms::types::SigningAlgorithmSpec::RsassaPkcs1V15Sha256 => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::SigningAlgorithmSpec::RSASSA_PKCS1_V1_5_SHA_256 {}, -aws_sdk_kms::types::SigningAlgorithmSpec::RsassaPkcs1V15Sha384 => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::SigningAlgorithmSpec::RSASSA_PKCS1_V1_5_SHA_384 {}, -aws_sdk_kms::types::SigningAlgorithmSpec::RsassaPkcs1V15Sha512 => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::SigningAlgorithmSpec::RSASSA_PKCS1_V1_5_SHA_512 {}, -aws_sdk_kms::types::SigningAlgorithmSpec::EcdsaSha256 => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::SigningAlgorithmSpec::ECDSA_SHA_256 {}, -aws_sdk_kms::types::SigningAlgorithmSpec::EcdsaSha384 => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::SigningAlgorithmSpec::ECDSA_SHA_384 {}, -aws_sdk_kms::types::SigningAlgorithmSpec::EcdsaSha512 => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::SigningAlgorithmSpec::ECDSA_SHA_512 {}, -aws_sdk_kms::types::SigningAlgorithmSpec::Sm2Dsa => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::SigningAlgorithmSpec::SM2DSA {}, - _ => panic!("Unknown enum variant: {}", value), - }) -} - #[allow(dead_code)] -pub fn from_dafny( - dafny_value: &crate::r#software::amazon::cryptography::services::kms::internaldafny::types::SigningAlgorithmSpec, -) -> aws_sdk_kms::types::SigningAlgorithmSpec { - match dafny_value { - crate::r#software::amazon::cryptography::services::kms::internaldafny::types::SigningAlgorithmSpec::RSASSA_PSS_SHA_256 {} => aws_sdk_kms::types::SigningAlgorithmSpec::RsassaPssSha256, -crate::r#software::amazon::cryptography::services::kms::internaldafny::types::SigningAlgorithmSpec::RSASSA_PSS_SHA_384 {} => aws_sdk_kms::types::SigningAlgorithmSpec::RsassaPssSha384, -crate::r#software::amazon::cryptography::services::kms::internaldafny::types::SigningAlgorithmSpec::RSASSA_PSS_SHA_512 {} => aws_sdk_kms::types::SigningAlgorithmSpec::RsassaPssSha512, -crate::r#software::amazon::cryptography::services::kms::internaldafny::types::SigningAlgorithmSpec::RSASSA_PKCS1_V1_5_SHA_256 {} => aws_sdk_kms::types::SigningAlgorithmSpec::RsassaPkcs1V15Sha256, -crate::r#software::amazon::cryptography::services::kms::internaldafny::types::SigningAlgorithmSpec::RSASSA_PKCS1_V1_5_SHA_384 {} => aws_sdk_kms::types::SigningAlgorithmSpec::RsassaPkcs1V15Sha384, -crate::r#software::amazon::cryptography::services::kms::internaldafny::types::SigningAlgorithmSpec::RSASSA_PKCS1_V1_5_SHA_512 {} => aws_sdk_kms::types::SigningAlgorithmSpec::RsassaPkcs1V15Sha512, -crate::r#software::amazon::cryptography::services::kms::internaldafny::types::SigningAlgorithmSpec::ECDSA_SHA_256 {} => aws_sdk_kms::types::SigningAlgorithmSpec::EcdsaSha256, -crate::r#software::amazon::cryptography::services::kms::internaldafny::types::SigningAlgorithmSpec::ECDSA_SHA_384 {} => aws_sdk_kms::types::SigningAlgorithmSpec::EcdsaSha384, -crate::r#software::amazon::cryptography::services::kms::internaldafny::types::SigningAlgorithmSpec::ECDSA_SHA_512 {} => aws_sdk_kms::types::SigningAlgorithmSpec::EcdsaSha512, -crate::r#software::amazon::cryptography::services::kms::internaldafny::types::SigningAlgorithmSpec::SM2DSA {} => aws_sdk_kms::types::SigningAlgorithmSpec::Sm2Dsa, - } -} diff --git a/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/update_primary_region.rs b/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/update_primary_region.rs deleted file mode 100644 index 3d5c910e0..000000000 --- a/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/update_primary_region.rs +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -pub mod _update_primary_region_request; - - pub mod _update_primary_region_response; - #[allow(dead_code)] -pub fn to_dafny_error( - value: &::aws_smithy_runtime_api::client::result::SdkError< - aws_sdk_kms::operation::update_primary_region::UpdatePrimaryRegionError, - ::aws_smithy_runtime_api::client::orchestrator::HttpResponse, - >, -) -> ::std::rc::Rc { - match value { - aws_sdk_kms::error::SdkError::ServiceError(service_error) => match service_error.err() { - aws_sdk_kms::operation::update_primary_region::UpdatePrimaryRegionError::NotFoundException(e) => - crate::conversions::error::not_found_exception::to_dafny(e.clone()), - aws_sdk_kms::operation::update_primary_region::UpdatePrimaryRegionError::DisabledException(e) => - crate::conversions::error::disabled_exception::to_dafny(e.clone()), - aws_sdk_kms::operation::update_primary_region::UpdatePrimaryRegionError::InvalidArnException(e) => - crate::conversions::error::invalid_arn_exception::to_dafny(e.clone()), - aws_sdk_kms::operation::update_primary_region::UpdatePrimaryRegionError::UnsupportedOperationException(e) => - crate::conversions::error::unsupported_operation_exception::to_dafny(e.clone()), - aws_sdk_kms::operation::update_primary_region::UpdatePrimaryRegionError::KmsInternalException(e) => - crate::conversions::error::kms_internal_exception::to_dafny(e.clone()), - aws_sdk_kms::operation::update_primary_region::UpdatePrimaryRegionError::KmsInvalidStateException(e) => - crate::conversions::error::kms_invalid_state_exception::to_dafny(e.clone()), - e => crate::conversions::error::to_opaque_error(e.to_string()), - }, - _ => { - crate::conversions::error::to_opaque_error(value.to_string()) - } - } -} diff --git a/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/update_primary_region/_update_primary_region_request.rs b/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/update_primary_region/_update_primary_region_request.rs deleted file mode 100644 index a44fcb0fd..000000000 --- a/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/update_primary_region/_update_primary_region_request.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: &aws_sdk_kms::operation::update_primary_region::UpdatePrimaryRegionInput, -) -> ::std::rc::Rc< - crate::r#software::amazon::cryptography::services::kms::internaldafny::types::UpdatePrimaryRegionRequest, ->{ - ::std::rc::Rc::new(crate::r#software::amazon::cryptography::services::kms::internaldafny::types::UpdatePrimaryRegionRequest::UpdatePrimaryRegionRequest { - KeyId: crate::standard_library_conversions::ostring_to_dafny(&value.key_id) .Extract(), - PrimaryRegion: crate::standard_library_conversions::ostring_to_dafny(&value.primary_region) .Extract(), - }) -} - #[allow(dead_code)] -pub fn from_dafny( - dafny_value: ::std::rc::Rc< - crate::r#software::amazon::cryptography::services::kms::internaldafny::types::UpdatePrimaryRegionRequest, - >, - client: aws_sdk_kms::Client, -) -> aws_sdk_kms::operation::update_primary_region::builders::UpdatePrimaryRegionFluentBuilder { - client.update_primary_region() - .set_key_id(Some( dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(dafny_value.KeyId()) )) - .set_primary_region(Some( dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(dafny_value.PrimaryRegion()) )) -} diff --git a/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/update_primary_region/_update_primary_region_response.rs b/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/update_primary_region/_update_primary_region_response.rs deleted file mode 100644 index 8aad303fd..000000000 --- a/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/update_primary_region/_update_primary_region_response.rs +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - _value: &aws_sdk_kms::operation::update_primary_region::UpdatePrimaryRegionOutput -) -> () { - () -} - diff --git a/TestModels/aws-sdks/kms-lite/runtimes/rust/src/standard_library_conversions.rs b/TestModels/aws-sdks/kms-lite/runtimes/rust/src/standard_library_conversions.rs deleted file mode 100644 index 6bf8297d8..000000000 --- a/TestModels/aws-sdks/kms-lite/runtimes/rust/src/standard_library_conversions.rs +++ /dev/null @@ -1,266 +0,0 @@ -pub fn ostring_to_dafny( - input: &Option, -) -> ::std::rc::Rc< - crate::_Wrappers_Compile::Option<::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>>, -> { - let dafny_value = match input { - Some(b) => crate::_Wrappers_Compile::Option::Some { value: - dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&b) - }, - None => crate::_Wrappers_Compile::Option::None {}, -}; - ::std::rc::Rc::new(dafny_value) -} - -pub fn ostring_from_dafny( - input: ::std::rc::Rc< - crate::_Wrappers_Compile::Option< - ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, - >, - >, -) -> Option { - if matches!( - input.as_ref(), - crate::_Wrappers_Compile::Option::Some { .. } - ) { - Some( - dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string( - &input.Extract(), - ), - ) - } else { - None - } -} - -pub fn obool_to_dafny( - input: &Option, -) -> ::std::rc::Rc> { - let dafny_value = match input { - Some(b) => crate::_Wrappers_Compile::Option::Some { value: *b }, - None => crate::_Wrappers_Compile::Option::None {}, - }; - ::std::rc::Rc::new(dafny_value) -} - -pub fn obool_from_dafny( - input: ::std::rc::Rc>, -) -> Option { - if matches!( - input.as_ref(), - crate::_Wrappers_Compile::Option::Some { .. } - ) { - Some(input.Extract()) - } else { - None - } -} - -pub fn oint_to_dafny(input: Option) -> ::std::rc::Rc> { - let dafny_value = match input { - Some(b) => crate::_Wrappers_Compile::Option::Some { value: b }, - None => crate::_Wrappers_Compile::Option::None {}, - }; - ::std::rc::Rc::new(dafny_value) -} - -pub fn oint_from_dafny(input: ::std::rc::Rc>) -> Option { - if matches!( - input.as_ref(), - crate::_Wrappers_Compile::Option::Some { .. } - ) { - Some(input.Extract()) - } else { - None - } -} - -pub fn olong_to_dafny(input: &Option) -> ::std::rc::Rc> { - let dafny_value = match input { - Some(b) => crate::_Wrappers_Compile::Option::Some { value: *b }, - None => crate::_Wrappers_Compile::Option::None {}, - }; - ::std::rc::Rc::new(dafny_value) -} - -pub fn olong_from_dafny( - input: ::std::rc::Rc>, -) -> Option { - if matches!( - input.as_ref(), - crate::_Wrappers_Compile::Option::Some { .. } - ) { - Some(input.Extract()) - } else { - None - } -} - -pub fn blob_to_dafny(input: &::aws_smithy_types::Blob) -> ::dafny_runtime::Sequence { - ::dafny_runtime::dafny_runtime_conversions::vec_to_dafny_sequence(&input.clone().into_inner(), |x| *x) -} - -pub fn oblob_to_dafny( - input: &Option<::aws_smithy_types::Blob>, -) -> ::std::rc::Rc>> { - let dafny_value = match input { - Some(b) => crate::_Wrappers_Compile::Option::Some { - value: blob_to_dafny(&b), - }, - None => crate::_Wrappers_Compile::Option::None {}, - }; - ::std::rc::Rc::new(dafny_value) -} - -pub fn blob_from_dafny(input: ::dafny_runtime::Sequence) -> ::aws_smithy_types::Blob { - ::aws_smithy_types::Blob::new( - ::std::rc::Rc::try_unwrap(input.to_array()).unwrap_or_else(|rc| (*rc).clone()), - ) -} - -pub fn oblob_from_dafny( - input: ::std::rc::Rc>>, -) -> Option<::aws_smithy_types::Blob> { - if matches!( - input.as_ref(), - crate::_Wrappers_Compile::Option::Some { .. } - ) { - Some(blob_from_dafny(input.Extract())) - } else { - None - } -} - -pub fn double_to_dafny(input: f64) -> ::dafny_runtime::Sequence { - ::dafny_runtime::dafny_runtime_conversions::vec_to_dafny_sequence( - &f64::to_be_bytes(input).to_vec(), - |x| *x, - ) -} - -pub fn odouble_to_dafny( - input: &Option, -) -> ::std::rc::Rc>> { - let dafny_value = match input { - Some(f) => crate::_Wrappers_Compile::Option::Some { - value: double_to_dafny(*f), - }, - None => crate::_Wrappers_Compile::Option::None {}, - }; - ::std::rc::Rc::new(dafny_value) -} - -pub fn double_from_dafny(input: &::dafny_runtime::Sequence) -> f64 { - let v = ::dafny_runtime::dafny_runtime_conversions::dafny_sequence_to_vec(input, |x| *x); - f64::from_be_bytes(v.try_into().expect("Error converting Sequence to f64")) -} - -pub fn odouble_from_dafny( - input: ::std::rc::Rc>>, -) -> Option { - if matches!( - input.as_ref(), - crate::_Wrappers_Compile::Option::Some { .. } - ) { - Some(double_from_dafny(&input.Extract())) - } else { - None - } -} - -pub fn timestamp_to_dafny( - input: &::aws_smithy_types::DateTime, -) -> ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16> { - ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string( - &input.to_string(), - ) -} - -pub fn otimestamp_to_dafny( - input: &Option<::aws_smithy_types::DateTime>, -) -> ::std::rc::Rc< - crate::_Wrappers_Compile::Option<::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>>, -> { - let dafny_value = match input { - Some(f) => crate::_Wrappers_Compile::Option::Some { - value: timestamp_to_dafny(f), - }, - None => crate::_Wrappers_Compile::Option::None {}, - }; - ::std::rc::Rc::new(dafny_value) -} - -pub fn timestamp_from_dafny( - input: ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, -) -> ::aws_smithy_types::DateTime { - let s = dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string( - &input, - ); - ::aws_smithy_types::DateTime::from_str(&s, aws_smithy_types::date_time::Format::DateTime) - .unwrap() -} - -pub fn otimestamp_from_dafny( - input: ::std::rc::Rc< - crate::_Wrappers_Compile::Option< - ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, - >, - >, -) -> Option<::aws_smithy_types::DateTime> { - if matches!( - input.as_ref(), - crate::_Wrappers_Compile::Option::Some { .. } - ) { - Some(timestamp_from_dafny(input.Extract())) - } else { - None - } -} - -pub fn option_from_dafny( - input: ::std::rc::Rc>, - converter: fn(&T) -> TR, -) -> Option { - match &*input { - crate::_Wrappers_Compile::Option::Some { value } => Some(converter(value)), - crate::_Wrappers_Compile::Option::None {} => None, - } -} - -pub fn option_to_dafny( - input: &Option, - converter: fn(&TR) -> T, -) -> ::std::rc::Rc> { - match input { - Some(value) => ::std::rc::Rc::new(crate::_Wrappers_Compile::Option::Some { - value: converter(&value), - }), - None => ::std::rc::Rc::new(crate::_Wrappers_Compile::Option::None {}), - } -} - -pub fn result_from_dafny( - input: ::std::rc::Rc>, - converter_t: fn(&T) -> TR, - converter_e: fn(&E) -> ER, -) -> Result { - match &*input { - crate::_Wrappers_Compile::Result::Success { value } => Ok(converter_t(value)), - crate::_Wrappers_Compile::Result::Failure { error } => Err(converter_e(error)), - } -} - -pub fn result_to_dafny( - input: &Result, - converter_t: fn(&TR) -> T, - converter_e: fn(&ER) -> E, -) -> ::std::rc::Rc> { - match input { - Ok(value) => ::std::rc::Rc::new(crate::_Wrappers_Compile::Result::Success { - value: converter_t(&value), - }), - Err(error) => ::std::rc::Rc::new(crate::_Wrappers_Compile::Result::Failure { - error: converter_e(&error), - }), - } -} diff --git a/TestModels/aws-sdks/kms-lite/runtimes/rust/src/standard_library_externs.rs b/TestModels/aws-sdks/kms-lite/runtimes/rust/src/standard_library_externs.rs deleted file mode 100644 index eca6a2980..000000000 --- a/TestModels/aws-sdks/kms-lite/runtimes/rust/src/standard_library_externs.rs +++ /dev/null @@ -1,80 +0,0 @@ -// Annotation to ignore the case of this module -use crate::r#_Wrappers_Compile; -use crate::UTF8; - -impl crate::UTF8::_default { - pub fn Encode( - s: &::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, - ) -> ::std::rc::Rc< - r#_Wrappers_Compile::Result< - UTF8::ValidUTF8Bytes, - ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, - >, - > { - let v = s.to_array(); - let mut _accumulator: Vec = vec![]; - // Use of .encode_utf8 method. - let mut surrogate: Option = None; - for c in v.iter() { - let s = if let Some(s) = surrogate { - String::from_utf16(&[s, c.0]) - } else { - String::from_utf16(&[c.0]) - }; - surrogate = None; - match s { - Ok(value) => { - _accumulator.extend(value.as_bytes()); - continue; - } - Err(e) => { - if 0xD800 <= c.0 && c.0 <= 0xDFFF { - surrogate = Some(c.0); - continue; - } - return ::std::rc::Rc::new(r#_Wrappers_Compile::Result::>::Failure { - error: ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string( - &e.to_string()) - }); - } - } - } - if let Some(s) = surrogate { - return ::std::rc::Rc::new(r#_Wrappers_Compile::Result::>::Failure { - error: ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string( - &format!("Surrogate pair missing: 0x{:04x}", s)) - }); - } - ::std::rc::Rc::new(r#_Wrappers_Compile::Result::< - UTF8::ValidUTF8Bytes, - ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, - >::Success { - value: ::dafny_runtime::Sequence::from_array_owned(_accumulator), - }) - } - pub fn Decode( - b: &::dafny_runtime::Sequence, - ) -> ::std::rc::Rc< - r#_Wrappers_Compile::Result< - ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, - ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, - >, - > { - let b = String::from_utf8(b.to_array().as_ref().clone()); - match b { - Ok(s) => { - ::std::rc::Rc::new(r#_Wrappers_Compile::Result::<::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, - ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>>::Success { - value: ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&s) - }) - }, - Err(e) => { - return ::std::rc::Rc::new(r#_Wrappers_Compile::Result::<::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, - ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>>::Failure { - error: ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string( - &e.to_string()) - }) - } - } - } -} diff --git a/TestModels/aws-sdks/kms/Makefile b/TestModels/aws-sdks/kms/Makefile index 87e4a5a70..989da590d 100644 --- a/TestModels/aws-sdks/kms/Makefile +++ b/TestModels/aws-sdks/kms/Makefile @@ -17,6 +17,8 @@ NAMESPACE=com.amazonaws.kms PROJECT_SERVICES := \ ComAmazonawsKms\ +MAIN_SERVICE_FOR_RUST := ComAmazonawsKms + SERVICE_NAMESPACE_ComAmazonawsKms=com.amazonaws.kms SERVICE_DEPS_ComAmazonawsKms := diff --git a/TestModels/dafny-dependencies/StandardLibrary/Makefile b/TestModels/dafny-dependencies/StandardLibrary/Makefile index 5c3f69c63..5157bbad3 100644 --- a/TestModels/dafny-dependencies/StandardLibrary/Makefile +++ b/TestModels/dafny-dependencies/StandardLibrary/Makefile @@ -34,21 +34,21 @@ polymorph_dafny : --dependent-model $(PROJECT_ROOT)/$(STD_LIBRARY)/../Model \ "; -polymorph_dotnet : +polymorph_dotnet: echo "Skipping polymorph_dotnet for StandardLibrary" -polymorph_java : +polymorph_java: echo "Skipping polymorph_java for StandardLibrary" -polymorph_python : +polymorph_python: echo "Skipping polymorph_python for StandardLibrary" -# Using this target for the side-effect of maintaining patches, -# Since Dafny Rust code generation is incomplete and also needs to be patched. -# That only works if you run transpile_rust first. -polymorph_rust : +polymorph_rust: echo "Skipping polymorph_rust for StandardLibrary" +patch_after_transpile_rust: + echo "Skipping patch_after_transpile_rust for StandardLibrary" + _polymorph_dependencies: echo "Skipping _polymorph_dependencies for StandardLibrary" @@ -71,6 +71,12 @@ transpile_rust: | transpile_implementation_rust RUST_OTHER_FILES=runtimes/rust/src/conversion.rs runtimes/rust/src/UTF8_externs.rs +# These are necessary just for the patch_after_transpile_rust target +MAIN_SERVICE_FOR_RUST := StandardLibrary +SERVICE_NAMESPACE_StandardLibrary=aws.polymorph +SERVICE_DEPS_StandardLibrary := +SMITHY_DEPS=dafny-dependencies/Model/traits.smithy + # Override this target to not insert a dependency on the standard library. _mv_implementation_rust: mv implementation_from_dafny-rust/src/implementation_from_dafny.rs runtimes/rust/src/implementation_from_dafny.rs diff --git a/TestModels/dafny-dependencies/dafny_runtime_rust/src/lib.rs b/TestModels/dafny-dependencies/dafny_runtime_rust/src/lib.rs index 408a0af13..80ac2084b 100644 --- a/TestModels/dafny-dependencies/dafny_runtime_rust/src/lib.rs +++ b/TestModels/dafny-dependencies/dafny_runtime_rust/src/lib.rs @@ -87,7 +87,7 @@ pub mod dafny_runtime_conversions { pub fn boxed_struct_to_dafny_class(t: Box) -> DafnyClass { struct_to_dafny_class(*t) } - pub unsafe fn rc_struct_to_dafny_class(t: ::std::rc::Rc) -> DafnyClass { + pub unsafe fn rc_struct_to_dafny_class(t: ::std::rc::Rc) -> DafnyClass { crate::Object::from_rc(t) } // Conversions to and from Dafny arrays. They all take ownership diff --git a/codegen/smithy-dafny-codegen-cli/src/main/java/software/amazon/polymorph/CodegenCli.java b/codegen/smithy-dafny-codegen-cli/src/main/java/software/amazon/polymorph/CodegenCli.java index 9f57eda40..1499c542c 100644 --- a/codegen/smithy-dafny-codegen-cli/src/main/java/software/amazon/polymorph/CodegenCli.java +++ b/codegen/smithy-dafny-codegen-cli/src/main/java/software/amazon/polymorph/CodegenCli.java @@ -8,6 +8,7 @@ import java.util.Arrays; import java.util.Collections; import java.util.HashMap; +import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Optional; @@ -126,14 +127,28 @@ public static void main(String[] args) { .withServiceModel(serviceModel) .withDependentModelPaths(cliArguments.dependentModelPaths) .withDependencyLibraryNames(cliArguments.dependencyLibraryNames) - .withNamespace(cliArguments.namespace) + .withNamespaces(cliArguments.namespaces) .withTargetLangOutputDirs(outputDirs) .withTargetLangTestOutputDirs(testOutputDirs) .withAwsSdkStyle(cliArguments.awsSdkStyle) - .withLocalServiceTest(cliArguments.localServiceTest) .withDafnyVersion(cliArguments.dafnyVersion) .withUpdatePatchFiles(cliArguments.updatePatchFiles) .withGenerationAspects(cliArguments.generationAspects); + // Rust currently generates all code for all dependencies at once, + // and the makefile structure makes it very difficult to avoid passing --local-service-test + // when we don't actually want it for --aws-sdk style projects. + // For now just ignoring it with a warning. + if ( + outputDirs.containsKey(TargetLanguage.RUST) && + cliArguments.awsSdkStyle && + cliArguments.localServiceTest + ) { + LOGGER.warn( + "Ignoring --local-service-test because --output-rust and --aws-sdk are also present" + ); + } else { + engineBuilder.withLocalServiceTest(cliArguments.localServiceTest); + } cliArguments.propertiesFile.ifPresent(engineBuilder::withPropertiesFile); cliArguments.javaAwsSdkVersion.ifPresent( engineBuilder::withJavaAwsSdkVersion @@ -198,7 +213,7 @@ private static Options getCliOptionsForBuild() { .longOpt("namespace") .desc("smithy namespace to generate code for, such as 'com.foo'") .hasArg() - .required() + .valueSeparator(',') .build() ) .addOption( @@ -418,6 +433,13 @@ private static Options getCliOptionsForPatchAfterTranspile() { .hasArgs() .valueSeparator(',') .build() + ) + .addOption( + Option + .builder() + .longOpt("local-service-test") + .desc(" generate Dafny that tests a local service") + .build() ); } @@ -440,7 +462,7 @@ private record CliArguments( Path modelPath, Path[] dependentModelPaths, Map dependencyLibraryNames, - String namespace, + Set namespaces, Optional libraryName, Optional outputDotnetDir, Optional outputJavaDir, @@ -512,7 +534,10 @@ static Optional parse(String[] args) throws ParseException { .collect(Collectors.toMap(i -> i[0], i -> i[1])) : new HashMap<>(); - final String namespace = commandLine.getOptionValue('n'); + final Set namespaces = Optional + .ofNullable(commandLine.getOptionValues("namespace")) + .>map(ns -> new HashSet<>(Arrays.asList(ns))) + .orElse(Collections.emptySet()); final Optional libraryName = Optional.ofNullable( commandLine.getOptionValue("library-name") @@ -606,7 +631,7 @@ static Optional parse(String[] args) throws ParseException { modelPath, dependentModelPaths, dependencyNamespacesToLibraryNamesMap, - namespace, + namespaces, libraryName, outputDotnetDir, outputJavaDir, diff --git a/codegen/smithy-dafny-codegen-test/src/test/java/software/amazon/polymorph/smithypython/PythonTestModels.java b/codegen/smithy-dafny-codegen-test/src/test/java/software/amazon/polymorph/smithypython/PythonTestModels.java index 851310fe3..05cbbc04c 100644 --- a/codegen/smithy-dafny-codegen-test/src/test/java/software/amazon/polymorph/smithypython/PythonTestModels.java +++ b/codegen/smithy-dafny-codegen-test/src/test/java/software/amazon/polymorph/smithypython/PythonTestModels.java @@ -18,6 +18,7 @@ class PythonTestModels extends TestModelTest { static { DISABLED_TESTS.add("AggregateReferences"); DISABLED_TESTS.add("LanguageSpecificLogic"); + DISABLED_TESTS.add("MultipleModels"); DISABLED_TESTS.add("SimpleTypes/BigDecimal"); DISABLED_TESTS.add("SimpleTypes/BigInteger"); DISABLED_TESTS.add("SimpleTypes/SimpleByte"); diff --git a/codegen/smithy-dafny-codegen-test/src/test/java/software/amazon/polymorph/smithyrust/RustTestModels.java b/codegen/smithy-dafny-codegen-test/src/test/java/software/amazon/polymorph/smithyrust/RustTestModels.java index 7eea6a965..5acc2f78e 100644 --- a/codegen/smithy-dafny-codegen-test/src/test/java/software/amazon/polymorph/smithyrust/RustTestModels.java +++ b/codegen/smithy-dafny-codegen-test/src/test/java/software/amazon/polymorph/smithyrust/RustTestModels.java @@ -23,7 +23,6 @@ class RustTestModels extends TestModelTest { DISABLED_TESTS.add("Documentation"); DISABLED_TESTS.add("Extendable"); DISABLED_TESTS.add("Extern"); - DISABLED_TESTS.add("MultipleModels"); DISABLED_TESTS.add("SimpleTypes/BigDecimal"); DISABLED_TESTS.add("SimpleTypes/BigInteger"); DISABLED_TESTS.add("SimpleTypes/SimpleByte"); diff --git a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/CodegenEngine.java b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/CodegenEngine.java index 6f83c0ec8..08b3a2ac8 100644 --- a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/CodegenEngine.java +++ b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/CodegenEngine.java @@ -7,6 +7,7 @@ import com.google.common.base.Strings; import com.google.common.collect.ImmutableMap; +import com.google.common.collect.MoreCollectors; import com.google.common.collect.Streams; import com.squareup.javapoet.ClassName; import java.io.IOException; @@ -51,6 +52,8 @@ import software.amazon.polymorph.smithypython.awssdk.extensions.DafnyPythonAwsSdkClientCodegenPlugin; import software.amazon.polymorph.smithypython.localservice.extensions.DafnyPythonLocalServiceClientCodegenPlugin; import software.amazon.polymorph.smithypython.wrappedlocalservice.extensions.DafnyPythonWrappedLocalServiceClientCodegenPlugin; +import software.amazon.polymorph.smithyrust.generator.AbstractRustShimGenerator; +import software.amazon.polymorph.smithyrust.generator.MergedServicesGenerator; import software.amazon.polymorph.smithyrust.generator.RustAwsSdkShimGenerator; import software.amazon.polymorph.smithyrust.generator.RustLibraryShimGenerator; import software.amazon.polymorph.traits.LocalServiceTrait; @@ -78,7 +81,7 @@ public class CodegenEngine { private final boolean fromSmithyBuildPlugin; private final Path libraryRoot; private final Path[] dependentModelPaths; - private final String namespace; + private final Set namespaces; private final Map targetLangOutputDirs; private final Map targetLangTestOutputDirs; private final DafnyVersion dafnyVersion; @@ -107,7 +110,7 @@ private CodegenEngine( final boolean fromSmithyBuildPlugin, final Model serviceModel, final Path[] dependentModelPaths, - final String namespace, + final Set namespaces, final Map targetLangOutputDirs, final Map targetLangTestOutputDirs, final DafnyVersion dafnyVersion, @@ -126,7 +129,7 @@ private CodegenEngine( // To be provided to constructor this.fromSmithyBuildPlugin = fromSmithyBuildPlugin; this.dependentModelPaths = dependentModelPaths; - this.namespace = namespace; + this.namespaces = namespaces; this.targetLangOutputDirs = targetLangOutputDirs; this.targetLangTestOutputDirs = targetLangTestOutputDirs; this.dafnyVersion = dafnyVersion; @@ -148,8 +151,13 @@ private CodegenEngine( ? ModelUtils.addMissingErrorMessageMembers(serviceModel) : serviceModel; + // TODO: This should not be used by Rust since it supports (or really requires) + // generating for multiple namespaces. this.serviceShape = - ModelUtils.serviceFromNamespace(this.model, this.namespace); + ModelUtils.serviceFromNamespace( + this.model, + this.namespaces.stream().findFirst().get() + ); } /** @@ -678,20 +686,21 @@ private void generateRust(final Path outputDir) { "Rust code generation is incomplete and may not function correctly!" ); - if (awsSdkStyle) { - RustAwsSdkShimGenerator generator = new RustAwsSdkShimGenerator( - model, - serviceShape, - generationAspects - ); - generator.generate(outputDir); - } else { - RustLibraryShimGenerator generator = new RustLibraryShimGenerator( - model, - serviceShape - ); - generator.generate(outputDir); - } + // TODO: Can't get makefile working yet + final var namespacesToGenerate = model + .getServiceShapes() + .stream() + .map(s -> s.getId().getNamespace()) + .collect(Collectors.toSet()); + + final MergedServicesGenerator generator = new MergedServicesGenerator( + model, + serviceShape, + namespacesToGenerate, + localServiceTest, + generationAspects + ); + generator.generateAllNamespaces(outputDir); // TODO: These should be part of the StandardLibrary instead, // but since the Dafny Rust code generator doesn't yet support multiple crates, @@ -842,10 +851,36 @@ public void patchAfterTranspiling() { } } + private static final TokenTree EXTRA_SINGLE_CRATE_DECLARATIONS = TokenTree.of( + """ + mod standard_library_conversions; + mod standard_library_externs; + """ + ); + private void patchRustAfterTranspiling() { - final String extraDeclarations = awsSdkStyle - ? extraDeclarationsForSDK() - : extraDeclarationsForLocalService(); + final MergedServicesGenerator generator = new MergedServicesGenerator( + model, + serviceShape, + namespaces, + localServiceTest, + generationAspects + ); + + final TokenTree extraRootServiceDeclarations = generator + .generatorForShape(serviceShape) + .topLevelModuleDeclarations(); + String extraDeclarations = TokenTree + .of(extraRootServiceDeclarations, EXTRA_SINGLE_CRATE_DECLARATIONS) + .lineSeparated() + .toString(); + if (!awsSdkStyle && serviceShape.hasTrait(LocalServiceTrait.class)) { + extraDeclarations = + extraDeclarations + + System.lineSeparator() + + extraTopLevelDeclarationsForLocalService(serviceShape) + + System.lineSeparator(); + } final Path implementationFromDafnyPath = libraryRoot .resolve("runtimes") .resolve("rust") @@ -867,15 +902,9 @@ private void patchRustAfterTranspiling() { } } - private String extraDeclarationsForSDK() { - return """ - mod client; - mod conversions; - mod standard_library_conversions; - """; - } - - private String extraDeclarationsForLocalService() { + private String extraTopLevelDeclarationsForLocalService( + ServiceShape serviceShape + ) { final String configStructName = serviceShape .expectTrait(LocalServiceTrait.class) .getConfigId() @@ -884,35 +913,16 @@ private String extraDeclarationsForLocalService() { return IOUtils.evalTemplate( """ - // (extra-declarations) - - pub mod client; - pub mod types; - - /// Common errors and error handling utilities. - pub mod error; - - /// All operations that this crate can perform. - pub mod operation; - - mod conversions; - - /// Copied from StandardLibrary - mod standard_library_conversions; - mod standard_library_externs; - - #[cfg(feature = "wrapped-client")] - pub mod wrapped; - pub use client::Client; pub use types::$configSnakeCase:L::$configStructName:L; - """, Map.of( "configSnakeCase", configSnakeCase, "configStructName", - configStructName + configStructName, + "sharedTopLevelDecls", + RustLibraryShimGenerator.TOP_LEVEL_MOD_DECLS ) ); } @@ -988,7 +998,7 @@ public static class Builder { private boolean fromSmithyBuildPlugin = false; private Model serviceModel; private Path[] dependentModelPaths; - private String namespace; + private Set namespaces; private Map targetLangOutputDirs = Collections.emptyMap(); private Map targetLangTestOutputDirs = @@ -1025,10 +1035,10 @@ public Builder withDependentModelPaths(final Path[] dependentModelPaths) { } /** - * Sets the Smithy namespace for which to generate code (e.g. "com.foo"). + * Sets the Smithy namespaces for which to generate code (e.g. "com.foo"). */ - public Builder withNamespace(final String namespace) { - this.namespace = namespace; + public Builder withNamespaces(final Set namespaces) { + this.namespaces = namespaces; return this; } @@ -1182,12 +1192,27 @@ public Builder withUpdatePatchFiles(final boolean updatePatchFiles) { public CodegenEngine build() { final Model serviceModel = Objects.requireNonNull(this.serviceModel); + + if (this.namespaces.isEmpty()) { + throw new IllegalStateException( + "at least one namespace must be provided" + ); + } + if (this.namespaces.size() > 1) { + for (final TargetLanguage targetLanguage : this.targetLangOutputDirs.keySet()) { + if (!targetLanguage.equals(TargetLanguage.RUST)) { + throw new IllegalStateException( + "generating for %s does not support multiple namespaces".formatted( + targetLanguage + ) + ); + } + } + } + final Path[] dependentModelPaths = this.dependentModelPaths == null ? new Path[] {} : this.dependentModelPaths.clone(); - if (Strings.isNullOrEmpty(this.namespace)) { - throw new IllegalStateException("No namespace provided"); - } final Map dependencyLibraryNames = this.dependencyLibraryNames == null @@ -1257,7 +1282,7 @@ public CodegenEngine build() { fromSmithyBuildPlugin, serviceModel, dependentModelPaths, - this.namespace, + this.namespaces, targetLangOutputDirs, targetLangTestOutputDirs, dafnyVersion, diff --git a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyrust/generator/AbstractRustShimGenerator.java b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyrust/generator/AbstractRustShimGenerator.java index 035367936..f547299c1 100644 --- a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyrust/generator/AbstractRustShimGenerator.java +++ b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyrust/generator/AbstractRustShimGenerator.java @@ -4,9 +4,11 @@ import static software.amazon.smithy.rust.codegen.core.util.StringsKt.toPascalCase; import static software.amazon.smithy.rust.codegen.core.util.StringsKt.toSnakeCase; +import com.google.common.collect.MoreCollectors; import java.nio.file.Path; import java.util.Collection; import java.util.HashMap; +import java.util.HashSet; import java.util.LinkedHashMap; import java.util.List; import java.util.Locale; @@ -15,11 +17,11 @@ import java.util.Set; import java.util.stream.Collectors; import java.util.stream.Stream; -import software.amazon.polymorph.smithydafny.DafnyNameResolver; +import software.amazon.polymorph.smithyjava.NamespaceHelper; import software.amazon.polymorph.traits.DafnyUtf8BytesTrait; import software.amazon.polymorph.traits.PositionalTrait; import software.amazon.polymorph.traits.ReferenceTrait; -import software.amazon.polymorph.utils.DafnyNameResolverHelpers; +import software.amazon.polymorph.utils.BoundOperationShape; import software.amazon.polymorph.utils.IOUtils; import software.amazon.polymorph.utils.MapUtils; import software.amazon.polymorph.utils.ModelUtils; @@ -42,15 +44,43 @@ import software.amazon.smithy.model.traits.EnumTrait; import software.amazon.smithy.model.traits.ErrorTrait; import software.amazon.smithy.model.traits.RequiredTrait; +import software.amazon.smithy.model.traits.UnitTypeTrait; public abstract class AbstractRustShimGenerator { + protected MergedServicesGenerator mergedGenerator; + protected final Model model; protected final ServiceShape service; + protected final OperationIndex operationIndex; protected final OperationBindingIndex operationBindingIndex; - public AbstractRustShimGenerator(Model model, ServiceShape service) { + private static final String TOP_LEVEL_MOD_DECLS = + """ + pub mod client; + pub mod types; + + /// Common errors and error handling utilities. + pub mod error; + + /// All operations that this crate can perform. + pub mod operation; + + pub mod conversions; + + pub mod deps; + + #[cfg(feature = "wrapped-client")] + pub mod wrapped; + """; + + public AbstractRustShimGenerator( + final MergedServicesGenerator mergedGenerator, + Model model, + ServiceShape service + ) { + this.mergedGenerator = mergedGenerator; this.model = model; this.service = service; this.operationIndex = new OperationIndex(model); @@ -68,33 +98,20 @@ public void generate(final Path outputDir) { protected abstract Set rustFiles(); - protected Stream serviceOperationShapes() { - return service - .getOperations() + protected Stream streamAllBoundOperationShapes() { + return operationBindingIndex + .getAllBindingShapes() .stream() - .sorted() - .map(shapeId -> model.expectShape(shapeId, OperationShape.class)); - } - - protected Stream allOperationShapes() { - return model.getOperationShapes().stream().sorted(); - } - - protected boolean shouldGenerateOperation(OperationShape operationShape) { - return ModelUtils.isInServiceNamespace(operationShape, service); + .filter(s -> ModelUtils.isInServiceNamespace(s, service)) + .flatMap(s -> operationBindingIndex.getOperations(s).stream()); } protected Stream allErrorShapes() { - final var commonErrors = service.getErrors().stream(); - final var operationErrors = model - .getOperationShapes() + return model + .getStructureShapes() .stream() - .flatMap(operationShape -> operationShape.getErrors().stream()); - return Stream - .concat(commonErrors, operationErrors) - .distinct() - .map(errorShapeId -> model.expectShape(errorShapeId, StructureShape.class) - ); + .filter(s -> s.hasTrait(ErrorTrait.class)) + .filter(o -> ModelUtils.isInServiceNamespace(o, service)); } protected final boolean isInputOrOutputStructure( @@ -110,7 +127,6 @@ protected boolean shouldGenerateStructForStructure( StructureShape structureShape ) { return ( - !isInputOrOutputStructure(structureShape) && !structureShape.hasTrait(ErrorTrait.class) && !structureShape.hasTrait(ShapeId.from("smithy.api#trait")) && !structureShape.hasTrait(ReferenceTrait.class) && @@ -118,6 +134,12 @@ protected boolean shouldGenerateStructForStructure( ); } + protected boolean shouldGenerateTraitForResource( + ResourceShape resourceShape + ) { + return ModelUtils.isInServiceNamespace(resourceShape, service); + } + protected final Stream< StructureShape > streamStructuresToGenerateStructsFor() { @@ -136,6 +158,7 @@ protected final Stream streamResourcesToGenerateTraitsFor() { .map(s -> s.expectTrait(ReferenceTrait.class)) .filter(t -> !t.isService()) .map(t -> model.expectShape(t.getReferentId(), ResourceShape.class)) + .filter(this::shouldGenerateTraitForResource) .sorted(); } @@ -143,21 +166,12 @@ protected boolean shouldGenerateEnumForUnion(UnionShape unionShape) { return ModelUtils.isInServiceNamespace(unionShape, service); } - protected TokenTree declarePubModules(Stream moduleNames) { - return TokenTree - .of( - moduleNames - .sorted() - .map(module -> TokenTree.of("pub mod " + module + ";\n")) - ) - .lineSeparated(); - } - protected RustFile conversionsModule() { - Stream operationModules = model - .getOperationShapes() - .stream() - .map(operationShape -> toSnakeCase(operationShape.getId().getName())); + final String namespace = service.getId().getNamespace(); + Stream operationModules = streamAllBoundOperationShapes() + .map(operationShape -> + toSnakeCase(operationShape.operationShape().getId().getName()) + ); Stream resourceModules = streamResourcesToGenerateTraitsFor() .map(resourceShape -> toSnakeCase(resourceShape.getId().getName())); @@ -165,18 +179,21 @@ protected RustFile conversionsModule() { // whereas most smithy code generators generate code for all shapes in the service closure. // Here we filter to "normal" structures and unions. Stream structureModules = streamStructuresToGenerateStructsFor() + .filter(o -> o.getId().getNamespace().equals(namespace)) .map(structureShape -> toSnakeCase(structureShape.getId().getName())); Stream unionModules = model .getUnionShapes() .stream() .filter(this::shouldGenerateEnumForUnion) + .filter(o -> o.getId().getNamespace().equals(namespace)) .map(structureShape -> toSnakeCase(structureShape.getId().getName())); Stream enumModules = ModelUtils .streamEnumShapes(model, service.getId().getNamespace()) + .filter(o -> o.getId().getNamespace().equals(namespace)) .map(structureShape -> toSnakeCase(structureShape.getId().getName())); - TokenTree content = declarePubModules( + TokenTree content = RustUtils.declarePubModules( Stream .of( resourceModules, @@ -190,14 +207,19 @@ protected RustFile conversionsModule() { .flatMap(s -> s) ); - return new RustFile(Path.of("src", "conversions.rs"), content); + return new RustFile( + rootPathForNamespace(namespace).resolve("conversions.rs"), + content + ); } protected RustFile structureConversionModule( final StructureShape structureShape ) { String snakeCaseName = toSnakeCase(structureName(structureShape)); - Path path = Path.of("src", "conversions", snakeCaseName + ".rs"); + Path path = rootPathForShape(service) + .resolve("conversions") + .resolve(snakeCaseName + ".rs"); return new RustFile( path, TokenTree.of( @@ -281,10 +303,17 @@ pub fn from_dafny( } protected RustFile operationRequestConversionModule( + final Shape bindingShape, final OperationShape operationShape ) { - var toDafnyFunction = operationRequestToDafnyFunction(operationShape); - var fromDafnyFunction = operationRequestFromDafnyFunction(operationShape); + var toDafnyFunction = operationRequestToDafnyFunction( + bindingShape, + operationShape + ); + var fromDafnyFunction = operationRequestFromDafnyFunction( + bindingShape, + operationShape + ); var content = TokenTree .of(toDafnyFunction, fromDafnyFunction) .lineSeparated(); @@ -292,22 +321,29 @@ protected RustFile operationRequestConversionModule( final String snakeCaseOperationName = toSnakeCase( operationName(operationShape) ); - final Path path = Path.of( - "src", - "conversions", - snakeCaseOperationName, - "_%s.rs".formatted( - toSnakeCase(syntheticOperationInputName(operationShape)) - ) - ); + final Path path = rootPathForShape(bindingShape) + .resolve("conversions") + .resolve(snakeCaseOperationName) + .resolve( + "_%s.rs".formatted( + toSnakeCase(syntheticOperationInputName(operationShape)) + ) + ); return new RustFile(path, content); } protected RustFile operationResponseConversionModule( + final Shape bindingShape, final OperationShape operationShape ) { - var toDafnyFunction = operationResponseToDafnyFunction(operationShape); - var fromDafnyFunction = operationResponseFromDafnyFunction(operationShape); + var toDafnyFunction = operationResponseToDafnyFunction( + bindingShape, + operationShape + ); + var fromDafnyFunction = operationResponseFromDafnyFunction( + bindingShape, + operationShape + ); var content = TokenTree .of(toDafnyFunction, fromDafnyFunction) .lineSeparated(); @@ -315,30 +351,34 @@ protected RustFile operationResponseConversionModule( final String snakeCaseOperationName = toSnakeCase( operationName(operationShape) ); - final Path path = Path.of( - "src", - "conversions", - snakeCaseOperationName, - "_%s.rs".formatted( - toSnakeCase(syntheticOperationOutputName(operationShape)) - ) - ); + final Path path = rootPathForShape(bindingShape) + .resolve("conversions") + .resolve(snakeCaseOperationName) + .resolve( + "_%s.rs".formatted( + toSnakeCase(syntheticOperationOutputName(operationShape)) + ) + ); return new RustFile(path, content); } protected abstract TokenTree operationRequestToDafnyFunction( + final Shape bindingShape, final OperationShape operationShape ); protected abstract TokenTree operationRequestFromDafnyFunction( + final Shape bindingShape, final OperationShape operationShape ); protected abstract TokenTree operationResponseToDafnyFunction( + final Shape bindingShape, final OperationShape operationShape ); protected abstract TokenTree operationResponseFromDafnyFunction( + final Shape bindingShape, final OperationShape operationShape ); @@ -609,13 +649,18 @@ protected TokenTree fromDafny( Shape memberShape = model.expectShape( listShape.getMember().getTarget() ); + String dafnyElementType = dafnyTypeForShape(memberShape); if (!isDafnyOption) { TokenTree result = TokenTree.of( """ ::dafny_runtime::dafny_runtime_conversions::dafny_sequence_to_vec(%s, - |e| %s, + |e: &%s| %s, ) - """.formatted(dafnyValue, fromDafny(memberShape, "e", false, false)) + """.formatted( + dafnyValue, + dafnyElementType, + fromDafny(memberShape, "e", false, false) + ) ); if (isRustOption) { result = @@ -629,12 +674,16 @@ protected TokenTree fromDafny( crate::r#_Wrappers_Compile::Option::Some { value } => Some( ::dafny_runtime::dafny_runtime_conversions::dafny_sequence_to_vec(value, - |e| %s, + |e: &%s| %s, ) ), _ => None } - """.formatted(dafnyValue, fromDafny(memberShape, "e", false, false)) + """.formatted( + dafnyValue, + dafnyElementType, + fromDafny(memberShape, "e", false, false) + ) ); } } @@ -646,12 +695,14 @@ protected TokenTree fromDafny( TokenTree result = TokenTree.of( """ ::dafny_runtime::dafny_runtime_conversions::dafny_map_to_hashmap(&%s, - |k| %s, - |v| %s, + |k: &%s| %s, + |v: &%s| %s, ) """.formatted( dafnyValue, + dafnyTypeForShape(keyShape), fromDafny(keyShape, "k", false, false), + dafnyTypeForShape(valueShape), fromDafny(valueShape, "v", false, false) ) ); @@ -667,38 +718,41 @@ protected TokenTree fromDafny( crate::r#_Wrappers_Compile::Option::Some { value } => Some( ::dafny_runtime::dafny_runtime_conversions::dafny_map_to_hashmap(value, - |k| %s, - |v| %s, + |k: &%s| %s, + |v: &%s| %s, ) ), _ => None } """.formatted( dafnyValue, + dafnyTypeForShape(keyShape), fromDafny(keyShape, "k", false, false), + dafnyTypeForShape(valueShape), fromDafny(valueShape, "v", false, false) ) ); } } case STRUCTURE, UNION -> { - var structureShapeName = toSnakeCase(shape.getId().getName()); - String prefix = topLevelNameForShape(shape); + var conversionsModule = mergedGenerator + .generatorForShape(shape) + .getRustConversionsModuleNameForShape(shape); if (isDafnyOption) { yield TokenTree.of( """ match (*%s).as_ref() { crate::r#_Wrappers_Compile::Option::Some { value } => - Some(%s::conversions::%s::from_dafny(value.clone())), + Some(%s::from_dafny(value.clone())), _ => None, } - """.formatted(dafnyValue, prefix, structureShapeName) + """.formatted(dafnyValue, conversionsModule) ); } else { TokenTree result = TokenTree.of( """ - %s::conversions::%s::from_dafny(%s.clone()) - """.formatted(prefix, structureShapeName, dafnyValue) + %s::from_dafny(%s.clone()) + """.formatted(conversionsModule, dafnyValue) ); if (isRustOption) { result = @@ -892,24 +946,97 @@ pub fn from_dafny( } protected Set allOperationConversionModules() { - return allOperationShapes() - .filter(this::shouldGenerateOperation) - .map(this::operationConversionModules) + return streamAllBoundOperationShapes() + .map(this::boundOperationConversionModules) .flatMap(Collection::stream) .collect(Collectors.toSet()); } - protected abstract Set operationConversionModules( - final OperationShape operationShape - ); + protected Set boundOperationConversionModules( + final BoundOperationShape boundOperationShape + ) { + final Shape bindingShape = boundOperationShape.bindingShape(); + final OperationShape operationShape = boundOperationShape.operationShape(); - protected RustFile enumConversionModule(final EnumShape enumShape) { - Path path = Path.of( - "src", - "conversions", - toSnakeCase(enumName(enumShape)) + ".rs" + final Map variables = MapUtils.merge( + serviceVariables(), + operationVariables(bindingShape, operationShape) + ); + + final String operationModuleName = toSnakeCase( + operationName(operationShape) ); + Optional inputStructure = operationIndex.getInputShape( + operationShape + ); + final boolean hasInputStructure = + inputStructure.isPresent() && + !inputStructure.get().hasTrait(PositionalTrait.class) && + !inputStructure.get().hasTrait(UnitTypeTrait.class); + Optional outputStructure = operationIndex.getOutputShape( + operationShape + ); + final boolean hasOutputStructure = + outputStructure.isPresent() && + !outputStructure.get().hasTrait(PositionalTrait.class) && + !outputStructure.get().hasTrait(UnitTypeTrait.class); + + final Set childModules = new HashSet<>(); + if (hasInputStructure) { + childModules.add( + "_" + variables.get("snakeCaseSyntheticOperationInputName") + ); + } + if (hasOutputStructure) { + childModules.add( + "_" + variables.get("snakeCaseSyntheticOperationOutputName") + ); + } + final RustFile outerModule = new RustFile( + rootPathForShape(bindingShape) + .resolve("conversions") + .resolve(operationModuleName + ".rs"), + TokenTree + .of( + operationErrorConversionFunctions(boundOperationShape), + RustUtils.declarePubModules(childModules.stream()) + ) + .lineSeparated() + ); + + Set result = new HashSet<>(Set.of(outerModule)); + + if (hasInputStructure) { + final RustFile requestModule = operationRequestConversionModule( + bindingShape, + operationShape + ); + result.add(requestModule); + } + if (hasOutputStructure) { + final RustFile responseModule = operationResponseConversionModule( + bindingShape, + operationShape + ); + result.add(responseModule); + } + + return result; + } + + protected TokenTree operationErrorConversionFunctions( + final BoundOperationShape boundOperationShape + ) { + // By default none necessary, but SDKs need them + return TokenTree.empty(); + } + + protected RustFile enumConversionModule(final EnumShape enumShape) { + Path path = rootPathForShape(service) + .resolve("conversions") + .resolve(toSnakeCase(enumName(enumShape)) + ".rs"); + return new RustFile( path, TokenTree @@ -984,11 +1111,9 @@ protected RustFile unionConversionModule(final UnionShape unionShape) { "runtimes/rust/conversions/union.rs", variables ); - final Path path = Path.of( - "src", - "conversions", - "%s.rs".formatted(toSnakeCase(unionName(unionShape))) - ); + final Path path = rootPathForShape(service) + .resolve("conversions") + .resolve("%s.rs".formatted(toSnakeCase(unionName(unionShape)))); return new RustFile(path, TokenTree.of(content)); } @@ -996,31 +1121,66 @@ protected RustFile unionConversionModule(final UnionShape unionShape) { * Generates values for variables commonly used in service-specific templates. */ protected HashMap serviceVariables() { + final String namespace = service.getId().getNamespace(); final HashMap variables = new HashMap<>(); + variables.put("sdkId", getSdkId()); variables.put("serviceName", service.getId().getName(service)); - variables.put("dafnyInternalModuleName", getDafnyInternalModuleName()); - variables.put("dafnyTypesModuleName", getDafnyTypesModuleName()); + variables.put("rustClientType", qualifiedRustServiceType(service)); + variables.put("dafnyModuleName", getDafnyModuleName(namespace)); + variables.put( + "dafnyInternalModuleName", + getDafnyInternalModuleName(namespace) + ); + variables.put("dafnyTypesModuleName", getDafnyTypesModuleName(namespace)); + variables.put("rustRootModuleName", getRustRootModuleName(namespace)); variables.put("rustTypesModuleName", getRustTypesModuleName()); + variables.put( + "rustConversionsModuleName", + getRustConversionsModuleName(namespace) + ); return variables; } - protected String getDafnyInternalModuleName() { - String dafnyExternName = DafnyNameResolver.dafnyExternNamespace( - service.getId().getNamespace() - ); + protected String getDafnyModuleName(final String namespace) { + String dafnyExternName = NamespaceHelper.standardize(namespace); return dafnyExternName.replace(".", "::").toLowerCase(Locale.ROOT); } - protected String getDafnyTypesModuleName() { - return "%s::types".formatted(getDafnyInternalModuleName()); + protected String getDafnyInternalModuleName(final String namespace) { + return "%s::internaldafny".formatted(getDafnyModuleName(namespace)); + } + + protected String getDafnyTypesModuleName(final String namespace) { + return "%s::types".formatted(getDafnyInternalModuleName(namespace)); + } + + protected String getRustRootModuleName(final String namespace) { + return mergedGenerator.isMainNamespace(namespace) + ? "crate" + : "crate::deps::" + RustUtils.rustModuleForSmithyNamespace(namespace); } protected abstract String getRustTypesModuleName(); + protected String getRustConversionsModuleName(final String namespace) { + return getRustRootModuleName(namespace) + "::conversions"; + } + + protected String getRustConversionsModuleNameForShape(final Shape shape) { + final String namespace = shape.getId().getNamespace(); + return switch (shape.getType()) { + case STRUCTURE, UNION, ENUM -> getRustConversionsModuleName(namespace) + + "::" + + toSnakeCase(shape.getId().getName()); + default -> "crate::standard_library_conversions"; + }; + } + /** * Generates values for variables commonly used in operation-specific templates. */ protected HashMap operationVariables( + final Shape bindingShape, final OperationShape operationShape ) { final String opName = operationName(operationShape); @@ -1031,6 +1191,7 @@ protected HashMap operationVariables( final String synOpOutputName = syntheticOperationOutputName(operationShape); final HashMap variables = new HashMap<>(); + variables.put("rustRootModuleName", topLevelNameForShape(bindingShape)); variables.put("operationName", opName); variables.put("operationInputName", opInputName); variables.put("operationOutputName", opOutputName); @@ -1053,12 +1214,12 @@ protected HashMap operationVariables( variables.put("pascalCaseOperationOutputName", toPascalCase(opOutputName)); variables.put("pascalCaseOperationErrorName", toPascalCase(opErrorName)); - final Shape bindingShape = operationBindingIndex - .getBindingShape(operationShape) - .get(); if (bindingShape.isServiceShape()) { variables.put("operationTargetName", "client"); - variables.put("operationTargetType", "crate::client::Client"); + variables.put( + "operationTargetType", + qualifiedRustServiceType((ServiceShape) bindingShape) + ); } else { Map resourceVariables = resourceVariables( bindingShape.asResourceShape().get() @@ -1070,8 +1231,8 @@ protected HashMap operationVariables( variables.put( "operationTargetType", evalTemplate( - "crate::types::$snakeCaseResourceName:L::$rustResourceName:LRef", - resourceVariables + "$rustRootModuleName:L::types::$snakeCaseResourceName:L::$rustResourceName:LRef", + MapUtils.merge(variables, resourceVariables) ) ); } @@ -1082,7 +1243,7 @@ protected HashMap operationVariables( variables.put( "operationInputType", evalTemplate( - "crate::operation::$snakeCaseOperationName:L::$pascalCaseOperationInputName:L", + "$rustRootModuleName:L::operation::$snakeCaseOperationName:L::$pascalCaseOperationInputName:L", variables ) ); @@ -1092,14 +1253,14 @@ protected HashMap operationVariables( ); variables.put( "operationDafnyInputType", - rustTypeForShape(resolvedInputShape) + dafnyTypeForShape(resolvedInputShape) ); } else { Map inputShapeVariables = structureVariables(inputShape); variables.put( "operationDafnyInputType", evalTemplate( - "crate::r#$dafnyTypesModuleName:L::$structureName:L", + "&::std::rc::Rc", inputShapeVariables ) ); @@ -1108,13 +1269,17 @@ protected HashMap operationVariables( final StructureShape outputShape = operationIndex .getOutputShape(operationShape) .get(); - if (outputShape.hasTrait(PositionalTrait.class)) { + if ( + outputShape.hasTrait(PositionalTrait.class) || + outputShape.hasTrait(UnitTypeTrait.class) + ) { variables.put("operationOutputType", rustTypeForShape(outputShape)); + variables.put("operationDafnyOutputType", dafnyTypeForShape(outputShape)); } else { variables.put( "operationOutputType", evalTemplate( - "crate::operation::$snakeCaseOperationName:L::$pascalCaseOperationOutputName:L", + "$rustRootModuleName:L::operation::$snakeCaseOperationName:L::$pascalCaseOperationOutputName:L", variables ) ); @@ -1124,7 +1289,7 @@ protected HashMap operationVariables( variables.put( "operationDafnyOutputType", evalTemplate( - "crate::r#$dafnyTypesModuleName:L::$structureName:L", + "::std::rc::Rc", outputShapeVariables ) ); @@ -1169,27 +1334,41 @@ protected String qualifiedRustStructureType( final StructureShape structureShape ) { return "%s::%s".formatted( - getRustTypesModuleName(), + mergedGenerator + .generatorForShape(structureShape) + .getRustTypesModuleName(), rustStructureName(structureShape) ); } protected String topLevelNameForShape(final ToShapeId toShapeId) { final ShapeId shapeId = toShapeId.toShapeId(); - if (ModelUtils.isInServiceNamespace(shapeId, service)) { + if (mergedGenerator.isMainNamespace(shapeId.getNamespace())) { return "crate"; } else { - if (shapeId.getNamespace().length() == 0) { - throw new IllegalArgumentException( - "Empty namespace for shape id: " + shapeId - ); - } - return NamespaceHelper.rustModuleForSmithyNamespace( - shapeId.getNamespace() + return ( + "crate::deps::" + + RustUtils.rustModuleForSmithyNamespace(shapeId.getNamespace()) ); } } + public Path rootPathForNamespace(final String namespace) { + if (mergedGenerator.isMainNamespace(namespace)) { + return Path.of("src"); + } else { + return Path.of( + "src", + "deps", + RustUtils.rustModuleForSmithyNamespace(namespace) + ); + } + } + + public Path rootPathForShape(final ToShapeId toShapeId) { + return rootPathForNamespace(toShapeId.toShapeId().getNamespace()); + } + protected String qualifiedRustServiceType(final ServiceShape serviceShape) { return topLevelNameForShape(serviceShape) + "::client::Client"; } @@ -1212,6 +1391,11 @@ protected HashMap structureVariables( variables.put("structureName", structureName); variables.put("snakeCaseStructureName", toSnakeCase(structureName)); variables.put("rustStructureName", rustStructureName(structureShape)); + // TODO: Risky... + variables.put( + "dafnyTypesModuleName", + getDafnyTypesModuleName(structureShape.getId().getNamespace()) + ); return variables; } @@ -1253,8 +1437,8 @@ protected String rustEnumName(final EnumShape enumShape) { } protected String qualifiedRustEnumType(final EnumShape enumShape) { - return "%s::types::%s".formatted( - topLevelNameForShape(enumShape), + return "%s::%s".formatted( + mergedGenerator.generatorForShape(enumShape).getRustTypesModuleName(), rustEnumName(enumShape) ); } @@ -1309,7 +1493,7 @@ protected String rustUnionName(final UnionShape unionShape) { protected String qualifiedRustUnionName(final UnionShape unionShape) { return "%s::%s".formatted( - getRustTypesModuleName(), + mergedGenerator.generatorForShape(unionShape).getRustTypesModuleName(), rustUnionName(unionShape) ); } @@ -1339,7 +1523,7 @@ protected String rustUnionMemberName(final MemberShape memberShape) { } protected String dafnyUnionMemberName(final MemberShape memberShape) { - return unionMemberName(memberShape); + return DafnyNameResolver.escapeName(unionMemberName(memberShape)); } /** @@ -1360,6 +1544,71 @@ protected HashMap unionMemberVariables( return variables; } + /** + * Generates values for variables commonly used in structure-member-specific templates. + */ + protected HashMap structureMemberVariables( + final MemberShape memberShape + ) { + final HashMap variables = new HashMap<>(); + final String memberName = memberShape.getMemberName(); + final Shape targetShape = model.expectShape(memberShape.getTarget()); + variables.put("memberName", memberName); + variables.put("fieldName", toSnakeCase(memberName)); + variables.put("fieldType", mergedGeneratorRustTypeForShape(targetShape)); + return variables; + } + + protected String qualifiedRustServiceErrorType() { + return "%s::error::Error".formatted(getRustTypesModuleName()); + } + + protected String errorName(final StructureShape errorShape) { + return errorShape.getId().getName(serviceForShape(model, errorShape)); + } + + protected String rustErrorName(final StructureShape errorShape) { + return toPascalCase(errorName(errorShape)); + } + + protected HashMap errorVariables( + final StructureShape errorShape + ) { + final HashMap variables = new HashMap<>(); + final String errorName = errorName(errorShape); + final String rustErrorName = rustErrorName(errorShape); + variables.put("errorName", errorName); + variables.put("snakeCaseErrorName", toSnakeCase(errorName)); + variables.put("rustErrorName", rustErrorName); + variables.put( + "qualifiedRustErrorVariant", + "%s::%s".formatted(qualifiedRustServiceErrorType(), rustErrorName) + ); + variables.put( + "qualifiedRustServiceErrorType", + qualifiedRustServiceErrorType() + ); + + // This is where smithy-dafny's assumption about error shapes shows up + var messageMember = errorShape + .members() + .stream() + .filter(m -> m.getMemberName().equalsIgnoreCase("message")) + .collect(MoreCollectors.onlyElement()); + variables.put("errorMessageMemberName", messageMember.getMemberName()); + + return variables; + } + + protected String mergedGeneratorRustTypeForShape(final Shape shape) { + AbstractRustShimGenerator forShape = mergedGenerator.generatorForShape( + shape + ); + return forShape != null + ? forShape.rustTypeForShape(shape) + : rustTypeForShape(shape); + } + protected String rustTypeForShape(final Shape originalShape) { // First handle indirection like @reference final ModelUtils.ResolvedShapeId resolvedShapeId = ModelUtils.resolveShape( @@ -1368,6 +1617,10 @@ protected String rustTypeForShape(final Shape originalShape) { ); final Shape shape = model.expectShape(resolvedShapeId.resolvedId()); + if (shape.hasTrait(UnitTypeTrait.class)) { + return "()"; + } + return switch (shape.getType()) { case BOOLEAN -> "::std::primitive::bool"; // integral @@ -1396,10 +1649,6 @@ yield qualifiedRustEnumType( // other simple shapes case TIMESTAMP -> "::aws_smithy_types::DateTime"; // aggregates - case STRUCTURE -> { - final StructureShape structureShape = (StructureShape) shape; - yield qualifiedRustStructureType(structureShape); - } case LIST -> { final ListShape listShape = (ListShape) shape; final String memberType = rustTypeForShape( @@ -1420,6 +1669,7 @@ yield qualifiedRustEnumType( valueType ); } + case STRUCTURE -> qualifiedRustStructureType((StructureShape) shape); case UNION -> qualifiedRustUnionName((UnionShape) shape); case RESOURCE -> qualifiedRustResourceType((ResourceShape) shape); case SERVICE -> qualifiedRustServiceType((ServiceShape) shape); @@ -1437,6 +1687,10 @@ protected String dafnyTypeForShape(final Shape originalShape) { ); final Shape shape = model.expectShape(resolvedShapeId.resolvedId()); + if (shape.hasTrait(UnitTypeTrait.class)) { + return "()"; + } + return switch (shape.getType()) { case BOOLEAN -> "::std::primitive::bool"; // integral @@ -1445,8 +1699,8 @@ protected String dafnyTypeForShape(final Shape originalShape) { case INTEGER -> "::std::primitive::i32"; case LONG -> "::std::primitive::i64"; // floats - case FLOAT -> "::std::primitive::f32"; - case DOUBLE -> "::std::primitive::f64"; + case FLOAT -> "::dafny_runtime::Sequence"; + case DOUBLE -> "::dafny_runtime::Sequence"; // special numerics case BIG_INTEGER -> "::num::bigint::BigInt"; case BIG_DECIMAL -> "::num::rational::BigRational"; @@ -1455,15 +1709,25 @@ protected String dafnyTypeForShape(final Shape originalShape) { case STRING -> { //noinspection deprecation if (shape.hasTrait(EnumTrait.class)) { - yield dafnyTypeForShape( - ModelUtils.stringToEnumShape(shape.asStringShape().orElseThrow()) + EnumShape enumShape = ModelUtils.stringToEnumShape( + shape.asStringShape().orElseThrow() ); + yield "::std::rc::Rc"; + } + if (shape.hasTrait(DafnyUtf8BytesTrait.class)) { + yield "::dafny_runtime::dafny_runtime_conversions::DafnySequence"; } yield "::dafny_runtime::dafny_runtime_conversions::DafnySequence<::dafny_runtime::dafny_runtime_conversions::DafnyCharUTF16>"; } - case ENUM -> getDafnyTypesModuleName() + + case ENUM -> "::std::rc::Rc"; // other simple shapes case TIMESTAMP -> "::dafny_runtime::dafny_runtime_conversions::DafnySequence<::dafny_runtime::dafny_runtime_conversions::DafnyCharUTF16>"; // aggregates @@ -1490,26 +1754,26 @@ yield dafnyTypeForShape( ); } case STRUCTURE -> "::std::rc::Rc"; case UNION -> "::std::rc::Rc"; case RESOURCE -> "::dafny_runtime::Object"; case SERVICE -> { ServiceShape service = (ServiceShape) shape; yield "::dafny_runtime::Object"; } default -> throw new UnsupportedOperationException( @@ -1517,4 +1781,27 @@ yield dafnyTypeForShape( ); }; } + + public abstract TokenTree topLevelModuleDeclarations(); + + public RustFile depTopLevelModule() { + final String rustModule = RustUtils.rustModuleForSmithyNamespace( + service.getId().getNamespace() + ); + return new RustFile( + Path.of("src", "deps", rustModule + ".rs"), + topLevelModuleDeclarations() + ); + } + + protected abstract String getSdkId(); + + protected ServiceShape serviceForShape(final Model model, final Shape shape) { + if (shape.isServiceShape()) { + return (ServiceShape) shape; + } else { + final String namespace = shape.getId().getNamespace(); + return ModelUtils.serviceFromNamespace(model, namespace); + } + } } diff --git a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyrust/generator/DafnyNameResolver.java b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyrust/generator/DafnyNameResolver.java new file mode 100644 index 000000000..359253c2e --- /dev/null +++ b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyrust/generator/DafnyNameResolver.java @@ -0,0 +1,11 @@ +package software.amazon.polymorph.smithyrust.generator; + +public class DafnyNameResolver { + + public static String escapeName(String name) { + if (name.equals("None")) { + return "_None"; + } + return name; + } +} diff --git a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyrust/generator/MergedServicesGenerator.java b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyrust/generator/MergedServicesGenerator.java new file mode 100644 index 000000000..1de294ddf --- /dev/null +++ b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyrust/generator/MergedServicesGenerator.java @@ -0,0 +1,155 @@ +package software.amazon.polymorph.smithyrust.generator; + +import java.nio.file.Path; +import java.util.HashMap; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.Set; +import java.util.stream.Stream; +import software.amazon.polymorph.CodegenEngine; +import software.amazon.polymorph.utils.IOUtils; +import software.amazon.polymorph.utils.ModelUtils; +import software.amazon.polymorph.utils.TokenTree; +import software.amazon.smithy.aws.traits.ServiceTrait; +import software.amazon.smithy.model.Model; +import software.amazon.smithy.model.shapes.ServiceShape; +import software.amazon.smithy.model.shapes.Shape; + +public class MergedServicesGenerator { + + private final Model model; + private final ServiceShape mainService; + private final Set namespaces; + private final boolean generateWrappedClient; + private final Set generationAspects; + + protected final Map generatorsByNamespace = + new HashMap<>(); + + public MergedServicesGenerator( + Model model, + ServiceShape mainService, + Set namespaces, + boolean generateWrappedClient, + Set generationAspects + ) { + this.model = model; + this.namespaces = namespaces; + this.mainService = mainService; + this.generateWrappedClient = generateWrappedClient; + this.generationAspects = generationAspects; + + // Prepopulate generators + for (String namespace : namespaces) { + generatorForNamespace(model, namespace, namespaces); + } + } + + public boolean isMainService(ServiceShape serviceShape) { + return serviceShape.equals(mainService); + } + + public boolean isMainNamespace(String namespace) { + return isMainService(ModelUtils.serviceFromNamespace(model, namespace)); + } + + public Set rustFiles() { + Set rustFiles = new HashSet<>(); + + namespaces + .stream() + .map(namespace -> generatorForNamespace(model, namespace, namespaces)) + .flatMap(generator -> generator.rustFiles().stream()) + .forEach(rustFiles::add); + + streamNamespacesToGenerateFor(model) + .filter(n -> !isMainNamespace(n)) + .map(namespace -> generatorForNamespace(model, namespace, namespaces)) + .map(g -> g.depTopLevelModule()) + .forEach(rustFiles::add); + + rustFiles.add(topLevelDepsModule()); + + return rustFiles; + } + + public void generateAllNamespaces(final Path outputDir) { + Set rustFiles = rustFiles(); + + final LinkedHashMap tokenTreeMap = new LinkedHashMap<>(); + for (RustFile rustFile : rustFiles) { + tokenTreeMap.put(rustFile.path(), rustFile.content()); + } + IOUtils.writeTokenTreesIntoDir(tokenTreeMap, outputDir); + } + + protected AbstractRustShimGenerator generatorForNamespace( + final Model model, + final String namespace, + final Set namespaces + ) { + return generatorsByNamespace.computeIfAbsent( + namespace, + n -> + generatorFor( + model, + ModelUtils.serviceFromNamespace(model, n), + namespaces + ) + ); + } + + public AbstractRustShimGenerator generatorFor( + Model model, + ServiceShape serviceShape, + Set namespaces + ) { + if (serviceShape.hasTrait(ServiceTrait.class)) { + return new RustAwsSdkShimGenerator( + this, + model, + serviceShape, + generationAspects + ); + } else { + return new RustLibraryShimGenerator( + this, + model, + serviceShape, + generateWrappedClient + ); + } + } + + public Stream streamNamespacesToGenerateFor(Model model) { + return model + .shapes() + .map(s -> s.getId().getNamespace()) + .distinct() + .filter(this::shouldGenerateForNamespace); + } + + private boolean shouldGenerateForNamespace(final String namespace) { + return namespaces.contains(namespace); + } + + public Stream streamServicesToGenerateFor(Model model) { + return model.getServiceShapes().stream(); + } + + // TODO: overlap with library version + private RustFile topLevelDepsModule() { + final TokenTree content = RustUtils.declarePubModules( + streamServicesToGenerateFor(model) + .filter(s -> !isMainService(s)) + .map(s -> s.getId().getNamespace()) + .map(RustUtils::rustModuleForSmithyNamespace) + ); + return new RustFile(Path.of("src", "deps.rs"), content); + } + + public AbstractRustShimGenerator generatorForShape(final Shape shape) { + return generatorsByNamespace.get(shape.getId().getNamespace()); + } +} diff --git a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyrust/generator/NamespaceHelper.java b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyrust/generator/NamespaceHelper.java deleted file mode 100644 index 2eb239bf6..000000000 --- a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyrust/generator/NamespaceHelper.java +++ /dev/null @@ -1,19 +0,0 @@ -package software.amazon.polymorph.smithyrust.generator; - -import static software.amazon.smithy.rust.codegen.core.util.StringsKt.toSnakeCase; - -public class NamespaceHelper { - - /** - * TODO: This is only hypothetical and untested at present, - * because smithy-dafny doesn't yet support building multiple Smithy models - * into either separate related crates or a single merged crate. - */ - public static String rustModuleForSmithyNamespace( - final String smithyNamespace - ) { - final String[] components = smithyNamespace.split("\\."); - final String lastComponent = components[components.length - 1]; - return toSnakeCase(lastComponent); - } -} diff --git a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyrust/generator/RustAwsSdkShimGenerator.java b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyrust/generator/RustAwsSdkShimGenerator.java index 00223efad..a21889896 100644 --- a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyrust/generator/RustAwsSdkShimGenerator.java +++ b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyrust/generator/RustAwsSdkShimGenerator.java @@ -4,17 +4,17 @@ import static software.amazon.smithy.rust.codegen.core.util.StringsKt.toPascalCase; import static software.amazon.smithy.rust.codegen.core.util.StringsKt.toSnakeCase; +import com.google.common.collect.MoreCollectors; import java.nio.file.Path; import java.util.HashMap; import java.util.HashSet; -import java.util.List; import java.util.Locale; import java.util.Map; import java.util.Set; import java.util.stream.Collectors; -import java.util.stream.Stream; import software.amazon.polymorph.CodegenEngine; import software.amazon.polymorph.traits.DafnyUtf8BytesTrait; +import software.amazon.polymorph.utils.BoundOperationShape; import software.amazon.polymorph.utils.IOUtils; import software.amazon.polymorph.utils.MapUtils; import software.amazon.polymorph.utils.ModelUtils; @@ -29,29 +29,26 @@ import software.amazon.smithy.model.shapes.Shape; import software.amazon.smithy.model.shapes.ShapeId; import software.amazon.smithy.model.shapes.StructureShape; -import software.amazon.smithy.model.shapes.UnionShape; import software.amazon.smithy.model.traits.BoxTrait; import software.amazon.smithy.model.traits.DefaultTrait; import software.amazon.smithy.model.traits.EnumTrait; -import software.amazon.smithy.rust.codegen.core.smithy.traits.RustBoxTrait; +import software.amazon.smithy.model.traits.UnitTypeTrait; /** * Generates all Rust modules needed to wrap * a Rust AWS SDK into a Dafny SDK. */ -// TODO: There is a lot of duplication in the various calls to evalTemplate. -// The best way to clean this up is to thread SimpleCodeWriters through the methods and use the stateful -// putContext method, instead of trying to work purely functionality with map literals. public class RustAwsSdkShimGenerator extends AbstractRustShimGenerator { private final Set generationAspects; public RustAwsSdkShimGenerator( + MergedServicesGenerator mergedGenerator, Model model, ServiceShape service, Set generationAspects ) { - super(model, service); + super(mergedGenerator, model, service); this.generationAspects = generationAspects; } @@ -59,22 +56,14 @@ public RustAwsSdkShimGenerator( protected Set rustFiles() { Set result = new HashSet<>(); result.add(clientModule()); - result.addAll( - allErrorShapes() - .map(this::errorConversionModule) - .collect(Collectors.toSet()) - ); - - result.addAll( - ModelUtils - .streamEnumShapes(model, service.getId().getNamespace()) - .map(this::enumConversionModule) - .toList() - ); result.add(conversionsModule()); + result.add(typesModule()); + result.add(typesErrorModule()); result.addAll(allOperationConversionModules()); result.addAll(allStructureConversionModules()); + result.addAll(allEnumConversionModules()); + result.addAll(allErrorConversionModules()); result.addAll(allUnionConversionModules()); result.add(conversionsErrorModule()); result.add(conversionsClientModule()); @@ -82,6 +71,13 @@ protected Set rustFiles() { return result; } + private RustFile typesModule() { + return new RustFile( + rootPathForShape(service).resolve("types.rs"), + TokenTree.of("pub mod error;") + ); + } + private RustFile clientModule() { final Map variables = serviceVariables(); variables.put( @@ -93,6 +89,7 @@ private RustFile clientModule() { .stream() .map(id -> operationClientFunction( + service, model.expectShape(id, OperationShape.class) ) ) @@ -105,12 +102,25 @@ private RustFile clientModule() { evalTemplate( """ use std::sync::LazyLock; - use crate::conversions; + use $rustRootModuleName:L::conversions; + #[derive(::std::clone::Clone, ::std::fmt::Debug)] pub struct Client { pub inner: $sdkCrate:L::Client } + impl ::std::cmp::PartialEq for Client { + fn eq(&self, other: &Self) -> bool { + false + } + } + + impl ::std::convert::Into for $sdkCrate:L::Client { + fn into(self) -> Client { + Client { inner: self } + } + } + /// A runtime for executing operations on the asynchronous client in a blocking manner. /// Necessary because Dafny only generates synchronous code. static dafny_tokio_runtime: LazyLock = LazyLock::new(|| { @@ -177,17 +187,21 @@ private RustFile clientModule() { } private TokenTree operationClientFunction( + final Shape bindingShape, final OperationShape operationShape ) { final Map variables = MapUtils.merge( serviceVariables(), - operationVariables(operationShape) + operationVariables(bindingShape, operationShape) ); - final ShapeId outputShapeId = operationShape.getOutputShape(); - final String outputType = outputShapeId.equals( - ShapeId.from("smithy.api#Unit") - ) + final StructureShape inputShape = operationIndex + .getInputShape(operationShape) + .get(); + final StructureShape outputShape = operationIndex + .getOutputShape(operationShape) + .get(); + final String outputType = outputShape.hasTrait(UnitTypeTrait.class) ? "()" : evalTemplate( "std::rc::Rc", @@ -195,6 +209,30 @@ private TokenTree operationClientFunction( ); variables.put("outputType", outputType); + variables.put( + "fluentSetters", + inputShape + .members() + .stream() + .map(member -> + evalTemplate( + ".set_$fieldName:L(inner_input.$fieldName:L)", + structureMemberVariables(member) + ) + ) + .collect(Collectors.joining("\n")) + ); + + variables.put( + "outputToDafnyMapper", + outputShape.hasTrait(UnitTypeTrait.class) + ? "|x| ()" + : evalTemplate( + "$rustRootModuleName:L::conversions::$snakeCaseOperationName:L::_$snakeCaseOperationName:L_response::to_dafny", + variables + ) + ); + return TokenTree.of( evalTemplate( """ @@ -204,11 +242,18 @@ private TokenTree operationClientFunction( std::rc::Rc > > { - let native_result =\s - dafny_tokio_runtime.block_on(conversions::$snakeCaseOperationName:L::_$snakeCaseOperationName:L_request::from_dafny(input.clone(), self.inner.clone()).send()); + let inner_input = $rustRootModuleName:L::conversions::$snakeCaseOperationName:L::_$snakeCaseOperationName:L_request::from_dafny(input.clone()); + let native_result = tokio::task::block_in_place(|| { + dafny_tokio_runtime.block_on(async { + self.inner.$snakeCaseOperationName:L() + $fluentSetters:L + .send() + .await + }) + }); crate::standard_library_conversions::result_to_dafny(&native_result,\s - conversions::$snakeCaseOperationName:L::_$snakeCaseOperationName:L_response::to_dafny, - conversions::$snakeCaseOperationName:L::to_dafny_error) + $outputToDafnyMapper:L, + $rustRootModuleName:L::conversions::$snakeCaseOperationName:L::to_dafny_error) } """, variables @@ -217,30 +262,79 @@ private TokenTree operationClientFunction( } protected RustFile conversionsClientModule() { - // Just defining an empty file for now - we will need - // these functions for AWS SDK clients as well but they will - // be quite different from the local service versions. + TokenTree clientConversionFunctions = TokenTree.of( + evalTemplate( + getClass(), + "runtimes/rust/conversions/client_awssdk.rs", + serviceVariables() + ) + ); return new RustFile( - Path.of("src", "conversions", "client.rs"), - TokenTree.of("") + rootPathForShape(service).resolve("conversions").resolve("client.rs"), + clientConversionFunctions ); } protected RustFile conversionsErrorModule() { - TokenTree modulesDeclarations = declarePubModules( + final Map variables = serviceVariables(); + + TokenTree modulesDeclarations = RustUtils.declarePubModules( allErrorShapes() .map(structureShape -> toSnakeCase(structureShape.getId().getName())) ); - TokenTree toDafnyOpaqueErrorFunctions = TokenTree.of( - evalTemplate( + + variables.put( + "qualifiedRustServiceErrorType", + topLevelNameForShape(service) + "::types::error::Error" + ); + + final String toDafnyArms = allErrorShapes() + .map(errorShape -> + IOUtils.evalTemplate( + """ + $qualifiedRustServiceErrorType:L::$rustErrorName:L { error } => + $rustRootModuleName:L::conversions::error::$snakeCaseErrorName:L::to_dafny(error), + """, + MapUtils.merge(errorVariables(errorShape), variables) + ) + ) + .collect(Collectors.joining("\n")); + variables.put("toDafnyArms", toDafnyArms); + + final String fromDafnyArms = allErrorShapes() + .map(errorShape -> + IOUtils.evalTemplate( + """ + crate::r#$dafnyTypesModuleName:L::Error::$errorName:L { $errorMessageMemberName:L, .. } => + $qualifiedRustServiceErrorType:L::$rustErrorName:L { + error: $sdkCrate:L::types::error::$rustErrorName:L::builder() + .set_message(crate::standard_library_conversions::ostring_from_dafny($errorMessageMemberName:L.clone())) + .build() + }, + """, + MapUtils.merge(errorVariables(errorShape), variables) + ) + ) + .collect(Collectors.joining("\n")); + variables.put("fromDafnyArms", fromDafnyArms); + + final TokenTree sdkContent = TokenTree.of( + IOUtils.evalTemplate( + getClass(), + "runtimes/rust/conversions/error_awssdk.rs", + variables + ) + ); + final TokenTree toDafnyOpaqueErrorFunctions = TokenTree.of( + IOUtils.evalTemplate( getClass(), "runtimes/rust/conversions/error_common.rs", - serviceVariables() + variables ) ); return new RustFile( - Path.of("src", "conversions", "error.rs"), - TokenTree.of(modulesDeclarations, toDafnyOpaqueErrorFunctions) + rootPathForShape(service).resolve("conversions").resolve("error.rs"), + TokenTree.of(modulesDeclarations, toDafnyOpaqueErrorFunctions, sdkContent) ); } @@ -275,6 +369,19 @@ protected boolean shouldGenerateStructForStructure( ); } + protected Set allEnumConversionModules() { + return ModelUtils + .streamEnumShapes(model, service.getId().getNamespace()) + .map(this::enumConversionModule) + .collect(Collectors.toSet()); + } + + protected Set allErrorConversionModules() { + return allErrorShapes() + .map(this::errorConversionModule) + .collect(Collectors.toSet()); + } + protected Set allUnionConversionModules() { return model .getUnionShapes() @@ -286,11 +393,12 @@ protected Set allUnionConversionModules() { @Override protected TokenTree operationRequestToDafnyFunction( + final Shape bindingShape, final OperationShape operationShape ) { final Map variables = MapUtils.merge( serviceVariables(), - operationVariables(operationShape) + operationVariables(bindingShape, operationShape) ); StructureShape inputShape = model.expectShape( operationShape.getInputShape(), @@ -369,11 +477,12 @@ protected boolean isStructureBuilderFallible( @Override protected TokenTree operationRequestFromDafnyFunction( + final Shape bindingShape, final OperationShape operationShape ) { final Map variables = MapUtils.merge( serviceVariables(), - operationVariables(operationShape) + operationVariables(bindingShape, operationShape) ); StructureShape inputShape = model.expectShape( operationShape.getInputShape(), @@ -383,6 +492,7 @@ protected TokenTree operationRequestFromDafnyFunction( "fluentMemberSetters", fluentMemberSettersForStructure(inputShape).toString() ); + variables.put("unwrapIfNecessary", ".unwrap()"); return TokenTree.of( evalTemplate( @@ -391,11 +501,12 @@ protected TokenTree operationRequestFromDafnyFunction( pub fn from_dafny( dafny_value: ::std::rc::Rc< crate::r#$dafnyTypesModuleName:L::$operationInputName:L, - >, - client: $sdkCrate:L::Client, - ) -> $sdkCrate:L::operation::$snakeCaseOperationName:L::builders::$operationName:LFluentBuilder { - client.$snakeCaseOperationName:L() + > + ) -> $sdkCrate:L::operation::$snakeCaseOperationName:L::$sdkOperationInputStruct:L { + $sdkCrate:L::operation::$snakeCaseOperationName:L::$sdkOperationInputStruct:L::builder() $fluentMemberSetters:L + .build() + $unwrapIfNecessary:L } """, variables @@ -405,11 +516,12 @@ pub fn from_dafny( @Override protected TokenTree operationResponseToDafnyFunction( + final Shape bindingShape, final OperationShape operationShape ) { final Map variables = MapUtils.merge( serviceVariables(), - operationVariables(operationShape) + operationVariables(bindingShape, operationShape) ); StructureShape outputShape = model.expectShape( operationShape.getOutputShape(), @@ -459,38 +571,66 @@ pub fn to_dafny( @Override protected TokenTree operationResponseFromDafnyFunction( + final Shape bindingShape, final OperationShape operationShape ) { - // No need for Dafny-to-Rust conversion - return TokenTree.empty(); - } - - @Override - protected Set operationConversionModules( - final OperationShape operationShape - ) { - var operationModuleName = toSnakeCase(operationName(operationShape)); - var operationModuleContent = declarePubModules( - Stream.of( - "_" + toSnakeCase(operationName(operationShape) + "Request"), - "_" + toSnakeCase(operationName(operationShape) + "Response") - ) + final Map variables = MapUtils.merge( + serviceVariables(), + operationVariables(bindingShape, operationShape) + ); + StructureShape outputShape = model.expectShape( + operationShape.getOutputShape(), + StructureShape.class + ); + variables.put( + "fluentMemberSetters", + fluentMemberSettersForStructure(outputShape).toString() + ); + variables.put( + "unwrapIfNecessary", + // TODO: Can't figure out why this one is fallible but not other similar output structures + outputShape + .getId() + .equals( + ShapeId.from("com.amazonaws.dynamodb#DescribeEndpointsResponse") + ) + ? ".unwrap()" + : "" ); - var errorToDafnyFunction = operationErrorToDafnyFunction(operationShape); + return TokenTree.of( + evalTemplate( + """ + #[allow(dead_code)] + pub fn from_dafny( + dafny_value: ::std::rc::Rc< + crate::r#$dafnyTypesModuleName:L::$operationOutputName:L, + > + ) -> $sdkCrate:L::operation::$snakeCaseOperationName:L::$sdkOperationOutputStruct:L { + $sdkCrate:L::operation::$snakeCaseOperationName:L::$sdkOperationOutputStruct:L::builder() + $fluentMemberSetters:L + .build() + $unwrapIfNecessary:L - RustFile outerModule = new RustFile( - Path.of("src", "conversions", operationModuleName + ".rs"), - TokenTree.of(operationModuleContent, errorToDafnyFunction) + } + """, + variables + ) ); + } - RustFile requestModule = operationRequestConversionModule(operationShape); - RustFile responseModule = operationResponseConversionModule(operationShape); - - return Set.of(outerModule, requestModule, responseModule); + @Override + protected TokenTree operationErrorConversionFunctions( + final BoundOperationShape boundOperationShape + ) { + return operationErrorToDafnyFunction( + boundOperationShape.bindingShape(), + boundOperationShape.operationShape() + ); } protected TokenTree operationErrorToDafnyFunction( + final Shape bindingShape, final OperationShape operationShape ) { TokenTree errorCases = TokenTree @@ -500,6 +640,7 @@ protected TokenTree operationErrorToDafnyFunction( .stream() .map(id -> errorVariantToDafny( + bindingShape, operationShape, model.expectShape(id, StructureShape.class) ) @@ -509,7 +650,7 @@ protected TokenTree operationErrorToDafnyFunction( final Map variables = MapUtils.merge( serviceVariables(), - operationVariables(operationShape) + operationVariables(bindingShape, operationShape) ); variables.put("errorCases", errorCases.toString()); @@ -526,10 +667,10 @@ pub fn to_dafny_error( match value { $sdkCrate:L::error::SdkError::ServiceError(service_error) => match service_error.err() { $errorCases:L - e => crate::conversions::error::to_opaque_error(e.to_string()), + e => $rustRootModuleName:L::conversions::error::to_opaque_error(e.to_string()), }, _ => { - crate::conversions::error::to_opaque_error(value.to_string()) + $rustRootModuleName:L::conversions::error::to_opaque_error(value.to_string()) } } } @@ -540,13 +681,43 @@ pub fn to_dafny_error( ); } + private RustFile typesErrorModule() { + final Map variables = serviceVariables(); + final String directErrorVariants = allErrorShapes() + .map(errorShape -> + IOUtils.evalTemplate( + """ + $rustErrorName:L { + error: $sdkCrate:L::types::error::$rustErrorName:L, + }, + """, + MapUtils.merge(variables, errorVariables(errorShape)) + ) + ) + .collect(Collectors.joining("\n\n")); + variables.put("modeledErrorVariants", directErrorVariants); + + final String content = IOUtils.evalTemplate( + getClass(), + "runtimes/rust/types/error_awssdk.rs", + variables + ); + + final Path path = rootPathForShape(service) + .resolve("types") + .resolve("error.rs"); + + return new RustFile(path, TokenTree.of(content)); + } + protected TokenTree errorVariantToDafny( + final Shape bindingShape, final OperationShape operationShape, final StructureShape errorShape ) { final Map variables = MapUtils.merge( serviceVariables(), - operationVariables(operationShape) + operationVariables(bindingShape, operationShape) ); String errorName = toPascalCase(errorShape.getId().getName()); variables.put("errorName", errorName); @@ -559,7 +730,7 @@ protected TokenTree errorVariantToDafny( evalTemplate( """ $sdkCrate:L::operation::$snakeCaseOperationName:L::$operationName:LError::$errorName:L(e) => - crate::conversions::error::$snakeCaseErrorName:L::to_dafny(e.clone()), + $rustRootModuleName:L::conversions::error::$snakeCaseErrorName:L::to_dafny(e.clone()), """, variables ) @@ -570,7 +741,10 @@ private RustFile errorConversionModule(final StructureShape errorStructure) { String structureName = errorStructure.getId().getName(); String snakeCaseName = toSnakeCase(structureName); String pascalCaseName = toPascalCase(structureName); - Path path = Path.of("src", "conversions", "error", snakeCaseName + ".rs"); + Path path = rootPathForShape(service) + .resolve("conversions") + .resolve("error") + .resolve(snakeCaseName + ".rs"); String template = """ #[allow(dead_code)] @@ -594,19 +768,18 @@ pub fn to_dafny( return new RustFile(path, TokenTree.of(evalTemplate(template, variables))); } - @Override - protected String getDafnyInternalModuleName() { + protected String getDafnyInternalModuleName(final String namespace) { return "software::amazon::cryptography::services::%s::internaldafny".formatted( getSdkId().toLowerCase() ); } - @Override protected String getRustTypesModuleName() { return "%s::types".formatted(getSdkCrate()); } - private String getSdkId() { + @Override + protected String getSdkId() { return service.expectTrait(ServiceTrait.class).getSdkId(); } @@ -617,10 +790,8 @@ private String getSdkCrate() { @Override protected HashMap serviceVariables() { final HashMap variables = super.serviceVariables(); - final String sdkId = getSdkId(); - variables.put("sdkId", sdkId); variables.put("sdkCrate", getSdkCrate()); - variables.put("clientName", "%sClient".formatted(sdkId)); + variables.put("clientName", "%sClient".formatted(getSdkId())); return variables; } @@ -644,9 +815,11 @@ private String sdkOperationOutputStruct(final OperationShape operationShape) { @Override protected HashMap operationVariables( - OperationShape operationShape + final Shape bindingShape, + final OperationShape operationShape ) { final HashMap variables = super.operationVariables( + bindingShape, operationShape ); variables.put( @@ -667,6 +840,9 @@ protected TokenTree toDafny( boolean isRustOption, boolean isDafnyOption ) { + final String rootRustModuleName = getRustRootModuleName( + service.getId().getNamespace() + ); return switch (shape.getType()) { case STRING, ENUM -> { if (shape.hasTrait(EnumTrait.class) || shape.isEnumShape()) { @@ -675,21 +851,23 @@ protected TokenTree toDafny( yield TokenTree.of( """ ::std::rc::Rc::new(match &%s { - Some(x) => crate::_Wrappers_Compile::Option::Some { value: crate::conversions::%s::to_dafny(x.clone()) }, + Some(x) => crate::_Wrappers_Compile::Option::Some { value: %s::conversions::%s::to_dafny(x.clone()) }, None => crate::_Wrappers_Compile::Option::None { } }) - """.formatted(rustValue, enumShapeName) + """.formatted(rustValue, rootRustModuleName, enumShapeName) ); } else if (isRustOption) { yield TokenTree.of( - "crate::conversions::%s::to_dafny(%s.clone().unwrap())".formatted( + "%s::conversions::%s::to_dafny(%s.clone().unwrap())".formatted( + rootRustModuleName, enumShapeName, rustValue ) ); } else { yield TokenTree.of( - "crate::conversions::%s::to_dafny(%s.clone())".formatted( + "%s::conversions::%s::to_dafny(%s.clone())".formatted( + rootRustModuleName, enumShapeName, rustValue ) @@ -946,24 +1124,24 @@ protected TokenTree toDafny( if (isRustOption) { yield TokenTree.of( """ - crate::conversions::%s::to_dafny(&%s.clone().unwrap()) - """.formatted(structureShapeName, rustValue) + %s::conversions::%s::to_dafny(&%s.clone().unwrap()) + """.formatted(rootRustModuleName, structureShapeName, rustValue) ); } else { yield TokenTree.of( """ - crate::conversions::%s::to_dafny(&%s) - """.formatted(structureShapeName, rustValue) + %s::conversions::%s::to_dafny(%s) + """.formatted(rootRustModuleName, structureShapeName, rustValue) ); } } else { yield TokenTree.of( """ ::std::rc::Rc::new(match &%s { - Some(x) => crate::_Wrappers_Compile::Option::Some { value: crate::conversions::%s::to_dafny(&x) }, + Some(x) => crate::_Wrappers_Compile::Option::Some { value: %s::conversions::%s::to_dafny(x) }, None => crate::_Wrappers_Compile::Option::None { } }) - """.formatted(rustValue, structureShapeName) + """.formatted(rustValue, rootRustModuleName, structureShapeName) ); } } @@ -972,4 +1150,81 @@ protected TokenTree toDafny( ); }; } + + @Override + public TokenTree topLevelModuleDeclarations() { + return TokenTree.of( + """ + pub mod client; + pub mod conversions; + pub mod types; + """ + ); + } + + protected String qualifiedRustStructureType( + final StructureShape structureShape + ) { + if (operationIndex.isInputStructure(structureShape)) { + final OperationShape operationShape = operationIndex + .getInputBindings(structureShape) + .stream() + .collect(MoreCollectors.onlyElement()); + return ( + getSdkCrate() + + "::operation::%s::%s".formatted( + toSnakeCase(operationShape.getId().getName()), + sdkOperationInputStruct(operationShape) + ) + ); + } + if (operationIndex.isOutputStructure(structureShape)) { + final OperationShape operationShape = operationIndex + .getOutputBindings(structureShape) + .stream() + .collect(MoreCollectors.onlyElement()); + return ( + getSdkCrate() + + "::operation::%s::%s".formatted( + toSnakeCase(operationShape.getId().getName()), + sdkOperationOutputStruct(operationShape) + ) + ); + } + return super.qualifiedRustStructureType(structureShape); + } + + protected String getRustConversionsModuleNameForShape(final Shape shape) { + final String namespace = shape.getId().getNamespace(); + if (shape.isStructureShape()) { + if (operationIndex.isInputStructure(shape)) { + final OperationShape operationShape = operationIndex + .getInputBindings(shape) + .stream() + .collect(MoreCollectors.onlyElement()); + return ( + getRustRootModuleName(namespace) + + "::conversions::%s::_%s".formatted( + toSnakeCase(operationName(operationShape)), + toSnakeCase(syntheticOperationInputName(operationShape)) + ) + ); + } + if (operationIndex.isOutputStructure(shape)) { + final OperationShape operationShape = operationIndex + .getOutputBindings(shape) + .stream() + .collect(MoreCollectors.onlyElement()); + return ( + getRustRootModuleName(namespace) + + "::conversions::%s::_%s".formatted( + toSnakeCase(operationName(operationShape)), + toSnakeCase(syntheticOperationOutputName(operationShape)) + ) + ); + } + } + + return super.getRustConversionsModuleNameForShape(shape); + } } diff --git a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyrust/generator/RustLibraryShimGenerator.java b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyrust/generator/RustLibraryShimGenerator.java index 6f1a5c272..71defacb6 100644 --- a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyrust/generator/RustLibraryShimGenerator.java +++ b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyrust/generator/RustLibraryShimGenerator.java @@ -6,7 +6,6 @@ import java.math.BigDecimal; import java.nio.file.Path; -import java.util.Collection; import java.util.HashMap; import java.util.HashSet; import java.util.List; @@ -14,9 +13,12 @@ import java.util.Optional; import java.util.Set; import java.util.stream.Collectors; +import java.util.stream.Stream; +import software.amazon.polymorph.smithydafny.DafnyNameResolver; import software.amazon.polymorph.traits.DafnyUtf8BytesTrait; import software.amazon.polymorph.traits.LocalServiceTrait; import software.amazon.polymorph.traits.PositionalTrait; +import software.amazon.polymorph.utils.BoundOperationShape; import software.amazon.polymorph.utils.ConstrainTraitUtils; import software.amazon.polymorph.utils.IOUtils; import software.amazon.polymorph.utils.MapUtils; @@ -38,24 +40,24 @@ import software.amazon.smithy.model.traits.EnumTrait; import software.amazon.smithy.model.traits.LengthTrait; import software.amazon.smithy.model.traits.RangeTrait; +import software.amazon.smithy.model.traits.ReadonlyTrait; +import software.amazon.smithy.model.traits.UnitTypeTrait; /** * Generates all Rust modules needed to wrap a Dafny library as a Rust library. */ public class RustLibraryShimGenerator extends AbstractRustShimGenerator { - private final StructureShape configShape; + private final boolean generateWrappedClient; public RustLibraryShimGenerator( + final MergedServicesGenerator mergedGenerator, final Model model, - final ServiceShape service + final ServiceShape service, + final boolean generateWrappedClient ) { - super(model, service); - // Check assumptions - final ShapeId configId = service - .expectTrait(LocalServiceTrait.class) - .getConfigId(); - configShape = model.expectShape(configId, StructureShape.class); + super(mergedGenerator, model, service); + this.generateWrappedClient = generateWrappedClient; } @Override @@ -70,12 +72,14 @@ protected Set rustFiles() { result.add(typesModule()); result.add(typesConfigModule()); result.add(typesBuildersModule()); + result.addAll( streamStructuresToGenerateStructsFor() .map(this::standardStructureModule) .toList() ); result.add(typesErrorModule()); + result.addAll( ModelUtils .streamEnumShapes(model, service.getId().getNamespace()) @@ -109,6 +113,7 @@ protected Set rustFiles() { result.add(conversionsErrorModule()); result.add(conversionsClientModule()); result.addAll(configConversionModules()); + result.addAll(allOperationConversionModules()); result.addAll( streamStructuresToGenerateStructsFor() @@ -131,31 +136,84 @@ protected Set rustFiles() { ); result.addAll( streamResourcesToGenerateTraitsFor() + .filter(this::shouldGenerateTraitForResource) .map(this::resourceConversionModule) .toList() ); // wrapped client - result.add(wrappedModule()); - result.add(wrappedClientModule()); + if (generateWrappedClient) { + result.add(wrappedModule()); + result.add(wrappedClientModule()); + } + + // deps module + result.add(depsModule()); return result; } + @Override + protected String getRustTypesModuleName() { + return getRustRootModuleName(service.getId().getNamespace()) + "::types"; + } + + public static final String TOP_LEVEL_MOD_DECLS = + """ + pub mod client; + pub mod types; + /// Common errors and error handling utilities. + pub mod error; + /// All operations that this crate can perform. + pub mod operation; + pub mod conversions; + pub mod deps; + """; + + public static final String TOP_LEVEL_WRAPPED_CLIENT_DECL = + """ + #[cfg(feature = "wrapped-client")] + pub mod wrapped; + """; + + private RustFile depsModule() { + final TokenTree content; + if (mergedGenerator.isMainService(service)) { + content = + RustUtils.declarePubModules( + mergedGenerator + .streamServicesToGenerateFor(model) + .filter(s -> !mergedGenerator.isMainService(s)) + .map(s -> s.getId().getNamespace()) + .map(RustUtils::rustModuleForSmithyNamespace) + ); + } else { + content = RustUtils.declarePubModules(Stream.empty()); + } + return new RustFile(rootPathForShape(service).resolve("deps.rs"), content); + } + @Override protected boolean shouldGenerateStructForStructure( final StructureShape structureShape ) { return ( super.shouldGenerateStructForStructure(structureShape) && - // don't generate a structure for the config structure - !localServiceTrait().getConfigId().equals(structureShape.getId()) + // don't generate a structure for the config structures + !localServiceTrait(service) + .getConfigId() + .equals(structureShape.getId()) && + !structureShape.hasTrait(PositionalTrait.class) ); } @Override protected RustFile conversionsModule() { final RustFile file = super.conversionsModule(); + final StructureShape configShape = ModelUtils.getConfigShape( + model, + service + ); final TokenTree content = file .content() .append( @@ -170,7 +228,10 @@ private RustFile clientModule() { final Map variables = serviceVariables(); variables.put( "operationModules", - serviceOperationShapes() + service + .getOperations() + .stream() + .map(id -> model.expectShape(id, OperationShape.class)) .map(operationShape -> "mod %s;".formatted(toSnakeCase(operationName(operationShape))) ) @@ -181,7 +242,10 @@ private RustFile clientModule() { "runtimes/rust/client.rs", variables ); - return new RustFile(Path.of("src", "client.rs"), TokenTree.of(content)); + return new RustFile( + rootPathForShape(service).resolve("client.rs"), + TokenTree.of(content) + ); } protected RustFile conversionsClientModule() { @@ -193,59 +257,63 @@ protected RustFile conversionsClientModule() { ) ); return new RustFile( - Path.of("src", "conversions", "client.rs"), + rootPathForShape(service).resolve("conversions").resolve("client.rs"), TokenTree.of(clientConversionFunctions) ); } private Set allOperationClientBuilders() { - return allOperationShapes() - .filter(this::shouldGenerateOperation) - .map(this::operationClientBuilder) + return streamAllBoundOperationShapes() + .map(this::boundOperationClientBuilder) .collect(Collectors.toSet()); } - private RustFile operationClientBuilder(final OperationShape operationShape) { + private RustFile boundOperationClientBuilder( + final BoundOperationShape boundOperationShape + ) { + final Shape bindingShape = boundOperationShape.bindingShape(); + final OperationShape operationShape = boundOperationShape.operationShape(); + final Map variables = MapUtils.merge( serviceVariables(), - operationVariables(operationShape) + operationVariables(bindingShape, operationShape) ); variables.put( "builderSettersDoc", - operationClientBuilderSettersDoc(operationShape) + operationClientBuilderSettersDoc(bindingShape, operationShape) + ); + variables.put( + "outputDoc", + operationClientOutputDoc(bindingShape, operationShape) ); - variables.put("outputDoc", operationClientOutputDoc(operationShape)); final String content = IOUtils.evalTemplate( getClass(), "runtimes/rust/operation/operation_builder.rs", variables ); - final Path path = operationBindingIndex - .getBindingShape(operationShape) - .get() - .isServiceShape() - ? Path.of( - "src", - "client", - variables.get("snakeCaseOperationName") + ".rs" - ) - : Path.of( - "src", - "types", - variables.get("operationTargetName"), - variables.get("snakeCaseOperationName") + ".rs" - ); + final Path path = bindingShape.isServiceShape() + ? rootPathForShape(bindingShape) + .resolve("client") + .resolve(variables.get("snakeCaseOperationName") + ".rs") + : rootPathForShape(bindingShape) + .resolve("types") + .resolve(variables.get("operationTargetName")) + .resolve(variables.get("snakeCaseOperationName") + ".rs"); return new RustFile(path, TokenTree.of(content)); } private String operationClientBuilderSettersDoc( + final Shape bindingShape, final OperationShape operationShape ) { final StructureShape inputShape = model.expectShape( operationShape.getInputShape(), StructureShape.class ); - final Map opVariables = operationVariables(operationShape); + final Map opVariables = operationVariables( + bindingShape, + operationShape + ); final String template = """ /// - [`$fieldName:L(impl Into>)`](crate::operation::$snakeCaseOperationName:L::builders::$operationName:LFluentBuilder::$fieldName:L) / [`set_$fieldName:L(Option<$fieldType:L>)`](crate::operation::$snakeCaseOperationName:L::builders::$operationName:LFluentBuilder::set_$fieldName:L): (undocumented)
""".indent( @@ -264,12 +332,18 @@ private String operationClientBuilderSettersDoc( .collect(Collectors.joining("\n")); } - private String operationClientOutputDoc(final OperationShape operationShape) { + private String operationClientOutputDoc( + final Shape bindingShape, + final OperationShape operationShape + ) { final StructureShape outputShape = model.expectShape( operationShape.getOutputShape(), StructureShape.class ); - final Map opVariables = operationVariables(operationShape); + final Map opVariables = operationVariables( + bindingShape, + operationShape + ); final String template = """ /// - [`$fieldName:L(Option<$fieldType:L>)`](crate::operation::$snakeCaseOperationName:L::$operationOutputName:L::$fieldName:L): (undocumented)""".indent( @@ -290,8 +364,10 @@ private String operationClientOutputDoc(final OperationShape operationShape) { private RustFile typesModule() { final Map variables = serviceVariables(); + final String namespace = service.getId().getNamespace(); final String resourceModules = streamResourcesToGenerateTraitsFor() + .filter(o -> o.getId().getNamespace().equals(namespace)) .map(resourceShape -> IOUtils.evalTemplate( """ @@ -305,13 +381,14 @@ private RustFile typesModule() { variables.put("resourceModules", resourceModules); final String structureModules = streamStructuresToGenerateStructsFor() + .filter(o -> o.getId().getNamespace().equals(namespace)) .map(structureShape -> IOUtils.evalTemplate( """ mod _$snakeCaseStructureName:L; - pub use crate::types::_$snakeCaseStructureName:L::$rustStructureName:L; + pub use $rustTypesModuleName:L::_$snakeCaseStructureName:L::$rustStructureName:L; """, - structureVariables(structureShape) + MapUtils.merge(variables, structureVariables(structureShape)) ) ) .collect(Collectors.joining("\n")); @@ -319,13 +396,14 @@ private RustFile typesModule() { final String enumModules = ModelUtils .streamEnumShapes(model, service.getId().getNamespace()) + .filter(o -> o.getId().getNamespace().equals(namespace)) .map(enumShape -> IOUtils.evalTemplate( """ mod _$snakeCaseEnumName:L; - pub use crate::types::_$snakeCaseEnumName:L::$rustEnumName:L; + pub use $rustTypesModuleName:L::_$snakeCaseEnumName:L::$rustEnumName:L; """, - enumVariables(enumShape) + MapUtils.merge(variables, enumVariables(enumShape)) ) ) .collect(Collectors.joining("\n")); @@ -335,13 +413,14 @@ private RustFile typesModule() { .getUnionShapes() .stream() .filter(this::shouldGenerateEnumForUnion) + .filter(o -> o.getId().getNamespace().equals(namespace)) .map(unionShape -> IOUtils.evalTemplate( """ mod _$snakeCaseUnionName:L; - pub use crate::types::_$snakeCaseUnionName:L::$rustUnionName:L; + pub use $rustTypesModuleName:L::_$snakeCaseUnionName:L::$rustUnionName:L; """, - unionVariables(unionShape) + MapUtils.merge(variables, unionVariables(unionShape)) ) ) .collect(Collectors.joining("\n")); @@ -352,10 +431,17 @@ private RustFile typesModule() { "runtimes/rust/types.rs", variables ); - return new RustFile(Path.of("src", "types.rs"), TokenTree.of(content)); + return new RustFile( + rootPathForNamespace(namespace).resolve("types.rs"), + TokenTree.of(content) + ); } private RustFile typesConfigModule() { + final StructureShape configShape = ModelUtils.getConfigShape( + model, + service + ); final Map variables = MapUtils.merge( serviceVariables(), standardStructureVariables(configShape), @@ -366,17 +452,16 @@ private RustFile typesConfigModule() { "runtimes/rust/types/config.rs", variables ); - final Path path = Path.of( - "src", - "types", - "%s.rs".formatted(variables.get("snakeCaseConfigName")) - ); + final Path path = rootPathForShape(service) + .resolve("types") + .resolve("%s.rs".formatted(variables.get("snakeCaseConfigName"))); return new RustFile(path, TokenTree.of(content)); } private RustFile typesBuildersModule() { final Map variables = serviceVariables(); final String content = streamStructuresToGenerateStructsFor() + .filter(s -> ModelUtils.isInServiceNamespace(s, service)) .map(structureShape -> IOUtils.evalTemplate( "pub use $rustTypesModuleName:L::_$snakeCaseStructureName:L::$rustStructureName:LBuilder;", @@ -384,13 +469,15 @@ private RustFile typesBuildersModule() { ) ) .collect(Collectors.joining("\n\n")); - final Path path = Path.of("src", "types", "builders.rs"); + final Path path = rootPathForShape(service) + .resolve("types") + .resolve("builders.rs"); return new RustFile(path, TokenTree.of(content)); } private RustFile typesErrorModule() { final Map variables = serviceVariables(); - final String modeledErrorVariants = allErrorShapes() + final Stream directErrorVariants = allErrorShapes() .map(errorShape -> IOUtils.evalTemplate( """ @@ -400,7 +487,25 @@ private RustFile typesErrorModule() { """, MapUtils.merge(variables, errorVariables(errorShape)) ) - ) + ); + final Stream dependencies = + ModelUtils.streamLocalServiceDependencies(model, service); + final Stream dependencyErrorVariants = + dependencies.map(dependentService -> { + return IOUtils.evalTemplate( + """ + $rustErrorName:L { + error: $rustDependentRootModuleName:L::types::error::Error, + }, + """, + MapUtils.merge( + variables, + dependentServiceErrorVariables(service, dependentService) + ) + ); + }); + final String modeledErrorVariants = Stream + .concat(directErrorVariants, dependencyErrorVariants) .collect(Collectors.joining("\n\n")); variables.put("modeledErrorVariants", modeledErrorVariants); @@ -410,7 +515,10 @@ private RustFile typesErrorModule() { variables ); - final Path path = Path.of("src", "types", "error.rs"); + final Path path = rootPathForShape(service) + .resolve("types") + .resolve("error.rs"); + return new RustFile(path, TokenTree.of(content)); } @@ -446,11 +554,9 @@ private RustFile enumTypeModule(final EnumShape enumShape) { variables ); - final Path path = Path.of( - "src", - "types", - "_%s.rs".formatted(toSnakeCase(enumName(enumShape))) - ); + final Path path = rootPathForShape(service) + .resolve("types") + .resolve("_%s.rs".formatted(toSnakeCase(enumName(enumShape)))); return new RustFile(path, TokenTree.of(content)); } @@ -521,11 +627,9 @@ private RustFile unionTypeModule(final UnionShape unionShape) { "runtimes/rust/types/union.rs", variables ); - final Path path = Path.of( - "src", - "types", - "_%s.rs".formatted(toSnakeCase(unionName(unionShape))) - ); + final Path path = rootPathForShape(service) + .resolve("types") + .resolve("_%s.rs".formatted(toSnakeCase(unionName(unionShape)))); return new RustFile(path, TokenTree.of(content)); } @@ -547,7 +651,7 @@ private RustFile resourceTypeModule(final ResourceShape resourceShape) { ); final Map operationVariables = MapUtils.merge( variables, - operationVariables(operationShape) + operationVariables(resourceShape, operationShape) ); return IOUtils.evalTemplate( getClass(), @@ -574,39 +678,55 @@ private RustFile resourceTypeModule(final ResourceShape resourceShape) { "runtimes/rust/types/resource.rs", variables ); - final Path path = Path.of( - "src", - "types", - "%s.rs".formatted(toSnakeCase(resourceName(resourceShape))) - ); + final Path path = rootPathForShape(service) + .resolve("types") + .resolve("%s.rs".formatted(toSnakeCase(resourceName(resourceShape)))); return new RustFile(path, TokenTree.of(content)); } private RustFile operationModule() { + final String content = operationBindingIndex + .getAllBindingShapes() + .stream() + // Need to filter by the binding shape, not the operation shape + .filter(bindingShape -> + ModelUtils.isInServiceNamespace(bindingShape, service) + ) + .flatMap(this::operationModuleDeclarationForBindingShape) + .collect(Collectors.joining("\n\n")); + return new RustFile( + rootPathForShape(service).resolve("operation.rs"), + TokenTree.of(content) + ); + } + + private Stream operationModuleDeclarationForBindingShape( + final Shape bindingShape + ) { final String opTemplate = """ /// Types for the `$operationName:L` operation. pub mod $snakeCaseOperationName:L; """; - final String content = allOperationShapes() - .filter(this::shouldGenerateOperation) - .map(this::operationVariables) - .map(opVariables -> IOUtils.evalTemplate(opTemplate, opVariables)) - .collect(Collectors.joining("\n\n")); - return new RustFile(Path.of("src", "operation.rs"), TokenTree.of(content)); + return operationBindingIndex + .getOperations(bindingShape) + .stream() + .map(o -> operationVariables(bindingShape, o.operationShape())) + .map(opVariables -> IOUtils.evalTemplate(opTemplate, opVariables)); } private Set allOperationImplementationModules() { - return allOperationShapes() - .filter(this::shouldGenerateOperation) - .map(this::operationImplementationModules) - .flatMap(Collection::stream) + return streamAllBoundOperationShapes() + .flatMap(bo -> boundOperationImplementationModules(bo).stream()) .collect(Collectors.toSet()); } - private Set operationImplementationModules( - final OperationShape operationShape + private Set boundOperationImplementationModules( + final BoundOperationShape boundOperationShape ) { + final Shape bindingShape = boundOperationShape.bindingShape(); + final OperationShape operationShape = boundOperationShape.operationShape(); + final StructureShape inputShape = model.expectShape( operationShape.getInputShape(), StructureShape.class @@ -616,27 +736,25 @@ private Set operationImplementationModules( StructureShape.class ); return Set.of( - operationOuterModule(operationShape, inputShape), - operationStructureModule(operationShape, inputShape), - operationStructureModule(operationShape, outputShape), - operationBuildersModule(operationShape) + operationOuterModule(bindingShape, operationShape, inputShape), + operationStructureModule(bindingShape, operationShape, inputShape), + operationStructureModule(bindingShape, operationShape, outputShape), + operationBuildersModule(bindingShape, operationShape) ); } private RustFile operationOuterModule( + final Shape bindingShape, final OperationShape operationShape, final StructureShape inputShape ) { - final Shape bindingShape = operationBindingIndex - .getBindingShape(operationShape) - .orElseThrow(); final Map variables = MapUtils.merge( serviceVariables(), - operationVariables(operationShape) + operationVariables(bindingShape, operationShape) ); variables.put( "inputValidations", - new InputValidationGenerator(operationShape) + new InputValidationGenerator(bindingShape, operationShape) .generateValidations(model, inputShape) .collect(Collectors.joining("\n")) ); @@ -652,11 +770,13 @@ private RustFile operationOuterModule( "inputToDafny", toDafny(inputShape, rustValue, true, false).toString() ); + } else if (inputShape.hasTrait(UnitTypeTrait.class)) { + variables.put("inputToDafny", "()"); } else { variables.put( "inputToDafny", evalTemplate( - "crate::conversions::$snakeCaseOperationName:L::_$snakeCaseSyntheticOperationInputName:L::to_dafny(input)", + "$rustRootModuleName:L::conversions::$snakeCaseOperationName:L::_$snakeCaseSyntheticOperationInputName:L::to_dafny(input)", variables ) ); @@ -671,15 +791,23 @@ private RustFile operationOuterModule( fromDafny(outputShape, "inner_result.value()", false, false) .toString() ); + } else if (outputShape.hasTrait(UnitTypeTrait.class)) { + variables.put("outputFromDafny", "()"); } else { variables.put( "outputFromDafny", evalTemplate( - "crate::conversions::$snakeCaseOperationName:L::_$snakeCaseSyntheticOperationOutputName:L::from_dafny(inner_result.value().clone())", + "$rustRootModuleName:L::conversions::$snakeCaseOperationName:L::_$snakeCaseSyntheticOperationOutputName:L::from_dafny(inner_result.value().clone())", variables ) ); } + + variables.put( + "innerInput", + inputShape.hasTrait(UnitTypeTrait.class) ? "" : "&inner_input" + ); + variables.put( "operationSendBody", IOUtils.evalTemplate( @@ -708,7 +836,7 @@ private RustFile operationOuterModule( ); final String snakeCaseOpName = toSnakeCase(operationName(operationShape)); - final Path path = operationsModuleFilePath() + final Path path = operationsModuleFilePath(bindingShape) .resolve(snakeCaseOpName + ".rs"); return new RustFile(path, TokenTree.of(content)); } @@ -718,9 +846,15 @@ class InputValidationGenerator private final Map commonVariables; - InputValidationGenerator(final OperationShape operationShape) { + InputValidationGenerator( + final Shape bindingShape, + final OperationShape operationShape + ) { this.commonVariables = - MapUtils.merge(serviceVariables(), operationVariables(operationShape)); + MapUtils.merge( + serviceVariables(), + operationVariables(bindingShape, operationShape) + ); } @Override @@ -846,12 +980,13 @@ private String describeMinMax( } private RustFile operationStructureModule( + final Shape bindingShape, final OperationShape operationShape, final StructureShape structureShape ) { final Map variables = MapUtils.merge( serviceVariables(), - operationVariables(operationShape), + operationVariables(bindingShape, operationShape), structureVariables(structureShape), structureModuleVariables(structureShape) ); @@ -860,7 +995,7 @@ private RustFile operationStructureModule( "runtimes/rust/operation/structure.rs", variables ); - final Path path = operationModuleFilePath(operationShape) + final Path path = operationModuleFilePath(bindingShape, operationShape) .resolve("_%s.rs".formatted(toSnakeCase(structureName(structureShape)))); return new RustFile(path, TokenTree.of(content)); } @@ -878,11 +1013,9 @@ private RustFile standardStructureModule( "runtimes/rust/types/structure.rs", variables ); - final Path path = Path.of( - "src", - "types", - "_%s.rs".formatted(toSnakeCase(structureName(structureShape))) - ); + final Path path = rootPathForShape(service) + .resolve("types") + .resolve("_%s.rs".formatted(toSnakeCase(structureName(structureShape)))); return new RustFile(path, TokenTree.of(content)); } @@ -985,6 +1118,7 @@ private String structureBuilderAssignment(final MemberShape memberShape) { } private RustFile operationBuildersModule( + final Shape bindingShape, final OperationShape operationShape ) { final StructureShape inputShape = model.expectShape( @@ -998,7 +1132,7 @@ private RustFile operationBuildersModule( final Map variables = MapUtils.merge( serviceVariables(), - operationVariables(operationShape) + operationVariables(bindingShape, operationShape) ); variables.put("accessors", accessors); @@ -1007,7 +1141,7 @@ private RustFile operationBuildersModule( "runtimes/rust/operation/builders.rs", variables ); - final Path path = operationModuleFilePath(operationShape) + final Path path = operationModuleFilePath(bindingShape, operationShape) .resolve("builders.rs"); return new RustFile(path, TokenTree.of(content)); } @@ -1044,7 +1178,10 @@ private RustFile errorModule() { "runtimes/rust/error.rs", Map.of() ); - return new RustFile(Path.of("src", "error.rs"), TokenTree.of(content)); + return new RustFile( + rootPathForShape(service).resolve("error.rs"), + TokenTree.of(content) + ); } private RustFile sealedUnhandledErrorModule() { @@ -1054,7 +1191,7 @@ private RustFile sealedUnhandledErrorModule() { Map.of() ); return new RustFile( - Path.of("src", "error", "sealed_unhandled.rs"), + rootPathForShape(service).resolve("error").resolve("sealed_unhandled.rs"), TokenTree.of(content) ); } @@ -1062,7 +1199,7 @@ private RustFile sealedUnhandledErrorModule() { protected RustFile conversionsErrorModule() { final Map variables = serviceVariables(); - final String toDafnyArms = allErrorShapes() + final Stream directToDafnyArms = allErrorShapes() .map(errorShape -> IOUtils.evalTemplate( """ @@ -1073,11 +1210,29 @@ protected RustFile conversionsErrorModule() { """, MapUtils.merge(variables, errorVariables(errorShape)) ) - ) + ); + final Stream dependencyToDafnyArms = ModelUtils + .streamLocalServiceDependencies(model, service) + .map(dependentService -> + IOUtils.evalTemplate( + """ + $qualifiedRustErrorVariant:L { error } => + crate::r#$dafnyTypesModuleName:L::Error::$errorName:L { + $errorName:L: $rustDependentRootModuleName:L::conversions::error::to_dafny(error), + }, + """, + MapUtils.merge( + variables, + dependentServiceErrorVariables(service, dependentService) + ) + ) + ); + final String toDafnyArms = Stream + .concat(directToDafnyArms, dependencyToDafnyArms) .collect(Collectors.joining("\n")); variables.put("toDafnyArms", toDafnyArms); - final String fromDafnyArms = allErrorShapes() + final Stream directFromDafnyArms = allErrorShapes() .map(errorShape -> IOUtils.evalTemplate( """ @@ -1088,7 +1243,25 @@ protected RustFile conversionsErrorModule() { """, MapUtils.merge(variables, errorVariables(errorShape)) ) - ) + ); + final Stream dependencyFromDafnyArms = ModelUtils + .streamLocalServiceDependencies(model, service) + .map(dependentService -> + IOUtils.evalTemplate( + """ + crate::r#$dafnyTypesModuleName:L::Error::$errorName:L { $errorName:L } => + $qualifiedRustErrorVariant:L { + error: $rustDependentRootModuleName:L::conversions::error::from_dafny($errorName:L.clone()), + }, + """, + MapUtils.merge( + variables, + dependentServiceErrorVariables(service, dependentService) + ) + ) + ); + final String fromDafnyArms = Stream + .concat(directFromDafnyArms, dependencyFromDafnyArms) .collect(Collectors.joining("\n")); variables.put("fromDafnyArms", fromDafnyArms); @@ -1103,12 +1276,16 @@ protected RustFile conversionsErrorModule() { variables ); return new RustFile( - Path.of("src", "conversions", "error.rs"), + rootPathForShape(service).resolve("conversions").resolve("error.rs"), TokenTree.of(commonContent, libraryContent) ); } private Set configConversionModules() { + final StructureShape configShape = ModelUtils.getConfigShape( + model, + service + ); final Map variables = MapUtils.merge( serviceVariables(), standardStructureVariables(configShape) @@ -1128,11 +1305,9 @@ private Set configConversionModules() { "runtimes/rust/conversions/config.rs", variables ); - final Path outerPath = Path.of( - "src", - "conversions", - "%s.rs".formatted(snakeCaseConfigName) - ); + final Path outerPath = rootPathForShape(service) + .resolve("conversions") + .resolve("%s.rs".formatted(snakeCaseConfigName)); final RustFile outerModule = new RustFile( outerPath, TokenTree.of(outerContent) @@ -1143,12 +1318,10 @@ private Set configConversionModules() { "runtimes/rust/conversions/config/_config.rs", variables ); - final Path innerPath = Path.of( - "src", - "conversions", - snakeCaseConfigName, - "_%s.rs".formatted(snakeCaseConfigName) - ); + final Path innerPath = rootPathForShape(service) + .resolve("conversions") + .resolve(snakeCaseConfigName) + .resolve("_%s.rs".formatted(snakeCaseConfigName)); final RustFile innerModule = new RustFile( innerPath, TokenTree.of(innerContent) @@ -1178,11 +1351,9 @@ private RustFile standardStructureConversionModule( variables ); - final Path path = Path.of( - "src", - "conversions", - "%s.rs".formatted(toSnakeCase(structureName(structureShape))) - ); + final Path path = rootPathForShape(service) + .resolve("conversions") + .resolve("%s.rs".formatted(toSnakeCase(structureName(structureShape)))); return new RustFile(path, TokenTree.of(content)); } @@ -1193,7 +1364,21 @@ private RustFile resourceConversionModule(final ResourceShape resourceShape) { ); variables.put( - "resourceOperations", + "resourceWrapperOperations", + resourceShape + .getAllOperations() + .stream() + .map(id -> { + final OperationShape operationShape = model.expectShape( + id, + OperationShape.class + ); + return resourceOperationWrapperImpl(resourceShape, operationShape); + }) + .collect(Collectors.joining("\n\n")) + ); + variables.put( + "resourceDafnyWrapperOperations", resourceShape .getAllOperations() .stream() @@ -1204,12 +1389,11 @@ private RustFile resourceConversionModule(final ResourceShape resourceShape) { ); final Map operationVariables = MapUtils.merge( variables, - operationVariables(operationShape) + operationVariables(resourceShape, operationShape) ); - return IOUtils.evalTemplate( - getClass(), - "runtimes/rust/conversions/resource_operation.rs", - operationVariables + return resourceOperationDafnyWrapperImpl( + resourceShape, + operationShape ); }) .collect(Collectors.joining("\n\n")) @@ -1220,79 +1404,140 @@ private RustFile resourceConversionModule(final ResourceShape resourceShape) { "runtimes/rust/conversions/resource.rs", variables ); - final Path path = Path.of( - "src", - "conversions", - "%s.rs".formatted(toSnakeCase(resourceName(resourceShape))) - ); + final Path path = rootPathForShape(service) + .resolve("conversions") + .resolve("%s.rs".formatted(toSnakeCase(resourceName(resourceShape)))); return new RustFile(path, TokenTree.of(content)); } - @Override - protected Set operationConversionModules( + private String resourceOperationWrapperImpl( + final ResourceShape resourceShape, final OperationShape operationShape ) { final Map variables = MapUtils.merge( serviceVariables(), - operationVariables(operationShape) + resourceVariables(resourceShape), + operationVariables(resourceShape, operationShape) ); - final String operationModuleName = toSnakeCase( - operationName(operationShape) - ); - - Optional inputStructure = operationIndex.getInputShape( - operationShape - ); - final boolean hasInputStructure = - inputStructure.isPresent() && - !inputStructure.get().hasTrait(PositionalTrait.class); - Optional outputStructure = operationIndex.getOutputShape( - operationShape - ); - final boolean hasOutputStructure = - outputStructure.isPresent() && - !outputStructure.get().hasTrait(PositionalTrait.class); - - final Set childModules = new HashSet<>(); - if (hasInputStructure) { - childModules.add( - "_" + variables.get("snakeCaseSyntheticOperationInputName") + StructureShape inputShape = operationIndex + .getInputShape(operationShape) + .get(); + if (inputShape.hasTrait(PositionalTrait.class)) { + // Need to fetch the single member and then convert, + // since on the Rust side there is still an input structure + // but not on the Dafny side. + final MemberShape onlyMember = PositionalTrait.onlyMember(inputShape); + final String rustValue = "input." + onlyMember.getMemberName() + "()"; + variables.put( + "inputFromDafny", + fromDafny(inputShape, rustValue, false, false).toString() + ); + } else { + variables.put( + "inputFromDafny", + evalTemplate( + "$rustRootModuleName:L::conversions::$snakeCaseOperationName:L::_$snakeCaseSyntheticOperationInputName:L::from_dafny(input.clone())", + variables + ) ); } - if (hasOutputStructure) { - childModules.add( - "_" + variables.get("snakeCaseSyntheticOperationOutputName") + + StructureShape outputShape = operationIndex + .getOutputShape(operationShape) + .get(); + if (outputShape.hasTrait(PositionalTrait.class)) { + variables.put( + "outputToDafny", + toDafny(outputShape, "x", false, false).toString() + ); + } else if (outputShape.hasTrait(UnitTypeTrait.class)) { + variables.put("outputToDafny", "()"); + } else { + variables.put( + "outputToDafny", + evalTemplate( + "$rustRootModuleName:L::conversions::$snakeCaseOperationName:L::_$snakeCaseSyntheticOperationOutputName:L::to_dafny(x.clone())", + variables + ) ); } - final RustFile outerModule = new RustFile( - Path.of("src", "conversions", operationModuleName + ".rs"), - declarePubModules(childModules.stream()) + + return IOUtils.evalTemplate( + getClass(), + "runtimes/rust/conversions/resource_wrapper_operation.rs", + variables ); + } - Set result = new HashSet<>(Set.of(outerModule)); + private String resourceOperationDafnyWrapperImpl( + final ResourceShape resourceShape, + final OperationShape operationShape + ) { + final Map variables = MapUtils.merge( + serviceVariables(), + resourceVariables(resourceShape), + operationVariables(resourceShape, operationShape) + ); - if (hasInputStructure) { - final RustFile requestModule = operationRequestConversionModule( - operationShape + StructureShape inputShape = operationIndex + .getInputShape(operationShape) + .get(); + if (inputShape.hasTrait(PositionalTrait.class)) { + // Need to fetch the single member and then convert, + // since on the Rust side there is still an input structure + // but not on the Dafny side. + final MemberShape onlyMember = PositionalTrait.onlyMember(inputShape); + final String rustValue = + "input." + toSnakeCase(onlyMember.getMemberName()); + variables.put( + "inputToDafny", + toDafny(inputShape, rustValue, true, false).toString() + ); + } else { + variables.put( + "inputToDafny", + evalTemplate( + "$rustRootModuleName:L::conversions::$snakeCaseOperationName:L::_$snakeCaseSyntheticOperationInputName:L::to_dafny(input)", + variables + ) ); - result.add(requestModule); } - if (hasOutputStructure) { - final RustFile responseModule = operationResponseConversionModule( - operationShape + + StructureShape outputShape = operationIndex + .getOutputShape(operationShape) + .get(); + if (outputShape.hasTrait(PositionalTrait.class)) { + variables.put( + "outputFromDafny", + fromDafny(outputShape, "inner_result.value()", false, false).toString() + ); + } else if (outputShape.hasTrait(UnitTypeTrait.class)) { + variables.put("outputFromDafny", "()"); + } else { + variables.put( + "outputFromDafny", + evalTemplate( + "$rustRootModuleName:L::conversions::$snakeCaseOperationName:L::_$snakeCaseSyntheticOperationOutputName:L::from_dafny(inner_result.value().clone())", + variables + ) ); - result.add(responseModule); } - return result; + return IOUtils.evalTemplate( + getClass(), + "runtimes/rust/conversions/resource_dafny_wrapper_operation.rs", + variables + ); } @Override protected TokenTree operationRequestToDafnyFunction( + final Shape bindingShape, OperationShape operationShape ) { return operationStructureToDafnyFunction( + bindingShape, operationShape, operationShape.getInputShape() ); @@ -1300,15 +1545,18 @@ protected TokenTree operationRequestToDafnyFunction( @Override protected TokenTree operationResponseToDafnyFunction( - OperationShape operationShape + final Shape bindingShape, + final OperationShape operationShape ) { return operationStructureToDafnyFunction( + bindingShape, operationShape, operationShape.getOutputShape() ); } private TokenTree operationStructureToDafnyFunction( + final Shape bindingShape, final OperationShape operationShape, final ShapeId structureId ) { @@ -1318,7 +1566,7 @@ private TokenTree operationStructureToDafnyFunction( ); final Map variables = MapUtils.merge( serviceVariables(), - operationVariables(operationShape), + operationVariables(bindingShape, operationShape), structureVariables(structureShape) ); variables.put( @@ -1331,7 +1579,7 @@ private TokenTree operationStructureToDafnyFunction( """ #[allow(dead_code)] pub fn to_dafny( - value: crate::operation::$snakeCaseOperationName:L::$rustStructureName:L, + value: $rustRootModuleName:L::operation::$snakeCaseOperationName:L::$rustStructureName:L, ) -> ::std::rc::Rc< crate::r#$dafnyTypesModuleName:L::$structureName:L, >{ @@ -1347,9 +1595,11 @@ pub fn to_dafny( @Override protected TokenTree operationRequestFromDafnyFunction( - OperationShape operationShape + final Shape bindingShape, + final OperationShape operationShape ) { return operationStructureFromDafnyFunction( + bindingShape, operationShape, operationShape.getInputShape() ); @@ -1357,15 +1607,18 @@ protected TokenTree operationRequestFromDafnyFunction( @Override protected TokenTree operationResponseFromDafnyFunction( - OperationShape operationShape + final Shape bindingShape, + final OperationShape operationShape ) { return operationStructureFromDafnyFunction( + bindingShape, operationShape, operationShape.getOutputShape() ); } private TokenTree operationStructureFromDafnyFunction( + final Shape bindingShape, final OperationShape operationShape, final ShapeId structureId ) { @@ -1375,7 +1628,7 @@ private TokenTree operationStructureFromDafnyFunction( ); final Map variables = MapUtils.merge( serviceVariables(), - operationVariables(operationShape), + operationVariables(bindingShape, operationShape), structureVariables(structureShape) ); variables.put( @@ -1391,8 +1644,8 @@ pub fn from_dafny( dafny_value: ::std::rc::Rc< crate::r#$dafnyTypesModuleName:L::$structureName:L, >, - ) -> crate::operation::$snakeCaseOperationName:L::$rustStructureName:L { - crate::operation::$snakeCaseOperationName:L::$rustStructureName:L::builder() + ) -> $rustRootModuleName:L::operation::$snakeCaseOperationName:L::$rustStructureName:L { + $rustRootModuleName:L::operation::$snakeCaseOperationName:L::$rustStructureName:L::builder() $fluentMemberSetters:L .build() .unwrap() @@ -1409,15 +1662,20 @@ private RustFile wrappedModule() { "runtimes/rust/wrapped.rs", serviceVariables() ); - return new RustFile(Path.of("src", "wrapped.rs"), TokenTree.of(content)); + return new RustFile( + rootPathForShape(service).resolve("wrapped.rs"), + TokenTree.of(content) + ); } private RustFile wrappedClientModule() { final Map variables = serviceVariables(); variables.put( "operationImpls", - serviceOperationShapes() - .map(this::wrappedClientOperationImpl) + operationBindingIndex + .getOperations(service) + .stream() + .map(o -> wrappedClientOperationImpl(service, o.operationShape())) .collect(Collectors.joining("\n\n")) ); final String content = IOUtils.evalTemplate( @@ -1426,17 +1684,18 @@ private RustFile wrappedClientModule() { variables ); return new RustFile( - Path.of("src", "wrapped", "client.rs"), + rootPathForShape(service).resolve("wrapped").resolve("client.rs"), TokenTree.of(content) ); } private String wrappedClientOperationImpl( + final ServiceShape serviceShape, final OperationShape operationShape ) { final Map variables = MapUtils.merge( serviceVariables(), - operationVariables(operationShape) + operationVariables(serviceShape, operationShape) ); StructureShape inputShape = operationIndex @@ -1456,18 +1715,20 @@ private String wrappedClientOperationImpl( "inputFromDafny", evalTemplate( """ - crate::operation::$snakeCaseOperationName:L::_$snakeCaseSyntheticOperationInputName:L::$syntheticOperationInputName:L { + $rustRootModuleName:L::operation::$snakeCaseOperationName:L::_$snakeCaseSyntheticOperationInputName:L::$syntheticOperationInputName:L { $memberName:L: $dafnyValue:L } """, variables ) ); + } else if (inputShape.hasTrait(UnitTypeTrait.class)) { + variables.put("inputFromDafny", "()"); } else { variables.put( "inputFromDafny", evalTemplate( - "crate::conversions::$snakeCaseOperationName:L::_$snakeCaseSyntheticOperationInputName:L::from_dafny(input.clone())", + "$rustRootModuleName:L::conversions::$snakeCaseOperationName:L::_$snakeCaseSyntheticOperationInputName:L::from_dafny(input.clone())", variables ) ); @@ -1482,17 +1743,34 @@ private String wrappedClientOperationImpl( "outputToDafny", toDafny(outputShape, "inner_result", false, false).toString() ); + } else if (outputShape.hasTrait(UnitTypeTrait.class)) { + variables.put("outputToDafny", "()"); } else { variables.put( "outputToDafny", evalTemplate( - "crate::conversions::$snakeCaseOperationName:L::_$snakeCaseSyntheticOperationOutputName:L::to_dafny(inner_result)", + "$rustRootModuleName:L::conversions::$snakeCaseOperationName:L::_$snakeCaseSyntheticOperationOutputName:L::to_dafny(inner_result)", variables ) ); } variables.put("operationOutputDafnyType", dafnyTypeForShape(outputShape)); + final String selfParameter = operationShape.hasTrait(ReadonlyTrait.class) + ? "&self," + : "&mut self,"; + if (inputShape.hasTrait(UnitTypeTrait.class)) { + variables.put("operationInputParams", selfParameter); + } else { + variables.put( + "operationInputParams", + selfParameter + + "\n input: &" + + variables.get("operationInputDafnyType") + + "," + ); + } + return IOUtils.evalTemplate( getClass(), "runtimes/rust/wrapped/client_operation_impl.part.rs", @@ -1500,27 +1778,31 @@ private String wrappedClientOperationImpl( ); } - private Path operationsModuleFilePath() { - return Path.of("src", "operation"); + private Path operationsModuleFilePath(final Shape bindingShape) { + return rootPathForShape(bindingShape).resolve("operation"); } - private Path operationModuleFilePath(final OperationShape operationShape) { - return operationsModuleFilePath() + private Path operationModuleFilePath( + final Shape bindingShape, + final OperationShape operationShape + ) { + return operationsModuleFilePath(bindingShape) .resolve(toSnakeCase(operationName(operationShape))); } - private LocalServiceTrait localServiceTrait() { - return service.expectTrait(LocalServiceTrait.class); + private LocalServiceTrait localServiceTrait(final ServiceShape serviceShape) { + return serviceShape.expectTrait(LocalServiceTrait.class); } @Override protected HashMap serviceVariables() { final HashMap variables = super.serviceVariables(); - final LocalServiceTrait localServiceTrait = localServiceTrait(); - final String sdkId = localServiceTrait.getSdkId(); + final StructureShape configShape = ModelUtils.getConfigShape( + model, + service + ); final String configName = configShape.getId().getName(service); - variables.put("sdkId", sdkId); variables.put("configName", configName); variables.put("snakeCaseConfigName", toSnakeCase(configName)); variables.put("rustErrorModuleName", rustErrorModuleName()); @@ -1532,9 +1814,9 @@ protected HashMap serviceVariables() { return variables; } - @Override - protected String getRustTypesModuleName() { - return "crate::types"; + protected String getSdkId() { + final LocalServiceTrait localServiceTrait = localServiceTrait(service); + return localServiceTrait.getSdkId(); } @Override @@ -1547,19 +1829,29 @@ protected String syntheticOperationOutputName(OperationShape operationShape) { return operationName(operationShape) + "Output"; } - /** - * Generates values for variables commonly used in structure-member-specific templates. - */ - private HashMap structureMemberVariables( - final MemberShape memberShape + private Map dependentServiceErrorVariables( + final ServiceShape serviceShape, + final ServiceShape dependentServiceShape ) { - final HashMap variables = new HashMap<>(); - final String memberName = memberShape.getMemberName(); - variables.put("memberName", memberName); - variables.put("fieldName", toSnakeCase(memberName)); + final Map variables = new HashMap<>(); + final String rustErrorName = + dependentServiceShape.getId().getName() + "Error"; variables.put( - "fieldType", - rustTypeForShape(model.expectShape(memberShape.getTarget())) + "errorName", + DafnyNameResolver.dafnyBaseModuleName( + dependentServiceShape.getId().getNamespace() + ) + ); + variables.put("rustErrorName", rustErrorName); + variables.put( + "rustDependentRootModuleName", + mergedGenerator + .generatorForShape(dependentServiceShape) + .getRustRootModuleName(dependentServiceShape.getId().getNamespace()) + ); + variables.put( + "qualifiedRustErrorVariant", + "%s::%s".formatted(qualifiedRustServiceErrorType(), rustErrorName) ); return variables; } @@ -1731,14 +2023,26 @@ protected TokenTree toDafny( } } case LONG -> { - if (isRustOption) { - yield TokenTree.of( - "crate::standard_library_conversions::olong_to_dafny(&%s)".formatted( - rustValue - ) - ); + if (isDafnyOption) { + if (isRustOption) { + yield TokenTree.of( + "crate::standard_library_conversions::olong_to_dafny(&%s)".formatted( + rustValue + ) + ); + } else { + yield TokenTree.of( + "crate::standard_library_conversions::olong_to_dafny(Some(%s))".formatted( + rustValue + ) + ); + } } else { - yield TokenTree.of("%s.clone()".formatted(rustValue)); + if (isRustOption) { + yield TokenTree.of("%s.clone().unwrap()".formatted(rustValue)); + } else { + yield TokenTree.of("%s.clone()".formatted(rustValue)); + } } } case DOUBLE -> { @@ -1773,23 +2077,33 @@ protected TokenTree toDafny( } case BLOB -> { if (isDafnyOption) { - yield TokenTree.of( - "crate::standard_library_conversions::oblob_to_dafny(&%s)".formatted( - rustValue - ) - ); - } else if (isRustOption) { - yield TokenTree.of( - "crate::standard_library_conversions::oblob_to_dafny(&%s).Extract()".formatted( - rustValue - ) - ); + if (isRustOption) { + yield TokenTree.of( + "crate::standard_library_conversions::oblob_to_dafny(&%s)".formatted( + rustValue + ) + ); + } else { + yield TokenTree.of( + "crate::standard_library_conversions::oblob_to_dafny(Some(&%s))".formatted( + rustValue + ) + ); + } } else { - yield TokenTree.of( - "crate::standard_library_conversions::blob_to_dafny(&%s)".formatted( - rustValue - ) - ); + if (isRustOption) { + yield TokenTree.of( + "crate::standard_library_conversions::blob_to_dafny(&%s.unwrap())".formatted( + rustValue + ) + ); + } else { + yield TokenTree.of( + "crate::standard_library_conversions::blob_to_dafny(&%s)".formatted( + rustValue + ) + ); + } } } case LIST -> { @@ -1884,30 +2198,31 @@ protected TokenTree toDafny( } } case STRUCTURE, UNION -> { - var structureShapeName = toSnakeCase(shape.getId().getName()); - String prefix = topLevelNameForShape(shape); + var conversionsModule = mergedGenerator + .generatorForShape(shape) + .getRustConversionsModuleNameForShape(shape); if (!isDafnyOption) { if (isRustOption) { yield TokenTree.of( """ - %s::conversions::%s::to_dafny(&%s.clone().unwrap()) - """.formatted(prefix, structureShapeName, rustValue) + %s::to_dafny(&%s.clone().unwrap()) + """.formatted(conversionsModule, rustValue) ); } else { yield TokenTree.of( """ - %s::conversions::%s::to_dafny(&%s.clone()) - """.formatted(prefix, structureShapeName, rustValue) + %s::to_dafny(&%s.clone()) + """.formatted(conversionsModule, rustValue) ); } } else { yield TokenTree.of( """ ::std::rc::Rc::new(match &%s { - Some(x) => crate::_Wrappers_Compile::Option::Some { value: %s::conversions::%s::to_dafny(&x.clone()) }, + Some(x) => crate::_Wrappers_Compile::Option::Some { value: %s::to_dafny(&x.clone()) }, None => crate::_Wrappers_Compile::Option::None { } }) - """.formatted(rustValue, prefix, structureShapeName) + """.formatted(rustValue, conversionsModule) ); } } @@ -1920,13 +2235,13 @@ protected TokenTree toDafny( if (isRustOption) { yield TokenTree.of( """ - %s::conversions::%s::to_dafny(%s.clone().unwrap()) + %s::conversions::%s::to_dafny(&%s.clone().unwrap()) """.formatted(prefix, resourceShapeName, rustValue) ); } else { yield TokenTree.of( """ - %s::conversions::%s::to_dafny(%s.clone()) + %s::conversions::%s::to_dafny(&%s.clone()) """.formatted(prefix, resourceShapeName, rustValue) ); } @@ -1934,7 +2249,7 @@ protected TokenTree toDafny( yield TokenTree.of( """ ::std::rc::Rc::new(match &%s { - Some(x) => crate::_Wrappers_Compile::Option::Some { value: %s::conversions::%s::to_dafny(x.clone()) }, + Some(x) => crate::_Wrappers_Compile::Option::Some { value: %s::conversions::%s::to_dafny(&x.clone()) }, None => crate::_Wrappers_Compile::Option::None { } }) """.formatted(rustValue, prefix, resourceShapeName) @@ -1953,7 +2268,7 @@ protected TokenTree toDafny( } else { yield TokenTree.of( """ - %s::conversions::client::to_dafny(%s.clone()) + %s::conversions::client::to_dafny(&%s.clone()) """.formatted(prefix, rustValue) ); } @@ -1961,7 +2276,7 @@ protected TokenTree toDafny( yield TokenTree.of( """ ::std::rc::Rc::new(match &%s { - Some(x) => crate::_Wrappers_Compile::Option::Some { value: %s::conversions::client::to_dafny(x.clone()) }, + Some(x) => crate::_Wrappers_Compile::Option::Some { value: %s::conversions::client::to_dafny(&x.clone()) }, None => crate::_Wrappers_Compile::Option::None { } }) """.formatted(rustValue, prefix) @@ -1981,4 +2296,14 @@ protected boolean isStructureBuilderFallible( // For simplicity and ease of migration, always make builders fallible. return true; } + + @Override + public TokenTree topLevelModuleDeclarations() { + final TokenTree common = TokenTree.of(TOP_LEVEL_MOD_DECLS); + return generateWrappedClient + ? TokenTree + .of(common, TokenTree.of(TOP_LEVEL_WRAPPED_CLIENT_DECL)) + .lineSeparated() + : common; + } } diff --git a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyrust/generator/RustUtils.java b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyrust/generator/RustUtils.java new file mode 100644 index 000000000..e9a38ce0a --- /dev/null +++ b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyrust/generator/RustUtils.java @@ -0,0 +1,27 @@ +package software.amazon.polymorph.smithyrust.generator; + +import java.util.Arrays; +import java.util.stream.Collectors; +import java.util.stream.Stream; +import software.amazon.polymorph.utils.TokenTree; + +public class RustUtils { + + public static String rustModuleForSmithyNamespace( + final String smithyNamespace + ) { + return Arrays + .stream(smithyNamespace.split("\\.")) + .collect(Collectors.joining("_")); + } + + public static TokenTree declarePubModules(Stream moduleNames) { + return TokenTree + .of( + moduleNames + .sorted() + .map(module -> TokenTree.of("pub mod " + module + ";\n")) + ) + .lineSeparated(); + } +} diff --git a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/utils/BoundOperationShape.java b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/utils/BoundOperationShape.java new file mode 100644 index 000000000..896e04059 --- /dev/null +++ b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/utils/BoundOperationShape.java @@ -0,0 +1,9 @@ +package software.amazon.polymorph.utils; + +import software.amazon.smithy.model.shapes.OperationShape; +import software.amazon.smithy.model.shapes.Shape; + +public record BoundOperationShape( + Shape bindingShape, + OperationShape operationShape +) {} diff --git a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/utils/ModelUtils.java b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/utils/ModelUtils.java index 331b383d3..e9345c217 100644 --- a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/utils/ModelUtils.java +++ b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/utils/ModelUtils.java @@ -712,4 +712,38 @@ public static Optional getDocumentationOrJavadoc(Shape shape) { .map(StringTrait::getValue) .or(() -> shape.getTrait(JavaDocTrait.class).map(StringTrait::getValue)); } + + public static Stream streamLocalServiceDependencies( + final Model model, + final ServiceShape serviceShape + ) { + final Optional localServiceTrait = serviceShape.getTrait( + LocalServiceTrait.class + ); + if (!localServiceTrait.isPresent()) { + return Stream.empty(); + } + + final Set dependentIds = localServiceTrait.get().getDependencies(); + if (dependentIds == null) { + return Stream.empty(); + } + + return dependentIds + .stream() + .map(id -> model.expectShape(id, ServiceShape.class)); + } + + public static StructureShape getConfigShape( + final Model model, + final ServiceShape serviceShape + ) { + final Optional localServiceTrait = serviceShape.getTrait( + LocalServiceTrait.class + ); + return model.expectShape( + localServiceTrait.get().getConfigId(), + StructureShape.class + ); + } } diff --git a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/utils/OperationBindingIndex.java b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/utils/OperationBindingIndex.java index 031728992..7506d9045 100644 --- a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/utils/OperationBindingIndex.java +++ b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/utils/OperationBindingIndex.java @@ -1,35 +1,82 @@ package software.amazon.polymorph.utils; +import java.util.Collections; import java.util.HashMap; +import java.util.HashSet; import java.util.Map; import java.util.Optional; +import java.util.Set; import software.amazon.smithy.model.Model; import software.amazon.smithy.model.knowledge.KnowledgeIndex; +import software.amazon.smithy.model.shapes.OperationShape; import software.amazon.smithy.model.shapes.ResourceShape; import software.amazon.smithy.model.shapes.ServiceShape; import software.amazon.smithy.model.shapes.Shape; import software.amazon.smithy.model.shapes.ShapeId; import software.amazon.smithy.model.shapes.ToShapeId; +import software.amazon.smithy.utils.SetUtils; public class OperationBindingIndex implements KnowledgeIndex { - private final Map operationBindings = new HashMap(); + private final Set bindingShapes = new HashSet<>(); + private final Map> bindingShapesForOperation = + new HashMap(); + private final Map> operationBindings = + new HashMap(); public OperationBindingIndex(Model model) { for (final ServiceShape service : model.getServiceShapes()) { + bindingShapes.add(service); for (final ShapeId operationId : service.getOperations()) { - operationBindings.put(operationId, service); + final OperationShape operationShape = model.expectShape( + operationId, + OperationShape.class + ); + operationBindings + .computeIfAbsent(service.getId(), id -> new HashSet<>()) + .add(new BoundOperationShape(service, operationShape)); + bindingShapesForOperation + .computeIfAbsent(operationId, id -> new HashSet<>()) + .add(service); } } for (final ResourceShape resource : model.getResourceShapes()) { + bindingShapes.add(resource); for (final ShapeId operationId : resource.getOperations()) { - operationBindings.put(operationId, resource); + final OperationShape operationShape = model.expectShape( + operationId, + OperationShape.class + ); + operationBindings + .computeIfAbsent(resource.getId(), id -> new HashSet<>()) + .add(new BoundOperationShape(resource, operationShape)); + bindingShapesForOperation + .computeIfAbsent(operationId, id -> new HashSet<>()) + .add(resource); } } } - public Optional getBindingShape(ToShapeId operation) { - return Optional.ofNullable(operationBindings.get(operation.toShapeId())); + public Set getAllBindingShapes() { + return SetUtils.copyOf(bindingShapes); + } + + public Set getBindingShapes(ToShapeId operation) { + return SetUtils.copyOf( + bindingShapesForOperation.getOrDefault( + operation.toShapeId(), + Collections.emptySet() + ) + ); + } + + public Set getOperations(ToShapeId bindingShape) { + return SetUtils.copyOf( + operationBindings.getOrDefault( + bindingShape.toShapeId(), + Collections.emptySet() + ) + ); } } diff --git a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/smithy/dafny/codegen/DafnyClientCodegenPlugin.java b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/smithy/dafny/codegen/DafnyClientCodegenPlugin.java index b8597dcc0..5a1cc18d6 100644 --- a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/smithy/dafny/codegen/DafnyClientCodegenPlugin.java +++ b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/smithy/dafny/codegen/DafnyClientCodegenPlugin.java @@ -5,6 +5,7 @@ import java.nio.file.Path; import java.nio.file.Paths; +import java.util.Collections; import java.util.EnumSet; import java.util.HashMap; import java.util.Map; @@ -79,7 +80,7 @@ public void execute(PluginContext context) { .withLibraryRoot(manifest.getBaseDir()) .withServiceModel(model) // TODO generate code based on service closure, not namespace - .withNamespace(settings.serviceId.getNamespace()) + .withNamespaces(Collections.singleton(settings.serviceId.getNamespace())) .withDafnyVersion(settings.dafnyVersion) .withPropertiesFile(propertiesFile) .withTargetLangOutputDirs(outputDirs) diff --git a/codegen/smithy-dafny-codegen/src/main/resources/templates/runtimes/rust/client.rs b/codegen/smithy-dafny-codegen/src/main/resources/templates/runtimes/rust/client.rs index 1764445d6..5999ede24 100644 --- a/codegen/smithy-dafny-codegen/src/main/resources/templates/runtimes/rust/client.rs +++ b/codegen/smithy-dafny-codegen/src/main/resources/templates/runtimes/rust/client.rs @@ -9,22 +9,17 @@ impl Client { /// Creates a new client from the service [`Config`](crate::Config). #[track_caller] pub fn from_conf( - conf: crate::types::$snakeCaseConfigName:L::$configName:L, - ) -> Result { + conf: $rustTypesModuleName:L::$snakeCaseConfigName:L::$configName:L, + ) -> Result { let inner = crate::$dafnyInternalModuleName:L::_default::$sdkId:L( - &crate::conversions::$snakeCaseConfigName:L::_$snakeCaseConfigName:L::to_dafny(conf), + &$rustConversionsModuleName:L::$snakeCaseConfigName:L::_$snakeCaseConfigName:L::to_dafny(conf), ); if matches!( inner.as_ref(), crate::_Wrappers_Compile::Result::Failure { .. } ) { - // TODO: convert error - the potential types are not modeled! - return Err(BuildError::other( - ::aws_smithy_types::error::metadata::ErrorMetadata::builder() - .message("Invalid client config") - .build(), - )); + return Err($rustRootModuleName:L::conversions::error::from_dafny(inner.as_ref().error().clone())); } Ok(Self { dafny_client: ::dafny_runtime::upcast_object()(inner.Extract()) diff --git a/codegen/smithy-dafny-codegen/src/main/resources/templates/runtimes/rust/conversions/client_awssdk.rs b/codegen/smithy-dafny-codegen/src/main/resources/templates/runtimes/rust/conversions/client_awssdk.rs new file mode 100644 index 000000000..80dee8702 --- /dev/null +++ b/codegen/smithy-dafny-codegen/src/main/resources/templates/runtimes/rust/conversions/client_awssdk.rs @@ -0,0 +1,35 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +#[allow(dead_code)] + +use std::any::Any; + +pub fn to_dafny( + value: &$rustClientType:L, +) -> + ::dafny_runtime::Object +{ + let x: std::rc::Rc<$rustClientType:L> = std::rc::Rc::new(value.clone()); + let y = x as std::rc::Rc; + unsafe { + ::dafny_runtime::dafny_runtime_conversions::object::rc_struct_to_dafny_class(y) + } +} + +#[allow(dead_code)] +pub fn from_dafny( + dafny_value: ::dafny_runtime::Object< + dyn crate::r#$dafnyTypesModuleName:L::I$sdkId:LClient + >, +) -> $rustClientType:L { + let as_boxed_any = dafny_runtime::cast_any_object!(dafny_value); + if (dafny_runtime::is_object!(as_boxed_any, $rustClientType:L)) { + let as_boxed_client = ::dafny_runtime::object::downcast::<$rustClientType:L>(as_boxed_any); + unsafe { + ::dafny_runtime::dafny_runtime_conversions::object::dafny_class_to_rc_struct(as_boxed_client).as_ref().clone() + } + } else { + panic!("Unexpected implementation of Dafny client interface"); + } +} diff --git a/codegen/smithy-dafny-codegen/src/main/resources/templates/runtimes/rust/conversions/client_localservice.rs b/codegen/smithy-dafny-codegen/src/main/resources/templates/runtimes/rust/conversions/client_localservice.rs index 01d3802e2..b61b9b65f 100644 --- a/codegen/smithy-dafny-codegen/src/main/resources/templates/runtimes/rust/conversions/client_localservice.rs +++ b/codegen/smithy-dafny-codegen/src/main/resources/templates/runtimes/rust/conversions/client_localservice.rs @@ -4,7 +4,7 @@ #[allow(dead_code)] pub fn to_dafny( - value: &crate::client::Client, + value: &$rustClientType:L, ) -> ::dafny_runtime::Object { @@ -16,6 +16,6 @@ pub fn from_dafny( dafny_value: ::dafny_runtime::Object< dyn crate::r#$dafnyTypesModuleName:L::I$serviceName:LClient >, -) -> crate::client::Client { - crate::client::Client { dafny_client: dafny_value } +) -> $rustClientType:L { + $rustClientType:L { dafny_client: dafny_value } } diff --git a/codegen/smithy-dafny-codegen/src/main/resources/templates/runtimes/rust/conversions/config/_config.rs b/codegen/smithy-dafny-codegen/src/main/resources/templates/runtimes/rust/conversions/config/_config.rs index 931a8c931..b37b7444d 100644 --- a/codegen/smithy-dafny-codegen/src/main/resources/templates/runtimes/rust/conversions/config/_config.rs +++ b/codegen/smithy-dafny-codegen/src/main/resources/templates/runtimes/rust/conversions/config/_config.rs @@ -1,7 +1,7 @@ #[allow(dead_code)] pub fn to_dafny( - value: crate::types::$snakeCaseConfigName:L::$configName:L, + value: $rustTypesModuleName:L::$snakeCaseConfigName:L::$configName:L, ) -> ::std::rc::Rc< crate::r#$dafnyTypesModuleName:L::$configName:L, > { @@ -13,14 +13,14 @@ pub fn from_dafny( dafny_value: ::std::rc::Rc< crate::r#$dafnyTypesModuleName:L::$configName:L, >, -) -> crate::types::$snakeCaseConfigName:L::$configName:L { +) -> $rustTypesModuleName:L::$snakeCaseConfigName:L::$configName:L { plain_from_dafny(&*dafny_value) } #[allow(dead_code)] pub fn to_dafny_plain( - value: crate::types::$snakeCaseConfigName:L::$configName:L, + value: $rustTypesModuleName:L::$snakeCaseConfigName:L::$configName:L, ) -> crate::r#$dafnyTypesModuleName:L::$configName:L { crate::r#$dafnyTypesModuleName:L::$configName:L::$configName:L { $variants:L @@ -30,10 +30,10 @@ pub fn to_dafny_plain( #[allow(dead_code)] pub fn plain_from_dafny( dafny_value: &crate::r#$dafnyTypesModuleName:L::$configName:L, -) -> crate::types::$snakeCaseConfigName:L::$configName:L { +) -> $rustTypesModuleName:L::$snakeCaseConfigName:L::$configName:L { match dafny_value { crate::r#$dafnyTypesModuleName:L::$structureName:L::$configName:L {..} => - crate::types::$snakeCaseConfigName:L::$configName:L::builder() + $rustTypesModuleName:L::$snakeCaseConfigName:L::$configName:L::builder() $fluentMemberSetters:L .build() .unwrap() diff --git a/codegen/smithy-dafny-codegen/src/main/resources/templates/runtimes/rust/conversions/error_awssdk.rs b/codegen/smithy-dafny-codegen/src/main/resources/templates/runtimes/rust/conversions/error_awssdk.rs new file mode 100644 index 000000000..efd15bc7c --- /dev/null +++ b/codegen/smithy-dafny-codegen/src/main/resources/templates/runtimes/rust/conversions/error_awssdk.rs @@ -0,0 +1,27 @@ + +pub fn to_dafny( + value: $qualifiedRustServiceErrorType:L, +) -> ::std::rc::Rc { + match value { + $toDafnyArms:L + $qualifiedRustServiceErrorType:L::Opaque { obj } => + ::std::rc::Rc::new(crate::r#$dafnyTypesModuleName:L::Error::Opaque { + obj: ::dafny_runtime::Object(obj.0) + }), + } +} + +#[allow(dead_code)] +pub fn from_dafny( + dafny_value: ::std::rc::Rc< + crate::r#$dafnyTypesModuleName:L::Error, + >, +) -> $qualifiedRustServiceErrorType:L { + match ::std::borrow::Borrow::borrow(&dafny_value) { + $fromDafnyArms:L + crate::r#$dafnyTypesModuleName:L::Error::Opaque { obj } => + $qualifiedRustServiceErrorType:L::Opaque { + obj: obj.clone() + }, + } +} \ No newline at end of file diff --git a/codegen/smithy-dafny-codegen/src/main/resources/templates/runtimes/rust/conversions/operation.rs b/codegen/smithy-dafny-codegen/src/main/resources/templates/runtimes/rust/conversions/operation.rs deleted file mode 100644 index 76dd882ee..000000000 --- a/codegen/smithy-dafny-codegen/src/main/resources/templates/runtimes/rust/conversions/operation.rs +++ /dev/null @@ -1,5 +0,0 @@ -use std::any::Any; - -pub mod _$snakeCaseSyntheticOperationInputName:L; - -pub mod _$snakeCaseSyntheticOperationOutputName:L; \ No newline at end of file diff --git a/codegen/smithy-dafny-codegen/src/main/resources/templates/runtimes/rust/conversions/resource.rs b/codegen/smithy-dafny-codegen/src/main/resources/templates/runtimes/rust/conversions/resource.rs index 165d50f31..e2f90c439 100644 --- a/codegen/smithy-dafny-codegen/src/main/resources/templates/runtimes/rust/conversions/resource.rs +++ b/codegen/smithy-dafny-codegen/src/main/resources/templates/runtimes/rust/conversions/resource.rs @@ -1,6 +1,6 @@ #[allow(dead_code)] pub fn to_dafny( - value: crate::types::$snakeCaseResourceName:L::$rustResourceName:LRef, + value: &$rustTypesModuleName:L::$snakeCaseResourceName:L::$rustResourceName:LRef, ) -> ::dafny_runtime::Object< dyn crate::r#$dafnyTypesModuleName:L::$dafnyResourceName:L, > { @@ -12,7 +12,7 @@ pub fn to_dafny( } pub struct $rustResourceName:LWrapper { - obj: crate::types::$snakeCaseResourceName:L::$rustResourceName:LRef, + obj: $rustTypesModuleName:L::$snakeCaseResourceName:L::$rustResourceName:LRef, } impl ::dafny_runtime::UpcastObject for $rustResourceName:LWrapper { @@ -22,13 +22,13 @@ impl ::dafny_runtime::UpcastObject for $rustResourceName:LW #[allow(dead_code)] pub fn from_dafny( dafny_value: ::dafny_runtime::Object< - dyn crate::r#$dafnyTypesModuleName:L::ISimpleResource, + dyn crate::r#$dafnyTypesModuleName:L::$dafnyResourceName:L, >, -) -> crate::types::$snakeCaseResourceName:L::$rustResourceName:LRef { +) -> $rustTypesModuleName:L::$snakeCaseResourceName:L::$rustResourceName:LRef { let wrap = $dafnyResourceName:LDafnyWrapper { obj: dafny_value.clone(), }; - crate::types::$snakeCaseResourceName:L::$rustResourceName:LRef { + $rustTypesModuleName:L::$snakeCaseResourceName:L::$rustResourceName:LRef { inner: ::std::rc::Rc::new(::std::cell::RefCell::new(wrap)) } } @@ -40,4 +40,13 @@ pub struct $dafnyResourceName:LDafnyWrapper { >, } -$resourceOperations:L \ No newline at end of file +impl crate::$dafnyTypesModuleName:L::$dafnyResourceName:L + for $rustResourceName:LWrapper +{ + $resourceWrapperOperations:L +} + +impl $rustTypesModuleName:L::$snakeCaseResourceName:L::$rustResourceName:L for $dafnyResourceName:LDafnyWrapper +{ + $resourceDafnyWrapperOperations:L +} \ No newline at end of file diff --git a/codegen/smithy-dafny-codegen/src/main/resources/templates/runtimes/rust/conversions/resource_dafny_wrapper_operation.rs b/codegen/smithy-dafny-codegen/src/main/resources/templates/runtimes/rust/conversions/resource_dafny_wrapper_operation.rs new file mode 100644 index 000000000..ac1127cad --- /dev/null +++ b/codegen/smithy-dafny-codegen/src/main/resources/templates/runtimes/rust/conversions/resource_dafny_wrapper_operation.rs @@ -0,0 +1,22 @@ +fn $snakeCaseOperationName:L( + &mut self, + input: $operationInputType:L, +) -> Result< + $operationOutputType:L, + $qualifiedRustServiceErrorType:L, +> { + let inner_input = $inputToDafny:L; + let inner_result = ::dafny_runtime::md!(self.obj.clone()).$operationName:L(&inner_input); + if matches!( + inner_result.as_ref(), + crate::r#_Wrappers_Compile::Result::Success { .. } + ) { + Ok( + $outputFromDafny:L, + ) + } else { + Err($rustRootModuleName:L::conversions::error::from_dafny( + inner_result.error().clone(), + )) + } +} \ No newline at end of file diff --git a/codegen/smithy-dafny-codegen/src/main/resources/templates/runtimes/rust/conversions/resource_operation.rs b/codegen/smithy-dafny-codegen/src/main/resources/templates/runtimes/rust/conversions/resource_operation.rs deleted file mode 100644 index c1eb642d2..000000000 --- a/codegen/smithy-dafny-codegen/src/main/resources/templates/runtimes/rust/conversions/resource_operation.rs +++ /dev/null @@ -1,64 +0,0 @@ - -impl crate::$dafnyTypesModuleName:L::$dafnyResourceName:L - for $rustResourceName:LWrapper -{ - fn r#_$operationName:L_k( - &mut self, - input: &::std::rc::Rc< - crate::r#$dafnyTypesModuleName:L::$pascalCaseOperationInputName:L, - >, - ) -> ::std::rc::Rc< - crate::r#_Wrappers_Compile::Result< - ::std::rc::Rc< - crate::r#$dafnyTypesModuleName:L::$pascalCaseOperationOutputName:L, - >, - ::std::rc::Rc, - >, - > - { - let inner_input = - crate::conversions::$snakeCaseOperationName:L::_$snakeCaseSyntheticOperationInputName:L::from_dafny( - input.clone(), - ); - let inner_result = self.obj.inner.borrow_mut().$snakeCaseOperationName:L(inner_input); - let result = match inner_result { - Ok(x) => crate::r#_Wrappers_Compile::Result::Success { - value: crate::conversions::$snakeCaseOperationName:L::_$snakeCaseSyntheticOperationOutputName:L::to_dafny( - x, - ), - }, - Err(x) => crate::r#_Wrappers_Compile::Result::Failure { - error: crate::conversions::error::to_dafny(x), - }, - }; - ::std::rc::Rc::new(result) - } -} - -impl crate::types::$snakeCaseResourceName:L::$rustResourceName:L for $dafnyResourceName:LDafnyWrapper { - fn $snakeCaseOperationName:L( - &mut self, - input: crate::operation::$snakeCaseOperationName:L::$pascalCaseOperationInputName:L, - ) -> Result< - crate::operation::$snakeCaseOperationName:L::$pascalCaseOperationOutputName:L, - $qualifiedRustServiceErrorType:L, - > { - let inner_input = - crate::conversions::$snakeCaseOperationName:L::_$snakeCaseSyntheticOperationInputName:L::to_dafny(input); - let inner_result = ::dafny_runtime::md!(self.obj.clone()).$operationName:L(&inner_input); - if matches!( - inner_result.as_ref(), - crate::r#_Wrappers_Compile::Result::Success { .. } - ) { - Ok( - crate::conversions::$snakeCaseOperationName:L::_$snakeCaseSyntheticOperationOutputName:L::from_dafny( - inner_result.value().clone(), - ), - ) - } else { - Err(crate::conversions::error::from_dafny( - inner_result.error().clone(), - )) - } - } -} diff --git a/codegen/smithy-dafny-codegen/src/main/resources/templates/runtimes/rust/conversions/resource_wrapper_operation.rs b/codegen/smithy-dafny-codegen/src/main/resources/templates/runtimes/rust/conversions/resource_wrapper_operation.rs new file mode 100644 index 000000000..ae18b9a84 --- /dev/null +++ b/codegen/smithy-dafny-codegen/src/main/resources/templates/runtimes/rust/conversions/resource_wrapper_operation.rs @@ -0,0 +1,22 @@ +fn r#_$operationName:L_k( + &mut self, + input: $operationDafnyInputType:L, +) -> ::std::rc::Rc< + crate::r#_Wrappers_Compile::Result< + $operationDafnyOutputType:L, + ::std::rc::Rc, + >, +> +{ + let inner_input = $inputFromDafny:L; + let inner_result = self.obj.inner.borrow_mut().$snakeCaseOperationName:L(inner_input); + let result = match inner_result { + Ok(x) => crate::r#_Wrappers_Compile::Result::Success { + value: $outputToDafny:L, + }, + Err(x) => crate::r#_Wrappers_Compile::Result::Failure { + error: $rustRootModuleName:L::conversions::error::to_dafny(x), + }, + }; + ::std::rc::Rc::new(result) +} \ No newline at end of file diff --git a/codegen/smithy-dafny-codegen/src/main/resources/templates/runtimes/rust/operation/builders.rs b/codegen/smithy-dafny-codegen/src/main/resources/templates/runtimes/rust/operation/builders.rs index 0ab705fdf..90d0e3fc8 100644 --- a/codegen/smithy-dafny-codegen/src/main/resources/templates/runtimes/rust/operation/builders.rs +++ b/codegen/smithy-dafny-codegen/src/main/resources/templates/runtimes/rust/operation/builders.rs @@ -1,6 +1,6 @@ -pub use crate::operation::$snakeCaseOperationName:L::_$snakeCaseOperationOutputName:L::$pascalCaseOperationOutputName:LBuilder; +pub use $rustRootModuleName:L::operation::$snakeCaseOperationName:L::_$snakeCaseOperationOutputName:L::$pascalCaseOperationOutputName:LBuilder; -pub use crate::operation::$snakeCaseOperationName:L::_$snakeCaseOperationInputName:L::$pascalCaseOperationInputName:LBuilder; +pub use $rustRootModuleName:L::operation::$snakeCaseOperationName:L::_$snakeCaseOperationInputName:L::$pascalCaseOperationInputName:LBuilder; impl $pascalCaseOperationInputName:LBuilder { /// Sends a request with this input using the given client. @@ -21,7 +21,7 @@ impl $pascalCaseOperationInputName:LBuilder { #[derive(::std::clone::Clone, ::std::fmt::Debug)] pub struct $pascalCaseOperationName:LFluentBuilder { $operationTargetName:L: $operationTargetType:L, - pub(crate) inner: crate::operation::$snakeCaseOperationName:L::builders::$pascalCaseOperationInputName:LBuilder, + pub(crate) inner: $rustRootModuleName:L::operation::$snakeCaseOperationName:L::builders::$pascalCaseOperationInputName:LBuilder, } impl $pascalCaseOperationName:LFluentBuilder { /// Creates a new `$pascalCaseOperationName:L`. @@ -32,7 +32,7 @@ impl $pascalCaseOperationName:LFluentBuilder { } } /// Access the $pascalCaseOperationName:L as a reference. - pub fn as_input(&self) -> &crate::operation::$snakeCaseOperationName:L::builders::$pascalCaseOperationInputName:LBuilder { + pub fn as_input(&self) -> &$rustRootModuleName:L::operation::$snakeCaseOperationName:L::builders::$pascalCaseOperationInputName:LBuilder { &self.inner } /// Sends the request and returns the response. @@ -52,7 +52,7 @@ impl $pascalCaseOperationName:LFluentBuilder { .map_err(|mut e| $qualifiedRustServiceErrorType:L::Opaque { obj: ::dafny_runtime::Object::from_ref(&mut e as &mut dyn ::std::any::Any) })?; - crate::operation::$snakeCaseOperationName:L::$pascalCaseOperationName:L::send(&self.$operationTargetName:L, input).await + $rustRootModuleName:L::operation::$snakeCaseOperationName:L::$pascalCaseOperationName:L::send(&self.$operationTargetName:L, input).await } $accessors:L diff --git a/codegen/smithy-dafny-codegen/src/main/resources/templates/runtimes/rust/operation/operation_builder.rs b/codegen/smithy-dafny-codegen/src/main/resources/templates/runtimes/rust/operation/operation_builder.rs index 86a99e97c..0210b75f7 100644 --- a/codegen/smithy-dafny-codegen/src/main/resources/templates/runtimes/rust/operation/operation_builder.rs +++ b/codegen/smithy-dafny-codegen/src/main/resources/templates/runtimes/rust/operation/operation_builder.rs @@ -6,7 +6,7 @@ $builderSettersDoc:L /// - On success, responds with [`$pascalCaseOperationOutputName:L`](crate::operation::$snakeCaseOperationName:L::$pascalCaseOperationOutputName:L) with field(s): $outputDoc:L /// - On failure, responds with [`SdkError<$pascalCaseOperationErrorName:L>`](crate::operation::$snakeCaseOperationName:L::$pascalCaseOperationErrorName:L) - pub fn $snakeCaseOperationName:L(&self) -> crate::operation::$snakeCaseOperationName:L::builders::$pascalCaseOperationName:LFluentBuilder { - crate::operation::$snakeCaseOperationName:L::builders::$pascalCaseOperationName:LFluentBuilder::new(self.clone()) + pub fn $snakeCaseOperationName:L(&self) -> $rustRootModuleName:L::operation::$snakeCaseOperationName:L::builders::$pascalCaseOperationName:LFluentBuilder { + $rustRootModuleName:L::operation::$snakeCaseOperationName:L::builders::$pascalCaseOperationName:LFluentBuilder::new(self.clone()) } } \ No newline at end of file diff --git a/codegen/smithy-dafny-codegen/src/main/resources/templates/runtimes/rust/operation/outer.rs b/codegen/smithy-dafny-codegen/src/main/resources/templates/runtimes/rust/operation/outer.rs index 4fe07443f..caf57050c 100644 --- a/codegen/smithy-dafny-codegen/src/main/resources/templates/runtimes/rust/operation/outer.rs +++ b/codegen/smithy-dafny-codegen/src/main/resources/templates/runtimes/rust/operation/outer.rs @@ -20,9 +20,9 @@ impl $pascalCaseOperationName:L { } } -pub use crate::operation::$snakeCaseOperationName:L::_$snakeCaseOperationOutputName:L::$pascalCaseOperationOutputName:L; +pub use $rustRootModuleName:L::operation::$snakeCaseOperationName:L::_$snakeCaseOperationOutputName:L::$pascalCaseOperationOutputName:L; -pub use crate::operation::$snakeCaseOperationName:L::_$snakeCaseOperationInputName:L::$pascalCaseOperationInputName:L; +pub use $rustRootModuleName:L::operation::$snakeCaseOperationName:L::_$snakeCaseOperationInputName:L::$pascalCaseOperationInputName:L; pub(crate) mod _$snakeCaseOperationOutputName:L; diff --git a/codegen/smithy-dafny-codegen/src/main/resources/templates/runtimes/rust/operation/outer_send_body.rs b/codegen/smithy-dafny-codegen/src/main/resources/templates/runtimes/rust/operation/outer_send_body.rs index 66f9693b0..5e08a07e7 100644 --- a/codegen/smithy-dafny-codegen/src/main/resources/templates/runtimes/rust/operation/outer_send_body.rs +++ b/codegen/smithy-dafny-codegen/src/main/resources/templates/runtimes/rust/operation/outer_send_body.rs @@ -1,6 +1,6 @@ let inner_input = $inputToDafny:L; let inner_result = - ::dafny_runtime::md!(client.dafny_client.clone()).$operationName:L(&inner_input); + ::dafny_runtime::md!(client.dafny_client.clone()).$operationName:L($innerInput:L); if matches!( inner_result.as_ref(), crate::r#_Wrappers_Compile::Result::Success { .. } @@ -9,7 +9,7 @@ $outputFromDafny:L, ) } else { - Err(crate::conversions::error::from_dafny( + Err($rustRootModuleName:L::conversions::error::from_dafny( inner_result.error().clone(), )) } \ No newline at end of file diff --git a/codegen/smithy-dafny-codegen/src/main/resources/templates/runtimes/rust/operation/structure.rs b/codegen/smithy-dafny-codegen/src/main/resources/templates/runtimes/rust/operation/structure.rs index ada34b100..ae8a24fb4 100644 --- a/codegen/smithy-dafny-codegen/src/main/resources/templates/runtimes/rust/operation/structure.rs +++ b/codegen/smithy-dafny-codegen/src/main/resources/templates/runtimes/rust/operation/structure.rs @@ -9,8 +9,8 @@ impl $rustStructureName:L { } impl $rustStructureName:L { /// Creates a new builder-style object to manufacture [`$rustStructureName:L`](crate::operation::$snakeCaseOperationName:L::builders::$rustStructureName:L). - pub fn builder() -> crate::operation::$snakeCaseOperationName:L::builders::$rustStructureName:LBuilder { - crate::operation::$snakeCaseOperationName:L::builders::$rustStructureName:LBuilder::default() + pub fn builder() -> $rustRootModuleName:L::operation::$snakeCaseOperationName:L::builders::$rustStructureName:LBuilder { + $rustRootModuleName:L::operation::$snakeCaseOperationName:L::builders::$rustStructureName:LBuilder::default() } } @@ -28,10 +28,10 @@ impl $rustStructureName:LBuilder { pub fn build( self, ) -> ::std::result::Result< - crate::operation::$snakeCaseOperationName:L::$rustStructureName:L, + $rustRootModuleName:L::operation::$snakeCaseOperationName:L::$rustStructureName:L, ::aws_smithy_types::error::operation::BuildError, > { - ::std::result::Result::Ok(crate::operation::$snakeCaseOperationName:L::$rustStructureName:L { + ::std::result::Result::Ok($rustRootModuleName:L::operation::$snakeCaseOperationName:L::$rustStructureName:L { $builderAssignments:L }) } diff --git a/codegen/smithy-dafny-codegen/src/main/resources/templates/runtimes/rust/types/config.rs b/codegen/smithy-dafny-codegen/src/main/resources/templates/runtimes/rust/types/config.rs index ffe78187a..d0baca074 100644 --- a/codegen/smithy-dafny-codegen/src/main/resources/templates/runtimes/rust/types/config.rs +++ b/codegen/smithy-dafny-codegen/src/main/resources/templates/runtimes/rust/types/config.rs @@ -9,8 +9,8 @@ impl $configName:L { } impl $configName:L { /// Creates a new builder-style object to manufacture [`$configName:L`]($qualifiedRustStructureType:L). - pub fn builder() -> crate::types::$snakeCaseStructureName:L::$configName:LBuilder { - crate::types::$snakeCaseStructureName:L::$configName:LBuilder::default() + pub fn builder() -> $rustTypesModuleName:L::$snakeCaseStructureName:L::$configName:LBuilder { + $rustTypesModuleName:L::$snakeCaseStructureName:L::$configName:LBuilder::default() } } @@ -28,10 +28,10 @@ impl $configName:LBuilder { pub fn build( self, ) -> ::std::result::Result< - crate::types::$snakeCaseStructureName:L::$configName:L, + $rustTypesModuleName:L::$snakeCaseStructureName:L::$configName:L, ::aws_smithy_types::error::operation::BuildError, > { - ::std::result::Result::Ok(crate::types::$snakeCaseStructureName:L::$configName:L { + ::std::result::Result::Ok($rustTypesModuleName:L::$snakeCaseStructureName:L::$configName:L { $builderAssignments:L }) } diff --git a/codegen/smithy-dafny-codegen/src/main/resources/templates/runtimes/rust/types/error_awssdk.rs b/codegen/smithy-dafny-codegen/src/main/resources/templates/runtimes/rust/types/error_awssdk.rs new file mode 100644 index 000000000..ebc4e8f99 --- /dev/null +++ b/codegen/smithy-dafny-codegen/src/main/resources/templates/runtimes/rust/types/error_awssdk.rs @@ -0,0 +1,17 @@ +#[derive(::std::clone::Clone, ::std::fmt::Debug, ::std::cmp::PartialEq)] +pub enum Error { + $modeledErrorVariants:L + Opaque { + obj: ::dafny_runtime::Object, + }, +} + +impl ::std::cmp::Eq for Error {} + +impl ::std::fmt::Display for Error { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + write!(f, "{:?}", self) + } +} + +impl ::std::error::Error for Error {} diff --git a/codegen/smithy-dafny-codegen/src/main/resources/templates/runtimes/rust/types/resource_operation.rs b/codegen/smithy-dafny-codegen/src/main/resources/templates/runtimes/rust/types/resource_operation.rs index b270ce350..1045915a1 100644 --- a/codegen/smithy-dafny-codegen/src/main/resources/templates/runtimes/rust/types/resource_operation.rs +++ b/codegen/smithy-dafny-codegen/src/main/resources/templates/runtimes/rust/types/resource_operation.rs @@ -1,7 +1,7 @@ fn $snakeCaseOperationName:L( &mut self, - input: crate::operation::$snakeCaseOperationName:L::$pascalCaseOperationInputName:L, + input: $operationInputType:L, ) -> Result< - crate::operation::$snakeCaseOperationName:L::$pascalCaseOperationOutputName:L, + $operationOutputType:L, $qualifiedRustServiceErrorType:L, >; \ No newline at end of file diff --git a/codegen/smithy-dafny-codegen/src/main/resources/templates/runtimes/rust/types/structure.rs b/codegen/smithy-dafny-codegen/src/main/resources/templates/runtimes/rust/types/structure.rs index 17714cf02..dda094c51 100644 --- a/codegen/smithy-dafny-codegen/src/main/resources/templates/runtimes/rust/types/structure.rs +++ b/codegen/smithy-dafny-codegen/src/main/resources/templates/runtimes/rust/types/structure.rs @@ -9,8 +9,8 @@ impl $rustStructureName:L { } impl $rustStructureName:L { /// Creates a new builder-style object to manufacture [`$rustStructureName:L`]($qualifiedRustStructureType:L). - pub fn builder() -> crate::types::builders::$rustStructureName:LBuilder { - crate::types::builders::$rustStructureName:LBuilder::default() + pub fn builder() -> $rustTypesModuleName:L::builders::$rustStructureName:LBuilder { + $rustTypesModuleName:L::builders::$rustStructureName:LBuilder::default() } } diff --git a/codegen/smithy-dafny-codegen/src/main/resources/templates/runtimes/rust/wrapped.rs b/codegen/smithy-dafny-codegen/src/main/resources/templates/runtimes/rust/wrapped.rs index 6e58e962f..83b6b9036 100644 --- a/codegen/smithy-dafny-codegen/src/main/resources/templates/runtimes/rust/wrapped.rs +++ b/codegen/smithy-dafny-codegen/src/main/resources/templates/runtimes/rust/wrapped.rs @@ -7,6 +7,6 @@ impl crate::r#$dafnyInternalModuleName:L::wrapped::_default { ::dafny_runtime::Object, ::std::rc::Rc >>{ - crate::wrapped::client::Client::from_conf(config) + $rustRootModuleName:L::wrapped::client::Client::from_conf(config) } } \ No newline at end of file diff --git a/codegen/smithy-dafny-codegen/src/main/resources/templates/runtimes/rust/wrapped/client.rs b/codegen/smithy-dafny-codegen/src/main/resources/templates/runtimes/rust/wrapped/client.rs index c8988f4e8..65b2d913f 100644 --- a/codegen/smithy-dafny-codegen/src/main/resources/templates/runtimes/rust/wrapped/client.rs +++ b/codegen/smithy-dafny-codegen/src/main/resources/templates/runtimes/rust/wrapped/client.rs @@ -1,7 +1,7 @@ use std::sync::LazyLock; pub struct Client { - wrapped: crate::client::Client + wrapped: $rustRootModuleName:L::client::Client } /// A runtime for executing operations on the asynchronous client in a blocking manner. @@ -29,14 +29,14 @@ impl Client { ::dafny_runtime::Object, ::std::rc::Rc >> { - let result = crate::client::Client::from_conf( - crate::conversions::$snakeCaseConfigName:L::_$snakeCaseConfigName:L::from_dafny( + let result = $rustRootModuleName:L::client::Client::from_conf( + $rustRootModuleName:L::conversions::$snakeCaseConfigName:L::_$snakeCaseConfigName:L::from_dafny( config.clone(), ), ); match result { Ok(client) => { - let wrap = crate::wrapped::client::Client { + let wrap = $rustRootModuleName:L::wrapped::client::Client { wrapped: client }; std::rc::Rc::new( @@ -45,7 +45,7 @@ impl Client { } ) }, - Err(error) => crate::conversions::error::to_opaque_error_result(error) + Err(error) => $rustRootModuleName:L::conversions::error::to_opaque_error_result(error) } } } diff --git a/codegen/smithy-dafny-codegen/src/main/resources/templates/runtimes/rust/wrapped/client_operation_impl.part.rs b/codegen/smithy-dafny-codegen/src/main/resources/templates/runtimes/rust/wrapped/client_operation_impl.part.rs index 2b104d24d..767854c69 100644 --- a/codegen/smithy-dafny-codegen/src/main/resources/templates/runtimes/rust/wrapped/client_operation_impl.part.rs +++ b/codegen/smithy-dafny-codegen/src/main/resources/templates/runtimes/rust/wrapped/client_operation_impl.part.rs @@ -1,6 +1,5 @@ fn $operationName:L( - &mut self, - input: &$operationInputDafnyType:L, + $operationInputParams:L ) -> std::rc::Rc< crate::r#_Wrappers_Compile::Result< $operationOutputDafnyType:L, @@ -9,12 +8,12 @@ >{ let inner_input = $inputFromDafny:L; let result = tokio::task::block_in_place(|| { - dafny_tokio_runtime.block_on(crate::operation::$snakeCaseOperationName:L::$pascalCaseOperationName:L::send(&self.wrapped, inner_input)) + dafny_tokio_runtime.block_on($rustRootModuleName:L::operation::$snakeCaseOperationName:L::$pascalCaseOperationName:L::send(&self.wrapped, inner_input)) }); match result { Err(error) => ::std::rc::Rc::new( crate::_Wrappers_Compile::Result::Failure { - error: crate::conversions::error::to_dafny(error), + error: $rustRootModuleName:L::conversions::error::to_dafny(error), }, ), Ok(inner_result) => ::std::rc::Rc::new( diff --git a/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithyrust/generator/NamespaceHelperTest.java b/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithyrust/generator/NamespaceHelperTest.java index f4812875b..0e42f0c6a 100644 --- a/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithyrust/generator/NamespaceHelperTest.java +++ b/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithyrust/generator/NamespaceHelperTest.java @@ -9,12 +9,12 @@ public class NamespaceHelperTest { @Test public void testRustModuleForSmithyNamespace() { assertEquals( - "string", - NamespaceHelper.rustModuleForSmithyNamespace("simple.string") + "simple_string", + RustUtils.rustModuleForSmithyNamespace("simple.string") ); assertEquals( - "foobar", - NamespaceHelper.rustModuleForSmithyNamespace("aws.cryptography.foobar") + "aws_cryptography_foobar", + RustUtils.rustModuleForSmithyNamespace("aws.cryptography.foobar") ); } }