Documentation
¶
Overview ¶
Package letsencrypt wraps SiteHost's Cloud-Container Let's Encrypt endpoints under /cloud/stack/ssl/lets_encrypt. The companion service running alongside the shared nginx-proxy on each Cloud Container Server provisions certs via the HTTP-01 challenge: as long as the stack's hostname (its label / VIRTUAL_HOST env) is reachable on port 80, a cert request will succeed.
Endpoints exposed today:
- List → cloud/stack/ssl/lets_encrypt/list_all.json (read)
- Create → cloud/stack/ssl/lets_encrypt/create.json (write, async)
- Delete → cloud/stack/ssl/lets_encrypt/delete.json (write, async)
- Renew → cloud/stack/ssl/lets_encrypt/renew.json (write, async)
- Revoke → cloud/stack/ssl/lets_encrypt/revoke.json (write, async)
All four write operations return a scheduler job; consumers must poll job.Get until state="Completed" before issuing dependent calls — see the JobResponse type and the package-level convention notes on `pkg/api/cloud/stack`.
Index ¶
- type CertInfo
- type Client
- func (s *Client) Create(ctx context.Context, request CreateRequest) (response JobResponse, err error)
- func (s *Client) Delete(ctx context.Context, request DeleteRequest) (response JobResponse, err error)
- func (s *Client) List(ctx context.Context, request ListRequest) (response ListResponse, err error)
- func (s *Client) Renew(ctx context.Context, request RenewRequest) (response JobResponse, err error)
- func (s *Client) Revoke(ctx context.Context, request RevokeRequest) (response JobResponse, err error)
- type CreateRequest
- type DeleteRequest
- type JobResponse
- type ListRequest
- type ListResponse
- type RenewRequest
- type RevokeRequest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CertInfo ¶
type CertInfo struct {
Issuer string `json:"issuer"`
NotBefore string `json:"not_before"`
NotAfter string `json:"not_after"`
Serial string `json:"serial"`
Expired string `json:"expired"`
IsMissing string `json:"is_missing"`
}
CertInfo is a single LE cert's metadata as returned by list_all. Per-container info is keyed by container name in the outer Return map of ListResponse.
String-typed boolean fields (Expired, IsMissing) reflect the API's actual response — values arrive as strings ("0"/"1") rather than typed bools.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a Service for Cloud Container Let's Encrypt management.
func (*Client) Create ¶
func (s *Client) Create(ctx context.Context, request CreateRequest) (response JobResponse, err error)
Create queues a Let's Encrypt cert issuance for the named stack. The HTTP-01 challenge runs against the stack's vhost via nginx-proxy; the stack must be reachable on port 80 at its label hostname for the challenge to succeed.
Returns a scheduler job; consumers must poll job.Get until state="Completed" before assuming the cert is issued.
func (*Client) Delete ¶
func (s *Client) Delete(ctx context.Context, request DeleteRequest) (response JobResponse, err error)
Delete removes the Let's Encrypt cert for the named stack. Distinct from Revoke (which is a CA-side action invalidating the cert across the public PKI); Delete only removes the cert from the stack's nginx-proxy config. Returns a scheduler job.
func (*Client) List ¶
func (s *Client) List(ctx context.Context, request ListRequest) (response ListResponse, err error)
List retrieves the LE certificates currently provisioned for the named stack on a Cloud Container Server. Returns a map keyed by container name within that stack; containers without an LE cert are absent from the map. Containers (optional) restricts the result to specific containers.
func (*Client) Renew ¶
func (s *Client) Renew(ctx context.Context, request RenewRequest) (response JobResponse, err error)
Renew forces an early renewal of the LE cert for the named stack. The companion auto-renews on schedule (typically when the cert has < 30 days remaining); use Renew only for out-of-band refresh. Returns a scheduler job.
func (*Client) Revoke ¶
func (s *Client) Revoke(ctx context.Context, request RevokeRequest) (response JobResponse, err error)
Revoke invalidates the LE cert for the named stack at the CA. Distinct from Delete: revocation propagates across the public PKI and means the cert can never be reinstated — issue a new one if you need HTTPS to keep working. Use Delete to remove the cert from local config without revoking. Returns a scheduler job.
type CreateRequest ¶
CreateRequest queues an LE-cert issuance for the named stack. HTTP-01 validation runs against the stack's nginx-proxy vhost; the stack must be reachable on port 80 at its label hostname for the challenge to succeed.
type DeleteRequest ¶
DeleteRequest removes the LE cert for the named stack.
type JobResponse ¶
type JobResponse struct {
Return struct {
models.Job `json:"job"`
} `json:"return"`
models.APIResponse
}
JobResponse is the shared response shape for the asynchronous write operations: Create, Delete, Renew, Revoke. Each queues a scheduler job; the job id is returned for tracking.
type ListRequest ¶
type ListRequest struct {
ServerName string `url:"server"`
StackName string `url:"name"`
Containers []string `url:"containers,omitempty"`
}
ListRequest identifies a stack on a CCS whose Let's Encrypt certs to list. ServerName is the CCS name (the unprefixed "server" parameter that cloud/stack/* uses, not "server_name"). StackName is the stack's name within that server. Containers is an optional filter restricting the result to specific containers within the stack.
Both ServerName and StackName are required by the API; omitting the stack name returns the API error "The stack name is missing.".
type ListResponse ¶
type ListResponse struct {
Return map[string]CertInfo `json:"return"`
models.APIResponse
}
ListResponse represents the response from list_all. Return is a map keyed by container name (within the queried stack) to that container's cert metadata. A container with no LE cert simply doesn't appear in the map.
func (*ListResponse) UnmarshalJSON ¶
func (r *ListResponse) UnmarshalJSON(data []byte) error
UnmarshalJSON tolerates the empty-array form the API returns when no stacks have LE certs configured.
type RenewRequest ¶
RenewRequest forces an early renewal of the LE cert for the named stack. Normally the companion auto-renews on schedule; use this for out-of-band refresh.
type RevokeRequest ¶
RevokeRequest revokes the LE cert for the named stack at the CA. Distinct from Delete: revocation is a CA-side action that invalidates the cert across the public PKI.