Documentation
¶
Index ¶
- Variables
- type ACMEChallenge
- type ACMEChallengeOptions
- type ACMEChallenges
- type ACMEChallengesPage
- type ACMEService
- type ACMEUser
- type ACMEUserService
- type Certificate
- type Certificates
- type CertificatesPage
- type Error
- type Getter
- type Info
- type Infos
- type InfosPage
- type ManagementService
- type Options
- type Service
Constants ¶
This section is empty.
Variables ¶
var ( CertificateNotFound = NewError(1000, "certificate not found") CertificateInvalid = NewError(1001, "certificate invalid") FQDNMissing = NewError(1100, "fqdn missing") FQDNInvalid = NewError(1101, "fqdn invalid") FQDNExists = NewError(1102, "fqdn exists") ACMEUserNotFound = NewError(1200, "acme user not found") ACMEUserEmailInvalid = NewError(1201, "acme user email invalid") ACMEChallengeNotFound = NewError(1300, "acme challenge not found") )
Errors that are related to the Certificate Service.
var ( // ErrorRegistry is a map of error codes to errors. // It is usually used in gopherpit.com/gopherpit/pkg/client.Client. ErrorRegistry = apiClient.NewMapErrorRegistry(nil) )
Functions ¶
This section is empty.
Types ¶
type ACMEChallenge ¶
type ACMEChallenge struct {
FQDN string `json:"fqdn"`
Token string `json:"token,omitempty"`
KeyAuth string `json:"key-auth,omitempty"`
}
ACMEChallenge provides data about ACME challenge for new certificate issue.
type ACMEChallengeOptions ¶
type ACMEChallengeOptions struct {
Token *string `json:"token,omitempty"`
KeyAuth *string `json:"key-auth,omitempty"`
}
ACMEChallengeOptions is a structure with parameters as pointers to set ACME challenge data. If a parameter is nil, the corresponding ACMEChallenge parameter will not be changed.
type ACMEChallenges ¶
type ACMEChallenges []ACMEChallenge
ACMEChallenges is a list of ACMEChallenge instances.
type ACMEChallengesPage ¶
type ACMEChallengesPage struct {
ACMEChallenges ACMEChallenges `json:"acme-challenges"`
Previous string `json:"previous,omitempty"`
Next string `json:"next,omitempty"`
Count int `json:"count,omitempty"`
}
ACMEChallengesPage is a paginated list of ACMEChallenge instances.
type ACMEService ¶
type ACMEService interface {
// ObtainCertificate requests a new SSL/TLS certificate from
// ACME provider and returns an instance of Certificate.
ObtainCertificate(fqdn string) (c *Certificate, err error)
// IsCertificateBeingObtained tests if certificate is being obtained currently.
// It can be used as a locking mechanism.
IsCertificateBeingObtained(fqdn string) (yes bool, err error)
// ACMEChallenge returns an instance of ACMEChallenge for a FQDN.
ACMEChallenge(fqdn string) (c *ACMEChallenge, err error)
// UpdateACMEChallenge alters the fields of existing ACMEChallenge.
UpdateACMEChallenge(fqdn string, o *ACMEChallengeOptions) (c *ACMEChallenge, err error)
// DeleteACMEChallenge deletes an existing ACMEChallenge for a
// provided FQDN and returns it.
DeleteACMEChallenge(fqdn string) (c *ACMEChallenge, err error)
// ACMEChallenges retrieves a paginated list of ACMEChallenge instances.
ACMEChallenges(start string, limit int) (page *ACMEChallengesPage, err error)
}
ACMEService defines functionality required to obtain SSL/TLS certificate from ACME provider.
type ACMEUser ¶
type ACMEUser struct {
ID int `json:"id"`
Email string `json:"email"`
PrivateKey []byte `json:"private-key"`
URL string `json:"url"`
NewAuthzURL string `json:"new-authz-url"`
DirectoryURL string `json:"directory-url"`
}
ACMEUser is hods data about authentication to ACME provider.
type ACMEUserService ¶
type ACMEUserService interface {
// ACMEUser returns ACME user with ACME authentication details.
ACMEUser() (u *ACMEUser, err error)
// RegisterACMEUser registers and saves ACME user authentication data.
RegisterACMEUser(directoryURL, email string) (u *ACMEUser, err error)
}
ACMEUserService handlers ACME user.
type Certificate ¶
type Certificate struct {
FQDN string `json:"fqdn"`
ExpirationTime *time.Time `json:"expiration-time,omitempty"`
Cert string `json:"cert,omitempty"`
Key string `json:"key,omitempty"`
ACMEURL string `json:"acme-url,omitempty"`
ACMEURLStable string `json:"acme-url-stable,omitempty"`
ACMEAccount string `json:"acme-account,omitempty"`
}
Certificate holds data related to SSL/TLS certificate.
type Certificates ¶
type Certificates []Certificate
Certificates is a list of Certificate instances.
type CertificatesPage ¶
type CertificatesPage struct {
Certificates Certificates `json:"certificates"`
Previous string `json:"previous,omitempty"`
Next string `json:"next,omitempty"`
Count int `json:"count,omitempty"`
}
CertificatesPage is a paginated list of Certificate instances.
type Error ¶
type Error struct {
// Message is a text that describes an error.
Message string `json:"message"`
// Code is a number that identifies error.
// It allows error identification when serialization is involved.
Code int `json:"code"`
}
Error is a structure that holds error message and code.
type Getter ¶ added in v0.2.1
type Getter interface {
// Certificate returns a Certificate for provided FQDN.
Certificate(fqdn string) (c *Certificate, err error)
}
Getter provides interface to get single certificate. It is most useful for services that are only consumers of certificates.
type Info ¶
type Info struct {
FQDN string `json:"fqdn"`
ExpirationTime *time.Time `json:"expiration-time,omitempty"`
ACMEURL string `json:"acme-url,omitempty"`
ACMEURLStable string `json:"acme-url-stable,omitempty"`
ACMEAccount string `json:"acme-account,omitempty"`
}
Info is a subset of Certificate structure fields to provide information about expiration time and ACME issuer.
type InfosPage ¶
type InfosPage struct {
Infos Infos `json:"infos"`
Previous string `json:"previous,omitempty"`
Next string `json:"next,omitempty"`
Count int `json:"count,omitempty"`
}
InfosPage is a paginated list of Info instances.
type ManagementService ¶
type ManagementService interface {
Getter
// UpdateCertificate alters the fields of existing Certificate.
UpdateCertificate(fqdn string, o *Options) (c *Certificate, err error)
// DeleteCertificate deletes an existing Certificate for a
// provided FQDN and returns it.
DeleteCertificate(fqdn string) (c *Certificate, err error)
// Certificates retrieves a paginated list of Certificate instances
// ordered by FQDN.
Certificates(start string, limit int) (page *CertificatesPage, err error)
// CertificatesInfoByExpiry retrieves a paginated list of Info instances
// ordered by expiration time.
CertificatesInfoByExpiry(since time.Time, start string, limit int) (page *InfosPage, err error)
}
ManagementService defines most basic functionality for certificate management.
type Options ¶
type Options struct {
Cert *string `json:"cert,omitempty"`
Key *string `json:"key,omitempty"`
ACMEURL *string `json:"acme-url,omitempty"`
ACMEURLStable *string `json:"acme-url-stable,omitempty"`
ACMEAccount *string `json:"acme-account,omitempty"`
}
Options is a structure with parameters as pointers to set certificate data. If a parameter is nil, the corresponding Certificate parameter will not be changed.
type Service ¶
type Service interface {
ManagementService
ACMEService
ACMEUserService
}
Service defines functions that Certificate provider must have.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package httpCertificate provides a Service that is a HTTP client to an external certificate service that can respond to HTTP requests defined here.
|
Package httpCertificate provides a Service that is a HTTP client to an external certificate service that can respond to HTTP requests defined here. |