Documentation ¶
Overview ¶
Package godo is the DigtalOcean API v2 client for Go
Index ¶
- Constants
- func Bool(v bool) *bool
- func CheckResponse(r *http.Response) error
- func Int(v int) *int
- func StreamToString(stream io.Reader) string
- func String(v string) *string
- func Stringify(message interface{}) string
- type Account
- type AccountService
- type AccountServiceOp
- type Action
- type ActionRequest
- type ActionsService
- type ActionsServiceOp
- type ArgError
- type Client
- type Domain
- type DomainCreateRequest
- type DomainRecord
- type DomainRecordEditRequest
- type DomainsService
- type DomainsServiceOp
- func (s *DomainsServiceOp) Create(createRequest *DomainCreateRequest) (*Domain, *Response, error)
- func (s *DomainsServiceOp) CreateRecord(domain string, createRequest *DomainRecordEditRequest) (*DomainRecord, *Response, error)
- func (s *DomainsServiceOp) Delete(name string) (*Response, error)
- func (s *DomainsServiceOp) DeleteRecord(domain string, id int) (*Response, error)
- func (s *DomainsServiceOp) EditRecord(domain string, id int, editRequest *DomainRecordEditRequest) (*DomainRecord, *Response, error)
- func (s *DomainsServiceOp) Get(name string) (*Domain, *Response, error)
- func (s DomainsServiceOp) List(opt *ListOptions) ([]Domain, *Response, error)
- func (s *DomainsServiceOp) Record(domain string, id int) (*DomainRecord, *Response, error)
- func (s *DomainsServiceOp) Records(domain string, opt *ListOptions) ([]DomainRecord, *Response, error)
- type Droplet
- type DropletActionsService
- type DropletActionsServiceOp
- func (s *DropletActionsServiceOp) ChangeKernel(id, kernelID int) (*Action, *Response, error)
- func (s *DropletActionsServiceOp) DisableBackups(id int) (*Action, *Response, error)
- func (s *DropletActionsServiceOp) EnableIPv6(id int) (*Action, *Response, error)
- func (s *DropletActionsServiceOp) EnablePrivateNetworking(id int) (*Action, *Response, error)
- func (s *DropletActionsServiceOp) Get(dropletID, actionID int) (*Action, *Response, error)
- func (s *DropletActionsServiceOp) GetByURI(rawurl string) (*Action, *Response, error)
- func (s *DropletActionsServiceOp) PasswordReset(id int) (*Action, *Response, error)
- func (s *DropletActionsServiceOp) PowerCycle(id int) (*Action, *Response, error)
- func (s *DropletActionsServiceOp) PowerOff(id int) (*Action, *Response, error)
- func (s *DropletActionsServiceOp) PowerOn(id int) (*Action, *Response, error)
- func (s *DropletActionsServiceOp) Reboot(id int) (*Action, *Response, error)
- func (s *DropletActionsServiceOp) RebuildByImageID(id, imageID int) (*Action, *Response, error)
- func (s *DropletActionsServiceOp) RebuildByImageSlug(id int, slug string) (*Action, *Response, error)
- func (s *DropletActionsServiceOp) Rename(id int, name string) (*Action, *Response, error)
- func (s *DropletActionsServiceOp) Resize(id int, sizeSlug string, resizeDisk bool) (*Action, *Response, error)
- func (s *DropletActionsServiceOp) Restore(id, imageID int) (*Action, *Response, error)
- func (s *DropletActionsServiceOp) Shutdown(id int) (*Action, *Response, error)
- func (s *DropletActionsServiceOp) Snapshot(id int, name string) (*Action, *Response, error)
- func (s *DropletActionsServiceOp) Upgrade(id int) (*Action, *Response, error)
- type DropletCreateImage
- type DropletCreateRequest
- type DropletCreateSSHKey
- type DropletsService
- type DropletsServiceOp
- func (s *DropletsServiceOp) Actions(dropletID int, opt *ListOptions) ([]Action, *Response, error)
- func (s *DropletsServiceOp) Backups(dropletID int, opt *ListOptions) ([]Image, *Response, error)
- func (s *DropletsServiceOp) Create(createRequest *DropletCreateRequest) (*Droplet, *Response, error)
- func (s *DropletsServiceOp) Delete(dropletID int) (*Response, error)
- func (s *DropletsServiceOp) Get(dropletID int) (*Droplet, *Response, error)
- func (s *DropletsServiceOp) Kernels(dropletID int, opt *ListOptions) ([]Kernel, *Response, error)
- func (s *DropletsServiceOp) List(opt *ListOptions) ([]Droplet, *Response, error)
- func (s *DropletsServiceOp) Neighbors(dropletID int) ([]Droplet, *Response, error)
- func (s *DropletsServiceOp) Snapshots(dropletID int, opt *ListOptions) ([]Image, *Response, error)
- type ErrorResponse
- type FloatingIP
- type FloatingIPActionsService
- type FloatingIPActionsServiceOp
- type FloatingIPCreateRequest
- type FloatingIPsService
- type FloatingIPsServiceOp
- func (f *FloatingIPsServiceOp) Create(createRequest *FloatingIPCreateRequest) (*FloatingIP, *Response, error)
- func (f *FloatingIPsServiceOp) Delete(ip string) (*Response, error)
- func (f *FloatingIPsServiceOp) Get(ip string) (*FloatingIP, *Response, error)
- func (f *FloatingIPsServiceOp) List(opt *ListOptions) ([]FloatingIP, *Response, error)
- type Image
- type ImageActionsService
- type ImageActionsServiceOp
- type ImageUpdateRequest
- type ImagesService
- type ImagesServiceOp
- func (s *ImagesServiceOp) Delete(imageID int) (*Response, error)
- func (s *ImagesServiceOp) GetByID(imageID int) (*Image, *Response, error)
- func (s *ImagesServiceOp) GetBySlug(slug string) (*Image, *Response, error)
- func (s *ImagesServiceOp) List(opt *ListOptions) ([]Image, *Response, error)
- func (s *ImagesServiceOp) ListApplication(opt *ListOptions) ([]Image, *Response, error)
- func (s *ImagesServiceOp) ListDistribution(opt *ListOptions) ([]Image, *Response, error)
- func (s *ImagesServiceOp) ListUser(opt *ListOptions) ([]Image, *Response, error)
- func (s *ImagesServiceOp) Update(imageID int, updateRequest *ImageUpdateRequest) (*Image, *Response, error)
- type Kernel
- type Key
- type KeyCreateRequest
- type KeyUpdateRequest
- type KeysService
- type KeysServiceOp
- func (s *KeysServiceOp) Create(createRequest *KeyCreateRequest) (*Key, *Response, error)
- func (s *KeysServiceOp) DeleteByFingerprint(fingerprint string) (*Response, error)
- func (s *KeysServiceOp) DeleteByID(keyID int) (*Response, error)
- func (s *KeysServiceOp) GetByFingerprint(fingerprint string) (*Key, *Response, error)
- func (s *KeysServiceOp) GetByID(keyID int) (*Key, *Response, error)
- func (s *KeysServiceOp) List(opt *ListOptions) ([]Key, *Response, error)
- func (s *KeysServiceOp) UpdateByFingerprint(fingerprint string, updateRequest *KeyUpdateRequest) (*Key, *Response, error)
- func (s *KeysServiceOp) UpdateByID(keyID int, updateRequest *KeyUpdateRequest) (*Key, *Response, error)
- type LinkAction
- type Links
- type ListOptions
- type NetworkV4
- type NetworkV6
- type Networks
- type Pages
- type Rate
- type Region
- type RegionsService
- type RegionsServiceOp
- type RequestCompletionCallback
- type Response
- type Size
- type SizesService
- type SizesServiceOp
- type Timestamp
Constants ¶
const ( // ActionInProgress is an in progress action status ActionInProgress = "in-progress" //ActionCompleted is a completed action status ActionCompleted = "completed" )
Variables ¶
This section is empty.
Functions ¶
func Bool ¶
Bool is a helper routine that allocates a new bool value to store v and returns a pointer to it.
func CheckResponse ¶
CheckResponse checks the API response for errors, and returns them if present. A response is considered an error if it has a status code outside the 200 range. API error responses are expected to have either no response body, or a JSON response body that maps to ErrorResponse. Any other response body will be silently ignored.
func Int ¶
Int is a helper routine that allocates a new int32 value to store v and returns a pointer to it, but unlike Int32 its argument value is an int.
func StreamToString ¶
StreamToString converts a reader to a string
Types ¶
type Account ¶
type Account struct { DropletLimit int `json:"droplet_limit,omitempty"` Email string `json:"email,omitempty"` UUID string `json:"uuid,omitempty"` EmailVerified bool `json:"email_verified,omitempty"` Status string `json:"status,omitempty"` StatusMessage string `json:"status_message,omitempty"` }
Account represents a DigitalOcean Account
type AccountService ¶
AccountService is an interface for interfacing with the Account endpoints of the DigitalOcean API See: https://developers.digitalocean.com/documentation/v2/#account
type AccountServiceOp ¶
type AccountServiceOp struct {
// contains filtered or unexported fields
}
AccountServiceOp handles communication with the Account related methods of the DigitalOcean API.
type Action ¶
type Action struct { ID int `json:"id"` Status string `json:"status"` Type string `json:"type"` StartedAt *Timestamp `json:"started_at"` CompletedAt *Timestamp `json:"completed_at"` ResourceID int `json:"resource_id"` ResourceType string `json:"resource_type"` Region *Region `json:"region,omitempty"` RegionSlug string `json:"region_slug,omitempty"` }
Action represents a DigitalOcean Action
type ActionRequest ¶
type ActionRequest map[string]interface{}
ActionRequest reprents DigitalOcean Action Request
type ActionsService ¶
type ActionsService interface { List(*ListOptions) ([]Action, *Response, error) Get(int) (*Action, *Response, error) }
ActionsService handles communction with action related methods of the DigitalOcean API: https://developers.digitalocean.com/documentation/v2#actions
type ActionsServiceOp ¶
type ActionsServiceOp struct {
// contains filtered or unexported fields
}
ActionsServiceOp handles communition with the image action related methods of the DigitalOcean API.
func (*ActionsServiceOp) Get ¶
func (s *ActionsServiceOp) Get(id int) (*Action, *Response, error)
Get an action by ID.
func (*ActionsServiceOp) List ¶
func (s *ActionsServiceOp) List(opt *ListOptions) ([]Action, *Response, error)
List all actions
type ArgError ¶
type ArgError struct {
// contains filtered or unexported fields
}
ArgError is an error that represents an error with an input to godo. It identifies the argument and the cause (if possible).
func NewArgError ¶
NewArgError creates an InputError.
type Client ¶
type Client struct { // Base URL for API requests. BaseURL *url.URL // User agent for client UserAgent string // Rate contains the current rate limit for the client as determined by the most recent // API call. Rate Rate // Services used for communicating with the API Account AccountService Actions ActionsService Domains DomainsService Droplets DropletsService DropletActions DropletActionsService Images ImagesService ImageActions ImageActionsService Keys KeysService Regions RegionsService Sizes SizesService FloatingIPs FloatingIPsService FloatingIPActions FloatingIPActionsService // contains filtered or unexported fields }
Client manages communication with DigitalOcean V2 API.
func (*Client) Do ¶
Do sends an API request and returns the API response. The API response is JSON decoded and stored in the value pointed to by v, or returned as an error if an API error has occurred. If v implements the io.Writer interface, the raw response will be written to v, without attempting to decode it.
func (*Client) NewRequest ¶
NewRequest creates an API request. A relative URL can be provided in urlStr, which will be resolved to the BaseURL of the Client. Relative URLS should always be specified without a preceding slash. If specified, the value pointed to by body is JSON encoded and included in as the request body.
func (*Client) OnRequestCompleted ¶
func (c *Client) OnRequestCompleted(rc RequestCompletionCallback)
OnRequestCompleted sets the DO API request completion callback
type Domain ¶
type Domain struct { Name string `json:"name"` TTL int `json:"ttl"` ZoneFile string `json:"zone_file"` }
Domain represents a DigitalOcean domain
type DomainCreateRequest ¶
DomainCreateRequest respresents a request to create a domain.
type DomainRecord ¶
type DomainRecord struct { ID int `json:"id,float64,omitempty"` Type string `json:"type,omitempty"` Name string `json:"name,omitempty"` Data string `json:"data,omitempty"` Priority int `json:"priority,omitempty"` Port int `json:"port,omitempty"` Weight int `json:"weight,omitempty"` }
DomainRecord represents a DigitalOcean DomainRecord
func (DomainRecord) String ¶
func (d DomainRecord) String() string
Converts a DomainRecord to a string.
type DomainRecordEditRequest ¶
type DomainRecordEditRequest struct { Type string `json:"type,omitempty"` Name string `json:"name,omitempty"` Data string `json:"data,omitempty"` Priority int `json:"priority,omitempty"` Port int `json:"port,omitempty"` Weight int `json:"weight,omitempty"` }
DomainRecordEditRequest represents a request to update a domain record.
func (DomainRecordEditRequest) String ¶
func (d DomainRecordEditRequest) String() string
Converts a DomainRecordEditRequest to a string.
type DomainsService ¶
type DomainsService interface { List(*ListOptions) ([]Domain, *Response, error) Get(string) (*Domain, *Response, error) Create(*DomainCreateRequest) (*Domain, *Response, error) Delete(string) (*Response, error) Records(string, *ListOptions) ([]DomainRecord, *Response, error) Record(string, int) (*DomainRecord, *Response, error) DeleteRecord(string, int) (*Response, error) EditRecord(string, int, *DomainRecordEditRequest) (*DomainRecord, *Response, error) CreateRecord(string, *DomainRecordEditRequest) (*DomainRecord, *Response, error) }
DomainsService is an interface for managing DNS with the DigitalOcean API. See: https://developers.digitalocean.com/documentation/v2#domains and https://developers.digitalocean.com/documentation/v2#domain-records
type DomainsServiceOp ¶
type DomainsServiceOp struct {
// contains filtered or unexported fields
}
DomainsServiceOp handles communication with the domain related methods of the DigitalOcean API.
func (*DomainsServiceOp) Create ¶
func (s *DomainsServiceOp) Create(createRequest *DomainCreateRequest) (*Domain, *Response, error)
Create a new domain
func (*DomainsServiceOp) CreateRecord ¶
func (s *DomainsServiceOp) CreateRecord( domain string, createRequest *DomainRecordEditRequest) (*DomainRecord, *Response, error)
CreateRecord creates a record using a DomainRecordEditRequest
func (*DomainsServiceOp) Delete ¶
func (s *DomainsServiceOp) Delete(name string) (*Response, error)
Delete domain
func (*DomainsServiceOp) DeleteRecord ¶
func (s *DomainsServiceOp) DeleteRecord(domain string, id int) (*Response, error)
DeleteRecord deletes a record from a domain identified by id
func (*DomainsServiceOp) EditRecord ¶
func (s *DomainsServiceOp) EditRecord( domain string, id int, editRequest *DomainRecordEditRequest, ) (*DomainRecord, *Response, error)
EditRecord edits a record using a DomainRecordEditRequest
func (*DomainsServiceOp) Get ¶
func (s *DomainsServiceOp) Get(name string) (*Domain, *Response, error)
Get individual domain. It requires a non-empty domain name.
func (DomainsServiceOp) List ¶
func (s DomainsServiceOp) List(opt *ListOptions) ([]Domain, *Response, error)
List all domains.
func (*DomainsServiceOp) Record ¶
func (s *DomainsServiceOp) Record(domain string, id int) (*DomainRecord, *Response, error)
Record returns the record id from a domain
func (*DomainsServiceOp) Records ¶
func (s *DomainsServiceOp) Records(domain string, opt *ListOptions) ([]DomainRecord, *Response, error)
Records returns a slice of DomainRecords for a domain
type Droplet ¶
type Droplet struct { ID int `json:"id,float64,omitempty"` Name string `json:"name,omitempty"` Memory int `json:"memory,omitempty"` Vcpus int `json:"vcpus,omitempty"` Disk int `json:"disk,omitempty"` Region *Region `json:"region,omitempty"` Image *Image `json:"image,omitempty"` Size *Size `json:"size,omitempty"` SizeSlug string `json:"size_slug,omitempty"` BackupIDs []int `json:"backup_ids,omitempty"` SnapshotIDs []int `json:"snapshot_ids,omitempty"` Locked bool `json:"locked,bool,omitempty"` Status string `json:"status,omitempty"` Networks *Networks `json:"networks,omitempty"` ActionIDs []int `json:"action_ids,omitempty"` Created string `json:"created_at,omitempty"` }
Droplet represents a DigitalOcean Droplet
type DropletActionsService ¶
type DropletActionsService interface { Shutdown(int) (*Action, *Response, error) PowerOff(int) (*Action, *Response, error) PowerOn(int) (*Action, *Response, error) PowerCycle(int) (*Action, *Response, error) Reboot(int) (*Action, *Response, error) Restore(int, int) (*Action, *Response, error) Resize(int, string, bool) (*Action, *Response, error) Rename(int, string) (*Action, *Response, error) Snapshot(int, string) (*Action, *Response, error) DisableBackups(int) (*Action, *Response, error) PasswordReset(int) (*Action, *Response, error) RebuildByImageID(int, int) (*Action, *Response, error) RebuildByImageSlug(int, string) (*Action, *Response, error) ChangeKernel(int, int) (*Action, *Response, error) EnableIPv6(int) (*Action, *Response, error) EnablePrivateNetworking(int) (*Action, *Response, error) Upgrade(int) (*Action, *Response, error) Get(int, int) (*Action, *Response, error) GetByURI(string) (*Action, *Response, error) }
DropletActionsService is an interface for interfacing with the droplet actions endpoints of the DigitalOcean API See: https://developers.digitalocean.com/documentation/v2#droplet-actions
type DropletActionsServiceOp ¶
type DropletActionsServiceOp struct {
// contains filtered or unexported fields
}
DropletActionsServiceOp handles communication with the droplet action related methods of the DigitalOcean API.
func (*DropletActionsServiceOp) ChangeKernel ¶
func (s *DropletActionsServiceOp) ChangeKernel(id, kernelID int) (*Action, *Response, error)
ChangeKernel changes the kernel for a droplet.
func (*DropletActionsServiceOp) DisableBackups ¶
func (s *DropletActionsServiceOp) DisableBackups(id int) (*Action, *Response, error)
DisableBackups disables backups for a droplet.
func (*DropletActionsServiceOp) EnableIPv6 ¶
func (s *DropletActionsServiceOp) EnableIPv6(id int) (*Action, *Response, error)
EnableIPv6 enables IPv6 for a droplet.
func (*DropletActionsServiceOp) EnablePrivateNetworking ¶
func (s *DropletActionsServiceOp) EnablePrivateNetworking(id int) (*Action, *Response, error)
EnablePrivateNetworking enables private networking for a droplet.
func (*DropletActionsServiceOp) Get ¶
func (s *DropletActionsServiceOp) Get(dropletID, actionID int) (*Action, *Response, error)
Get an action for a particular droplet by id.
func (*DropletActionsServiceOp) GetByURI ¶
func (s *DropletActionsServiceOp) GetByURI(rawurl string) (*Action, *Response, error)
GetByURI gets an action for a particular droplet by id.
func (*DropletActionsServiceOp) PasswordReset ¶
func (s *DropletActionsServiceOp) PasswordReset(id int) (*Action, *Response, error)
PasswordReset resets the password for a droplet.
func (*DropletActionsServiceOp) PowerCycle ¶
func (s *DropletActionsServiceOp) PowerCycle(id int) (*Action, *Response, error)
PowerCycle a Droplet
func (*DropletActionsServiceOp) PowerOff ¶
func (s *DropletActionsServiceOp) PowerOff(id int) (*Action, *Response, error)
PowerOff a Droplet
func (*DropletActionsServiceOp) PowerOn ¶
func (s *DropletActionsServiceOp) PowerOn(id int) (*Action, *Response, error)
PowerOn a Droplet
func (*DropletActionsServiceOp) Reboot ¶
func (s *DropletActionsServiceOp) Reboot(id int) (*Action, *Response, error)
Reboot a Droplet
func (*DropletActionsServiceOp) RebuildByImageID ¶
func (s *DropletActionsServiceOp) RebuildByImageID(id, imageID int) (*Action, *Response, error)
RebuildByImageID rebuilds a droplet droplet from an image with a given id.
func (*DropletActionsServiceOp) RebuildByImageSlug ¶
func (s *DropletActionsServiceOp) RebuildByImageSlug(id int, slug string) (*Action, *Response, error)
RebuildByImageSlug rebuilds a droplet from an image with a given slug.
func (*DropletActionsServiceOp) Resize ¶
func (s *DropletActionsServiceOp) Resize(id int, sizeSlug string, resizeDisk bool) (*Action, *Response, error)
Resize a Droplet
func (*DropletActionsServiceOp) Restore ¶
func (s *DropletActionsServiceOp) Restore(id, imageID int) (*Action, *Response, error)
Restore an image to a Droplet
func (*DropletActionsServiceOp) Shutdown ¶
func (s *DropletActionsServiceOp) Shutdown(id int) (*Action, *Response, error)
Shutdown a Droplet
type DropletCreateImage ¶
DropletCreateImage identifies an image for the create request. It prefers slug over ID.
func (DropletCreateImage) MarshalJSON ¶
func (d DropletCreateImage) MarshalJSON() ([]byte, error)
MarshalJSON returns either the slug or id of the image. It returns the id if the slug is empty.
type DropletCreateRequest ¶
type DropletCreateRequest struct { Name string `json:"name"` Region string `json:"region"` Size string `json:"size"` Image DropletCreateImage `json:"image"` SSHKeys []DropletCreateSSHKey `json:"ssh_keys"` Backups bool `json:"backups"` IPv6 bool `json:"ipv6"` PrivateNetworking bool `json:"private_networking"` UserData string `json:"user_data,omitempty"` }
DropletCreateRequest represents a request to create a droplet.
func (DropletCreateRequest) String ¶
func (d DropletCreateRequest) String() string
type DropletCreateSSHKey ¶
DropletCreateSSHKey identifies a SSH Key for the create request. It prefers fingerprint over ID.
func (DropletCreateSSHKey) MarshalJSON ¶
func (d DropletCreateSSHKey) MarshalJSON() ([]byte, error)
MarshalJSON returns either the fingerprint or id of the ssh key. It returns the id if the fingerprint is empty.
type DropletsService ¶
type DropletsService interface { List(*ListOptions) ([]Droplet, *Response, error) Get(int) (*Droplet, *Response, error) Create(*DropletCreateRequest) (*Droplet, *Response, error) Delete(int) (*Response, error) Kernels(int, *ListOptions) ([]Kernel, *Response, error) Snapshots(int, *ListOptions) ([]Image, *Response, error) Backups(int, *ListOptions) ([]Image, *Response, error) Actions(int, *ListOptions) ([]Action, *Response, error) Neighbors(int) ([]Droplet, *Response, error) }
DropletsService is an interface for interfacing with the droplet endpoints of the DigitalOcean API See: https://developers.digitalocean.com/documentation/v2#droplets
type DropletsServiceOp ¶
type DropletsServiceOp struct {
// contains filtered or unexported fields
}
DropletsServiceOp handles communication with the droplet related methods of the DigitalOcean API.
func (*DropletsServiceOp) Actions ¶
func (s *DropletsServiceOp) Actions(dropletID int, opt *ListOptions) ([]Action, *Response, error)
Actions lists the actions for a droplet.
func (*DropletsServiceOp) Backups ¶
func (s *DropletsServiceOp) Backups(dropletID int, opt *ListOptions) ([]Image, *Response, error)
Backups lists the backups for a droplet.
func (*DropletsServiceOp) Create ¶
func (s *DropletsServiceOp) Create(createRequest *DropletCreateRequest) (*Droplet, *Response, error)
Create droplet
func (*DropletsServiceOp) Delete ¶
func (s *DropletsServiceOp) Delete(dropletID int) (*Response, error)
Delete droplet
func (*DropletsServiceOp) Get ¶
func (s *DropletsServiceOp) Get(dropletID int) (*Droplet, *Response, error)
Get individual droplet
func (*DropletsServiceOp) Kernels ¶
func (s *DropletsServiceOp) Kernels(dropletID int, opt *ListOptions) ([]Kernel, *Response, error)
Kernels lists kernels available for a droplet.
func (*DropletsServiceOp) List ¶
func (s *DropletsServiceOp) List(opt *ListOptions) ([]Droplet, *Response, error)
List all droplets
func (*DropletsServiceOp) Neighbors ¶
func (s *DropletsServiceOp) Neighbors(dropletID int) ([]Droplet, *Response, error)
Neighbors lists the neighbors for a droplet.
func (*DropletsServiceOp) Snapshots ¶
func (s *DropletsServiceOp) Snapshots(dropletID int, opt *ListOptions) ([]Image, *Response, error)
Snapshots lists the snapshots available for a droplet.
type ErrorResponse ¶
type ErrorResponse struct { // HTTP response that caused this error Response *http.Response // Error message Message string }
An ErrorResponse reports the error caused by an API request
func (*ErrorResponse) Error ¶
func (r *ErrorResponse) Error() string
type FloatingIP ¶
type FloatingIP struct { Region *Region `json:"region"` Droplet *Droplet `json:"droplet"` IP string `json:"ip"` }
FloatingIP represents a Digital Ocean floating IP.
func (FloatingIP) String ¶
func (f FloatingIP) String() string
type FloatingIPActionsService ¶
type FloatingIPActionsService interface { Assign(ip string, dropletID int) (*Action, *Response, error) Unassign(ip string) (*Action, *Response, error) Get(ip string, actionID int) (*Action, *Response, error) }
FloatingIPActionsService is an interface for interfacing with the floating IPs actions endpoints of the Digital Ocean API. See: https://developers.digitalocean.com/documentation/v2#floating-ips-action
type FloatingIPActionsServiceOp ¶
type FloatingIPActionsServiceOp struct {
// contains filtered or unexported fields
}
FloatingIPActionsServiceOp handles communication with the floating IPs action related methods of the DigitalOcean API.
type FloatingIPCreateRequest ¶
type FloatingIPCreateRequest struct { Region string `json:"region"` DropletID int `json:"droplet_id,omitempty"` }
FloatingIPCreateRequest represents a request to create a floating IP. If DropletID is not empty, the floating IP will be assigned to the droplet.
type FloatingIPsService ¶
type FloatingIPsService interface { List(*ListOptions) ([]FloatingIP, *Response, error) Get(string) (*FloatingIP, *Response, error) Create(*FloatingIPCreateRequest) (*FloatingIP, *Response, error) Delete(string) (*Response, error) }
FloatingIPsService is an interface for interfacing with the floating IPs endpoints of the Digital Ocean API. See: https://developers.digitalocean.com/documentation/v2#floating-ips
type FloatingIPsServiceOp ¶
type FloatingIPsServiceOp struct {
// contains filtered or unexported fields
}
FloatingIPsServiceOp handles communication with the floating IPs related methods of the DigitalOcean API.
func (*FloatingIPsServiceOp) Create ¶
func (f *FloatingIPsServiceOp) Create(createRequest *FloatingIPCreateRequest) (*FloatingIP, *Response, error)
Create a floating IP. If the DropletID field of the request is not empty, the floating IP will also be assigned to the droplet.
func (*FloatingIPsServiceOp) Delete ¶
func (f *FloatingIPsServiceOp) Delete(ip string) (*Response, error)
Delete a floating IP.
func (*FloatingIPsServiceOp) Get ¶
func (f *FloatingIPsServiceOp) Get(ip string) (*FloatingIP, *Response, error)
Get an individual floating IP.
func (*FloatingIPsServiceOp) List ¶
func (f *FloatingIPsServiceOp) List(opt *ListOptions) ([]FloatingIP, *Response, error)
List all floating IPs.
type Image ¶
type Image struct { ID int `json:"id,float64,omitempty"` Name string `json:"name,omitempty"` Type string `json:"type,omitempty"` Distribution string `json:"distribution,omitempty"` Slug string `json:"slug,omitempty"` Public bool `json:"public,omitempty"` Regions []string `json:"regions,omitempty"` MinDiskSize int `json:"min_disk_size,omitempty"` Created string `json:"created_at,omitempty"` }
Image represents a DigitalOcean Image
type ImageActionsService ¶
type ImageActionsService interface { Get(int, int) (*Action, *Response, error) Transfer(int, *ActionRequest) (*Action, *Response, error) }
ImageActionsService is an interface for interfacing with the image actions endpoints of the DigitalOcean API See: https://developers.digitalocean.com/documentation/v2#image-actions
type ImageActionsServiceOp ¶
type ImageActionsServiceOp struct {
// contains filtered or unexported fields
}
ImageActionsServiceOp handles communition with the image action related methods of the DigitalOcean API.
func (*ImageActionsServiceOp) Get ¶
func (i *ImageActionsServiceOp) Get(imageID, actionID int) (*Action, *Response, error)
Get an action for a particular image by id.
func (*ImageActionsServiceOp) Transfer ¶
func (i *ImageActionsServiceOp) Transfer(imageID int, transferRequest *ActionRequest) (*Action, *Response, error)
Transfer an image
type ImageUpdateRequest ¶
type ImageUpdateRequest struct {
Name string `json:"name"`
}
ImageUpdateRequest represents a request to update an image.
type ImagesService ¶
type ImagesService interface { List(*ListOptions) ([]Image, *Response, error) ListDistribution(opt *ListOptions) ([]Image, *Response, error) ListApplication(opt *ListOptions) ([]Image, *Response, error) ListUser(opt *ListOptions) ([]Image, *Response, error) GetByID(int) (*Image, *Response, error) GetBySlug(string) (*Image, *Response, error) Update(int, *ImageUpdateRequest) (*Image, *Response, error) Delete(int) (*Response, error) }
ImagesService is an interface for interfacing with the images endpoints of the DigitalOcean API See: https://developers.digitalocean.com/documentation/v2#images
type ImagesServiceOp ¶
type ImagesServiceOp struct {
// contains filtered or unexported fields
}
ImagesServiceOp handles communication with the image related methods of the DigitalOcean API.
func (*ImagesServiceOp) Delete ¶
func (s *ImagesServiceOp) Delete(imageID int) (*Response, error)
Delete an image.
func (*ImagesServiceOp) GetByID ¶
func (s *ImagesServiceOp) GetByID(imageID int) (*Image, *Response, error)
GetByID retrieves an image by id.
func (*ImagesServiceOp) GetBySlug ¶
func (s *ImagesServiceOp) GetBySlug(slug string) (*Image, *Response, error)
GetBySlug retrieves an image by slug.
func (*ImagesServiceOp) List ¶
func (s *ImagesServiceOp) List(opt *ListOptions) ([]Image, *Response, error)
List lists all the images available.
func (*ImagesServiceOp) ListApplication ¶
func (s *ImagesServiceOp) ListApplication(opt *ListOptions) ([]Image, *Response, error)
ListApplication lists all the application images.
func (*ImagesServiceOp) ListDistribution ¶
func (s *ImagesServiceOp) ListDistribution(opt *ListOptions) ([]Image, *Response, error)
ListDistribution lists all the distribution images.
func (*ImagesServiceOp) ListUser ¶
func (s *ImagesServiceOp) ListUser(opt *ListOptions) ([]Image, *Response, error)
ListUser lists all the user images.
func (*ImagesServiceOp) Update ¶
func (s *ImagesServiceOp) Update(imageID int, updateRequest *ImageUpdateRequest) (*Image, *Response, error)
Update an image name.
type Kernel ¶
type Kernel struct { ID int `json:"id,float64,omitempty"` Name string `json:"name,omitempty"` Version string `json:"version,omitempty"` }
Kernel object
type Key ¶
type Key struct { ID int `json:"id,float64,omitempty"` Name string `json:"name,omitempty"` Fingerprint string `json:"fingerprint,omitempty"` PublicKey string `json:"public_key,omitempty"` }
Key represents a DigitalOcean Key.
type KeyCreateRequest ¶
KeyCreateRequest represents a request to create a new key.
type KeyUpdateRequest ¶
type KeyUpdateRequest struct {
Name string `json:"name"`
}
KeyUpdateRequest represents a request to update a DigitalOcean key.
type KeysService ¶
type KeysService interface { List(*ListOptions) ([]Key, *Response, error) GetByID(int) (*Key, *Response, error) GetByFingerprint(string) (*Key, *Response, error) Create(*KeyCreateRequest) (*Key, *Response, error) UpdateByID(int, *KeyUpdateRequest) (*Key, *Response, error) UpdateByFingerprint(string, *KeyUpdateRequest) (*Key, *Response, error) DeleteByID(int) (*Response, error) DeleteByFingerprint(string) (*Response, error) }
KeysService is an interface for interfacing with the keys endpoints of the DigitalOcean API See: https://developers.digitalocean.com/documentation/v2#keys
type KeysServiceOp ¶
type KeysServiceOp struct {
// contains filtered or unexported fields
}
KeysServiceOp handles communication with key related method of the DigitalOcean API.
func (*KeysServiceOp) Create ¶
func (s *KeysServiceOp) Create(createRequest *KeyCreateRequest) (*Key, *Response, error)
Create a key using a KeyCreateRequest
func (*KeysServiceOp) DeleteByFingerprint ¶
func (s *KeysServiceOp) DeleteByFingerprint(fingerprint string) (*Response, error)
DeleteByFingerprint deletes a key by its fingerprint
func (*KeysServiceOp) DeleteByID ¶
func (s *KeysServiceOp) DeleteByID(keyID int) (*Response, error)
DeleteByID deletes a key by its id
func (*KeysServiceOp) GetByFingerprint ¶
func (s *KeysServiceOp) GetByFingerprint(fingerprint string) (*Key, *Response, error)
GetByFingerprint gets a Key by by fingerprint
func (*KeysServiceOp) GetByID ¶
func (s *KeysServiceOp) GetByID(keyID int) (*Key, *Response, error)
GetByID gets a Key by id
func (*KeysServiceOp) List ¶
func (s *KeysServiceOp) List(opt *ListOptions) ([]Key, *Response, error)
List all keys
func (*KeysServiceOp) UpdateByFingerprint ¶
func (s *KeysServiceOp) UpdateByFingerprint(fingerprint string, updateRequest *KeyUpdateRequest) (*Key, *Response, error)
UpdateByFingerprint updates a key name by fingerprint.
func (*KeysServiceOp) UpdateByID ¶
func (s *KeysServiceOp) UpdateByID(keyID int, updateRequest *KeyUpdateRequest) (*Key, *Response, error)
UpdateByID updates a key name by ID.
type LinkAction ¶
type LinkAction struct { ID int `json:"id,omitempty"` Rel string `json:"rel,omitempty"` HREF string `json:"href,omitempty"` }
LinkAction is a pointer to an action
type Links ¶
type Links struct { Pages *Pages `json:"pages,omitempty"` Actions []LinkAction `json:"actions,omitempty"` }
Links manages links that are returned along with a List
func (*Links) CurrentPage ¶
CurrentPage is current page of the list
func (*Links) IsLastPage ¶
IsLastPage returns true if the current page is the last
type ListOptions ¶
type ListOptions struct { // For paginated result sets, page of results to retrieve. Page int `url:"page,omitempty"` // For paginated result sets, the number of results to include per page. PerPage int `url:"per_page,omitempty"` }
ListOptions specifies the optional parameters to various List methods that support pagination.
type NetworkV4 ¶
type NetworkV4 struct { IPAddress string `json:"ip_address,omitempty"` Netmask string `json:"netmask,omitempty"` Gateway string `json:"gateway,omitempty"` Type string `json:"type,omitempty"` }
NetworkV4 represents a DigitalOcean IPv4 Network
type NetworkV6 ¶
type NetworkV6 struct { IPAddress string `json:"ip_address,omitempty"` Netmask int `json:"netmask,omitempty"` Gateway string `json:"gateway,omitempty"` Type string `json:"type,omitempty"` }
NetworkV6 represents a DigitalOcean IPv6 network.
type Pages ¶
type Pages struct { First string `json:"first,omitempty"` Prev string `json:"prev,omitempty"` Last string `json:"last,omitempty"` Next string `json:"next,omitempty"` }
Pages are pages specified in Links
type Rate ¶
type Rate struct { // The number of request per hour the client is currently limited to. Limit int `json:"limit"` // The number of remaining requests the client can make this hour. Remaining int `json:"remaining"` // The time at w\hic the current rate limit will reset. Reset Timestamp `json:"reset"` }
Rate contains the rate limit for the current client.
type Region ¶
type Region struct { Slug string `json:"slug,omitempty"` Name string `json:"name,omitempty"` Sizes []string `json:"sizes,omitempty"` Available bool `json:"available,omitempty"` Features []string `json:"features,omitempty"` }
Region represents a DigitalOcean Region
type RegionsService ¶
type RegionsService interface {
List(*ListOptions) ([]Region, *Response, error)
}
RegionsService is an interface for interfacing with the regions endpoints of the DigitalOcean API See: https://developers.digitalocean.com/documentation/v2#regions
type RegionsServiceOp ¶
type RegionsServiceOp struct {
// contains filtered or unexported fields
}
RegionsServiceOp handles communication with the region related methods of the DigitalOcean API.
func (*RegionsServiceOp) List ¶
func (s *RegionsServiceOp) List(opt *ListOptions) ([]Region, *Response, error)
List all regions
type RequestCompletionCallback ¶
RequestCompletionCallback defines the type of the request callback function
type Response ¶
type Response struct { *http.Response // Links that were returned with the response. These are parsed from // request body and not the header. Links *Links // Monitoring URI Monitor string Rate }
Response is a DigitalOcean response. This wraps the standard http.Response returned from DigitalOcean.
type Size ¶
type Size struct { Slug string `json:"slug,omitempty"` Memory int `json:"memory,omitempty"` Vcpus int `json:"vcpus,omitempty"` Disk int `json:"disk,omitempty"` PriceMonthly float64 `json:"price_monthly,omitempty"` PriceHourly float64 `json:"price_hourly,omitempty"` Regions []string `json:"regions,omitempty"` Available bool `json:"available,omitempty"` Transfer float64 `json:"transfer,omitempty"` }
Size represents a DigitalOcean Size
type SizesService ¶
type SizesService interface {
List(*ListOptions) ([]Size, *Response, error)
}
SizesService is an interface for interfacing with the size endpoints of the DigitalOcean API See: https://developers.digitalocean.com/documentation/v2#sizes
type SizesServiceOp ¶
type SizesServiceOp struct {
// contains filtered or unexported fields
}
SizesServiceOp handles communication with the size related methods of the DigitalOcean API.
func (*SizesServiceOp) List ¶
func (s *SizesServiceOp) List(opt *ListOptions) ([]Size, *Response, error)
List all images
type Timestamp ¶
Timestamp represents a time that can be unmarshalled from a JSON string formatted as either an RFC3339 or Unix timestamp. All exported methods of time.Time can be called on Timestamp.
func (*Timestamp) UnmarshalJSON ¶
UnmarshalJSON implements the json.Unmarshaler interface. Time is expected in RFC3339 or Unix format.