ncmapi

package
v0.0.0-...-63b898f Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2025 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CAsPath = "/v1/cas"
	CSRPath = "/v1/requests"
)

Variables

This section is empty.

Functions

func GetPathFromCertHref

func GetPathFromCertHref(certHref string) (string, error)

Types

type APIError

type APIError struct {
	Message       string `json:"message,omitempty"`
	Status        int    `json:"status"`
	StatusMessage string `json:"statusMessage"`
}

func (*APIError) Error

func (a *APIError) Error() string

type CAResponse

type CAResponse struct {
	Href         string            `json:"href"`
	Name         string            `json:"name"`
	Description  string            `json:"description,omitempty"`
	Status       string            `json:"status"`
	Type         string            `json:"type,omitempty"`
	Certificates map[string]string `json:"certificates"`
}

type CAsResponse

type CAsResponse struct {
	TotalCount int          `json:"totalCount"`
	Href       string       `json:"href"`
	CAList     []CAResponse `json:"cas"`
}

type CSRResponse

type CSRResponse struct {
	Href              string `json:"href"`
	Issuer            string `json:"issuer"`
	Certificate       string `json:"certificate"`
	CertificateBase64 string `json:"certificateBase64"`
}

type CSRStatusResponse

type CSRStatusResponse struct {
	Href        string `json:"href"`
	Issuer      string `json:"issuer"`
	Certificate string `json:"certificate"`
	Status      string `json:"status"`
}

type CertificateDownloadResponse

type CertificateDownloadResponse struct {
	Href              string       `json:"href"`
	Request           string       `json:"request"`
	IssuerCA          string       `json:"issuerCa"`
	IssuedTime        *metav1.Time `json:"issuedTime,omitempty"`
	Type              string       `json:"type"`
	Status            string       `json:"status"`
	CertificateBase64 string       `json:"certificateBase64"`
}

type Client

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

Client is a client used to communicate with the NCM API.

func NewClient

func NewClient(cfg *cfg.NCMConfig, log logr.Logger) (*Client, error)

NewClient creates a new client used to perform requests to the NCM API.

func (*Client) CheckCSRStatus

func (c *Client) CheckCSRStatus(path string) (*CSRStatusResponse, error)

func (*Client) DownloadCertificate

func (c *Client) DownloadCertificate(path string) (*CertificateDownloadResponse, error)

func (*Client) DownloadCertificateInPEM

func (c *Client) DownloadCertificateInPEM(path string) ([]byte, error)

func (*Client) GetCA

func (c *Client) GetCA(path string) (*CAResponse, error)

func (*Client) GetCAs

func (c *Client) GetCAs() (*CAsResponse, error)

func (*Client) RenewCertificate

func (c *Client) RenewCertificate(path string, duration *metav1.Duration, profileID string) (*RenewCertificateResponse, error)

func (*Client) SendCSR

func (c *Client) SendCSR(pem []byte, CA *CAResponse, duration *metav1.Duration, profileID string) (*CSRResponse, error)

func (*Client) StartHealthChecker

func (c *Client) StartHealthChecker(interval time.Duration)

func (*Client) StopHealthChecker

func (c *Client) StopHealthChecker()

type ClientError

type ClientError struct {
	Reason       string
	ErrorMessage error
}

func (*ClientError) Error

func (c *ClientError) Error() string

type ExternalClient

type ExternalClient interface {
	GetCAs() (*CAsResponse, error)
	GetCA(path string) (*CAResponse, error)
	SendCSR(pem []byte, CA *CAResponse, duration *metav1.Duration, profileID string) (*CSRResponse, error)
	CheckCSRStatus(path string) (*CSRStatusResponse, error)
	DownloadCertificate(path string) (*CertificateDownloadResponse, error)
	DownloadCertificateInPEM(path string) ([]byte, error)
	RenewCertificate(path string, duration *metav1.Duration, profileID string) (*RenewCertificateResponse, error)
	StartHealthChecker(interval time.Duration)
	StopHealthChecker()
}

type RenewCertificateResponse

type RenewCertificateResponse struct {
	Result      string `json:"result"`
	Request     string `json:"request,omitempty"`
	Certificate string `json:"certificate"`
}

type ServerURL

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

ServerURL is used to store NCM API url and health status.

func NewServerURL

func NewServerURL(url string) *ServerURL

Jump to

Keyboard shortcuts

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