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 /// <p>The ARN of a primary secret in another Amazon Web Services account. Include this field to create a cross-account replica secret that receives replicated data from that primary secret. The primary secret must be in the same Amazon Web Services Region and partition as the replica, and you must specify a customer managed KMS key in <code>KmsKeyId</code>. You can't include <code>SecretString</code>, <code>SecretBinary</code>, <code>Description</code>, <code>AddReplicaRegions</code>, or <code>Type</code>.</p>
56 pub cross_account_primary_arn: ::std::option::Option<::std::string::String>,
57}
58impl CreateSecretInput {
59 /// <p>The name of the new secret.</p>
60 /// <p>The secret name can contain ASCII letters, numbers, and the following characters: /_+=.@-</p>
61 /// <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>
62 pub fn name(&self) -> ::std::option::Option<&str> {
63 self.name.as_deref()
64 }
65 /// <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>
66 /// <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>
67 /// </note>
68 /// <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>
69 /// <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>
70 /// <ul>
71 /// <li>
72 /// <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>
73 /// <li>
74 /// <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>
75 /// <li>
76 /// <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>
77 /// </ul>
78 /// <p>This value becomes the <code>VersionId</code> of the new version.</p>
79 pub fn client_request_token(&self) -> ::std::option::Option<&str> {
80 self.client_request_token.as_deref()
81 }
82 /// <p>The description of the secret.</p>
83 pub fn description(&self) -> ::std::option::Option<&str> {
84 self.description.as_deref()
85 }
86 /// <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>
87 /// <p>To use a KMS key in a different account, use the key ARN or the alias ARN.</p>
88 /// <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>
89 /// <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>
90 pub fn kms_key_id(&self) -> ::std::option::Option<&str> {
91 self.kms_key_id.as_deref()
92 }
93 /// <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>
94 /// <p>Either <code>SecretString</code> or <code>SecretBinary</code> must have a value, but not both.</p>
95 /// <p>This parameter is not available in the Secrets Manager console.</p>
96 /// <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>
97 pub fn secret_binary(&self) -> ::std::option::Option<&::aws_smithy_types::Blob> {
98 self.secret_binary.as_ref()
99 }
100 /// <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>
101 /// <p>Either <code>SecretString</code> or <code>SecretBinary</code> must have a value, but not both.</p>
102 /// <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>
103 /// <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>
104 pub fn secret_string(&self) -> ::std::option::Option<&str> {
105 self.secret_string.as_deref()
106 }
107 /// <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>
108 /// <p><code>\[{"Key":"CostCenter","Value":"12345"},{"Key":"environment","Value":"production"}\]</code></p>
109 /// <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>
110 /// <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>
111 /// <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>
112 /// <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>
113 ///
114 /// 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()`.
115 pub fn tags(&self) -> &[crate::types::Tag] {
116 self.tags.as_deref().unwrap_or_default()
117 }
118 /// <p>A list of Regions and KMS keys to replicate secrets.</p>
119 ///
120 /// 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()`.
121 pub fn add_replica_regions(&self) -> &[crate::types::ReplicaRegionType] {
122 self.add_replica_regions.as_deref().unwrap_or_default()
123 }
124 /// <p>Specifies whether to overwrite a secret with the same name in the destination Region. By default, secrets aren't overwritten.</p>
125 pub fn force_overwrite_replica_secret(&self) -> ::std::option::Option<bool> {
126 self.force_overwrite_replica_secret
127 }
128 /// <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>
129 pub fn r#type(&self) -> ::std::option::Option<&str> {
130 self.r#type.as_deref()
131 }
132 /// <p>The ARN of a primary secret in another Amazon Web Services account. Include this field to create a cross-account replica secret that receives replicated data from that primary secret. The primary secret must be in the same Amazon Web Services Region and partition as the replica, and you must specify a customer managed KMS key in <code>KmsKeyId</code>. You can't include <code>SecretString</code>, <code>SecretBinary</code>, <code>Description</code>, <code>AddReplicaRegions</code>, or <code>Type</code>.</p>
133 pub fn cross_account_primary_arn(&self) -> ::std::option::Option<&str> {
134 self.cross_account_primary_arn.as_deref()
135 }
136}
137impl ::std::fmt::Debug for CreateSecretInput {
138 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
139 let mut formatter = f.debug_struct("CreateSecretInput");
140 formatter.field("name", &self.name);
141 formatter.field("client_request_token", &self.client_request_token);
142 formatter.field("description", &self.description);
143 formatter.field("kms_key_id", &self.kms_key_id);
144 formatter.field("secret_binary", &"*** Sensitive Data Redacted ***");
145 formatter.field("secret_string", &"*** Sensitive Data Redacted ***");
146 formatter.field("tags", &self.tags);
147 formatter.field("add_replica_regions", &self.add_replica_regions);
148 formatter.field("force_overwrite_replica_secret", &self.force_overwrite_replica_secret);
149 formatter.field("r#type", &self.r#type);
150 formatter.field("cross_account_primary_arn", &self.cross_account_primary_arn);
151 formatter.finish()
152 }
153}
154impl CreateSecretInput {
155 /// Creates a new builder-style object to manufacture [`CreateSecretInput`](crate::operation::create_secret::CreateSecretInput).
156 pub fn builder() -> crate::operation::create_secret::builders::CreateSecretInputBuilder {
157 crate::operation::create_secret::builders::CreateSecretInputBuilder::default()
158 }
159}
160
161/// A builder for [`CreateSecretInput`](crate::operation::create_secret::CreateSecretInput).
162#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default)]
163#[non_exhaustive]
164pub struct CreateSecretInputBuilder {
165 pub(crate) name: ::std::option::Option<::std::string::String>,
166 pub(crate) client_request_token: ::std::option::Option<::std::string::String>,
167 pub(crate) description: ::std::option::Option<::std::string::String>,
168 pub(crate) kms_key_id: ::std::option::Option<::std::string::String>,
169 pub(crate) secret_binary: ::std::option::Option<::aws_smithy_types::Blob>,
170 pub(crate) secret_string: ::std::option::Option<::std::string::String>,
171 pub(crate) tags: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>,
172 pub(crate) add_replica_regions: ::std::option::Option<::std::vec::Vec<crate::types::ReplicaRegionType>>,
173 pub(crate) force_overwrite_replica_secret: ::std::option::Option<bool>,
174 pub(crate) r#type: ::std::option::Option<::std::string::String>,
175 pub(crate) cross_account_primary_arn: ::std::option::Option<::std::string::String>,
176}
177impl CreateSecretInputBuilder {
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 /// This field is required.
182 pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
183 self.name = ::std::option::Option::Some(input.into());
184 self
185 }
186 /// <p>The name of the new secret.</p>
187 /// <p>The secret name can contain ASCII letters, numbers, and the following characters: /_+=.@-</p>
188 /// <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>
189 pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
190 self.name = input;
191 self
192 }
193 /// <p>The name of the new secret.</p>
194 /// <p>The secret name can contain ASCII letters, numbers, and the following characters: /_+=.@-</p>
195 /// <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>
196 pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
197 &self.name
198 }
199 /// <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>
200 /// <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>
201 /// </note>
202 /// <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>
203 /// <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>
204 /// <ul>
205 /// <li>
206 /// <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>
207 /// <li>
208 /// <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>
209 /// <li>
210 /// <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>
211 /// </ul>
212 /// <p>This value becomes the <code>VersionId</code> of the new version.</p>
213 pub fn client_request_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
214 self.client_request_token = ::std::option::Option::Some(input.into());
215 self
216 }
217 /// <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>
218 /// <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>
219 /// </note>
220 /// <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>
221 /// <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>
222 /// <ul>
223 /// <li>
224 /// <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>
225 /// <li>
226 /// <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>
227 /// <li>
228 /// <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>
229 /// </ul>
230 /// <p>This value becomes the <code>VersionId</code> of the new version.</p>
231 pub fn set_client_request_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
232 self.client_request_token = input;
233 self
234 }
235 /// <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>
236 /// <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>
237 /// </note>
238 /// <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>
239 /// <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>
240 /// <ul>
241 /// <li>
242 /// <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>
243 /// <li>
244 /// <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>
245 /// <li>
246 /// <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>
247 /// </ul>
248 /// <p>This value becomes the <code>VersionId</code> of the new version.</p>
249 pub fn get_client_request_token(&self) -> &::std::option::Option<::std::string::String> {
250 &self.client_request_token
251 }
252 /// <p>The description of the secret.</p>
253 pub fn description(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
254 self.description = ::std::option::Option::Some(input.into());
255 self
256 }
257 /// <p>The description of the secret.</p>
258 pub fn set_description(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
259 self.description = input;
260 self
261 }
262 /// <p>The description of the secret.</p>
263 pub fn get_description(&self) -> &::std::option::Option<::std::string::String> {
264 &self.description
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 kms_key_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
271 self.kms_key_id = ::std::option::Option::Some(input.into());
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 set_kms_key_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
279 self.kms_key_id = input;
280 self
281 }
282 /// <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>
283 /// <p>To use a KMS key in a different account, use the key ARN or the alias ARN.</p>
284 /// <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>
285 /// <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>
286 pub fn get_kms_key_id(&self) -> &::std::option::Option<::std::string::String> {
287 &self.kms_key_id
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 secret_binary(mut self, input: ::aws_smithy_types::Blob) -> Self {
294 self.secret_binary = ::std::option::Option::Some(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 set_secret_binary(mut self, input: ::std::option::Option<::aws_smithy_types::Blob>) -> Self {
302 self.secret_binary = input;
303 self
304 }
305 /// <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>
306 /// <p>Either <code>SecretString</code> or <code>SecretBinary</code> must have a value, but not both.</p>
307 /// <p>This parameter is not available in the Secrets Manager console.</p>
308 /// <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>
309 pub fn get_secret_binary(&self) -> &::std::option::Option<::aws_smithy_types::Blob> {
310 &self.secret_binary
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 secret_string(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
317 self.secret_string = ::std::option::Option::Some(input.into());
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 set_secret_string(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
325 self.secret_string = input;
326 self
327 }
328 /// <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>
329 /// <p>Either <code>SecretString</code> or <code>SecretBinary</code> must have a value, but not both.</p>
330 /// <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>
331 /// <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>
332 pub fn get_secret_string(&self) -> &::std::option::Option<::std::string::String> {
333 &self.secret_string
334 }
335 /// Appends an item to `tags`.
336 ///
337 /// To override the contents of this collection use [`set_tags`](Self::set_tags).
338 ///
339 /// <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>
340 /// <p><code>\[{"Key":"CostCenter","Value":"12345"},{"Key":"environment","Value":"production"}\]</code></p>
341 /// <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>
342 /// <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>
343 /// <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>
344 /// <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>
345 pub fn tags(mut self, input: crate::types::Tag) -> Self {
346 let mut v = self.tags.unwrap_or_default();
347 v.push(input);
348 self.tags = ::std::option::Option::Some(v);
349 self
350 }
351 /// <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>
352 /// <p><code>\[{"Key":"CostCenter","Value":"12345"},{"Key":"environment","Value":"production"}\]</code></p>
353 /// <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>
354 /// <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>
355 /// <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>
356 /// <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>
357 pub fn set_tags(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>) -> Self {
358 self.tags = input;
359 self
360 }
361 /// <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>
362 /// <p><code>\[{"Key":"CostCenter","Value":"12345"},{"Key":"environment","Value":"production"}\]</code></p>
363 /// <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>
364 /// <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>
365 /// <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>
366 /// <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>
367 pub fn get_tags(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Tag>> {
368 &self.tags
369 }
370 /// Appends an item to `add_replica_regions`.
371 ///
372 /// To override the contents of this collection use [`set_add_replica_regions`](Self::set_add_replica_regions).
373 ///
374 /// <p>A list of Regions and KMS keys to replicate secrets.</p>
375 pub fn add_replica_regions(mut self, input: crate::types::ReplicaRegionType) -> Self {
376 let mut v = self.add_replica_regions.unwrap_or_default();
377 v.push(input);
378 self.add_replica_regions = ::std::option::Option::Some(v);
379 self
380 }
381 /// <p>A list of Regions and KMS keys to replicate secrets.</p>
382 pub fn set_add_replica_regions(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::ReplicaRegionType>>) -> Self {
383 self.add_replica_regions = input;
384 self
385 }
386 /// <p>A list of Regions and KMS keys to replicate secrets.</p>
387 pub fn get_add_replica_regions(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::ReplicaRegionType>> {
388 &self.add_replica_regions
389 }
390 /// <p>Specifies whether to overwrite a secret with the same name in the destination Region. By default, secrets aren't overwritten.</p>
391 pub fn force_overwrite_replica_secret(mut self, input: bool) -> Self {
392 self.force_overwrite_replica_secret = ::std::option::Option::Some(input);
393 self
394 }
395 /// <p>Specifies whether to overwrite a secret with the same name in the destination Region. By default, secrets aren't overwritten.</p>
396 pub fn set_force_overwrite_replica_secret(mut self, input: ::std::option::Option<bool>) -> Self {
397 self.force_overwrite_replica_secret = input;
398 self
399 }
400 /// <p>Specifies whether to overwrite a secret with the same name in the destination Region. By default, secrets aren't overwritten.</p>
401 pub fn get_force_overwrite_replica_secret(&self) -> &::std::option::Option<bool> {
402 &self.force_overwrite_replica_secret
403 }
404 /// <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>
405 pub fn r#type(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
406 self.r#type = ::std::option::Option::Some(input.into());
407 self
408 }
409 /// <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>
410 pub fn set_type(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
411 self.r#type = input;
412 self
413 }
414 /// <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>
415 pub fn get_type(&self) -> &::std::option::Option<::std::string::String> {
416 &self.r#type
417 }
418 /// <p>The ARN of a primary secret in another Amazon Web Services account. Include this field to create a cross-account replica secret that receives replicated data from that primary secret. The primary secret must be in the same Amazon Web Services Region and partition as the replica, and you must specify a customer managed KMS key in <code>KmsKeyId</code>. You can't include <code>SecretString</code>, <code>SecretBinary</code>, <code>Description</code>, <code>AddReplicaRegions</code>, or <code>Type</code>.</p>
419 pub fn cross_account_primary_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
420 self.cross_account_primary_arn = ::std::option::Option::Some(input.into());
421 self
422 }
423 /// <p>The ARN of a primary secret in another Amazon Web Services account. Include this field to create a cross-account replica secret that receives replicated data from that primary secret. The primary secret must be in the same Amazon Web Services Region and partition as the replica, and you must specify a customer managed KMS key in <code>KmsKeyId</code>. You can't include <code>SecretString</code>, <code>SecretBinary</code>, <code>Description</code>, <code>AddReplicaRegions</code>, or <code>Type</code>.</p>
424 pub fn set_cross_account_primary_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
425 self.cross_account_primary_arn = input;
426 self
427 }
428 /// <p>The ARN of a primary secret in another Amazon Web Services account. Include this field to create a cross-account replica secret that receives replicated data from that primary secret. The primary secret must be in the same Amazon Web Services Region and partition as the replica, and you must specify a customer managed KMS key in <code>KmsKeyId</code>. You can't include <code>SecretString</code>, <code>SecretBinary</code>, <code>Description</code>, <code>AddReplicaRegions</code>, or <code>Type</code>.</p>
429 pub fn get_cross_account_primary_arn(&self) -> &::std::option::Option<::std::string::String> {
430 &self.cross_account_primary_arn
431 }
432 /// Consumes the builder and constructs a [`CreateSecretInput`](crate::operation::create_secret::CreateSecretInput).
433 pub fn build(
434 self,
435 ) -> ::std::result::Result<crate::operation::create_secret::CreateSecretInput, ::aws_smithy_types::error::operation::BuildError> {
436 ::std::result::Result::Ok(crate::operation::create_secret::CreateSecretInput {
437 name: self.name,
438 client_request_token: self.client_request_token,
439 description: self.description,
440 kms_key_id: self.kms_key_id,
441 secret_binary: self.secret_binary,
442 secret_string: self.secret_string,
443 tags: self.tags,
444 add_replica_regions: self.add_replica_regions,
445 force_overwrite_replica_secret: self.force_overwrite_replica_secret,
446 r#type: self.r#type,
447 cross_account_primary_arn: self.cross_account_primary_arn,
448 })
449 }
450}
451impl ::std::fmt::Debug for CreateSecretInputBuilder {
452 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
453 let mut formatter = f.debug_struct("CreateSecretInputBuilder");
454 formatter.field("name", &self.name);
455 formatter.field("client_request_token", &self.client_request_token);
456 formatter.field("description", &self.description);
457 formatter.field("kms_key_id", &self.kms_key_id);
458 formatter.field("secret_binary", &"*** Sensitive Data Redacted ***");
459 formatter.field("secret_string", &"*** Sensitive Data Redacted ***");
460 formatter.field("tags", &self.tags);
461 formatter.field("add_replica_regions", &self.add_replica_regions);
462 formatter.field("force_overwrite_replica_secret", &self.force_overwrite_replica_secret);
463 formatter.field("r#type", &self.r#type);
464 formatter.field("cross_account_primary_arn", &self.cross_account_primary_arn);
465 formatter.finish()
466 }
467}