func (pki *PKI) DisableIfEnabled() error {
	if err := pki.client.Sys().Unmount(pki.path); err != nil {
		return fmt.Errorf("failed to disable PKI: %s", err)
	}
	return nil
}
DisableIfEnabled disables the engine backing the PKI if it exists.
package crypto
import (
	"crypto/x509"
	"encoding/json"
	"fmt"
	"time"
	vaultapi "github.com/hashicorp/vault/api"
)
type PKI struct {
	client *vaultapi.Client
	path   string
}
type PKICertificate struct {
	Serial        string
	Certificate   string
	PrivateKey    string
	CACertificate string
	Expiration    time.Time
}
type PKICrl struct {
	Certificate string
}
type PKIConfig struct {
	CommonName         string
	Validity           time.Duration
	RSABits            int
	Organization       string
	OrganizationalUnit string
	Country            string
	Locality           string
}
type PKIRoleConfig struct {
	DefaultValidity time.Duration
	RSABits         int
	Server          bool
}
func NewPKI(vault *vaultapi.Client, path string) *PKI {
	return &PKI{client: vault, path: path}
}
func (pki *PKI) EnsureEnabled() error {
	mounts, err := pki.client.Sys().ListMounts()
	if err != nil {
		return fmt.Errorf("failed to list existing mount paths: %s", err)
	}
	if _, ok := mounts[pki.path+"/"]; ok {
		return nil
	}
	input := &vaultapi.MountInput{
		Type: "pki",
		Config: vaultapi.MountConfigInput{
			DefaultLeaseTTL: "2592000",    
			MaxLeaseTTL:     "315360000",  
		},
	}
	if err := pki.client.Sys().Mount(pki.path, input); err != nil {
		return fmt.Errorf("failed to create mount for PKI: %s", err)
	}
	path := fmt.Sprintf("%s/config/crl", pki.path)
	content := map[string]interface{}{
		"expiry":  "72h",
		"disable": false,
	}
	if _, err := pki.client.Logical().Write(path, content); err != nil {
		return fmt.Errorf("failed to set CRL configuration: %s", err)
	}
	return nil
}