certificate

package
v0.1.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 19, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatIssuer

func FormatIssuer(cert *x509.Certificate) string

FormatIssuer formats the certificate issuer for display

func ParseCertificatePEM

func ParseCertificatePEM(certPEM string) (*x509.Certificate, error)

ParseCertificatePEM parses a PEM-encoded certificate

func UpdateCertificateStatus

func UpdateCertificateStatus(cert *model.Certificate)

UpdateCertificateStatus updates the certificate status based on expiration

Types

type AddAlertRequest

type AddAlertRequest = CertificateAlertAddRequest

type AddAlertResponse

type AddAlertResponse = CertificateAlertAddResponse

type AddRequest

type AddRequest = CertificateAddRequest

type AddResponse

type AddResponse = CertificateAddResponse

type AlertItem

type AlertItem = CertificateAlertItem

type Certificate

type Certificate struct {
	ID            uint   `json:"id"`
	Domain        string `json:"domain"`
	Issuer        string `json:"issuer"`
	ExpiresAt     string `json:"expiresAt"`
	Status        string `json:"status"`
	LastCheckedAt string `json:"lastCheckedAt"`
	ErrorMessage  string `json:"errorMessage,omitempty"`
	CreatedAt     string `json:"createdAt"`
}

Certificate represents a certificate entity

type CertificateAddRequest

type CertificateAddRequest struct {
	Domain      string `json:"domain"`
	Certificate string `json:"certificate"`
	PrivateKey  string `json:"privateKey"`
}

CertificateAddRequest is the request to add a certificate

type CertificateAddResponse

type CertificateAddResponse struct {
	Certificate CertificateItem `json:"certificate"`
}

CertificateAddResponse is the response from adding a certificate

type CertificateAlertAddRequest

type CertificateAlertAddRequest struct {
	Domain    string `json:"domain"`
	Threshold int    `json:"threshold"`
}

CertificateAlertAddRequest is the request to add a certificate alert

type CertificateAlertAddResponse

type CertificateAlertAddResponse struct {
	ID            uint   `json:"id"`
	Domain        string `json:"domain"`
	ThresholdDays int    `json:"thresholdDays"`
}

CertificateAlertAddResponse is the response from adding a certificate alert

type CertificateAlertItem

type CertificateAlertItem struct {
	ID              uint   `json:"id"`
	Domain          string `json:"domain"`
	ThresholdDays   int    `json:"thresholdDays"`
	Active          bool   `json:"active"`
	LastTriggeredAt string `json:"lastTriggeredAt,omitempty"`
	CreatedAt       string `json:"createdAt"`
}

CertificateAlertItem represents a certificate alert

type CertificateAlertsListRequest

type CertificateAlertsListRequest struct {
	Page     int `form:"page"`
	PageSize int `form:"pageSize"`
}

CertificateAlertsListRequest is the request to list certificate alerts

type CertificateAlertsListResponse

type CertificateAlertsListResponse struct {
	Items []CertificateAlertItem `json:"items"`
	Total int64                  `json:"total"`
	Page  int                    `json:"page"`
	Size  int                    `json:"size"`
}

CertificateAlertsListResponse is the response with certificate alerts list

type CertificateCheckAllRequest

type CertificateCheckAllRequest struct {
}

CertificateCheckAllRequest is the request to check all certificates

type CertificateCheckAllResponse

type CertificateCheckAllResponse struct {
	Checked int `json:"checked"`
	Failed  int `json:"failed"`
	Total   int `json:"total"`
}

CertificateCheckAllResponse is the response from checking all certificates

type CertificateCheckRequest

type CertificateCheckRequest struct {
	ID string `uri:"id"`
}

CertificateCheckRequest is the request to check a certificate

type CertificateCheckResponse

type CertificateCheckResponse struct {
	Certificate CertificateItem `json:"certificate"`
}

CertificateCheckResponse is the response from checking a certificate

type CertificateDeleteRequest

type CertificateDeleteRequest struct {
	ID string `uri:"id"`
}

