// To generate a random password
//
// 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.
To generate a random password

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.
// To generate a random password // // 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 .
func ExampleSecretsManager_GetRandomPassword_shared00() {
	svc := secretsmanager.New(session.New())
	input := &secretsmanager.GetRandomPasswordInput{
		IncludeSpace:            aws.Bool(true),
		PasswordLength:          aws.Int64(20),
		RequireEachIncludedType: aws.Bool(true),
	}
	result, err := svc.GetRandomPassword(input)
	if err != nil {
		if aerr, ok := err.(awserr.Error); ok {
			switch aerr.Code() {
			case secretsmanager.ErrCodeInvalidParameterException:
				fmt.Println(secretsmanager.ErrCodeInvalidParameterException, aerr.Error())
			case secretsmanager.ErrCodeInvalidRequestException:
				fmt.Println(secretsmanager.ErrCodeInvalidRequestException, aerr.Error())
			case secretsmanager.ErrCodeInternalServiceError:
				fmt.Println(secretsmanager.ErrCodeInternalServiceError, aerr.Error())
			default:
				fmt.Println(aerr.Error())
			}
		} else {
			fmt.Println(err.Error())
		}
		return
	}
	fmt.Println(result)
}
func ExampleSecretsManager_GetRandomPassword_shared00 ( ) { svc := secretsmanager . New ( session . New ( ) ) input := & secretsmanager . GetRandomPasswordInput { IncludeSpace : aws . Bool ( true ) , PasswordLength : aws . Int64 ( 20 ) , RequireEachIncludedType : aws . Bool ( true ) , } result , err := svc . GetRandomPassword ( input ) if err != nil { if aerr , ok := err . ( awserr . Error ) ; ok { switch aerr . Code ( ) { case secretsmanager . ErrCodeInvalidParameterException : fmt . Println ( secretsmanager . ErrCodeInvalidParameterException , aerr . Error ( ) ) case secretsmanager . ErrCodeInvalidRequestException : fmt . Println ( secretsmanager . ErrCodeInvalidRequestException , aerr . Error ( ) ) case secretsmanager . ErrCodeInternalServiceError : fmt . Println ( secretsmanager . ErrCodeInternalServiceError , aerr . Error ( ) ) default : fmt . Println ( aerr . Error ( ) ) } } else { fmt . Println ( err . Error ( ) ) } return } fmt . Println ( result ) }
To generate a random password
To generate a random password
// Print the error, cast err to awserr.Error to get the Code and // Message from an error.