Skip to content

Commit

Permalink
Merge pull request digitalocean#8 from digitalocean/userdata
Browse files Browse the repository at this point in the history
Update Go API client to be closer to API spec
  • Loading branch information
aybabtme committed Oct 16, 2014
2 parents 1c064ed + e1fc58d commit 5478aae
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 7 deletions.
14 changes: 9 additions & 5 deletions droplets.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,15 @@ type dropletsRoot struct {

// DropletCreateRequest represents a request to create a droplet.
type DropletCreateRequest struct {
Name string `json:"name"`
Region string `json:"region"`
Size string `json:"size"`
Image string `json:"image"`
SSHKeys []interface{} `json:"ssh_keys"`
Name string `json:"name"`
Region string `json:"region"`
Size string `json:"size"`
Image string `json:"image"`
SSHKeys []interface{} `json:"ssh_keys"`
Backups bool `json:"backups"`
IPv6 bool `json:"ipv6"`
PrivateNetworking bool `json:"private_networking"`
UserData string `json:"user_data"`
}

func (d DropletCreateRequest) String() string {
Expand Down
5 changes: 4 additions & 1 deletion godo_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,10 @@ func TestNewRequest(t *testing.T) {
c := NewClient(nil)

inURL, outURL := "/foo", defaultBaseURL+"foo"
inBody, outBody := &DropletCreateRequest{Name: "l"}, `{"name":"l","region":"","size":"","image":"","ssh_keys":null}`+"\n"
inBody, outBody := &DropletCreateRequest{Name: "l"},
`{"name":"l","region":"","size":"","image":"",`+
`"ssh_keys":null,"backups":false,"ipv6":false,`+
`"private_networking":false,"user_data":""}`+"\n"
req, _ := c.NewRequest("GET", inURL, inBody)

// test relative URL was expanded
Expand Down
2 changes: 1 addition & 1 deletion links.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func (p *Pages) current() (int, error) {

// IsLastPage returns true if the current page is the last
func (l *Links) IsLastPage() bool {
if l == nil {
if l.Pages == nil {
return true
}
return l.Pages.isLast()
Expand Down
1 change: 1 addition & 0 deletions regions.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ type Region struct {
Name string `json:"name,omitempty"`
Sizes []string `json:"sizes,omitempty"`
Available bool `json:"available,omitempty`
Features []string `json:"features,omitempty`
}

type regionsRoot struct {
Expand Down

0 comments on commit 5478aae

Please sign in to comment.