Skip to content

Commit

Permalink
Merge pull request #185 from mchitten/feature/projects-api
Browse files Browse the repository at this point in the history
add projects support [beta]
  • Loading branch information
mchitten authored Oct 16, 2018
2 parents b3d0928 + 0f1b9ca commit d29fc3d
Show file tree
Hide file tree
Showing 11 changed files with 956 additions and 5 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Change Log

## [v1.6.0] - 2018-10-16

- #185 Projects support [beta] - @mchitten

## [v1.5.0] - 2018-10-01

- #181 Adding tagging images support - @hugocorbucci
Expand Down
4 changes: 4 additions & 0 deletions domains.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,10 @@ func (d Domain) String() string {
return Stringify(d)
}

func (d Domain) URN() string {
return ToURN("Domain", d.Name)
}

// List all domains.
func (s DomainsServiceOp) List(ctx context.Context, opt *ListOptions) ([]Domain, *Response, error) {
path := domainsBasePath
Expand Down
4 changes: 4 additions & 0 deletions droplets.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,10 @@ func (d Droplet) String() string {
return Stringify(d)
}

func (d Droplet) URN() string {
return ToURN("Droplet", d.ID)
}

// DropletRoot represents a Droplet root
type dropletRoot struct {
Droplet *Droplet `json:"droplet"`
Expand Down
4 changes: 4 additions & 0 deletions firewalls.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ func (fw Firewall) String() string {
return Stringify(fw)
}

func (fw Firewall) URN() string {
return ToURN("Firewall", fw.ID)
}

// FirewallRequest represents the configuration to be applied to an existing or a new Firewall.
type FirewallRequest struct {
Name string `json:"name"`
Expand Down
4 changes: 4 additions & 0 deletions floating_ips.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ func (f FloatingIP) String() string {
return Stringify(f)
}

func (f FloatingIP) URN() string {
return ToURN("FloatingIP", f.IP)
}

type floatingIPsRoot struct {
FloatingIPs []FloatingIP `json:"floating_ips"`
Links *Links `json:"links"`
Expand Down
12 changes: 7 additions & 5 deletions godo.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
)

const (
libraryVersion = "1.5.0"
libraryVersion = "1.6.0"
defaultBaseURL = "https://api.digitalocean.com/"
userAgent = "godo/" + libraryVersion
mediaType = "application/json"
Expand Down Expand Up @@ -64,6 +64,7 @@ type Client struct {
LoadBalancers LoadBalancersService
Certificates CertificatesService
Firewalls FirewallsService
Projects ProjectsService

// Optional function called after every successful request made to the DO APIs
onRequestCompleted RequestCompletionCallback
Expand Down Expand Up @@ -159,23 +160,24 @@ func NewClient(httpClient *http.Client) *Client {
c.Account = &AccountServiceOp{client: c}
c.Actions = &ActionsServiceOp{client: c}
c.CDNs = &CDNServiceOp{client: c}
c.Certificates = &CertificatesServiceOp{client: c}
c.Domains = &DomainsServiceOp{client: c}
c.Droplets = &DropletsServiceOp{client: c}
c.DropletActions = &DropletActionsServiceOp{client: c}
c.Firewalls = &FirewallsServiceOp{client: c}
c.FloatingIPs = &FloatingIPsServiceOp{client: c}
c.FloatingIPActions = &FloatingIPActionsServiceOp{client: c}
c.Images = &ImagesServiceOp{client: c}
c.ImageActions = &ImageActionsServiceOp{client: c}
c.Keys = &KeysServiceOp{client: c}
c.LoadBalancers = &LoadBalancersServiceOp{client: c}
c.Projects = &ProjectsServiceOp{client: c}
c.Regions = &RegionsServiceOp{client: c}
c.Snapshots = &SnapshotsServiceOp{client: c}
c.Sizes = &SizesServiceOp{client: c}
c.Snapshots = &SnapshotsServiceOp{client: c}
c.Storage = &StorageServiceOp{client: c}
c.StorageActions = &StorageActionsServiceOp{client: c}
c.Tags = &TagsServiceOp{client: c}
c.LoadBalancers = &LoadBalancersServiceOp{client: c}
c.Certificates = &CertificatesServiceOp{client: c}
c.Firewalls = &FirewallsServiceOp{client: c}

return c
}
Expand Down
4 changes: 4 additions & 0 deletions load_balancers.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ func (l LoadBalancer) String() string {
return Stringify(l)
}

func (l LoadBalancer) URN() string {
return ToURN("LoadBalancer", l.ID)
}

// AsRequest creates a LoadBalancerRequest that can be submitted to Update with the current values of the LoadBalancer.
// Modifying the returned LoadBalancerRequest will not modify the original LoadBalancer.
func (l LoadBalancer) AsRequest() *LoadBalancerRequest {
Expand Down
Loading

0 comments on commit d29fc3d

Please sign in to comment.