CertificateDeleteRequest is the request to delete a certificate

type CertificateDeleteResponse

type CertificateDeleteResponse struct {
	Message string `json:"message"`
}

CertificateDeleteResponse is the response from deleting a certificate

type CertificateDetailRequest

type CertificateDetailRequest struct {
	ID string `uri:"id"`
}

CertificateDetailRequest is the request to get certificate details

type CertificateDetailResponse

type CertificateDetailResponse struct {
	Certificate CertificateItem `json:"certificate"`
}

CertificateDetailResponse is the response with certificate details

type CertificateDomainInfoRequest

type CertificateDomainInfoRequest struct {
	Domain string `form:"domain"`
}

CertificateDomainInfoRequest is the request to get domain certificate info

type CertificateDomainInfoResponse

type CertificateDomainInfoResponse struct {
	Certificate CertificateItem `json:"certificate"`
}

CertificateDomainInfoResponse is the response with domain certificate info

type CertificateExpiringRequest

type CertificateExpiringRequest struct {
	Days int `form:"days"`
}

CertificateExpiringRequest is the request to get expiring certificates

type CertificateExpiringResponse

type CertificateExpiringResponse struct {
	Items []CertificateItem `json:"items"`
	Days  int               `json:"days"`
}

CertificateExpiringResponse is the response with expiring certificates

type CertificateItem

type CertificateItem struct {
	ID            uint   `json:"id"`
	Domain        string `json:"domain"`
	Issuer        string `json:"issuer"`
	ExpiresAt     string `json:"expiresAt"`
	Status        string `json:"status"`
	LastCheckedAt string `json:"lastCheckedAt"`
	ErrorMessage  string `json:"errorMessage,omitempty"`
	CreatedAt     string `json:"createdAt"`
}

CertificateItem represents a certificate in the list

func BuildCertificateDTO

func BuildCertificateDTO(cert *model.Certificate) CertificateItem

BuildCertificateDTO builds a certificate DTO from model

type CertificateStatsRequest

type CertificateStatsRequest struct {
}

CertificateStatsRequest is the request to get certificate statistics

type CertificateStatsResponse

type CertificateStatsResponse struct {
	Total    int64 `json:"total"`
	Valid    int64 `json:"valid"`
	Expiring int64 `json:"expiring"`
	Expired  int64 `json:"expired"`
	Invalid  int64 `json:"invalid"`
}

CertificateStatsResponse is the response with certificate statistics

type CertificatesListRequest

type CertificatesListRequest struct {
	Page     int    `form:"page"`
	PageSize int    `form:"pageSize"`
	Status   string `form:"status"`
}

CertificatesListRequest is the request to list certificates

type CertificatesListResponse

type CertificatesListResponse struct {
	Items []CertificateItem `json:"items"`
	Total int64             `json:"total"`
	Page  int               `json:"page"`
	Size  int               `json:"size"`
}

CertificatesListResponse is the response with certificates list

type CheckAllRequest

type CheckAllRequest = CertificateCheckAllRequest

type CheckAllResponse

type CheckAllResponse = CertificateCheckAllResponse

type CheckRequest

type CheckRequest = CertificateCheckRequest

type CheckResponse

type CheckResponse = CertificateCheckResponse

type DeleteRequest

type DeleteRequest = CertificateDeleteRequest

type DomainInfoRequest

type DomainInfoRequest = CertificateDomainInfoRequest

type DomainInfoResponse

type DomainInfoResponse = CertificateDomainInfoResponse

type ExpiringRequest

type ExpiringRequest = CertificateExpiringRequest

type ExpiringResponse

type ExpiringResponse = CertificateExpiringResponse

type GetRequest

type GetRequest = CertificateDetailRequest

type GetResponse

type GetResponse = CertificateDetailResponse

type Handler

type Handler struct {
	// contains filtered or unexported fields
}

func NewHandler

func NewHandler(service *Service) *Handler

func (*Handler) Add

func (h *Handler) Add(c *gin.Context)

