Skip to content

Commit

Permalink
Merge pull request #353 from mchitten/feature/projects-api
Browse files Browse the repository at this point in the history
projects API support
  • Loading branch information
mchitten authored Oct 16, 2018
2 parents 2af73d3 + 06ab2cc commit e06eddd
Show file tree
Hide file tree
Showing 140 changed files with 3,924 additions and 1,403 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

All changes to `doctl` will be documented in this file.

## [1.11.0] - 2018-10-01

- #348 Add support for projects API [beta] - @mchitten

## [1.10.0] - 2018-10-01

- #348 Add support for tagging Images. - @hugocorbucci
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM alpine:3.5

ENV DOCTL_VERSION=1.10.0
ENV DOCTL_VERSION=1.11.0

RUN apk add --no-cache curl

Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,25 +58,25 @@ For example, with `wget`:

```
cd ~
wget https://github.com/digitalocean/doctl/releases/download/v1.10.0/doctl-1.10.0-linux-amd64.tar.gz
wget https://github.com/digitalocean/doctl/releases/download/v1.11.0/doctl-1.11.0-linux-amd64.tar.gz
```

Or with `curl`:

```
cd ~
curl -OL https://github.com/digitalocean/doctl/releases/download/v1.10.0/doctl-1.10.0-linux-amd64.tar.gz
curl -OL https://github.com/digitalocean/doctl/releases/download/v1.11.0/doctl-1.11.0-linux-amd64.tar.gz
```

Extract the binary. On GNU/Linux or OS X systems, you can use `tar`.

```
tar xf ~/doctl-1.10.0-linux-amd64.tar.gz
tar xf ~/doctl-1.11.0-linux-amd64.tar.gz
```

Or download and extract with this oneliner:
```
curl -sL https://github.com/digitalocean/doctl/releases/download/v1.10.0/doctl-1.10.0-linux-amd64.tar.gz | tar -xzv
curl -sL https://github.com/digitalocean/doctl/releases/download/v1.11.0/doctl-1.11.0-linux-amd64.tar.gz | tar -xzv
```

On Windows systems, you should be able to double-click the zip archive to extract the `doctl` executable.
Expand Down
15 changes: 14 additions & 1 deletion args.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright 2016 The Doctl Authors All rights reserved.
Copyright 2018 The Doctl Authors All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
Expand Down Expand Up @@ -187,6 +187,19 @@ const (
// ArgOutboundRules is a list of outbound rules for the firewall.
ArgOutboundRules = "outbound-rules"

// ArgProjectName is the name of a project.
ArgProjectName = "name"
// ArgProjectDescription is the description of a project.
ArgProjectDescription = "description"
// ArgProjectPurpose is the purpose of a project.
ArgProjectPurpose = "purpose"
// ArgProjectEnvironment is the environment of a project. Should be one of 'Development', 'Staging', 'Production'.
ArgProjectEnvironment = "environment"
// ArgProjectIsDefault is used to change the default project.
ArgProjectIsDefault = "is_default"
// ArgProjectResource is a flag for your resource URNs
ArgProjectResource = "resource"

// ArgForce forces confirmation on actions
ArgForce = "force"
)
2 changes: 1 addition & 1 deletion args_short.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright 2016 The Doctl Authors All rights reserved.
Copyright 2018 The Doctl Authors All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
Expand Down
2 changes: 1 addition & 1 deletion cmd/doctl-gen-doc/main.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright 2016 The Doctl Authors All rights reserved.
Copyright 2018 The Doctl Authors All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
Expand Down
2 changes: 1 addition & 1 deletion cmd/doctl/main.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright 2016 The Doctl Authors All rights reserved.
Copyright 2018 The Doctl Authors All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
Expand Down
2 changes: 1 addition & 1 deletion cmd/install-doctl/main.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright 2016 The Doctl Authors All rights reserved.
Copyright 2018 The Doctl Authors All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
Expand Down
2 changes: 1 addition & 1 deletion cmd/release-doctl/main.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright 2016 The Doctl Authors All rights reserved.
Copyright 2018 The Doctl Authors All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
Expand Down
2 changes: 1 addition & 1 deletion command.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright 2016 The Doctl Authors All rights reserved.
Copyright 2018 The Doctl Authors All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
Expand Down
15 changes: 9 additions & 6 deletions commands/account.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright 2016 The Doctl Authors All rights reserved.
Copyright 2018 The Doctl Authors All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
Expand All @@ -13,7 +13,10 @@ limitations under the License.

package commands

import "github.com/spf13/cobra"
import (
"github.com/digitalocean/doctl/commands/displayers"
"github.com/spf13/cobra"
)

