creator

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2020 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Endpoint is the API endpoint of the service this client action interacts
	// with.
	Endpoint = "/v1/clusters/%s/key-pairs/"
	// Name is the service name being implemented. This can be used for e.g.
	// logging.
	Name = "keypair/creator"
)

Variables

This section is empty.

Functions

func IsInvalidConfig

func IsInvalidConfig(err error) bool

IsInvalidConfig asserts invalidConfigError.

func IsInvalidRequest

func IsInvalidRequest(err error) bool

IsInvalidRequest asserts invalidRequestError.

func IsServiceUnavailable added in v0.2.1

func IsServiceUnavailable(err error) bool

IsServiceUnavailable asserts serviceUnavailableError.

Types

type Config

type Config struct {
	Logger     micrologger.Logger
	RestClient *resty.Client

	URL *url.URL
}

Config represents the configuration used to create a creator service.

func DefaultConfig

func DefaultConfig() Config

DefaultConfig provides a default configuration to create a new creator service by best effort.

type Request

type Request struct {
	Cluster *config.Cluster `json:"cluster"`
	KeyPair *config.KeyPair `json:"key_pair"`
}

Request is the configuration for the service action.

func DefaultRequest

func DefaultRequest() Request

DefaultRequest provides a default request by best effort.

type Response

type Response struct {
	CertificateAuthorityData string    `json:"certificate_authority_data"`
	ClientCertificateData    string    `json:"client_certificate_data"`
	ClientKeyData            string    `json:"client_key_data"`
	CreateDate               time.Time `json:"create_date"`
	Description              string    `json:"description"`
	SerialNumber             string    `json:"serial_number"`
	TTL                      int       `json:"ttl"`
}

Response is the return value of the service action.

func DefaultResponse

func DefaultResponse() *Response

DefaultResponse provides a default response by best effort.

type Service

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

func New

func New(config Config) (*Service, error)

New creates a new configured creator service.

func (*Service) Create

func (s *Service) Create(ctx context.Context, request Request) (*Response, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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