digitalocean

package
v0.7.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 10, 2014 License: MPL-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const BuilderId = "pearkes.digitalocean"

The unique id for the builder

View Source
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=6374128,

View Source
const DefaultRegion = "nyc1"

see https://api.digitalocean.com/regions/?client_id=[client_id]&api_key=[api_key] name="New York", id=1

View Source
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 NewRequestV1 added in v0.7.2

func NewRequestV1(d DigitalOceanClientV1, path string, params url.Values) (map[string]interface{}, error)

Sends an api request and returns a generic map[string]interface of the response.

func NewRequestV2 added in v0.7.2

func NewRequestV2(d DigitalOceanClientV2, path string, method string, req interface{}, res interface{}) error

Sends an api request and returns a generic map[string]interface of the response.

Types

type Artifact

type Artifact struct {
	// contains filtered or unexported fields
}

func (*Artifact) BuilderId

func (*Artifact) BuilderId() string

func (*Artifact) Destroy

func (a *Artifact) Destroy() error

func (*Artifact) Files

func (*Artifact) Files() []string

func (*Artifact) Id

func (a *Artifact) Id() string

func (*Artifact) State added in v0.7.2

func (a *Artifact) State(name string) interface{}

func (*Artifact) String

func (a *Artifact) String() string

type Builder

type Builder struct {
	// contains filtered or unexported fields
}

func (*Builder) Cancel

func (b *Builder) Cancel()

func (*Builder) Prepare

func (b *Builder) Prepare(raws ...interface{}) ([]string, error)

func (*Builder) Run

func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packer.Artifact, error)

type DigitalOceanClient

type DigitalOceanClient interface {
	CreateKey(string, string) (uint, error)
	DestroyKey(uint) error
	CreateDroplet(string, string, string, string, uint, bool) (uint, error)
	DestroyDroplet(uint) error
	PowerOffDroplet(uint) error
	ShutdownDroplet(uint) error
	CreateSnapshot(uint, string) error
	Images() ([]Image, error)
	DestroyImage(uint) error
	DropletStatus(uint) (string, string, error)
	Image(string) (Image, error)
	Regions() ([]Region, error)
	Region(string) (Region, error)
	Sizes() ([]Size, error)
	Size(string) (Size, error)
}

type DigitalOceanClientV1 added in v0.7.2

type DigitalOceanClientV1 struct {

	// Credentials
	ClientID string
	APIKey   string
	// The base URL of the API
	APIURL string
	// contains filtered or unexported fields
}

func DigitalOceanClientNewV1 added in v0.7.2

func DigitalOceanClientNewV1(client string, key string, url string) *DigitalOceanClientV1

Creates a new client for communicating with DO

func (DigitalOceanClientV1) CreateDroplet added in v0.7.2

func (d DigitalOceanClientV1) CreateDroplet(name string, size string, image string, region string, keyId uint, privateNetworking bool) (uint, error)

Creates a droplet and returns it's id

func (DigitalOceanClientV1) CreateKey added in v0.7.2

func (d DigitalOceanClientV1) CreateKey(name string, pub string) (uint, error)

Creates an SSH Key and returns it's id

func (DigitalOceanClientV1) CreateSnapshot added in v0.7.2

func (d DigitalOceanClientV1) CreateSnapshot(id uint, name string) error

Creates a snaphot of a droplet by it's ID

func (DigitalOceanClientV1) DestroyDroplet added in v0.7.2

func (d DigitalOceanClientV1) DestroyDroplet(id uint) error

Destroys a droplet

func (DigitalOceanClientV1) DestroyImage added in v0.7.2

func (d DigitalOceanClientV1) DestroyImage(id uint) error

Destroys an image by its ID.

func (DigitalOceanClientV1) DestroyKey added in v0.7.2

func (d DigitalOceanClientV1) DestroyKey(id uint) error

Destroys an SSH key

func (DigitalOceanClientV1) DropletStatus added in v0.7.2

func (d DigitalOceanClientV1) DropletStatus(id uint) (string, string, error)

Returns DO's string representation of status "off" "new" "active" etc.

func (DigitalOceanClientV1) Image added in v0.7.2

func (d DigitalOceanClientV1) Image(slug_or_name_or_id string) (Image, error)

func (DigitalOceanClientV1) Images added in v0.7.2

func (d DigitalOceanClientV1) Images() ([]Image, error)

Returns all available images.

func (DigitalOceanClientV1) PowerOffDroplet added in v0.7.2

func (d DigitalOceanClientV1) PowerOffDroplet(id uint) error

Powers off a droplet

func (DigitalOceanClientV1) Region added in v0.7.2

func (d DigitalOceanClientV1) Region(slug_or_name_or_id string) (Region, error)

func (DigitalOceanClientV1) Regions added in v0.7.2

func (d DigitalOceanClientV1) Regions() ([]Region, error)

Returns all available regions.

func (DigitalOceanClientV1) ShutdownDroplet added in v0.7.2

func (d DigitalOceanClientV1) ShutdownDroplet(id uint) error

Shutsdown a droplet. This is a "soft" shutdown.

func (DigitalOceanClientV1) Size added in v0.7.2

func (d DigitalOceanClientV1) Size(slug_or_name_or_id string) (Size, error)

func (DigitalOceanClientV1) Sizes added in v0.7.2

