Updates to build script.
Project: http://git-wip-us.apache.org/repos/asf/brooklyn-client/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-client/commit/81853355 Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-client/tree/81853355 Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-client/diff/81853355 Branch: refs/heads/master Commit: 81853355650fd3efe724686a0828ee1e70cd11f4 Parents: 191b637 Author: Geoff Macartney <geoff.macart...@cloudsoftcorp.com> Authored: Wed Feb 24 12:21:25 2016 +0000 Committer: Geoff Macartney <geoff.macart...@cloudsoftcorp.com> Committed: Wed Feb 24 12:21:25 2016 +0000 ---------------------------------------------------------------------- br/Godeps/Godeps.json | 111 --- br/Godeps/Readme | 5 - br/Godeps/_workspace/.gitignore | 2 - .../github.com/apache/brooklyn-client/LICENSE | 201 ----- .../api/access_control/access_control.go | 30 - .../api/activities/activities.go | 41 - .../api/application/applications.go | 123 --- .../brooklyn-client/api/catalog/catalog.go | 215 ----- .../brooklyn-client/api/entities/entities.go | 165 ---- .../brooklyn-client/api/entity_config/config.go | 76 -- .../api/entity_effectors/effectors.go | 44 - .../api/entity_policies/policies.go | 86 -- .../api/entity_policy_config/config.go | 47 - .../api/entity_sensors/sensors.go | 80 -- .../brooklyn-client/api/locations/locations.go | 59 -- .../brooklyn-client/api/version/version.go | 18 - .../apache/brooklyn-client/app/app.go | 145 --- .../apache/brooklyn-client/command/command.go | 12 - .../brooklyn-client/command/supercommand.go | 12 - .../brooklyn-client/command_factory/factory.go | 123 --- .../command_metadata/command_metadata.go | 15 - .../brooklyn-client/command_runner/runner.go | 43 - .../apache/brooklyn-client/commands/access.go | 41 - .../brooklyn-client/commands/activity-stream.go | 131 --- .../apache/brooklyn-client/commands/activity.go | 144 --- .../brooklyn-client/commands/add-catalog.go | 41 - .../brooklyn-client/commands/add-children.go | 45 - .../brooklyn-client/commands/add-location.go | 15 - .../brooklyn-client/commands/add-policy.go | 32 - .../brooklyn-client/commands/application.go | 93 -- .../commands/catalog-applications.go | 15 - .../commands/catalog-entities.go | 15 - .../brooklyn-client/commands/catalog-entity.go | 15 - .../commands/catalog-location.go | 15 - .../commands/catalog-locations.go | 15 - .../commands/catalog-policies.go | 15 - .../brooklyn-client/commands/catalog-policy.go | 15 - .../apache/brooklyn-client/commands/catalog.go | 45 - .../apache/brooklyn-client/commands/config.go | 60 -- .../commands/delete-catalog-application.go | 15 - .../commands/delete-catalog-entity.go | 15 - .../commands/delete-catalog-policy.go | 15 - .../apache/brooklyn-client/commands/delete.go | 41 - .../apache/brooklyn-client/commands/deploy.go | 67 -- .../brooklyn-client/commands/destroy-policy.go | 41 - .../apache/brooklyn-client/commands/effector.go | 52 -- .../apache/brooklyn-client/commands/entity.go | 109 --- .../apache/brooklyn-client/commands/invoke.go | 184 ---- .../apache/brooklyn-client/commands/list.go | 72 -- .../brooklyn-client/commands/locations.go | 45 - .../apache/brooklyn-client/commands/login.go | 93 -- .../apache/brooklyn-client/commands/policy.go | 96 -- .../apache/brooklyn-client/commands/rename.go | 41 - .../brooklyn-client/commands/reset-catalog.go | 15 - .../apache/brooklyn-client/commands/sensor.go | 100 --- .../apache/brooklyn-client/commands/set.go | 41 - .../apache/brooklyn-client/commands/spec.go | 41 - .../brooklyn-client/commands/start-policy.go | 41 - .../brooklyn-client/commands/stop-policy.go | 41 - .../apache/brooklyn-client/commands/tree.go | 60 -- .../apache/brooklyn-client/commands/utils.go | 20 - .../apache/brooklyn-client/commands/version.go | 41 - .../brooklyn-client/error_handler/error.go | 28 - .../apache/brooklyn-client/io/config.go | 51 -- .../apache/brooklyn-client/models/access.go | 6 - .../brooklyn-client/models/applications.go | 77 -- .../apache/brooklyn-client/models/catalog.go | 45 - .../apache/brooklyn-client/models/config.go | 13 - .../apache/brooklyn-client/models/effectors.go | 16 - .../apache/brooklyn-client/models/entities.go | 9 - .../apache/brooklyn-client/models/locations.go | 10 - .../apache/brooklyn-client/models/policies.go | 21 - .../apache/brooklyn-client/models/sensors.go | 8 - .../apache/brooklyn-client/models/version.go | 16 - .../apache/brooklyn-client/net/net.go | 156 ---- .../apache/brooklyn-client/scope/scope.go | 119 --- .../apache/brooklyn-client/terminal/table.go | 84 -- .../src/github.com/codegangsta/cli/.travis.yml | 19 - .../src/github.com/codegangsta/cli/LICENSE | 21 - .../src/github.com/codegangsta/cli/README.md | 352 -------- .../src/github.com/codegangsta/cli/app.go | 349 -------- .../src/github.com/codegangsta/cli/appveyor.yml | 16 - .../cli/autocomplete/bash_autocomplete | 14 - .../cli/autocomplete/zsh_autocomplete | 5 - .../src/github.com/codegangsta/cli/cli.go | 40 - .../src/github.com/codegangsta/cli/command.go | 250 ------ .../src/github.com/codegangsta/cli/context.go | 388 -------- .../src/github.com/codegangsta/cli/flag.go | 546 ------------ .../src/github.com/codegangsta/cli/help.go | 248 ------ .../_workspace/src/golang.org/x/crypto/LICENSE | 27 - .../_workspace/src/golang.org/x/crypto/PATENTS | 22 - .../x/crypto/ssh/terminal/terminal.go | 892 ------------------- .../golang.org/x/crypto/ssh/terminal/util.go | 128 --- .../x/crypto/ssh/terminal/util_bsd.go | 12 - .../x/crypto/ssh/terminal/util_linux.go | 11 - .../x/crypto/ssh/terminal/util_windows.go | 174 ---- build.xml | 22 +- 97 files changed, 9 insertions(+), 7877 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/81853355/br/Godeps/Godeps.json ---------------------------------------------------------------------- diff --git a/br/Godeps/Godeps.json b/br/Godeps/Godeps.json deleted file mode 100644 index 556e486..0000000 --- a/br/Godeps/Godeps.json +++ /dev/null @@ -1,111 +0,0 @@ -{ - "ImportPath": "github.com/apache/brooklyn-client/br", - "GoVersion": "go1.5", - "Deps": [ - { - "ImportPath": "github.com/apache/brooklyn-client/api/access_control", - "Rev": "89c10be6258c2e3b14c4516cdabad0932d7fddb4" - }, - { - "ImportPath": "github.com/apache/brooklyn-client/api/activities", - "Rev": "89c10be6258c2e3b14c4516cdabad0932d7fddb4" - }, - { - "ImportPath": "github.com/apache/brooklyn-client/api/application", - "Rev": "89c10be6258c2e3b14c4516cdabad0932d7fddb4" - }, - { - "ImportPath": "github.com/apache/brooklyn-client/api/catalog", - "Rev": "89c10be6258c2e3b14c4516cdabad0932d7fddb4" - }, - { - "ImportPath": "github.com/apache/brooklyn-client/api/entities", - "Rev": "89c10be6258c2e3b14c4516cdabad0932d7fddb4" - }, - { - "ImportPath": "github.com/apache/brooklyn-client/api/entity_config", - "Rev": "89c10be6258c2e3b14c4516cdabad0932d7fddb4" - }, - { - "ImportPath": "github.com/apache/brooklyn-client/api/entity_effectors", - "Rev": "89c10be6258c2e3b14c4516cdabad0932d7fddb4" - }, - { - "ImportPath": "github.com/apache/brooklyn-client/api/entity_policies", - "Rev": "89c10be6258c2e3b14c4516cdabad0932d7fddb4" - }, - { - "ImportPath": "github.com/apache/brooklyn-client/api/entity_policy_config", - "Rev": "89c10be6258c2e3b14c4516cdabad0932d7fddb4" - }, - { - "ImportPath": "github.com/apache/brooklyn-client/api/entity_sensors", - "Rev": "89c10be6258c2e3b14c4516cdabad0932d7fddb4" - }, - { - "ImportPath": "github.com/apache/brooklyn-client/api/locations", - "Rev": "89c10be6258c2e3b14c4516cdabad0932d7fddb4" - }, - { - "ImportPath": "github.com/apache/brooklyn-client/api/version", - "Rev": "89c10be6258c2e3b14c4516cdabad0932d7fddb4" - }, - { - "ImportPath": "github.com/apache/brooklyn-client/app", - "Rev": "89c10be6258c2e3b14c4516cdabad0932d7fddb4" - }, - { - "ImportPath": "github.com/apache/brooklyn-client/command", - "Rev": "89c10be6258c2e3b14c4516cdabad0932d7fddb4" - }, - { - "ImportPath": "github.com/apache/brooklyn-client/command_factory", - "Rev": "89c10be6258c2e3b14c4516cdabad0932d7fddb4" - }, - { - "ImportPath": "github.com/apache/brooklyn-client/command_metadata", - "Rev": "89c10be6258c2e3b14c4516cdabad0932d7fddb4" - }, - { - "ImportPath": "github.com/apache/brooklyn-client/command_runner", - "Rev": "89c10be6258c2e3b14c4516cdabad0932d7fddb4" - }, - { - "ImportPath": "github.com/apache/brooklyn-client/commands", - "Rev": "89c10be6258c2e3b14c4516cdabad0932d7fddb4" - }, - { - "ImportPath": "github.com/apache/brooklyn-client/error_handler", - "Rev": "89c10be6258c2e3b14c4516cdabad0932d7fddb4" - }, - { - "ImportPath": "github.com/apache/brooklyn-client/io", - "Rev": "89c10be6258c2e3b14c4516cdabad0932d7fddb4" - }, - { - "ImportPath": "github.com/apache/brooklyn-client/models", - "Rev": "89c10be6258c2e3b14c4516cdabad0932d7fddb4" - }, - { - "ImportPath": "github.com/apache/brooklyn-client/net", - "Rev": "89c10be6258c2e3b14c4516cdabad0932d7fddb4" - }, - { - "ImportPath": "github.com/apache/brooklyn-client/scope", - "Rev": "89c10be6258c2e3b14c4516cdabad0932d7fddb4" - }, - { - "ImportPath": "github.com/apache/brooklyn-client/terminal", - "Rev": "89c10be6258c2e3b14c4516cdabad0932d7fddb4" - }, - { - "ImportPath": "github.com/codegangsta/cli", - "Comment": "1.2.0-217-g5db7419", - "Rev": "5db74198dee1cfe60cf06a611d03a420361baad6" - }, - { - "ImportPath": "golang.org/x/crypto/ssh/terminal", - "Rev": "1f22c0103821b9390939b6776727195525381532" - } - ] -} http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/81853355/br/Godeps/Readme ---------------------------------------------------------------------- diff --git a/br/Godeps/Readme b/br/Godeps/Readme deleted file mode 100644 index 4cdaa53..0000000 --- a/br/Godeps/Readme +++ /dev/null @@ -1,5 +0,0 @@ -This directory tree is generated automatically by godep. - -Please do not edit. - -See https://github.com/tools/godep for more information. http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/81853355/br/Godeps/_workspace/.gitignore ---------------------------------------------------------------------- diff --git a/br/Godeps/_workspace/.gitignore b/br/Godeps/_workspace/.gitignore deleted file mode 100644 index f037d68..0000000 --- a/br/Godeps/_workspace/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -/pkg -/bin http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/81853355/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/LICENSE ---------------------------------------------------------------------- diff --git a/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/LICENSE b/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/LICENSE deleted file mode 100644 index ad410e1..0000000 --- a/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ -Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "{}" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright {yyyy} {name of copyright owner} - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - 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. \ No newline at end of file http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/81853355/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/api/access_control/access_control.go ---------------------------------------------------------------------- diff --git a/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/api/access_control/access_control.go b/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/api/access_control/access_control.go deleted file mode 100644 index a87c0af..0000000 --- a/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/api/access_control/access_control.go +++ /dev/null @@ -1,30 +0,0 @@ -package access_control - -import ( - "encoding/json" - "fmt" - "github.com/apache/brooklyn-client/models" - "github.com/apache/brooklyn-client/net" -) - -func Access(network *net.Network) (models.AccessSummary, error) { - url := fmt.Sprintf("/v1/access") - var access models.AccessSummary - - body, err := network.SendGetRequest(url) - if err != nil { - return access, err - } - - err = json.Unmarshal(body, &access) - return access, err -} - -// WIP -//func LocationProvisioningAllowed(network *net.Network, allowed bool) { -// url := fmt.Sprintf("/v1/access/locationProvisioningAllowed") -// body, err := network.SendPostRequest(url) -// if err != nil { -// error_handler.ErrorExit(err) -// } -//} http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/81853355/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/api/activities/activities.go ---------------------------------------------------------------------- diff --git a/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/api/activities/activities.go b/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/api/activities/activities.go deleted file mode 100644 index 8311877..0000000 --- a/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/api/activities/activities.go +++ /dev/null @@ -1,41 +0,0 @@ -package activities - -import ( - "encoding/json" - "fmt" - "github.com/apache/brooklyn-client/models" - "github.com/apache/brooklyn-client/net" -) - -func Activity(network *net.Network, activity string) (models.TaskSummary, error) { - url := fmt.Sprintf("/v1/activities/%s", activity) - var task models.TaskSummary - body, err := network.SendGetRequest(url) - if err != nil { - return task, err - } - - err = json.Unmarshal(body, &task) - return task, err -} - -func ActivityChildren(network *net.Network, activity string) ([]models.TaskSummary, error) { - url := fmt.Sprintf("/v1/activities/%s/children", activity) - var tasks []models.TaskSummary - body, err := network.SendGetRequest(url) - if err != nil { - return tasks, err - } - - err = json.Unmarshal(body, &tasks) - return tasks, err -} - -func ActivityStream(network *net.Network, activity, streamId string) (string, error) { - url := fmt.Sprintf("/v1/activities/%s/stream/%s", activity, streamId) - body, err := network.SendGetRequest(url) - if nil != err { - return "", err - } - return string(body), nil -} http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/81853355/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/api/application/applications.go ---------------------------------------------------------------------- diff --git a/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/api/application/applications.go b/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/api/application/applications.go deleted file mode 100644 index f61cf6d..0000000 --- a/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/api/application/applications.go +++ /dev/null @@ -1,123 +0,0 @@ -package application - -import ( - "encoding/json" - "fmt" - "github.com/apache/brooklyn-client/models" - "github.com/apache/brooklyn-client/net" -) - -//WIP -func Fetch(network *net.Network) (string, error) { - url := "/v1/applications/fetch" - body, err := network.SendGetRequest(url) - if err != nil { - return "", err - } - // TODO return model - return string(body), nil -} - -func Applications(network *net.Network) ([]models.ApplicationSummary, error) { - url := fmt.Sprintf("/v1/applications") - var appSummary []models.ApplicationSummary - body, err := network.SendGetRequest(url) - if err != nil { - return appSummary, err - } - - err = json.Unmarshal(body, &appSummary) - return appSummary, err -} - -func Create(network *net.Network, filePath string) (models.TaskSummary, error) { - url := "/v1/applications" - var response models.TaskSummary - body, err := network.SendPostFileRequest(url, filePath, "application/json") - if err != nil { - return response, err - } - err = json.Unmarshal(body, &response) - return response, err -} - -func CreateFromBytes(network *net.Network, blueprint []byte) (models.TaskSummary, error) { - url := "/v1/applications" - var response models.TaskSummary - body, err := network.SendPostRequest(url, blueprint) - if err != nil { - return response, err - } - err = json.Unmarshal(body, &response) - return response, err -} - -// WIP -func Descendants(network *net.Network, app string) (string, error) { - url := fmt.Sprintf("/v1/applications/%s/descendants", app) - - body, err := network.SendGetRequest(url) - // TODO return model - if nil != err { - return "", err - } - return string(body), nil -} - -// WIP -func DescendantsSensor(network *net.Network, app, sensor string) (string, error) { - url := fmt.Sprintf("/v1/applications/%s/descendants/sensor/%s", app, sensor) - - body, err := network.SendGetRequest(url) - // TODO return model - if nil != err { - return "", err - } - return string(body), nil -} - -func Tree(network *net.Network) ([]models.Tree, error) { - url := "/v1/applications/tree" - var tree []models.Tree - body, err := network.SendGetRequest(url) - if err != nil { - return tree, err - } - - err = json.Unmarshal(body, &tree) - return tree, err -} - -func Application(network *net.Network, app string) (models.ApplicationSummary, error) { - url := fmt.Sprintf("/v1/applications/%s", app) - var appSummary models.ApplicationSummary - body, err := network.SendGetRequest(url) - if err != nil { - return appSummary, err - } - - err = json.Unmarshal(body, &appSummary) - return appSummary, err -} - -func Delete(network *net.Network, application string) (models.TaskSummary, error) { - url := fmt.Sprintf("/v1/applications/%s", application) - var response models.TaskSummary - body, err := network.SendDeleteRequest(url) - if err != nil { - return response, err - } - err = json.Unmarshal(body, &response) - return response, err -} - -// WIP -func CreateLegacy(network *net.Network) (string, error) { - url := fmt.Sprintf("/v1/applications/createLegacy") - body, err := network.SendEmptyPostRequest(url) - if err != nil { - return "", err - } - // TODO return model - return string(body), nil -} http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/81853355/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/api/catalog/catalog.go ---------------------------------------------------------------------- diff --git a/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/api/catalog/catalog.go b/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/api/catalog/catalog.go deleted file mode 100644 index 1d18275..0000000 --- a/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/api/catalog/catalog.go +++ /dev/null @@ -1,215 +0,0 @@ -package catalog - -import ( - "encoding/json" - "fmt" - "github.com/apache/brooklyn-client/models" - "github.com/apache/brooklyn-client/net" -) - -func Icon(network *net.Network, itemId string) ([]byte, error) { - url := fmt.Sprintf("/v1/catalog/icon/%s", itemId) - body, err := network.SendGetRequest(url) - return body, err -} - -func IconWithVersion(network *net.Network, itemId, version string) ([]byte, error) { - url := fmt.Sprintf("/v1/catalog/icon/%s/%s", itemId, version) - body, err := network.SendGetRequest(url) - return body, err -} - -func GetEntityWithVersion(network *net.Network, entityId, version string) (models.CatalogEntitySummary, error) { - url := fmt.Sprintf("/v1/catalog/entities/%s/%s", entityId, version) - var catalogEntity models.CatalogEntitySummary - body, err := network.SendGetRequest(url) - if err != nil { - return catalogEntity, err - } - err = json.Unmarshal(body, &catalogEntity) - return catalogEntity, err -} - -func DeleteEntityWithVersion(network *net.Network, entityId, version string) (string, error) { - url := fmt.Sprintf("/v1/catalog/entities/%s/%s", entityId, version) - body, err := network.SendDeleteRequest(url) - if err != nil { - return "", err - } - return string(body), nil -} - -func GetEntity(network *net.Network, entityId string) (models.CatalogEntitySummary, error) { - url := fmt.Sprintf("/v1/catalog/entities/%s", entityId) - var catalogEntity models.CatalogEntitySummary - body, err := network.SendGetRequest(url) - if err != nil { - return catalogEntity, err - } - err = json.Unmarshal(body, &catalogEntity) - return catalogEntity, err -} - -func DeleteEntity(network *net.Network, entityId string) (string, error) { - url := fmt.Sprintf("/v1/catalog/entities/%s", entityId) - body, err := network.SendDeleteRequest(url) - if err != nil { - return "", err - } - return string(body), nil -} - -func GetPolicy(network *net.Network, policyId string) (models.CatalogItemSummary, error) { - url := fmt.Sprintf("/v1/catalog/policies/%s", policyId) - var catalogItem models.CatalogItemSummary - body, err := network.SendGetRequest(url) - if err != nil { - return catalogItem, err - } - err = json.Unmarshal(body, &catalogItem) - return catalogItem, err -} - -func GetPolicyWithVersion(network *net.Network, policyId, version string) (models.CatalogItemSummary, error) { - url := fmt.Sprintf("/v1/catalog/policies/%s/%s", policyId) - var catalogItem models.CatalogItemSummary - body, err := network.SendGetRequest(url) - if err != nil { - return catalogItem, err - } - err = json.Unmarshal(body, &catalogItem) - return catalogItem, err -} - -func DeletePolicyWithVersion(network *net.Network, policyId, version string) (string, error) { - url := fmt.Sprintf("/v1/catalog/policies/%s/%s", policyId) - body, err := network.SendDeleteRequest(url) - if err != nil { - return "", err - } - return string(body), nil -} - -func GetApplication(network *net.Network, applicationId string) (models.CatalogEntitySummary, error) { - url := fmt.Sprintf("/v1/catalog/applications/%s", applicationId) - var catalogEntity models.CatalogEntitySummary - body, err := network.SendGetRequest(url) - if err != nil { - return catalogEntity, err - } - err = json.Unmarshal(body, &catalogEntity) - return catalogEntity, err -} - -func GetApplicationWithVersion(network *net.Network, applicationId, version string) (models.CatalogEntitySummary, error) { - url := fmt.Sprintf("/v1/catalog/applications/%s/%s", applicationId, version) - var catalogEntity models.CatalogEntitySummary - body, err := network.SendGetRequest(url) - if err != nil { - return catalogEntity, err - } - err = json.Unmarshal(body, &catalogEntity) - return catalogEntity, err -} - -func DeleteApplicationWithVersion(network *net.Network, applicationId, version string) (string, error) { - url := fmt.Sprintf("/v1/catalog/applications/%s/%s", applicationId, 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 - body, err := network.SendGetRequest(url) - if err != nil { - return policies, err - } - err = json.Unmarshal(body, &policies) - return policies, err -} - -func Locations(network *net.Network) (models.CatalogLocationSummary, error) { - url := "/v1/catalog/locations" - var catalogLocation models.CatalogLocationSummary - body, err := network.SendGetRequest(url) - if err != nil { - return catalogLocation, err - } - err = json.Unmarshal(body, &catalogLocation) - return catalogLocation, err -} - -func AddCatalog(network *net.Network, filePath string) (string, error) { - url := "/v1/catalog" - body, err := network.SendPostFileRequest(url, filePath, "application/json") - if err != nil { - return "", err - } - return string(body), nil -} - -func Reset(network *net.Network) (string, error) { - url := "/v1/catalog/reset" - body, err := network.SendEmptyPostRequest(url) - if err != nil { - return "", err - } - return string(body), nil -} - -func GetLocationWithVersion(network *net.Network, locationId, version string) (models.CatalogLocationSummary, error) { - url := fmt.Sprintf("/v1/catalog/locations/%s/%s", locationId, version) - var catalogLocation models.CatalogLocationSummary - body, err := network.SendGetRequest(url) - if err != nil { - return catalogLocation, err - } - err = json.Unmarshal(body, &catalogLocation) - return catalogLocation, err -} - -func PostLocationWithVersion(network *net.Network, locationId, version string) (string, error) { - url := fmt.Sprintf("/v1/catalog/locations/%s/%s", locationId, version) - body, err := network.SendEmptyPostRequest(url) - if err != nil { - return "", err - } - return string(body), nil -} - -func Entities(network *net.Network) ([]models.CatalogItemSummary, error) { - url := "/v1/catalog/entities" - var entities []models.CatalogItemSummary - body, err := network.SendGetRequest(url) - if err != nil { - return entities, err - } - err = json.Unmarshal(body, &entities) - return entities, err -} - -func Catalog(network *net.Network) ([]models.CatalogItemSummary, error) { - url := "/v1/catalog/applications" - var applications []models.CatalogItemSummary - body, err := network.SendGetRequest(url) - if err != nil { - return applications, err - } - err = json.Unmarshal(body, &applications) - return applications, err -} - -func GetLocation(network *net.Network, locationId string) (models.CatalogLocationSummary, error) { - url := fmt.Sprintf("/v1/catalog/locations/%s", locationId) - var catalogLocation models.CatalogLocationSummary - body, err := network.SendGetRequest(url) - if err != nil { - return catalogLocation, err - } - err = json.Unmarshal(body, &catalogLocation) - return catalogLocation, err -} http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/81853355/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/api/entities/entities.go ---------------------------------------------------------------------- diff --git a/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/api/entities/entities.go b/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/api/entities/entities.go deleted file mode 100644 index fe64fa6..0000000 --- a/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/api/entities/entities.go +++ /dev/null @@ -1,165 +0,0 @@ -package entities - -import ( - "encoding/json" - "fmt" - "github.com/apache/brooklyn-client/models" - "github.com/apache/brooklyn-client/net" - "net/url" -) - -//WIP -func GetTask(network *net.Network, application, entity, task string) (string, error) { - url := fmt.Sprintf("/v1/applications/%s/entities/%s/activities/%s", application, entity, task) - body, err := network.SendGetRequest(url) - // TODO return model - if nil != err { - return "", err - } - return string(body), nil -} - -//WIP -func GetIcon(network *net.Network, application, entity string) (string, error) { - url := fmt.Sprintf("/v1/applications/%s/entities/%s/icon", application, entity) - body, err := network.SendGetRequest(url) - // TODO return model - if nil != err { - return "", err - } - return string(body), nil -} - -func Children(network *net.Network, application, entity string) ([]models.EntitySummary, error) { - urlStr := fmt.Sprintf("/v1/applications/%s/entities/%s/children", application, entity) - var entityList []models.EntitySummary - body, err := network.SendGetRequest(urlStr) - if err != nil { - return entityList, err - } - - err = json.Unmarshal(body, &entityList) - return entityList, err -} - -func AddChildren(network *net.Network, application, entity, filePath string) (models.TaskSummary, error) { - urlStr := fmt.Sprintf("/v1/applications/%s/entities/%s/children", application, entity) - var response models.TaskSummary - body, err := network.SendPostFileRequest(urlStr, filePath, "application/json") - if err != nil { - return response, err - } - - err = json.Unmarshal(body, &response) - return response, err -} - -//WIP -func GetLocations(network *net.Network, application, entity string) (string, error) { - url := fmt.Sprintf("/v1/applications/%s/entities/%s/locations", application, entity) - body, err := network.SendGetRequest(url) - // TODO return model - if nil != err { - return "", err - } - return string(body), nil -} - -func Spec(network *net.Network, application, entity string) (string, error) { - urlStr := fmt.Sprintf("/v1/applications/%s/entities/%s/spec", application, entity) - body, err := network.SendGetRequest(urlStr) - if nil != err { - return "", err - } - return string(body), nil -} - -//WIP -func GetDescendants(network *net.Network, application, entity string) (string, error) { - url := fmt.Sprintf("/v1/applications/%s/entities/%s/descendants", application, entity) - body, err := network.SendGetRequest(url) - // TODO return model - if nil != err { - return "", err - } - return string(body), nil -} - -//WIP -func GetDescendantsSensor(network *net.Network, application, entity, sensor string) (string, error) { - url := fmt.Sprintf("/v1/applications/%s/entities/%s/descendants/sensor/%s", application, entity, sensor) - body, err := network.SendGetRequest(url) - // TODO return model - if nil != err { - return "", err - } - return string(body), nil -} - -func GetActivities(network *net.Network, application, entity string) ([]models.TaskSummary, error) { - url := fmt.Sprintf("/v1/applications/%s/entities/%s/activities", application, entity) - var activityList []models.TaskSummary - body, err := network.SendGetRequest(url) - if err != nil { - return activityList, err - } - - err = json.Unmarshal(body, &activityList) - return activityList, err -} - -//WIP -func GetTags(network *net.Network, application, entity string) (string, error) { - url := fmt.Sprintf("/v1/applications/%s/entities/%s/tags", application, entity) - body, err := network.SendGetRequest(url) - // TODO return model - if nil != err { - return "", err - } - return string(body), nil -} - -//WIP -func Expunge(network *net.Network, application, entity string) (string, error) { - url := fmt.Sprintf("/v1/applications/%s/entities/%s/expunge", application, entity) - body, err := network.SendEmptyPostRequest(url) - // TODO return model - if nil != err { - return "", err - } - return string(body), nil -} - -//WIP -func GetEntity(network *net.Network, application, entity string) (models.EntitySummary, error) { - url := fmt.Sprintf("/v1/applications/%s/entities/%s", application, entity) - summary := models.EntitySummary{} - body, err := network.SendGetRequest(url) - if err != nil { - return summary, err - } - - err = json.Unmarshal(body, &summary) - return summary, err -} - -func EntityList(network *net.Network, application string) ([]models.EntitySummary, error) { - urlStr := fmt.Sprintf("/v1/applications/%s/entities", application) - var entityList []models.EntitySummary - body, err := network.SendGetRequest(urlStr) - if err != nil { - return entityList, err - } - - err = json.Unmarshal(body, &entityList) - return entityList, err -} - -func Rename(network *net.Network, application, entity, newName string) (string, error) { - urlStr := fmt.Sprintf("/v1/applications/%s/entities/%s/name?name=%s", application, entity, url.QueryEscape(newName)) - body, err := network.SendEmptyPostRequest(urlStr) - if nil != err { - return "", err - } - return string(body), nil -} http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/81853355/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/api/entity_config/config.go ---------------------------------------------------------------------- diff --git a/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/api/entity_config/config.go b/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/api/entity_config/config.go deleted file mode 100644 index 65078a1..0000000 --- a/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/api/entity_config/config.go +++ /dev/null @@ -1,76 +0,0 @@ -package entity_config - -import ( - "encoding/json" - "fmt" - "github.com/apache/brooklyn-client/models" - "github.com/apache/brooklyn-client/net" -) - -func ConfigValue(network *net.Network, application, entity, config string) (interface{}, error) { - bytes, err := ConfigValueAsBytes(network, application, entity, config) - if nil != err || 0 == len(bytes) { - return nil, err - } - - var value interface{} - err = json.Unmarshal(bytes, &value) - if nil != err { - return nil, err - } - - return value, nil -} - -func ConfigValueAsBytes(network *net.Network, application, entity, config string) ([]byte, error) { - url := fmt.Sprintf("/v1/applications/%s/entities/%s/config/%s", application, entity, config) - body, err := network.SendGetRequest(url) - if err != nil { - return []byte{}, err - } - - return body, nil -} - -func SetConfig(network *net.Network, application, entity, config, value string) (string, error) { - url := fmt.Sprintf("/v1/applications/%s/entities/%s/config/%s", application, entity, config) - val := []byte(value) - body, err := network.SendPostRequest(url, val) - if nil != err { - return "", err - } - return string(body), nil -} - -func ConfigList(network *net.Network, application, entity string) ([]models.ConfigSummary, error) { - url := fmt.Sprintf("/v1/applications/%s/entities/%s/config", application, entity) - var configList []models.ConfigSummary - body, err := network.SendGetRequest(url) - if err != nil { - return configList, err - } - - err = json.Unmarshal(body, &configList) - return configList, err -} - -func PostConfig(network *net.Network, application, entity, config, value string) (string, error) { - url := fmt.Sprintf("/v1/applications/%s/entities/%s/config", application, entity) - val := []byte(value) - body, err := network.SendPostRequest(url, val) - if nil != err { - return "", err - } - return string(body), nil -} - -func ConfigCurrentState(network *net.Network, application, entity string) (map[string]interface{}, error) { - url := fmt.Sprintf("/v1/applications/%s/entities/%s/config/current-state", application, entity) - var currentState map[string]interface{} - body, err := network.SendGetRequest(url) - if err != nil { - return currentState, err - } - err = json.Unmarshal(body, ¤tState) - return currentState, err -} http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/81853355/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/api/entity_effectors/effectors.go ---------------------------------------------------------------------- diff --git a/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/api/entity_effectors/effectors.go b/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/api/entity_effectors/effectors.go deleted file mode 100644 index 5cfb7ab..0000000 --- a/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/api/entity_effectors/effectors.go +++ /dev/null @@ -1,44 +0,0 @@ -package entity_effectors - -import ( - "bytes" - "encoding/json" - "errors" - "fmt" - "github.com/apache/brooklyn-client/models" - "github.com/apache/brooklyn-client/net" - "net/url" - "strconv" - "strings" -) - -func EffectorList(network *net.Network, application, entity string) ([]models.EffectorSummary, error) { - path := fmt.Sprintf("/v1/applications/%s/entities/%s/effectors", application, entity) - var effectorList []models.EffectorSummary - body, err := network.SendGetRequest(path) - if err != nil { - return effectorList, err - } - - err = json.Unmarshal(body, &effectorList) - return effectorList, err -} - -func TriggerEffector(network *net.Network, application, entity, effector string, params []string, args []string) (string, error) { - if len(params) != len(args) { - return "", errors.New(strings.Join([]string{"Parameters not supplied:", strings.Join(params, ", ")}, " ")) - } - path := fmt.Sprintf("/v1/applications/%s/entities/%s/effectors/%s", application, entity, effector) - data := url.Values{} - for i := range params { - data.Set(params[i], args[i]) - } - req := network.NewPostRequest(path, bytes.NewBufferString(data.Encode())) - req.Header.Add("Content-Type", "application/x-www-form-urlencoded") - req.Header.Add("Content-Length", strconv.Itoa(len(data.Encode()))) - body, err := network.SendRequest(req) - if err != nil { - return "", err - } - return string(body), nil -} http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/81853355/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/api/entity_policies/policies.go ---------------------------------------------------------------------- diff --git a/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/api/entity_policies/policies.go b/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/api/entity_policies/policies.go deleted file mode 100644 index 29fdbaa..0000000 --- a/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/api/entity_policies/policies.go +++ /dev/null @@ -1,86 +0,0 @@ -package entity_policies - -import ( - "bytes" - "encoding/json" - "fmt" - "github.com/apache/brooklyn-client/models" - "github.com/apache/brooklyn-client/net" - "net/url" - "strconv" -) - -// WIP -func AddPolicy(network *net.Network, application, entity, policy string, config map[string]string) (models.PolicySummary, error) { - path := fmt.Sprintf("/v1/applications/%s/entities/%s/policies", application, entity) - data := url.Values{} - data.Set("policyType", policy) - //data.Add("config", config) - req := network.NewPostRequest(path, bytes.NewBufferString(data.Encode())) - req.Header.Add("Content-Type", "application/x-www-form-urlencoded") - req.Header.Add("Content-Length", strconv.Itoa(len(data.Encode()))) - var policySummary models.PolicySummary - body, err := network.SendRequest(req) - if err != nil { - return policySummary, err - } - err = json.Unmarshal(body, &policySummary) - return policySummary, err -} - -func PolicyList(network *net.Network, application, entity string) ([]models.PolicySummary, error) { - url := fmt.Sprintf("/v1/applications/%s/entities/%s/policies", application, entity) - var policyList []models.PolicySummary - body, err := network.SendGetRequest(url) - if err != nil { - return policyList, err - } - - err = json.Unmarshal(body, &policyList) - return policyList, err -} - -func PolicyStatus(network *net.Network, application, entity, policy string) (string, error) { - url := fmt.Sprintf("/v1/applications/%s/entities/%s/policies/%s", application, entity, policy) - body, err := network.SendGetRequest(url) - if nil != err { - return "", err - } - return string(body), nil -} - -func CurrentState(network *net.Network, application, entity string) (string, error) { - url := fmt.Sprintf("/v1/applications/%s/entities/%s/policies/current-state", application, entity) - body, err := network.SendGetRequest(url) - if nil != err { - return "", err - } - return string(body), nil -} - -func StartPolicy(network *net.Network, application, entity, policy string) (string, error) { - url := fmt.Sprintf("/v1/applications/%s/entities/%s/policies/%s/start", application, entity, policy) - body, err := network.SendEmptyPostRequest(url) - if nil != err { - return "", err - } - return string(body), nil -} - -func StopPolicy(network *net.Network, application, entity, policy string) (string, error) { - url := fmt.Sprintf("/v1/applications/%s/entities/%s/policies/%s/stop", application, entity, policy) - body, err := network.SendEmptyPostRequest(url) - if nil != err { - return "", err - } - return string(body), nil -} - -func DestroyPolicy(network *net.Network, application, entity, policy string) (string, error) { - url := fmt.Sprintf("/v1/applications/%s/entities/%s/policies/%s/destroy", application, entity, policy) - body, err := network.SendEmptyPostRequest(url) - if nil != err { - return "", err - } - return string(body), nil -} http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/81853355/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/api/entity_policy_config/config.go ---------------------------------------------------------------------- diff --git a/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/api/entity_policy_config/config.go b/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/api/entity_policy_config/config.go deleted file mode 100644 index 27cadd9..0000000 --- a/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/api/entity_policy_config/config.go +++ /dev/null @@ -1,47 +0,0 @@ -package entity_policy_config - -import ( - "encoding/json" - "fmt" - "github.com/apache/brooklyn-client/models" - "github.com/apache/brooklyn-client/net" -) - -func CurrentState(network *net.Network, application, entity, policy string) (string, error) { - url := fmt.Sprintf("/v1/applications/%s/entities/%s/policies/%s/config/current-state", application, entity, policy) - body, err := network.SendGetRequest(url) - if nil != err { - return "", err - } - return string(body), nil -} - -func GetConfigValue(network *net.Network, application, entity, policy, config string) (string, error) { - url := fmt.Sprintf("/v1/applications/%s/entities/%s/policies/%s/config/%s", application, entity, policy, config) - body, err := network.SendGetRequest(url) - if nil != err { - return "", err - } - return string(body), nil -} - -// WIP -func SetConfigValue(network *net.Network, application, entity, policy, config string) (string, error) { - url := fmt.Sprintf("/v1/applications/%s/entities/%s/policies/%s/config/%s", application, entity, policy, config) - body, err := network.SendEmptyPostRequest(url) - if nil != err { - return "", err - } - return string(body), nil -} - -func GetAllConfigValues(network *net.Network, application, entity, policy string) ([]models.PolicyConfigList, error) { - url := fmt.Sprintf("/v1/applications/%s/entities/%s/policies/%s/config", application, entity, policy) - var policyConfigList []models.PolicyConfigList - body, err := network.SendGetRequest(url) - if nil != err { - return policyConfigList, err - } - err = json.Unmarshal(body, &policyConfigList) - return policyConfigList, err -} http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/81853355/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/api/entity_sensors/sensors.go ---------------------------------------------------------------------- diff --git a/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/api/entity_sensors/sensors.go b/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/api/entity_sensors/sensors.go deleted file mode 100644 index 2589898..0000000 --- a/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/api/entity_sensors/sensors.go +++ /dev/null @@ -1,80 +0,0 @@ -package entity_sensors - -import ( - "encoding/json" - "fmt" - "github.com/apache/brooklyn-client/models" - "github.com/apache/brooklyn-client/net" -) - -func SensorValue(network *net.Network, application, entity, sensor string) (interface{}, error) { - url := fmt.Sprintf("/v1/applications/%s/entities/%s/sensors/%s", application, entity, sensor) - body, err := network.SendGetRequest(url) - if nil != err || 0 == len(body) { - return nil, err - } - - var value interface{} - err = json.Unmarshal(body, &value) - if nil != err { - return nil, err - } - - return value, nil -} - -// WIP -func DeleteSensor(network *net.Network, application, entity, sensor string) (string, error) { - url := fmt.Sprintf("/v1/applications/%s/entities/%s/sensors/%s", application, entity, sensor) - body, err := network.SendDeleteRequest(url) - if nil != err { - return "", err - } - return string(body), nil -} - -// WIP -//func SetSensor(network *net.Network, application, entity, sensor string) string { -// url := fmt.Sprintf("/v1/applications/%s/entities/%s/sensors/%s", application, entity, sensor) -// body, err := network.SendPostRequest(url) -// if err != nil { -// error_handler.ErrorExit(err) -// } - -// return string(body) -//} - -// WIP -//func SetSensors(network *net.Network, application, entity, sensor string) string { -// url := fmt.Sprintf("/v1/applications/%s/entities/%s/sensors", application, entity, sensor) -// body, err := network.SendPostRequest(url) -// if err != nil { -// error_handler.ErrorExit(err) -// } - -// return string(body) -//} - -func SensorList(network *net.Network, application, entity string) ([]models.SensorSummary, error) { - url := fmt.Sprintf("/v1/applications/%s/entities/%s/sensors", application, entity) - body, err := network.SendGetRequest(url) - var sensorList []models.SensorSummary - if err != nil { - return sensorList, err - } - - err = json.Unmarshal(body, &sensorList) - return sensorList, err -} - -func CurrentState(network *net.Network, application, entity string) (map[string]interface{}, error) { - url := fmt.Sprintf("/v1/applications/%s/entities/%s/sensors/current-state", application, entity) - var currentState map[string]interface{} - body, err := network.SendGetRequest(url) - if err != nil { - return currentState, err - } - - err = json.Unmarshal(body, ¤tState) - return currentState, err -} http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/81853355/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/api/locations/locations.go ---------------------------------------------------------------------- diff --git a/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/api/locations/locations.go b/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/api/locations/locations.go deleted file mode 100644 index d0e7e21..0000000 --- a/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/api/locations/locations.go +++ /dev/null @@ -1,59 +0,0 @@ -package locations - -import ( - "encoding/json" - "fmt" - "github.com/apache/brooklyn-client/models" - "github.com/apache/brooklyn-client/net" -) - -func LocatedLocations(network *net.Network) (string, error) { - url := "/v1/locations/usage/LocatedLocations" - body, err := network.SendGetRequest(url) - if err != nil { - return "", err - } - return string(body), nil -} - -func GetLocation(network *net.Network, locationId string) (models.LocationSummary, error) { - url := fmt.Sprintf("/v1/locations/%s", locationId) - var locationDetail models.LocationSummary - body, err := network.SendGetRequest(url) - if err != nil { - return locationDetail, err - } - err = json.Unmarshal(body, &locationDetail) - return locationDetail, err -} - -func DeleteLocation(network *net.Network, locationId string) (string, error) { - url := fmt.Sprintf("/v1/locations/%s", locationId) - body, err := network.SendDeleteRequest(url) - if err != nil { - return "", err - } - return string(body), nil -} - -// WIP -func CreateLocation(network *net.Network, locationId string) (string, error) { - url := fmt.Sprintf("/v1/locations", locationId) - body, err := network.SendEmptyPostRequest(url) - if err != nil { - return "", err - } - return string(body), nil -} - -func LocationList(network *net.Network) ([]models.LocationSummary, error) { - url := "/v1/locations" - var locationList []models.LocationSummary - body, err := network.SendGetRequest(url) - if err != nil { - return locationList, err - } - - err = json.Unmarshal(body, &locationList) - return locationList, err -} http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/81853355/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/api/version/version.go ---------------------------------------------------------------------- diff --git a/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/api/version/version.go b/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/api/version/version.go deleted file mode 100644 index 1cb3757..0000000 --- a/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/api/version/version.go +++ /dev/null @@ -1,18 +0,0 @@ -package version - -import ( - "encoding/json" - "github.com/apache/brooklyn-client/models" - "github.com/apache/brooklyn-client/net" -) - -func Version(network *net.Network) (models.VersionSummary, error) { - url := "/v1/server/version" - var versionSummary models.VersionSummary - body, err := network.SendGetRequest(url) - if err != nil { - return versionSummary, err - } - err = json.Unmarshal(body, &versionSummary) - return versionSummary, err -} http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/81853355/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/app/app.go ---------------------------------------------------------------------- diff --git a/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/app/app.go b/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/app/app.go deleted file mode 100644 index 84d258b..0000000 --- a/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/app/app.go +++ /dev/null @@ -1,145 +0,0 @@ -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/codegangsta/cli" - "os" - "strings" -) - -type configDefaults struct { - Name string - HelpName string - Usage string - Version string -} - -var appConfig = configDefaults{ - Name: os.Args[0], - HelpName: os.Args[0], - Usage: "A Brooklyn command line client application", - Version: "0.9.0", -} - -func NewApp(baseName string, cmdRunner command_runner.Runner, metadatas ...command_metadata.CommandMetadata) (app *cli.App) { - - cli.AppHelpTemplate = appHelpTemplate() - cli.CommandHelpTemplate = commandHelpTemplate() - app = cli.NewApp() - app.Name = appConfig.Name - app.HelpName = appConfig.HelpName - app.Usage = appConfig.Usage - app.Version = appConfig.Version - - app.Commands = []cli.Command{} - - for _, metadata := range metadatas { - primaryCommand := getCommand(baseName, metadata, cmdRunner) - app.Commands = append(app.Commands, primaryCommand) - } - return -} - -func getCommand(baseName string, metadata command_metadata.CommandMetadata, runner command_runner.Runner) cli.Command { - command := cli.Command{ - Name: metadata.Name, - Aliases: metadata.Aliases, - ShortName: metadata.ShortName, - Description: metadata.Description, - Usage: strings.Replace(metadata.Usage, "BROOKLYN_NAME", baseName, -1), - Action: func(context *cli.Context) { - err := runner.RunCmdByName(metadata.Name, context) - if err != nil { - error_handler.ErrorExit(err) - } - }, - Flags: metadata.Flags, - SkipFlagParsing: metadata.SkipFlagParsing, - } - - if nil != metadata.Operands { - command.Subcommands = make([]cli.Command, 0) - for _, operand := range metadata.Operands { - command.Subcommands = append(command.Subcommands, cli.Command{ - Name: operand.Name, - Aliases: operand.Aliases, - ShortName: operand.ShortName, - Description: operand.Description, - Usage: operand.Usage, - Flags: operand.Flags, - SkipFlagParsing: operand.SkipFlagParsing, - Action: subCommandAction(command.Name, operand.Name, runner), - }) - command.Usage = strings.Join([]string{ - command.Usage, "\n... ", operand.Usage, "\t", operand.Description, - }, "") - } - } - - return command -} - -func subCommandAction(command string, operand string, runner command_runner.Runner) func(context *cli.Context) { - return func(context *cli.Context) { - err := runner.RunSubCmdByName(command, operand, context) - if err != nil { - fmt.Fprintln(os.Stderr, err) - } - } -} - -func appHelpTemplate() string { - return `NAME: - {{.Name}} - {{.Usage}} -USAGE: - {{.Name}} {{if .Flags}}[global options] {{end}}command{{if .Flags}} [command options]{{end}} [arguments...] - -VERSION: - {{.Version}}{{if or .Author .Email}} - -AUTHOR:{{if .Author}} - {{.Author}}{{if .Email}} - <{{.Email}}>{{end}}{{else}} - {{.Email}}{{end}}{{end}} - - -SCOPES: - Many commands require a "scope" expression to indicate the target on which they operate. The scope expressions are - as follows (values in brackets are aliases for the scope): - - application APP-ID (app, a) Selects and application, e.g. "br app myapp" - - entity ENT-ID (ent, e) Selects an entity within an application scope, e.g. "br app myapp ent myserver" - - effector EFF-ID (eff, f) Selects an effector of an entity or application, e.g. "br a myapp e myserver eff xyz" - - config CONF-KEY (conf, con, c) Selects a configuration key of an entity e.g. "br a myapp e myserver config jmx.agent.mode" - - activity ACT-ID (act, v) Selects an activity of an entity e.g. "br a myapp e myserver act iHG7sq1" - - -COMMANDS: - - Commands whose description begins with a "*" character are particularly experimental and likely to change in upcoming - releases. If not otherwise specified, "SCOPE" below means application or entity scope. If an entity scope is not - specified, the application entity is used as a default. - - {{range .Commands}}{{.Name}}{{with .ShortName}}, {{.}}{{end}}{{ "\t" }}{{.Description}} - {{end}}{{if .Flags}} -GLOBAL OPTIONS: - {{range .Flags}}{{.}} - {{end}}{{end}} -` -} - -func commandHelpTemplate() string { - return `NAME: - {{.Name}} - {{.Description}} -{{with .ShortName}} -ALIAS: - {{.}} -{{end}} -USAGE: - {{.Usage}}{{with .Flags}} -OPTIONS: -{{range .}} {{.}} -{{end}}{{else}} -{{end}}` -} http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/81853355/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/command/command.go ---------------------------------------------------------------------- diff --git a/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/command/command.go b/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/command/command.go deleted file mode 100644 index 8a8cc1e..0000000 --- a/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/command/command.go +++ /dev/null @@ -1,12 +0,0 @@ -package command - -import ( - "github.com/apache/brooklyn-client/command_metadata" - "github.com/apache/brooklyn-client/scope" - "github.com/codegangsta/cli" -) - -type Command interface { - Metadata() command_metadata.CommandMetadata - Run(scope scope.Scope, context *cli.Context) -} http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/81853355/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/command/supercommand.go ---------------------------------------------------------------------- diff --git a/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/command/supercommand.go b/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/command/supercommand.go deleted file mode 100644 index 54008b8..0000000 --- a/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/command/supercommand.go +++ /dev/null @@ -1,12 +0,0 @@ -package command - -// A command with further (sub) commands, like 'git remote', with its 'git remote add' etc. -type SuperCommand interface { - Command - - // Get the sub command wih the given name - SubCommand(name string) Command - - // Get the names of all subcommands - SubCommandNames() []string -} http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/81853355/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/command_factory/factory.go ---------------------------------------------------------------------- diff --git a/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/command_factory/factory.go b/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/command_factory/factory.go deleted file mode 100644 index 5fd3da8..0000000 --- a/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/command_factory/factory.go +++ /dev/null @@ -1,123 +0,0 @@ -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" - "sort" - "strings" -) - -type Factory interface { - GetByCmdName(cmdName string) (cmd command.Command, err error) - GetBySubCmdName(cmdName string, subCmdName string) (cmd command.Command, err error) - CommandMetadatas() []command_metadata.CommandMetadata -} - -type concreteFactory struct { - cmdsByName map[string]command.Command - subCommands map[string]map[string]command.Command -} - -func NewFactory(network *net.Network, config *io.Config) (factory concreteFactory) { - factory.cmdsByName = make(map[string]command.Command) - factory.subCommands = make(map[string]map[string]command.Command) - - factory.simpleCommand(commands.NewAccess(network)) - //factory.command(commands.NewActivities(network)) - factory.simpleCommand(commands.NewActivity(network)) - factory.simpleCommand(commands.NewActivityStreamEnv(network)) - 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)) - factory.simpleCommand(commands.NewCatalog(network)) - factory.simpleCommand(commands.NewConfig(network)) - factory.simpleCommand(commands.NewDeploy(network)) - factory.simpleCommand(commands.NewDelete(network)) - factory.simpleCommand(commands.NewDestroyPolicy(network)) - factory.simpleCommand(commands.NewEffector(network)) - factory.simpleCommand(commands.NewEntity(network)) - factory.simpleCommand(commands.NewInvoke(network)) - factory.simpleCommand(commands.NewInvokeRestart(network)) - factory.simpleCommand(commands.NewInvokeStart(network)) - factory.simpleCommand(commands.NewInvokeStop(network)) - // NewList below is not used but we retain the code as an example of how to do a super command. - // factory.superCommand(commands.NewList(network)) - factory.simpleCommand(commands.NewLocations(network)) - factory.simpleCommand(commands.NewLogin(network, config)) - factory.simpleCommand(commands.NewPolicy(network)) - factory.simpleCommand(commands.NewRename(network)) - factory.simpleCommand(commands.NewSensor(network)) - factory.simpleCommand(commands.NewSetConfig(network)) - factory.simpleCommand(commands.NewSpec(network)) - factory.simpleCommand(commands.NewStartPolicy(network)) - factory.simpleCommand(commands.NewStopPolicy(network)) - factory.simpleCommand(commands.NewTree(network)) - factory.simpleCommand(commands.NewVersion(network)) - - return factory -} - -func (factory *concreteFactory) simpleCommand(cmd command.Command) { - factory.cmdsByName[cmd.Metadata().Name] = cmd -} - -func (factory *concreteFactory) superCommand(cmd command.SuperCommand) { - - factory.simpleCommand(cmd) - - if nil == factory.subCommands[cmd.Metadata().Name] { - factory.subCommands[cmd.Metadata().Name] = make(map[string]command.Command) - } - - for _, sub := range cmd.SubCommandNames() { - factory.subCommands[cmd.Metadata().Name][sub] = cmd.SubCommand(sub) - } -} - -func (f concreteFactory) GetByCmdName(cmdName string) (cmd command.Command, err error) { - cmd, found := f.cmdsByName[cmdName] - if !found { - for _, c := range f.cmdsByName { - if c.Metadata().ShortName == cmdName { - return c, nil - } - } - - err = errors.New(strings.Join([]string{"Command not found:", cmdName}, " ")) - } - return -} - -func (f concreteFactory) GetBySubCmdName(cmdName string, subCmdName string) (cmd command.Command, err error) { - - _, hasPrimary := f.subCommands[cmdName] - if hasPrimary { - cmd, found := f.subCommands[cmdName][subCmdName] - if found { - return cmd, nil - } - } - return cmd, errors.New(strings.Join([]string{"Command not found:", cmdName, subCmdName}, " ")) -} - -func (factory concreteFactory) CommandMetadatas() (commands []command_metadata.CommandMetadata) { - keys := make([]string, 0, len(factory.cmdsByName)) - for key := range factory.cmdsByName { - keys = append(keys, key) - } - sort.Strings(keys) - - for _, key := range keys { - command := factory.cmdsByName[key] - commands = append(commands, command.Metadata()) - } - return -} http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/81853355/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/command_metadata/command_metadata.go ---------------------------------------------------------------------- diff --git a/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/command_metadata/command_metadata.go b/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/command_metadata/command_metadata.go deleted file mode 100644 index aa8a43e..0000000 --- a/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/command_metadata/command_metadata.go +++ /dev/null @@ -1,15 +0,0 @@ -package command_metadata - -import "github.com/codegangsta/cli" - -type CommandMetadata struct { - Name string - Aliases []string - ShortName string - Usage string - Description string - Flags []cli.Flag - SkipFlagParsing bool - TotalArgs int //Optional: number of required arguments to skip for flag verification - Operands []CommandMetadata -} http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/81853355/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/command_runner/runner.go ---------------------------------------------------------------------- diff --git a/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/command_runner/runner.go b/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/command_runner/runner.go deleted file mode 100644 index 9e8b058..0000000 --- a/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/command_runner/runner.go +++ /dev/null @@ -1,43 +0,0 @@ -package command_runner - -import ( - "github.com/apache/brooklyn-client/command_factory" - "github.com/apache/brooklyn-client/scope" - "github.com/codegangsta/cli" -) - -type Runner interface { - RunCmdByName(cmdName string, c *cli.Context) (err error) - RunSubCmdByName(cmdName string, subCommand string, c *cli.Context) (err error) -} - -type ConcreteRunner struct { - cmdFactory command_factory.Factory - scope scope.Scope -} - -func NewRunner(scope scope.Scope, cmdFactory command_factory.Factory) (runner ConcreteRunner) { - runner.cmdFactory = cmdFactory - runner.scope = scope - return -} - -func (runner ConcreteRunner) RunCmdByName(cmdName string, c *cli.Context) error { - cmd, err := runner.cmdFactory.GetByCmdName(cmdName) - if nil != err { - return err - } - - cmd.Run(runner.scope, c) - return nil -} - -func (runner ConcreteRunner) RunSubCmdByName(cmdName string, subCommand string, c *cli.Context) error { - cmd, err := runner.cmdFactory.GetBySubCmdName(cmdName, subCommand) - if nil != err { - return err - } - - cmd.Run(runner.scope, c) - return nil -} http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/81853355/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/commands/access.go ---------------------------------------------------------------------- diff --git a/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/commands/access.go b/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/commands/access.go deleted file mode 100644 index 7aa733f..0000000 --- a/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/commands/access.go +++ /dev/null @@ -1,41 +0,0 @@ -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/codegangsta/cli" -) - -type Access struct { - network *net.Network -} - -func NewAccess(network *net.Network) (cmd *Access) { - cmd = new(Access) - cmd.network = network - return -} - -func (cmd *Access) Metadata() command_metadata.CommandMetadata { - return command_metadata.CommandMetadata{ - Name: "access", - Description: "Show access control", - Usage: "BROOKLYN_NAME access", - Flags: []cli.Flag{}, - } -} - -func (cmd *Access) Run(scope scope.Scope, c *cli.Context) { - if err := net.VerifyLoginURL(cmd.network); err != nil { - error_handler.ErrorExit(err) - } - access, err := access_control.Access(cmd.network) - if nil != err { - error_handler.ErrorExit(err) - } - fmt.Println("Location Provisioning Allowed:", access.LocationProvisioningAllowed) -} http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/81853355/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 72a7bd7..0000000 --- a/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/commands/activity-stream.go +++ /dev/null @@ -1,131 +0,0 @@ -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/81853355/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 9ce18b3..0000000 --- a/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/commands/activity.go +++ /dev/null @@ -1,144 +0,0 @@ -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/81853355/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 abd4404..0000000 --- a/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/commands/add-catalog.go +++ /dev/null @@ -1,41 +0,0 @@ -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/81853355/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 5aa1965..0000000 --- a/br/Godeps/_workspace/src/github.com/apache/brooklyn-client/commands/add-children.go +++ /dev/null @@ -1,45 +0,0 @@ -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() -}