api

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2021 License: MPL-2.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Client errors
	ErrInvalidCSR       = errors.New("unable to parse CSR, is invalid") //400
	ErrInvalidID        = errors.New("invalid CSR ID, does not exist")  //404
	ErrInvalidIDFormat  = errors.New("invalid ID format")
	ErrInvalidApprobeOp = errors.New("invalid operation, only pending status CSRs can be approved")          //400
	ErrInvalidRevokeOp  = errors.New("invalid operation, only approved status CSRs can be revoked")          //400
	ErrInvalidDenyOp    = errors.New("invalid operation, only pending status CSRs can be denied")            //400
	ErrInvalidDeleteOp  = errors.New("invalid operation, only denied or revoked status CSRs can be deleted") //400
	ErrIncorrectType    = errors.New("unsupported media type")                                               //415
	ErrEmptyBody        = errors.New("empty body")

	//Server errors
	ErrInvalidOperation = errors.New("invalid operation")
	ErrInsertCSR        = errors.New("unable to insert CSR")
	ErrInsertCert       = errors.New("unable to insert certificate")
	ErrGetCSR           = errors.New("unable to get CSR")
	ErrGetCert          = errors.New("unable to get certificate")
	ErrUpdateCSR        = errors.New("unable to update CSR")
	ErrDeleteCSR        = errors.New("unable to delete CSR")
	ErrSignCSR          = errors.New("unable to sign CSR")
	ErrRevokeCert       = errors.New("unable to revoke certificate")
	ErrResponseEncode   = errors.New("error encoding response")
)

Functions

func MakeDeleteCSREndpoint

func MakeDeleteCSREndpoint(s Service) endpoint.Endpoint

func MakeGetCTREndpoint

func MakeGetCTREndpoint(s Service) endpoint.Endpoint

func MakeGetPendingCSRDBEndpoint

func MakeGetPendingCSRDBEndpoint(s Service) endpoint.Endpoint

func MakeGetPendingCSRFileEndpoint

func MakeGetPendingCSRFileEndpoint(s Service) endpoint.Endpoint

func MakeGetPendingCSRsEndpoint

func MakeGetPendingCSRsEndpoint(s Service) endpoint.Endpoint

func MakeHTTPHandler

func MakeHTTPHandler(s Service, logger log.Logger, auth auth.Auth, otTracer stdopentracing.Tracer) http.Handler

func MakeHealthEndpoint

func MakeHealthEndpoint(s Service) endpoint.Endpoint

func MakePostCSREndpoint

func MakePostCSREndpoint(s Service) endpoint.Endpoint

func MakePutChangeCSRStatusEndpoint

func MakePutChangeCSRStatusEndpoint(s Service) endpoint.Endpoint

Types

type Endpoints

type Endpoints struct {
	HealthEndpoint             endpoint.Endpoint
	PostCSREndpoint            endpoint.Endpoint
	GetPendingCSRsEndpoint     endpoint.Endpoint
	GetPendingCSRDBEndpoint    endpoint.Endpoint
	GetPendingCSRFileEndpoint  endpoint.Endpoint
	PutChangeCSRStatusEndpoint endpoint.Endpoint
	DeleteCSREndpoint          endpoint.Endpoint
	GetCRTEndpoint             endpoint.Endpoint
}

func MakeServerEndpoints

func MakeServerEndpoints(s Service, otTracer stdopentracing.Tracer) Endpoints

type Middleware

type Middleware func(Service) Service

func LoggingMiddleware

func LoggingMiddleware(logger log.Logger) Middleware

func NewInstrumentingMiddleware

func NewInstrumentingMiddleware(counter metrics.Counter, latency metrics.Histogram) Middleware

type Service

type Service interface {
	Health(ctx context.Context) bool
	PostCSR(ctx context.Context, data []byte) (csrmodel.CSR, error)
	GetPendingCSRs(ctx context.Context) csrmodel.CSRs
	GetPendingCSRDB(ctx context.Context, id int) (csrmodel.CSR, error)
	GetPendingCSRFile(ctx context.Context, id int) ([]byte, error)
	PutChangeCSRStatus(ctx context.Context, csr csrmodel.CSR, id int) (csrmodel.CSR, error)
	DeleteCSR(ctx context.Context, id int) error
	GetCRT(ctx context.Context, id int) ([]byte, error)
}

func NewEnrollerService

func NewEnrollerService(csrDBStore csrstore.DB, csrFileStore csrstore.File, certsDBStore certstore.DB, certsFileStore certstore.File, secrets secrets.Secrets, homePath string) Service

Jump to

Keyboard shortcuts

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