cfapi

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2021 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIError

type APIError struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
}

func (*APIError) Error

func (a *APIError) Error() string

type APIResponse

type APIResponse struct {
	Success  bool            `json:"success"`
	Errors   []APIError      `json:"errors"`
	Messages []string        `json:"messages"`
	Result   json.RawMessage `json:"result"`
}

type Client

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

func New

func New(serviceKey []byte, options ...Options) *Client

func (*Client) Sign

func (c *Client) Sign(ctx context.Context, req *SignRequest) (*SignResponse, error)

type Factory

type Factory interface {
	APIWith([]byte) (Interface, error)
}

type FactoryFunc

type FactoryFunc func([]byte) (Interface, error)

func (FactoryFunc) APIWith

func (f FactoryFunc) APIWith(serviceKey []byte) (Interface, error)

type Interface

type Interface interface {
	Sign(context.Context, *SignRequest) (*SignResponse, error)
}

type Options

type Options func(c *Client)

func WithClient

func WithClient(client *http.Client) Options

func WithEndpoint added in v0.6.1

func WithEndpoint(endpoint string) (Options, error)

type SignRequest

type SignRequest struct {
	Hostnames []string `json:"hostnames"`
	Validity  int      `json:"requested_validity"`
	Type      string   `json:"request_type"`
	CSR       string   `json:"csr"`
}

type SignResponse

type SignResponse struct {
	Id          string    `json:"id"`
	Certificate string    `json:"certificate"`
	Hostnames   []string  `json:"hostnames"`
	Expiration  time.Time `json:"expires_on"`
	Type        string    `json:"request_type"`
	Validity    int       `json:"requested_validity"`
	CSR         string    `json:"csr"`
}

func (*SignResponse) UnmarshalJSON added in v0.5.1

func (r *SignResponse) UnmarshalJSON(p []byte) error

adapted from http://choly.ca/post/go-json-marshalling/

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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