Example #1
0
func Add(cmd *cli.Cmd) {

	identifier := cmd.String(cli.StringArg{
		Name:      "LOCATION",
		Desc:      "location to be added to your current role(i.e. us-east-1)",
		HideValue: true,
	})

	cmd.Action = func() {
		l := pools.Location{}
		l.Identifier = *identifier

		location, resp, errs := l.Create()

		if len(errs) > 0 {
			log.Fatalf("Could not add new location: %s", errs)
		}

		if resp.StatusCode != 201 {
			log.Fatalf("Cloud not add new location: %s", resp.Status)
		}

		PrintLocationBrief([]pools.Location{*location}, false)
	}
}