You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by sv...@apache.org on 2016/10/25 19:10:55 UTC

[01/19] brooklyn-client git commit: fix import paths

Repository: brooklyn-client
Updated Branches:
  refs/heads/master ed158fdc0 -> 5dd174649


fix import paths


Project: http://git-wip-us.apache.org/repos/asf/brooklyn-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-client/commit/7db8e15d
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-client/tree/7db8e15d
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-client/diff/7db8e15d

Branch: refs/heads/master
Commit: 7db8e15d85cc4c8f3cc8f4a7c63e1803da4665bd
Parents: ff8224c
Author: Geoff Macartney <ge...@cloudsoftcorp.com>
Authored: Tue Oct 11 16:51:24 2016 +0100
Committer: Geoff Macartney <ge...@cloudsoftcorp.com>
Committed: Tue Oct 11 16:51:24 2016 +0100

----------------------------------------------------------------------
 cli/api/access_control/access_control.go   |  4 ++--
 cli/api/activities/activities.go           |  4 ++--
 cli/api/application/applications.go        |  4 ++--
 cli/api/catalog/catalog.go                 |  4 ++--
 cli/api/entities/entities.go               |  4 ++--
 cli/api/entity_config/config.go            |  4 ++--
 cli/api/entity_effectors/effectors.go      |  4 ++--
 cli/api/entity_policies/policies.go        |  4 ++--
 cli/api/entity_policy_config/config.go     |  4 ++--
 cli/api/entity_sensors/sensors.go          |  4 ++--
 cli/api/locations/locations.go             |  4 ++--
 cli/api/server/server.go                   |  2 +-
 cli/api/usage/usage.go                     |  4 ++--
 cli/api/version/version.go                 |  4 ++--
 cli/app/app.go                             |  6 +++---
 cli/br/brooklyn.go                         | 14 +++++++-------
 cli/command/command.go                     |  4 ++--
 cli/command_factory/factory.go             | 10 +++++-----
 cli/command_runner/runner.go               |  4 ++--
 cli/commands/access.go                     | 10 +++++-----
 cli/commands/activity-stream.go            | 10 +++++-----
 cli/commands/activity.go                   | 16 ++++++++--------
 cli/commands/add-catalog.go                | 10 +++++-----
 cli/commands/add-children.go               | 12 ++++++------
 cli/commands/add-location.go               |  2 +-
 cli/commands/add-policy.go                 |  8 ++++----
 cli/commands/application.go                | 18 +++++++++---------
 cli/commands/catalog-applications.go       |  2 +-
 cli/commands/catalog-entities.go           |  2 +-
 cli/commands/catalog-entity.go             |  2 +-
 cli/commands/catalog-location.go           |  2 +-
 cli/commands/catalog-locations.go          |  2 +-
 cli/commands/catalog-policies.go           |  2 +-
 cli/commands/catalog-policy.go             |  2 +-
 cli/commands/catalog.go                    | 12 ++++++------
 cli/commands/config.go                     | 12 ++++++------
 cli/commands/delete-catalog-application.go |  2 +-
 cli/commands/delete-catalog-entity.go      |  2 +-
 cli/commands/delete-catalog-policy.go      |  2 +-
 cli/commands/delete.go                     | 10 +++++-----
 cli/commands/deploy.go                     | 14 +++++++-------
 cli/commands/destroy-policy.go             | 10 +++++-----
 cli/commands/effector.go                   | 12 ++++++------
 cli/commands/entity.go                     | 14 +++++++-------
 cli/commands/invoke.go                     | 10 +++++-----
 cli/commands/list.go                       | 10 +++++-----
 cli/commands/locations.go                  | 12 ++++++------
 cli/commands/login.go                      | 12 ++++++------
 cli/commands/policy.go                     | 16 ++++++++--------
 cli/commands/rename.go                     | 10 +++++-----
 cli/commands/reset-catalog.go              |  2 +-
 cli/commands/sensor.go                     | 14 +++++++-------
 cli/commands/set.go                        | 10 +++++-----
 cli/commands/spec.go                       | 10 +++++-----
 cli/commands/start-policy.go               | 10 +++++-----
 cli/commands/stop-policy.go                | 10 +++++-----
 cli/commands/tree.go                       | 12 ++++++------
 cli/commands/version.go                    | 10 +++++-----
 cli/io/config.go                           |  2 +-
 cli/release/build.sh                       |  3 +--
 60 files changed, 217 insertions(+), 218 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/7db8e15d/cli/api/access_control/access_control.go