func (d DigitalOceanClientV1) Sizes() ([]Size, error)

Returns all available sizes.

type DigitalOceanClientV2 added in v0.7.2

type DigitalOceanClientV2 struct {

	// Credentials
	APIToken string

	// The base URL of the API
	APIURL string
	// contains filtered or unexported fields
}

func DigitalOceanClientNewV2 added in v0.7.2

func DigitalOceanClientNewV2(token string, url string) *DigitalOceanClientV2

Creates a new client for communicating with DO

func (DigitalOceanClientV2) CreateDroplet added in v0.7.2

func (d DigitalOceanClientV2) CreateDroplet(name string, size string, image string, region string, keyId uint, privateNetworking bool) (uint, error)

Creates a droplet and returns it's id

func (DigitalOceanClientV2) CreateKey added in v0.7.2

func (d DigitalOceanClientV2) CreateKey(name string, pub string) (uint, error)

Creates an SSH Key and returns it's id

func (DigitalOceanClientV2) CreateSnapshot added in v0.7.2

func (d DigitalOceanClientV2) CreateSnapshot(id uint, name string) error

Creates a snaphot of a droplet by it's ID

func (DigitalOceanClientV2) DestroyDroplet added in v0.7.2

func (d DigitalOceanClientV2) DestroyDroplet(id uint) error

Destroys a droplet

func (DigitalOceanClientV2) DestroyImage added in v0.7.2

func (d DigitalOceanClientV2) DestroyImage(id uint) error

Destroys an image by its ID.

func (DigitalOceanClientV2) DestroyKey added in v0.7.2

func (d DigitalOceanClientV2) DestroyKey(id uint) error

Destroys an SSH key

func (DigitalOceanClientV2) DropletStatus added in v0.7.2

func (d DigitalOceanClientV2) DropletStatus(id uint) (string, string, error)

Returns DO's string representation of status "off" "new" "active" etc.

func (DigitalOceanClientV2) Image added in v0.7.2

func (d DigitalOceanClientV2) Image(slug_or_name_or_id string) (Image, error)

func (DigitalOceanClientV2) Images added in v0.7.2

func (d DigitalOceanClientV2) Images() ([]Image, error)

Returns all available images.

func (DigitalOceanClientV2) PowerOffDroplet added in v0.7.2

func (d DigitalOceanClientV2) PowerOffDroplet(id uint) error

Powers off a droplet

func (DigitalOceanClientV2) Region added in v0.7.2

func (d DigitalOceanClientV2) Region(slug_or_name_or_id string) (Region, error)

func (DigitalOceanClientV2) Regions added in v0.7.2

func (d DigitalOceanClientV2) Regions() ([]Region, error)

Returns all available regions.

func (DigitalOceanClientV2) ShutdownDroplet added in v0.7.2

func (d DigitalOceanClientV2) ShutdownDroplet(id uint) error

Shutsdown a droplet. This is a "soft" shutdown.

func (DigitalOceanClientV2) Size added in v0.7.2

func (d DigitalOceanClientV2) Size(slug_or_name_or_id string) (Size, error)

func (DigitalOceanClientV2) Sizes added in v0.7.2

func (d DigitalOceanClientV2) Sizes() ([]Size, error)

Returns all available sizes.

type Image

type Image struct {
	Id           uint     `json:"id"`                   //presen in both api
	Name         string   `json:"name"`                 //presen in both api
	Slug         string   `json:"slug"`                 //presen in both api
	Distribution string   `json:"distribution"`         //presen in both api
	Public       bool     `json:"public,omitempty"`     //only in v2 api
	Regions      []string `json:"regions,omitempty"`    //only in v2 api
	ActionIds    []string `json:"action_ids,omitempty"` //only in v2 api
	CreatedAt    string   `json:"created_at,omitempty"` //only in v2 api
}

type ImagesResp

type ImagesResp struct {
	Images []Image
}

type Region added in v0.4.0

type Region struct {
	Id        uint     `json:"id,omitempty"`        //only in v1 api
	Slug      string   `json:"slug"`                //presen in both api
	Name      string   `json:"name"`                //presen in both api
	Sizes     []string `json:"sizes,omitempty"`     //only in v2 api
	Available bool     `json:"available,omitempty"` //only in v2 api
	Features  []string `json:"features,omitempty"`  //only in v2 api
}

type RegionsResp added in v0.4.0

type RegionsResp struct {
	Regions []Region
}

type Size added in v0.6.0

type Size struct {
	Id           uint     `json:"id,omitempty"`            //only in v1 api
	Name         string   `json:"name,omitempty"`          //only in v1 api
	Slug         string   `json:"slug"`                    //presen in both api
	Memory       uint     `json:"memory,omitempty"`        //only in v2 api
	VCPUS        uint     `json:"vcpus,omitempty"`         //only in v2 api
	Disk         uint     `json:"disk,omitempty"`          //only in v2 api
	Transfer     float64  `json:"transfer,omitempty"`      //only in v2 api
	PriceMonthly float64  `json:"price_monthly,omitempty"` //only in v2 api
	PriceHourly  float64  `json:"price_hourly,omitempty"`  //only in v2 api
	Regions      []string `json:"regions,omitempty"`       //only in v2 api
}

type SizesResp added in v0.6.0

type SizesResp struct {
	Sizes []Size
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL