Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id E63E2200B90 for ; Sat, 10 Sep 2016 19:14:42 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id E4F18160AD2; Sat, 10 Sep 2016 17:14:42 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 4AFD9160AD9 for ; Sat, 10 Sep 2016 19:14:40 +0200 (CEST) Received: (qmail 22891 invoked by uid 500); 10 Sep 2016 17:14:39 -0000 Mailing-List: contact commits-help@brooklyn.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@brooklyn.apache.org Delivered-To: mailing list commits@brooklyn.apache.org Received: (qmail 22678 invoked by uid 99); 10 Sep 2016 17:14:39 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 10 Sep 2016 17:14:39 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id EF4EBEF7C4; Sat, 10 Sep 2016 17:14:38 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: andreaturli@apache.org To: commits@brooklyn.apache.org Date: Sat, 10 Sep 2016 17:14:46 -0000 Message-Id: <23b9b8e822974c9dbcaef322043d9773@git.apache.org> In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [09/10] brooklyn-client git commit: move rest-client to brooklyn-client archived-at: Sat, 10 Sep 2016 17:14:43 -0000 move rest-client to brooklyn-client update brooklyn-client/cli/README.md Project: http://git-wip-us.apache.org/repos/asf/brooklyn-client/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-client/commit/4122cfe1 Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-client/tree/4122cfe1 Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-client/diff/4122cfe1 Branch: refs/heads/master Commit: 4122cfe1183340e5417c3e02ad56388811184641 Parents: a191255 Author: Andrea Turli Authored: Wed Sep 7 18:07:07 2016 +0200 Committer: Andrea Turli Committed: Sat Sep 10 19:10:40 2016 +0200 ---------------------------------------------------------------------- .gitignore | 5 +- LICENSE | 445 ------------ NOTICE | 5 - README.md | 118 --- api/access_control/access_control.go | 48 -- api/activities/activities.go | 59 -- api/application/applications.go | 141 ---- api/catalog/catalog.go | 233 ------ api/entities/entities.go | 183 ----- api/entity_config/config.go | 94 --- api/entity_effectors/effectors.go | 62 -- api/entity_policies/policies.go | 104 --- api/entity_policy_config/config.go | 65 -- api/entity_sensors/sensors.go | 98 --- api/locations/locations.go | 77 -- api/server/server.go | 190 ----- api/usage/usage.go | 62 -- api/version/version.go | 36 - app/app.go | 170 ----- br/brooklyn.go | 65 -- build.xml | 59 -- cli/LICENSE | 445 ++++++++++++ cli/NOTICE | 5 + cli/README.md | 118 +++ cli/api/access_control/access_control.go | 48 ++ cli/api/activities/activities.go | 59 ++ cli/api/application/applications.go | 141 ++++ cli/api/catalog/catalog.go | 233 ++++++ cli/api/entities/entities.go | 183 +++++ cli/api/entity_config/config.go | 94 +++ cli/api/entity_effectors/effectors.go | 62 ++ cli/api/entity_policies/policies.go | 104 +++ cli/api/entity_policy_config/config.go | 65 ++ cli/api/entity_sensors/sensors.go | 98 +++ cli/api/locations/locations.go | 77 ++ cli/api/server/server.go | 190 +++++ cli/api/usage/usage.go | 62 ++ cli/api/version/version.go | 36 + cli/app/app.go | 170 +++++ cli/br/brooklyn.go | 65 ++ cli/build.xml | 59 ++ cli/command/command.go | 30 + cli/command/supercommand.go | 30 + cli/command_factory/factory.go | 141 ++++ cli/command_metadata/command_metadata.go | 33 + cli/command_runner/runner.go | 61 ++ cli/commands/access.go | 59 ++ cli/commands/activity-stream.go | 149 ++++ cli/commands/activity.go | 162 +++++ cli/commands/add-catalog.go | 59 ++ cli/commands/add-children.go | 63 ++ cli/commands/add-location.go | 33 + cli/commands/add-policy.go | 50 ++ cli/commands/application.go | 111 +++ cli/commands/catalog-applications.go | 33 + cli/commands/catalog-entities.go | 33 + cli/commands/catalog-entity.go | 33 + cli/commands/catalog-location.go | 33 + cli/commands/catalog-locations.go | 33 + cli/commands/catalog-policies.go | 33 + cli/commands/catalog-policy.go | 33 + cli/commands/catalog.go | 63 ++ cli/commands/config.go | 78 ++ cli/commands/delete-catalog-application.go | 33 + cli/commands/delete-catalog-entity.go | 33 + cli/commands/delete-catalog-policy.go | 33 + cli/commands/delete.go | 59 ++ cli/commands/deploy.go | 85 +++ cli/commands/destroy-policy.go | 59 ++ cli/commands/effector.go | 70 ++ cli/commands/entity.go | 127 ++++ cli/commands/invoke.go | 203 ++++++ cli/commands/list.go | 90 +++ cli/commands/locations.go | 63 ++ cli/commands/login.go | 113 +++ cli/commands/policy.go | 114 +++ cli/commands/rename.go | 59 ++ cli/commands/reset-catalog.go | 33 + cli/commands/sensor.go | 118 +++ cli/commands/set.go | 59 ++ cli/commands/spec.go | 59 ++ cli/commands/start-policy.go | 59 ++ cli/commands/stop-policy.go | 59 ++ cli/commands/tree.go | 78 ++ cli/commands/utils.go | 38 + cli/commands/version.go | 59 ++ cli/error_handler/error.go | 46 ++ cli/glide.lock | 10 + cli/glide.yaml | 6 + cli/io/config.go | 72 ++ cli/models/access.go | 24 + cli/models/applications.go | 97 +++ cli/models/catalog.go | 63 ++ cli/models/config.go | 31 + cli/models/effectors.go | 34 + cli/models/entities.go | 27 + cli/models/locations.go | 28 + cli/models/policies.go | 39 + cli/models/sensors.go | 26 + cli/models/version.go | 34 + cli/net/net.go | 211 ++++++ cli/pom.xml | 132 ++++ cli/release/assembly.xml | 43 ++ cli/release/build.bat | 24 + cli/release/build.sh | 283 ++++++++ cli/release/files/README | 42 ++ cli/release/license/files/LICENSE | 445 ++++++++++++ cli/release/license/source-inclusions.yaml | 24 + cli/scope/scope.go | 137 ++++ cli/terminal/table.go | 102 +++ cli/test/test.sh | 226 ++++++ cli/test/test_app.yaml | 22 + command/command.go | 30 - command/supercommand.go | 30 - command_factory/factory.go | 141 ---- command_metadata/command_metadata.go | 33 - command_runner/runner.go | 61 -- commands/access.go | 59 -- commands/activity-stream.go | 149 ---- commands/activity.go | 162 ----- commands/add-catalog.go | 59 -- commands/add-children.go | 63 -- commands/add-location.go | 33 - commands/add-policy.go | 50 -- commands/application.go | 111 --- commands/catalog-applications.go | 33 - commands/catalog-entities.go | 33 - commands/catalog-entity.go | 33 - commands/catalog-location.go | 33 - commands/catalog-locations.go | 33 - commands/catalog-policies.go | 33 - commands/catalog-policy.go | 33 - commands/catalog.go | 63 -- commands/config.go | 78 -- commands/delete-catalog-application.go | 33 - commands/delete-catalog-entity.go | 33 - commands/delete-catalog-policy.go | 33 - commands/delete.go | 59 -- commands/deploy.go | 85 --- commands/destroy-policy.go | 59 -- commands/effector.go | 70 -- commands/entity.go | 127 ---- commands/invoke.go | 203 ------ commands/list.go | 90 --- commands/locations.go | 63 -- commands/login.go | 113 --- commands/policy.go | 114 --- commands/rename.go | 59 -- commands/reset-catalog.go | 33 - commands/sensor.go | 118 --- commands/set.go | 59 -- commands/spec.go | 59 -- commands/start-policy.go | 59 -- commands/stop-policy.go | 59 -- commands/tree.go | 78 -- commands/utils.go | 38 - commands/version.go | 59 -- error_handler/error.go | 46 -- glide.lock | 10 - glide.yaml | 6 - io/config.go | 72 -- java/pom.xml | 719 +++++++++++++++++++ .../brooklyn/rest/client/BrooklynApi.java | 419 +++++++++++ .../brooklyn/rest/client/BrooklynApiUtil.java | 154 ++++ .../util/http/BuiltResponsePreservingError.java | 79 ++ .../ApplicationResourceIntegrationTest.java | 190 +++++ .../rest/client/BrooklynApiRestClientTest.java | 163 +++++ .../rest/client/BrooklynApiUtilTest.java | 129 ++++ .../src/test/resources/catalog/test-catalog.bom | 33 + java/src/test/webapp/WEB-INF/web.xml | 129 ++++ models/access.go | 24 - models/applications.go | 97 --- models/catalog.go | 63 -- models/config.go | 31 - models/effectors.go | 34 - models/entities.go | 27 - models/locations.go | 28 - models/policies.go | 39 - models/sensors.go | 26 - models/version.go | 34 - net/net.go | 211 ------ pom.xml | 538 +++++++++++--- release/assembly.xml | 43 -- release/build.bat | 24 - release/build.sh | 283 -------- release/files/README | 42 -- release/license/files/LICENSE | 445 ------------ release/license/source-inclusions.yaml | 24 - scope/scope.go | 137 ---- terminal/table.go | 102 --- test/test.sh | 226 ------ test/test_app.yaml | 22 - 192 files changed, 10064 insertions(+), 7558 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/4122cfe1/.gitignore ---------------------------------------------------------------------- diff --git a/.gitignore b/.gitignore index 08d4901..6dacd7f 100644 --- a/.gitignore +++ b/.gitignore @@ -8,4 +8,7 @@ target .classpath .settings/ .metadata/ -vendor/ \ No newline at end of file +vendor/ + +*.log +brooklyn*.log.* http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/4122cfe1/LICENSE ---------------------------------------------------------------------- diff --git a/LICENSE b/LICENSE deleted file mode 100644 index 9764158..0000000 --- a/LICENSE +++ /dev/null @@ -1,445 +0,0 @@ - -This software is distributed under the Apache License, version 2.0. See (1) below. -This software is copyright (c) The Apache Software Foundation and contributors. - -Contents: - - (1) This software license: Apache License, version 2.0 - (2) Notices for bundled software - (3) Licenses for bundled software - - ---------------------------------------------------- - -(1) This software license: Apache License, version 2.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. - - ---------------------------------------------------- - -(2) Notices for bundled software - -This project includes the software: github.com/urfave/cli - Available at: https://github.com/urfave/cli - Used under the following license: The MIT License (http://opensource.org/licenses/MIT) - Copyright (C) 2013 Jeremy Saenz - -This project includes the software: golang.org/x/crypto/ssh - Available at: https://godoc.org/golang.org/x/crypto/ssh - Used under the following license: The BSD 3-Clause (New BSD) License (http://opensource.org/licenses/BSD-3-Clause) - Copyright (c) 2009 The Go Authors. All rights reserved. - - ---------------------------------------------------- - -(3) Licenses for bundled software - -Contents: - - Apache License, Version 2.0 - The BSD 3-Clause License ("New BSD") - The MIT License ("MIT") - - -Apache License, Version 2.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. - - -The BSD 3-Clause License ("New BSD") - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - 3. Neither the name of the copyright holder nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - - -The MIT License ("MIT") - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - THE SOFTWARE. - - http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/4122cfe1/NOTICE ---------------------------------------------------------------------- diff --git a/NOTICE b/NOTICE deleted file mode 100644 index 6d1f608..0000000 --- a/NOTICE +++ /dev/null @@ -1,5 +0,0 @@ -Apache Brooklyn -Copyright 2014-2016 The Apache Software Foundation - -This product includes software developed at -The Apache Software Foundation (http://www.apache.org/). http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/4122cfe1/README.md ---------------------------------------------------------------------- diff --git a/README.md b/README.md deleted file mode 100644 index e45eacb..0000000 --- a/README.md +++ /dev/null @@ -1,118 +0,0 @@ - -# [![**Brooklyn**](https://brooklyn.apache.org/style/img/apache-brooklyn-logo-244px-wide.png)](http://brooklyn.apache.org/) - -### Apache Brooklyn Client CLI - -A command line client for [Apache Brooklyn](https://brooklyn.apache.org). - -## Toolchain - -The CLI tool is written in Go and should be obtained and built as a standard Go project. -You will need the following tools to build it: - -- Go (version 1.6.1 or higher), with full cross-compiler support (see https://golang.org/dl). - On Mac, if using Homebrew, use "brew install go --with-cc-all" - -Optional: -- Maven (used by the Brooklyn build process) - -- Maven (see note below on the Brooklyn build process) - - -## Workspace Setup - -Go is very particular about the layout of a source tree, and the naming of packages. It is therefore important to -get the code from github.com/apache/brooklyn-client and not your own fork. If you want to contribute to the -project, the procedure to follow is still to get the code from github.com/apache/brooklyn-client, and then to add your -own fork as a remote. - -- Ensure your [$GOPATH](http://golang.org/cmd/go/#hdr-GOPATH_environment_variable) is set correctly - to a suitable location for your Go code, for example, simply $HOME/go. -- Get the Brooklyn CLI and dependencies. - -```bash -go get github.com/apache/brooklyn-client/br -``` - - -## Installing Dependencies - -The CLI has a small number of dependencies, notably on `urfave/cli`. To manage the version of dependencies, the CLI -code currently uses [Glide](https://github.com/Masterminds/glide). The dependencies are installed to the top level 'vendor' directory. - -```bash -go get github.com/Masterminds/glide -cd $GOPATH/src/github.com/apache/brooklyn-client -glide install -``` - -## Compiling the code with Go for development purposes - -Just use the regular Go build commands. - - -## Testing - -The code includes a test script in the [test](test) directory. This deploys a Tomcat server on a location of your choice -and runs a number of tests against it, to verify that the br commands perform as expected. To use this you must edit -the file "test_app.yaml" to change the location to your own value, and then invoke the test script like the following, -where the username and password need only be supplied if Brooklyn requires them: - -```bash -sh test.sh http://your-brooklyn-host:8081 myuser mypassword -``` - -Note, the tests are not yet comprehensive, and contributions are welcome. - -## Building the code as part of the Brooklyn build process - -For consistency with the other sub-projects of the overall [Brooklyn](https://github.com/apache/brooklyn) build, Maven -is used to perform the build when brooklyn-client is built as one of the sub-modules of Brooklyn. Most of the work is -delegated to the release/build.sh script, which cross-compiles the code for a number of platform-architecture combinations. - -Invoke the build script via Maven with one of - - - ```mvn clean install``` build for all supported platforms - - ```mvn -Dtarget=native clean install``` build for the current platform - - ```mvn -Dtarget=cross -Dos=OS -Darch=ARCH clean install``` build for platform with operating system OS and architecture ARCH - -*NOTE* This does *not* build the code into your usual GOPATH. To allow the project to be checked out along with the -other Brooklyn submodules and built using Maven, without any special treatment to install it into a separate GOPATH -location, the Maven build makes no assumption about the location of the project root directory. Instead, the Maven -`target` directory is used as the GOPATH, and a soft link is created as `target/src/github.com/apache/brooklyn-cli` to -the code in the root directory. - -This builds the requested binaries into the "target" directory, each in its own subdirectory with a name that includes -the platform/architecture details, e.g. bin/linux.386/br. The build installs a maven artifact to the maven repository, -consisting of a zip file containing all the binaries. This artifact can be referenced in a POM as - -```xml -org.apache.brooklyn -brooklyn-client-cli -bin -zip -... -``` - - -## Running - -See instructions in the included [Runtime README](release/files/README) file. - ----- -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. http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/4122cfe1/api/access_control/access_control.go ---------------------------------------------------------------------- diff --git a/api/access_control/access_control.go b/api/access_control/access_control.go deleted file mode 100644 index c68eecf..0000000 --- a/api/access_control/access_control.go +++ /dev/null @@ -1,48 +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 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/4122cfe1/api/activities/activities.go ---------------------------------------------------------------------- diff --git a/api/activities/activities.go b/api/activities/activities.go deleted file mode 100644 index 0364dcb..0000000 --- a/api/activities/activities.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 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/4122cfe1/api/application/applications.go ---------------------------------------------------------------------- diff --git a/api/application/applications.go b/api/application/applications.go deleted file mode 100644 index f46ebac..0000000 --- a/api/application/applications.go +++ /dev/null @@ -1,141 +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 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, resource string) (models.TaskSummary, error) { - url := "/v1/applications" - var response models.TaskSummary - body, err := network.SendPostResourceRequest(url, resource, "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/fetch" - 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/4122cfe1/api/catalog/catalog.go ---------------------------------------------------------------------- diff --git a/api/catalog/catalog.go b/api/catalog/catalog.go deleted file mode 100644 index dd5b75a..0000000 --- a/api/catalog/catalog.go +++ /dev/null @@ -1,233 +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 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, resource string) (string, error) { - url := "/v1/catalog" - body, err := network.SendPostResourceRequest(url, resource, "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/4122cfe1/api/entities/entities.go ---------------------------------------------------------------------- diff --git a/api/entities/entities.go b/api/entities/entities.go deleted file mode 100644 index 90dbb49..0000000 --- a/api/entities/entities.go +++ /dev/null @@ -1,183 +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 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, resource string) (models.TaskSummary, error) { - urlStr := fmt.Sprintf("/v1/applications/%s/entities/%s/children", application, entity) - var response models.TaskSummary - body, err := network.SendPostResourceRequest(urlStr, resource, "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/4122cfe1/api/entity_config/config.go ---------------------------------------------------------------------- diff --git a/api/entity_config/config.go b/api/entity_config/config.go deleted file mode 100644 index 66cd1d5..0000000 --- a/api/entity_config/config.go +++ /dev/null @@ -1,94 +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 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/4122cfe1/api/entity_effectors/effectors.go ---------------------------------------------------------------------- diff --git a/api/entity_effectors/effectors.go b/api/entity_effectors/effectors.go deleted file mode 100644 index 488a5b1..0000000 --- a/api/entity_effectors/effectors.go +++ /dev/null @@ -1,62 +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 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/4122cfe1/api/entity_policies/policies.go ---------------------------------------------------------------------- diff --git a/api/entity_policies/policies.go b/api/entity_policies/policies.go deleted file mode 100644 index d776a05..0000000 --- a/api/entity_policies/policies.go +++ /dev/null @@ -1,104 +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 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/4122cfe1/api/entity_policy_config/config.go ---------------------------------------------------------------------- diff --git a/api/entity_policy_config/config.go b/api/entity_policy_config/config.go deleted file mode 100644 index 0cf40fe..0000000 --- a/api/entity_policy_config/config.go +++ /dev/null @@ -1,65 +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 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/4122cfe1/api/entity_sensors/sensors.go ---------------------------------------------------------------------- diff --git a/api/entity_sensors/sensors.go b/api/entity_sensors/sensors.go deleted file mode 100644 index ddb0d5b..0000000 --- a/api/entity_sensors/sensors.go +++ /dev/null @@ -1,98 +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 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/4122cfe1/api/locations/locations.go ---------------------------------------------------------------------- diff --git a/api/locations/locations.go b/api/locations/locations.go deleted file mode 100644 index 9bbb9b3..0000000 --- a/api/locations/locations.go +++ /dev/null @@ -1,77 +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 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/4122cfe1/api/server/server.go ---------------------------------------------------------------------- diff --git a/api/server/server.go b/api/server/server.go deleted file mode 100644 index a46b705..0000000 --- a/api/server/server.go +++ /dev/null @@ -1,190 +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 server - -import ( - "fmt" - "github.com/apache/brooklyn-client/net" -) - -func Up(network *net.Network) (string, error) { - url := "/v1/server/up" - body, err := network.SendGetRequest(url) - if err != nil { - return "", err - } - return string(body), nil -} - -func Version(network *net.Network) (string, error) { - url := "/v1/server/version" - body, err := network.SendGetRequest(url) - if err != nil { - return "", err - } - return string(body), nil -} - -func GetConfig(network *net.Network, configKey string) (string, error) { - url := fmt.Sprintf("/v1/server/config/%s", configKey) - body, err := network.SendGetRequest(url) - if err != nil { - return "", err - } - return string(body), nil -} - -func Reload(network *net.Network) (string, error) { - url := "/v1/server/properties/reload" - body, err := network.SendEmptyPostRequest(url) - if err != nil { - return "", err - } - return string(body), nil -} - -func Status(network *net.Network) (string, error) { - url := "/v1/server/status" - body, err := network.SendGetRequest(url) - if err != nil { - return "", err - } - return string(body), nil -} - -func User(network *net.Network) (string, error) { - url := "/v1/server/user" - body, err := network.SendGetRequest(url) - if err != nil { - return "", err - } - return string(body), nil -} - -func ShuttingDown(network *net.Network) (string, error) { - url := "/v1/server/shuttingDown" - body, err := network.SendGetRequest(url) - if err != nil { - return "", err - } - return string(body), nil -} - -func Healthy(network *net.Network) (string, error) { - url := "/v1/server/healthy" - body, err := network.SendGetRequest(url) - if err != nil { - return "", err - } - return string(body), nil -} - -func UpExtended(network *net.Network) (string, error) { - url := "/v1/server/up/extended" - body, err := network.SendGetRequest(url) - if err != nil { - return "", err - } - return string(body), nil -} - -func State(network *net.Network) (string, error) { - url := "/v1/server/ha/state" - body, err := network.SendGetRequest(url) - if err != nil { - return "", err - } - return string(body), nil -} - -// WIP -func SetState(network *net.Network) (string, error) { - url := "/v1/server/ha/state" - body, err := network.SendEmptyPostRequest(url) - if err != nil { - return "", err - } - return string(body), nil -} - -func Metrics(network *net.Network) (string, error) { - url := "/v1/server/ha/metrics" - body, err := network.SendGetRequest(url) - if err != nil { - return "", err - } - return string(body), nil -} - -func Priority(network *net.Network) (string, error) { - url := "/v1/server/ha/priority" - body, err := network.SendGetRequest(url) - if err != nil { - return "", err - } - return string(body), nil -} - -// WIP -func SetPriority(network *net.Network) (string, error) { - url := "/v1/server/ha/priority" - body, err := network.SendEmptyPostRequest(url) - if err != nil { - return "", err - } - return string(body), nil -} - -func States(network *net.Network) (string, error) { - url := "/v1/server/ha/states" - body, err := network.SendGetRequest(url) - if err != nil { - return "", nil - } - return string(body) -} - -// WIP -func ClearStates(network *net.Network) (string, error) { - url := "/v1/server/ha/states/clear" - body, err := network.SendEmptyPostRequest(url) - if err != nil { - return "", nil - } - return string(body), nil -} - -func Export(network *net.Network) (string, error) { - url := "/v1/server/ha/persist/export" - body, err := network.SendGetRequest(url) - if err != nil { - return "", nil - } - return string(body), nil -} - -// WIP -func Shutdown(network *net.Network) (string, error) { - url := "/v1/server/shutdown" - body, err := network.SendEmptyPostRequest(url) - if err != nil { - return "", err - } - return string(body), nil -}