service

package
v0.2.5 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2022 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Service

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

Service is the struct used for every request

func NewAsClient

func NewAsClient(client *client.Client, version string) *Service

NewAsClient creates a Server instance that requires a remote server to operate

func NewAsServer

func NewAsServer(store store.Store, version string) *Service

NewAsServer creates a Service instance that handles the store directly

func (*Service) CACreate

func (s *Service) CACreate(ctx context.Context, request client.APICertificateRequest) (string, []byte, []byte, error)

CACreate is responsible of create a new CA struct with its certificate returning its information

func (*Service) CAGet

func (s *Service) CAGet(collection string) (*manager.CA, error)

CAGet creates a new CA struct from the collection ID

func (*Service) CertificateDelete

func (s *Service) CertificateDelete(ctx context.Context, collection, cn string) (ok bool, err error)

CertificateDelete removes the certificate from the store

func (*Service) CertificateGet

func (s *Service) CertificateGet(ctx context.Context, collection, id string, remaining int) (client.Certificate, error)

CertificateGet returns the certificate and its key information

func (*Service) CertificateList

func (s *Service) CertificateList(ctx context.Context, collection string) (certificates map[string]client.Certificate, err error)

CertificateList returns an array of certificates and its x509 representation

func (*Service) CertificateSet

func (s *Service) CertificateSet(ctx context.Context, collection string, request client.APICertificateRequest) ([]byte, []byte, []byte, error)

CertificateSet creates a new certificate and stores in the store (if server) or POST to the API

func (*Service) Close

func (s *Service) Close() error

Close the store service in a proper way

func (*Service) IsNearToExpire

func (s *Service) IsNearToExpire(certificate client.Certificate, percent int) bool

IsNearToExpire returns true if certificate is already expired or remaining days are less than (percent/100)

func (*Service) Server added in v0.2.0

func (s *Service) Server() bool

Server returns true when the library is used as server,

func (*Service) Status

func (s *Service) Status() (status client.APIStatus, err error)

Status returns the status for the service. If used as server it will return ok For client request, an API call will be done to ensure availability

Jump to

Keyboard shortcuts

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