// Handle getting and formating Azure Key Vault Certificate from Azure Key Vault to Kubernetes
Handle getting and formating Azure Key Vault Certificate from Azure Key Vault to Kubernetes
// Handle getting and formating Azure Key Vault Certificate from Azure Key Vault to Kubernetes
func (h *AzureKeyVaultCertificateHandler) Handle() (string, error) {
	exportPrivateKey := h.query == corev1.TLSPrivateKeyKey
	cert, err := h.vaultService.GetCertificate(&h.secretSpec.Spec.Vault, exportPrivateKey)
	if err != nil {
		return "", err
	}
	if h.query == "raw" {
		return string(cert.ExportRaw()), nil
	}
	var privKey []byte
	var pubKey []byte
	if exportPrivateKey {
		if privKey, err = cert.ExportPrivateKeyAsPem(); err != nil {
			return "", err
		}
		return string(privKey), nil
	}
	if pubKey, err = cert.ExportPublicKeyAsPem(); err != nil {
		return "", err
	}
	return string(pubKey), nil
}
func ( h * AzureKeyVaultCertificateHandler ) Handle ( ) ( string , error ) { exportPrivateKey := h . query == corev1 . TLSPrivateKeyKey cert , err := h . vaultService . GetCertificate ( & h . secretSpec . Spec . Vault , exportPrivateKey ) if err != nil { return " " , err } if h . query == " " { return string ( cert . ExportRaw ( ) ) , nil } var privKey [ ] byte var pubKey [ ] byte if exportPrivateKey { if privKey , err = cert . ExportPrivateKeyAsPem ( ) ; err != nil { return " " , err } return string ( privKey ) , nil } if pubKey , err = cert . ExportPublicKeyAsPem ( ) ; err != nil { return " " , err } return string ( pubKey ) , nil }
Handle getting and formating Azure Key Vault Certificate from Azure Key Vault to Kubernetes
Handle getting and formating Azure Key Vault Certificate from Azure Key Vault to Kubernetes