// Account creates the account commands heirarchy.
func Account() *Command {
Expand All @@ -28,10 +31,10 @@ func Account() *Command {
}

CmdBuilder(cmd, RunAccountGet, "get", "get account", Writer,
aliasOpt("g"), displayerType(&account{}), docCategories("account"))
aliasOpt("g"), displayerType(&displayers.Account{}), docCategories("account"))

CmdBuilder(cmd, RunAccountRateLimit, "ratelimit", "get API rate limits", Writer,
aliasOpt("rl"), displayerType(&rateLimit{}), docCategories("account"))
aliasOpt("rl"), displayerType(&displayers.RateLimit{}), docCategories("account"))

return cmd
}
Expand All @@ -43,7 +46,7 @@ func RunAccountGet(c *CmdConfig) error {
return err
}

return c.Display(&account{Account: a})
return c.Display(&displayers.Account{Account: a})
}

// RunAccountRateLimit retrieves API rate limits for the account.
Expand All @@ -53,5 +56,5 @@ func RunAccountRateLimit(c *CmdConfig) error {
return err
}

return c.Display(&rateLimit{RateLimit: rl})
return c.Display(&displayers.RateLimit{RateLimit: rl})
}
2 changes: 1 addition & 1 deletion commands/account_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright 2016 The Doctl Authors All rights reserved.
Copyright 2018 The Doctl Authors All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
Expand Down
15 changes: 8 additions & 7 deletions commands/actions.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright 2016 The Doctl Authors All rights reserved.
Copyright 2018 The Doctl Authors All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
Expand All @@ -19,6 +19,7 @@ import (
"time"

"github.com/digitalocean/doctl"
"github.com/digitalocean/doctl/commands/displayers"
"github.com/digitalocean/doctl/do"
"github.com/spf13/cobra"
)
Expand All @@ -36,10 +37,10 @@ func Actions() *Command {
}

CmdBuilder(cmd, RunCmdActionGet, "get <action-id>", "get action", Writer,
aliasOpt("g"), displayerType(&action{}), docCategories("action"))
aliasOpt("g"), displayerType(&displayers.Action{}), docCategories("action"))

cmdActionList := CmdBuilder(cmd, RunCmdActionList, "list", "list actions", Writer,
aliasOpt("ls"), displayerType(&action{}), docCategories("action"))
aliasOpt("ls"), displayerType(&displayers.Action{}), docCategories("action"))
AddStringFlag(cmdActionList, doctl.ArgActionResourceType, "", "", "Action resource type")
AddStringFlag(cmdActionList, doctl.ArgActionRegion, "", "", "Action region")
AddStringFlag(cmdActionList, doctl.ArgActionAfter, "", "", "Action completed after in RFC3339 format")
Expand All @@ -48,7 +49,7 @@ func Actions() *Command {
AddStringFlag(cmdActionList, doctl.ArgActionType, "", "", "Action type")

cmdActionWait := CmdBuilder(cmd, RunCmdActionWait, "wait <action-id>", "wait for action to complete", Writer,
aliasOpt("w"), displayerType(&action{}), docCategories("action"))
aliasOpt("w"), displayerType(&displayers.Action{}), docCategories("action"))
AddIntFlag(cmdActionWait, doctl.ArgPollTime, "", 5, "Re-poll time in seconds")

return cmd
Expand All @@ -68,7 +69,7 @@ func RunCmdActionList(c *CmdConfig) error {

sort.Sort(actionsByCompletedAt(actions))

item := &action{actions: actions}
item := &displayers.Action{Actions: actions}
return c.Display(item)
}

Expand Down Expand Up @@ -190,7 +191,7 @@ func RunCmdActionGet(c *CmdConfig) error {
return err
}

return c.Display(&action{actions: do.Actions{*a}})
return c.Display(&displayers.Action{Actions: do.Actions{*a}})
}

// RunCmdActionWait waits for an action to complete or error.
Expand All @@ -214,7 +215,7 @@ func RunCmdActionWait(c *CmdConfig) error {
return err
}

return c.Display(&action{actions: do.Actions{*a}})
return c.Display(&displayers.Action{Actions: do.Actions{*a}})
}

func actionWait(c *CmdConfig, actionID, pollTime int) (*do.Action, error) {
Expand Down
2 changes: 1 addition & 1 deletion commands/actions_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright 2016 The Doctl Authors All rights reserved.
Copyright 2018 The Doctl Authors All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
Expand Down
2 changes: 1 addition & 1 deletion commands/auth.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright 2016 The Doctl Authors All rights reserved.
Copyright 2018 The Doctl Authors All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
Expand Down
2 changes: 1 addition & 1 deletion commands/auth_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright 2016 The Doctl Authors All rights reserved.
Copyright 2018 The Doctl Authors All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
Expand Down
17 changes: 9 additions & 8 deletions commands/cdns.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
"fmt"

"github.com/digitalocean/doctl"
"github.com/digitalocean/doctl/commands/displayers"
"github.com/digitalocean/doctl/do"
"github.com/digitalocean/godo"
"github.com/spf13/cobra"
Expand All @@ -34,21 +35,21 @@ func CDN() *Command {
}

CmdBuilder(cmd, RunCDNList, "list", "list cdn", Writer,
aliasOpt("ls"), displayerType(&cdn{}))
aliasOpt("ls"), displayerType(&displayers.CDN{}))

cmdCDNCreate := CmdBuilder(cmd, RunCDNCreate, "create <cdn-origin>", "create a cdn", Writer,
aliasOpt("c"), displayerType(&cdn{}))
aliasOpt("c"), displayerType(&displayers.CDN{}))
AddIntFlag(cmdCDNCreate, doctl.ArgCDNTTL, "", 3600, "CDN ttl")

cmdRunCDNDelete := CmdBuilder(cmd, RunCDNDelete, "delete <cdn-id>", "delete a cdn", Writer,
aliasOpt("rm"))
AddBoolFlag(cmdRunCDNDelete, doctl.ArgForce, doctl.ArgShortForce, false, "Force cdn delete")

CmdBuilder(cmd, RunCDNGet, "get <cdn-id>", "get a cdn", Writer, aliasOpt("g"),
displayerType(&cdn{}))
displayerType(&displayers.CDN{}))

cmdCDNUpdate := CmdBuilder(cmd, RunCDNUpdateTTL, "update <cdn-id>", "update a cdn", Writer,
aliasOpt("u"), displayerType(&cdn{}))
aliasOpt("u"), displayerType(&displayers.CDN{}))
AddIntFlag(cmdCDNUpdate, doctl.ArgCDNTTL, "", 3600, "cdn ttl")

cmdCDNFlushCache := CmdBuilder(cmd, RunCDNFlushCache, "flush <cdn-id>", "flush cdn cache", Writer,
Expand All @@ -65,7 +66,7 @@ func RunCDNList(c *CmdConfig) error {
return err
}

return c.Display(&cdn{cdns: cdns})
return c.Display(&displayers.CDN{CDNs: cdns})
}

// RunCDNGet returns an individual CDN.
Expand All @@ -80,7 +81,7 @@ func RunCDNGet(c *CmdConfig) error {
return err
}

return c.Display(&cdn{cdns: []do.CDN{*item}})
return c.Display(&displayers.CDN{CDNs: []do.CDN{*item}})
}

// RunCDNCreate creates a cdn.
Expand Down Expand Up @@ -109,7 +110,7 @@ func RunCDNCreate(c *CmdConfig) error {
return err
}

return c.Display(&cdn{cdns: []do.CDN{*item}})
return c.Display(&displayers.CDN{CDNs: []do.CDN{*item}})
}

// RunCDNUpdateTTL updates an individual cdn ttl
Expand Down Expand Up @@ -137,7 +138,7 @@ func RunCDNUpdateTTL(c *CmdConfig) error {
return err
}

return c.Display(&cdn{cdns: []do.CDN{*item}})
return c.Display(&displayers.CDN{CDNs: []do.CDN{*item}})
}

// RunCDNDelete deletes a cdn.
Expand Down
9 changes: 5 additions & 4 deletions commands/certificates.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright 2017 The Doctl Authors All rights reserved.
Copyright 2018 The Doctl Authors All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
Expand All @@ -18,6 +18,7 @@ import (
"io/ioutil"

"github.com/digitalocean/doctl"
"github.com/digitalocean/doctl/commands/displayers"
"github.com/digitalocean/doctl/do"
"github.com/digitalocean/godo"

Expand Down Expand Up @@ -65,7 +66,7 @@ func RunCertificateGet(c *CmdConfig) error {
return err
}

item := &certificate{certificates: do.Certificates{*cer}}
item := &displayers.Certificate{Certificates: do.Certificates{*cer}}
return c.Display(item)
}

Expand Down Expand Up @@ -140,7 +141,7 @@ func RunCertificateCreate(c *CmdConfig) error {
return err
}

item := &certificate{certificates: do.Certificates{*cer}}
item := &displayers.Certificate{Certificates: do.Certificates{*cer}}
return c.Display(item)
}

Expand All @@ -152,7 +153,7 @@ func RunCertificateList(c *CmdConfig) error {
return err
}

item := &certificate{certificates: list}
item := &displayers.Certificate{Certificates: list}
return c.Display(item)
}

Expand Down
2 changes: 1 addition & 1 deletion commands/command.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright 2016 The Doctl Authors All rights reserved.
Copyright 2018 The Doctl Authors All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
Expand Down
Loading

0 comments on commit e06eddd

Please sign in to comment.