func (v *Vault) DeleteTransitKey(key string) {
	p := make(map[string]interface{})
	p["deletion_allowed"] = "true"
	_, err := v.Client.Logical().Write("transit/keys/"+key+"/config", p)
	if err != nil {
		log.Fatalf("Vault error: %v", err)
	}
	_, err = v.Client.Logical().Delete("transit/keys/" + key)
	if err != nil {
		log.Fatalf("Vault error: %v", err)
	}
	color.Green("=> Deleted transit key '%v' from Vault", key)
}
DeleteTransitKey : Delete a transit key from Vault
package cmd
import (
	"fmt"
	"io/ioutil"
	"os"
	"path/filepath"
	"github.com/fatih/color"
	"github.com/hashicorp/vault/api"
	"github.com/mitchellh/go-homedir"
	"github.com/olekukonko/tablewriter"
	log "github.com/sirupsen/logrus"
	s5 "github.com/mvisonneau/s5/cipher"
	s5Vault "github.com/mvisonneau/s5/cipher/vault"
)
type Vault struct {
	Client *api.Client
}
type VaultConfig struct {
	Address  string
	Token    string
	RoleID   string
	SecretID string
}
func getVaultClient(vc *VaultConfig) (*Vault, error) {
	log.Debug("Creating Vault client..")
	v, err := api.NewClient(nil)
	if err != nil {
		return nil, fmt.Errorf("Error creating Vault client: %v", err)
	}
	if vc.Address == "" {
		return nil, fmt.Errorf("Vault address must be defined")
	}
	if len(vc.Token) > 0 {
		v.SetToken(vc.Token)
	} else if len(vc.RoleID) > 0 && len(vc.SecretID) > 0 {
		data := map[string]interface{}{
			"role_id":   vc.RoleID,
			"secret_id": vc.SecretID,
		}
		r, err := v.Logical().Write("auth/approle/login", data)
		if err != nil {
			log.Fatalf("Can't authenticate against vault using provided approle credentials: %v", err)
		}
		if r.Auth == nil {
			log.Fatalf("no auth info returned with provided approle credentials")
		}
		v.SetToken(r.Auth.ClientToken)
	} else {
		home, _ := homedir.Dir()
		f, err := ioutil.ReadFile(filepath.Clean(home + "/.vault-token"))
		if err != nil {
			return nil, fmt.Errorf("Vault token is not defined (VAULT_TOKEN, (--vault-role-id and --vault-secret-id) or ~/.vault-token)")
		}
		v.SetToken(string(f))
	}
	return &Vault{v}, nil
}
func (v *Vault) GetTransitInfo() {
	d, err := v.Client.Logical().Read("transit/keys/" + s.Vault.TransitKey)
	if err != nil {
		log.Fatalf("Vault error: %v", err)
	}
	if d == nil {
		log.Fatalf("The configured transit key doesn't seem to exists : %v", s.Vault.TransitKey)
	}
	table := tablewriter.NewWriter(os.Stdout)
	table.SetHeader([]string{"Key", "Value"})
	for k, l := range d.Data {
		table.Append([]string{k, fmt.Sprintf("%v", l)})
	}
	table.Render()
}
func (v *Vault) CreateTransitKey(key string) {
	_, err := v.Client.Logical().Write("transit/keys/"+key, make(map[string]interface{}))
	if err != nil {
		log.Fatalf("Vault error: %v", err)
	}
	fmt.Println("Transit key created successfully")
}
func (v *Vault) ListTransitKeys() {
	d, err := v.Client.Logical().List("transit/keys")
	if err != nil {
		log.Fatalf("Vault error: %v", err)
	}
	if d != nil {
		table := tablewriter.NewWriter(os.Stdout)
		table.SetHeader([]string{"Key"})
		for _, l := range d.Data["keys"].([]interface{}) {
			table.Append([]string{l.(string)})
		}
		table.Render()
	}
}