Documentation ¶
Index ¶
- Constants
- func CheckResponse(r *http.Response) error
- type Account
- type AccountResponse
- type AccountService
- type Client
- type CreateDropletRequest
- type Droplet
- type DropletResponse
- type DropletsListResponse
- type DropletsService
- func (s *DropletsService) Create(droplet *CreateDropletRequest) (*Droplet, *http.Response, error)
- func (s *DropletsService) Destroy(id int) (*http.Response, error)
- func (s *DropletsService) Get(id int) (*Droplet, *http.Response, error)
- func (s *DropletsService) List() ([]Droplet, *http.Response, error)
- type ErrorResponse
- type ErrorStatus
- type Image
- type ImagesResponse
- type ImagesService
- type Kernel
- type Meta
- type MockClient
- type NetworkV4
- type NetworkV6
- type Networks
- type Option
- type Region
- type RegionsResponse
- type RegionsService
- type SSHKey
- type SSHKeyListResponse
- type SSHKeysService
- type Size
- type SizesResponse
- type SizesService
Constants ¶
const (
LibraryVersion = "0.1"
)
const
Variables ¶
This section is empty.
Functions ¶
func CheckResponse ¶
CheckResponse checks the API response for errors, and returns them if present.
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"` }
Account represents a Digital Ocean acount.
type AccountResponse ¶
type AccountResponse struct {
Account Account `json:"account"`
}
AccountResponse https://developers.digitalocean.com/#account
type AccountService ¶
type AccountService struct {
// contains filtered or unexported fields
}
AccountService Digital Ocean API docs: https://developers.digitalocean.com/#account
func (*AccountService) GetUserInformation ¶
func (s *AccountService) GetUserInformation() (*Account, *http.Response, error)
GetUserInformation https://developers.digitalocean.com/#account
type Client ¶
type Client struct { Option *Option BaseURL *url.URL UserAgent string SizesService *SizesService RegionsService *RegionsService DropletsService *DropletsService ImagesService *ImagesService SSHKeysService *SSHKeysService AccountService *AccountService // contains filtered or unexported fields }
A Client manages communication with the Digital Ocean API.
type CreateDropletRequest ¶
type CreateDropletRequest struct { Name string `json:"name,omitempty"` Region string `json:"region,omitempty"` Size string `json:"size,omitempty"` Image string `json:"image,omitempty"` SSHKeys []string `json:"ssh_keys,omitempty"` Backups bool `json:"backups,omitempty"` IPv6 bool `json:"ipv6,omitempty"` PrivateNetworking bool `json:"private_networking,omitempty"` UserData string `json:"user_data,omitempty"` }
CreateDropletsReque https://developers.digitalocean.com/#create-a-new-droplet
type Droplet ¶
type Droplet struct { ID int `json:"id,omitempty"` Name string `json:"name,omitempty"` Memory int `json:"memory,omitempty"` Vcpus int `json:"vcpus,omitempty"` Disk int `json:"disk,omitempty"` Locked bool `json:"locked,omitempty"` CreatedAt string `json:"created_at,omitempty"` Status string `json:"status,omitempty"` BackupIds []int `json:"backup_ids,omitempty"` SnapshotIds []int `json:"snapshot_ids,omitempty"` ActionIds []string `json:"action_ids,omitempty"` Features []string `json:"features,omitempty"` Region Region `json:"region,omitempty"` Size string `json:"size_slug,omitempty"` Networks Networks `json:"networks,omitempty"` Image Image `json:"image,omitempty"` Kernel Kernel `json:"kernel,omitempty"` }
Droplet https://developers.digitalocean.com/#create-a-new-droplet
type DropletResponse ¶
type DropletResponse struct {
Droplet Droplet `json:"droplet,omitempty"`
}
DropletResponse https://developers.digitalocean.com/#create-a-new-droplet
type DropletsListResponse ¶
type DropletsListResponse struct {
Droplets []Droplet `json:"droplets,omitempty"`
}
DropletsListResponse https://developers.digitalocean.com/#list-all-droplets
type DropletsService ¶
type DropletsService struct {
// contains filtered or unexported fields
}
DropletsService Digital Ocean API docs: https://developers.digitalocean.com/#droplets
func (*DropletsService) Create ¶
func (s *DropletsService) Create(droplet *CreateDropletRequest) (*Droplet, *http.Response, error)
Create a new droplet
func (*DropletsService) Destroy ¶
func (s *DropletsService) Destroy(id int) (*http.Response, error)
Destroy a droplet
type ErrorResponse ¶
type ErrorResponse struct { Response *http.Response ErrorStatus ErrorStatus }
An ErrorResponse reports one or more errors caused by an API request.
func (*ErrorResponse) Error ¶
func (r *ErrorResponse) Error() string
type ErrorStatus ¶
type ErrorStatus struct { ID string `json:"id,omitempty"` Message string `json:"message,omitempty"` }
ErrorStatus https://developers.digitalocean.com/#statuses
type Image ¶
type Image struct { ID int `json:"id,omitempty"` Name string `json:"name,omitempty"` Distribution string `json:"distribution,omitempty"` Slug string `json:"slug,omitempty"` Public bool `json:"public,omitempty"` Regions []string `json:"regions,omitempty"` CreatedAt string `json:"created_at,omitempty"` MinDiskSize int `json:"min_disk_size,omitempty"` }
type ImagesResponse ¶
type ImagesResponse struct { Images []Image `json:"images,omitempty"` Meta Meta `json:"meta,omitempty"` }
ImagesResponse https://developers.digitalocean.com/#images
type ImagesService ¶
ImagesService Digital Ocean API docs: https://developers.digitalocean.com/#images
func (*ImagesService) ListAll ¶
func (s *ImagesService) ListAll() ([]Image, *http.Response, error)
ListAll https://developers.digitalocean.com/#list-all-images
func (*ImagesService) ListApplication ¶
func (s *ImagesService) ListApplication() ([]Image, *http.Response, error)
ListApplication https://developers.digitalocean.com/#list-all-application-images
func (*ImagesService) ListDistribution ¶
func (s *ImagesService) ListDistribution() ([]Image, *http.Response, error)
ListDistribution https://developers.digitalocean.com/#list-all-distribution-images
type Kernel ¶
type Kernel struct { ID int `json:"id,omitempty"` Name string `json:"name,omitempty"` Version string `json:"version,omitempty"` }
Kernel The current kernel.
type MockClient ¶
type MockClient struct { Mux *http.ServeMux Client *Client Server *httptest.Server FixturesDir string }
A MockClient manages communication with the Digital Ocean API mock.
func NewMockClient ¶
func NewMockClient() *MockClient
NewMockClient returns a new Digital Ocean API client mock.
func (*MockClient) ReadJSON ¶
func (r *MockClient) ReadJSON(filename string) string
ReadJSON Read json from file
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 The details of the network that are configured for the Droplet instance.
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 The details of the network that are configured for the Droplet instance.
type Networks ¶
type Networks struct { V4s []NetworkV4 `json:"v4,omitempty"` V6s []NetworkV6 `json:"v6,omitempty"` }
Networks The details of the network that are configured for the Droplet instance.
type Region ¶
type RegionsResponse ¶
type RegionsResponse struct { Regions []Region `json:"regions,omitempty"` Meta Meta `json:"meta,omitempty"` }
RegionsResponse https://developers.digitalocean.com/#list-all-regions
type RegionsService ¶
type RegionsService struct {
// contains filtered or unexported fields
}
RegionsService Digital Ocean API docs: https://developers.digitalocean.com/#regions
type SSHKey ¶
type SSHKeyListResponse ¶
type SSHKeysService ¶
type SSHKeysService struct {
// contains filtered or unexported fields
}
SSHKeyService Digital Ocean API docs: https://developers.digitalocean.com/#ssh-keys
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"` Transfer float32 `json:"transfer,omitempty"` PriceMonthly float32 `json:"price_monthly,omitempty"` PriceHourly float32 `json:"price_hourly,omitempty"` Regions []string `json:"regions,omitempty"` }
type SizesResponse ¶
type SizesResponse struct { Sizes []Size `json:"sizes,omitempty"` Meta Meta `json:"meta,omitempty"` }
SizesResponse https://developers.digitalocean.com/#list-all-sizes
type SizesService ¶
type SizesService struct {
// contains filtered or unexported fields
}
SizesService Digital Ocean API docs: https://developers.digitalocean.com/#sizes