Documentation ¶
Overview ¶
Package api implements an interface to the Auklet backend API.
Index ¶
Constants ¶
const ( ReleasesEP = "/private/releases/" CertificatesEP = "/private/devices/certificates/" DevicesEP = "/private/devices/" ConfigEP = "/private/devices/config/" DataLimitEP = "/private/devices/%s/app_config/" // app id )
namespaces and endpoints for the API. All new endpoints should be entered here.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type API ¶
type API struct { // BaseURL is the subdomain against which requests will be performed. It // should not assume any particular namespace. BaseURL string Key string AppID string MacHash string // for credentials CredsPath string // where to save/load credentials Fs Fs // filesystem for saving/loading ReleasesEP string CertificatesEP string DevicesEP string ConfigEP string DataLimitEP string }
API provides an interface to the backend.
func (API) BrokerAddress ¶
BrokerAddress returns an address to which we can send broker messages.
func (API) Certificates ¶
Certificates retrieves CA certs.
func (API) Credentials ¶
func (a API) Credentials() (*Credentials, error)
Credentials retrieves credentials from the filesystem, with a fallback to the API. If credentials are retrieved from the API, they are saved to the filesystem.
type CellularConfig ¶
CellularConfig holds parameters for a cellular plan.
type Credentialer ¶
type Credentialer interface {
Credentials() (*Credentials, error)
}
Credentialer provides a way to get Credentials.
type Credentials ¶
type Credentials struct { Username string `json:"id"` Password string `json:"client_password"` Org string `json:"organization"` ClientID string `json:"client_id"` }
Credentials represents credentials required for sending broker messages.
type DataLimit ¶
type DataLimit struct { Storage *int64 EmissionPeriod int Cellular CellularConfig }
DataLimit holds parameters controlling Auklet's data usage.