api

package
v0.0.0-...-bbdb812 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2019 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

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

API represents the CDN API ojbect

func NewAPI

func NewAPI(conf Conf, cache cache.Cache) (*API, error)

NewAPI returns a new API object

func (*API) Shutdown

func (a *API) Shutdown(ctx context.Context) error

Shutdown terminates the API server in a clean way

func (*API) Start

func (a *API) Start() error

Start starts the API server

type Conf

type Conf struct {
	Address  string `yaml:"address"`
	Port     int    `yaml:"port"`
	CertFile string `yaml:"cert"`
	KeyFile  string `yaml:"key"`
}

Conf is the configuration for the API endpoint used to purge entries from the cache

func DefaultConf

func DefaultConf() Conf

DefaultConf returns an API configuration with some defaults

func (Conf) IsValid

func (c Conf) IsValid() (bool, string)

IsValid checks the validity of the API configuration

type PurgeRequest

type PurgeRequest struct {
	Resource string `json:"resource"`
}

PurgeRequest is used to receive a call to purge an item from the cache

type Response

type Response struct {
	Message string `json:"message"`
}

Response is used to json encode the API response

Jump to

Keyboard shortcuts

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