aws_sdk_secretsmanager/operation/create_secret/_create_secret_input.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2#[allow(missing_docs)] // documentation missing in model
3#[non_exhaustive]
4#[derive(::std::clone::Clone, ::std::cmp::PartialEq)]
5pub struct CreateSecretInput {
6 /// <p>The name of the new secret.</p>
7 /// <p>The secret name can contain ASCII letters, numbers, and the following characters: /_+=.@-</p>
8 /// <p>Do not end your secret name with a hyphen followed by six characters. If you do so, you risk confusion and unexpected results when searching for a secret by partial ARN. Secrets Manager automatically adds a hyphen and six random characters after the secret name at the end of the ARN.</p>
9 pub name: ::std::option::Option<::std::string::String>,
10 /// <p>If you include <code>SecretString</code> or <code>SecretBinary</code>, then Secrets Manager creates an initial version for the secret, and this parameter specifies the unique identifier for the new version.</p><note>
11 /// <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>
12 /// </note>
13 /// <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>
14 /// <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>
15 /// <ul>
16 /// <li>
17 /// <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>
18 /// <li>
19 /// <p>If a version with this value already exists and the version <code>SecretString</code> and <code>SecretBinary</code> values are the same as those in the request, then the request is ignored.</p></li>
20 /// <li>
21 /// <p>If a version with this value already exists and that version's <code>SecretString</code> and <code>SecretBinary</code> values are different from those in the request, then the request fails because you cannot modify an existing version. Instead, use <code>PutSecretValue</code> to create a new version.</p></li>
22 /// </ul>
23 /// <p>This value becomes the <code>VersionId</code> of the new version.</p>
24 pub client_request_token: ::std::option::Option<::std::string::String>,
25 /// <p>The description of the secret.</p>
26 pub description: ::std::option::Option<::std::string::String>,
27 /// <p>The ARN, key ID, or alias of the KMS key that Secrets Manager uses to encrypt the secret value in the secret. An alias is always prefixed by <code>alias/</code>, for example <code>alias/aws/secretsmanager</code>. For more information, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/alias-about.html">About aliases</a>.</p>
28 /// <p>To use a KMS key in a different account, use the key ARN or the alias ARN.</p>
29 /// <p>If you don't specify this value, then Secrets Manager uses the key <code>aws/secretsmanager</code>. If that key doesn't yet exist, then Secrets Manager creates it for you automatically the first time it encrypts the secret value.</p>
30 /// <p>If the secret is in a different Amazon Web Services account from the credentials calling the API, then you can't use <code>aws/secretsmanager</code> to encrypt the secret, and you must create and use a customer managed KMS key.</p>
31 pub kms_key_id: ::std::option::Option<::std::string::String>,
32 /// <p>The binary data to encrypt and store in the new version of the secret. We recommend that you store your binary data in a file and then pass the contents of the file as a parameter.</p>
33 /// <p>Either <code>SecretString</code> or <code>SecretBinary</code> must have a value, but not both.</p>
34 /// <p>This parameter is not available in the Secrets Manager console.</p>
35 /// <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>
36 pub secret_binary: ::std::option::Option<::aws_smithy_types::Blob>,
37 /// <p>The text data to encrypt and store in this new version of the secret. We recommend you use a JSON structure of key/value pairs for your secret value.</p>
38 /// <p>Either <code>SecretString</code> or <code>SecretBinary</code> must have a value, but not both.</p>
39 /// <p>If you create a secret by using the Secrets Manager console then Secrets Manager puts the protected secret text in only the <code>SecretString</code> parameter. The Secrets Manager console stores the information as a JSON structure of key/value pairs that a Lambda rotation function can parse.</p>
40 /// <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>
41 pub secret_string: ::std::option::Option<::std::string::String>,
42 /// <p>A list of tags to attach to the secret. Each tag is a key and value pair of strings in a JSON text string, for example:</p>
43 /// <p><code>\[{"Key":"CostCenter","Value":"12345"},{"Key":"environment","Value":"production"}\]</code></p>
44 /// <p>Secrets Manager tag key names are case sensitive. A tag with the key "ABC" is a different tag from one with key "abc".</p>
45 /// <p>If you check tags in permissions policies as part of your security strategy, then adding or removing a tag can change permissions. If the completion of this operation would result in you losing your permissions for this secret, then Secrets Manager blocks the operation and returns an <code>Access Denied</code> error. For more information, see <a href="https://docs.aws.amazon.com/secretsmanager/latest/userguide/auth-and-access_examples.html#tag-secrets-abac">Control access to secrets using tags</a> and <a href="https://docs.aws.amazon.com/secretsmanager/latest/userguide/auth-and-access_examples.html#auth-and-access_tags2">Limit access to identities with tags that match secrets' tags</a>.</p>
46 /// <p>For information about how to format a JSON parameter for the various command line tool environments, see <a href="https://docs.aws.amazon.com/cli/latest/userguide/cli-using-param.html#cli-using-param-json">Using JSON for Parameters</a>. If your command-line tool or SDK requires quotation marks around the parameter, you should use single quotes to avoid confusion with the double quotes required in the JSON text.</p>
47 /// <p>For tag quotas and naming restrictions, see <a href="https://docs.aws.amazon.com/general/latest/gr/arg.html#taged-reference-quotas">Service quotas for Tagging</a> in the <i>Amazon Web Services General Reference guide</i>.</p>
48 pub tags: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>,
49 /// <p>A list of Regions and KMS keys to replicate secrets.</p>
50 pub add_replica_regions: ::std::option::Option<::std::vec::Vec<crate::types::ReplicaRegionType>>,
51 /// <p>Specifies whether to overwrite a secret with the same name in the destination Region. By default, secrets aren't overwritten.</p>
52 pub force_overwrite_replica_secret: ::std::option::Option<bool>,
53 /// <p>The exact string that identifies the partner that holds the external secret. For more information, see <a href="https://docs.aws.amazon.com/secretsmanager/latest/userguide/managed-external-secrets.html">Using Secrets Manager managed external secrets</a>.</p>
54 pub r#type: ::std::option::Option<::std::string::String>,
55}
56impl CreateSecretInput {
57 /// <p>The name of the new secret.</p>
58 /// <p>The secret name can contain ASCII letters, numbers, and the following characters: /_+=.@-</p>
59 /// <p>Do not end your secret name with a hyphen followed by six characters. If you do so, you risk confusion and unexpected results when searching for a secret by partial ARN. Secrets Manager automatically adds a hyphen and six random characters after the secret name at the end of the ARN.</p>
60 pub fn name(&self) -> ::std::option::Option<&str> {
61 self.name.as_deref()
62 }
63 /// <p>If you include <code>SecretString</code> or <code>SecretBinary</code>, then Secrets Manager creates an initial version for the secret, and this parameter specifies the unique identifier for the new version.</p><note>
64 /// <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>
65 /// </note>
66 /// <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>
67 /// <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>
68 /// <ul>
69 /// <li>
70 /// <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>
71 /// <li>
72 /// <p>If a version with this value already exists and the version <code>SecretString</code> and <code>SecretBinary</code> values are the same as those in the request, then the request is ignored.</p></li>
73 /// <li>
74 /// <p>If a version with this value already exists and that version's <code>SecretString</code> and <code>SecretBinary</code> values are different from those in the request, then the request fails because you cannot modify an existing version. Instead, use <code>PutSecretValue</code> to create a new version.</p></li>
75 /// </ul>
76 /// <p>This value becomes the <code>VersionId</code> of the new version.</p>
77 pub fn client_request_token(&self) -> ::std::option::Option<&str> {
78 self.client_request_token.as_deref()
79 }
80 /// <p>The description of the secret.</p>
81 pub fn description(&self) -> ::std::option::Option<&str> {
82 self.description.as_deref()
83 }
84 /// <p>The ARN, key ID, or alias of the KMS key that Secrets Manager uses to encrypt the secret value in the secret. An alias is always prefixed by <code>alias/</code>, for example <code>alias/aws/secretsmanager</code>. For more information, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/alias-about.html">About aliases</a>.</p>
85 /// <p>To use a KMS key in a different account, use the key ARN or the alias ARN.</p>
86 /// <p>If you don't specify this value, then Secrets Manager uses the key <code>aws/secretsmanager</code>. If that key doesn't yet exist, then Secrets Manager creates it for you automatically the first time it encrypts the secret value.</p>
87 /// <p>If the secret is in a different Amazon Web Services account from the credentials calling the API, then you can't use <code>aws/secretsmanager</code> to encrypt the secret, and you must create and use a customer managed KMS key.</p>
88 pub fn kms_key_id(&self) -> ::std::option::Option<&str> {
89 self.kms_key_id.as_deref()
90 }
91 /// <p>The binary data to encrypt and store in the new version of the secret. We recommend that you store your binary data in a file and then pass the contents of the file as a parameter.</p>
92 /// <p>Either <code>SecretString</code> or <code>SecretBinary</code> must have a value, but not both.</p>
93 /// <p>This parameter is not available in the Secrets Manager console.</p>
94 /// <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>
95 pub fn secret_binary(&self) -> ::std::option::Option<&::aws_smithy_types::Blob> {
96 self.secret_binary.as_ref()
97 }
98 /// <p>The text data to encrypt and store in this new version of the secret. We recommend you use a JSON structure of key/value pairs for your secret value.</p>
99 /// <p>Either <code>SecretString</code> or <code>SecretBinary</code> must have a value, but not both.</p>
100 /// <p>If you create a secret by using the Secrets Manager console then Secrets Manager puts the protected secret text in only the <code>SecretString</code> parameter. The Secrets Manager console stores the information as a JSON structure of key/value pairs that a Lambda rotation function can parse.</p>
101 /// <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>
102 pub fn secret_string(&self) -> ::std::option::Option<&str> {
103 self.secret_string.as_deref()
104 }
105 /// <p>A list of tags to attach to the secret. Each tag is a key and value pair of strings in a JSON text string, for example:</p>
106 /// <p><code>\[{"Key":"CostCenter","Value":"12345"},{"Key":"environment","Value":"production"}\]</code></p>
107 /// <p>Secrets Manager tag key names are case sensitive. A tag with the key "ABC" is a different tag from one with key "abc".</p>
108 /// <p>If you check tags in permissions policies as part of your security strategy, then adding or removing a tag can change permissions. If the completion of this operation would result in you losing your permissions for this secret, then Secrets Manager blocks the operation and returns an <code>Access Denied</code> error. For more information, see <a href="https://docs.aws.amazon.com/secretsmanager/latest/userguide/auth-and-access_examples.html#tag-secrets-abac">Control access to secrets using tags</a> and <a href="https://docs.aws.amazon.com/secretsmanager/latest/userguide/auth-and-access_examples.html#auth-and-access_tags2">Limit access to identities with tags that match secrets' tags</a>.</p>
109 /// <p>For information about how to format a JSON parameter for the various command line tool environments, see <a href="https://docs.aws.amazon.com/cli/latest/userguide/cli-using-param.html#cli-using-param-json">Using JSON for Parameters</a>. If your command-line tool or SDK requires quotation marks around the parameter, you should use single quotes to avoid confusion with the double quotes required in the JSON text.</p>
110 /// <p>For tag quotas and naming restrictions, see <a href="https://docs.aws.amazon.com/general/latest/gr/arg.html#taged-reference-quotas">Service quotas for Tagging</a> in the <i>Amazon Web Services General Reference guide</i>.</p>
111 ///
112 /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.tags.is_none()`.
113 pub fn tags(&self) -> &[crate::types::Tag] {
114 self.tags.as_deref().unwrap_or_default()
115 }
116 /// <p>A list of Regions and KMS keys to replicate secrets.</p>
117 ///
118 /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.add_replica_regions.is_none()`.
119 pub fn add_replica_regions(&self) -> &[crate::types::ReplicaRegionType] {
120 self.add_replica_regions.as_deref().unwrap_or_default()
121 }
122 /// <p>Specifies whether to overwrite a secret with the same name in the destination Region. By default, secrets aren't overwritten.</p>
123 pub fn force_overwrite_replica_secret(&self) -> ::std::option::Option<bool> {
124 self.force_overwrite_replica_secret
125 }
126 /// <p>The exact string that identifies the partner that holds the external secret. For more information, see <a href="https://docs.aws.amazon.com/secretsmanager/latest/userguide/managed-external-secrets.html">Using Secrets Manager managed external secrets</a>.</p>
127 pub fn r#type(&self) -> ::std::option::Option<&str> {
128 self.r#type.as_deref()
129 }
130}
131impl ::std::fmt::Debug for CreateSecretInput {
132 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
133 let mut formatter = f.debug_struct("CreateSecretInput");
134 formatter.field("name", &self.name);
135 formatter.field("client_request_token", &self.client_request_token);
136 formatter.field("description", &self.description);
137 formatter.field("kms_key_id", &self.kms_key_id);
138 formatter.field("secret_binary", &"*** Sensitive Data Redacted ***");
139 formatter.field("secret_string", &"*** Sensitive Data Redacted ***");
140 formatter.field("tags", &self.tags);
141 formatter.field("add_replica_regions", &self.add_replica_regions);
142 formatter.field("force_overwrite_replica_secret", &self.force_overwrite_replica_secret);
143 formatter.field("r#type", &self.r#type);
144 formatter.finish()
145 }
146}
147impl CreateSecretInput {
148 /// Creates a new builder-style object to manufacture [`CreateSecretInput`](crate::operation::create_secret::CreateSecretInput).
149 pub fn builder() -> crate::operation::create_secret::builders::CreateSecretInputBuilder {
150 crate::operation::create_secret::builders::CreateSecretInputBuilder::default()
151 }
152}
153
154/// A builder for [`CreateSecretInput`](crate::operation::create_secret::CreateSecretInput).
155#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default)]
156#[non_exhaustive]
157pub struct CreateSecretInputBuilder {
158 pub(crate) name: ::std::option::Option<::std::string::String>,
159 pub(crate) client_request_token: ::std::option::Option<::std::string::String>,
160 pub(crate) description: ::std::option::Option<::std::string::String>,
161 pub(crate) kms_key_id: ::std::option::Option<::std::string::String>,
162 pub(crate) secret_binary: ::std::option::Option<::aws_smithy_types::Blob>,
163 pub(crate) secret_string: ::std::option::Option<::std::string::String>,
164 pub(crate) tags: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>,
165 pub(crate) add_replica_regions: ::std::option::Option<::std::vec::Vec<crate::types::ReplicaRegionType>>,
166 pub(crate) force_overwrite_replica_secret: ::std::option::Option<bool>,
167 pub(crate) r#type: ::std::option::Option<::std::string::String>,
168}
169impl CreateSecretInputBuilder {
170 /// <p>The name of the new secret.</p>
171 /// <p>The secret name can contain ASCII letters, numbers, and the following characters: /_+=.@-</p>
172 /// <p>Do not end your secret name with a hyphen followed by six characters. If you do so, you risk confusion and unexpected results when searching for a secret by partial ARN. Secrets Manager automatically adds a hyphen and six random characters after the secret name at the end of the ARN.</p>
173 /// This field is required.
174 pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
175 self.name = ::std::option::Option::Some(input.into());
176 self
177 }
178 /// <p>The name of the new secret.</p>
179 /// <p>The secret name can contain ASCII letters, numbers, and the following characters: /_+=.@-</p>
180 /// <p>Do not end your secret name with a hyphen followed by six characters. If you do so, you risk confusion and unexpected results when searching for a secret by partial ARN. Secrets Manager automatically adds a hyphen and six random characters after the secret name at the end of the ARN.</p>
181 pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
182 self.name = input;
183 self
184 }
185 /// <p>The name of the new secret.</p>
186 /// <p>The secret name can contain ASCII letters, numbers, and the following characters: /_+=.@-</p>
187 /// <p>Do not end your secret name with a hyphen followed by six characters. If you do so, you risk confusion and unexpected results when searching for a secret by partial ARN. Secrets Manager automatically adds a hyphen and six random characters after the secret name at the end of the ARN.</p>
188 pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
189 &self.name
190 }
191 /// <p>If you include <code>SecretString</code> or <code>SecretBinary</code>, then Secrets Manager creates an initial version for the secret, and this parameter specifies the unique identifier for the new version.</p><note>
192 /// <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>
193 /// </note>
194 /// <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>
195 /// <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>
196 /// <ul>
197 /// <li>
198 /// <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>
199 /// <li>
200 /// <p>If a version with this value already exists and the version <code>SecretString</code> and <code>SecretBinary</code> values are the same as those in the request, then the request is ignored.</p></li>
201 /// <li>
202 /// <p>If a version with this value already exists and that version's <code>SecretString</code> and <code>SecretBinary</code> values are different from those in the request, then the request fails because you cannot modify an existing version. Instead, use <code>PutSecretValue</code> to create a new version.</p></li>
203 /// </ul>
204 /// <p>This value becomes the <code>VersionId</code> of the new version.</p>
205 pub fn client_request_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
206 self.client_request_token = ::std::option::Option::Some(input.into());
207 self
208 }
209 /// <p>If you include <code>SecretString</code> or <code>SecretBinary</code>, then Secrets Manager creates an initial version for the secret, and this parameter specifies the unique identifier for the new version.</p><note>
210 /// <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>
211 /// </note>
212 /// <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>
213 /// <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>
214 /// <ul>
215 /// <li>
216 /// <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>
217 /// <li>
218 /// <p>If a version with this value already exists and the version <code>SecretString</code> and <code>SecretBinary</code> values are the same as those in the request, then the request is ignored.</p></li>
219 /// <li>
220 /// <p>If a version with this value already exists and that version's <code>SecretString</code> and <code>SecretBinary</code> values are different from those in the request, then the request fails because you cannot modify an existing version. Instead, use <code>PutSecretValue</code> to create a new version.</p></li>
221 /// </ul>
222 /// <p>This value becomes the <code>VersionId</code> of the new version.</p>
223 pub fn set_client_request_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
224 self.client_request_token = input;
225 self
226 }
227 /// <p>If you include <code>SecretString</code> or <code>SecretBinary</code>, then Secrets Manager creates an initial version for the secret, and this parameter specifies the unique identifier for the new version.</p><note>
228 /// <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>
229 /// </note>
230 /// <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>
231 /// <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>
232 /// <ul>
233 /// <li>
234 /// <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>
235 /// <li>
236 /// <p>If a version with this value already exists and the version <code>SecretString</code> and <code>SecretBinary</code> values are the same as those in the request, then the request is ignored.</p></li>
237 /// <li>
238 /// <p>If a version with this value already exists and that version's <code>SecretString</code> and <code>SecretBinary</code> values are different from those in the request, then the request fails because you cannot modify an existing version. Instead, use <code>PutSecretValue</code> to create a new version.</p></li>
239 /// </ul>
240 /// <p>This value becomes the <code>VersionId</code> of the new version.</p>
241 pub fn get_client_request_token(&self) -> &::std::option::Option<::std::string::String> {
242 &self.client_request_token
243 }
244 /// <p>The description of the secret.</p>
245 pub fn description(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
246 self.description = ::std::option::Option::Some(input.into());
247 self
248 }
249 /// <p>The description of the secret.</p>
250 pub fn set_description(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
251 self.description = input;
252 self
253 }
254 /// <p>The description of the secret.</p>
255 pub fn get_description(&self) -> &::std::option::Option<::std::string::String> {
256 &self.description
257 }
258 /// <p>The ARN, key ID, or alias of the KMS key that Secrets Manager uses to encrypt the secret value in the secret. An alias is always prefixed by <code>alias/</code>, for example <code>alias/aws/secretsmanager</code>. For more information, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/alias-about.html">About aliases</a>.</p>
259 /// <p>To use a KMS key in a different account, use the key ARN or the alias ARN.</p>
260 /// <p>If you don't specify this value, then Secrets Manager uses the key <code>aws/secretsmanager</code>. If that key doesn't yet exist, then Secrets Manager creates it for you automatically the first time it encrypts the secret value.</p>
261 /// <p>If the secret is in a different Amazon Web Services account from the credentials calling the API, then you can't use <code>aws/secretsmanager</code> to encrypt the secret, and you must create and use a customer managed KMS key.</p>
262 pub fn kms_key_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
263 self.kms_key_id = ::std::option::Option::Some(input.into());
264 self
265 }
266 /// <p>The ARN, key ID, or alias of the KMS key that Secrets Manager uses to encrypt the secret value in the secret. An alias is always prefixed by <code>alias/</code>, for example <code>alias/aws/secretsmanager</code>. For more information, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/alias-about.html">About aliases</a>.</p>
267 /// <p>To use a KMS key in a different account, use the key ARN or the alias ARN.</p>
268 /// <p>If you don't specify this value, then Secrets Manager uses the key <code>aws/secretsmanager</code>. If that key doesn't yet exist, then Secrets Manager creates it for you automatically the first time it encrypts the secret value.</p>
269 /// <p>If the secret is in a different Amazon Web Services account from the credentials calling the API, then you can't use <code>aws/secretsmanager</code> to encrypt the secret, and you must create and use a customer managed KMS key.</p>
270 pub fn set_kms_key_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
271 self.kms_key_id = input;
272 self
273 }
274 /// <p>The ARN, key ID, or alias of the KMS key that Secrets Manager uses to encrypt the secret value in the secret. An alias is always prefixed by <code>alias/</code>, for example <code>alias/aws/secretsmanager</code>. For more information, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/alias-about.html">About aliases</a>.</p>
275 /// <p>To use a KMS key in a different account, use the key ARN or the alias ARN.</p>
276 /// <p>If you don't specify this value, then Secrets Manager uses the key <code>aws/secretsmanager</code>. If that key doesn't yet exist, then Secrets Manager creates it for you automatically the first time it encrypts the secret value.</p>
277 /// <p>If the secret is in a different Amazon Web Services account from the credentials calling the API, then you can't use <code>aws/secretsmanager</code> to encrypt the secret, and you must create and use a customer managed KMS key.</p>
278 pub fn get_kms_key_id(&self) -> &::std::option::Option<::std::string::String> {
279 &self.kms_key_id
280 }
281 /// <p>The binary data to encrypt and store in the new version of the secret. We recommend that you store your binary data in a file and then pass the contents of the file as a parameter.</p>
282 /// <p>Either <code>SecretString</code> or <code>SecretBinary</code> must have a value, but not both.</p>
283 /// <p>This parameter is not available in the Secrets Manager console.</p>
284 /// <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>
285 pub fn secret_binary(mut self, input: ::aws_smithy_types::Blob) -> Self {
286 self.secret_binary = ::std::option::Option::Some(input);
287 self
288 }
289 /// <p>The binary data to encrypt and store in the new version of the secret. We recommend that you store your binary data in a file and then pass the contents of the file as a parameter.</p>
290 /// <p>Either <code>SecretString</code> or <code>SecretBinary</code> must have a value, but not both.</p>
291 /// <p>This parameter is not available in the Secrets Manager console.</p>
292 /// <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>
293 pub fn set_secret_binary(mut self, input: ::std::option::Option<::aws_smithy_types::Blob>) -> Self {
294 self.secret_binary = input;
295 self
296 }
297 /// <p>The binary data to encrypt and store in the new version of the secret. We recommend that you store your binary data in a file and then pass the contents of the file as a parameter.</p>
298 /// <p>Either <code>SecretString</code> or <code>SecretBinary</code> must have a value, but not both.</p>
299 /// <p>This parameter is not available in the Secrets Manager console.</p>
300 /// <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>
301 pub fn get_secret_binary(&self) -> &::std::option::Option<::aws_smithy_types::Blob> {
302 &self.secret_binary
303 }
304 /// <p>The text data to encrypt and store in this new version of the secret. We recommend you use a JSON structure of key/value pairs for your secret value.</p>
305 /// <p>Either <code>SecretString</code> or <code>SecretBinary</code> must have a value, but not both.</p>
306 /// <p>If you create a secret by using the Secrets Manager console then Secrets Manager puts the protected secret text in only the <code>SecretString</code> parameter. The Secrets Manager console stores the information as a JSON structure of key/value pairs that a Lambda rotation function can parse.</p>
307 /// <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>
308 pub fn secret_string(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
309 self.secret_string = ::std::option::Option::Some(input.into());
310 self
311 }
312 /// <p>The text data to encrypt and store in this new version of the secret. We recommend you use a JSON structure of key/value pairs for your secret value.</p>
313 /// <p>Either <code>SecretString</code> or <code>SecretBinary</code> must have a value, but not both.</p>
314 /// <p>If you create a secret by using the Secrets Manager console then Secrets Manager puts the protected secret text in only the <code>SecretString</code> parameter. The Secrets Manager console stores the information as a JSON structure of key/value pairs that a Lambda rotation function can parse.</p>
315 /// <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>
316 pub fn set_secret_string(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
317 self.secret_string = input;
318 self
319 }
320 /// <p>The text data to encrypt and store in this new version of the secret. We recommend you use a JSON structure of key/value pairs for your secret value.</p>
321 /// <p>Either <code>SecretString</code> or <code>SecretBinary</code> must have a value, but not both.</p>
322 /// <p>If you create a secret by using the Secrets Manager console then Secrets Manager puts the protected secret text in only the <code>SecretString</code> parameter. The Secrets Manager console stores the information as a JSON structure of key/value pairs that a Lambda rotation function can parse.</p>
323 /// <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>
324 pub fn get_secret_string(&self) -> &::std::option::Option<::std::string::String> {
325 &self.secret_string
326 }
327 /// Appends an item to `tags`.
328 ///
329 /// To override the contents of this collection use [`set_tags`](Self::set_tags).
330 ///
331 /// <p>A list of tags to attach to the secret. Each tag is a key and value pair of strings in a JSON text string, for example:</p>
332 /// <p><code>\[{"Key":"CostCenter","Value":"12345"},{"Key":"environment","Value":"production"}\]</code></p>
333 /// <p>Secrets Manager tag key names are case sensitive. A tag with the key "ABC" is a different tag from one with key "abc".</p>
334 /// <p>If you check tags in permissions policies as part of your security strategy, then adding or removing a tag can change permissions. If the completion of this operation would result in you losing your permissions for this secret, then Secrets Manager blocks the operation and returns an <code>Access Denied</code> error. For more information, see <a href="https://docs.aws.amazon.com/secretsmanager/latest/userguide/auth-and-access_examples.html#tag-secrets-abac">Control access to secrets using tags</a> and <a href="https://docs.aws.amazon.com/secretsmanager/latest/userguide/auth-and-access_examples.html#auth-and-access_tags2">Limit access to identities with tags that match secrets' tags</a>.</p>
335 /// <p>For information about how to format a JSON parameter for the various command line tool environments, see <a href="https://docs.aws.amazon.com/cli/latest/userguide/cli-using-param.html#cli-using-param-json">Using JSON for Parameters</a>. If your command-line tool or SDK requires quotation marks around the parameter, you should use single quotes to avoid confusion with the double quotes required in the JSON text.</p>
336 /// <p>For tag quotas and naming restrictions, see <a href="https://docs.aws.amazon.com/general/latest/gr/arg.html#taged-reference-quotas">Service quotas for Tagging</a> in the <i>Amazon Web Services General Reference guide</i>.</p>
337 pub fn tags(mut self, input: crate::types::Tag) -> Self {
338 let mut v = self.tags.unwrap_or_default();
339 v.push(input);
340 self.tags = ::std::option::Option::Some(v);
341 self
342 }
343 /// <p>A list of tags to attach to the secret. Each tag is a key and value pair of strings in a JSON text string, for example:</p>
344 /// <p><code>\[{"Key":"CostCenter","Value":"12345"},{"Key":"environment","Value":"production"}\]</code></p>
345 /// <p>Secrets Manager tag key names are case sensitive. A tag with the key "ABC" is a different tag from one with key "abc".</p>
346 /// <p>If you check tags in permissions policies as part of your security strategy, then adding or removing a tag can change permissions. If the completion of this operation would result in you losing your permissions for this secret, then Secrets Manager blocks the operation and returns an <code>Access Denied</code> error. For more information, see <a href="https://docs.aws.amazon.com/secretsmanager/latest/userguide/auth-and-access_examples.html#tag-secrets-abac">Control access to secrets using tags</a> and <a href="https://docs.aws.amazon.com/secretsmanager/latest/userguide/auth-and-access_examples.html#auth-and-access_tags2">Limit access to identities with tags that match secrets' tags</a>.</p>
347 /// <p>For information about how to format a JSON parameter for the various command line tool environments, see <a href="https://docs.aws.amazon.com/cli/latest/userguide/cli-using-param.html#cli-using-param-json">Using JSON for Parameters</a>. If your command-line tool or SDK requires quotation marks around the parameter, you should use single quotes to avoid confusion with the double quotes required in the JSON text.</p>
348 /// <p>For tag quotas and naming restrictions, see <a href="https://docs.aws.amazon.com/general/latest/gr/arg.html#taged-reference-quotas">Service quotas for Tagging</a> in the <i>Amazon Web Services General Reference guide</i>.</p>
349 pub fn set_tags(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>) -> Self {
350 self.tags = input;
351 self
352 }
353 /// <p>A list of tags to attach to the secret. Each tag is a key and value pair of strings in a JSON text string, for example:</p>
354 /// <p><code>\[{"Key":"CostCenter","Value":"12345"},{"Key":"environment","Value":"production"}\]</code></p>
355 /// <p>Secrets Manager tag key names are case sensitive. A tag with the key "ABC" is a different tag from one with key "abc".</p>
356 /// <p>If you check tags in permissions policies as part of your security strategy, then adding or removing a tag can change permissions. If the completion of this operation would result in you losing your permissions for this secret, then Secrets Manager blocks the operation and returns an <code>Access Denied</code> error. For more information, see <a href="https://docs.aws.amazon.com/secretsmanager/latest/userguide/auth-and-access_examples.html#tag-secrets-abac">Control access to secrets using tags</a> and <a href="https://docs.aws.amazon.com/secretsmanager/latest/userguide/auth-and-access_examples.html#auth-and-access_tags2">Limit access to identities with tags that match secrets' tags</a>.</p>
357 /// <p>For information about how to format a JSON parameter for the various command line tool environments, see <a href="https://docs.aws.amazon.com/cli/latest/userguide/cli-using-param.html#cli-using-param-json">Using JSON for Parameters</a>. If your command-line tool or SDK requires quotation marks around the parameter, you should use single quotes to avoid confusion with the double quotes required in the JSON text.</p>
358 /// <p>For tag quotas and naming restrictions, see <a href="https://docs.aws.amazon.com/general/latest/gr/arg.html#taged-reference-quotas">Service quotas for Tagging</a> in the <i>Amazon Web Services General Reference guide</i>.</p>
359 pub fn get_tags(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Tag>> {
360 &self.tags
361 }
362 /// Appends an item to `add_replica_regions`.
363 ///
364 /// To override the contents of this collection use [`set_add_replica_regions`](Self::set_add_replica_regions).
365 ///
366 /// <p>A list of Regions and KMS keys to replicate secrets.</p>
367 pub fn add_replica_regions(mut self, input: crate::types::ReplicaRegionType) -> Self {
368 let mut v = self.add_replica_regions.unwrap_or_default();
369 v.push(input);
370 self.add_replica_regions = ::std::option::Option::Some(v);
371 self
372 }
373 /// <p>A list of Regions and KMS keys to replicate secrets.</p>
374 pub fn set_add_replica_regions(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::ReplicaRegionType>>) -> Self {
375 self.add_replica_regions = input;
376 self
377 }
378 /// <p>A list of Regions and KMS keys to replicate secrets.</p>
379 pub fn get_add_replica_regions(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::ReplicaRegionType>> {
380 &self.add_replica_regions
381 }
382 /// <p>Specifies whether to overwrite a secret with the same name in the destination Region. By default, secrets aren't overwritten.</p>
383 pub fn force_overwrite_replica_secret(mut self, input: bool) -> Self {
384 self.force_overwrite_replica_secret = ::std::option::Option::Some(input);
385 self
386 }
387 /// <p>Specifies whether to overwrite a secret with the same name in the destination Region. By default, secrets aren't overwritten.</p>
388 pub fn set_force_overwrite_replica_secret(mut self, input: ::std::option::Option<bool>) -> Self {
389 self.force_overwrite_replica_secret = input;
390 self
391 }
392 /// <p>Specifies whether to overwrite a secret with the same name in the destination Region. By default, secrets aren't overwritten.</p>
393 pub fn get_force_overwrite_replica_secret(&self) -> &::std::option::Option<bool> {
394 &self.force_overwrite_replica_secret
395 }
396 /// <p>The exact string that identifies the partner that holds the external secret. For more information, see <a href="https://docs.aws.amazon.com/secretsmanager/latest/userguide/managed-external-secrets.html">Using Secrets Manager managed external secrets</a>.</p>
397 pub fn r#type(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
398 self.r#type = ::std::option::Option::Some(input.into());
399 self
400 }
401 /// <p>The exact string that identifies the partner that holds the external secret. For more information, see <a href="https://docs.aws.amazon.com/secretsmanager/latest/userguide/managed-external-secrets.html">Using Secrets Manager managed external secrets</a>.</p>
402 pub fn set_type(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
403 self.r#type = input;
404 self
405 }
406 /// <p>The exact string that identifies the partner that holds the external secret. For more information, see <a href="https://docs.aws.amazon.com/secretsmanager/latest/userguide/managed-external-secrets.html">Using Secrets Manager managed external secrets</a>.</p>
407 pub fn get_type(&self) -> &::std::option::Option<::std::string::String> {
408 &self.r#type
409 }
410 /// Consumes the builder and constructs a [`CreateSecretInput`](crate::operation::create_secret::CreateSecretInput).
411 pub fn build(
412 self,
413 ) -> ::std::result::Result<crate::operation::create_secret::CreateSecretInput, ::aws_smithy_types::error::operation::BuildError> {
414 ::std::result::Result::Ok(crate::operation::create_secret::CreateSecretInput {
415 name: self.name,
416 client_request_token: self.client_request_token,
417 description: self.description,
418 kms_key_id: self.kms_key_id,
419 secret_binary: self.secret_binary,
420 secret_string: self.secret_string,
421 tags: self.tags,
422 add_replica_regions: self.add_replica_regions,
423 force_overwrite_replica_secret: self.force_overwrite_replica_secret,
424 r#type: self.r#type,
425 })
426 }
427}
428impl ::std::fmt::Debug for CreateSecretInputBuilder {
429 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
430 let mut formatter = f.debug_struct("CreateSecretInputBuilder");
431 formatter.field("name", &self.name);
432 formatter.field("client_request_token", &self.client_request_token);
433 formatter.field("description", &self.description);
434 formatter.field("kms_key_id", &self.kms_key_id);
435 formatter.field("secret_binary", &"*** Sensitive Data Redacted ***");
436 formatter.field("secret_string", &"*** Sensitive Data Redacted ***");
437 formatter.field("tags", &self.tags);
438 formatter.field("add_replica_regions", &self.add_replica_regions);
439 formatter.field("force_overwrite_replica_secret", &self.force_overwrite_replica_secret);
440 formatter.field("r#type", &self.r#type);
441 formatter.finish()
442 }
443}