Skip to content

Commit

Permalink
Merge pull request digitalocean#111 from digitalocean/bugfix/image-root
Browse files Browse the repository at this point in the history
Object roots should use a pointer to be consistent.
  • Loading branch information
phillbaker authored Nov 23, 2016
2 parents c3a2aad + 32a0d37 commit 5c91372
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 20 deletions.
4 changes: 2 additions & 2 deletions action.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ type actionsRoot struct {
}

type actionRoot struct {
Event Action `json:"action"`
Event *Action `json:"action"`
}

// Action represents a DigitalOcean Action
Expand Down Expand Up @@ -92,7 +92,7 @@ func (s *ActionsServiceOp) Get(id int) (*Action, *Response, error) {
return nil, resp, err
}

return &root.Event, resp, err
return root.Event, resp, err
}

func (a Action) String() string {
Expand Down
6 changes: 3 additions & 3 deletions droplet_actions.go
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ func (s *DropletActionsServiceOp) doAction(id int, request *ActionRequest) (*Act
return nil, resp, err
}

return &root.Event, resp, err
return root.Event, resp, err
}

func (s *DropletActionsServiceOp) doActionByTag(tag string, request *ActionRequest) (*Action, *Response, error) {
Expand All @@ -281,7 +281,7 @@ func (s *DropletActionsServiceOp) doActionByTag(tag string, request *ActionReque
return nil, resp, err
}

return &root.Event, resp, err
return root.Event, resp, err
}

// Get an action for a particular droplet by id.
Expand Down Expand Up @@ -321,7 +321,7 @@ func (s *DropletActionsServiceOp) get(path string) (*Action, *Response, error) {
return nil, resp, err
}

return &root.Event, resp, err
return root.Event, resp, err

}

Expand Down
4 changes: 2 additions & 2 deletions floating_ips_actions.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func (s *FloatingIPActionsServiceOp) doAction(ip string, request *ActionRequest)
return nil, resp, err
}

return &root.Event, resp, err
return root.Event, resp, err
}

func (s *FloatingIPActionsServiceOp) get(path string) (*Action, *Response, error) {
Expand All @@ -79,7 +79,7 @@ func (s *FloatingIPActionsServiceOp) get(path string) (*Action, *Response, error
return nil, resp, err
}

return &root.Event, resp, err
return root.Event, resp, err
}

func (s *FloatingIPActionsServiceOp) list(path string) ([]Action, *Response, error) {
Expand Down
4 changes: 2 additions & 2 deletions image_actions.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func (i *ImageActionsServiceOp) Transfer(imageID int, transferRequest *ActionReq
return nil, resp, err
}

return &root.Event, resp, err
return root.Event, resp, err
}

// Get an action for a particular image by id.
Expand All @@ -67,5 +67,5 @@ func (i *ImageActionsServiceOp) Get(imageID, actionID int) (*Action, *Response,
return nil, resp, err
}

return &root.Event, resp, err
return root.Event, resp, err
}
6 changes: 3 additions & 3 deletions images.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ type ImageUpdateRequest struct {
}

type imageRoot struct {
Image Image
Image *Image
}

type imagesRoot struct {
Expand Down Expand Up @@ -125,7 +125,7 @@ func (s *ImagesServiceOp) Update(imageID int, updateRequest *ImageUpdateRequest)
return nil, resp, err
}

return &root.Image, resp, err
return root.Image, resp, err
}

// Delete an image.
Expand Down Expand Up @@ -161,7 +161,7 @@ func (s *ImagesServiceOp) get(ID interface{}) (*Image, *Response, error) {
return nil, resp, err
}

return &root.Image, resp, err
return root.Image, resp, err
}

// Helper method for listing images
Expand Down
10 changes: 5 additions & 5 deletions keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ type keysRoot struct {
}

type keyRoot struct {
SSHKey Key `json:"ssh_key"`
SSHKey *Key `json:"ssh_key"`
}

func (s Key) String() string {
Expand Down Expand Up @@ -96,7 +96,7 @@ func (s *KeysServiceOp) get(path string) (*Key, *Response, error) {
return nil, resp, err
}

return &root.SSHKey, resp, err
return root.SSHKey, resp, err
}

// GetByID gets a Key by id
Expand Down Expand Up @@ -136,7 +136,7 @@ func (s *KeysServiceOp) Create(createRequest *KeyCreateRequest) (*Key, *Response
return nil, resp, err
}

return &root.SSHKey, resp, err
return root.SSHKey, resp, err
}

// UpdateByID updates a key name by ID.
Expand All @@ -161,7 +161,7 @@ func (s *KeysServiceOp) UpdateByID(keyID int, updateRequest *KeyUpdateRequest) (
return nil, resp, err
}

return &root.SSHKey, resp, err
return root.SSHKey, resp, err
}

// UpdateByFingerprint updates a key name by fingerprint.
Expand All @@ -186,7 +186,7 @@ func (s *KeysServiceOp) UpdateByFingerprint(fingerprint string, updateRequest *K
return nil, resp, err
}

return &root.SSHKey, resp, err
return root.SSHKey, resp, err
}

// Delete key using a path
Expand Down
2 changes: 1 addition & 1 deletion regions.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ type regionsRoot struct {
}

type regionRoot struct {
Region Region
Region *Region
}

func (r Region) String() string {
Expand Down
4 changes: 2 additions & 2 deletions storage_actions.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ func (s *StorageActionsServiceOp) doAction(volumeID string, request *ActionReque
return nil, resp, err
}

return &root.Event, resp, err
return root.Event, resp, err
}

func (s *StorageActionsServiceOp) get(path string) (*Action, *Response, error) {
Expand All @@ -108,7 +108,7 @@ func (s *StorageActionsServiceOp) get(path string) (*Action, *Response, error) {
return nil, resp, err
}

return &root.Event, resp, err
return root.Event, resp, err
}

func (s *StorageActionsServiceOp) list(path string) ([]Action, *Response, error) {
Expand Down

0 comments on commit 5c91372

Please sign in to comment.