2020-09-09 02:26:32 +00:00
|
|
|
package apiv1
|
|
|
|
|
2020-09-10 23:19:18 +00:00
|
|
|
import (
|
|
|
|
"strings"
|
|
|
|
)
|
|
|
|
|
2020-09-09 02:26:32 +00:00
|
|
|
// CertificateAuthorityService is the interface implemented to support external
|
|
|
|
// certificate authorities.
|
|
|
|
type CertificateAuthorityService interface {
|
|
|
|
CreateCertificate(req *CreateCertificateRequest) (*CreateCertificateResponse, error)
|
|
|
|
RenewCertificate(req *RenewCertificateRequest) (*RenewCertificateResponse, error)
|
|
|
|
RevokeCertificate(req *RevokeCertificateRequest) (*RevokeCertificateResponse, error)
|
|
|
|
}
|
|
|
|
|
2020-09-11 02:09:46 +00:00
|
|
|
// Type represents the CAS type used.
|
2020-09-09 02:26:32 +00:00
|
|
|
type Type string
|
|
|
|
|
|
|
|
const (
|
|
|
|
// DefaultCAS is a CertificateAuthorityService using software.
|
|
|
|
DefaultCAS = ""
|
|
|
|
// SoftCAS is a CertificateAuthorityService using software.
|
2020-09-11 02:09:46 +00:00
|
|
|
SoftCAS = "softcas"
|
2020-09-09 02:26:32 +00:00
|
|
|
// CloudCAS is a CertificateAuthorityService using Google Cloud CAS.
|
2020-09-11 02:09:46 +00:00
|
|
|
CloudCAS = "cloudcas"
|
2020-09-09 02:26:32 +00:00
|
|
|
)
|
2020-09-10 23:19:18 +00:00
|
|
|
|
2020-09-11 02:09:46 +00:00
|
|
|
// String returns a string from the type. It will always return the lower case
|
|
|
|
// version of the Type, as we need a standard type to compare and use as the
|
|
|
|
// registry key.
|
2020-09-10 23:19:18 +00:00
|
|
|
func (t Type) String() string {
|
|
|
|
if t == "" {
|
|
|
|
return SoftCAS
|
|
|
|
}
|
2020-09-11 02:09:46 +00:00
|
|
|
return strings.ToLower(string(t))
|
2020-09-10 23:19:18 +00:00
|
|
|
}
|