// To retrieve the encrypted secret value of a secret
//
// The following example shows how to retrieve the secret string value from the version
// of the secret that has the AWSPREVIOUS staging label attached. If you want to retrieve
// the AWSCURRENT version of the secret, then you can omit the VersionStage parameter
// because it defaults to AWSCURRENT.
To retrieve the encrypted secret value of a secret

The following example shows how to retrieve the secret string value from the version
of the secret that has the AWSPREVIOUS staging label attached. If you want to retrieve
the AWSCURRENT version of the secret, then you can omit the VersionStage parameter
because it defaults to AWSCURRENT.
// To retrieve the encrypted secret value of a secret // // The following example shows how to retrieve the secret string value from the version // of the secret that has the AWSPREVIOUS staging label attached . If you want to retrieve // the AWSCURRENT version of the secret then you can omit the VersionStage parameter // because it defaults to AWSCURRENT .
func ExampleSecretsManager_GetSecretValue_shared00() {
	svc := secretsmanager.New(session.New())
	input := &secretsmanager.GetSecretValueInput{
		SecretId:     aws.String("MyTestDatabaseSecret"),
		VersionStage: aws.String("AWSPREVIOUS"),
	}
	result, err := svc.GetSecretValue(input)
	if err != nil {
		if aerr, ok := err.(awserr.Error); ok {
			switch aerr.Code() {
			case secretsmanager.ErrCodeResourceNotFoundException:
				fmt.Println(secretsmanager.ErrCodeResourceNotFoundException, aerr.Error())
			case secretsmanager.ErrCodeInvalidParameterException:
				fmt.Println(secretsmanager.ErrCodeInvalidParameterException, aerr.Error())
			case secretsmanager.ErrCodeInvalidRequestException:
				fmt.Println(secretsmanager.ErrCodeInvalidRequestException, aerr.Error())
			case secretsmanager.ErrCodeDecryptionFailure:
				fmt.Println(secretsmanager.ErrCodeDecryptionFailure, 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_GetSecretValue_shared00 ( ) { svc := secretsmanager . New ( session . New ( ) ) input := & secretsmanager . GetSecretValueInput { SecretId : aws . String ( " " ) , VersionStage : aws . String ( " " ) , } result , err := svc . GetSecretValue ( input ) if err != nil { if aerr , ok := err . ( awserr . Error ) ; ok { switch aerr . Code ( ) { case secretsmanager . ErrCodeResourceNotFoundException : fmt . Println ( secretsmanager . ErrCodeResourceNotFoundException , aerr . Error ( ) ) case secretsmanager . ErrCodeInvalidParameterException : fmt . Println ( secretsmanager . ErrCodeInvalidParameterException , aerr . Error ( ) ) case secretsmanager . ErrCodeInvalidRequestException : fmt . Println ( secretsmanager . ErrCodeInvalidRequestException , aerr . Error ( ) ) case secretsmanager . ErrCodeDecryptionFailure : fmt . Println ( secretsmanager . ErrCodeDecryptionFailure , 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 retrieve the encrypted secret value of a secret
To retrieve the encrypted secret value of a secret
// Print the error, cast err to awserr.Error to get the Code and // Message from an error.