cert-manager/pkg/issuer/const.go
2017-09-11 10:47:58 +01:00

27 lines
621 B
Go

package issuer
import (
"fmt"
"github.com/jetstack-experimental/cert-manager/pkg/apis/certmanager/v1alpha1"
)
const (
// IssuerACME is the name of the ACME issuer
IssuerACME string = "acme"
// IssuerCA is the name of the simple issuer
IssuerCA string = "ca"
)
// nameForIssuer determines the name of the issuer implementation given an
// Issuer resource.
func nameForIssuer(i *v1alpha1.Issuer) (string, error) {
switch {
case i.Spec.ACME != nil:
return IssuerACME, nil
case i.Spec.CA != nil:
return IssuerCA, nil
}
return "", fmt.Errorf("no issuer specified for Issuer '%s/%s'", i.Namespace, i.Name)
}