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/04/05 16:16:04 UTC
[2/4] brooklyn-client git commit: remove brooklyn-client Godep from
repo - @geomacy can you have a look at this,
leaving this in results in mvn building from the old Godep. I can build via
`mvn`, `godep install`
http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/bdb83934/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/commands/activity-stream.go
----------------------------------------------------------------------
diff --git a/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/commands/activity-stream.go b/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/commands/activity-stream.go
deleted file mode 100644
index 38cec20..0000000
--- a/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/commands/activity-stream.go
+++ /dev/null
@@ -1,149 +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 (
- "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/codegangsta/cli"
-)
-
-type ActivityStreamEnv struct {
- network *net.Network
-}
-
-type ActivityStreamStderr struct {
- network *net.Network
-}
-
-type ActivityStreamStdin struct {
- network *net.Network
-}
-
-type ActivityStreamStdout struct {
- network *net.Network
-}
-
-func NewActivityStreamEnv(network *net.Network) (cmd *ActivityStreamEnv) {
- cmd = new(ActivityStreamEnv)
- cmd.network = network
- return
-}
-
-func NewActivityStreamStderr(network *net.Network) (cmd *ActivityStreamStderr) {
- cmd = new(ActivityStreamStderr)
- cmd.network = network
- return
-}
-
-func NewActivityStreamStdin(network *net.Network) (cmd *ActivityStreamStdin) {
- cmd = new(ActivityStreamStdin)
- cmd.network = network
- return
-}
-
-func NewActivityStreamStdout(network *net.Network) (cmd *ActivityStreamStdout) {
- cmd = new(ActivityStreamStdout)
- cmd.network = network
- return
-}
-
-func (cmd *ActivityStreamEnv) Metadata() command_metadata.CommandMetadata {
- return command_metadata.CommandMetadata{
- Name: "env",
- Description: "Show the ENV stream for a given activity",
- Usage: "BROOKLYN_NAME ACTIVITY-SCOPE env",
- Flags: []cli.Flag{},
- }
-}
-
-func (cmd *ActivityStreamStderr) Metadata() command_metadata.CommandMetadata {
- return command_metadata.CommandMetadata{
- Name: "stderr",
- Description: "Show the STDERR stream for a given activity",
- Usage: "BROOKLYN_NAME ACTIVITY-SCOPE stderr",
- Flags: []cli.Flag{},
- }
-}
-
-func (cmd *ActivityStreamStdin) Metadata() command_metadata.CommandMetadata {
- return command_metadata.CommandMetadata{
- Name: "stdin",
- Description: "Show the STDIN stream for a given activity",
- Usage: "BROOKLYN_NAME ACTIVITY-SCOPE ] stdin",
- Flags: []cli.Flag{},
- }
-}
-
-func (cmd *ActivityStreamStdout) Metadata() command_metadata.CommandMetadata {
- return command_metadata.CommandMetadata{
- Name: "stdout",
- Description: "Show the STDOUT stream for a given activity",
- Usage: "BROOKLYN_NAME ACTIVITY-SCOPE stdout",
- Flags: []cli.Flag{},
- }
-}
-
-func (cmd *ActivityStreamEnv) Run(scope scope.Scope, c *cli.Context) {
- if err := net.VerifyLoginURL(cmd.network); err != nil {
- error_handler.ErrorExit(err)
- }
- activityStream, err := activities.ActivityStream(cmd.network, scope.Activity, "env")
- if nil != err {
- error_handler.ErrorExit(err)
- }
- fmt.Println(activityStream)
-}
-
-func (cmd *ActivityStreamStderr) Run(scope scope.Scope, c *cli.Context) {
- if err := net.VerifyLoginURL(cmd.network); err != nil {
- error_handler.ErrorExit(err)
- }
- activityStream, err := activities.ActivityStream(cmd.network, scope.Activity, "stderr")
- if nil != err {
- error_handler.ErrorExit(err)
- }
- fmt.Println(activityStream)
-}
-
-func (cmd *ActivityStreamStdin) Run(scope scope.Scope, c *cli.Context) {
- if err := net.VerifyLoginURL(cmd.network); err != nil {
- error_handler.ErrorExit(err)
- }
- activityStream, err := activities.ActivityStream(cmd.network, scope.Activity, "stdin")
- if nil != err {
- error_handler.ErrorExit(err)
- }
- fmt.Println(activityStream)
-}
-
-func (cmd *ActivityStreamStdout) Run(scope scope.Scope, c *cli.Context) {
- if err := net.VerifyLoginURL(cmd.network); err != nil {
- error_handler.ErrorExit(err)
- }
- activityStream, err := activities.ActivityStream(cmd.network, scope.Activity, "stdout")
- if nil != err {
- error_handler.ErrorExit(err)
- }
- fmt.Println(activityStream)
-}
http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/bdb83934/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/commands/activity.go
----------------------------------------------------------------------
diff --git a/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/commands/activity.go b/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/commands/activity.go
deleted file mode 100644
index cee097b..0000000
--- a/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/commands/activity.go
+++ /dev/null
@@ -1,162 +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 (
- "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/codegangsta/cli"
- "sort"
- "strconv"
- "strings"
- "time"
-)
-
-type Activity struct {
- network *net.Network
-}
-
-func NewActivity(network *net.Network) (cmd *Activity) {
- cmd = new(Activity)
- cmd.network = network
- return
-}
-
-func (cmd *Activity) Metadata() command_metadata.CommandMetadata {
- return command_metadata.CommandMetadata{
- Name: "activity",
- Aliases: []string{"activities", "act", "acts"},
- Description: "Show the activity for an application / entity",
- Usage: "BROOKLYN_NAME SCOPE activity [ ACTIVITYID]",
- Flags: []cli.Flag{
- cli.StringSliceFlag{
- Name: "children, c",
- Usage: "List children of the activity",
- },
- },
- }
-}
-
-func (cmd *Activity) Run(scope scope.Scope, c *cli.Context) {
- if err := net.VerifyLoginURL(cmd.network); err != nil {
- error_handler.ErrorExit(err)
- }
- if c.NumFlags() > 0 && c.FlagNames()[0] == "children" {
- cmd.listchildren(c.StringSlice("children")[0])
- } else {
- if c.Args().Present() {
- cmd.show(c.Args().First())
- } else {
- if scope.Activity == "" {
- cmd.list(scope.Application, scope.Entity)
- } else {
- cmd.listchildren(scope.Activity)
- }
- }
- }
-}
-
-func (cmd *Activity) show(activityId string) {
- activity, err := activities.Activity(cmd.network, activityId)
- if nil != err {
- error_handler.ErrorExit(err)
- }
-
- table := terminal.NewTable([]string{"Id:", activity.Id})
- table.Add("DisplayName:", activity.DisplayName)
- table.Add("Description:", activity.Description)
- table.Add("EntityId:", activity.EntityId)
- table.Add("EntityDisplayName:", activity.EntityDisplayName)
- table.Add("Submitted:", time.Unix(activity.SubmitTimeUtc/1000, 0).Format(time.UnixDate))
- table.Add("Started:", time.Unix(activity.StartTimeUtc/1000, 0).Format(time.UnixDate))
- table.Add("Ended:", time.Unix(activity.EndTimeUtc/1000, 0).Format(time.UnixDate))
- table.Add("CurrentStatus:", activity.CurrentStatus)
- table.Add("IsError:", strconv.FormatBool(activity.IsError))
- table.Add("IsCancelled:", strconv.FormatBool(activity.IsCancelled))
- table.Add("SubmittedByTask:", activity.SubmittedByTask.Metadata.Id)
- if activity.Streams["stdin"].Metadata.Size > 0 ||
- activity.Streams["stdout"].Metadata.Size > 0 ||
- activity.Streams["stderr"].Metadata.Size > 0 ||
- activity.Streams["env"].Metadata.Size > 0 {
- table.Add("Streams:", fmt.Sprintf("stdin: %d, stdout: %d, stderr: %d, env %d",
- activity.Streams["stdin"].Metadata.Size,
- activity.Streams["stdout"].Metadata.Size,
- activity.Streams["stderr"].Metadata.Size,
- activity.Streams["env"].Metadata.Size))
- } else {
- table.Add("Streams:", "")
- }
- table.Add("DetailedStatus:", fmt.Sprintf("\"%s\"", activity.DetailedStatus))
- table.Print()
-}
-
-func (cmd *Activity) list(application, entity string) {
- activityList, err := entities.GetActivities(cmd.network, application, entity)
- if nil != err {
- error_handler.ErrorExit(err)
- }
- table := terminal.NewTable([]string{"Id", "Task", "Submitted", "Status", "Streams"})
- for _, activity := range activityList {
- table.Add(activity.Id,
- truncate(activity.DisplayName),
- time.Unix(activity.SubmitTimeUtc/1000, 0).Format(time.UnixDate), truncate(activity.CurrentStatus),
- streams(activity))
- }
- table.Print()
-}
-
-func (cmd *Activity) listchildren(activity string) {
- activityList, err := activities.ActivityChildren(cmd.network, activity)
- if nil != err {
- error_handler.ErrorExit(err)
- }
- table := terminal.NewTable([]string{"Id", "Task", "Submitted", "Status", "Streams"})
- for _, activity := range activityList {
- table.Add(activity.Id,
- truncate(activity.DisplayName),
- time.Unix(activity.SubmitTimeUtc/1000, 0).Format(time.UnixDate), truncate(activity.CurrentStatus),
- streams(activity))
- }
- table.Print()
-}
-
-func streams(act models.TaskSummary) string {
- names := make([]string, 0)
- for name, _ := range act.Streams {
- names = append(names, name)
- }
- sort.Strings(names)
- return strings.Join(names, ",")
-}
-
-const truncLimit = 40
-
-func truncate(text string) string {
- if len(text) < truncLimit {
- return text
- }
- return text[0:(truncLimit-3)] + "..."
-}
http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/bdb83934/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/commands/add-catalog.go
----------------------------------------------------------------------
diff --git a/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/commands/add-catalog.go b/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/commands/add-catalog.go
deleted file mode 100644
index bf79f23..0000000
--- a/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/commands/add-catalog.go
+++ /dev/null
@@ -1,59 +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 (
- "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/codegangsta/cli"
-)
-
-type AddCatalog struct {
- network *net.Network
-}
-
-func NewAddCatalog(network *net.Network) (cmd *AddCatalog) {
- cmd = new(AddCatalog)
- cmd.network = network
- return
-}
-
-func (cmd *AddCatalog) Metadata() command_metadata.CommandMetadata {
- return command_metadata.CommandMetadata{
- Name: "add-catalog",
- Description: "* Add a new catalog item from the supplied YAML",
- Usage: "BROOKLYN_NAME add-catalog FILEPATH",
- Flags: []cli.Flag{},
- }
-}
-
-func (cmd *AddCatalog) 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)
- }
- fmt.Println(create)
-}
http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/bdb83934/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/commands/add-children.go
----------------------------------------------------------------------
diff --git a/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/commands/add-children.go b/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/commands/add-children.go
deleted file mode 100644
index 6492044..0000000
--- a/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/commands/add-children.go
+++ /dev/null
@@ -1,63 +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/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/codegangsta/cli"
- "time"
-)
-
-type AddChildren struct {
- network *net.Network
-}
-
-func NewAddChildren(network *net.Network) (cmd *AddChildren) {
- cmd = new(AddChildren)
- cmd.network = network
- return
-}
-
-func (cmd *AddChildren) Metadata() command_metadata.CommandMetadata {
- return command_metadata.CommandMetadata{
- Name: "add-children",
- Description: "* Add a child or children to this entity from the supplied YAML",
- Usage: "BROOKLYN_NAME SCOPE add-children FILEPATH",
- Flags: []cli.Flag{},
- }
-}
-
-func (cmd *AddChildren) Run(scope scope.Scope, c *cli.Context) {
- if err := net.VerifyLoginURL(cmd.network); err != nil {
- error_handler.ErrorExit(err)
- }
- activity, err := entities.AddChildren(cmd.network, scope.Application, scope.Entity, c.Args().First())
- if nil != err {
- error_handler.ErrorExit(err)
- }
- table := terminal.NewTable([]string{"Id", "Task", "Submitted", "Status"})
- table.Add(activity.Id, activity.DisplayName, time.Unix(activity.SubmitTimeUtc/1000, 0).Format(time.UnixDate), activity.CurrentStatus)
-
- table.Print()
-}
http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/bdb83934/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/commands/add-location.go
----------------------------------------------------------------------
diff --git a/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/commands/add-location.go b/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/commands/add-location.go
deleted file mode 100644
index 32c2db0..0000000
--- a/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/commands/add-location.go
+++ /dev/null
@@ -1,33 +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/net"
-)
-
-type AddLocation struct {
- network *net.Network
-}
-
-func NewAddLocation(network *net.Network) (cmd *AddLocation) {
- cmd = new(AddLocation)
- cmd.network = network
- return
-}
http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/bdb83934/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/commands/add-policy.go
----------------------------------------------------------------------
diff --git a/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/commands/add-policy.go b/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/commands/add-policy.go
deleted file mode 100644
index a17e6c5..0000000
--- a/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/commands/add-policy.go
+++ /dev/null
@@ -1,50 +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/codegangsta/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"
-)
-
-type AddPolicy struct {
- network *net.Network
-}
-
-func NewAddPolicy(network *net.Network) (cmd *AddPolicy) {
- cmd = new(AddPolicy)
- cmd.network = network
- return
-}
-
-func (cmd *AddPolicy) Metadata() command_metadata.CommandMetadata {
- return command_metadata.CommandMetadata{
- Name: "add-policy",
- Description: "Add a new policy",
- Usage: "BROOKLYN_NAME [ SCOPE ] add-policy APPLICATION ENTITY POLICY_TYPE",
- Flags: []cli.Flag{},
- }
-}
-
-func (cmd *AddPolicy) Run(scope scope.Scope, c *cli.Context) {
- // Todo
-}
http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/bdb83934/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/commands/application.go
----------------------------------------------------------------------
diff --git a/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/commands/application.go b/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/commands/application.go
deleted file mode 100644
index 3538689..0000000
--- a/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/commands/application.go
+++ /dev/null
@@ -1,111 +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 (
- "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/codegangsta/cli"
- "strings"
-)
-
-type Application struct {
- network *net.Network
-}
-
-func NewApplication(network *net.Network) (cmd *Application) {
- cmd = new(Application)
- cmd.network = network
- return
-}
-
-func (cmd *Application) Metadata() command_metadata.CommandMetadata {
- return command_metadata.CommandMetadata{
- Name: "application",
- Aliases: []string{"applications", "app", "apps"},
- Description: "Show the status and location of running applications",
- Usage: "BROOKLYN_NAME application [APP]",
- Flags: []cli.Flag{},
- }
-}
-
-func (cmd *Application) Run(scope scope.Scope, c *cli.Context) {
- if err := net.VerifyLoginURL(cmd.network); err != nil {
- error_handler.ErrorExit(err)
- }
- if c.Args().Present() {
- cmd.show(c.Args().First())
- } else {
- cmd.list()
- }
-}
-
-const serviceIsUpStr = "service.isUp"
-
-func (cmd *Application) show(appName string) {
- application, err := application.Application(cmd.network, appName)
- if nil != err {
- error_handler.ErrorExit(err)
- }
- entity, err := entities.GetEntity(cmd.network, appName, appName)
- if nil != err {
- error_handler.ErrorExit(err)
- }
- state, err := entity_sensors.CurrentState(cmd.network, appName, appName)
- if nil != err {
- error_handler.ErrorExit(err)
- }
- location, err := locations.GetLocation(cmd.network, application.Spec.Locations[0])
- if nil != err {
- error_handler.ErrorExit(err)
- }
- table := terminal.NewTable([]string{"Id:", application.Id})
- table.Add("Name:", application.Spec.Name)
- table.Add("Status:", string(application.Status))
- if serviceUp, ok := state[serviceIsUpStr]; ok {
- table.Add("ServiceUp:", fmt.Sprintf("%v", serviceUp))
- }
- table.Add("Type:", application.Spec.Type)
- table.Add("CatalogItemId:", entity.CatalogItemId)
- table.Add("LocationId:", strings.Join(application.Spec.Locations, ", "))
- table.Add("LocationName:", location.Name)
- table.Add("LocationSpec:", location.Spec)
- table.Add("LocationType:", location.Type)
- table.Print()
-}
-
-func (cmd *Application) list() {
- applications, err := application.Applications(cmd.network)
- if nil != err {
- error_handler.ErrorExit(err)
- }
- table := terminal.NewTable([]string{"Id", "Name", "Status", "Location"})
- for _, app := range applications {
- table.Add(app.Id, app.Spec.Name, string(app.Status), strings.Join(app.Spec.Locations, ", "))
- }
- table.Print()
-}
http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/bdb83934/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/commands/catalog-applications.go
----------------------------------------------------------------------
diff --git a/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/commands/catalog-applications.go b/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/commands/catalog-applications.go
deleted file mode 100644
index 19a4373..0000000
--- a/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/commands/catalog-applications.go
+++ /dev/null
@@ -1,33 +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/net"
-)
-
-type CatalogApplication struct {
- network *net.Network
-}
-
-func NewCatalogApplication(network *net.Network) (cmd *CatalogApplication) {
- cmd = new(CatalogApplication)
- cmd.network = network
- return
-}
http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/bdb83934/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/commands/catalog-entities.go
----------------------------------------------------------------------
diff --git a/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/commands/catalog-entities.go b/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/commands/catalog-entities.go
deleted file mode 100644
index dbec760..0000000
--- a/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/commands/catalog-entities.go
+++ /dev/null
@@ -1,33 +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/net"
-)
-
-type CatalogEntities struct {
- network *net.Network
-}
-
-func NewCatalogEntities(network *net.Network) (cmd *CatalogEntities) {
- cmd = new(CatalogEntities)
- cmd.network = network
- return
-}
http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/bdb83934/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/commands/catalog-entity.go
----------------------------------------------------------------------
diff --git a/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/commands/catalog-entity.go b/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/commands/catalog-entity.go
deleted file mode 100644
index 23cc295..0000000
--- a/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/commands/catalog-entity.go
+++ /dev/null
@@ -1,33 +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/net"
-)
-
-type CatalogEntity struct {
- network *net.Network
-}
-
-func NewCatalogEntity(network *net.Network) (cmd *CatalogEntity) {
- cmd = new(CatalogEntity)
- cmd.network = network
- return
-}
http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/bdb83934/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/commands/catalog-location.go
----------------------------------------------------------------------
diff --git a/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/commands/catalog-location.go b/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/commands/catalog-location.go
deleted file mode 100644
index 40babdd..0000000
--- a/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/commands/catalog-location.go
+++ /dev/null
@@ -1,33 +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/net"
-)
-
-type CatalogLocation struct {
- network *net.Network
-}
-
-func NewCatalogLocation(network *net.Network) (cmd *CatalogLocation) {
- cmd = new(CatalogLocation)
- cmd.network = network
- return
-}
http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/bdb83934/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/commands/catalog-locations.go
----------------------------------------------------------------------
diff --git a/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/commands/catalog-locations.go b/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/commands/catalog-locations.go
deleted file mode 100644
index e1791e8..0000000
--- a/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/commands/catalog-locations.go
+++ /dev/null
@@ -1,33 +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/net"
-)
-
-type CatalogLocations struct {
- network *net.Network
-}
-
-func NewCatalogLocations(network *net.Network) (cmd *CatalogLocations) {
- cmd = new(CatalogLocations)
- cmd.network = network
- return
-}
http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/bdb83934/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/commands/catalog-policies.go
----------------------------------------------------------------------
diff --git a/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/commands/catalog-policies.go b/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/commands/catalog-policies.go
deleted file mode 100644
index 3e245db..0000000
--- a/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/commands/catalog-policies.go
+++ /dev/null
@@ -1,33 +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/net"
-)
-
-type CatalogPolicies struct {
- network *net.Network
-}
-
-func NewCatalogPolicies(network *net.Network) (cmd *CatalogPolicies) {
- cmd = new(CatalogPolicies)
- cmd.network = network
- return
-}
http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/bdb83934/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/commands/catalog-policy.go
----------------------------------------------------------------------
diff --git a/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/commands/catalog-policy.go b/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/commands/catalog-policy.go
deleted file mode 100644
index 82e8a95..0000000
--- a/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/commands/catalog-policy.go
+++ /dev/null
@@ -1,33 +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/net"
-)
-
-type CatalogPolicy struct {
- network *net.Network
-}
-
-func NewCatalogPolicy(network *net.Network) (cmd *CatalogPolicy) {
- cmd = new(CatalogPolicy)
- cmd.network = network
- return
-}
http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/bdb83934/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/commands/catalog.go
----------------------------------------------------------------------
diff --git a/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/commands/catalog.go b/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/commands/catalog.go
deleted file mode 100644
index 2cb884d..0000000
--- a/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/commands/catalog.go
+++ /dev/null
@@ -1,63 +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/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/codegangsta/cli"
-)
-
-type Catalog struct {
- network *net.Network
-}
-
-func NewCatalog(network *net.Network) (cmd *Catalog) {
- cmd = new(Catalog)
- cmd.network = network
- return
-}
-
-func (cmd *Catalog) Metadata() command_metadata.CommandMetadata {
- return command_metadata.CommandMetadata{
- Name: "catalog",
- Description: "* List the available catalog applications",
- Usage: "BROOKLYN_NAME catalog",
- Flags: []cli.Flag{},
- }
-}
-
-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()
-}
http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/bdb83934/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/commands/config.go
----------------------------------------------------------------------
diff --git a/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/commands/config.go b/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/commands/config.go
deleted file mode 100644
index 8af3046..0000000
--- a/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/commands/config.go
+++ /dev/null
@@ -1,78 +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 (
- "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/codegangsta/cli"
-)
-
-type Config struct {
- network *net.Network
-}
-
-func NewConfig(network *net.Network) (cmd *Config) {
- cmd = new(Config)
- cmd.network = network
- return
-}
-
-func (cmd *Config) Metadata() command_metadata.CommandMetadata {
- return command_metadata.CommandMetadata{
- Name: "config",
- Description: "Show the config for an application or entity",
- Usage: "BROOKLYN_NAME SCOPE config",
- Flags: []cli.Flag{},
- }
-}
-
-func (cmd *Config) Run(scope scope.Scope, c *cli.Context) {
- if err := net.VerifyLoginURL(cmd.network); err != nil {
- error_handler.ErrorExit(err)
- }
- if c.Args().Present() {
- configValue, err := entity_config.ConfigValue(cmd.network, scope.Application, scope.Entity, c.Args().First())
-
- if nil != err {
- error_handler.ErrorExit(err)
- }
- displayValue, err := stringRepresentation(configValue)
- if nil != err {
- error_handler.ErrorExit(err)
- }
- fmt.Println(displayValue)
-
- } else {
- config, err := entity_config.ConfigCurrentState(cmd.network, scope.Application, scope.Entity)
- if nil != err {
- error_handler.ErrorExit(err)
- }
- table := terminal.NewTable([]string{"Key", "Value"})
- for key, value := range config {
- table.Add(key, fmt.Sprintf("%v", value))
- }
- table.Print()
- }
-}
http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/bdb83934/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/commands/delete-catalog-application.go
----------------------------------------------------------------------
diff --git a/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/commands/delete-catalog-application.go b/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/commands/delete-catalog-application.go
deleted file mode 100644
index f289bbd..0000000
--- a/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/commands/delete-catalog-application.go
+++ /dev/null
@@ -1,33 +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/net"
-)
-
-type DeleteCatalogApplication struct {
- network *net.Network
-}
-
-func NewDeleteCatalogApplication(network *net.Network) (cmd *DeleteCatalogApplication) {
- cmd = new(DeleteCatalogApplication)
- cmd.network = network
- return
-}
http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/bdb83934/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/commands/delete-catalog-entity.go
----------------------------------------------------------------------
diff --git a/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/commands/delete-catalog-entity.go b/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/commands/delete-catalog-entity.go
deleted file mode 100644
index 5953fff..0000000
--- a/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/commands/delete-catalog-entity.go
+++ /dev/null
@@ -1,33 +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/net"
-)
-
-type DeleteCatalogEntity struct {
- network *net.Network
-}
-
-func NewDeleteCatalogEntity(network *net.Network) (cmd *DeleteCatalogEntity) {
- cmd = new(DeleteCatalogEntity)
- cmd.network = network
- return
-}
http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/bdb83934/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/commands/delete-catalog-policy.go
----------------------------------------------------------------------
diff --git a/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/commands/delete-catalog-policy.go b/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/commands/delete-catalog-policy.go
deleted file mode 100644
index c6b29a6..0000000
--- a/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/commands/delete-catalog-policy.go
+++ /dev/null
@@ -1,33 +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/net"
-)
-
-type DeleteCatalogPolicy struct {
- network *net.Network
-}
-
-func NewDeleteCatalogPolicy(network *net.Network) (cmd *DeleteCatalogPolicy) {
- cmd = new(DeleteCatalogPolicy)
- cmd.network = network
- return
-}
http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/bdb83934/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/commands/delete.go
----------------------------------------------------------------------
diff --git a/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/commands/delete.go b/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/commands/delete.go
deleted file mode 100644
index e4bfdae..0000000
--- a/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/commands/delete.go
+++ /dev/null
@@ -1,59 +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 (
- "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/codegangsta/cli"
-)
-
-type Delete struct {
- network *net.Network
-}
-
-func NewDelete(network *net.Network) (cmd *Delete) {
- cmd = new(Delete)
- cmd.network = network
- return
-}
-
-func (cmd *Delete) Metadata() command_metadata.CommandMetadata {
- return command_metadata.CommandMetadata{
- Name: "delete",
- Description: "* Delete (expunge) a brooklyn application",
- Usage: "BROOKLYN_NAME SCOPE delete",
- Flags: []cli.Flag{},
- }
-}
-
-func (cmd *Delete) Run(scope scope.Scope, c *cli.Context) {
- if err := net.VerifyLoginURL(cmd.network); err != nil {
- error_handler.ErrorExit(err)
- }
- del, err := application.Delete(cmd.network, scope.Application)
- if nil != err {
- error_handler.ErrorExit(err)
- }
- fmt.Println(del)
-}
http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/bdb83934/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/commands/deploy.go
----------------------------------------------------------------------
diff --git a/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/commands/deploy.go b/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/commands/deploy.go
deleted file mode 100644
index 3b0607c..0000000
--- a/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/commands/deploy.go
+++ /dev/null
@@ -1,85 +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/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/codegangsta/cli"
- "io/ioutil"
- "os"
- "strings"
-)
-
-type Deploy struct {
- network *net.Network
-}
-
-func NewDeploy(network *net.Network) (cmd *Deploy) {
- cmd = new(Deploy)
- cmd.network = network
- return
-}
-
-func (cmd *Deploy) Metadata() command_metadata.CommandMetadata {
- return command_metadata.CommandMetadata{
- Name: "deploy",
- Description: "Deploy a new application from the given YAML (read from file or stdin)",
- Usage: "BROOKLYN_NAME deploy ( <FILE> | - )",
- Flags: []cli.Flag{},
- }
-}
-
-func (cmd *Deploy) Run(scope scope.Scope, c *cli.Context) {
- if err := net.VerifyLoginURL(cmd.network); err != nil {
- error_handler.ErrorExit(err)
- }
-
- var create models.TaskSummary
- var err error
- var blueprint []byte
- if c.Args().First() == "" {
- error_handler.ErrorExit("A filename or '-' must be provided as the first argument", error_handler.CLIUsageErrorExitCode)
- }
- if c.Args().First() == "-" {
- blueprint, err = ioutil.ReadAll(os.Stdin)
- if err != nil {
- error_handler.ErrorExit(err)
- }
- create, err = application.CreateFromBytes(cmd.network, blueprint)
- } else {
- create, err = application.Create(cmd.network, c.Args().First())
- }
- if nil != err {
- if httpErr, ok := err.(net.HttpError); ok {
- error_handler.ErrorExit(strings.Join([]string{httpErr.Status, httpErr.Body}, "\n"), httpErr.Code)
- } else {
- error_handler.ErrorExit(err)
- }
- }
- table := terminal.NewTable([]string{"Id:", create.EntityId})
- table.Add("Name:", create.EntityDisplayName)
- table.Add("Status:", create.CurrentStatus)
- table.Print()
-}
http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/bdb83934/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/commands/destroy-policy.go
----------------------------------------------------------------------
diff --git a/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/commands/destroy-policy.go b/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/commands/destroy-policy.go
deleted file mode 100644
index c358d70..0000000
--- a/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/commands/destroy-policy.go
+++ /dev/null
@@ -1,59 +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 (
- "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/codegangsta/cli"
-)
-
-type DestroyPolicy struct {
- network *net.Network
-}
-
-func NewDestroyPolicy(network *net.Network) (cmd *DestroyPolicy) {
- cmd = new(DestroyPolicy)
- cmd.network = network
- return
-}
-
-func (cmd *DestroyPolicy) Metadata() command_metadata.CommandMetadata {
- return command_metadata.CommandMetadata{
- Name: "destroy-policy",
- Description: "Destroy a policy",
- Usage: "BROOKLYN_NAME SCOPE destroy-policy POLICY",
- Flags: []cli.Flag{},
- }
-}
-
-func (cmd *DestroyPolicy) Run(scope scope.Scope, c *cli.Context) {
- if err := net.VerifyLoginURL(cmd.network); err != nil {
- error_handler.ErrorExit(err)
- }
- spec, err := entity_policies.DestroyPolicy(cmd.network, scope.Application, scope.Entity, c.Args().First())
- if nil != err {
- error_handler.ErrorExit(err)
- }
- fmt.Println(spec)
-}
http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/bdb83934/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/commands/effector.go
----------------------------------------------------------------------
diff --git a/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/commands/effector.go b/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/commands/effector.go
deleted file mode 100644
index 7105cf9..0000000
--- a/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/commands/effector.go
+++ /dev/null
@@ -1,70 +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/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/codegangsta/cli"
- "strings"
-)
-
-type Effector struct {
- network *net.Network
-}
-
-func NewEffector(network *net.Network) (cmd *Effector) {
- cmd = new(Effector)
- cmd.network = network
- return
-}
-
-func (cmd *Effector) Metadata() command_metadata.CommandMetadata {
- return command_metadata.CommandMetadata{
- Name: "effector",
- Description: "Show the effectors for an application or entity",
- Usage: "BROOKLYN_NAME SCOPE effector [ NAME ]",
- Flags: []cli.Flag{},
- }
-}
-
-func (cmd *Effector) Run(scope scope.Scope, c *cli.Context) {
- if err := net.VerifyLoginURL(cmd.network); err != nil {
- error_handler.ErrorExit(err)
- }
- effectors, err := entity_effectors.EffectorList(cmd.network, scope.Application, scope.Entity)
- if nil != err {
- error_handler.ErrorExit(err)
- }
- table := terminal.NewTable([]string{"Name", "Description", "Parameters"})
- for _, effector := range effectors {
- var parameters []string
- for _, parameter := range effector.Parameters {
- parameters = append(parameters, parameter.Name)
- }
- if !c.Args().Present() || c.Args().First() == effector.Name {
- table.Add(effector.Name, effector.Description, strings.Join(parameters, ","))
- }
- }
- table.Print()
-}
http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/bdb83934/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/commands/entity.go
----------------------------------------------------------------------
diff --git a/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/commands/entity.go b/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/commands/entity.go
deleted file mode 100644
index b6688a3..0000000
--- a/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/commands/entity.go
+++ /dev/null
@@ -1,127 +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 (
- "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/codegangsta/cli"
- "os"
-)
-
-type Entity struct {
- network *net.Network
-}
-
-func NewEntity(network *net.Network) (cmd *Entity) {
- cmd = new(Entity)
- cmd.network = network
- return
-}
-
-func (cmd *Entity) Metadata() command_metadata.CommandMetadata {
- return command_metadata.CommandMetadata{
- Name: "entity",
- Aliases: []string{"entities", "ent", "ents"},
- Description: "Show the entities of an application or entity",
- Usage: "BROOKLYN_NAME SCOPE entity [ENTITYID]",
- Flags: []cli.Flag{
- cli.StringSliceFlag{
- Name: "children, c",
- Usage: "List children of the entity",
- },
- },
- }
-}
-
-func (cmd *Entity) Run(scope scope.Scope, c *cli.Context) {
- if err := net.VerifyLoginURL(cmd.network); err != nil {
- error_handler.ErrorExit(err)
- }
- if c.NumFlags() > 0 && c.FlagNames()[0] == "children" {
- cmd.listentity(scope.Application, c.StringSlice("children")[0])
- } else {
- if c.Args().Present() {
- cmd.show(scope.Application, c.Args().First())
- } else {
- if scope.Entity == scope.Application {
- cmd.listapp(scope.Application)
- } else {
- cmd.listentity(scope.Application, scope.Entity)
- }
- }
- }
-}
-
-const serviceStateSensor = "service.state"
-const serviceIsUp = "service.isUp"
-
-func (cmd *Entity) show(application, entity string) {
- summary, err := entities.GetEntity(cmd.network, application, entity)
- if nil != err {
- fmt.Fprintf(os.Stderr, "Error: %s\n", err)
- os.Exit(1)
- }
- table := terminal.NewTable([]string{"Id:", summary.Id})
- table.Add("Name:", summary.Name)
- configState, err := entity_sensors.CurrentState(cmd.network, application, entity)
- if nil != err {
- error_handler.ErrorExit(err)
- }
- if serviceState, ok := configState[serviceStateSensor]; ok {
- table.Add("Status:", fmt.Sprintf("%v", serviceState))
- }
- if serviceIsUp, ok := configState[serviceIsUp]; ok {
- table.Add("ServiceUp:", fmt.Sprintf("%v", serviceIsUp))
- }
- table.Add("Type:", summary.Type)
- table.Add("CatalogItemId:", summary.CatalogItemId)
- table.Print()
-}
-
-func (cmd *Entity) listapp(application string) {
- entitiesList, err := entities.EntityList(cmd.network, application)
- if nil != err {
- error_handler.ErrorExit(err)
- }
- table := terminal.NewTable([]string{"Id", "Name", "Type"})
- for _, entityitem := range entitiesList {
- table.Add(entityitem.Id, entityitem.Name, entityitem.Type)
- }
- table.Print()
-}
-
-func (cmd *Entity) listentity(application string, entity string) {
- entitiesList, err := entities.Children(cmd.network, application, entity)
- if nil != err {
- error_handler.ErrorExit(err)
- }
-
- table := terminal.NewTable([]string{"Id", "Name", "Type"})
- for _, entityitem := range entitiesList {
- table.Add(entityitem.Id, entityitem.Name, entityitem.Type)
- }
- table.Print()
-}
http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/bdb83934/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/commands/invoke.go
----------------------------------------------------------------------
diff --git a/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/commands/invoke.go b/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/commands/invoke.go
deleted file mode 100644
index 1ca6dd8..0000000
--- a/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/commands/invoke.go
+++ /dev/null
@@ -1,202 +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 (
- "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/codegangsta/cli"
- "io/ioutil"
- "strings"
-)
-
-type Invoke struct {
- network *net.Network
-}
-
-type Stop struct {
- Invoke
-}
-
-type Start struct {
- Invoke
-}
-
-type Restart struct {
- Invoke
-}
-
-func NewInvoke(network *net.Network) (cmd *Invoke) {
- cmd = new(Invoke)
- cmd.network = network
- return
-}
-
-func NewInvokeStop(network *net.Network) (cmd *Stop) {
- cmd = new(Stop)
- cmd.network = network
- return
-}
-
-func NewInvokeStart(network *net.Network) (cmd *Start) {
- cmd = new(Start)
- cmd.network = network
- return
-}
-
-func NewInvokeRestart(network *net.Network) (cmd *Restart) {
- cmd = new(Restart)
- cmd.network = network
- return
-}
-
-var paramFlags = []cli.Flag{
- cli.StringSliceFlag{
- Name: "param, P",
- Usage: "Parameter and value separated by '=', e.g. -P x=y",
- },
-}
-
-func (cmd *Invoke) Metadata() command_metadata.CommandMetadata {
- return command_metadata.CommandMetadata{
- Name: "invoke",
- Description: "Invoke an effector of an application and entity",
- Usage: "BROOKLYN_NAME EFF-SCOPE invoke [ parameter-options ]",
- Flags: paramFlags,
- }
-}
-
-func (cmd *Stop) Metadata() command_metadata.CommandMetadata {
- return command_metadata.CommandMetadata{
- Name: "stop",
- Description: "Invoke stop effector on an application and entity",
- Usage: "BROOKLYN_NAME ENT-SCOPE stop [ parameter-options ]",
- Flags: paramFlags,
- }
-}
-
-func (cmd *Start) Metadata() command_metadata.CommandMetadata {
- return command_metadata.CommandMetadata{
- Name: "start",
- Description: "Invoke start effector on an application and entity",
- Usage: "BROOKLYN_NAME ENT-SCOPE start [ parameter-options ]",
- Flags: paramFlags,
- }
-}
-
-func (cmd *Restart) Metadata() command_metadata.CommandMetadata {
- return command_metadata.CommandMetadata{
- Name: "restart",
- Description: "Invoke restart effector on an application and entity",
- Usage: "BROOKLYN_NAME ENT-SCOPE restart [ parameter-options ]",
- Flags: paramFlags,
- }
-}
-
-func (cmd *Invoke) Run(scope scope.Scope, c *cli.Context) {
- if err := net.VerifyLoginURL(cmd.network); err != nil {
- error_handler.ErrorExit(err)
- }
- parms := c.StringSlice("param")
- invoke(cmd.network, scope.Application, scope.Entity, scope.Effector, parms)
-}
-
-const stopEffector = "stop"
-
-func (cmd *Stop) Run(scope scope.Scope, c *cli.Context) {
- if err := net.VerifyLoginURL(cmd.network); err != nil {
- error_handler.ErrorExit(err)
- }
- parms := c.StringSlice("param")
- invoke(cmd.network, scope.Application, scope.Entity, stopEffector, parms)
-}
-
-const startEffector = "start"
-
-func (cmd *Start) Run(scope scope.Scope, c *cli.Context) {
- if err := net.VerifyLoginURL(cmd.network); err != nil {
- error_handler.ErrorExit(err)
- }
- parms := c.StringSlice("param")
- invoke(cmd.network, scope.Application, scope.Entity, startEffector, parms)
-}
-
-const restartEffector = "restart"
-
-func (cmd *Restart) Run(scope scope.Scope, c *cli.Context) {
- if err := net.VerifyLoginURL(cmd.network); err != nil {
- error_handler.ErrorExit(err)
- }
- parms := c.StringSlice("param")
- invoke(cmd.network, scope.Application, scope.Entity, restartEffector, parms)
-}
-
-func invoke(network *net.Network, application, entity, effector string, parms []string) {
- names, vals, err := extractParams(parms)
- result, err := entity_effectors.TriggerEffector(network, application, entity, effector, names, vals)
- if nil != err {
- error_handler.ErrorExit(err)
- } else {
- if "" != result {
- fmt.Println(result)
- }
- }
-}
-
-func extractParams(parms []string) ([]string, []string, error) {
- names := make([]string, len(parms))
- vals := make([]string, len(parms))
- var err error
- for i, parm := range parms {
- index := strings.Index(parm, "=")
- if index < 0 {
- return names, vals, errors.New("Parameter value not provided: " + parm)
- }
- names[i] = parm[0:index]
- vals[i], err = extractParamValue(parm[index+1:])
- }
- return names, vals, err
-}
-
-const paramDataPrefix string = "@"
-
-func extractParamValue(rawParam string) (string, error) {
- var err error
- var val string
- if strings.HasPrefix(rawParam, paramDataPrefix) {
- // strip the data prefix from the filename before reading
- val, err = readParamFromFile(rawParam[len(paramDataPrefix):])
- } else {
- val = rawParam
- err = nil
- }
- return val, err
-}
-
-// returning a string rather than byte array, assuming non-binary
-// TODO - if necessary support binary data sending to effector
-func readParamFromFile(filename string) (string, error) {
- dat, err := ioutil.ReadFile(filename)
- return string(dat), err
-}
http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/bdb83934/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/commands/list.go
----------------------------------------------------------------------
diff --git a/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/commands/list.go b/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/commands/list.go
deleted file mode 100644
index d675f77..0000000
--- a/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/commands/list.go
+++ /dev/null
@@ -1,90 +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 (
- "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/codegangsta/cli"
- "strings"
-)
-
-type List struct {
- network *net.Network
- listCommands map[string]command.Command
-}
-
-func NewList(network *net.Network) (cmd *List) {
- cmd = new(List)
- cmd.network = network
- cmd.listCommands = map[string]command.Command{
- // ListApplicationCommand: NewApplications(cmd.network),
- // ListEntityCommand: NewEntities(cmd.network),
- // ListSensorCommand: NewSensors(cmd.network),
- // ListEffectorCommand: NewEffector(cmd.network),
- }
- return
-}
-
-const ListApplicationCommand = "application"
-const ListEntityCommand = "entities"
-const ListSensorCommand = "sensors"
-const ListEffectorCommand = "effectors"
-
-var listCommands = []string{
- ListApplicationCommand,
- ListEntityCommand,
- ListSensorCommand,
- ListEffectorCommand,
-}
-var listCommandsUsage = strings.Join(listCommands, " | ")
-
-func (cmd *List) SubCommandNames() []string {
- return listCommands
-}
-
-func (cmd *List) SubCommand(name string) command.Command {
- return cmd.listCommands[name]
-}
-
-func (cmd *List) Metadata() command_metadata.CommandMetadata {
- return command_metadata.CommandMetadata{
- Name: "list",
- Description: "List details for a variety of operands",
- Usage: "BROOKLYN_NAME SCOPE list (" + listCommandsUsage + ")",
- Flags: []cli.Flag{},
- Operands: []command_metadata.CommandMetadata{
- cmd.SubCommand(ListApplicationCommand).Metadata(),
- cmd.SubCommand(ListEntityCommand).Metadata(),
- cmd.SubCommand(ListSensorCommand).Metadata(),
- cmd.SubCommand(ListEffectorCommand).Metadata(),
- },
- }
-}
-
-func (cmd *List) Run(scope scope.Scope, c *cli.Context) {
- if err := net.VerifyLoginURL(cmd.network); err != nil {
- error_handler.ErrorExit(err)
- }
- fmt.Printf("Unrecognised item for list, please use one of (%s)\n", listCommandsUsage)
-}
http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/bdb83934/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/commands/locations.go
----------------------------------------------------------------------
diff --git a/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/commands/locations.go b/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/commands/locations.go
deleted file mode 100644
index 79646d5..0000000
--- a/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/commands/locations.go
+++ /dev/null
@@ -1,63 +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/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/codegangsta/cli"
-)
-
-type Locations struct {
- network *net.Network
-}
-
-func NewLocations(network *net.Network) (cmd *Locations) {
- cmd = new(Locations)
- cmd.network = network
- return
-}
-
-func (cmd *Locations) Metadata() command_metadata.CommandMetadata {
- return command_metadata.CommandMetadata{
- Name: "locations",
- Description: "* List the available locations",
- Usage: "BROOKLYN_NAME locations",
- Flags: []cli.Flag{},
- }
-}
-
-func (cmd *Locations) Run(scope scope.Scope, c *cli.Context) {
- if err := net.VerifyLoginURL(cmd.network); err != nil {
- error_handler.ErrorExit(err)
- }
- locationList, err := locations.LocationList(cmd.network)
- if nil != err {
- error_handler.ErrorExit(err)
- }
- table := terminal.NewTable([]string{"Id", "Name", "Spec"})
- for _, location := range locationList {
- table.Add(location.Id, location.Name, location.Spec)
- }
- table.Print()
-}
http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/bdb83934/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/commands/login.go
----------------------------------------------------------------------
diff --git a/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/commands/login.go b/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/commands/login.go
deleted file mode 100644
index fd47196..0000000
--- a/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/commands/login.go
+++ /dev/null
@@ -1,111 +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 (
- "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/codegangsta/cli"
- "golang.org/x/crypto/ssh/terminal"
- "syscall"
-)
-
-type Login struct {
- network *net.Network
- config *io.Config
-}
-
-func NewLogin(network *net.Network, config *io.Config) (cmd *Login) {
- cmd = new(Login)
- cmd.network = network
- cmd.config = config
- return
-}
-
-func (cmd *Login) Metadata() command_metadata.CommandMetadata {
- return command_metadata.CommandMetadata{
- Name: "login",
- Description: "Login to brooklyn",
- Usage: "BROOKLYN_NAME login URL [USER [PASSWORD]]",
- Flags: []cli.Flag{},
- }
-}
-
-func (cmd *Login) Run(scope scope.Scope, c *cli.Context) {
- if !c.Args().Present() {
- error_handler.ErrorExit("A URL must be provided as the first argument", error_handler.CLIUsageErrorExitCode)
- }
-
- // If an argument was not supplied, it is set to empty string
- cmd.network.BrooklynUrl = c.Args().Get(0)
- cmd.network.BrooklynUser = c.Args().Get(1)
- cmd.network.BrooklynPass = c.Args().Get(2)
-
- if err := net.VerifyLoginURL(cmd.network); err != nil {
- error_handler.ErrorExit(err)
- }
-
- // Strip off trailing '/' from URL if present.
- if cmd.network.BrooklynUrl[len(cmd.network.BrooklynUrl)-1] == '/' {
- if len(cmd.network.BrooklynUrl) == 1 {
- error_handler.ErrorExit("URL must not be a single \"/\" character", error_handler.CLIUsageErrorExitCode)
- }
- cmd.network.BrooklynUrl = cmd.network.BrooklynUrl[0 : len(cmd.network.BrooklynUrl)-1]
- }
-
- // Prompt for password if not supplied (password is not echoed to screen
- if cmd.network.BrooklynUser != "" && cmd.network.BrooklynPass == "" {
- fmt.Print("Enter Password: ")
- bytePassword, err := terminal.ReadPassword(int(syscall.Stdin))
- if err != nil {
- error_handler.ErrorExit(err)
- }
- fmt.Printf("\n")
- cmd.network.BrooklynPass = string(bytePassword)
- }
-
- if cmd.config.Map == nil {
- cmd.config.Map = make(map[string]interface{})
- }
- // now persist these credentials to the yaml file
- auth, ok := cmd.config.Map["auth"].(map[string]interface{})
- if !ok {
- auth = make(map[string]interface{})
- cmd.config.Map["auth"] = auth
- }
-
- auth[cmd.network.BrooklynUrl] = map[string]string{
- "username": cmd.network.BrooklynUser,
- "password": cmd.network.BrooklynPass,
- }
-
- cmd.config.Map["target"] = cmd.network.BrooklynUrl
- cmd.config.Write()
-
- loginVersion, err := version.Version(cmd.network)
- if nil != err {
- error_handler.ErrorExit(err)
- }
- fmt.Printf("Connected to Brooklyn version %s at %s\n", loginVersion.Version, cmd.network.BrooklynUrl)
-}
http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/bdb83934/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/commands/policy.go
----------------------------------------------------------------------
diff --git a/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/commands/policy.go b/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/commands/policy.go
deleted file mode 100644
index b548ab8..0000000
--- a/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/commands/policy.go
+++ /dev/null
@@ -1,114 +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/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/codegangsta/cli"
- "sort"
-)
-
-type Policy struct {
- network *net.Network
-}
-
-type policyConfigList []models.PolicyConfigList
-
-// Len is the number of elements in the collection.
-func (configs policyConfigList) Len() int {
- return len(configs)
-}
-
-// Less reports whether the element with
-// index i should sort before the element with index j.
-func (configs policyConfigList) Less(i, j int) bool {
- return configs[i].Name < configs[j].Name
-}
-
-// Swap swaps the elements with indexes i and j.
-func (configs policyConfigList) Swap(i, j int) {
- temp := configs[i]
- configs[i] = configs[j]
- configs[j] = temp
-}
-
-func NewPolicy(network *net.Network) (cmd *Policy) {
- cmd = new(Policy)
- cmd.network = network
- return
-}
-
-func (cmd *Policy) Metadata() command_metadata.CommandMetadata {
- return command_metadata.CommandMetadata{
- Name: "policy",
- Aliases: []string{"policies", "pol", "pols"},
- Description: "Show the policies for an application or entity",
- Usage: "BROOKLYN_NAME SCOPE policy [NAME]",
- Flags: []cli.Flag{},
- }
-}
-
-func (cmd *Policy) Run(scope scope.Scope, c *cli.Context) {
- if err := net.VerifyLoginURL(cmd.network); err != nil {
- error_handler.ErrorExit(err)
- }
- if c.Args().Present() {
- cmd.show(scope.Application, scope.Entity, c.Args().First())
- } else {
- cmd.list(scope.Application, scope.Entity)
- }
-}
-
-func (cmd *Policy) show(application, entity, policy string) {
- configs, err := entity_policy_config.GetAllConfigValues(cmd.network, application, entity, policy)
- if nil != err {
- error_handler.ErrorExit(err)
- }
- table := terminal.NewTable([]string{"Name", "Value", "Description"})
- var theConfigs policyConfigList = configs
- sort.Sort(theConfigs)
-
- for _, config := range theConfigs {
- value, err := entity_policy_config.GetConfigValue(cmd.network, application, entity, policy, config.Name)
- if nil != err {
- error_handler.ErrorExit(err)
- }
- table.Add(config.Name, value, config.Description)
- }
- table.Print()
-}
-
-func (cmd *Policy) list(application, entity string) {
- policies, err := entity_policies.PolicyList(cmd.network, application, entity)
- if nil != err {
- error_handler.ErrorExit(err)
- }
- table := terminal.NewTable([]string{"Id", "Name", "State"})
- for _, policy := range policies {
- table.Add(policy.Id, policy.Name, string(policy.State))
- }
- table.Print()
-}
http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/bdb83934/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/commands/rename.go
----------------------------------------------------------------------
diff --git a/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/commands/rename.go b/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/commands/rename.go
deleted file mode 100644
index 70df396..0000000
--- a/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/commands/rename.go
+++ /dev/null
@@ -1,59 +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 (
- "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/codegangsta/cli"
-)
-
-type Rename struct {
- network *net.Network
-}
-
-func NewRename(network *net.Network) (cmd *Rename) {
- cmd = new(Rename)
- cmd.network = network
- return
-}
-
-func (cmd *Rename) Metadata() command_metadata.CommandMetadata {
- return command_metadata.CommandMetadata{
- Name: "rename",
- Description: "Rename an application or entity",
- Usage: "BROOKLYN_NAME SCOPE rename NEW_NAME",
- Flags: []cli.Flag{},
- }
-}
-
-func (cmd *Rename) Run(scope scope.Scope, c *cli.Context) {
- if err := net.VerifyLoginURL(cmd.network); err != nil {
- error_handler.ErrorExit(err)
- }
- rename, err := entities.Rename(cmd.network, scope.Application, scope.Entity, c.Args().First())
- if nil != err {
- error_handler.ErrorExit(err)
- }
- fmt.Println(rename)
-}
http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/bdb83934/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/commands/reset-catalog.go
----------------------------------------------------------------------
diff --git a/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/commands/reset-catalog.go b/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/commands/reset-catalog.go
deleted file mode 100644
index 6830399..0000000
--- a/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/commands/reset-catalog.go
+++ /dev/null
@@ -1,33 +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/net"
-)
-
-type ResetCatalog struct {
- network *net.Network
-}
-
-func NewResetCatalog(network *net.Network) (cmd *ResetCatalog) {
- cmd = new(ResetCatalog)
- cmd.network = network
- return
-}