Documentation ¶
Index ¶
- Constants
- func NewRequest(d DigitalOceanClient, path string, params url.Values) (map[string]interface{}, error)
- type Artifact
- type Builder
- type DigitalOceanClient
- func (d DigitalOceanClient) CreateDroplet(name string, size string, image string, region string, keyId uint, ...) (uint, error)
- func (d DigitalOceanClient) CreateKey(name string, pub string) (uint, error)
- func (d DigitalOceanClient) CreateSnapshot(id uint, name string) error
- func (d DigitalOceanClient) DestroyDroplet(id uint) error
- func (d DigitalOceanClient) DestroyImage(id uint) error
- func (d DigitalOceanClient) DestroyKey(id uint) error
- func (d DigitalOceanClient) DropletStatus(id uint) (string, string, error)
- func (d DigitalOceanClient) Image(slug_or_name_or_id string) (Image, error)
- func (d DigitalOceanClient) Images() ([]Image, error)
- func (d DigitalOceanClient) New(client string, key string) *DigitalOceanClient
- func (d DigitalOceanClient) PowerOffDroplet(id uint) error
- func (d DigitalOceanClient) Region(slug_or_name_or_id string) (Region, error)
- func (d DigitalOceanClient) Regions() ([]Region, error)
- func (d DigitalOceanClient) ShutdownDroplet(id uint) error
- func (d DigitalOceanClient) Size(slug_or_name_or_id string) (Size, error)
- func (d DigitalOceanClient) Sizes() ([]Size, error)
- type Image
- type ImagesResp
- type Region
- type RegionsResp
- type Size
- type SizesResp
Constants ¶
const BuilderId = "pearkes.digitalocean"
The unique id for the builder
const DIGITALOCEAN_API_URL = "https://api.digitalocean.com"
const DefaultImage = "ubuntu-12-04-x64"
see https://api.digitalocean.com/images/?client_id=[client_id]&api_key=[api_key] name="Ubuntu 12.04.4 x64", id=3101045,
const DefaultRegion = "nyc1"
see https://api.digitalocean.com/regions/?client_id=[client_id]&api_key=[api_key] name="New York", id=1
const DefaultSize = "512mb"
see https://api.digitalocean.com/sizes/?client_id=[client_id]&api_key=[api_key] name="512MB", id=66 (the smallest droplet size)
Variables ¶
This section is empty.
Functions ¶
func NewRequest ¶
func NewRequest(d DigitalOceanClient, path string, params url.Values) (map[string]interface{}, error)
Sends an api request and returns a generic map[string]interface of the response.
Types ¶
type DigitalOceanClient ¶
type DigitalOceanClient struct { // The base URL of the API BaseURL string // Credentials ClientID string APIKey string // contains filtered or unexported fields }
func (DigitalOceanClient) CreateDroplet ¶
func (d DigitalOceanClient) CreateDroplet(name string, size string, image string, region string, keyId uint, privateNetworking bool) (uint, error)
Creates a droplet and returns it's id
func (DigitalOceanClient) CreateKey ¶
func (d DigitalOceanClient) CreateKey(name string, pub string) (uint, error)
Creates an SSH Key and returns it's id
func (DigitalOceanClient) CreateSnapshot ¶
func (d DigitalOceanClient) CreateSnapshot(id uint, name string) error
Creates a snaphot of a droplet by it's ID
func (DigitalOceanClient) DestroyDroplet ¶
func (d DigitalOceanClient) DestroyDroplet(id uint) error
Destroys a droplet
func (DigitalOceanClient) DestroyImage ¶
func (d DigitalOceanClient) DestroyImage(id uint) error
Destroys an image by its ID.
func (DigitalOceanClient) DestroyKey ¶
func (d DigitalOceanClient) DestroyKey(id uint) error
Destroys an SSH key
func (DigitalOceanClient) DropletStatus ¶
func (d DigitalOceanClient) DropletStatus(id uint) (string, string, error)
Returns DO's string representation of status "off" "new" "active" etc.
func (DigitalOceanClient) Image ¶ added in v0.6.0
func (d DigitalOceanClient) Image(slug_or_name_or_id string) (Image, error)
func (DigitalOceanClient) Images ¶
func (d DigitalOceanClient) Images() ([]Image, error)
Returns all available images.
func (DigitalOceanClient) New ¶
func (d DigitalOceanClient) New(client string, key string) *DigitalOceanClient
Creates a new client for communicating with DO
func (DigitalOceanClient) PowerOffDroplet ¶
func (d DigitalOceanClient) PowerOffDroplet(id uint) error
Powers off a droplet
func (DigitalOceanClient) Region ¶ added in v0.6.0
func (d DigitalOceanClient) Region(slug_or_name_or_id string) (Region, error)
func (DigitalOceanClient) Regions ¶ added in v0.4.0
func (d DigitalOceanClient) Regions() ([]Region, error)
Returns all available regions.
func (DigitalOceanClient) ShutdownDroplet ¶ added in v0.3.5
func (d DigitalOceanClient) ShutdownDroplet(id uint) error
Shutsdown a droplet. This is a "soft" shutdown.
func (DigitalOceanClient) Size ¶ added in v0.6.0
func (d DigitalOceanClient) Size(slug_or_name_or_id string) (Size, error)
func (DigitalOceanClient) Sizes ¶ added in v0.6.0
func (d DigitalOceanClient) Sizes() ([]Size, error)
Returns all available sizes.
type ImagesResp ¶
type ImagesResp struct {
Images []Image
}
type RegionsResp ¶ added in v0.4.0
type RegionsResp struct {
Regions []Region
}