// To delete a secret
//
// The following example shows how to delete a secret. The secret stays in your account
// in a deprecated and inaccessible state until the recovery window ends. After the
// date and time in the DeletionDate response field has passed, you can no longer recover
// this secret with restore-secret.
To delete a secret

The following example shows how to delete a secret. The secret stays in your account
in a deprecated and inaccessible state until the recovery window ends. After the
date and time in the DeletionDate response field has passed, you can no longer recover
this secret with restore-secret.
// To delete a secret // // The following example shows how to delete a secret . The secret stays in your account // in a deprecated and inaccessible state until the recovery window ends . After the // date and time in the DeletionDate response field has passed you can no longer recover // this secret with restore - secret .
func ExampleSecretsManager_DeleteSecret_shared00() {
	svc := secretsmanager.New(session.New())
	input := &secretsmanager.DeleteSecretInput{
		RecoveryWindowInDays: aws.Int64(7),
		SecretId:             aws.String("MyTestDatabaseSecret1"),
	}
	result, err := svc.DeleteSecret(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.ErrCodeInternalServiceError:
				fmt.Println(secretsmanager.ErrCodeInternalServiceError, aerr.Error())
			default:
				fmt.Println(aerr.Error())
			}
		} else {
			fmt.Println(err.Error())
		}
		return
	}
	fmt.Println(result)
}
func ExampleSecretsManager_DeleteSecret_shared00 ( ) { svc := secretsmanager . New ( session . New ( ) ) input := & secretsmanager . DeleteSecretInput { RecoveryWindowInDays : aws . Int64 ( 7 ) , SecretId : aws . String ( " " ) , } result , err := svc . DeleteSecret ( 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 . ErrCodeInternalServiceError : fmt . Println ( secretsmanager . ErrCodeInternalServiceError , aerr . Error ( ) ) default : fmt . Println ( aerr . Error ( ) ) } } else { fmt . Println ( err . Error ( ) ) } return } fmt . Println ( result ) }
To delete a secret
To delete a secret
// Print the error, cast err to awserr.Error to get the Code and // Message from an error.