Skip to main content

aws_esdk/operation/encrypt/
builders.rs

1// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
2// SPDX-License-Identifier: Apache-2.0
3// Do not modify this file. This file is machine generated, and any changes to it will be overwritten.
4pub use crate::operation::encrypt::_encrypt_output::EncryptOutputBuilder;
5
6pub use crate::operation::encrypt::_encrypt_input::EncryptInputBuilder;
7
8impl EncryptInputBuilder {
9    /// Sends a request with this input using the given client.
10    pub async fn send_with(
11        self,
12        client: &crate::client::Client,
13    ) -> ::std::result::Result<crate::operation::encrypt::EncryptOutput, crate::types::error::Error>
14    {
15        let mut fluent_builder = client.encrypt();
16        fluent_builder.inner = self;
17        fluent_builder.send().await
18    }
19}
20/// Fluent builder constructing a request to `Encrypt`.
21///
22#[derive(::std::clone::Clone, ::std::fmt::Debug)]
23pub struct EncryptFluentBuilder {
24    client: crate::client::Client,
25    pub(crate) inner: crate::operation::encrypt::builders::EncryptInputBuilder,
26}
27impl EncryptFluentBuilder {
28    /// Creates a new `Encrypt`.
29    pub(crate) fn new(client: crate::client::Client) -> Self {
30        Self {
31            client,
32            inner: ::std::default::Default::default(),
33        }
34    }
35    /// Access the Encrypt as a reference.
36    pub fn as_input(&self) -> &crate::operation::encrypt::builders::EncryptInputBuilder {
37        &self.inner
38    }
39    /// Sends the request and returns the response.
40    pub async fn send(
41        self,
42    ) -> ::std::result::Result<crate::operation::encrypt::EncryptOutput, crate::types::error::Error>
43    {
44        let input = self
45            .inner
46            .build()
47            // Using Opaque since we don't have a validation-specific error yet.
48            // Operations' models don't declare their own validation error,
49            // and smithy-rs seems to not generate a ValidationError case unless there is.
50            // Vanilla smithy-rs uses SdkError::construction_failure, but we aren't using SdkError.
51            .map_err(|mut e| {
52                let msg = format!("{:?}", e);
53                crate::types::error::Error::OpaqueWithText {
54                    obj: ::dafny_runtime::Object::from_ref(&mut e as &mut ::dafny_runtime::DynAny),
55                    objMessage: msg,
56                }
57            })?;
58        crate::operation::encrypt::Encrypt::send(&self.client, input).await
59    }
60
61    #[allow(missing_docs)]
62    pub fn algorithm_suite_id(
63        mut self,
64        input: impl ::std::convert::Into<
65            crate::deps::aws_cryptography_materialProviders::types::EsdkAlgorithmSuiteId,
66        >,
67    ) -> Self {
68        self.inner = self.inner.algorithm_suite_id(input.into());
69        self
70    }
71    #[allow(missing_docs)]
72    pub fn set_algorithm_suite_id(
73        mut self,
74        input: ::std::option::Option<
75            crate::deps::aws_cryptography_materialProviders::types::EsdkAlgorithmSuiteId,
76        >,
77    ) -> Self {
78        self.inner = self.inner.set_algorithm_suite_id(input);
79        self
80    }
81    #[allow(missing_docs)]
82    pub fn get_algorithm_suite_id(
83        &self,
84    ) -> &::std::option::Option<
85        crate::deps::aws_cryptography_materialProviders::types::EsdkAlgorithmSuiteId,
86    > {
87        self.inner.get_algorithm_suite_id()
88    }
89    #[allow(missing_docs)]
90    pub fn encryption_context(
91        mut self,
92        input: impl ::std::convert::Into<
93            ::std::collections::HashMap<::std::string::String, ::std::string::String>,
94        >,
95    ) -> Self {
96        self.inner = self.inner.encryption_context(input.into());
97        self
98    }
99    #[allow(missing_docs)]
100    pub fn set_encryption_context(
101        mut self,
102        input: ::std::option::Option<
103            ::std::collections::HashMap<::std::string::String, ::std::string::String>,
104        >,
105    ) -> Self {
106        self.inner = self.inner.set_encryption_context(input);
107        self
108    }
109    #[allow(missing_docs)]
110    pub fn get_encryption_context(
111        &self,
112    ) -> &::std::option::Option<
113        ::std::collections::HashMap<::std::string::String, ::std::string::String>,
114    > {
115        self.inner.get_encryption_context()
116    }
117    #[allow(missing_docs)]
118    pub fn frame_length(mut self, input: impl ::std::convert::Into<::std::primitive::i64>) -> Self {
119        self.inner = self.inner.frame_length(input.into());
120        self
121    }
122    #[allow(missing_docs)]
123    pub fn set_frame_length(mut self, input: ::std::option::Option<::std::primitive::i64>) -> Self {
124        self.inner = self.inner.set_frame_length(input);
125        self
126    }
127    #[allow(missing_docs)]
128    pub fn get_frame_length(&self) -> &::std::option::Option<::std::primitive::i64> {
129        self.inner.get_frame_length()
130    }
131    #[allow(missing_docs)]
132    pub fn keyring(
133        mut self,
134        input: impl ::std::convert::Into<
135            crate::deps::aws_cryptography_materialProviders::types::keyring::KeyringRef,
136        >,
137    ) -> Self {
138        self.inner = self.inner.keyring(input.into());
139        self
140    }
141    #[allow(missing_docs)]
142    pub fn set_keyring(
143        mut self,
144        input: ::std::option::Option<
145            crate::deps::aws_cryptography_materialProviders::types::keyring::KeyringRef,
146        >,
147    ) -> Self {
148        self.inner = self.inner.set_keyring(input);
149        self
150    }
151    #[allow(missing_docs)]
152    pub fn get_keyring(
153        &self,
154    ) -> &::std::option::Option<
155        crate::deps::aws_cryptography_materialProviders::types::keyring::KeyringRef,
156    > {
157        self.inner.get_keyring()
158    }
159    #[allow(missing_docs)]
160    pub fn materials_manager(
161        mut self,
162        input: impl ::std::convert::Into<crate::deps::aws_cryptography_materialProviders::types::cryptographic_materials_manager::CryptographicMaterialsManagerRef>,
163    ) -> Self {
164        self.inner = self.inner.materials_manager(input.into());
165        self
166    }
167    #[allow(missing_docs)]
168    pub fn set_materials_manager(
169        mut self,
170        input: ::std::option::Option<crate::deps::aws_cryptography_materialProviders::types::cryptographic_materials_manager::CryptographicMaterialsManagerRef>,
171    ) -> Self {
172        self.inner = self.inner.set_materials_manager(input);
173        self
174    }
175    #[allow(missing_docs)]
176    pub fn get_materials_manager(&self) -> &::std::option::Option<crate::deps::aws_cryptography_materialProviders::types::cryptographic_materials_manager::CryptographicMaterialsManagerRef>{
177        self.inner.get_materials_manager()
178    }
179    #[allow(missing_docs)]
180    pub fn plaintext(mut self, input: impl ::std::convert::Into<::aws_smithy_types::Blob>) -> Self {
181        self.inner = self.inner.plaintext(input.into());
182        self
183    }
184    #[allow(missing_docs)]
185    pub fn set_plaintext(mut self, input: ::std::option::Option<::aws_smithy_types::Blob>) -> Self {
186        self.inner = self.inner.set_plaintext(input);
187        self
188    }
189    #[allow(missing_docs)]
190    pub fn get_plaintext(&self) -> &::std::option::Option<::aws_smithy_types::Blob> {
191        self.inner.get_plaintext()
192    }
193}