----------------------------------------------------------------------
diff --git a/cli/api/access_control/access_control.go b/cli/api/access_control/access_control.go
index c68eecf..f8350db 100644
--- a/cli/api/access_control/access_control.go
+++ b/cli/api/access_control/access_control.go
@@ -21,8 +21,8 @@ package access_control
 import (
 	"encoding/json"
 	"fmt"
-	"github.com/apache/brooklyn-client/models"
-	"github.com/apache/brooklyn-client/net"
+	"github.com/apache/brooklyn-client/cli/models"
+	"github.com/apache/brooklyn-client/cli/net"
 )
 
 func Access(network *net.Network) (models.AccessSummary, error) {

http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/7db8e15d/cli/api/activities/activities.go
----------------------------------------------------------------------
diff --git a/cli/api/activities/activities.go b/cli/api/activities/activities.go
index 0364dcb..0080829 100644
--- a/cli/api/activities/activities.go
+++ b/cli/api/activities/activities.go
@@ -21,8 +21,8 @@ package activities
 import (
 	"encoding/json"
 	"fmt"
-	"github.com/apache/brooklyn-client/models"
-	"github.com/apache/brooklyn-client/net"
+	"github.com/apache/brooklyn-client/cli/models"
+	"github.com/apache/brooklyn-client/cli/net"
 )
 
 func Activity(network *net.Network, activity string) (models.TaskSummary, error) {

http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/7db8e15d/cli/api/application/applications.go
----------------------------------------------------------------------
diff --git a/cli/api/application/applications.go b/cli/api/application/applications.go
index f46ebac..ae0d307 100644
--- a/cli/api/application/applications.go
+++ b/cli/api/application/applications.go
@@ -21,8 +21,8 @@ package application
 import (
 	"encoding/json"
 	"fmt"
-	"github.com/apache/brooklyn-client/models"
-	"github.com/apache/brooklyn-client/net"
+	"github.com/apache/brooklyn-client/cli/models"
+	"github.com/apache/brooklyn-client/cli/net"
 )
 
 //WIP

http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/7db8e15d/cli/api/catalog/catalog.go
----------------------------------------------------------------------
diff --git a/cli/api/catalog/catalog.go b/cli/api/catalog/catalog.go
index dd5b75a..3db32ce 100644
--- a/cli/api/catalog/catalog.go
+++ b/cli/api/catalog/catalog.go
@@ -21,8 +21,8 @@ package catalog
 import (
 	"encoding/json"
 	"fmt"
-	"github.com/apache/brooklyn-client/models"
-	"github.com/apache/brooklyn-client/net"
+	"github.com/apache/brooklyn-client/cli/models"
+	"github.com/apache/brooklyn-client/cli/net"
 )
 
 func Icon(network *net.Network, itemId string) ([]byte, error) {

http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/7db8e15d/cli/api/entities/entities.go
----------------------------------------------------------------------
diff --git a/cli/api/entities/entities.go b/cli/api/entities/entities.go
index 90dbb49..9e0323a 100644
--- a/cli/api/entities/entities.go
+++ b/cli/api/entities/entities.go
@@ -21,8 +21,8 @@ package entities
 import (
 	"encoding/json"
 	"fmt"
-	"github.com/apache/brooklyn-client/models"
-	"github.com/apache/brooklyn-client/net"
+	"github.com/apache/brooklyn-client/cli/models"
+	"github.com/apache/brooklyn-client/cli/net"
 	"net/url"
 )
 

http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/7db8e15d/cli/api/entity_config/config.go
----------------------------------------------------------------------
diff --git a/cli/api/entity_config/config.go b/cli/api/entity_config/config.go
index 66cd1d5..fcdf148 100644
--- a/cli/api/entity_config/config.go
+++ b/cli/api/entity_config/config.go
@@ -21,8 +21,8 @@ package entity_config
 import (
 	"encoding/json"
 	"fmt"
-	"github.com/apache/brooklyn-client/models"
-	"github.com/apache/brooklyn-client/net"
+	"github.com/apache/brooklyn-client/cli/models"
+	"github.com/apache/brooklyn-client/cli/net"
 )
 
 func ConfigValue(network *net.Network, application, entity, config string) (interface{}, error) {

http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/7db8e15d/cli/api/entity_effectors/effectors.go
----------------------------------------------------------------------
diff --git a/cli/api/entity_effectors/effectors.go b/cli/api/entity_effectors/effectors.go
index 488a5b1..557928d 100644
--- a/cli/api/entity_effectors/effectors.go
+++ b/cli/api/entity_effectors/effectors.go
@@ -23,8 +23,8 @@ import (
 	"encoding/json"
 	"errors"
 	"fmt"
-	"github.com/apache/brooklyn-client/models"
-	"github.com/apache/brooklyn-client/net"
+	"github.com/apache/brooklyn-client/cli/models"
+	"github.com/apache/brooklyn-client/cli/net"
 	"net/url"
 	"strconv"
 	"strings"

http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/7db8e15d/cli/api/entity_policies/policies.go
----------------------------------------------------------------------
diff --git a/cli/api/entity_policies/policies.go b/cli/api/entity_policies/policies.go
index d776a05..d4673a1 100644
--- a/cli/api/entity_policies/policies.go
+++ b/cli/api/entity_policies/policies.go
@@ -22,8 +22,8 @@ import (
 	"bytes"
 	"encoding/json"
 	"fmt"
-	"github.com/apache/brooklyn-client/models"
-	"github.com/apache/brooklyn-client/net"
+	"github.com/apache/brooklyn-client/cli/models"
+	"github.com/apache/brooklyn-client/cli/net"
 	"net/url"
 	"strconv"
 )

http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/7db8e15d/cli/api/entity_policy_config/config.go
----------------------------------------------------------------------
diff --git a/cli/api/entity_policy_config/config.go b/cli/api/entity_policy_config/config.go
index 0cf40fe..7b0b318 100644
--- a/cli/api/entity_policy_config/config.go
+++ b/cli/api/entity_policy_config/config.go
@@ -21,8 +21,8 @@ package entity_policy_config
 import (
 	"encoding/json"
 	"fmt"
-	"github.com/apache/brooklyn-client/models"
-	"github.com/apache/brooklyn-client/net"
+	"github.com/apache/brooklyn-client/cli/models"
+	"github.com/apache/brooklyn-client/cli/net"
 )
 
 func CurrentState(network *net.Network, application, entity, policy string) (string, error) {

http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/7db8e15d/cli/api/entity_sensors/sensors.go
----------------------------------------------------------------------
diff --git a/cli/api/entity_sensors/sensors.go b/cli/api/entity_sensors/sensors.go
index ddb0d5b..1a32bf8 100644
--- a/cli/api/entity_sensors/sensors.go
+++ b/cli/api/entity_sensors/sensors.go
@@ -21,8 +21,8 @@ package entity_sensors
 import (
 	"encoding/json"
 	"fmt"
-	"github.com/apache/brooklyn-client/models"
-	"github.com/apache/brooklyn-client/net"
+	"github.com/apache/brooklyn-client/cli/models"
+	"github.com/apache/brooklyn-client/cli/net"
 )
 
 func SensorValue(network *net.Network, application, entity, sensor string) (interface{}, error) {

http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/7db8e15d/cli/api/locations/locations.go
----------------------------------------------------------------------
diff --git a/cli/api/locations/locations.go b/cli/api/locations/locations.go
index 9bbb9b3..f85ea97 100644
--- a/cli/api/locations/locations.go
+++ b/cli/api/locations/locations.go
@@ -21,8 +21,8 @@ package locations
 import (
 	"encoding/json"
 	"fmt"
-	"github.com/apache/brooklyn-client/models"
-	"github.com/apache/brooklyn-client/net"
+	"github.com/apache/brooklyn-client/cli/models"
+	"github.com/apache/brooklyn-client/cli/net"
 )
 
 func LocatedLocations(network *net.Network) (string, error) {

http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/7db8e15d/cli/api/server/server.go
----------------------------------------------------------------------
diff --git a/cli/api/server/server.go b/cli/api/server/server.go
index a46b705..b1b49b5 100644
--- a/cli/api/server/server.go
+++ b/cli/api/server/server.go
@@ -20,7 +20,7 @@ package server
 
 import (
 	"fmt"
-	"github.com/apache/brooklyn-client/net"
+	"github.com/apache/brooklyn-client/cli/net"
 )
 
 func Up(network *net.Network) (string, error) {

http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/7db8e15d/cli/api/usage/usage.go
----------------------------------------------------------------------
diff --git a/cli/api/usage/usage.go b/cli/api/usage/usage.go
index f49a517..26289ee 100644
--- a/cli/api/usage/usage.go
+++ b/cli/api/usage/usage.go
@@ -21,8 +21,8 @@ package usage
 import (
 	"encoding/json"
 	"fmt"
-	"github.com/apache/brooklyn-client/models"
-	"github.com/apache/brooklyn-client/net"
+	"github.com/apache/brooklyn-client/cli/models"
+	"github.com/apache/brooklyn-client/cli/net"
 )
 
 func Application(network *net.Network, application string) (string, error) {

http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/7db8e15d/cli/api/version/version.go
----------------------------------------------------------------------
diff --git a/cli/api/version/version.go b/cli/api/version/version.go
index c3f1c70..622068d 100644
--- a/cli/api/version/version.go
+++ b/cli/api/version/version.go
@@ -20,8 +20,8 @@ package version
 
 import (
 	"encoding/json"
-	"github.com/apache/brooklyn-client/models"
-	"github.com/apache/brooklyn-client/net"
+	"github.com/apache/brooklyn-client/cli/models"
+	"github.com/apache/brooklyn-client/cli/net"
 )
 
 func Version(network *net.Network) (models.VersionSummary, error) {

http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/7db8e15d/cli/app/app.go
----------------------------------------------------------------------
diff --git a/cli/app/app.go b/cli/app/app.go
index afdb41d..4fb39a2 100644
--- a/cli/app/app.go
+++ b/cli/app/app.go
@@ -20,9 +20,9 @@ package app
 
 import (
 	"fmt"
-	"github.com/apache/brooklyn-client/command_metadata"
-	"github.com/apache/brooklyn-client/command_runner"
-	"github.com/apache/brooklyn-client/error_handler"
+	"github.com/apache/brooklyn-client/cli/command_metadata"
+	"github.com/apache/brooklyn-client/cli/command_runner"
+	"github.com/apache/brooklyn-client/cli/error_handler"
 	"github.com/urfave/cli"
 	"os"
 	"strings"

http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/7db8e15d/cli/br/brooklyn.go
----------------------------------------------------------------------
diff --git a/cli/br/brooklyn.go b/cli/br/brooklyn.go
index 7f5eed5..1ffb765 100644
--- a/cli/br/brooklyn.go
+++ b/cli/br/brooklyn.go
@@ -19,13 +19,13 @@
 package main
 
 import (
-	"github.com/apache/brooklyn-client/app"
-	"github.com/apache/brooklyn-client/command_factory"
-	"github.com/apache/brooklyn-client/command_runner"
-	"github.com/apache/brooklyn-client/error_handler"
-	"github.com/apache/brooklyn-client/io"
-	"github.com/apache/brooklyn-client/net"
-	"github.com/apache/brooklyn-client/scope"
+	"github.com/apache/brooklyn-client/cli/app"
+	"github.com/apache/brooklyn-client/cli/command_factory"
+	"github.com/apache/brooklyn-client/cli/command_runner"
+	"github.com/apache/brooklyn-client/cli/error_handler"
+	"github.com/apache/brooklyn-client/cli/io"
+	"github.com/apache/brooklyn-client/cli/net"
+	"github.com/apache/brooklyn-client/cli/scope"
 	"os"
 	"path/filepath"
 )

http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/7db8e15d/cli/command/command.go
----------------------------------------------------------------------
diff --git a/cli/command/command.go b/cli/command/command.go
index 1a16282..c19cc98 100644
--- a/cli/command/command.go
+++ b/cli/command/command.go
@@ -19,8 +19,8 @@
 package command
 
 import (
-	"github.com/apache/brooklyn-client/command_metadata"
-	"github.com/apache/brooklyn-client/scope"
+	"github.com/apache/brooklyn-client/cli/command_metadata"
+	"github.com/apache/brooklyn-client/cli/scope"
 	"github.com/urfave/cli"
 )
 

http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/7db8e15d/cli/command_factory/factory.go
----------------------------------------------------------------------
diff --git a/cli/command_factory/factory.go b/cli/command_factory/factory.go
index 7a46eb9..ae1634d 100644
--- a/cli/command_factory/factory.go
+++ b/cli/command_factory/factory.go
@@ -20,11 +20,11 @@ package command_factory
 
 import (
 	"errors"
-	"github.com/apache/brooklyn-client/command"
-	"github.com/apache/brooklyn-client/command_metadata"
-	"github.com/apache/brooklyn-client/commands"
-	"github.com/apache/brooklyn-client/io"
-	"github.com/apache/brooklyn-client/net"
+	"github.com/apache/brooklyn-client/cli/command"
+	"github.com/apache/brooklyn-client/cli/command_metadata"
+	"github.com/apache/brooklyn-client/cli/commands"
+	"github.com/apache/brooklyn-client/cli/io"
+	"github.com/apache/brooklyn-client/cli/net"
 	"sort"
 	"strings"
 )

http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/7db8e15d/cli/command_runner/runner.go
----------------------------------------------------------------------
diff --git a/cli/command_runner/runner.go b/cli/command_runner/runner.go
index c123b5f..4ab5c78 100644
--- a/cli/command_runner/runner.go
+++ b/cli/command_runner/runner.go
@@ -19,8 +19,8 @@
 package command_runner
 
 import (
-	"github.com/apache/brooklyn-client/command_factory"
-	"github.com/apache/brooklyn-client/scope"
+	"github.com/apache/brooklyn-client/cli/command_factory"
+	"github.com/apache/brooklyn-client/cli/scope"
 	"github.com/urfave/cli"
 )
 

http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/7db8e15d/cli/commands/access.go
----------------------------------------------------------------------
diff --git a/cli/commands/access.go b/cli/commands/access.go
index 87e26cd..8a8b850 100644
--- a/cli/commands/access.go
+++ b/cli/commands/access.go
@@ -20,11 +20,11 @@ package commands
 
 import (
 	"fmt"
-	"github.com/apache/brooklyn-client/api/access_control"
-	"github.com/apache/brooklyn-client/command_metadata"
-	"github.com/apache/brooklyn-client/error_handler"
-	"github.com/apache/brooklyn-client/net"
-	"github.com/apache/brooklyn-client/scope"
+	"github.com/apache/brooklyn-client/cli/api/access_control"
+	"github.com/apache/brooklyn-client/cli/command_metadata"
+	"github.com/apache/brooklyn-client/cli/error_handler"
+	"github.com/apache/brooklyn-client/cli/net"
+	"github.com/apache/brooklyn-client/cli/scope"
 	"github.com/urfave/cli"
 )
 

http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/7db8e15d/cli/commands/activity-stream.go
----------------------------------------------------------------------
diff --git a/cli/commands/activity-stream.go b/cli/commands/activity-stream.go
index eceadc4..75a8286 100644
--- a/cli/commands/activity-stream.go
+++ b/cli/commands/activity-stream.go
@@ -20,11 +20,11 @@ package commands
 
 import (
 	"fmt"
-	"github.com/apache/brooklyn-client/api/activities"
-	"github.com/apache/brooklyn-client/command_metadata"
-	"github.com/apache/brooklyn-client/error_handler"
-	"github.com/apache/brooklyn-client/net"
-	"github.com/apache/brooklyn-client/scope"
+	"github.com/apache/brooklyn-client/cli/api/activities"
+	"github.com/apache/brooklyn-client/cli/command_metadata"
+	"github.com/apache/brooklyn-client/cli/error_handler"
+	"github.com/apache/brooklyn-client/cli/net"
+	"github.com/apache/brooklyn-client/cli/scope"
 	"github.com/urfave/cli"
 )
 

http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/7db8e15d/cli/commands/activity.go
----------------------------------------------------------------------
diff --git a/cli/commands/activity.go b/cli/commands/activity.go
index d748c1a..1d82dac 100644
--- a/cli/commands/activity.go
+++ b/cli/commands/activity.go
@@ -20,14 +20,14 @@ package commands
 
 import (
 	"fmt"
-	"github.com/apache/brooklyn-client/api/activities"
-	"github.com/apache/brooklyn-client/api/entities"
-	"github.com/apache/brooklyn-client/command_metadata"
-	"github.com/apache/brooklyn-client/error_handler"
-	"github.com/apache/brooklyn-client/models"
-	"github.com/apache/brooklyn-client/net"
-	"github.com/apache/brooklyn-client/scope"
-	"github.com/apache/brooklyn-client/terminal"
+	"github.com/apache/brooklyn-client/cli/api/activities"
+	"github.com/apache/brooklyn-client/cli/api/entities"
+	"github.com/apache/brooklyn-client/cli/command_metadata"
+	"github.com/apache/brooklyn-client/cli/error_handler"
+	"github.com/apache/brooklyn-client/cli/models"
+	"github.com/apache/brooklyn-client/cli/net"
+	"github.com/apache/brooklyn-client/cli/scope"
+	"github.com/apache/brooklyn-client/cli/terminal"
 	"github.com/urfave/cli"
 	"sort"
 	"strconv"

http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/7db8e15d/cli/commands/add-catalog.go
----------------------------------------------------------------------
diff --git a/cli/commands/add-catalog.go b/cli/commands/add-catalog.go
index b161f8b..9a29328 100644
--- a/cli/commands/add-catalog.go
+++ b/cli/commands/add-catalog.go
@@ -20,11 +20,11 @@ package commands
 
 import (
 	"fmt"
-	"github.com/apache/brooklyn-client/api/catalog"
-	"github.com/apache/brooklyn-client/command_metadata"
-	"github.com/apache/brooklyn-client/error_handler"
-	"github.com/apache/brooklyn-client/net"
-	"github.com/apache/brooklyn-client/scope"
+	"github.com/apache/brooklyn-client/cli/api/catalog"
+	"github.com/apache/brooklyn-client/cli/command_metadata"
+	"github.com/apache/brooklyn-client/cli/error_handler"
+	"github.com/apache/brooklyn-client/cli/net"
+	"github.com/apache/brooklyn-client/cli/scope"
 	"github.com/urfave/cli"
 )
 

http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/7db8e15d/cli/commands/add-children.go
----------------------------------------------------------------------
diff --git a/cli/commands/add-children.go b/cli/commands/add-children.go
index d05a114..da87b44 100644
--- a/cli/commands/add-children.go
+++ b/cli/commands/add-children.go
@@ -19,12 +19,12 @@
 package commands
 
 import (
-	"github.com/apache/brooklyn-client/api/entities"
-	"github.com/apache/brooklyn-client/command_metadata"
-	"github.com/apache/brooklyn-client/error_handler"
-	"github.com/apache/brooklyn-client/net"
-	"github.com/apache/brooklyn-client/scope"
-	"github.com/apache/brooklyn-client/terminal"
+	"github.com/apache/brooklyn-client/cli/api/entities"
+	"github.com/apache/brooklyn-client/cli/command_metadata"
+	"github.com/apache/brooklyn-client/cli/error_handler"
+	"github.com/apache/brooklyn-client/cli/net"
+	"github.com/apache/brooklyn-client/cli/scope"
+	"github.com/apache/brooklyn-client/cli/terminal"
 	"github.com/urfave/cli"
 	"time"
 )

http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/7db8e15d/cli/commands/add-location.go
----------------------------------------------------------------------
diff --git a/cli/commands/add-location.go b/cli/commands/add-location.go
index 32c2db0..0c76823 100644
--- a/cli/commands/add-location.go
+++ b/cli/commands/add-location.go
@@ -19,7 +19,7 @@
 package commands
 
 import (
-	"github.com/apache/brooklyn-client/net"
+	"github.com/apache/brooklyn-client/cli/net"
 )
 
 type AddLocation struct {

http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/7db8e15d/cli/commands/add-policy.go
----------------------------------------------------------------------
diff --git a/cli/commands/add-policy.go b/cli/commands/add-policy.go
index 35de8c4..d026153 100644
--- a/cli/commands/add-policy.go
+++ b/cli/commands/add-policy.go
@@ -20,10 +20,10 @@ package commands
 
 import (
 	"github.com/urfave/cli"
-	//"github.com/apache/brooklyn-client/api/entity_policies"
-	"github.com/apache/brooklyn-client/command_metadata"
-	"github.com/apache/brooklyn-client/net"
-	"github.com/apache/brooklyn-client/scope"
+	//"github.com/apache/brooklyn-client/cli/api/entity_policies"
+	"github.com/apache/brooklyn-client/cli/command_metadata"
+	"github.com/apache/brooklyn-client/cli/net"
+	"github.com/apache/brooklyn-client/cli/scope"
 )
 
 type AddPolicy struct {

http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/7db8e15d/cli/commands/application.go
----------------------------------------------------------------------
diff --git a/cli/commands/application.go b/cli/commands/application.go
index c321227..0e9be1f 100644
--- a/cli/commands/application.go
+++ b/cli/commands/application.go
@@ -20,15 +20,15 @@ package commands
 
 import (
 	"fmt"
-	"github.com/apache/brooklyn-client/api/application"
-	"github.com/apache/brooklyn-client/api/entities"
-	"github.com/apache/brooklyn-client/api/entity_sensors"
-	"github.com/apache/brooklyn-client/api/locations"
-	"github.com/apache/brooklyn-client/command_metadata"
-	"github.com/apache/brooklyn-client/error_handler"
-	"github.com/apache/brooklyn-client/net"
-	"github.com/apache/brooklyn-client/scope"
-	"github.com/apache/brooklyn-client/terminal"
+	"github.com/apache/brooklyn-client/cli/api/application"
+	"github.com/apache/brooklyn-client/cli/api/entities"
+	"github.com/apache/brooklyn-client/cli/api/entity_sensors"
+	"github.com/apache/brooklyn-client/cli/api/locations"
+	"github.com/apache/brooklyn-client/cli/command_metadata"
+	"github.com/apache/brooklyn-client/cli/error_handler"
+	"github.com/apache/brooklyn-client/cli/net"
+	"github.com/apache/brooklyn-client/cli/scope"
+	"github.com/apache/brooklyn-client/cli/terminal"
 	"github.com/urfave/cli"
 	"strings"
 )

http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/7db8e15d/cli/commands/catalog-applications.go
----------------------------------------------------------------------
diff --git a/cli/commands/catalog-applications.go b/cli/commands/catalog-applications.go
index 19a4373..21e07e0 100644
--- a/cli/commands/catalog-applications.go
+++ b/cli/commands/catalog-applications.go
@@ -19,7 +19,7 @@
 package commands
 
 import (
-	"github.com/apache/brooklyn-client/net"
+	"github.com/apache/brooklyn-client/cli/net"
 )
 
 type CatalogApplication struct {

http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/7db8e15d/cli/commands/catalog-entities.go
----------------------------------------------------------------------
diff --git a/cli/commands/catalog-entities.go b/cli/commands/catalog-entities.go
index dbec760..7615461 100644
--- a/cli/commands/catalog-entities.go
+++ b/cli/commands/catalog-entities.go
@@ -19,7 +19,7 @@
 package commands
 
 import (
-	"github.com/apache/brooklyn-client/net"
+	"github.com/apache/brooklyn-client/cli/net"
 )
 
 type CatalogEntities struct {

http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/7db8e15d/cli/commands/catalog-entity.go
----------------------------------------------------------------------
diff --git a/cli/commands/catalog-entity.go b/cli/commands/catalog-entity.go
index 23cc295..142d250 100644
--- a/cli/commands/catalog-entity.go
+++ b/cli/commands/catalog-entity.go
@@ -19,7 +19,7 @@
 package commands
 
 import (
-	"github.com/apache/brooklyn-client/net"
+	"github.com/apache/brooklyn-client/cli/net"
 )
 
 type CatalogEntity struct {

http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/7db8e15d/cli/commands/catalog-location.go
----------------------------------------------------------------------
diff --git a/cli/commands/catalog-location.go b/cli/commands/catalog-location.go
index 40babdd..ecf8ea6 100644
--- a/cli/commands/catalog-location.go
+++ b/cli/commands/catalog-location.go
@@ -19,7 +19,7 @@
 package commands
 
 import (
-	"github.com/apache/brooklyn-client/net"
+	"github.com/apache/brooklyn-client/cli/net"
 )
 
 type CatalogLocation struct {

http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/7db8e15d/cli/commands/catalog-locations.go
----------------------------------------------------------------------
diff --git a/cli/commands/catalog-locations.go b/cli/commands/catalog-locations.go
index e1791e8..c474b32 100644
--- a/cli/commands/catalog-locations.go
+++ b/cli/commands/catalog-locations.go
@@ -19,7 +19,7 @@
 package commands
 
 import (
-	"github.com/apache/brooklyn-client/net"
+	"github.com/apache/brooklyn-client/cli/net"
 )
 
 type CatalogLocations struct {

http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/7db8e15d/cli/commands/catalog-policies.go
----------------------------------------------------------------------
diff --git a/cli/commands/catalog-policies.go b/cli/commands/catalog-policies.go
index 3e245db..1dfa1df 100644
--- a/cli/commands/catalog-policies.go
+++ b/cli/commands/catalog-policies.go
@@ -19,7 +19,7 @@
 package commands
 
 import (
-	"github.com/apache/brooklyn-client/net"
+	"github.com/apache/brooklyn-client/cli/net"
 )
 
 type CatalogPolicies struct {

http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/7db8e15d/cli/commands/catalog-policy.go
----------------------------------------------------------------------
diff --git a/cli/commands/catalog-policy.go b/cli/commands/catalog-policy.go
index 82e8a95..d64c73d 100644
--- a/cli/commands/catalog-policy.go
+++ b/cli/commands/catalog-policy.go
@@ -19,7 +19,7 @@
 package commands
 
 import (
-	"github.com/apache/brooklyn-client/net"
+	"github.com/apache/brooklyn-client/cli/net"
 )
 
 type CatalogPolicy struct {

http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/7db8e15d/cli/commands/catalog.go
----------------------------------------------------------------------
diff --git a/cli/commands/catalog.go b/cli/commands/catalog.go
index fd1d8ad..eab08b8 100644
--- a/cli/commands/catalog.go
+++ b/cli/commands/catalog.go
@@ -19,12 +19,12 @@
 package commands
 
 import (
-	"github.com/apache/brooklyn-client/api/catalog"
-	"github.com/apache/brooklyn-client/command_metadata"
-	"github.com/apache/brooklyn-client/error_handler"
-	"github.com/apache/brooklyn-client/net"
-	"github.com/apache/brooklyn-client/scope"
-	"github.com/apache/brooklyn-client/terminal"
+	"github.com/apache/brooklyn-client/cli/api/catalog"
+	"github.com/apache/brooklyn-client/cli/command_metadata"
+	"github.com/apache/brooklyn-client/cli/error_handler"
+	"github.com/apache/brooklyn-client/cli/net"
+	"github.com/apache/brooklyn-client/cli/scope"
+	"github.com/apache/brooklyn-client/cli/terminal"
 	"github.com/urfave/cli"
 )
 

http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/7db8e15d/cli/commands/config.go
----------------------------------------------------------------------
diff --git a/cli/commands/config.go b/cli/commands/config.go
index 33d9cba..7766251 100644
--- a/cli/commands/config.go
+++ b/cli/commands/config.go
@@ -20,12 +20,12 @@ package commands
 
 import (
 	"fmt"
-	"github.com/apache/brooklyn-client/api/entity_config"
-	"github.com/apache/brooklyn-client/command_metadata"
-	"github.com/apache/brooklyn-client/error_handler"
-	"github.com/apache/brooklyn-client/net"
-	"github.com/apache/brooklyn-client/scope"
-	"github.com/apache/brooklyn-client/terminal"
+	"github.com/apache/brooklyn-client/cli/api/entity_config"
+	"github.com/apache/brooklyn-client/cli/command_metadata"
+	"github.com/apache/brooklyn-client/cli/error_handler"
+	"github.com/apache/brooklyn-client/cli/net"
+	"github.com/apache/brooklyn-client/cli/scope"
+	"github.com/apache/brooklyn-client/cli/terminal"
 	"github.com/urfave/cli"
 )
 

http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/7db8e15d/cli/commands/delete-catalog-application.go
----------------------------------------------------------------------
diff --git a/cli/commands/delete-catalog-application.go b/cli/commands/delete-catalog-application.go
index f289bbd..fd8ac3b 100644
--- a/cli/commands/delete-catalog-application.go
+++ b/cli/commands/delete-catalog-application.go
@@ -19,7 +19,7 @@
 package commands
 
 import (
-	"github.com/apache/brooklyn-client/net"
+	"github.com/apache/brooklyn-client/cli/net"
 )
 
 type DeleteCatalogApplication struct {

http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/7db8e15d/cli/commands/delete-catalog-entity.go
----------------------------------------------------------------------
diff --git a/cli/commands/delete-catalog-entity.go b/cli/commands/delete-catalog-entity.go
index 5953fff..4f207c5 100644
--- a/cli/commands/delete-catalog-entity.go
+++ b/cli/commands/delete-catalog-entity.go
@@ -19,7 +19,7 @@
 package commands
 
 import (
-	"github.com/apache/brooklyn-client/net"
+	"github.com/apache/brooklyn-client/cli/net"
 )
 
 type DeleteCatalogEntity struct {

http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/7db8e15d/cli/commands/delete-catalog-policy.go
----------------------------------------------------------------------
diff --git a/cli/commands/delete-catalog-policy.go b/cli/commands/delete-catalog-policy.go
index c6b29a6..26c5d71 100644
--- a/cli/commands/delete-catalog-policy.go
+++ b/cli/commands/delete-catalog-policy.go
@@ -19,7 +19,7 @@
 package commands
 
 import (
-	"github.com/apache/brooklyn-client/net"
+	"github.com/apache/brooklyn-client/cli/net"
 )
 
 type DeleteCatalogPolicy struct {

http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/7db8e15d/cli/commands/delete.go
----------------------------------------------------------------------
diff --git a/cli/commands/delete.go b/cli/commands/delete.go
index 90c60f9..d3f30a4 100644
--- a/cli/commands/delete.go
+++ b/cli/commands/delete.go
@@ -20,11 +20,11 @@ package commands
 
 import (
 	"fmt"
-	"github.com/apache/brooklyn-client/api/application"
-	"github.com/apache/brooklyn-client/command_metadata"
-	"github.com/apache/brooklyn-client/error_handler"
-	"github.com/apache/brooklyn-client/net"
-	"github.com/apache/brooklyn-client/scope"
+	"github.com/apache/brooklyn-client/cli/api/application"
+	"github.com/apache/brooklyn-client/cli/command_metadata"
+	"github.com/apache/brooklyn-client/cli/error_handler"
+	"github.com/apache/brooklyn-client/cli/net"
+	"github.com/apache/brooklyn-client/cli/scope"
 	"github.com/urfave/cli"
 )
 

http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/7db8e15d/cli/commands/deploy.go
----------------------------------------------------------------------
diff --git a/cli/commands/deploy.go b/cli/commands/deploy.go
index bc42b08..46b1395 100644
--- a/cli/commands/deploy.go
+++ b/cli/commands/deploy.go
@@ -19,13 +19,13 @@
 package commands
 
 import (
-	"github.com/apache/brooklyn-client/api/application"
-	"github.com/apache/brooklyn-client/command_metadata"
-	"github.com/apache/brooklyn-client/error_handler"
-	"github.com/apache/brooklyn-client/models"
-	"github.com/apache/brooklyn-client/net"
-	"github.com/apache/brooklyn-client/scope"
-	"github.com/apache/brooklyn-client/terminal"
+	"github.com/apache/brooklyn-client/cli/api/application"
+	"github.com/apache/brooklyn-client/cli/command_metadata"
+	"github.com/apache/brooklyn-client/cli/error_handler"
+	"github.com/apache/brooklyn-client/cli/models"
+	"github.com/apache/brooklyn-client/cli/net"
+	"github.com/apache/brooklyn-client/cli/scope"
+	"github.com/apache/brooklyn-client/cli/terminal"
 	"github.com/urfave/cli"
 	"io/ioutil"
 	"os"

http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/7db8e15d/cli/commands/destroy-policy.go
----------------------------------------------------------------------
diff --git a/cli/commands/destroy-policy.go b/cli/commands/destroy-policy.go
index 4ea37ec..808d777 100644
--- a/cli/commands/destroy-policy.go
+++ b/cli/commands/destroy-policy.go
@@ -20,11 +20,11 @@ package commands
 
 import (
 	"fmt"
-	"github.com/apache/brooklyn-client/api/entity_policies"
-	"github.com/apache/brooklyn-client/command_metadata"
-	"github.com/apache/brooklyn-client/error_handler"
-	"github.com/apache/brooklyn-client/net"
-	"github.com/apache/brooklyn-client/scope"
+	"github.com/apache/brooklyn-client/cli/api/entity_policies"
+	"github.com/apache/brooklyn-client/cli/command_metadata"
+	"github.com/apache/brooklyn-client/cli/error_handler"
+	"github.com/apache/brooklyn-client/cli/net"
+	"github.com/apache/brooklyn-client/cli/scope"
 	"github.com/urfave/cli"
 )
 

http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/7db8e15d/cli/commands/effector.go
----------------------------------------------------------------------
diff --git a/cli/commands/effector.go b/cli/commands/effector.go
index aeff664..98fd561 100644
--- a/cli/commands/effector.go
+++ b/cli/commands/effector.go
@@ -19,12 +19,12 @@
 package commands
 
 import (
-	"github.com/apache/brooklyn-client/api/entity_effectors"
-	"github.com/apache/brooklyn-client/command_metadata"
-	"github.com/apache/brooklyn-client/error_handler"
-	"github.com/apache/brooklyn-client/net"
-	"github.com/apache/brooklyn-client/scope"
-	"github.com/apache/brooklyn-client/terminal"
+	"github.com/apache/brooklyn-client/cli/api/entity_effectors"
+	"github.com/apache/brooklyn-client/cli/command_metadata"
+	"github.com/apache/brooklyn-client/cli/error_handler"
+	"github.com/apache/brooklyn-client/cli/net"
+	"github.com/apache/brooklyn-client/cli/scope"
+	"github.com/apache/brooklyn-client/cli/terminal"
 	"github.com/urfave/cli"
 	"strings"
 )

http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/7db8e15d/cli/commands/entity.go
----------------------------------------------------------------------
diff --git a/cli/commands/entity.go b/cli/commands/entity.go
index e5903c9..8820023 100644
--- a/cli/commands/entity.go
+++ b/cli/commands/entity.go
@@ -20,13 +20,13 @@ package commands
 
 import (
 	"fmt"
-	"github.com/apache/brooklyn-client/api/entities"
-	"github.com/apache/brooklyn-client/api/entity_sensors"
-	"github.com/apache/brooklyn-client/command_metadata"
-	"github.com/apache/brooklyn-client/error_handler"
-	"github.com/apache/brooklyn-client/net"
-	"github.com/apache/brooklyn-client/scope"
-	"github.com/apache/brooklyn-client/terminal"
+	"github.com/apache/brooklyn-client/cli/api/entities"
+	"github.com/apache/brooklyn-client/cli/api/entity_sensors"
+	"github.com/apache/brooklyn-client/cli/command_metadata"
+	"github.com/apache/brooklyn-client/cli/error_handler"
+	"github.com/apache/brooklyn-client/cli/net"
+	"github.com/apache/brooklyn-client/cli/scope"
+	"github.com/apache/brooklyn-client/cli/terminal"
 	"github.com/urfave/cli"
 	"os"
 )

http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/7db8e15d/cli/commands/invoke.go
----------------------------------------------------------------------
diff --git a/cli/commands/invoke.go b/cli/commands/invoke.go
index a719ed7..61a4edc 100644
--- a/cli/commands/invoke.go
+++ b/cli/commands/invoke.go
@@ -21,11 +21,11 @@ package commands
 import (
 	"errors"
 	"fmt"
-	"github.com/apache/brooklyn-client/api/entity_effectors"
-	"github.com/apache/brooklyn-client/command_metadata"
-	"github.com/apache/brooklyn-client/error_handler"
-	"github.com/apache/brooklyn-client/net"
-	"github.com/apache/brooklyn-client/scope"
+	"github.com/apache/brooklyn-client/cli/api/entity_effectors"
+	"github.com/apache/brooklyn-client/cli/command_metadata"
+	"github.com/apache/brooklyn-client/cli/error_handler"
+	"github.com/apache/brooklyn-client/cli/net"
+	"github.com/apache/brooklyn-client/cli/scope"
 	"github.com/urfave/cli"
 	"io/ioutil"
 	"strings"

http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/7db8e15d/cli/commands/list.go
----------------------------------------------------------------------
diff --git a/cli/commands/list.go b/cli/commands/list.go
index 7758568..dc63891 100644
--- a/cli/commands/list.go
+++ b/cli/commands/list.go
@@ -20,11 +20,11 @@ package commands
 
 import (
 	"fmt"
-	"github.com/apache/brooklyn-client/command"
-	"github.com/apache/brooklyn-client/command_metadata"
-	"github.com/apache/brooklyn-client/error_handler"
-	"github.com/apache/brooklyn-client/net"
-	"github.com/apache/brooklyn-client/scope"
+	"github.com/apache/brooklyn-client/cli/command"
+	"github.com/apache/brooklyn-client/cli/command_metadata"
+	"github.com/apache/brooklyn-client/cli/error_handler"
+	"github.com/apache/brooklyn-client/cli/net"
+	"github.com/apache/brooklyn-client/cli/scope"
 	"github.com/urfave/cli"
 	"strings"
 )

http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/7db8e15d/cli/commands/locations.go
----------------------------------------------------------------------
diff --git a/cli/commands/locations.go b/cli/commands/locations.go
index f197130..c0a21d6 100644
--- a/cli/commands/locations.go
+++ b/cli/commands/locations.go
@@ -19,12 +19,12 @@
 package commands
 
 import (
-	"github.com/apache/brooklyn-client/api/locations"
-	"github.com/apache/brooklyn-client/command_metadata"
-	"github.com/apache/brooklyn-client/error_handler"
-	"github.com/apache/brooklyn-client/net"
-	"github.com/apache/brooklyn-client/scope"
-	"github.com/apache/brooklyn-client/terminal"
+	"github.com/apache/brooklyn-client/cli/api/locations"
+	"github.com/apache/brooklyn-client/cli/command_metadata"
+	"github.com/apache/brooklyn-client/cli/error_handler"
+	"github.com/apache/brooklyn-client/cli/net"
+	"github.com/apache/brooklyn-client/cli/scope"
+	"github.com/apache/brooklyn-client/cli/terminal"
 	"github.com/urfave/cli"
 )
 

http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/7db8e15d/cli/commands/login.go
----------------------------------------------------------------------
diff --git a/cli/commands/login.go b/cli/commands/login.go
index df63b33..349b0d8 100644
--- a/cli/commands/login.go
+++ b/cli/commands/login.go
@@ -20,12 +20,12 @@ package commands
 
 import (
 	"fmt"
-	"github.com/apache/brooklyn-client/api/version"
-	"github.com/apache/brooklyn-client/command_metadata"
-	"github.com/apache/brooklyn-client/error_handler"
-	"github.com/apache/brooklyn-client/io"
-	"github.com/apache/brooklyn-client/net"
-	"github.com/apache/brooklyn-client/scope"
+	"github.com/apache/brooklyn-client/cli/api/version"
+	"github.com/apache/brooklyn-client/cli/command_metadata"
+	"github.com/apache/brooklyn-client/cli/error_handler"
+	"github.com/apache/brooklyn-client/cli/io"
+	"github.com/apache/brooklyn-client/cli/net"
+	"github.com/apache/brooklyn-client/cli/scope"
 	"github.com/urfave/cli"
 	"golang.org/x/crypto/ssh/terminal"
 	"syscall"

http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/7db8e15d/cli/commands/policy.go
----------------------------------------------------------------------
diff --git a/cli/commands/policy.go b/cli/commands/policy.go
index 1d587fd..e6d0bcf 100644
--- a/cli/commands/policy.go
+++ b/cli/commands/policy.go
@@ -19,14 +19,14 @@
 package commands
 
 import (
-	"github.com/apache/brooklyn-client/api/entity_policies"
-	"github.com/apache/brooklyn-client/api/entity_policy_config"
-	"github.com/apache/brooklyn-client/command_metadata"
-	"github.com/apache/brooklyn-client/error_handler"
-	"github.com/apache/brooklyn-client/models"
-	"github.com/apache/brooklyn-client/net"
-	"github.com/apache/brooklyn-client/scope"
-	"github.com/apache/brooklyn-client/terminal"
+	"github.com/apache/brooklyn-client/cli/api/entity_policies"
+	"github.com/apache/brooklyn-client/cli/api/entity_policy_config"
+	"github.com/apache/brooklyn-client/cli/command_metadata"
+	"github.com/apache/brooklyn-client/cli/error_handler"
+	"github.com/apache/brooklyn-client/cli/models"
+	"github.com/apache/brooklyn-client/cli/net"
+	"github.com/apache/brooklyn-client/cli/scope"
+	"github.com/apache/brooklyn-client/cli/terminal"
 	"github.com/urfave/cli"
 	"sort"
 )

http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/7db8e15d/cli/commands/rename.go
----------------------------------------------------------------------
diff --git a/cli/commands/rename.go b/cli/commands/rename.go
index 7891971..f7f6aed 100644
--- a/cli/commands/rename.go
+++ b/cli/commands/rename.go
@@ -20,11 +20,11 @@ package commands
 
 import (
 	"fmt"
-	"github.com/apache/brooklyn-client/api/entities"
-	"github.com/apache/brooklyn-client/command_metadata"
-	"github.com/apache/brooklyn-client/error_handler"
-	"github.com/apache/brooklyn-client/net"
-	"github.com/apache/brooklyn-client/scope"
+	"github.com/apache/brooklyn-client/cli/api/entities"
+	"github.com/apache/brooklyn-client/cli/command_metadata"
+	"github.com/apache/brooklyn-client/cli/error_handler"
+	"github.com/apache/brooklyn-client/cli/net"
+	"github.com/apache/brooklyn-client/cli/scope"
 	"github.com/urfave/cli"
 )
 

http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/7db8e15d/cli/commands/reset-catalog.go
----------------------------------------------------------------------
diff --git a/cli/commands/reset-catalog.go b/cli/commands/reset-catalog.go
index 6830399..d7dfcae 100644
--- a/cli/commands/reset-catalog.go
+++ b/cli/commands/reset-catalog.go
@@ -19,7 +19,7 @@
 package commands
 
 import (
-	"github.com/apache/brooklyn-client/net"
+	"github.com/apache/brooklyn-client/cli/net"
 )
 
 type ResetCatalog struct {

http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/7db8e15d/cli/commands/sensor.go
----------------------------------------------------------------------
diff --git a/cli/commands/sensor.go b/cli/commands/sensor.go
index ac75660..144b4af 100644
--- a/cli/commands/sensor.go
+++ b/cli/commands/sensor.go
@@ -20,13 +20,13 @@ package commands
 
 import (
 	"fmt"
-	"github.com/apache/brooklyn-client/api/entity_sensors"
-	"github.com/apache/brooklyn-client/command_metadata"
-	"github.com/apache/brooklyn-client/error_handler"
-	"github.com/apache/brooklyn-client/models"
-	"github.com/apache/brooklyn-client/net"
-	"github.com/apache/brooklyn-client/scope"
-	"github.com/apache/brooklyn-client/terminal"
+	"github.com/apache/brooklyn-client/cli/api/entity_sensors"
+	"github.com/apache/brooklyn-client/cli/command_metadata"
+	"github.com/apache/brooklyn-client/cli/error_handler"
+	"github.com/apache/brooklyn-client/cli/models"
+	"github.com/apache/brooklyn-client/cli/net"
+	"github.com/apache/brooklyn-client/cli/scope"
+	"github.com/apache/brooklyn-client/cli/terminal"
 	"github.com/urfave/cli"
 	"sort"
 )

http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/7db8e15d/cli/commands/set.go
----------------------------------------------------------------------
diff --git a/cli/commands/set.go b/cli/commands/set.go
index ae1a594..80aa4cb 100644
--- a/cli/commands/set.go
+++ b/cli/commands/set.go
@@ -20,11 +20,11 @@ package commands
 
 import (
 	"fmt"
-	"github.com/apache/brooklyn-client/api/entity_config"
-	"github.com/apache/brooklyn-client/command_metadata"
-	"github.com/apache/brooklyn-client/error_handler"
-	"github.com/apache/brooklyn-client/net"
-	"github.com/apache/brooklyn-client/scope"
+	"github.com/apache/brooklyn-client/cli/api/entity_config"
+	"github.com/apache/brooklyn-client/cli/command_metadata"
+	"github.com/apache/brooklyn-client/cli/error_handler"
+	"github.com/apache/brooklyn-client/cli/net"
+	"github.com/apache/brooklyn-client/cli/scope"
 	"github.com/urfave/cli"
 )
 

http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/7db8e15d/cli/commands/spec.go
----------------------------------------------------------------------
diff --git a/cli/commands/spec.go b/cli/commands/spec.go
index 06819b9..ddedbb3 100644
--- a/cli/commands/spec.go
+++ b/cli/commands/spec.go
@@ -20,11 +20,11 @@ package commands
 
 import (
 	"fmt"
-	"github.com/apache/brooklyn-client/api/entities"
-	"github.com/apache/brooklyn-client/command_metadata"
-	"github.com/apache/brooklyn-client/error_handler"
-	"github.com/apache/brooklyn-client/net"
-	"github.com/apache/brooklyn-client/scope"
+	"github.com/apache/brooklyn-client/cli/api/entities"
+	"github.com/apache/brooklyn-client/cli/command_metadata"
+	"github.com/apache/brooklyn-client/cli/error_handler"
+	"github.com/apache/brooklyn-client/cli/net"
+	"github.com/apache/brooklyn-client/cli/scope"
 	"github.com/urfave/cli"
 )
 

http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/7db8e15d/cli/commands/start-policy.go
----------------------------------------------------------------------
diff --git a/cli/commands/start-policy.go b/cli/commands/start-policy.go
index 68dbec7..c7a6d09 100644
--- a/cli/commands/start-policy.go
+++ b/cli/commands/start-policy.go
@@ -20,11 +20,11 @@ package commands
 
 import (
 	"fmt"
-	"github.com/apache/brooklyn-client/api/entity_policies"
-	"github.com/apache/brooklyn-client/command_metadata"
-	"github.com/apache/brooklyn-client/error_handler"
-	"github.com/apache/brooklyn-client/net"
-	"github.com/apache/brooklyn-client/scope"
+	"github.com/apache/brooklyn-client/cli/api/entity_policies"
+	"github.com/apache/brooklyn-client/cli/command_metadata"
+	"github.com/apache/brooklyn-client/cli/error_handler"
+	"github.com/apache/brooklyn-client/cli/net"
+	"github.com/apache/brooklyn-client/cli/scope"
 	"github.com/urfave/cli"
 )
 

http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/7db8e15d/cli/commands/stop-policy.go
----------------------------------------------------------------------
diff --git a/cli/commands/stop-policy.go b/cli/commands/stop-policy.go
index 2700802..7738d39 100644
--- a/cli/commands/stop-policy.go
+++ b/cli/commands/stop-policy.go
@@ -20,11 +20,11 @@ package commands
 
 import (
 	"fmt"
-	"github.com/apache/brooklyn-client/api/entity_policies"
-	"github.com/apache/brooklyn-client/command_metadata"
-	"github.com/apache/brooklyn-client/error_handler"
-	"github.com/apache/brooklyn-client/net"
-	"github.com/apache/brooklyn-client/scope"
+	"github.com/apache/brooklyn-client/cli/api/entity_policies"
+	"github.com/apache/brooklyn-client/cli/command_metadata"
+	"github.com/apache/brooklyn-client/cli/error_handler"
+	"github.com/apache/brooklyn-client/cli/net"
+	"github.com/apache/brooklyn-client/cli/scope"
 	"github.com/urfave/cli"
 )
 

http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/7db8e15d/cli/commands/tree.go
----------------------------------------------------------------------
diff --git a/cli/commands/tree.go b/cli/commands/tree.go
index 5665997..e2f9535 100644
--- a/cli/commands/tree.go
+++ b/cli/commands/tree.go
@@ -20,12 +20,12 @@ package commands
 
 import (
 	"fmt"
-	"github.com/apache/brooklyn-client/api/application"
-	"github.com/apache/brooklyn-client/command_metadata"
-	"github.com/apache/brooklyn-client/error_handler"
-	"github.com/apache/brooklyn-client/models"
-	"github.com/apache/brooklyn-client/net"
-	"github.com/apache/brooklyn-client/scope"
+	"github.com/apache/brooklyn-client/cli/api/application"
+	"github.com/apache/brooklyn-client/cli/command_metadata"
+	"github.com/apache/brooklyn-client/cli/error_handler"
+	"github.com/apache/brooklyn-client/cli/models"
+	"github.com/apache/brooklyn-client/cli/net"
+	"github.com/apache/brooklyn-client/cli/scope"
 	"github.com/urfave/cli"
 )
 

http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/7db8e15d/cli/commands/version.go
----------------------------------------------------------------------
diff --git a/cli/commands/version.go b/cli/commands/version.go
index 39de4b6..6cbdf1d 100644
--- a/cli/commands/version.go
+++ b/cli/commands/version.go
@@ -20,11 +20,11 @@ package commands
 
 import (
 	"fmt"
-	"github.com/apache/brooklyn-client/api/version"
-	"github.com/apache/brooklyn-client/command_metadata"
-	"github.com/apache/brooklyn-client/error_handler"
-	"github.com/apache/brooklyn-client/net"
-	"github.com/apache/brooklyn-client/scope"
+	"github.com/apache/brooklyn-client/cli/api/version"
+	"github.com/apache/brooklyn-client/cli/command_metadata"
+	"github.com/apache/brooklyn-client/cli/error_handler"
+	"github.com/apache/brooklyn-client/cli/net"
+	"github.com/apache/brooklyn-client/cli/scope"
 	"github.com/urfave/cli"
 )
 

http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/7db8e15d/cli/io/config.go
----------------------------------------------------------------------
diff --git a/cli/io/config.go b/cli/io/config.go
index ea9ca01..12d2803 100644
--- a/cli/io/config.go
+++ b/cli/io/config.go
@@ -23,7 +23,7 @@ import (
 	"os"
 	"path/filepath"
 
-	"github.com/apache/brooklyn-client/error_handler"
+	"github.com/apache/brooklyn-client/cli/error_handler"
 )
 
 type Config struct {

http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/7db8e15d/cli/release/build.sh
----------------------------------------------------------------------
diff --git a/cli/release/build.sh b/cli/release/build.sh
index dfee050..6f91ed4 100755
--- a/cli/release/build.sh
+++ b/cli/release/build.sh
@@ -23,8 +23,7 @@
 OSVALUES="darwin freebsd linux netbsd openbsd windows"
 ARCHVALUES="386 amd64"
 BRNAME="br"
-GOPACKAGE="github.com/apache/brooklyn-client/${BRNAME}"
-PROJECT="github.com/apache/brooklyn-client"
+PROJECT="github.com/apache/brooklyn-client/cli"
 CLI_PACKAGE="${PROJECT}/${BRNAME}"
 GOBIN=go
 GLIDE=glide


[15/19] brooklyn-client git commit: Avoid passing through the content even for 404 URLs

Posted by sv...@apache.org.
Avoid passing through the content even for 404 URLs


Project: http://git-wip-us.apache.org/repos/asf/brooklyn-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-client/commit/665f00a0
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-client/tree/665f00a0
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-client/diff/665f00a0

Branch: refs/heads/master
Commit: 665f00a06299c573cd5266db12eec3f4bfaa6702
Parents: e6a5d58
Author: Geoff Macartney <ge...@cloudsoftcorp.com>
Authored: Mon Oct 24 19:55:53 2016 +0100
Committer: Geoff Macartney <ge...@cloudsoftcorp.com>
Committed: Tue Oct 25 11:14:53 2016 +0100

----------------------------------------------------------------------
 cli/net/net.go | 49 +++++++++++++++++++++++++++----------------------
 1 file changed, 27 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/665f00a0/cli/net/net.go
----------------------------------------------------------------------
diff --git a/cli/net/net.go b/cli/net/net.go
index b47d75a..73cfdea 100644
--- a/cli/net/net.go
+++ b/cli/net/net.go
@@ -28,8 +28,6 @@ import (
 	"net/url"
 	"os"
 	"path/filepath"
-	"strconv"
-	"strings"
 	"crypto/tls"
 )
 
@@ -111,19 +109,27 @@ func (net *Network) SendRequest(req *http.Request) ([]byte, error) {
 	return body, err
 }
 
-func (net *Network) SendRequestGetStatusCode(req *http.Request) ([]byte, int, error) {
+func (net *Network) makeClient() (*http.Client) {
 	tr := &http.Transport{
 		TLSClientConfig: &tls.Config{InsecureSkipVerify: net.SkipSslChecks},
 	}
 	client := &http.Client{Transport: tr}
+	return client
+}
+
+func (net *Network) SendRequestGetStatusCode(req *http.Request) ([]byte, int, error) {
+        client := net.makeClient()
 	resp, err := client.Do(req)
 	if err != nil {
 		return nil, 0, err
 	}
 	defer resp.Body.Close()
 	body, err := ioutil.ReadAll(resp.Body)
-	if code, failed := unsuccessful(resp.Status); failed {
-		return nil, 0, makeError(resp, code, body)
+	if err != nil {
+		body = nil
+	}
+	if failed := unsuccessful(resp.StatusCode); failed {
+		return nil, 0, makeError(resp, resp.StatusCode, body)
 	}
 	return body, resp.StatusCode, err
 }
@@ -131,16 +137,8 @@ func (net *Network) SendRequestGetStatusCode(req *http.Request) ([]byte, int, er
 const httpSuccessSeriesFrom = 200
 const httpSuccessSeriesTo = 300
 
-func unsuccessful(status string) (int, bool) {
-	tokens := strings.Split(status, " ")
-	if 0 == len(tokens) {
-		return -1, false
-	}
-	code, err := strconv.Atoi(tokens[0])
-	if nil != err {
-		return -1, false
-	}
-	return code, code < httpSuccessSeriesFrom || httpSuccessSeriesTo <= code
+func unsuccessful(code int) (bool) {
+	return code < httpSuccessSeriesFrom || httpSuccessSeriesTo <= code
 }
 
 func (net *Network) SendGetRequest(url string) ([]byte, error) {
@@ -176,7 +174,10 @@ func (net *Network) SendPostRequest(urlStr string, data []byte) ([]byte, error)
 }
 
 func (net *Network) SendPostResourceRequest(restUrl string, resourceUrl string, contentType string) ([]byte, error) {
-	resource, err := openResource(resourceUrl)
+	resource, err := net.openResource(resourceUrl)
+	if err != nil {
+		return nil, err
+	}
 	defer resource.Close()
 	req := net.NewPostRequest(restUrl, resource)
 	req.Header.Set("Content-Type", contentType)
@@ -184,23 +185,23 @@ func (net *Network) SendPostResourceRequest(restUrl string, resourceUrl string,
 	return body, err
 }
 
-func openResource(resourceUrl string) (io.ReadCloser, error) {
+func (net *Network) openResource(resourceUrl string) (io.ReadCloser, error) {
 	u, err := url.Parse(resourceUrl)
 	if err != nil {
 		return nil, err
 	}
 	if "" == u.Scheme || "file" == u.Scheme {
-		return openFileResource(u)
+		return net.openFileResource(u)
 
 	} else if "http" == u.Scheme || "https" == u.Scheme {
-		return openHttpResource(resourceUrl)
+		return net.openHttpResource(resourceUrl)
 
 	} else {
 		return nil, errors.New("Unrecognised protocol scheme: " + u.Scheme)
 	}
 }
 
-func openFileResource(url *url.URL) (io.ReadCloser, error) {
+func (net *Network) openFileResource(url *url.URL) (io.ReadCloser, error) {
 	filePath := url.Path;
 	file, err := os.Open(filepath.Clean(filePath))
 	if err != nil {
@@ -209,11 +210,15 @@ func openFileResource(url *url.URL) (io.ReadCloser, error) {
 	return file, nil
 }
 
-func openHttpResource(resourceUrl string) (io.ReadCloser, error) {
-	resp, err := http.Get(resourceUrl)
+func (net *Network) openHttpResource(resourceUrl string) (io.ReadCloser, error) {
+	client := net.makeClient()
+	resp, err := client.Get(resourceUrl)
 	if err != nil {
 		return nil, err
 	}
+	if failed := unsuccessful(resp.StatusCode) ; failed {
+		return nil, errors.New("Error retrieving " + resourceUrl + " (" + resp.Status + ")")
+	}
 	return resp.Body, nil
 }
 


[13/19] brooklyn-client git commit: Restore 'add-catalog' for backward compatibility.

Posted by sv...@apache.org.
Restore 'add-catalog' for backward compatibility.


Project: http://git-wip-us.apache.org/repos/asf/brooklyn-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-client/commit/bff209a3
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-client/tree/bff209a3
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-client/diff/bff209a3

Branch: refs/heads/master
Commit: bff209a3b7a1c51b6d84d5b32832b7f5222c7fa3
Parents: dca9a27
Author: Geoff Macartney <ge...@cloudsoftcorp.com>
Authored: Mon Oct 24 15:57:21 2016 +0100
Committer: Geoff Macartney <ge...@cloudsoftcorp.com>
Committed: Mon Oct 24 15:57:21 2016 +0100

----------------------------------------------------------------------
 cli/command_factory/factory.go | 1 +
 1 file changed, 1 insertion(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/bff209a3/cli/command_factory/factory.go
----------------------------------------------------------------------
diff --git a/cli/command_factory/factory.go b/cli/command_factory/factory.go
index b225b2c..399014f 100644
--- a/cli/command_factory/factory.go
+++ b/cli/command_factory/factory.go
@@ -51,6 +51,7 @@ func NewFactory(network *net.Network, config *io.Config) (factory concreteFactor
 	factory.simpleCommand(commands.NewActivityStreamStderr(network))
 	factory.simpleCommand(commands.NewActivityStreamStdin(network))
 	factory.simpleCommand(commands.NewActivityStreamStdout(network))
+	factory.simpleCommand(commands.NewAddCatalog(network))
 	factory.simpleCommand(commands.NewAddChildren(network))
 	factory.simpleCommand(commands.NewApplication(network))
 	//factory.simpleCommand(commands.NewApplications(network))


[12/19] brooklyn-client git commit: Fix subcommand usage.

Posted by sv...@apache.org.
Fix subcommand usage.

avoid 'BROOKLYN_NAME' in help text


Project: http://git-wip-us.apache.org/repos/asf/brooklyn-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-client/commit/dca9a27e
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-client/tree/dca9a27e
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-client/diff/dca9a27e

Branch: refs/heads/master
Commit: dca9a27e1aa4e8885821d307fd48981223701409
Parents: 3808374
Author: Geoff Macartney <ge...@cloudsoftcorp.com>
Authored: Mon Oct 24 14:49:17 2016 +0100
Committer: Geoff Macartney <ge...@cloudsoftcorp.com>
Committed: Mon Oct 24 14:49:17 2016 +0100

----------------------------------------------------------------------
 cli/app/app.go                 | 2 +-
 cli/commands/catalog-delete.go | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/dca9a27e/cli/app/app.go
----------------------------------------------------------------------
diff --git a/cli/app/app.go b/cli/app/app.go
index ad96fa3..07ef3cd 100644
--- a/cli/app/app.go
+++ b/cli/app/app.go
@@ -92,7 +92,7 @@ func getCommand(baseName string, metadata command_metadata.CommandMetadata, runn
 				Aliases:         operand.Aliases,
 				ShortName:       operand.ShortName,
 				Description:     operand.Description,
-				Usage:           operand.Usage,
+				Usage:           strings.Replace(operand.Usage, "BROOKLYN_NAME", baseName, -1),
 				Flags:           operand.Flags,
 				SkipFlagParsing: operand.SkipFlagParsing,
 				Action:          subCommandAction(command.Name, operand.Name, runner),

http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/dca9a27e/cli/commands/catalog-delete.go
----------------------------------------------------------------------
diff --git a/cli/commands/catalog-delete.go b/cli/commands/catalog-delete.go
index 77bb078..8b6a33a 100644
--- a/cli/commands/catalog-delete.go
+++ b/cli/commands/catalog-delete.go
@@ -44,7 +44,7 @@ func (cmd *DeleteCatalogItem) Metadata() command_metadata.CommandMetadata {
 		Name:        "delete",
 		Description: "delete the given catalog item",
 		Usage:       "BROOKLYN_NAME catalog  " + deleteCommandName +
-			" TYPE [ITEM_ID:VERSION] (where TYPE is one of application, location, entity, policy, may be abbreviated)",
+			" TYPE ITEM_ID:VERSION (where TYPE is one of application, location, entity, policy, may be abbreviated)",
 	}
 }
 


[06/19] brooklyn-client git commit: Simplify output of catalog add

Posted by sv...@apache.org.
Simplify output of catalog add


Project: http://git-wip-us.apache.org/repos/asf/brooklyn-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-client/commit/9ea65f92
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-client/tree/9ea65f92
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-client/diff/9ea65f92

Branch: refs/heads/master
Commit: 9ea65f9295ad923eaa9e137996327e96f78c5e7b
Parents: 2634701
Author: Geoff Macartney <ge...@cloudsoftcorp.com>
Authored: Thu Oct 13 20:56:10 2016 +0100
Committer: Geoff Macartney <ge...@cloudsoftcorp.com>
Committed: Thu Oct 13 20:56:10 2016 +0100

----------------------------------------------------------------------
 cli/api/catalog/catalog.go  | 8 +++++---
 cli/commands/add-catalog.go | 4 +++-
 2 files changed, 8 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/9ea65f92/cli/api/catalog/catalog.go
----------------------------------------------------------------------
diff --git a/cli/api/catalog/catalog.go b/cli/api/catalog/catalog.go
index 6a017f5..6f0797a 100644
--- a/cli/api/catalog/catalog.go
+++ b/cli/api/catalog/catalog.go
@@ -161,13 +161,15 @@ func Locations(network *net.Network) ([]models.CatalogLocationSummary, error) {
 	return catalogLocations, err
 }
 
-func AddCatalog(network *net.Network, resource string) (string, error) {
+func AddCatalog(network *net.Network, resource string) (map[string]models.CatalogEntitySummary, error) {
 	url := "/v1/catalog"
+	var entities map[string]models.CatalogEntitySummary
 	body, err := network.SendPostResourceRequest(url, resource, "application/json")
 	if err != nil {
-		return "", err
+		return nil, err
 	}
-	return string(body), nil
+	err = json.Unmarshal(body, &entities)
+	return entities, nil
 }
 
 func Reset(network *net.Network) (string, error) {

http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/9ea65f92/cli/commands/add-catalog.go
----------------------------------------------------------------------
diff --git a/cli/commands/add-catalog.go b/cli/commands/add-catalog.go
index d6ceba7..2d736c3 100644
--- a/cli/commands/add-catalog.go
+++ b/cli/commands/add-catalog.go
@@ -55,5 +55,7 @@ func (cmd *AddCatalog) Run(scope scope.Scope, c *cli.Context) {
 	if nil != err {
 		error_handler.ErrorExit(err)
 	}
-	fmt.Println(create)
+	for id, _ := range create {
+		fmt.Println(id)
+	}
 }


[09/19] brooklyn-client git commit: Do arguments to `list` as such, rather than as flags.

Posted by sv...@apache.org.
Do arguments to `list` as such, rather than as flags.

Retain the add-catalog command for backward compatibility.


Project: http://git-wip-us.apache.org/repos/asf/brooklyn-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-client/commit/3c6d1e5e
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-client/tree/3c6d1e5e
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-client/diff/3c6d1e5e

Branch: refs/heads/master
Commit: 3c6d1e5e8d444b1390bc866c0f39111b579bfb4d
Parents: c68dbc4
Author: Geoff Macartney <ge...@cloudsoftcorp.com>
Authored: Mon Oct 24 13:44:32 2016 +0100
Committer: Geoff Macartney <ge...@cloudsoftcorp.com>
Committed: Mon Oct 24 13:44:32 2016 +0100

----------------------------------------------------------------------
 cli/commands/add-catalog.go  | 10 +++----
 cli/commands/catalog-add.go  | 61 +++++++++++++++++++++++++++++++++++++++
 cli/commands/catalog-list.go | 57 ++++++++++++++++--------------------
 cli/commands/catalog.go      | 31 ++++++++++++++++++--
 4 files changed, 119 insertions(+), 40 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/3c6d1e5e/cli/commands/add-catalog.go
----------------------------------------------------------------------
diff --git a/cli/commands/add-catalog.go b/cli/commands/add-catalog.go
index 2d736c3..17bb85c 100644
--- a/cli/commands/add-catalog.go
+++ b/cli/commands/add-catalog.go
@@ -40,9 +40,9 @@ func NewAddCatalog(network *net.Network) (cmd *AddCatalog) {
 
 func (cmd *AddCatalog) Metadata() command_metadata.CommandMetadata {
 	return command_metadata.CommandMetadata{
-		Name:        "add",
-		Description: "* Add a new catalog item from the supplied YAML (a file or http URL)",
-		Usage:       "BROOKLYN_NAME catalog add ( FILEPATH | URL )",
+		Name:        "add-catalog",
+		Description: "(deprecated, use catalog add) Add a new catalog item from the supplied YAML (a file or http URL)",
+		Usage:       "BROOKLYN_NAME add-catalog ( FILEPATH | URL )",
 		Flags:       []cli.Flag{},
 	}
 }
@@ -55,7 +55,5 @@ func (cmd *AddCatalog) Run(scope scope.Scope, c *cli.Context) {
 	if nil != err {
 		error_handler.ErrorExit(err)
 	}
-	for id, _ := range create {
-		fmt.Println(id)
-	}
+	fmt.Println(create)
 }

http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/3c6d1e5e/cli/commands/catalog-add.go
----------------------------------------------------------------------
diff --git a/cli/commands/catalog-add.go b/cli/commands/catalog-add.go
new file mode 100644
index 0000000..0cf6281
--- /dev/null
+++ b/cli/commands/catalog-add.go
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package commands
+
+import (
+	"fmt"
+	"github.com/apache/brooklyn-client/cli/api/catalog"
+	"github.com/apache/brooklyn-client/cli/command_metadata"
+	"github.com/apache/brooklyn-client/cli/error_handler"
+	"github.com/apache/brooklyn-client/cli/net"
+	"github.com/apache/brooklyn-client/cli/scope"
+	"github.com/urfave/cli"
+)
+
+type CatalogAdd struct {
+	network *net.Network
+}
+
+func NewCatalogAdd(network *net.Network) (cmd *CatalogAdd) {
+	cmd = new(CatalogAdd)
+	cmd.network = network
+	return
+}
+
+func (cmd *CatalogAdd) Metadata() command_metadata.CommandMetadata {
+	return command_metadata.CommandMetadata{
+		Name:        "add",
+		Description: "Add a new catalog item from the supplied YAML (a file or http URL)",
+		Usage:       "BROOKLYN_NAME catalog add ( FILEPATH | URL )",
+		Flags:       []cli.Flag{},
+	}
+}
+
+func (cmd *CatalogAdd) Run(scope scope.Scope, c *cli.Context) {
+	if err := net.VerifyLoginURL(cmd.network); err != nil {
+		error_handler.ErrorExit(err)
+	}
+	create, err := catalog.AddCatalog(cmd.network, c.Args().First())
+	if nil != err {
+		error_handler.ErrorExit(err)
+	}
+	for id, _ := range create {
+		fmt.Println(id)
+	}
+}

http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/3c6d1e5e/cli/commands/catalog-list.go
----------------------------------------------------------------------
diff --git a/cli/commands/catalog-list.go b/cli/commands/catalog-list.go
index 5fa8414..7814b48 100644
--- a/cli/commands/catalog-list.go
+++ b/cli/commands/catalog-list.go
@@ -27,6 +27,7 @@ import (
 	"github.com/apache/brooklyn-client/cli/terminal"
 	"github.com/urfave/cli"
 	"github.com/apache/brooklyn-client/cli/models"
+	"errors"
 )
 
 type CatalogList struct {
@@ -39,29 +40,13 @@ func NewCatalogList(network *net.Network) (cmd *CatalogList) {
 	return
 }
 
+const commandName = "list"
+
 func (cmd *CatalogList) Metadata() command_metadata.CommandMetadata {
 	return command_metadata.CommandMetadata{
-		Name:        "list",
+		Name:        commandName,
 		Description: "* List the available catalog applications",
-		Usage:       "BROOKLYN_NAME catalog list",
-		Flags:       []cli.Flag{
-			cli.BoolFlag{
-				Name:  "applications, a",
-				Usage: "list applications (default)",
-			},
-			cli.BoolFlag{
-				Name:  "entities, e",
-				Usage: "list entities",
-			},
-			cli.BoolFlag{
-				Name:  "locations, l",
-				Usage: "list locations",
-			},
-			cli.BoolFlag{
-				Name:  "policies, p",
-				Usage: "list policies",
-			},
-		},
+		Usage:       "BROOKLYN_NAME catalog " + commandName,
 	}
 }
 
@@ -81,18 +66,26 @@ func (cmd *CatalogList) Run(scope scope.Scope, c *cli.Context) {
 }
 
 func (cmd *CatalogList) list(c *cli.Context) ([]models.IdentityDetails, error) {
-	if c.IsSet("entities") {
-		list, err := cmd.listEntities(c)
-		return list, err
-	} else if c.IsSet("locations") {
-		list, err := cmd.listLocations(c)
-		return list, err
-        } else if c.IsSet("policies") {
-		list, err := cmd.listPolicies(c)
-		return list, err
+
+	catalogType, err := GetCatalogType(c, commandName)
+	if  err != nil {
+		return nil, err
+	}
+	switch catalogType {
+	case ApplicationsItemType:
+		items, err := cmd.listCatalogApplications(c)
+		return items, err
+	case EntitiesItemType:
+		items, err := cmd.listEntities(c)
+		return items, err
+	case LocationsItemType:
+		items, err := cmd.listLocations(c)
+		return items, err
+	case PoliciesItemType:
+		items, err := cmd.listPolicies(c)
+		return items, err
 	}
-	items, err := cmd.listCatalogItems(c)
-	return items, err
+	return nil, errors.New("Unrecognised argument")
 }
 
 func (cmd *CatalogList) listPolicies(c *cli.Context) ([]models.IdentityDetails, error) {
@@ -131,7 +124,7 @@ func (cmd *CatalogList) listEntities(c *cli.Context) ([]models.IdentityDetails,
 	return result, nil
 }
 
-func (cmd *CatalogList) listCatalogItems(c *cli.Context) ([]models.IdentityDetails, error) {
+func (cmd *CatalogList) listCatalogApplications(c *cli.Context) ([]models.IdentityDetails, error) {
 	items, err := catalog.Catalog(cmd.network)
 	if err != nil {
 		return nil, err

http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/3c6d1e5e/cli/commands/catalog.go
----------------------------------------------------------------------
diff --git a/cli/commands/catalog.go b/cli/commands/catalog.go
index 0cc3380..f0cee15 100644
--- a/cli/commands/catalog.go
+++ b/cli/commands/catalog.go
@@ -27,6 +27,7 @@ import (
 	"github.com/urfave/cli"
 	"strings"
 	"fmt"
+	"errors"
 )
 
 type Catalog struct {
@@ -39,7 +40,7 @@ func NewCatalog(network *net.Network) (cmd *Catalog) {
 	cmd.network = network
 	cmd.catalogCommands = map[string]command.Command {
 		ListCatalogCommand: NewCatalogList(cmd.network),
-		AddCatalogCommand: NewAddCatalog(cmd.network),
+		AddCatalogCommand: NewCatalogAdd(cmd.network),
 		DeleteCatalogCommand: NewDeleteCatalogItem(cmd.network),
 	}
 	return
@@ -56,6 +57,33 @@ var catalogCommands = []string{
 }
 var catalogCommandsUsage = strings.Join(catalogCommands, " | ")
 
+type CatalogItemType int
+const  (
+	Unknown = iota
+	ApplicationsItemType
+	EntitiesItemType
+	LocationsItemType
+	PoliciesItemType
+)
+const catalogItemTypesUsage = " ( applications | entities | locations | policies )"
+
+func GetCatalogType(c *cli.Context, commandName string) (CatalogItemType, error) {
+	if len(c.Args()) != 1 {
+		return Unknown, errors.New(c.App.Name + " " + commandName + catalogItemTypesUsage)
+	}
+	commandType := c.Args().First()
+	if strings.HasPrefix("entities", commandType) {
+		return EntitiesItemType, nil
+	} else if strings.HasPrefix("locations", commandType) {
+		return LocationsItemType, nil
+	} else if strings.HasPrefix("policies", commandType) {
+		return PoliciesItemType, nil
+	} else if strings.HasPrefix("applications", commandType) {
+		return ApplicationsItemType, nil
+	}
+	return Unknown, errors.New("Unknown type: " + commandType)
+}
+
 func (cmd *Catalog) SubCommandNames() []string {
 	return catalogCommands
 }
@@ -83,5 +111,4 @@ func (cmd *Catalog) Run(scope scope.Scope, c *cli.Context) {
 		error_handler.ErrorExit(err)
 	}
  	fmt.Printf("'catalog' requires one of (%s)\n", catalogCommandsUsage)
-
 }


[02/19] brooklyn-client git commit: Add catalog list

Posted by sv...@apache.org.
Add catalog list


Project: http://git-wip-us.apache.org/repos/asf/brooklyn-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-client/commit/16eff1b0
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-client/tree/16eff1b0
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-client/diff/16eff1b0

Branch: refs/heads/master
Commit: 16eff1b0b2290eea1d3d1bd1b8907637197bc974
Parents: 7db8e15
Author: Geoff Macartney <ge...@cloudsoftcorp.com>
Authored: Wed Oct 12 14:07:59 2016 +0100
Committer: Geoff Macartney <ge...@cloudsoftcorp.com>
Committed: Wed Oct 12 14:07:59 2016 +0100

----------------------------------------------------------------------
 cli/app/app.go                 |  3 +-
 cli/command_factory/factory.go |  2 +-
 cli/commands/catalog-list.go   | 63 +++++++++++++++++++++++++++++++++++++
 cli/commands/catalog.go        | 42 +++++++++++++++++--------
 4 files changed, 94 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/16eff1b0/cli/app/app.go
----------------------------------------------------------------------
diff --git a/cli/app/app.go b/cli/app/app.go
index 4fb39a2..ad96fa3 100644
--- a/cli/app/app.go
+++ b/cli/app/app.go
@@ -19,7 +19,6 @@
 package app
 
 import (
-	"fmt"
 	"github.com/apache/brooklyn-client/cli/command_metadata"
 	"github.com/apache/brooklyn-client/cli/command_runner"
 	"github.com/apache/brooklyn-client/cli/error_handler"
@@ -111,7 +110,7 @@ func subCommandAction(command string, operand string, runner command_runner.Runn
 	return func(context *cli.Context) {
 		err := runner.RunSubCmdByName(command, operand, context)
 		if err != nil {
-			fmt.Fprintln(os.Stderr, err)
+			error_handler.ErrorExit(err)
 		}
 	}
 }

http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/16eff1b0/cli/command_factory/factory.go
----------------------------------------------------------------------
diff --git a/cli/command_factory/factory.go b/cli/command_factory/factory.go
index ae1634d..399014f 100644
--- a/cli/command_factory/factory.go
+++ b/cli/command_factory/factory.go
@@ -55,7 +55,7 @@ func NewFactory(network *net.Network, config *io.Config) (factory concreteFactor
 	factory.simpleCommand(commands.NewAddChildren(network))
 	factory.simpleCommand(commands.NewApplication(network))
 	//factory.simpleCommand(commands.NewApplications(network))
-	factory.simpleCommand(commands.NewCatalog(network))
+	factory.superCommand(commands.NewCatalog(network))
 	factory.simpleCommand(commands.NewConfig(network))
 	factory.simpleCommand(commands.NewDeploy(network))
 	factory.simpleCommand(commands.NewDelete(network))

http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/16eff1b0/cli/commands/catalog-list.go
----------------------------------------------------------------------
diff --git a/cli/commands/catalog-list.go b/cli/commands/catalog-list.go
new file mode 100644
index 0000000..bb6efe3
--- /dev/null
+++ b/cli/commands/catalog-list.go
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package commands
+
+import (
+	"github.com/apache/brooklyn-client/cli/api/catalog"
+	"github.com/apache/brooklyn-client/cli/command_metadata"
+	"github.com/apache/brooklyn-client/cli/error_handler"
+	"github.com/apache/brooklyn-client/cli/net"
+	"github.com/apache/brooklyn-client/cli/scope"
+	"github.com/apache/brooklyn-client/cli/terminal"
+	"github.com/urfave/cli"
+)
+
+type CatalogList struct {
+	network *net.Network
+}
+
+func NewCatalogList(network *net.Network) (cmd *CatalogList) {
+	cmd = new(CatalogList)
+	cmd.network = network
+	return
+}
+
+func (cmd *CatalogList) Metadata() command_metadata.CommandMetadata {
+	return command_metadata.CommandMetadata{
+		Name:        "list",
+		Description: "* List the available catalog applications",
+		Usage:       "BROOKLYN_NAME catalog list",
+		Flags:       []cli.Flag{},
+	}
+}
+
+func (cmd *CatalogList) Run(scope scope.Scope, c *cli.Context) {
+	if err := net.VerifyLoginURL(cmd.network); err != nil {
+		error_handler.ErrorExit(err)
+	}
+	catalog, err := catalog.Catalog(cmd.network)
+	if nil != err {
+		error_handler.ErrorExit(err)
+	}
+	table := terminal.NewTable([]string{"Id", "Name", "Description"})
+	for _, app := range catalog {
+		table.Add(app.Id, app.Name, app.Description)
+	}
+	table.Print()
+}

http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/16eff1b0/cli/commands/catalog.go
----------------------------------------------------------------------
diff --git a/cli/commands/catalog.go b/cli/commands/catalog.go
index eab08b8..6cfc324 100644
--- a/cli/commands/catalog.go
+++ b/cli/commands/catalog.go
@@ -19,31 +19,54 @@
 package commands
 
 import (
-	"github.com/apache/brooklyn-client/cli/api/catalog"
+	"github.com/apache/brooklyn-client/cli/command"
 	"github.com/apache/brooklyn-client/cli/command_metadata"
 	"github.com/apache/brooklyn-client/cli/error_handler"
 	"github.com/apache/brooklyn-client/cli/net"
 	"github.com/apache/brooklyn-client/cli/scope"
-	"github.com/apache/brooklyn-client/cli/terminal"
 	"github.com/urfave/cli"
+	"strings"
+	"fmt"
 )
 
 type Catalog struct {
 	network *net.Network
+	catalogCommands map[string]command.Command
 }
 
 func NewCatalog(network *net.Network) (cmd *Catalog) {
 	cmd = new(Catalog)
 	cmd.network = network
+	cmd.catalogCommands = map[string]command.Command {
+		ListCatalogCommand: NewCatalogList(cmd.network),
+	}
 	return
 }
 
+const ListCatalogCommand = "list"
+
+var catalogCommands = []string{
+	ListCatalogCommand,
+}
+var catalogCommandsUsage = strings.Join(catalogCommands, " | ")
+
+func (cmd *Catalog) SubCommandNames() []string {
+	return catalogCommands
+}
+
+func (cmd *Catalog) SubCommand(name string) command.Command {
+	return cmd.catalogCommands[name]
+}
+
 func (cmd *Catalog) Metadata() command_metadata.CommandMetadata {
 	return command_metadata.CommandMetadata{
 		Name:        "catalog",
-		Description: "* List the available catalog applications",
-		Usage:       "BROOKLYN_NAME catalog",
+		Description: "Catalog operations",
+		Usage:       "BROOKLYN_NAME catalog (" + catalogCommandsUsage + ")",
 		Flags:       []cli.Flag{},
+		Operands:    []command_metadata.CommandMetadata{
+			cmd.SubCommand(ListCatalogCommand).Metadata(),
+		},
 	}
 }
 
@@ -51,13 +74,6 @@ func (cmd *Catalog) Run(scope scope.Scope, c *cli.Context) {
 	if err := net.VerifyLoginURL(cmd.network); err != nil {
 		error_handler.ErrorExit(err)
 	}
-	catalog, err := catalog.Catalog(cmd.network)
-	if nil != err {
-		error_handler.ErrorExit(err)
-	}
-	table := terminal.NewTable([]string{"Id", "Name", "Description"})
-	for _, app := range catalog {
-		table.Add(app.Id, app.Name, app.Description)
-	}
-	table.Print()
+	fmt.Printf("Unrecognised instruction, please use one of (%s)\n", catalogCommandsUsage)
+
 }


[19/19] brooklyn-client git commit: Closes #29

Posted by sv...@apache.org.
Closes #29

Usability improvements and better catalog support


Project: http://git-wip-us.apache.org/repos/asf/brooklyn-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-client/commit/5dd17464
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-client/tree/5dd17464
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-client/diff/5dd17464

Branch: refs/heads/master
Commit: 5dd1746493080a7316ec807ed1b3aa3eb1e8f323
Parents: ed158fd 404e25f
Author: Svetoslav Neykov <sv...@neykov.name>
Authored: Tue Oct 25 22:09:20 2016 +0300
Committer: Svetoslav Neykov <sv...@neykov.name>
Committed: Tue Oct 25 22:09:20 2016 +0300

----------------------------------------------------------------------
 cli/api/access_control/access_control.go   |   4 +-
 cli/api/activities/activities.go           |   4 +-
 cli/api/application/applications.go        |   4 +-
 cli/api/catalog/catalog.go                 |  41 ++++---
 cli/api/entities/entities.go               |   4 +-
 cli/api/entity_config/config.go            |   4 +-
 cli/api/entity_effectors/effectors.go      |   4 +-
 cli/api/entity_policies/policies.go        |   4 +-
 cli/api/entity_policy_config/config.go     |   4 +-
 cli/api/entity_sensors/sensors.go          |   4 +-
 cli/api/locations/locations.go             |   4 +-
 cli/api/server/server.go                   |   2 +-
 cli/api/usage/usage.go                     |   4 +-
 cli/api/version/version.go                 |   4 +-
 cli/app/app.go                             |  11 +-
 cli/br/brooklyn.go                         |  14 +--
 cli/command/command.go                     |   4 +-
 cli/command_factory/factory.go             |  12 +-
 cli/command_runner/runner.go               |   4 +-
 cli/commands/access.go                     |  10 +-
 cli/commands/activity-stream.go            |  10 +-
 cli/commands/activity.go                   |  16 +--
 cli/commands/add-catalog.go                |  12 +-
 cli/commands/add-children.go               |  12 +-
 cli/commands/add-location.go               |   2 +-
 cli/commands/add-policy.go                 |   8 +-
 cli/commands/application.go                |  18 +--
 cli/commands/catalog-add.go                |  61 +++++++++++
 cli/commands/catalog-applications.go       |   2 +-
 cli/commands/catalog-delete.go             | 108 ++++++++++++++++++
 cli/commands/catalog-entities.go           |   2 +-
 cli/commands/catalog-entity.go             |   2 +-
 cli/commands/catalog-list.go               | 139 ++++++++++++++++++++++++
 cli/commands/catalog-location.go           |   2 +-
 cli/commands/catalog-locations.go          |   2 +-
 cli/commands/catalog-policies.go           |   2 +-
 cli/commands/catalog-policy.go             |   2 +-
 cli/commands/catalog.go                    |  82 +++++++++++---
 cli/commands/config.go                     |  12 +-
 cli/commands/delete-catalog-application.go |  33 ------
 cli/commands/delete-catalog-entity.go      |   2 +-
 cli/commands/delete-catalog-policy.go      |   2 +-
 cli/commands/delete.go                     |  10 +-
 cli/commands/deploy.go                     |  14 +--
 cli/commands/destroy-policy.go             |  10 +-
 cli/commands/effector.go                   |  12 +-
 cli/commands/entity.go                     |  14 +--
 cli/commands/invoke.go                     |  10 +-
 cli/commands/list.go                       |  10 +-
 cli/commands/locations.go                  |  12 +-
 cli/commands/login.go                      |  12 +-
 cli/commands/policy.go                     |  16 +--
 cli/commands/rename.go                     |  10 +-
 cli/commands/reset-catalog.go              |   2 +-
 cli/commands/sensor.go                     |  14 +--
 cli/commands/set.go                        |  10 +-
 cli/commands/spec.go                       |  10 +-
 cli/commands/start-policy.go               |  10 +-
 cli/commands/stop-policy.go                |  10 +-
 cli/commands/tree.go                       |  12 +-
 cli/commands/version.go                    |  10 +-
 cli/error_handler/error.go                 |   4 +
 cli/io/config.go                           |   2 +-
 cli/models/applications.go                 |   7 +-
 cli/models/catalog.go                      |  31 +++---
 cli/net/net.go                             |  79 +++++++++-----
 cli/release/build.sh                       |   3 +-
 cli/terminal/table.go                      |  17 +--
 cli/test/test.sh                           |   2 +-
 69 files changed, 698 insertions(+), 332 deletions(-)
----------------------------------------------------------------------



[11/19] brooklyn-client git commit: Make args singular for nicer syntax of delete command.

Posted by sv...@apache.org.
Make args singular for nicer syntax of delete command.


Project: http://git-wip-us.apache.org/repos/asf/brooklyn-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-client/commit/38083744
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-client/tree/38083744
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-client/diff/38083744

Branch: refs/heads/master
Commit: 38083744ffed5b875881484c8a25d7a882de7d6f
Parents: baa2801
Author: Geoff Macartney <ge...@cloudsoftcorp.com>
Authored: Mon Oct 24 14:35:27 2016 +0100
Committer: Geoff Macartney <ge...@cloudsoftcorp.com>
Committed: Mon Oct 24 14:35:27 2016 +0100

----------------------------------------------------------------------
 cli/commands/catalog-delete.go |  2 +-
 cli/commands/catalog.go        | 10 +++++-----
 2 files changed, 6 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/38083744/cli/commands/catalog-delete.go
----------------------------------------------------------------------
diff --git a/cli/commands/catalog-delete.go b/cli/commands/catalog-delete.go
index 443f550..77bb078 100644
--- a/cli/commands/catalog-delete.go
+++ b/cli/commands/catalog-delete.go
@@ -44,7 +44,7 @@ func (cmd *DeleteCatalogItem) Metadata() command_metadata.CommandMetadata {
 		Name:        "delete",
 		Description: "delete the given catalog item",
 		Usage:       "BROOKLYN_NAME catalog  " + deleteCommandName +
-			" TYPE [ITEM_ID:VERSION] (where TYPE is one of applications, locations, entities, policies, may be abbreviated)",
+			" TYPE [ITEM_ID:VERSION] (where TYPE is one of application, location, entity, policy, may be abbreviated)",
 	}
 }
 

http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/38083744/cli/commands/catalog.go
----------------------------------------------------------------------
diff --git a/cli/commands/catalog.go b/cli/commands/catalog.go
index 86073a6..117dcb7 100644
--- a/cli/commands/catalog.go
+++ b/cli/commands/catalog.go
@@ -65,17 +65,17 @@ const  (
 	LocationsItemType
 	PoliciesItemType
 )
-const catalogItemTypesUsage = " ( applications | entities | locations | policies )"
+const catalogItemTypesUsage = " ( application | entity | location | policy )"
 
 func GetCatalogType(c *cli.Context) (CatalogItemType, error) {
 	commandType := c.Args().First()
-	if strings.HasPrefix("entities", commandType) {
+	if strings.HasPrefix("entity", commandType) {
 		return EntitiesItemType, nil
-	} else if strings.HasPrefix("locations", commandType) {
+	} else if strings.HasPrefix("location", commandType) {
 		return LocationsItemType, nil
-	} else if strings.HasPrefix("policies", commandType) {
+	} else if strings.HasPrefix("policy", commandType) {
 		return PoliciesItemType, nil
-	} else if strings.HasPrefix("applications", commandType) {
+	} else if strings.HasPrefix("application", commandType) {
 		return ApplicationsItemType, nil
 	}
 	return Unknown, errors.New("Unknown type: " + commandType)


[07/19] brooklyn-client git commit: add br catalog delete for entities, locations, policies

Posted by sv...@apache.org.
add br catalog delete for entities, locations, policies


Project: http://git-wip-us.apache.org/repos/asf/brooklyn-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-client/commit/625ad88d
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-client/tree/625ad88d
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-client/diff/625ad88d

Branch: refs/heads/master
Commit: 625ad88d382ebd87b03d8ca9dd2829d9a79503dc
Parents: 9ea65f9
Author: Geoff Macartney <ge...@cloudsoftcorp.com>
Authored: Fri Oct 14 13:44:59 2016 +0100
Committer: Geoff Macartney <ge...@cloudsoftcorp.com>
Committed: Fri Oct 14 13:44:59 2016 +0100

----------------------------------------------------------------------
 cli/api/catalog/catalog.go                 | 11 +++-
 cli/commands/catalog.go                    |  2 +-
 cli/commands/delete-catalog-application.go | 78 ++++++++++++++++++++-----
 3 files changed, 74 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/625ad88d/cli/api/catalog/catalog.go
----------------------------------------------------------------------
diff --git a/cli/api/catalog/catalog.go b/cli/api/catalog/catalog.go
index 6f0797a..56b37cb 100644
--- a/cli/api/catalog/catalog.go
+++ b/cli/api/catalog/catalog.go
@@ -100,7 +100,7 @@ func GetPolicyWithVersion(network *net.Network, policyId, version string) (model
 }
 
 func DeletePolicyWithVersion(network *net.Network, policyId, version string) (string, error) {
-	url := fmt.Sprintf("/v1/catalog/policies/%s/%s", policyId)
+	url := fmt.Sprintf("/v1/catalog/policies/%s/%s", policyId, version)
 	body, err := network.SendDeleteRequest(url)
 	if err != nil {
 		return "", err
@@ -139,6 +139,15 @@ func DeleteApplicationWithVersion(network *net.Network, applicationId, version s
 	return string(body), nil
 }
 
+func DeleteLocationWithVersion(network *net.Network, locationId, version string) (string, error) {
+	url := fmt.Sprintf("/v1/catalog/locations/%s/%s", locationId, version)
+	body, err := network.SendDeleteRequest(url)
+	if err != nil {
+		return "", err
+	}
+	return string(body), nil
+}
+
 func Policies(network *net.Network) ([]models.CatalogPolicySummary, error) {
 	url := "/v1/catalog/policies"
 	var policies []models.CatalogPolicySummary

http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/625ad88d/cli/commands/catalog.go
----------------------------------------------------------------------
diff --git a/cli/commands/catalog.go b/cli/commands/catalog.go
index 1a870b6..0cc3380 100644
--- a/cli/commands/catalog.go
+++ b/cli/commands/catalog.go
@@ -40,7 +40,7 @@ func NewCatalog(network *net.Network) (cmd *Catalog) {
 	cmd.catalogCommands = map[string]command.Command {
 		ListCatalogCommand: NewCatalogList(cmd.network),
 		AddCatalogCommand: NewAddCatalog(cmd.network),
-		DeleteCatalogCommand: NewDeleteCatalogApplication(cmd.network),
+		DeleteCatalogCommand: NewDeleteCatalogItem(cmd.network),
 	}
 	return
 }

http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/625ad88d/cli/commands/delete-catalog-application.go
----------------------------------------------------------------------
diff --git a/cli/commands/delete-catalog-application.go b/cli/commands/delete-catalog-application.go
index ef8c561..888184c 100644
--- a/cli/commands/delete-catalog-application.go
+++ b/cli/commands/delete-catalog-application.go
@@ -28,40 +28,88 @@ import (
 	"github.com/apache/brooklyn-client/cli/api/catalog"
 )
 
-type DeleteCatalogApplication struct {
+type DeleteCatalogItem  struct {
 	network *net.Network
 }
 
-func NewDeleteCatalogApplication(network *net.Network) (cmd *DeleteCatalogApplication) {
-	cmd = new(DeleteCatalogApplication)
+func NewDeleteCatalogItem(network *net.Network) (cmd *DeleteCatalogItem) {
+	cmd = new(DeleteCatalogItem)
 	cmd.network = network
 	return
 }
 
-func (cmd *DeleteCatalogApplication) Metadata() command_metadata.CommandMetadata {
+func (cmd *DeleteCatalogItem) Metadata() command_metadata.CommandMetadata {
 	return command_metadata.CommandMetadata{
 		Name:        "delete",
-		Description: "delete the given catalog application",
-		Usage:       "BROOKLYN_NAME catalog delete [APPLICATION_ID:VERSION]",
-		Flags:       []cli.Flag{},
+		Description: "delete the given catalog item",
+		Usage:       "BROOKLYN_NAME catalog delete [ITEM_ID:VERSION]",
+		Flags:       []cli.Flag{
+			cli.BoolFlag{
+				Name:  "applications, a",
+				Usage: "delete application (default)",
+			},
+			cli.BoolFlag{
+				Name:  "entities, e",
+				Usage: "delete entity",
+			},
+			cli.BoolFlag{
+				Name:  "locations, l",
+				Usage: "delete location",
+			},
+			cli.BoolFlag{
+				Name:  "policies, p",
+				Usage: "delete policy",
+			},
+		},
 	}
 }
 
-func (cmd *DeleteCatalogApplication) Run(scope scope.Scope, c *cli.Context) {
+func (cmd *DeleteCatalogItem) Run(scope scope.Scope, c *cli.Context) {
 	if err := net.VerifyLoginURL(cmd.network); err != nil {
 		error_handler.ErrorExit(err)
 	}
 	if len(c.Args()) != 1 {
-		error_handler.ErrorExit("command requires single argument APPLICATION_ID:VERSION")
+		error_handler.ErrorExit("command requires single argument ITEM_ID:VERSION")
 	}
-	appVersion := strings.Split(c.Args().First(), ":")
-	if len(appVersion) != 2 {
-		error_handler.ErrorExit("command requires single argument APPLICATION_ID:VERSION")
+	itemVersion := strings.Split(c.Args().First(), ":")
+	if len(itemVersion) != 2 {
+		error_handler.ErrorExit("command requires single argument ITEM_ID:VERSION")
 	}
-	appId := appVersion[0]
-	version := appVersion[1]
-	_, err := catalog.DeleteApplicationWithVersion(cmd.network, appId, version)
+	itemId := itemVersion[0]
+	version := itemVersion[1]
+	err := cmd.deleteItem(c, itemId, version)
 	if nil != err {
 		error_handler.ErrorExit(err)
 	}
 }
+
+func (cmd *DeleteCatalogItem) deleteItem(c *cli.Context, itemId string, version string) (error){
+	if c.IsSet("entities") {
+		return cmd.deleteEntity(c, itemId, version)
+	} else if c.IsSet("locations") {
+		return cmd.deleteLocation(c, itemId, version)
+	} else if c.IsSet("policies") {
+		return cmd.deletePolicy(c, itemId, version)
+	}
+	return cmd.deleteApplication(c, itemId, version)
+}
+
+func (cmd *DeleteCatalogItem) deleteApplication(c *cli.Context, itemId string, version string) (error){
+	_, err := catalog.DeleteApplicationWithVersion(cmd.network, itemId, version)
+	return err
+}
+
+func (cmd *DeleteCatalogItem) deleteEntity(c *cli.Context, itemId string, version string) (error){
+	_, err := catalog.DeleteEntityWithVersion(cmd.network, itemId, version)
+	return err
+}
+
+func (cmd *DeleteCatalogItem) deletePolicy(c *cli.Context, itemId string, version string) (error){
+	_, err := catalog.DeletePolicyWithVersion(cmd.network, itemId, version)
+	return err
+}
+
+func (cmd *DeleteCatalogItem) deleteLocation(c *cli.Context, itemId string, version string) (error){
+	_, err := catalog.DeleteLocationWithVersion(cmd.network, itemId, version)
+	return err
+}
\ No newline at end of file


[10/19] brooklyn-client git commit: Do arguments to `delete` as such, rather than as flags.

Posted by sv...@apache.org.
Do arguments to `delete` as such, rather than as flags.


Project: http://git-wip-us.apache.org/repos/asf/brooklyn-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-client/commit/baa28010
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-client/tree/baa28010
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-client/diff/baa28010

Branch: refs/heads/master
Commit: baa28010b55fd4c19d59b781e22178fc08885afa
Parents: 3c6d1e5
Author: Geoff Macartney <ge...@cloudsoftcorp.com>
Authored: Mon Oct 24 14:32:31 2016 +0100
Committer: Geoff Macartney <ge...@cloudsoftcorp.com>
Committed: Mon Oct 24 14:32:31 2016 +0100

----------------------------------------------------------------------
 cli/commands/catalog-delete.go             | 110 +++++++++++++++++++++++
 cli/commands/catalog-list.go               |  12 +--
 cli/commands/catalog.go                    |   5 +-
 cli/commands/delete-catalog-application.go | 115 ------------------------
 4 files changed, 118 insertions(+), 124 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/baa28010/cli/commands/catalog-delete.go
----------------------------------------------------------------------
diff --git a/cli/commands/catalog-delete.go b/cli/commands/catalog-delete.go
new file mode 100644
index 0000000..443f550
--- /dev/null
+++ b/cli/commands/catalog-delete.go
@@ -0,0 +1,110 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package commands
+
+import (
+	"github.com/apache/brooklyn-client/cli/net"
+	"github.com/apache/brooklyn-client/cli/command_metadata"
+	"github.com/urfave/cli"
+	"github.com/apache/brooklyn-client/cli/scope"
+	"github.com/apache/brooklyn-client/cli/error_handler"
+	"strings"
+	"github.com/apache/brooklyn-client/cli/api/catalog"
+	"errors"
+)
+
+type DeleteCatalogItem  struct {
+	network *net.Network
+}
+
+func NewDeleteCatalogItem(network *net.Network) (cmd *DeleteCatalogItem) {
+	cmd = new(DeleteCatalogItem)
+	cmd.network = network
+	return
+}
+
+func (cmd *DeleteCatalogItem) Metadata() command_metadata.CommandMetadata {
+	return command_metadata.CommandMetadata{
+		Name:        "delete",
+		Description: "delete the given catalog item",
+		Usage:       "BROOKLYN_NAME catalog  " + deleteCommandName +
+			" TYPE [ITEM_ID:VERSION] (where TYPE is one of applications, locations, entities, policies, may be abbreviated)",
+	}
+}
+
+const deleteCommandName = "delete"
+
+
+func (cmd *DeleteCatalogItem) Run(scope scope.Scope, c *cli.Context) {
+	if err := net.VerifyLoginURL(cmd.network); err != nil {
+		error_handler.ErrorExit(err)
+	}
+	args := c.Args()
+	if len(args) != 2 {
+		error_handler.ErrorExit("command requires arguments TYPE ITEM_ID:VERSION")
+	}
+	itemVersion := strings.Split(args.Get(1), ":")
+	if len(itemVersion) != 2 {
+		error_handler.ErrorExit("command requires arguments TYPE ITEM_ID:VERSION")
+	}
+	itemId := itemVersion[0]
+	version := itemVersion[1]
+	err := cmd.deleteItem(c, itemId, version)
+	if nil != err {
+		error_handler.ErrorExit(err)
+	}
+}
+
+func (cmd *DeleteCatalogItem) deleteItem(c *cli.Context, itemId string, version string) (error){
+	catalogType, err := GetCatalogType(c)
+	if  err != nil {
+		return err
+	}
+	switch catalogType {
+	case ApplicationsItemType:
+		return cmd.deleteApplication(c, itemId, version)
+	case EntitiesItemType:
+		return cmd.deleteEntity(c, itemId, version)
+	case LocationsItemType:
+		return cmd.deleteLocation(c, itemId, version)
+	case PoliciesItemType:
+		return cmd.deletePolicy(c, itemId, version)
+	}
+	return errors.New("Unknown type " + c.Args().First())
+}
+
+func (cmd *DeleteCatalogItem) deleteApplication(c *cli.Context, itemId string, version string) (error){
+	_, err := catalog.DeleteApplicationWithVersion(cmd.network, itemId, version)
+	return err
+}
+
+func (cmd *DeleteCatalogItem) deleteEntity(c *cli.Context, itemId string, version string) (error){
+	_, err := catalog.DeleteEntityWithVersion(cmd.network, itemId, version)
+	return err
+}
+
+func (cmd *DeleteCatalogItem) deletePolicy(c *cli.Context, itemId string, version string) (error){
+	_, err := catalog.DeletePolicyWithVersion(cmd.network, itemId, version)
+	return err
+}
+
+func (cmd *DeleteCatalogItem) deleteLocation(c *cli.Context, itemId string, version string) (error){
+	_, err := catalog.DeleteLocationWithVersion(cmd.network, itemId, version)
+	return err
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/baa28010/cli/commands/catalog-list.go
----------------------------------------------------------------------
diff --git a/cli/commands/catalog-list.go b/cli/commands/catalog-list.go
index 7814b48..bc22c2c 100644
--- a/cli/commands/catalog-list.go
+++ b/cli/commands/catalog-list.go
@@ -40,13 +40,13 @@ func NewCatalogList(network *net.Network) (cmd *CatalogList) {
 	return
 }
 
-const commandName = "list"
+const listCommandName = "list"
 
 func (cmd *CatalogList) Metadata() command_metadata.CommandMetadata {
 	return command_metadata.CommandMetadata{
-		Name:        commandName,
+		Name:        listCommandName,
 		Description: "* List the available catalog applications",
-		Usage:       "BROOKLYN_NAME catalog " + commandName,
+		Usage:       "BROOKLYN_NAME catalog " + listCommandName + " " + catalogItemTypesUsage + " (may be abbreviated)",
 	}
 }
 
@@ -66,8 +66,10 @@ func (cmd *CatalogList) Run(scope scope.Scope, c *cli.Context) {
 }
 
 func (cmd *CatalogList) list(c *cli.Context) ([]models.IdentityDetails, error) {
-
-	catalogType, err := GetCatalogType(c, commandName)
+	if len(c.Args()) != 1 {
+		return nil, errors.New(c.App.Name + " " + listCommandName + catalogItemTypesUsage + " (may be abbreviated)")
+	}
+	catalogType, err := GetCatalogType(c)
 	if  err != nil {
 		return nil, err
 	}

http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/baa28010/cli/commands/catalog.go
----------------------------------------------------------------------
diff --git a/cli/commands/catalog.go b/cli/commands/catalog.go
index f0cee15..86073a6 100644
--- a/cli/commands/catalog.go
+++ b/cli/commands/catalog.go
@@ -67,10 +67,7 @@ const  (
 )
 const catalogItemTypesUsage = " ( applications | entities | locations | policies )"
 
-func GetCatalogType(c *cli.Context, commandName string) (CatalogItemType, error) {
-	if len(c.Args()) != 1 {
-		return Unknown, errors.New(c.App.Name + " " + commandName + catalogItemTypesUsage)
-	}
+func GetCatalogType(c *cli.Context) (CatalogItemType, error) {
 	commandType := c.Args().First()
 	if strings.HasPrefix("entities", commandType) {
 		return EntitiesItemType, nil

http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/baa28010/cli/commands/delete-catalog-application.go
----------------------------------------------------------------------
diff --git a/cli/commands/delete-catalog-application.go b/cli/commands/delete-catalog-application.go
deleted file mode 100644
index 888184c..0000000
--- a/cli/commands/delete-catalog-application.go
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you 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
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package commands
-
-import (
-	"github.com/apache/brooklyn-client/cli/net"
-	"github.com/apache/brooklyn-client/cli/command_metadata"
-	"github.com/urfave/cli"
-	"github.com/apache/brooklyn-client/cli/scope"
-	"github.com/apache/brooklyn-client/cli/error_handler"
-	"strings"
-	"github.com/apache/brooklyn-client/cli/api/catalog"
-)
-
-type DeleteCatalogItem  struct {
-	network *net.Network
-}
-
-func NewDeleteCatalogItem(network *net.Network) (cmd *DeleteCatalogItem) {
-	cmd = new(DeleteCatalogItem)
-	cmd.network = network
-	return
-}
-
-func (cmd *DeleteCatalogItem) Metadata() command_metadata.CommandMetadata {
-	return command_metadata.CommandMetadata{
-		Name:        "delete",
-		Description: "delete the given catalog item",
-		Usage:       "BROOKLYN_NAME catalog delete [ITEM_ID:VERSION]",
-		Flags:       []cli.Flag{
-			cli.BoolFlag{
-				Name:  "applications, a",
-				Usage: "delete application (default)",
-			},
-			cli.BoolFlag{
-				Name:  "entities, e",
-				Usage: "delete entity",
-			},
-			cli.BoolFlag{
-				Name:  "locations, l",
-				Usage: "delete location",
-			},
-			cli.BoolFlag{
-				Name:  "policies, p",
-				Usage: "delete policy",
-			},
-		},
-	}
-}
-
-func (cmd *DeleteCatalogItem) Run(scope scope.Scope, c *cli.Context) {
-	if err := net.VerifyLoginURL(cmd.network); err != nil {
-		error_handler.ErrorExit(err)
-	}
-	if len(c.Args()) != 1 {
-		error_handler.ErrorExit("command requires single argument ITEM_ID:VERSION")
-	}
-	itemVersion := strings.Split(c.Args().First(), ":")
-	if len(itemVersion) != 2 {
-		error_handler.ErrorExit("command requires single argument ITEM_ID:VERSION")
-	}
-	itemId := itemVersion[0]
-	version := itemVersion[1]
-	err := cmd.deleteItem(c, itemId, version)
-	if nil != err {
-		error_handler.ErrorExit(err)
-	}
-}
-
-func (cmd *DeleteCatalogItem) deleteItem(c *cli.Context, itemId string, version string) (error){
-	if c.IsSet("entities") {
-		return cmd.deleteEntity(c, itemId, version)
-	} else if c.IsSet("locations") {
-		return cmd.deleteLocation(c, itemId, version)
-	} else if c.IsSet("policies") {
-		return cmd.deletePolicy(c, itemId, version)
-	}
-	return cmd.deleteApplication(c, itemId, version)
-}
-
-func (cmd *DeleteCatalogItem) deleteApplication(c *cli.Context, itemId string, version string) (error){
-	_, err := catalog.DeleteApplicationWithVersion(cmd.network, itemId, version)
-	return err
-}
-
-func (cmd *DeleteCatalogItem) deleteEntity(c *cli.Context, itemId string, version string) (error){
-	_, err := catalog.DeleteEntityWithVersion(cmd.network, itemId, version)
-	return err
-}
-
-func (cmd *DeleteCatalogItem) deletePolicy(c *cli.Context, itemId string, version string) (error){
-	_, err := catalog.DeletePolicyWithVersion(cmd.network, itemId, version)
-	return err
-}
-
-func (cmd *DeleteCatalogItem) deleteLocation(c *cli.Context, itemId string, version string) (error){
-	_, err := catalog.DeleteLocationWithVersion(cmd.network, itemId, version)
-	return err
-}
\ No newline at end of file


[14/19] brooklyn-client git commit: Remove newlines from output tables and add delimiter character.

Posted by sv...@apache.org.
Remove newlines from output tables and add delimiter character.


Project: http://git-wip-us.apache.org/repos/asf/brooklyn-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-client/commit/e6a5d58a
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-client/tree/e6a5d58a
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-client/diff/e6a5d58a

Branch: refs/heads/master
Commit: e6a5d58ab50f871c429b58c17e10663be19295e2
Parents: bff209a
Author: Geoff Macartney <ge...@cloudsoftcorp.com>
Authored: Mon Oct 24 15:58:27 2016 +0100
Committer: Geoff Macartney <ge...@cloudsoftcorp.com>
Committed: Mon Oct 24 15:58:27 2016 +0100

----------------------------------------------------------------------
 cli/terminal/table.go | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/e6a5d58a/cli/terminal/table.go
----------------------------------------------------------------------
diff --git a/cli/terminal/table.go b/cli/terminal/table.go
index c163318..cc69024 100644
--- a/cli/terminal/table.go
+++ b/cli/terminal/table.go
@@ -43,8 +43,13 @@ func NewTable(headers []string) Table {
 	}
 }
 
-func (t *PrintableTable) Add(row ...string) {
-	t.rows = append(t.rows, row)
+func (t *PrintableTable) Add(rows ...string) {
+	singleLines := make([]string, len(rows))
+	for i, r := range rows {
+		single := strings.Replace(r, "\n", " ", -1)
+		singleLines[i] = strings.TrimSpace(single)
+	}
+	t.rows = append(t.rows, singleLines)
 }
 
 func (t *PrintableTable) Print() {
@@ -84,10 +89,6 @@ func (t *PrintableTable) printHeader() {
 func (t *PrintableTable) printRow(row []string) {
 	output := ""
 	for columnIndex, value := range row {
-		if columnIndex == 0 {
-			value = value
-		}
-
 		output = output + t.cellValue(columnIndex, value)
 	}
 	fmt.Printf("%s\n", output)
@@ -95,8 +96,10 @@ func (t *PrintableTable) printRow(row []string) {
 
 func (t *PrintableTable) cellValue(col int, value string) string {
 	padding := ""
+	delim := ""
 	if col < len(t.headers)-1 {
+		delim = "| "
 		padding = strings.Repeat(" ", t.maxSizes[col]-utf8.RuneCountInString(value))
 	}
-	return fmt.Sprintf("%s%s   ", value, padding)
+	return fmt.Sprintf("%s%s   " + delim, value, padding)
 }


[16/19] brooklyn-client git commit: Fix br tree for apps with members

Posted by sv...@apache.org.
Fix br tree for apps with members


Project: http://git-wip-us.apache.org/repos/asf/brooklyn-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-client/commit/2c6da538
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-client/tree/2c6da538
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-client/diff/2c6da538

Branch: refs/heads/master
Commit: 2c6da53869e0a5fae347c5baf7866f95ca3ceeb2
Parents: 665f00a
Author: Geoff Macartney <ge...@cloudsoftcorp.com>
Authored: Tue Oct 25 11:52:21 2016 +0100
Committer: Geoff Macartney <ge...@cloudsoftcorp.com>
Committed: Tue Oct 25 11:52:21 2016 +0100

----------------------------------------------------------------------
 cli/models/applications.go | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/2c6da538/cli/models/applications.go
----------------------------------------------------------------------
diff --git a/cli/models/applications.go b/cli/models/applications.go
index aa44b8d..01f35cb 100644
--- a/cli/models/applications.go
+++ b/cli/models/applications.go
@@ -18,6 +18,11 @@
  */
 package models
 
+type MemberSpec struct {
+	Id            string   `json:"id"`
+	Name          string   `json:"name"`
+}
+
 type Tree struct {
 	Id            string   `json:"id"`
 	ParentId      string   `json:"parentId"`
@@ -26,7 +31,7 @@ type Tree struct {
 	CatalogItemId string   `json:"catalogItemId"`
 	Children      []Tree   `json:"children"`
 	GroupIds      []string `json:"groupIds"`
-	Members       []string `json:"members"`
+	Members       []MemberSpec `json:"members"`
 }
 
 type TaskSummary struct {


[18/19] brooklyn-client git commit: Fix delete usage

Posted by sv...@apache.org.
Fix delete usage


Project: http://git-wip-us.apache.org/repos/asf/brooklyn-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-client/commit/404e25f2
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-client/tree/404e25f2
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-client/diff/404e25f2

Branch: refs/heads/master
Commit: 404e25f224774fa07b428a9f2828575a948c3aee
Parents: d892964
Author: Geoff Macartney <ge...@cloudsoftcorp.com>
Authored: Tue Oct 25 17:21:28 2016 +0100
Committer: Geoff Macartney <ge...@cloudsoftcorp.com>
Committed: Tue Oct 25 17:21:28 2016 +0100

----------------------------------------------------------------------
 cli/commands/catalog-delete.go | 10 ++++------
 cli/commands/catalog.go        |  2 +-
 2 files changed, 5 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/404e25f2/cli/commands/catalog-delete.go
----------------------------------------------------------------------
diff --git a/cli/commands/catalog-delete.go b/cli/commands/catalog-delete.go
index 8b6a33a..76875fd 100644
--- a/cli/commands/catalog-delete.go
+++ b/cli/commands/catalog-delete.go
@@ -43,13 +43,11 @@ func (cmd *DeleteCatalogItem) Metadata() command_metadata.CommandMetadata {
 	return command_metadata.CommandMetadata{
 		Name:        "delete",
 		Description: "delete the given catalog item",
-		Usage:       "BROOKLYN_NAME catalog  " + deleteCommandName +
-			" TYPE ITEM_ID:VERSION (where TYPE is one of application, location, entity, policy, may be abbreviated)",
+		Usage:       "BROOKLYN_NAME catalog " + deleteCommandUsage,
 	}
 }
 
-const deleteCommandName = "delete"
-
+const deleteCommandUsage = "delete  TYPE  ITEM_ID:VERSION  (where TYPE is one of application, location, entity, policy; may be abbreviated)"
 
 func (cmd *DeleteCatalogItem) Run(scope scope.Scope, c *cli.Context) {
 	if err := net.VerifyLoginURL(cmd.network); err != nil {
@@ -57,11 +55,11 @@ func (cmd *DeleteCatalogItem) Run(scope scope.Scope, c *cli.Context) {
 	}
 	args := c.Args()
 	if len(args) != 2 {
-		error_handler.ErrorExit("command requires arguments TYPE ITEM_ID:VERSION")
+		error_handler.ErrorExit(c.App.Name + " " + deleteCommandUsage)
 	}
 	itemVersion := strings.Split(args.Get(1), ":")
 	if len(itemVersion) != 2 {
-		error_handler.ErrorExit("command requires arguments TYPE ITEM_ID:VERSION")
+		error_handler.ErrorExit(c.App.Name +  " " + deleteCommandUsage)
 	}
 	itemId := itemVersion[0]
 	version := itemVersion[1]

http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/404e25f2/cli/commands/catalog.go
----------------------------------------------------------------------
diff --git a/cli/commands/catalog.go b/cli/commands/catalog.go
index 117dcb7..3d5e525 100644
--- a/cli/commands/catalog.go
+++ b/cli/commands/catalog.go
@@ -55,7 +55,7 @@ var catalogCommands = []string{
 	AddCatalogCommand,
 	DeleteCatalogCommand,
 }
-var catalogCommandsUsage = strings.Join(catalogCommands, " | ")
+var catalogCommandsUsage = "list TYPE | add FILE/URL | delete TYPE ID:VERSION"
 
 type CatalogItemType int
 const  (


[05/19] brooklyn-client git commit: Do add-catalog as catalog add

Posted by sv...@apache.org.
Do add-catalog as catalog add


Project: http://git-wip-us.apache.org/repos/asf/brooklyn-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-client/commit/26347017
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-client/tree/26347017
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-client/diff/26347017

Branch: refs/heads/master
Commit: 26347017aa2076933da1a32d6be7e3cf7ce4f6ce
Parents: 72355dd
Author: Geoff Macartney <ge...@cloudsoftcorp.com>
Authored: Thu Oct 13 20:25:56 2016 +0100
Committer: Geoff Macartney <ge...@cloudsoftcorp.com>
Committed: Thu Oct 13 20:25:56 2016 +0100

----------------------------------------------------------------------
 cli/command_factory/factory.go | 1 -
 cli/commands/add-catalog.go    | 4 ++--
 cli/commands/catalog.go        | 4 ++++
 3 files changed, 6 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/26347017/cli/command_factory/factory.go
----------------------------------------------------------------------
diff --git a/cli/command_factory/factory.go b/cli/command_factory/factory.go
index 399014f..b225b2c 100644
--- a/cli/command_factory/factory.go
+++ b/cli/command_factory/factory.go
@@ -51,7 +51,6 @@ func NewFactory(network *net.Network, config *io.Config) (factory concreteFactor
 	factory.simpleCommand(commands.NewActivityStreamStderr(network))
 	factory.simpleCommand(commands.NewActivityStreamStdin(network))
 	factory.simpleCommand(commands.NewActivityStreamStdout(network))
-	factory.simpleCommand(commands.NewAddCatalog(network))
 	factory.simpleCommand(commands.NewAddChildren(network))
 	factory.simpleCommand(commands.NewApplication(network))
 	//factory.simpleCommand(commands.NewApplications(network))

http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/26347017/cli/commands/add-catalog.go
----------------------------------------------------------------------
diff --git a/cli/commands/add-catalog.go b/cli/commands/add-catalog.go
index 9a29328..d6ceba7 100644
--- a/cli/commands/add-catalog.go
+++ b/cli/commands/add-catalog.go
@@ -40,9 +40,9 @@ func NewAddCatalog(network *net.Network) (cmd *AddCatalog) {
 
 func (cmd *AddCatalog) Metadata() command_metadata.CommandMetadata {
 	return command_metadata.CommandMetadata{
-		Name:        "add-catalog",
+		Name:        "add",
 		Description: "* Add a new catalog item from the supplied YAML (a file or http URL)",
-		Usage:       "BROOKLYN_NAME add-catalog ( FILEPATH | URL )",
+		Usage:       "BROOKLYN_NAME catalog add ( FILEPATH | URL )",
 		Flags:       []cli.Flag{},
 	}
 }

http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/26347017/cli/commands/catalog.go
----------------------------------------------------------------------
diff --git a/cli/commands/catalog.go b/cli/commands/catalog.go
index c197c21..1a870b6 100644
--- a/cli/commands/catalog.go
+++ b/cli/commands/catalog.go
@@ -39,16 +39,19 @@ func NewCatalog(network *net.Network) (cmd *Catalog) {
 	cmd.network = network
 	cmd.catalogCommands = map[string]command.Command {
 		ListCatalogCommand: NewCatalogList(cmd.network),
+		AddCatalogCommand: NewAddCatalog(cmd.network),
 		DeleteCatalogCommand: NewDeleteCatalogApplication(cmd.network),
 	}
 	return
 }
 
 const ListCatalogCommand = "list"
+const AddCatalogCommand = "add"
 const DeleteCatalogCommand = "delete"
 
 var catalogCommands = []string{
 	ListCatalogCommand,
+	AddCatalogCommand,
 	DeleteCatalogCommand,
 }
 var catalogCommandsUsage = strings.Join(catalogCommands, " | ")
@@ -69,6 +72,7 @@ func (cmd *Catalog) Metadata() command_metadata.CommandMetadata {
 		Flags:       []cli.Flag{},
 		Operands:    []command_metadata.CommandMetadata{
 			cmd.SubCommand(ListCatalogCommand).Metadata(),
+			cmd.SubCommand(AddCatalogCommand).Metadata(),
 			cmd.SubCommand(DeleteCatalogCommand).Metadata(),
 		},
 	}


[17/19] brooklyn-client git commit: test update

Posted by sv...@apache.org.
test update


Project: http://git-wip-us.apache.org/repos/asf/brooklyn-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-client/commit/d892964f
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-client/tree/d892964f
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-client/diff/d892964f

Branch: refs/heads/master
Commit: d892964ff3792d9fce71fb7a89d1c400f81bbd40
Parents: 2c6da53
Author: Geoff Macartney <ge...@cloudsoftcorp.com>
Authored: Tue Oct 25 12:12:19 2016 +0100
Committer: Geoff Macartney <ge...@cloudsoftcorp.com>
Committed: Tue Oct 25 12:12:19 2016 +0100

----------------------------------------------------------------------
 cli/test/test.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/d892964f/cli/test/test.sh
----------------------------------------------------------------------
diff --git a/cli/test/test.sh b/cli/test/test.sh
index 7f86538..0c6f913 100644
--- a/cli/test/test.sh
+++ b/cli/test/test.sh
@@ -139,7 +139,7 @@ function shouldRenameTomcatServerEntity() {
     local appname=$1
     local rename=$2
 
-    br app "${appname}" entity "Tomcat Server" rename "${rename}"
+    br app "${appname}" entity "Tomcat 7 Server" rename "${rename}"
     br app "${appname}" entity "${rename}" | grep TomcatServer || fail
 }
 


[08/19] brooklyn-client git commit: ?allVersions=true

Posted by sv...@apache.org.
?allVersions=true


Project: http://git-wip-us.apache.org/repos/asf/brooklyn-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-client/commit/c68dbc4c
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-client/tree/c68dbc4c
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-client/diff/c68dbc4c

Branch: refs/heads/master
Commit: c68dbc4cc687d5e534ee8b919b254ad4b036b9c8
Parents: 625ad88
Author: Geoff Macartney <ge...@cloudsoftcorp.com>
Authored: Fri Oct 14 20:58:36 2016 +0100
Committer: Geoff Macartney <ge...@cloudsoftcorp.com>
Committed: Fri Oct 14 20:58:36 2016 +0100

----------------------------------------------------------------------
 cli/api/catalog/catalog.go | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/c68dbc4c/cli/api/catalog/catalog.go
----------------------------------------------------------------------
diff --git a/cli/api/catalog/catalog.go b/cli/api/catalog/catalog.go
index 56b37cb..cab5214 100644
--- a/cli/api/catalog/catalog.go
+++ b/cli/api/catalog/catalog.go
@@ -149,7 +149,7 @@ func DeleteLocationWithVersion(network *net.Network, locationId, version string)
 }
 
 func Policies(network *net.Network) ([]models.CatalogPolicySummary, error) {
-	url := "/v1/catalog/policies"
+	url := "/v1/catalog/policies?allVersions"
 	var policies []models.CatalogPolicySummary
 	body, err := network.SendGetRequest(url)
 	if err != nil {
@@ -160,7 +160,7 @@ func Policies(network *net.Network) ([]models.CatalogPolicySummary, error) {
 }
 
 func Locations(network *net.Network) ([]models.CatalogLocationSummary, error) {
-	url := "/v1/catalog/locations"
+	url := "/v1/catalog/locations?allVersions=true"
 	var catalogLocations []models.CatalogLocationSummary
 	body, err := network.SendGetRequest(url)
 	if err != nil {
@@ -211,7 +211,7 @@ func PostLocationWithVersion(network *net.Network, locationId, version string) (
 }
 
 func Entities(network *net.Network) ([]models.CatalogItemSummary, error) {
-	url := "/v1/catalog/entities"
+	url := "/v1/catalog/entities?allVersions=true"
 	var entities []models.CatalogItemSummary
 	body, err := network.SendGetRequest(url)
 	if err != nil {
@@ -222,7 +222,7 @@ func Entities(network *net.Network) ([]models.CatalogItemSummary, error) {
 }
 
 func Catalog(network *net.Network) ([]models.CatalogItemSummary, error) {
-	url := "/v1/catalog/applications"
+	url := "/v1/catalog/applications?allVersions=true"
 	var applications []models.CatalogItemSummary
 	body, err := network.SendGetRequest(url)
 	if err != nil {


[03/19] brooklyn-client git commit: Add catalog delete

Posted by sv...@apache.org.
Add catalog delete


Project: http://git-wip-us.apache.org/repos/asf/brooklyn-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-client/commit/b7eca931
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-client/tree/b7eca931
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-client/diff/b7eca931

Branch: refs/heads/master
Commit: b7eca9314ebf2c8e5efe81f2c23d6db97790b70d
Parents: 16eff1b
Author: Geoff Macartney <ge...@cloudsoftcorp.com>
Authored: Wed Oct 12 20:11:11 2016 +0100
Committer: Geoff Macartney <ge...@cloudsoftcorp.com>
Committed: Wed Oct 12 20:11:11 2016 +0100

----------------------------------------------------------------------
 cli/commands/catalog.go                    |  4 +++
 cli/commands/delete-catalog-application.go | 34 +++++++++++++++++++++++++
 cli/error_handler/error.go                 |  4 +++
 cli/net/net.go                             | 34 ++++++++++++++++++++-----
 4 files changed, 70 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/b7eca931/cli/commands/catalog.go
----------------------------------------------------------------------
diff --git a/cli/commands/catalog.go b/cli/commands/catalog.go
index 6cfc324..7102b3a 100644
--- a/cli/commands/catalog.go
+++ b/cli/commands/catalog.go
@@ -39,14 +39,17 @@ func NewCatalog(network *net.Network) (cmd *Catalog) {
 	cmd.network = network
 	cmd.catalogCommands = map[string]command.Command {
 		ListCatalogCommand: NewCatalogList(cmd.network),
+		DeleteCatalogCommand: NewDeleteCatalogApplication(cmd.network),
 	}
 	return
 }
 
 const ListCatalogCommand = "list"
+const DeleteCatalogCommand = "delete"
 
 var catalogCommands = []string{
 	ListCatalogCommand,
+	DeleteCatalogCommand,
 }
 var catalogCommandsUsage = strings.Join(catalogCommands, " | ")
 
@@ -66,6 +69,7 @@ func (cmd *Catalog) Metadata() command_metadata.CommandMetadata {
 		Flags:       []cli.Flag{},
 		Operands:    []command_metadata.CommandMetadata{
 			cmd.SubCommand(ListCatalogCommand).Metadata(),
+			cmd.SubCommand(DeleteCatalogCommand).Metadata(),
 		},
 	}
 }

http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/b7eca931/cli/commands/delete-catalog-application.go
----------------------------------------------------------------------
diff --git a/cli/commands/delete-catalog-application.go b/cli/commands/delete-catalog-application.go
index fd8ac3b..ef8c561 100644
--- a/cli/commands/delete-catalog-application.go
+++ b/cli/commands/delete-catalog-application.go
@@ -20,6 +20,12 @@ package commands
 
 import (
 	"github.com/apache/brooklyn-client/cli/net"
+	"github.com/apache/brooklyn-client/cli/command_metadata"
+	"github.com/urfave/cli"
+	"github.com/apache/brooklyn-client/cli/scope"
+	"github.com/apache/brooklyn-client/cli/error_handler"
+	"strings"
+	"github.com/apache/brooklyn-client/cli/api/catalog"
 )
 
 type DeleteCatalogApplication struct {
@@ -31,3 +37,31 @@ func NewDeleteCatalogApplication(network *net.Network) (cmd *DeleteCatalogApplic
 	cmd.network = network
 	return
 }
+
+func (cmd *DeleteCatalogApplication) Metadata() command_metadata.CommandMetadata {
+	return command_metadata.CommandMetadata{
+		Name:        "delete",
+		Description: "delete the given catalog application",
+		Usage:       "BROOKLYN_NAME catalog delete [APPLICATION_ID:VERSION]",
+		Flags:       []cli.Flag{},
+	}
+}
+
+func (cmd *DeleteCatalogApplication) Run(scope scope.Scope, c *cli.Context) {
+	if err := net.VerifyLoginURL(cmd.network); err != nil {
+		error_handler.ErrorExit(err)
+	}
+	if len(c.Args()) != 1 {
+		error_handler.ErrorExit("command requires single argument APPLICATION_ID:VERSION")
+	}
+	appVersion := strings.Split(c.Args().First(), ":")
+	if len(appVersion) != 2 {
+		error_handler.ErrorExit("command requires single argument APPLICATION_ID:VERSION")
+	}
+	appId := appVersion[0]
+	version := appVersion[1]
+	_, err := catalog.DeleteApplicationWithVersion(cmd.network, appId, version)
+	if nil != err {
+		error_handler.ErrorExit(err)
+	}
+}

http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/b7eca931/cli/error_handler/error.go
----------------------------------------------------------------------
diff --git a/cli/error_handler/error.go b/cli/error_handler/error.go
index 8238c2b..e1f768a 100644
--- a/cli/error_handler/error.go
+++ b/cli/error_handler/error.go
@@ -21,6 +21,7 @@ package error_handler
 import (
 	"fmt"
 	"os"
+	"github.com/apache/brooklyn-client/cli/net"
 )
 
 const CLIUsageErrorExitCode int = 1
@@ -29,6 +30,9 @@ const CLITrapErrorCode int = 3
 
 func ErrorExit(errorvalue interface{}, errorcode ...int) {
 	switch errorvalue.(type) {
+	case net.HttpError:
+		httpError := errorvalue.(net.HttpError)
+		fmt.Fprintln(os.Stderr, httpError.Body)
 	case error:
 		fmt.Fprintln(os.Stderr, errorvalue)
 	case string:

http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/b7eca931/cli/net/net.go
----------------------------------------------------------------------
diff --git a/cli/net/net.go b/cli/net/net.go
index b35a6c3..b47d75a 100644
--- a/cli/net/net.go
+++ b/cli/net/net.go
@@ -84,10 +84,21 @@ func makeError(resp *http.Response, code int, body []byte) error {
 		Status:  resp.Status,
 		Headers: resp.Header,
 	}
-	details := make(map[string]string)
+	return makeErrorBody(theError, body)
+}
+
+func makeSimpleError(code int, body []byte) error {
+	theError := HttpError{
+		Code:    code,
+	}
+	return makeErrorBody(theError, body)
+}
+
+func makeErrorBody(theError HttpError, body []byte) error {
+	details := make(map[string]interface{})
 	if err := json.Unmarshal(body, &details); nil == err {
 		if message, ok := details["message"]; ok {
-			theError.Body = message
+			theError.Body = message.(string)
 			return theError
 		}
 	}
@@ -96,20 +107,25 @@ func makeError(resp *http.Response, code int, body []byte) error {
 }
 
 func (net *Network) SendRequest(req *http.Request) ([]byte, error) {
+	body, _, err := net.SendRequestGetStatusCode(req)
+	return body, err
+}
+
+func (net *Network) SendRequestGetStatusCode(req *http.Request) ([]byte, int, error) {
 	tr := &http.Transport{
 		TLSClientConfig: &tls.Config{InsecureSkipVerify: net.SkipSslChecks},
 	}
 	client := &http.Client{Transport: tr}
 	resp, err := client.Do(req)
 	if err != nil {
-		return nil, err
+		return nil, 0, err
 	}
 	defer resp.Body.Close()
 	body, err := ioutil.ReadAll(resp.Body)
 	if code, failed := unsuccessful(resp.Status); failed {
-		return nil, makeError(resp, code, body)
+		return nil, 0, makeError(resp, code, body)
 	}
-	return body, err
+	return body, resp.StatusCode, err
 }
 
 const httpSuccessSeriesFrom = 200
@@ -136,7 +152,13 @@ func (net *Network) SendGetRequest(url string) ([]byte, error) {
 
 func (net *Network) SendDeleteRequest(url string) ([]byte, error) {
 	req := net.NewDeleteRequest(url)
-	body, err := net.SendRequest(req)
+	body, code, err := net.SendRequestGetStatusCode(req)
+	if nil != err {
+		return nil, err
+	}
+	if code != http.StatusNoContent {
+		return nil, makeSimpleError(code, body)
+	}
 	return body, err
 }
 


[04/19] brooklyn-client git commit: add catalog list for entities, locations, policies

Posted by sv...@apache.org.
add catalog list for entities, locations, policies


Project: http://git-wip-us.apache.org/repos/asf/brooklyn-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-client/commit/72355dd9
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-client/tree/72355dd9
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-client/diff/72355dd9

Branch: refs/heads/master
Commit: 72355dd9af88a5dfc4b35cbdbd761f907c5f2d43
Parents: b7eca93
Author: Geoff Macartney <ge...@cloudsoftcorp.com>
Authored: Thu Oct 13 20:18:56 2016 +0100
Committer: Geoff Macartney <ge...@cloudsoftcorp.com>
Committed: Thu Oct 13 20:18:56 2016 +0100

----------------------------------------------------------------------
 cli/api/catalog/catalog.go   | 10 ++---
 cli/commands/catalog-list.go | 89 +++++++++++++++++++++++++++++++++++++--
 cli/commands/catalog.go      |  2 +-
 cli/models/catalog.go        | 31 ++++++--------
 4 files changed, 104 insertions(+), 28 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/72355dd9/cli/api/catalog/catalog.go
----------------------------------------------------------------------
diff --git a/cli/api/catalog/catalog.go b/cli/api/catalog/catalog.go
index 3db32ce..6a017f5 100644
--- a/cli/api/catalog/catalog.go
+++ b/cli/api/catalog/catalog.go
@@ -150,15 +150,15 @@ func Policies(network *net.Network) ([]models.CatalogPolicySummary, error) {
 	return policies, err
 }
 
-func Locations(network *net.Network) (models.CatalogLocationSummary, error) {
+func Locations(network *net.Network) ([]models.CatalogLocationSummary, error) {
 	url := "/v1/catalog/locations"
-	var catalogLocation models.CatalogLocationSummary
+	var catalogLocations []models.CatalogLocationSummary
 	body, err := network.SendGetRequest(url)
 	if err != nil {
-		return catalogLocation, err
+		return catalogLocations, err
 	}
-	err = json.Unmarshal(body, &catalogLocation)
-	return catalogLocation, err
+	err = json.Unmarshal(body, &catalogLocations)
+	return catalogLocations, err
 }
 
 func AddCatalog(network *net.Network, resource string) (string, error) {

http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/72355dd9/cli/commands/catalog-list.go
----------------------------------------------------------------------
diff --git a/cli/commands/catalog-list.go b/cli/commands/catalog-list.go
index bb6efe3..5fa8414 100644
--- a/cli/commands/catalog-list.go
+++ b/cli/commands/catalog-list.go
@@ -26,6 +26,7 @@ import (
 	"github.com/apache/brooklyn-client/cli/scope"
 	"github.com/apache/brooklyn-client/cli/terminal"
 	"github.com/urfave/cli"
+	"github.com/apache/brooklyn-client/cli/models"
 )
 
 type CatalogList struct {
@@ -43,7 +44,24 @@ func (cmd *CatalogList) Metadata() command_metadata.CommandMetadata {
 		Name:        "list",
 		Description: "* List the available catalog applications",
 		Usage:       "BROOKLYN_NAME catalog list",
-		Flags:       []cli.Flag{},
+		Flags:       []cli.Flag{
+			cli.BoolFlag{
+				Name:  "applications, a",
+				Usage: "list applications (default)",
+			},
+			cli.BoolFlag{
+				Name:  "entities, e",
+				Usage: "list entities",
+			},
+			cli.BoolFlag{
+				Name:  "locations, l",
+				Usage: "list locations",
+			},
+			cli.BoolFlag{
+				Name:  "policies, p",
+				Usage: "list policies",
+			},
+		},
 	}
 }
 
@@ -51,13 +69,76 @@ func (cmd *CatalogList) Run(scope scope.Scope, c *cli.Context) {
 	if err := net.VerifyLoginURL(cmd.network); err != nil {
 		error_handler.ErrorExit(err)
 	}
-	catalog, err := catalog.Catalog(cmd.network)
+	summary, err := cmd.list(c)
 	if nil != err {
 		error_handler.ErrorExit(err)
 	}
 	table := terminal.NewTable([]string{"Id", "Name", "Description"})
-	for _, app := range catalog {
-		table.Add(app.Id, app.Name, app.Description)
+	for _, catalogItem := range summary {
+		table.Add(catalogItem.Id, catalogItem.Name, catalogItem.Description)
 	}
 	table.Print()
 }
+
+func (cmd *CatalogList) list(c *cli.Context) ([]models.IdentityDetails, error) {
+	if c.IsSet("entities") {
+		list, err := cmd.listEntities(c)
+		return list, err
+	} else if c.IsSet("locations") {
+		list, err := cmd.listLocations(c)
+		return list, err
+        } else if c.IsSet("policies") {
+		list, err := cmd.listPolicies(c)
+		return list, err
+	}
+	items, err := cmd.listCatalogItems(c)
+	return items, err
+}
+
+func (cmd *CatalogList) listPolicies(c *cli.Context) ([]models.IdentityDetails, error) {
+	policies, err := catalog.Policies(cmd.network)
+	if err != nil {
+		return nil, err
+	}
+	result := make([]models.IdentityDetails, len(policies))
+	for i, policy := range policies {
+		result[i] = policy.IdentityDetails
+	}
+	return result, nil
+}
+
+func (cmd *CatalogList) listLocations(c *cli.Context) ([]models.IdentityDetails, error) {
+	locations, err := catalog.Locations(cmd.network)
+	if err != nil {
+		return nil, err
+	}
+	result := make([]models.IdentityDetails, len(locations))
+	for i, location := range locations {
+		result[i] = location.CatalogItemSummary.IdentityDetails
+	}
+	return result, nil
+}
+
+func (cmd *CatalogList) listEntities(c *cli.Context) ([]models.IdentityDetails, error) {
+	entities, err := catalog.Entities(cmd.network)
+	if err != nil {
+		return nil, err
+	}
+	result := make([]models.IdentityDetails, len(entities))
+	for i, ent := range entities {
+		result[i] = ent.IdentityDetails
+	}
+	return result, nil
+}
+
+func (cmd *CatalogList) listCatalogItems(c *cli.Context) ([]models.IdentityDetails, error) {
+	items, err := catalog.Catalog(cmd.network)
+	if err != nil {
+		return nil, err
+	}
+	result := make([]models.IdentityDetails, len(items))
+	for i, item := range items {
+		result[i] = item.IdentityDetails
+	}
+	return result, nil
+}

http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/72355dd9/cli/commands/catalog.go
----------------------------------------------------------------------
diff --git a/cli/commands/catalog.go b/cli/commands/catalog.go
index 7102b3a..c197c21 100644
--- a/cli/commands/catalog.go
+++ b/cli/commands/catalog.go
@@ -78,6 +78,6 @@ func (cmd *Catalog) Run(scope scope.Scope, c *cli.Context) {
 	if err := net.VerifyLoginURL(cmd.network); err != nil {
 		error_handler.ErrorExit(err)
 	}
-	fmt.Printf("Unrecognised instruction, please use one of (%s)\n", catalogCommandsUsage)
+ 	fmt.Printf("'catalog' requires one of (%s)\n", catalogCommandsUsage)
 
 }

http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/72355dd9/cli/models/catalog.go
----------------------------------------------------------------------
diff --git a/cli/models/catalog.go b/cli/models/catalog.go
index ef6dabf..ff537c8 100644
--- a/cli/models/catalog.go
+++ b/cli/models/catalog.go
@@ -18,46 +18,41 @@
  */
 package models
 
-type CatalogItemSummary struct {
+type IdentityDetails struct {
+	Id           string                 `json:"id"`
 	Name         string                 `json:"name"`
-	JavaType     string                 `json:"javaType"`
 	SymbolicName string                 `json:"symbolicName"`
 	Version      string                 `json:"version"`
-	PlanYaml     string                 `json:"planYaml"`
 	Description  string                 `json:"description"`
+}
+
+type CatalogItemSummary struct {
+	IdentityDetails
+	JavaType     string                 `json:"javaType"`
+	PlanYaml     string                 `json:"planYaml"`
 	Deprecated   bool                   `json:"deprecated"`
 	Links        map[string]interface{} `json:"links"`
-	Id           string                 `json:"id"`
 	Type         string                 `json:"type"`
 }
 
 type CatalogPolicySummary struct {
-	symbolicName string         `json:"symbolicName"`
-	version      string         `json:"version"`
-	displayName  string         `json:"name"`
+	IdentityDetails
 	javaType     string         `json:"javaType"`
 	planYaml     string         `json:"planYaml"`
-	description  string         `json:"description"`
 	iconUrl      string         `json:"iconUrl"`
 	deprecated   bool           `json:"deprecated"`
 	links        map[string]URI `json:"links"`
 }
 
+
 type CatalogLocationSummary struct {
+	CatalogItemSummary
+	IconUrl     string                 `json:"iconUrl"`
 }
 
 type CatalogEntitySummary struct {
-	symbolicName string                 `json:"symbolicName"`
-	version      string                 `json:"version"`
-	displayName  string                 `json:"name"`
-	javaType     string                 `json:"javaType"`
-	planYaml     string                 `json:"planYaml"`
-	description  string                 `json:"description"`
+	CatalogItemSummary
 	Config       []ConfigSummary        `json:"config"`
 	Effectors    []EffectorSummary      `json:"effectors"`
 	Sensors      []SensorSummary        `json:"sensors"`
-	Deprecated   bool                   `json:"deprecated"`
-	Links        map[string]interface{} `json:"links"`
-	Id           string                 `json:"id"`
-	Type         string                 `json:"type"`
 }