Documentation
¶
Index ¶
Constants ¶
const ( ERR_OK = 0 ERR_BAD_REQUEST = 1 ERR_NO_ACTION_REQUESTED = 2 ERR_CLASS_DOES_NOT_EXIST = 3 ERR_AUTHENTICATION_FAILED = 4 ERR_OBJECT_NOT_FOUND = 5 ERR_REQUIRED_PROPERTY_MISSING = 6 ERR_INVALID_PROPERTY = 7 ERR_DATA_VALIDATION_FAILED = 8 ERR_METHOD_NOT_IMPLEMENTED = 9 ERR_TOO_MANY_BATCHED_REQUESTS = 10 ERR_REQUEST_INVALID_JSON = 11 ERR_BATCH_TIMED_OUT = 12 ERR_PERMISSION_DENIED = 13 ERR_API_RATE_LIMIT_EXCEEDED = 14 ERR_CREDIT_CARD_CHARGE_FAILED = 30 ERR_CREDIT_CARD_EXPIRED = 31 ERR_LINODES_PER_HOUR_LIMIT_EXCEEDED = 40 ERR_LINODE_STILL_HAS_DISKS = 41 )
const (
// ApiEndpoint is the base URL for the Linode API endpoint.
ApiEndpoint = "https://api.linode.com/"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Action ¶
type Action struct {
// contains filtered or unexported fields
}
Action represents an action to be performed.
type Error ¶
type Error struct { Err error // contains filtered or unexported fields }
Error represents an error, either API related or not.
func NewApiError ¶
NewApiError returns an instance of Error which represents an API error.
func (*Error) IsApiError ¶
IsApiError returns true if the error is an API error, or false otherwise.
type Linode ¶
type Linode struct {
// contains filtered or unexported fields
}
Linode represents the interface to the Linode API.
func (*Linode) Batch ¶
func (l *Linode) Batch(action string, params Parameters, result interface{})
Batch adds a new action to the batch request to be performed.
func (*Linode) Request ¶
func (l *Linode) Request(action string, params Parameters, result interface{}) (*Response, error)
Request performs a single API operation and returns the full response.
func (*Linode) SetEndpoint ¶
SetEndpoint sets the endpoint that all API requests will be sent to. This should only be used for testing/debugging purposes!
type Parameters ¶
Parameters represents the parameters that are passed for an API call.
func (Parameters) Del ¶
func (p Parameters) Del(key string)
Del deletes the parameter associated with key.
func (Parameters) Encode ¶
func (p Parameters) Encode() string
Encode encodes the parameters into "URL encoded" form ("bar=baz&foo=quux") sorted by key.
func (Parameters) Get ¶
func (p Parameters) Get(key string) string
Get gets the parameter associated with the given key. If no parameter is associated with the key, Get returns the empty string.
func (Parameters) Set ¶
func (p Parameters) Set(key, value string)
Set sets the key to value. It replaces any existing value.
type Response ¶
type Response struct { Action string `json:"ACTION"` RawData json.RawMessage `json:"DATA"` Errors []ResponseError `json:"ERRORARRAY"` Data interface{} `json:"-"` }
Response represents the response to an API call. Data is defined as an interface, because each API call will return a different response. It is the user's responsibility to turn it into something useful.
type ResponseError ¶
ResponseError represents an error returned by an API call.