Add handles the request to add a certificate

func (*Handler) AddAlert

func (h *Handler) AddAlert(c *gin.Context)

AddAlert handles the request to add a certificate alert

func (*Handler) AlertsList

func (h *Handler) AlertsList(c *gin.Context)

func (*Handler) Check

func (h *Handler) Check(c *gin.Context)

Check handles the request to check a certificate

func (*Handler) CheckAll

func (h *Handler) CheckAll(c *gin.Context)

CheckAll handles the request to check all certificates

func (*Handler) Delete

func (h *Handler) Delete(c *gin.Context)

Delete handles the request to delete a certificate

func (*Handler) DomainInfo

func (h *Handler) DomainInfo(c *gin.Context)

func (*Handler) Expiring

func (h *Handler) Expiring(c *gin.Context)

func (*Handler) Get

func (h *Handler) Get(c *gin.Context)

Get handles the request to get certificate details

func (*Handler) GetDomainInfo

func (h *Handler) GetDomainInfo(c *gin.Context)

GetDomainInfo handles the request to get domain certificate info

func (*Handler) GetExpiring

func (h *Handler) GetExpiring(c *gin.Context)

GetExpiring handles the request to get expiring certificates

func (*Handler) List

func (h *Handler) List(c *gin.Context)

List handles the request to list certificates

func (*Handler) ListAlerts

func (h *Handler) ListAlerts(c *gin.Context)

ListAlerts handles the request to list certificate alerts

func (*Handler) Stats

func (h *Handler) Stats(c *gin.Context)

Stats handles the request to get certificate statistics

type ListAlertsRequest

type ListAlertsRequest = CertificateAlertsListRequest

type ListAlertsResponse

type ListAlertsResponse = CertificateAlertsListResponse

type ListRequest

type ListRequest = CertificatesListRequest

Type aliases for backward compatibility

type ListResponse

type ListResponse = CertificatesListResponse

type Service

type Service struct {
	// contains filtered or unexported fields
}

func NewService

func NewService(svcCtx *svc.ServiceContext) *Service

func (*Service) Add

func (s *Service) Add(ctx context.Context, req *AddRequest) (*AddResponse, error)

Add adds a new certificate

func (*Service) AddAlert

func (s *Service) AddAlert(ctx context.Context, req *AddAlertRequest) (*AddAlertResponse, error)

AddAlert adds a certificate alert

func (*Service) Check

func (s *Service) Check(ctx context.Context, req *CheckRequest) (*CheckResponse, error)

Check checks certificate status

func (*Service) CheckAll

func (s *Service) CheckAll(ctx context.Context) (*CheckAllResponse, error)

CheckAll checks all certificates

func (*Service) Delete

func (s *Service) Delete(ctx context.Context, req *DeleteRequest) error

Delete deletes a certificate

func (*Service) Get

func (s *Service) Get(ctx context.Context, req *GetRequest) (*GetResponse, error)

Get returns certificate details

func (*Service) GetDomainInfo

func (s *Service) GetDomainInfo(ctx context.Context, req *DomainInfoRequest) (*DomainInfoResponse, error)

GetDomainInfo returns certificate info for a domain

func (*Service) GetExpiring

func (s *Service) GetExpiring(ctx context.Context, req *ExpiringRequest) (*ExpiringResponse, error)

GetExpiring returns certificates expiring within specified days

func (*Service) List

func (s *Service) List(ctx context.Context, req *ListRequest) (*ListResponse, error)

List returns a list of certificates

func (*Service) ListAlerts

func (s *Service) ListAlerts(ctx context.Context, req *ListAlertsRequest) (*ListAlertsResponse, error)

ListAlerts returns a list of certificate alerts

func (*Service) Stats

func (s *Service) Stats(ctx context.Context) (*StatsResponse, error)

Stats returns certificate statistics

type StatsRequest

type StatsRequest = CertificateStatsRequest

type StatsResponse

type StatsResponse = CertificateStatsResponse

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL