diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..ab24d56 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,89 @@ +# Contributing + +Development is set up for Unix/Linux/Mac systems. Some of the +instructions below may not work properly on Windows. + +### Preparing an environment + +* [Install Go](https://golang.org/). +* Install Godep: `go get github.com/tools/godep`. +* Clone this repo (do **not** use `go get`). +* [Ensure your $GOPATH is set correctly](http://golang.org/cmd/go/#hdr-GOPATH_environment_variable). Working in a clean environment without any other packages on $GOPATH is highly encouraged to avoid conflicts with the dependencies of the tool. Using a [gvm tool](https://github.com/moovweb/gvm) is a good choice for setting up a clean environment. Also, gvm is a convenient tool for installing cross-compilation prerequisites. +* Install dependencies with Godep: enter the repo's root and `godep restore`. +* Install go vet: `go get code.google.com/p/go.tools/cmd/vet`. + +### Developing + +* The TDD approach is recommended - write a failing test first, then fix it. + +* Use a `dev` script to run commands as you change the code: + + ``` + ./dev + ``` + + This way you do not need to rebuild the tool every time you alter something. + +* Before making a pull request check that `gofmt -d=true ./..` and `go vet ./...` do not produce any output (except for that coming from `Godeps/_workspace` - ignore it). + +* Do not commit until the unit tests have passed (`./run_tests`). + +* If you want to make an executable, simply run `./scripts/build`. The binary will appear in the `./out` folder. + +* The integration tests can be running `./run_integration_tests`. + +* The API file can be regenerated by running `./scripts/generate_api`. + +* Pull requests should be made against the development branch. + +### Building the releases + +Generally, any Linux/Darwin machine should work for building the releases. A Darwin machine is required though if you want to build a `MacOS .pkg`. + +* Install [gvm](https://github.com/moovweb/gvm) + +* Install the cross-compilation prerequisites: + +``` +./scripts/install_platform_commands +``` + +* Build the releases: + +``` +./scripts/build_releases +``` + +At first, the script updates `base/constants.go` with the given version. This is needed for the tool to use the relevant user agent information. After that, the script builds a binary for each of the following OS/arch flavors: + +- Linux/amd4 +- Windows/amd64 +- MacOS/amd64 + +The binaries are packaged along with utility scripts as described in the [Install](#install-it) section. The folders are then archived - a `.tar.gz` file is made for Linux and Mac; a `.zip` file is made for Windows. + +Here is a full list of the created artifacts: + +* `clc-$version-linux-amd64/` +* `clc-$version-linux-amd64.tar.gz` +* `clc-$version-darwin-amd64` +* `clc-$version-darwin-amd64.tar.gz` +* `clc-$version-windows-amd64/` +* `clc-$version-windows-amd64.zip` + +#### Building a .pkg for MacOS + +* Build a regular MacOS release using the command from the previous section + +* Execute the following script to build a `.pkg` file: + +``` +./scripts/build_darwin_pkg +``` + +**Note:** the version has to match the version you specified in the previous section. + +You should see 2 artifacts after executing this script: + +* `clc-$version-pkg` +* `clc-$version.pkg` diff --git a/README.md b/README.md index 381afce..5218157 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,12 @@ # CenturyLink Cloud CLI -This is the Command Line Interface (CLI) for the CenturyLink Cloud. +This is the Command Line Interface (CLI) for the CenturyLink Cloud. It runs on MacOS, Linux and Windows. ## Getting Started ### Download the tool -Click a link below to download the latest release for each OS. - -[MacOS tar.gz](https://github.com/CenturyLinkCloud/clc-go-cli/releases/download/2016-07-21/clc-2016-07-21-darwin-amd64.tar.gz) | [MacOS pkg](https://github.com/CenturyLinkCloud/clc-go-cli/releases/download/2016-07-21/clc-2016-07-21.pkg) | [Linux tar.gz](https://github.com/CenturyLinkCloud/clc-go-cli/releases/download/2016-07-21/clc-2016-07-21-linux-amd64.tar.gz) | [Windows zip](https://github.com/CenturyLinkCloud/clc-go-cli/releases/download/2016-07-21/clc-2016-07-21-windows-amd64.zip) - -**Note:** You can see previous releases and release notes on the [releases page](https://github.com/CenturyLinkCloud/clc-go-cli/releases). +The latest version of the CLI can be downloaded from the [releases page](https://github.com/CenturyLinkCloud/clc-go-cli/releases). ### Install it @@ -286,94 +282,6 @@ Explore the available resources, commands, options and other useful guidance usi The documentation of the underlying HTTP API can be found [here](https://www.ctl.io/api-docs/v2/). -## Contributing - -Development is set up for Unix/Linux/Mac systems. Some of the -instructions below may not work properly on Windows. - -### Preparing an environment - -* [Install Go](https://golang.org/). -* Install Godep: `go get github.com/tools/godep`. -* Clone this repo (do **not** use `go get`). -* [Ensure your $GOPATH is set correctly](http://golang.org/cmd/go/#hdr-GOPATH_environment_variable). Working in a clean environment without any other packages on $GOPATH is highly encouraged to avoid conflicts with the dependencies of the tool. Using a [gvm tool](https://github.com/moovweb/gvm) is a good choice for setting up a clean environment. Also, gvm is a convenient tool for installing cross-compilation prerequisites. -* Install dependencies with Godep: enter the repo's root and `godep restore`. -* Install go vet: `go get code.google.com/p/go.tools/cmd/vet`. - -### Developing - -* The TDD approach is recommended - write a failing test first, then fix it. - -* Use a `dev` script to run commands as you change the code: - - ``` - ./dev - ``` - - This way you do not need to rebuild the tool every time you alter something. - -* Before making a pull request check that `gofmt -d=true ./..` and `go vet ./...` do not produce any output (except for that coming from `Godeps/_workspace` - ignore it). - -* Do not commit until the unit tests have passed (`./run_tests`). - -* If you want to make an executable, simply run `./scripts/build`. The binary will appear in the `./out` folder. - -* The integration tests can be running `./run_integration_tests`. - -* The API file can be regenerated by running `./scripts/generate_api`. - -### Building the releases - -Generally, any Linux/Darwin machine should work for building the releases. A Darwin machine is required though if you want to build a `MacOS .pkg`. - -* Install [gvm](https://github.com/moovweb/gvm) - -* Install the cross-compilation prerequisites: - -``` -./scripts/install_platform_commands -``` - -* Build the releases: - -``` -./scripts/build_releases -``` - -At first, the script updates `base/constants.go` with the given version. This is needed for the tool to use the relevant user agent information. After that, the script builds a binary for each of the following OS/arch flavors: - -- Linux/amd4 -- Windows/amd64 -- MacOS/amd64 - -The binaries are packaged along with utility scripts as described in the [Install](#install-it) section. The folders are then archived - a `.tar.gz` file is made for Linux and Mac; a `.zip` file is made for Windows. - -Here is a full list of the created artifacts: - -* `clc-$version-linux-amd64/` -* `clc-$version-linux-amd64.tar.gz` -* `clc-$version-darwin-amd64` -* `clc-$version-darwin-amd64.tar.gz` -* `clc-$version-windows-amd64/` -* `clc-$version-windows-amd64.zip` - -#### Building a .pkg for MacOS - -* Build a regular MacOS release using the command from the previous section - -* Execute the following script to build a `.pkg` file: - -``` -./scripts/build_darwin_pkg -``` - -**Note:** the version has to match the version you specified in the previous section. - -You should see 2 artifacts after executing this script: - -* `clc-$version-pkg` -* `clc-$version.pkg` - ## Security The CenturyLink Cloud Go CLI leverages our public API that serves all requests over HTTPS. Therefore credentials are encrypted when being transfered. Credentials stored on the local machine in the config.yml are not encrypted during installation and you are encouraged to use industry standard encryption tools in order to provide additional protection for them. diff --git a/models/network/list_ip_addresses.go b/models/network/list_ip_addresses.go index 58c9526..3a4d5fd 100644 --- a/models/network/list_ip_addresses.go +++ b/models/network/list_ip_addresses.go @@ -1,7 +1,6 @@ package network type ListIpAddresses struct { - DataCenter string `valid:"required" URIParam:"yes"` - Network string `valid:"required" URIParam:"yes"` - Type string `URIParam:"yes" oneOf:"claimed,free,all"` + Network `argument:"composed" URIParam:"NetworkId,DataCenter" json:"-"` + Type string `URIParam:"yes" oneOf:"claimed,free,all,optional"` }