aws_sdk_secretsmanager/operation/put_secret_value/builders.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::put_secret_value::_put_secret_value_output::PutSecretValueOutputBuilder;
3
4pub use crate::operation::put_secret_value::_put_secret_value_input::PutSecretValueInputBuilder;
5
6impl crate::operation::put_secret_value::builders::PutSecretValueInputBuilder {
7 /// Sends a request with this input using the given client.
8 pub async fn send_with(
9 self,
10 client: &crate::Client,
11 ) -> ::std::result::Result<
12 crate::operation::put_secret_value::PutSecretValueOutput,
13 ::aws_smithy_runtime_api::client::result::SdkError<
14 crate::operation::put_secret_value::PutSecretValueError,
15 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16 >,
17 > {
18 let mut fluent_builder = client.put_secret_value();
19 fluent_builder.inner = self;
20 fluent_builder.send().await
21 }
22}
23/// Fluent builder constructing a request to `PutSecretValue`.
24///
25/// <p>Creates a new version with a new encrypted secret value and attaches it to the secret. The version can contain a new <code>SecretString</code> value or a new <code>SecretBinary</code> value.</p>
26/// <p>We recommend you avoid calling <code>PutSecretValue</code> at a sustained rate of more than once every 10 minutes. When you update the secret value, Secrets Manager creates a new version of the secret. Secrets Manager removes outdated versions when there are more than 100, but it does not remove versions created less than 24 hours ago. If you call <code>PutSecretValue</code> more than once every 10 minutes, you create more versions than Secrets Manager removes, and you will reach the quota for secret versions.</p>
27/// <p>You can specify the staging labels to attach to the new version in <code>VersionStages</code>. If you don't include <code>VersionStages</code>, then Secrets Manager automatically moves the staging label <code>AWSCURRENT</code> to this version. If this operation creates the first version for the secret, then Secrets Manager automatically attaches the staging label <code>AWSCURRENT</code> to it. If this operation moves the staging label <code>AWSCURRENT</code> from another version to this version, then Secrets Manager also automatically moves the staging label <code>AWSPREVIOUS</code> to the version that <code>AWSCURRENT</code> was removed from.</p>
28/// <p>This operation is idempotent. If you call this operation with a <code>ClientRequestToken</code> that matches an existing version's VersionId, and you specify the same secret data, the operation succeeds but does nothing. However, if the secret data is different, then the operation fails because you can't modify an existing version; you can only create new ones.</p>
29/// <p>Secrets Manager generates a CloudTrail log entry when you call this action. Do not include sensitive information in request parameters except <code>SecretBinary</code>, <code>SecretString</code>, or <code>RotationToken</code> because it might be logged. For more information, see <a href="https://docs.aws.amazon.com/secretsmanager/latest/userguide/retrieve-ct-entries.html">Logging Secrets Manager events with CloudTrail</a>.</p>
30/// <p><b>Required permissions: </b> <code>secretsmanager:PutSecretValue</code>. For more information, see <a href="https://docs.aws.amazon.com/secretsmanager/latest/userguide/reference_iam-permissions.html#reference_iam-permissions_actions"> IAM policy actions for Secrets Manager</a> and <a href="https://docs.aws.amazon.com/secretsmanager/latest/userguide/auth-and-access.html">Authentication and access control in Secrets Manager</a>.</p><important>
31/// <p>When you enter commands in a command shell, there is a risk of the command history being accessed or utilities having access to your command parameters. This is a concern if the command includes the value of a secret. Learn how to <a href="https://docs.aws.amazon.com/secretsmanager/latest/userguide/security_cli-exposure-risks.html">Mitigate the risks of using command-line tools to store Secrets Manager secrets</a>.</p>
32/// </important>
33#[derive(::std::clone::Clone, ::std::fmt::Debug)]
34pub struct PutSecretValueFluentBuilder {
35 handle: ::std::sync::Arc<crate::client::Handle>,
36 inner: crate::operation::put_secret_value::builders::PutSecretValueInputBuilder,
37 config_override: ::std::option::Option<crate::config::Builder>,
38}
39impl
40 crate::client::customize::internal::CustomizableSend<
41 crate::operation::put_secret_value::PutSecretValueOutput,
42 crate::operation::put_secret_value::PutSecretValueError,
43 > for PutSecretValueFluentBuilder
44{
45 fn send(
46 self,
47 config_override: crate::config::Builder,
48 ) -> crate::client::customize::internal::BoxFuture<
49 crate::client::customize::internal::SendResult<
50 crate::operation::put_secret_value::PutSecretValueOutput,
51 crate::operation::put_secret_value::PutSecretValueError,
52 >,
53 > {
54 ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
55 }
56}
57impl PutSecretValueFluentBuilder {
58 /// Creates a new `PutSecretValueFluentBuilder`.
59 pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
60 Self {
61 handle,
62 inner: ::std::default::Default::default(),
63 config_override: ::std::option::Option::None,
64 }
65 }
66 /// Access the PutSecretValue as a reference.
67 pub fn as_input(&self) -> &crate::operation::put_secret_value::builders::PutSecretValueInputBuilder {
68 &self.inner
69 }
70 /// Sends the request and returns the response.
71 ///
72 /// If an error occurs, an `SdkError` will be returned with additional details that
73 /// can be matched against.
74 ///
75 /// By default, any retryable failures will be retried twice. Retry behavior
76 /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
77 /// set when configuring the client.
78 pub async fn send(
79 self,
80 ) -> ::std::result::Result<
81 crate::operation::put_secret_value::PutSecretValueOutput,
82 ::aws_smithy_runtime_api::client::result::SdkError<
83 crate::operation::put_secret_value::PutSecretValueError,
84 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
85 >,
86 > {
87 let input = self
88 .inner
89 .build()
90 .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
91 let runtime_plugins = crate::operation::put_secret_value::PutSecretValue::operation_runtime_plugins(
92 self.handle.runtime_plugins.clone(),
93 &self.handle.conf,
94 self.config_override,
95 );
96 crate::operation::put_secret_value::PutSecretValue::orchestrate(&runtime_plugins, input).await
97 }
98
99 /// Consumes this builder, creating a customizable operation that can be modified before being sent.
100 pub fn customize(
101 self,
102 ) -> crate::client::customize::CustomizableOperation<
103 crate::operation::put_secret_value::PutSecretValueOutput,
104 crate::operation::put_secret_value::PutSecretValueError,
105 Self,
106 > {
107 crate::client::customize::CustomizableOperation::new(self)
108 }
109 pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
110 self.set_config_override(::std::option::Option::Some(config_override.into()));
111 self
112 }
113
114 pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
115 self.config_override = config_override;
116 self
117 }
118 /// <p>The ARN or name of the secret to add a new version to.</p>
119 /// <p>For an ARN, we recommend that you specify a complete ARN rather than a partial ARN. See <a href="https://docs.aws.amazon.com/secretsmanager/latest/userguide/troubleshoot.html#ARN_secretnamehyphen">Finding a secret from a partial ARN</a>.</p>
120 /// <p>If the secret doesn't already exist, use <code>CreateSecret</code> instead.</p>
121 pub fn secret_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
122 self.inner = self.inner.secret_id(input.into());
123 self
124 }
125 /// <p>The ARN or name of the secret to add a new version to.</p>
126 /// <p>For an ARN, we recommend that you specify a complete ARN rather than a partial ARN. See <a href="https://docs.aws.amazon.com/secretsmanager/latest/userguide/troubleshoot.html#ARN_secretnamehyphen">Finding a secret from a partial ARN</a>.</p>
127 /// <p>If the secret doesn't already exist, use <code>CreateSecret</code> instead.</p>
128 pub fn set_secret_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
129 self.inner = self.inner.set_secret_id(input);
130 self
131 }
132 /// <p>The ARN or name of the secret to add a new version to.</p>
133 /// <p>For an ARN, we recommend that you specify a complete ARN rather than a partial ARN. See <a href="https://docs.aws.amazon.com/secretsmanager/latest/userguide/troubleshoot.html#ARN_secretnamehyphen">Finding a secret from a partial ARN</a>.</p>
134 /// <p>If the secret doesn't already exist, use <code>CreateSecret</code> instead.</p>
135 pub fn get_secret_id(&self) -> &::std::option::Option<::std::string::String> {
136 self.inner.get_secret_id()
137 }
138 /// <p>A unique identifier for the new version of the secret.</p><note>
139 /// <p>If you use the Amazon Web Services CLI or one of the Amazon Web Services SDKs to call this operation, then you can leave this parameter empty. The CLI or SDK generates a random UUID for you and includes it as the value for this parameter in the request.</p>
140 /// </note>
141 /// <p>If you generate a raw HTTP request to the Secrets Manager service endpoint, then you must generate a <code>ClientRequestToken</code> and include it in the request.</p>
142 /// <p>This value helps ensure idempotency. Secrets Manager uses this value to prevent the accidental creation of duplicate versions if there are failures and retries during a rotation. We recommend that you generate a <a href="https://wikipedia.org/wiki/Universally_unique_identifier">UUID-type</a> value to ensure uniqueness of your versions within the specified secret.</p>
143 /// <ul>
144 /// <li>
145 /// <p>If the <code>ClientRequestToken</code> value isn't already associated with a version of the secret then a new version of the secret is created.</p></li>
146 /// <li>
147 /// <p>If a version with this value already exists and that version's <code>SecretString</code> or <code>SecretBinary</code> values are the same as those in the request then the request is ignored. The operation is idempotent.</p></li>
148 /// <li>
149 /// <p>If a version with this value already exists and the version of the <code>SecretString</code> and <code>SecretBinary</code> values are different from those in the request, then the request fails because you can't modify a secret version. You can only create new versions to store new secret values.</p></li>
150 /// </ul>
151 /// <p>This value becomes the <code>VersionId</code> of the new version.</p>
152 pub fn client_request_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
153 self.inner = self.inner.client_request_token(input.into());
154 self
155 }
156 /// <p>A unique identifier for the new version of the secret.</p><note>
157 /// <p>If you use the Amazon Web Services CLI or one of the Amazon Web Services SDKs to call this operation, then you can leave this parameter empty. The CLI or SDK generates a random UUID for you and includes it as the value for this parameter in the request.</p>
158 /// </note>
159 /// <p>If you generate a raw HTTP request to the Secrets Manager service endpoint, then you must generate a <code>ClientRequestToken</code> and include it in the request.</p>
160 /// <p>This value helps ensure idempotency. Secrets Manager uses this value to prevent the accidental creation of duplicate versions if there are failures and retries during a rotation. We recommend that you generate a <a href="https://wikipedia.org/wiki/Universally_unique_identifier">UUID-type</a> value to ensure uniqueness of your versions within the specified secret.</p>
161 /// <ul>
162 /// <li>
163 /// <p>If the <code>ClientRequestToken</code> value isn't already associated with a version of the secret then a new version of the secret is created.</p></li>
164 /// <li>
165 /// <p>If a version with this value already exists and that version's <code>SecretString</code> or <code>SecretBinary</code> values are the same as those in the request then the request is ignored. The operation is idempotent.</p></li>
166 /// <li>
167 /// <p>If a version with this value already exists and the version of the <code>SecretString</code> and <code>SecretBinary</code> values are different from those in the request, then the request fails because you can't modify a secret version. You can only create new versions to store new secret values.</p></li>
168 /// </ul>
169 /// <p>This value becomes the <code>VersionId</code> of the new version.</p>
170 pub fn set_client_request_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
171 self.inner = self.inner.set_client_request_token(input);
172 self
173 }
174 /// <p>A unique identifier for the new version of the secret.</p><note>
175 /// <p>If you use the Amazon Web Services CLI or one of the Amazon Web Services SDKs to call this operation, then you can leave this parameter empty. The CLI or SDK generates a random UUID for you and includes it as the value for this parameter in the request.</p>
176 /// </note>
177 /// <p>If you generate a raw HTTP request to the Secrets Manager service endpoint, then you must generate a <code>ClientRequestToken</code> and include it in the request.</p>
178 /// <p>This value helps ensure idempotency. Secrets Manager uses this value to prevent the accidental creation of duplicate versions if there are failures and retries during a rotation. We recommend that you generate a <a href="https://wikipedia.org/wiki/Universally_unique_identifier">UUID-type</a> value to ensure uniqueness of your versions within the specified secret.</p>
179 /// <ul>
180 /// <li>
181 /// <p>If the <code>ClientRequestToken</code> value isn't already associated with a version of the secret then a new version of the secret is created.</p></li>
182 /// <li>
183 /// <p>If a version with this value already exists and that version's <code>SecretString</code> or <code>SecretBinary</code> values are the same as those in the request then the request is ignored. The operation is idempotent.</p></li>
184 /// <li>
185 /// <p>If a version with this value already exists and the version of the <code>SecretString</code> and <code>SecretBinary</code> values are different from those in the request, then the request fails because you can't modify a secret version. You can only create new versions to store new secret values.</p></li>
186 /// </ul>
187 /// <p>This value becomes the <code>VersionId</code> of the new version.</p>
188 pub fn get_client_request_token(&self) -> &::std::option::Option<::std::string::String> {
189 self.inner.get_client_request_token()
190 }
191 /// <p>The binary data to encrypt and store in the new version of the secret. To use this parameter in the command-line tools, we recommend that you store your binary data in a file and then pass the contents of the file as a parameter.</p>
192 /// <p>You must include <code>SecretBinary</code> or <code>SecretString</code>, but not both.</p>
193 /// <p>You can't access this value from the Secrets Manager console.</p>
194 /// <p>Sensitive: This field contains sensitive information, so the service does not include it in CloudTrail log entries. If you create your own log entries, you must also avoid logging the information in this field.</p>
195 pub fn secret_binary(mut self, input: ::aws_smithy_types::Blob) -> Self {
196 self.inner = self.inner.secret_binary(input);
197 self
198 }
199 /// <p>The binary data to encrypt and store in the new version of the secret. To use this parameter in the command-line tools, we recommend that you store your binary data in a file and then pass the contents of the file as a parameter.</p>
200 /// <p>You must include <code>SecretBinary</code> or <code>SecretString</code>, but not both.</p>
201 /// <p>You can't access this value from the Secrets Manager console.</p>
202 /// <p>Sensitive: This field contains sensitive information, so the service does not include it in CloudTrail log entries. If you create your own log entries, you must also avoid logging the information in this field.</p>
203 pub fn set_secret_binary(mut self, input: ::std::option::Option<::aws_smithy_types::Blob>) -> Self {
204 self.inner = self.inner.set_secret_binary(input);
205 self
206 }
207 /// <p>The binary data to encrypt and store in the new version of the secret. To use this parameter in the command-line tools, we recommend that you store your binary data in a file and then pass the contents of the file as a parameter.</p>
208 /// <p>You must include <code>SecretBinary</code> or <code>SecretString</code>, but not both.</p>
209 /// <p>You can't access this value from the Secrets Manager console.</p>
210 /// <p>Sensitive: This field contains sensitive information, so the service does not include it in CloudTrail log entries. If you create your own log entries, you must also avoid logging the information in this field.</p>
211 pub fn get_secret_binary(&self) -> &::std::option::Option<::aws_smithy_types::Blob> {
212 self.inner.get_secret_binary()
213 }
214 /// <p>The text to encrypt and store in the new version of the secret.</p>
215 /// <p>You must include <code>SecretBinary</code> or <code>SecretString</code>, but not both.</p>
216 /// <p>We recommend you create the secret string as JSON key/value pairs, as shown in the example.</p>
217 /// <p>Sensitive: This field contains sensitive information, so the service does not include it in CloudTrail log entries. If you create your own log entries, you must also avoid logging the information in this field.</p>
218 pub fn secret_string(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
219 self.inner = self.inner.secret_string(input.into());
220 self
221 }
222 /// <p>The text to encrypt and store in the new version of the secret.</p>
223 /// <p>You must include <code>SecretBinary</code> or <code>SecretString</code>, but not both.</p>
224 /// <p>We recommend you create the secret string as JSON key/value pairs, as shown in the example.</p>
225 /// <p>Sensitive: This field contains sensitive information, so the service does not include it in CloudTrail log entries. If you create your own log entries, you must also avoid logging the information in this field.</p>
226 pub fn set_secret_string(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
227 self.inner = self.inner.set_secret_string(input);
228 self
229 }
230 /// <p>The text to encrypt and store in the new version of the secret.</p>
231 /// <p>You must include <code>SecretBinary</code> or <code>SecretString</code>, but not both.</p>
232 /// <p>We recommend you create the secret string as JSON key/value pairs, as shown in the example.</p>
233 /// <p>Sensitive: This field contains sensitive information, so the service does not include it in CloudTrail log entries. If you create your own log entries, you must also avoid logging the information in this field.</p>
234 pub fn get_secret_string(&self) -> &::std::option::Option<::std::string::String> {
235 self.inner.get_secret_string()
236 }
237 ///
238 /// Appends an item to `VersionStages`.
239 ///
240 /// To override the contents of this collection use [`set_version_stages`](Self::set_version_stages).
241 ///
242 /// <p>A list of staging labels to attach to this version of the secret. Secrets Manager uses staging labels to track versions of a secret through the rotation process.</p>
243 /// <p>If you specify a staging label that's already associated with a different version of the same secret, then Secrets Manager removes the label from the other version and attaches it to this version. If you specify <code>AWSCURRENT</code>, and it is already attached to another version, then Secrets Manager also moves the staging label <code>AWSPREVIOUS</code> to the version that <code>AWSCURRENT</code> was removed from.</p>
244 /// <p>If you don't include <code>VersionStages</code>, then Secrets Manager automatically moves the staging label <code>AWSCURRENT</code> to this version.</p>
245 pub fn version_stages(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
246 self.inner = self.inner.version_stages(input.into());
247 self
248 }
249 /// <p>A list of staging labels to attach to this version of the secret. Secrets Manager uses staging labels to track versions of a secret through the rotation process.</p>
250 /// <p>If you specify a staging label that's already associated with a different version of the same secret, then Secrets Manager removes the label from the other version and attaches it to this version. If you specify <code>AWSCURRENT</code>, and it is already attached to another version, then Secrets Manager also moves the staging label <code>AWSPREVIOUS</code> to the version that <code>AWSCURRENT</code> was removed from.</p>
251 /// <p>If you don't include <code>VersionStages</code>, then Secrets Manager automatically moves the staging label <code>AWSCURRENT</code> to this version.</p>
252 pub fn set_version_stages(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
253 self.inner = self.inner.set_version_stages(input);
254 self
255 }
256 /// <p>A list of staging labels to attach to this version of the secret. Secrets Manager uses staging labels to track versions of a secret through the rotation process.</p>
257 /// <p>If you specify a staging label that's already associated with a different version of the same secret, then Secrets Manager removes the label from the other version and attaches it to this version. If you specify <code>AWSCURRENT</code>, and it is already attached to another version, then Secrets Manager also moves the staging label <code>AWSPREVIOUS</code> to the version that <code>AWSCURRENT</code> was removed from.</p>
258 /// <p>If you don't include <code>VersionStages</code>, then Secrets Manager automatically moves the staging label <code>AWSCURRENT</code> to this version.</p>
259 pub fn get_version_stages(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
260 self.inner.get_version_stages()
261 }
262 /// <p>A unique identifier that indicates the source of the request. For cross-account rotation (when you rotate a secret in one account by using a Lambda rotation function in another account) and the Lambda rotation function assumes an IAM role to call Secrets Manager, Secrets Manager validates the identity with the rotation token. For more information, see <a href="https://docs.aws.amazon.com/secretsmanager/latest/userguide/rotating-secrets.html">How rotation works</a>.</p>
263 /// <p>Sensitive: This field contains sensitive information, so the service does not include it in CloudTrail log entries. If you create your own log entries, you must also avoid logging the information in this field.</p>
264 pub fn rotation_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
265 self.inner = self.inner.rotation_token(input.into());
266 self
267 }
268 /// <p>A unique identifier that indicates the source of the request. For cross-account rotation (when you rotate a secret in one account by using a Lambda rotation function in another account) and the Lambda rotation function assumes an IAM role to call Secrets Manager, Secrets Manager validates the identity with the rotation token. For more information, see <a href="https://docs.aws.amazon.com/secretsmanager/latest/userguide/rotating-secrets.html">How rotation works</a>.</p>
269 /// <p>Sensitive: This field contains sensitive information, so the service does not include it in CloudTrail log entries. If you create your own log entries, you must also avoid logging the information in this field.</p>
270 pub fn set_rotation_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
271 self.inner = self.inner.set_rotation_token(input);
272 self
273 }
274 /// <p>A unique identifier that indicates the source of the request. For cross-account rotation (when you rotate a secret in one account by using a Lambda rotation function in another account) and the Lambda rotation function assumes an IAM role to call Secrets Manager, Secrets Manager validates the identity with the rotation token. For more information, see <a href="https://docs.aws.amazon.com/secretsmanager/latest/userguide/rotating-secrets.html">How rotation works</a>.</p>
275 /// <p>Sensitive: This field contains sensitive information, so the service does not include it in CloudTrail log entries. If you create your own log entries, you must also avoid logging the information in this field.</p>
276 pub fn get_rotation_token(&self) -> &::std::option::Option<::std::string::String> {
277 self.inner.get_rotation_token()
278 }
279}