cfapi

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2024 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"`
	RayID   string `json:"-"`
}

func (*APIError) Error

func (a *APIError) Error() string

func (*APIError) Is added in v0.10.0

func (a *APIError) Is(target error) bool

type APIResponse

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

type Builder added in v0.10.0

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

func NewBuilder added in v0.10.0

func NewBuilder() *Builder

func (*Builder) Build added in v0.10.0

func (b *Builder) Build() *Client

func (*Builder) Clone added in v0.10.0

func (b *Builder) Clone() *Builder

func (*Builder) WithClient added in v0.10.0

func (b *Builder) WithClient(hc *http.Client) *Builder

func (*Builder) WithServiceKey added in v0.10.0

func (b *Builder) WithServiceKey(key []byte) *Builder

func (*Builder) WithToken added in v0.10.0

func (b *Builder) WithToken(token []byte) *Builder

type Client

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

func New

func New(options ...Options) *Client

func (*Client) Sign

func (c *Client) Sign(ctx context.Context, req *SignRequest) (*SignResponse, 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)

func WithServiceKey added in v0.10.0

func WithServiceKey(key []byte) Options

func WithToken added in v0.10.0

func WithToken(token []byte) Options

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/

Jump to

Keyboard shortcuts

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