getRandomPassword
abstract suspend fun getRandomPassword(input: GetRandomPasswordRequest = GetRandomPasswordRequest { }): GetRandomPasswordResponse
Generates a random password. We recommend that you specify the maximum length and include every character type that the system you are generating a password for can support. By default, Secrets Manager uses uppercase and lowercase letters, numbers, and the following characters in passwords: !\"#$%&'()*+,-./:;<=>?@[\\]^_
{|}~`
Secrets Manager generates a CloudTrail log entry when you call this action.
**Required permissions: **secretsmanager:GetRandomPassword
. For more information, see IAM policy actions for Secrets Manager and Authentication and access control in Secrets Manager.
Samples
fun main() {
//sampleStart
// The following example shows how to request a randomly generated password. This example includes the
// optional flags to require spaces and at least one character of each included type. It specifies a length of
// 20 characters.
val resp = secretsManagerClient.getRandomPassword {
passwordLength = 20
includeSpace = true
requireEachIncludedType = true
}
//sampleEnd
}