diff --git a/.gitignore b/.gitignore index a9ddaa685..db1f55091 100644 --- a/.gitignore +++ b/.gitignore @@ -1,22 +1,22 @@ -*~ -*.iml -.idea/ -.settings/ -.classpath -.project -.settings/ -target/ -bin/logs/ - - -openstack-api/test-output/ -openstack-ui/src/main/webapp/META-INF/ -openstack-ui/src/main/webapp/WEB-INF/deploy/ -openstack-ui/src/main/webapp/WEB-INF/classes/ -openstack-ui/src/main/gwt-unitCache/ -openstack-ui/src/main/webapp/ui/ -openstack-ui/src/main/webapp/WEB-INF/lib/ -openstack-ui/.gwt/ -openstack-ui/deploy.sh -test-output/ +*~ +*.iml +.idea/ +.settings/ +.classpath +.project +.settings/ +target/ +bin/logs/ + + +openstack-api/test-output/ +openstack-ui/src/main/webapp/META-INF/ +openstack-ui/src/main/webapp/WEB-INF/deploy/ +openstack-ui/src/main/webapp/WEB-INF/classes/ +openstack-ui/src/main/gwt-unitCache/ +openstack-ui/src/main/webapp/ui/ +openstack-ui/src/main/webapp/WEB-INF/lib/ +openstack-ui/.gwt/ +openstack-ui/deploy.sh +test-output/ bin \ No newline at end of file diff --git a/.travis.yml b/.travis.yml index f2ad391ed..dee18f982 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,3 +1,3 @@ -language: java - +language: java + install: mvn clean package -DskipTests=true \ No newline at end of file diff --git a/LICENSE.txt b/LICENSE.txt index d64569567..75b52484e 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -1,202 +1,202 @@ - - 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. + + 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. diff --git a/README.textile b/README.textile index ff07ffab2..ee73c947e 100644 --- a/README.textile +++ b/README.textile @@ -1,142 +1,142 @@ -h1. OpenStack Java SDK v2.0 - -h1. Important - -You can continue using the latest source from v1.x essex branch - -h2. Maven - -|groupId|artifactId|version| -|com.woorea|keystone-client|3.0.0-SNAPSHOT| -|com.woorea|nova-client|3.0.0-SNAPSHOT| -|com.woorea|glance-client|3.0.0-SNAPSHOT| -|com.woorea|swift-client|3.0.0-SNAPSHOT| - -h3. Maven Repositories - -https://maven.java.net/content/repositories/snapshots -https://raw.github.com/woorea/maven/master/snapshots - -h1. Available artifacts - -h2. OpenStack Identity Service - -OpenStack Keystone Model - -OpenStack Keystone Client - -
-KeystoneClient keystone = new KeystoneClient(KEYSTONE_AUTH_URL);
-Authentication authentication = new Authentication();
-PasswordCredentials passwordCredentials = new PasswordCredentials();
-passwordCredentials.setUsername(KEYSTONE_USERNAME);
-passwordCredentials.setPassword(KEYSTONE_PASSWORD);
-authentication.setPasswordCredentials(passwordCredentials);
-
-//access with unscoped token
-Access access = keystone.execute(new Authenticate(authentication));
-
-//use the token in the following requests
-keystone.setToken(access.getToken().getId());
-
-Tenants tenants = keystone.execute(new ListTenants());
-
-//try to exchange token using the first tenant
-if(tenants.getList().size() > 0) {
-
- authentication = new Authentication();
- Token token = new Token();
- token.setId(access.getToken().getId());
- authentication.setToken(token);
- authentication.setTenantId(tenants.getList().get(0).getId());
-
- access = keystone.execute(new Authenticate(authentication));
-
- ...
-
-
-h2. OpenStack Compute Service
-
-OpenStack Nova Model
-
-OpenStack Nova Client
-
-
-NovaClient novaClient = new NovaClient(KeystoneUtils.findEndpointURL(access.getServiceCatalog(), "compute", null, "public"), access.getToken().getId());
-
-Servers servers = novaClient.execute(ServersCore.listServers());
-for(Server server : servers) {
- System.out.println(server);
-}
-
-
-h2. OpenStack Image Store Service
-
-OpenStack Glance Model
-
-OpenStack Glance Client
-
-h2. OpenStack Object Store Service
-
-OpenStack Swift Model
-
-OpenStack Swift Client
-
-h2. OpenStack Ceilometer Service
-
-h3. MongoDB Installation
-
-OpenStack Ceilometer Service uses MongoDB as storage.
-
-h3. Ceilometer Compute Agent Installation
-
-OpenStack Ceilometer Compute Agent
-
-This artefact should be installed on each compute node
-
--mvn clean compile assembly:assembly -Properties can be configured in /etc/ceilometer/ceilometer-agent.properties -java -jar ceilometer-compute-agent-jar-with-dependencies.jar -- -h3. Ceilometer Collector Installation - -OpenStack Ceilometer Collector - -
-mvn clean compile assembly:assembly -Properties can be configured in /etc/ceilometer/ceilometer-collector.properties -java -jar ceilometer-collector.jar -- -h3. OpenStack Ceilometer API Installation - -OpenStack Ceilometer API - -
-mvn clean compile assembly:assembly -Properties can be configured in /etc/ceilometer/ceilometer-api.properties -java -jar ceilometer-api.jar --OpenStack Ceilometer Client - -h1. License - -
-This software is licensed under the Apache 2 license, quoted below. - -Copyright 2012 Luis Gervaso and OpenStack Java SDK - -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. +h1. OpenStack Java SDK v2.0 + +h1. Important + +You can continue using the latest source from v1.x essex branch + +h2. Maven + +|groupId|artifactId|version| +|com.woorea|keystone-client|3.0.0-SNAPSHOT| +|com.woorea|nova-client|3.0.0-SNAPSHOT| +|com.woorea|glance-client|3.0.0-SNAPSHOT| +|com.woorea|swift-client|3.0.0-SNAPSHOT| + +h3. Maven Repositories + +https://maven.java.net/content/repositories/snapshots +https://raw.github.com/woorea/maven/master/snapshots + +h1. Available artifacts + +h2. OpenStack Identity Service + +OpenStack Keystone Model + +OpenStack Keystone Client + ++KeystoneClient keystone = new KeystoneClient(KEYSTONE_AUTH_URL); +Authentication authentication = new Authentication(); +PasswordCredentials passwordCredentials = new PasswordCredentials(); +passwordCredentials.setUsername(KEYSTONE_USERNAME); +passwordCredentials.setPassword(KEYSTONE_PASSWORD); +authentication.setPasswordCredentials(passwordCredentials); + +//access with unscoped token +Access access = keystone.execute(new Authenticate(authentication)); + +//use the token in the following requests +keystone.setToken(access.getToken().getId()); + +Tenants tenants = keystone.execute(new ListTenants()); + +//try to exchange token using the first tenant +if(tenants.getList().size() > 0) { + + authentication = new Authentication(); + Token token = new Token(); + token.setId(access.getToken().getId()); + authentication.setToken(token); + authentication.setTenantId(tenants.getList().get(0).getId()); + + access = keystone.execute(new Authenticate(authentication)); + + ... ++ +h2. OpenStack Compute Service + +OpenStack Nova Model + +OpenStack Nova Client + ++NovaClient novaClient = new NovaClient(KeystoneUtils.findEndpointURL(access.getServiceCatalog(), "compute", null, "public"), access.getToken().getId()); + +Servers servers = novaClient.execute(ServersCore.listServers()); +for(Server server : servers) { + System.out.println(server); +} ++ +h2. OpenStack Image Store Service + +OpenStack Glance Model + +OpenStack Glance Client + +h2. OpenStack Object Store Service + +OpenStack Swift Model + +OpenStack Swift Client + +h2. OpenStack Ceilometer Service + +h3. MongoDB Installation + +OpenStack Ceilometer Service uses MongoDB as storage. + +h3. Ceilometer Compute Agent Installation + +OpenStack Ceilometer Compute Agent + +This artefact should be installed on each compute node + ++mvn clean compile assembly:assembly +Properties can be configured in /etc/ceilometer/ceilometer-agent.properties +java -jar ceilometer-compute-agent-jar-with-dependencies.jar ++ +h3. Ceilometer Collector Installation + +OpenStack Ceilometer Collector + ++mvn clean compile assembly:assembly +Properties can be configured in /etc/ceilometer/ceilometer-collector.properties +java -jar ceilometer-collector.jar ++ +h3. OpenStack Ceilometer API Installation + +OpenStack Ceilometer API + ++mvn clean compile assembly:assembly +Properties can be configured in /etc/ceilometer/ceilometer-api.properties +java -jar ceilometer-api.jar ++OpenStack Ceilometer Client + +h1. License + ++This software is licensed under the Apache 2 license, quoted below. + +Copyright 2012 Luis Gervaso and OpenStack Java SDK + +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 diff --git a/bundle.sh b/bundle.sh index bae51557d..abdd172f9 100644 --- a/bundle.sh +++ b/bundle.sh @@ -1,2 +1,2 @@ -#!/bin/sh +#!/bin/sh mvn source:jar javadoc:jar package gpg:sign repository:bundle-create -Dgpg.passphrase=$1 \ No newline at end of file diff --git a/ceilometer-client/pom.xml b/ceilometer-client/pom.xml index f8a9a3fe1..8893fb0ef 100644 --- a/ceilometer-client/pom.xml +++ b/ceilometer-client/pom.xml @@ -1,23 +1,23 @@ -- +4.0.0 -- -com.woorea -openstack-java-sdk -3.2.2-SNAPSHOT -ceilometer-client -OpenStack Ceilometer Client -OpenStack Ceilometer Client -- -- -com.woorea -openstack-client -3.2.2-SNAPSHOT -- -com.woorea -ceilometer-model -3.2.2-SNAPSHOT -+ diff --git a/ceilometer-client/src/main/java/com/woorea/openstack/ceilometer/Ceilometer.java b/ceilometer-client/src/main/java/com/woorea/openstack/ceilometer/Ceilometer.java index 05cda3551..999144b10 100644 --- a/ceilometer-client/src/main/java/com/woorea/openstack/ceilometer/Ceilometer.java +++ b/ceilometer-client/src/main/java/com/woorea/openstack/ceilometer/Ceilometer.java @@ -1,34 +1,34 @@ -package com.woorea.openstack.ceilometer; - - -import com.woorea.openstack.base.client.OpenStackClient; -import com.woorea.openstack.base.client.OpenStackClientConnector; -import com.woorea.openstack.ceilometer.v2.api.MetersResource; -import com.woorea.openstack.ceilometer.v2.api.ResourcesResource; - -public class Ceilometer extends OpenStackClient { - - private final MetersResource METERS; - - private final ResourcesResource RESOURCES; - - public Ceilometer(String endpoint, OpenStackClientConnector connector) { - super(endpoint, connector); - METERS = new MetersResource(this); - RESOURCES = new ResourcesResource(this); - } - - public Ceilometer(String endpoint) { - this(endpoint, null); - - } - - public ResourcesResource resources() { - return RESOURCES; - } - - public MetersResource meters() { - return METERS; - } - -} +package com.woorea.openstack.ceilometer; + + +import com.woorea.openstack.base.client.OpenStackClient; +import com.woorea.openstack.base.client.OpenStackClientConnector; +import com.woorea.openstack.ceilometer.v2.api.MetersResource; +import com.woorea.openstack.ceilometer.v2.api.ResourcesResource; + +public class Ceilometer extends OpenStackClient { + + private final MetersResource METERS; + + private final ResourcesResource RESOURCES; + + public Ceilometer(String endpoint, OpenStackClientConnector connector) { + super(endpoint, connector); + METERS = new MetersResource(this); + RESOURCES = new ResourcesResource(this); + } + + public Ceilometer(String endpoint) { + this(endpoint, null); + + } + + public ResourcesResource resources() { + return RESOURCES; + } + + public MetersResource meters() { + return METERS; + } + +} diff --git a/ceilometer-client/src/main/java/com/woorea/openstack/ceilometer/QueriableCeilometerCommand.java b/ceilometer-client/src/main/java/com/woorea/openstack/ceilometer/QueriableCeilometerCommand.java index 444c052cb..7a27dbeb3 100644 --- a/ceilometer-client/src/main/java/com/woorea/openstack/ceilometer/QueriableCeilometerCommand.java +++ b/ceilometer-client/src/main/java/com/woorea/openstack/ceilometer/QueriableCeilometerCommand.java @@ -1,58 +1,58 @@ -package com.woorea.openstack.ceilometer; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.List; - -import com.woorea.openstack.base.client.OpenStackRequest; - -public abstract class QueriableCeilometerCommand4.0.0 ++ +com.woorea +openstack-java-sdk +3.2.2-SNAPSHOT +ceilometer-client +OpenStack Ceilometer Client +OpenStack Ceilometer Client ++ ++ +com.woorea +openstack-client +3.2.2-SNAPSHOT ++ +com.woorea +ceilometer-model +3.2.2-SNAPSHOT +extends OpenStackRequest { - - protected List fields = new ArrayList (); - - protected List ops = new ArrayList (); - - protected List values = new ArrayList (); - - private T filter(String field, String op, Serializable value) { - fields.add(field); - ops.add(op); - values.add(value); - return (T) this; - } - - public T lt(String field, Serializable value) { - return filter(field, "lt", value); - } - - public T le(String field, Serializable value) { - return filter(field, "le", value); - } - - public T eq(String field, Serializable value) { - return filter(field, "eq", value); - } - - public T ne(String field, Serializable value) { - return filter(field, "ne", value); - } - - public T ge(String field, Serializable value) { - return filter(field, "ge", value); - } - - public T gt(String field, Serializable value) { - return filter(field, "gt", value); - } - - /* - public WebTarget query(WebTarget target) { - if(fields.size() > 0) { - target = target.queryParam("q.field", fields.toArray()); - target = target.queryParam("q.op", ops.toArray()); - target = target.queryParam("q.value", values.toArray()); - } - return target; - } - */ -} +package com.woorea.openstack.ceilometer; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +import com.woorea.openstack.base.client.OpenStackRequest; + +public abstract class QueriableCeilometerCommand extends OpenStackRequest { + + protected List fields = new ArrayList (); + + protected List ops = new ArrayList (); + + protected List values = new ArrayList (); + + private T filter(String field, String op, Serializable value) { + fields.add(field); + ops.add(op); + values.add(value); + return (T) this; + } + + public T lt(String field, Serializable value) { + return filter(field, "lt", value); + } + + public T le(String field, Serializable value) { + return filter(field, "le", value); + } + + public T eq(String field, Serializable value) { + return filter(field, "eq", value); + } + + public T ne(String field, Serializable value) { + return filter(field, "ne", value); + } + + public T ge(String field, Serializable value) { + return filter(field, "ge", value); + } + + public T gt(String field, Serializable value) { + return filter(field, "gt", value); + } + + /* + public WebTarget query(WebTarget target) { + if(fields.size() > 0) { + target = target.queryParam("q.field", fields.toArray()); + target = target.queryParam("q.op", ops.toArray()); + target = target.queryParam("q.value", values.toArray()); + } + return target; + } + */ +} diff --git a/ceilometer-client/src/main/java/com/woorea/openstack/ceilometer/v2/api/MetersResource.java b/ceilometer-client/src/main/java/com/woorea/openstack/ceilometer/v2/api/MetersResource.java index e44dbe649..3841f1703 100644 --- a/ceilometer-client/src/main/java/com/woorea/openstack/ceilometer/v2/api/MetersResource.java +++ b/ceilometer-client/src/main/java/com/woorea/openstack/ceilometer/v2/api/MetersResource.java @@ -1,71 +1,70 @@ -package com.woorea.openstack.ceilometer.v2.api; - - -import com.woorea.openstack.base.client.OpenStackClient; -import com.woorea.openstack.base.client.OpenStackRequest; -import com.woorea.openstack.ceilometer.QueriableCeilometerCommand; -import com.woorea.openstack.ceilometer.v2.model.Sample; - -public class MetersResource { - - private final OpenStackClient CLIENT; - - public MetersResource(OpenStackClient client) { - CLIENT = client; - } - - public List list() { - return new List(); - } - - public Show show() { - return new Show(); - } - - public Statistics statistics() { - return new Statistics(); - } - - public class List extends QueriableCeilometerCommand > { - public List() { - //return query(target.path("meters")).request(MediaType.APPLICATION_JSON).get(new GenericType
>() {}); - } - } - - public class Show extends QueriableCeilometerCommand
> { - - private String name; - - public Show name(String name) { - this.name = name; - return this; - } - - public Show() { -// if(name == null) { -// throw new UnsupportedOperationException("meter id is mandatory"); -// } -// return query(target.path("meters").path(name)).request(MediaType.APPLICATION_JSON).get(new GenericType >() {}); - } - - } - - public class Statistics extends QueriableCeilometerCommand
> { - - private String name; - - public Statistics name(String name) { - this.name = name; - return this; - } - - public Statistics() { -// if(name == null) { -// throw new UnsupportedOperationException("meter id is mandatory"); -// } -// return query(target.path("meters").path(name).path("statistics")).request(MediaType.APPLICATION_JSON).get(new GenericType >(){}); - } - - } - -} +package com.woorea.openstack.ceilometer.v2.api; + + +import com.woorea.openstack.base.client.OpenStackClient; +import com.woorea.openstack.ceilometer.QueriableCeilometerCommand; +import com.woorea.openstack.ceilometer.v2.model.Sample; + +public class MetersResource { + + private final OpenStackClient CLIENT; + + public MetersResource(OpenStackClient client) { + CLIENT = client; + } + + public List list() { + return new List(); + } + + public Show show() { + return new Show(); + } + + public Statistics statistics() { + return new Statistics(); + } + + public class List extends QueriableCeilometerCommand
> { + public List() { + //return query(target.path("meters")).request(MediaType.APPLICATION_JSON).get(new GenericType
>() {}); + } + } + + public class Show extends QueriableCeilometerCommand
> { + + private String name; + + public Show name(String name) { + this.name = name; + return this; + } + + public Show() { +// if(name == null) { +// throw new UnsupportedOperationException("meter id is mandatory"); +// } +// return query(target.path("meters").path(name)).request(MediaType.APPLICATION_JSON).get(new GenericType >() {}); + } + + } + + public class Statistics extends QueriableCeilometerCommand
> { + + private String name; + + public Statistics name(String name) { + this.name = name; + return this; + } + + public Statistics() { +// if(name == null) { +// throw new UnsupportedOperationException("meter id is mandatory"); +// } +// return query(target.path("meters").path(name).path("statistics")).request(MediaType.APPLICATION_JSON).get(new GenericType >(){}); + } + + } + +} diff --git a/ceilometer-client/src/main/java/com/woorea/openstack/ceilometer/v2/api/ResourcesResource.java b/ceilometer-client/src/main/java/com/woorea/openstack/ceilometer/v2/api/ResourcesResource.java index 900168719..31ada7adb 100644 --- a/ceilometer-client/src/main/java/com/woorea/openstack/ceilometer/v2/api/ResourcesResource.java +++ b/ceilometer-client/src/main/java/com/woorea/openstack/ceilometer/v2/api/ResourcesResource.java @@ -1,45 +1,45 @@ -package com.woorea.openstack.ceilometer.v2.api; - -import java.util.List; - -import com.woorea.openstack.base.client.OpenStackClient; -import com.woorea.openstack.base.client.OpenStackRequest; -import com.woorea.openstack.ceilometer.QueriableCeilometerCommand; -import com.woorea.openstack.ceilometer.v2.model.Resource; - -public class ResourcesResource { - - private final OpenStackClient CLIENT; - - public ResourcesResource(OpenStackClient client) { - CLIENT = client; - } - - public class ResourceList extends QueriableCeilometerCommand
> { - - public ResourceList() { - OpenStackRequest request = new OpenStackRequest(); - //return query(target.path("resources")).request(MediaType.APPLICATION_JSON).get(new GenericType >() {}); - } - - } - - public class ResourceShow extends OpenStackRequest
{ - - private String id; - - public ResourceShow id(String id) { - this.id = id; - return this; - } - - public ResourceShow(OpenStackClient client) { -// if(id == null) { -// throw new UnsupportedOperationException("resource id is mandatory"); -// } -// return target.path("resources").path(id).request(MediaType.APPLICATION_JSON).get(Resource.class); - } - - } - -} +package com.woorea.openstack.ceilometer.v2.api; + +import java.util.List; + +import com.woorea.openstack.base.client.OpenStackClient; +import com.woorea.openstack.base.client.OpenStackRequest; +import com.woorea.openstack.ceilometer.QueriableCeilometerCommand; +import com.woorea.openstack.ceilometer.v2.model.Resource; + +public class ResourcesResource { + + private final OpenStackClient CLIENT; + + public ResourcesResource(OpenStackClient client) { + CLIENT = client; + } + + public class ResourceList extends QueriableCeilometerCommand > { + + public ResourceList() { + OpenStackRequest request = new OpenStackRequest(); + //return query(target.path("resources")).request(MediaType.APPLICATION_JSON).get(new GenericType >() {}); + } + + } + + public class ResourceShow extends OpenStackRequest
{ + + private String id; + + public ResourceShow id(String id) { + this.id = id; + return this; + } + + public ResourceShow(OpenStackClient client) { +// if(id == null) { +// throw new UnsupportedOperationException("resource id is mandatory"); +// } +// return target.path("resources").path(id).request(MediaType.APPLICATION_JSON).get(Resource.class); + } + + } + +} diff --git a/ceilometer-model/pom.xml b/ceilometer-model/pom.xml index 2718bdbe8..c4800f828 100644 --- a/ceilometer-model/pom.xml +++ b/ceilometer-model/pom.xml @@ -1,11 +1,11 @@ - - +4.0.0 -- -com.woorea -openstack-java-sdk -3.2.2-SNAPSHOT -ceilometer-model -OpenStack Ceilometer Model -OpenStack Ceilometer Model -+ diff --git a/ceilometer-model/src/main/java/com/woorea/openstack/ceilometer/v2/model/Meter.java b/ceilometer-model/src/main/java/com/woorea/openstack/ceilometer/v2/model/Meter.java index df9182f9c..f92605add 100644 --- a/ceilometer-model/src/main/java/com/woorea/openstack/ceilometer/v2/model/Meter.java +++ b/ceilometer-model/src/main/java/com/woorea/openstack/ceilometer/v2/model/Meter.java @@ -1,54 +1,54 @@ -package com.woorea.openstack.ceilometer.v2.model; - -import org.codehaus.jackson.annotate.JsonProperty; - -public class Meter { - - @JsonProperty("user_id") - private String user; - - - private String name; - - @JsonProperty("resource_id") - private String resource; - - @JsonProperty("project_id") - private String project; - - private String type; - - private String unit; - - public String getUser() { - return user; - } - - public String getName() { - return name; - } - - public String getResource() { - return resource; - } - - public String getProject() { - return project; - } - - public String getType() { - return type; - } - - public String getUnit() { - return unit; - } - - @Override - public String toString() { - return "Meter [user=" + user + ", name=" + name + ", resource=" - + resource + ", project=" + project + ", type=" + type - + ", unit=" + unit + "]"; - } - -} +package com.woorea.openstack.ceilometer.v2.model; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class Meter { + + @JsonProperty("user_id") + private String user; + + + private String name; + + @JsonProperty("resource_id") + private String resource; + + @JsonProperty("project_id") + private String project; + + private String type; + + private String unit; + + public String getUser() { + return user; + } + + public String getName() { + return name; + } + + public String getResource() { + return resource; + } + + public String getProject() { + return project; + } + + public String getType() { + return type; + } + + public String getUnit() { + return unit; + } + + @Override + public String toString() { + return "Meter [user=" + user + ", name=" + name + ", resource=" + + resource + ", project=" + project + ", type=" + type + + ", unit=" + unit + "]"; + } + +} diff --git a/ceilometer-model/src/main/java/com/woorea/openstack/ceilometer/v2/model/Resource.java b/ceilometer-model/src/main/java/com/woorea/openstack/ceilometer/v2/model/Resource.java index 24e14aa3d..3a2e3ac56 100644 --- a/ceilometer-model/src/main/java/com/woorea/openstack/ceilometer/v2/model/Resource.java +++ b/ceilometer-model/src/main/java/com/woorea/openstack/ceilometer/v2/model/Resource.java @@ -1,50 +1,50 @@ -package com.woorea.openstack.ceilometer.v2.model; - -import java.util.Map; - -import org.codehaus.jackson.annotate.JsonProperty; - -public class Resource { - //{"resource_id": "23b55841eedd41e99d5f3f32149ca086", "timestamp": "2013-03-03T15:19:00", "project_id": "23b55841eedd41e99d5f3f32149ca086", "user_id": null, "metadata": {}} - - @JsonProperty("resource_id") - private String resource; - - private String timestamp; - - @JsonProperty("project_id") - private String project; - - @JsonProperty("user_id") - private String user; - - private Map4.0.0 ++ +com.woorea +openstack-java-sdk +3.2.2-SNAPSHOT +ceilometer-model +OpenStack Ceilometer Model +OpenStack Ceilometer Model +metadata; - - public String getResource() { - return resource; - } - - public String getTimestamp() { - return timestamp; - } - - public String getProject() { - return project; - } - - public String getUser() { - return user; - } - - public Map getMetadata() { - return metadata; - } - - @Override - public String toString() { - return "Resource [resource=" + resource + ", timestamp=" + timestamp - + ", project=" + project + ", user=" + user + ", metadata=" - + metadata + "]"; - } - -} +package com.woorea.openstack.ceilometer.v2.model; + +import java.util.Map; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class Resource { + //{"resource_id": "23b55841eedd41e99d5f3f32149ca086", "timestamp": "2013-03-03T15:19:00", "project_id": "23b55841eedd41e99d5f3f32149ca086", "user_id": null, "metadata": {}} + + @JsonProperty("resource_id") + private String resource; + + private String timestamp; + + @JsonProperty("project_id") + private String project; + + @JsonProperty("user_id") + private String user; + + private Map metadata; + + public String getResource() { + return resource; + } + + public String getTimestamp() { + return timestamp; + } + + public String getProject() { + return project; + } + + public String getUser() { + return user; + } + + public Map getMetadata() { + return metadata; + } + + @Override + public String toString() { + return "Resource [resource=" + resource + ", timestamp=" + timestamp + + ", project=" + project + ", user=" + user + ", metadata=" + + metadata + "]"; + } + +} diff --git a/ceilometer-model/src/main/java/com/woorea/openstack/ceilometer/v2/model/Sample.java b/ceilometer-model/src/main/java/com/woorea/openstack/ceilometer/v2/model/Sample.java index 8827de466..3ec191647 100644 --- a/ceilometer-model/src/main/java/com/woorea/openstack/ceilometer/v2/model/Sample.java +++ b/ceilometer-model/src/main/java/com/woorea/openstack/ceilometer/v2/model/Sample.java @@ -1,94 +1,94 @@ -package com.woorea.openstack.ceilometer.v2.model; - -import java.util.Map; - -import org.codehaus.jackson.annotate.JsonProperty; - -public class Sample { - - @JsonProperty("counter_type") - private String counterType; - - @JsonProperty("counter_name") - private String counterName; - - @JsonProperty("counter_unit") - private String counterUnit; - - @JsonProperty("counter_volume") - private String counterVolume; - - private String source; - - @JsonProperty("project_id") - private String project; - - @JsonProperty("user_id") - private String user; - - @JsonProperty("resource_id") - private String resource; - - private String timestamp; - - @JsonProperty("message_id") - private String message; - - @JsonProperty("resource_metadata") - private Map metadata; - - public String getCounterType() { - return counterType; - } - - public String getCounterName() { - return counterName; - } - - public String getCounterUnit() { - return counterUnit; - } - - public String getCounterVolume() { - return counterVolume; - } - - public String getSource() { - return source; - } - - public String getProject() { - return project; - } - - public String getUser() { - return user; - } - - public String getResource() { - return resource; - } - - public String getTimestamp() { - return timestamp; - } - - public String getMessage() { - return message; - } - - public Map getMetadata() { - return metadata; - } - - @Override - public String toString() { - return "Sample [counterType=" + counterType + ", counterName=" - + counterName + ", counterUnit=" + counterUnit - + ", counterVolume=" + counterVolume + ", source=" + source - + ", project=" + project + ", user=" + user + ", resource=" - + resource + ", timestamp=" + timestamp + ", message=" - + message + ", metadata=" + metadata + "]"; - } - -} +package com.woorea.openstack.ceilometer.v2.model; + +import java.util.Map; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class Sample { + + @JsonProperty("counter_type") + private String counterType; + + @JsonProperty("counter_name") + private String counterName; + + @JsonProperty("counter_unit") + private String counterUnit; + + @JsonProperty("counter_volume") + private String counterVolume; + + private String source; + + @JsonProperty("project_id") + private String project; + + @JsonProperty("user_id") + private String user; + + @JsonProperty("resource_id") + private String resource; + + private String timestamp; + + @JsonProperty("message_id") + private String message; + + @JsonProperty("resource_metadata") + private Map metadata; + + public String getCounterType() { + return counterType; + } + + public String getCounterName() { + return counterName; + } + + public String getCounterUnit() { + return counterUnit; + } + + public String getCounterVolume() { + return counterVolume; + } + + public String getSource() { + return source; + } + + public String getProject() { + return project; + } + + public String getUser() { + return user; + } + + public String getResource() { + return resource; + } + + public String getTimestamp() { + return timestamp; + } + + public String getMessage() { + return message; + } + + public Map getMetadata() { + return metadata; + } + + @Override + public String toString() { + return "Sample [counterType=" + counterType + ", counterName=" + + counterName + ", counterUnit=" + counterUnit + + ", counterVolume=" + counterVolume + ", source=" + source + + ", project=" + project + ", user=" + user + ", resource=" + + resource + ", timestamp=" + timestamp + ", message=" + + message + ", metadata=" + metadata + "]"; + } + +} diff --git a/ceilometer-model/src/main/java/com/woorea/openstack/ceilometer/v2/model/Statistics.java b/ceilometer-model/src/main/java/com/woorea/openstack/ceilometer/v2/model/Statistics.java index 5a34fe54b..cea9cca71 100644 --- a/ceilometer-model/src/main/java/com/woorea/openstack/ceilometer/v2/model/Statistics.java +++ b/ceilometer-model/src/main/java/com/woorea/openstack/ceilometer/v2/model/Statistics.java @@ -1,88 +1,88 @@ -package com.woorea.openstack.ceilometer.v2.model; - -import java.math.BigDecimal; - -import org.codehaus.jackson.annotate.JsonProperty; - -public class Statistics { - - private BigDecimal avg; - - private BigDecimal count; - - private BigDecimal duration; - - @JsonProperty("duration_start") - private String durationStart; - - @JsonProperty("duration_end") - private String durationEnd; - - private BigDecimal max; - - private BigDecimal min; - - private BigDecimal period; - - @JsonProperty("period_start") - private String periodStart; - - @JsonProperty("period_end") - private String periodEnd; - - private BigDecimal sum; - - public BigDecimal getAvg() { - return avg; - } - - public BigDecimal getCount() { - return count; - } - - public BigDecimal getDuration() { - return duration; - } - - public String getDurationStart() { - return durationStart; - } - - public String getDurationEnd() { - return durationEnd; - } - - public BigDecimal getMax() { - return max; - } - - public BigDecimal getMin() { - return min; - } - - public BigDecimal getPeriod() { - return period; - } - - public String getPeriodStart() { - return periodStart; - } - - public String getPeriodEnd() { - return periodEnd; - } - - public BigDecimal getSum() { - return sum; - } - - @Override - public String toString() { - return "Statistics [avg=" + avg + ", count=" + count + ", duration=" - + duration + ", durationStart=" + durationStart - + ", durationEnd=" + durationEnd + ", max=" + max + ", min=" - + min + ", period=" + period + ", periodStart=" + periodStart - + ", periodEnd=" + periodEnd + ", sum=" + sum + "]"; - } - -} +package com.woorea.openstack.ceilometer.v2.model; + +import java.math.BigDecimal; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class Statistics { + + private BigDecimal avg; + + private BigDecimal count; + + private BigDecimal duration; + + @JsonProperty("duration_start") + private String durationStart; + + @JsonProperty("duration_end") + private String durationEnd; + + private BigDecimal max; + + private BigDecimal min; + + private BigDecimal period; + + @JsonProperty("period_start") + private String periodStart; + + @JsonProperty("period_end") + private String periodEnd; + + private BigDecimal sum; + + public BigDecimal getAvg() { + return avg; + } + + public BigDecimal getCount() { + return count; + } + + public BigDecimal getDuration() { + return duration; + } + + public String getDurationStart() { + return durationStart; + } + + public String getDurationEnd() { + return durationEnd; + } + + public BigDecimal getMax() { + return max; + } + + public BigDecimal getMin() { + return min; + } + + public BigDecimal getPeriod() { + return period; + } + + public String getPeriodStart() { + return periodStart; + } + + public String getPeriodEnd() { + return periodEnd; + } + + public BigDecimal getSum() { + return sum; + } + + @Override + public String toString() { + return "Statistics [avg=" + avg + ", count=" + count + ", duration=" + + duration + ", durationStart=" + durationStart + + ", durationEnd=" + durationEnd + ", max=" + max + ", min=" + + min + ", period=" + period + ", periodStart=" + periodStart + + ", periodEnd=" + periodEnd + ", sum=" + sum + "]"; + } + +} diff --git a/glance-client/pom.xml b/glance-client/pom.xml index 6eb537e1c..6dcd52275 100644 --- a/glance-client/pom.xml +++ b/glance-client/pom.xml @@ -1,24 +1,24 @@ - - 4.0.0 -- -com.woorea -openstack-java-sdk -3.2.2-SNAPSHOT -glance-client -OpenStack Glance Client -OpenStack Glance Client -- +- - -com.woorea -openstack-client -3.2.2-SNAPSHOT -- -com.woorea -glance-model -3.2.2-SNAPSHOT -+ \ No newline at end of file diff --git a/glance-client/src/main/java/com/woorea/openstack/glance/Glance.java b/glance-client/src/main/java/com/woorea/openstack/glance/Glance.java index 67714e7f8..ac3c404a7 100644 --- a/glance-client/src/main/java/com/woorea/openstack/glance/Glance.java +++ b/glance-client/src/main/java/com/woorea/openstack/glance/Glance.java @@ -1,30 +1,30 @@ -package com.woorea.openstack.glance; - -import com.woorea.openstack.base.client.OpenStackClient; -import com.woorea.openstack.base.client.OpenStackClientConnector; - -public class Glance extends OpenStackClient { - - private final ImagesResource IMAGES; - - private final SharedImagesResource SHARED_IMAGES; - - public Glance(String endpoint, OpenStackClientConnector connector) { - super(endpoint, connector); - IMAGES = new ImagesResource(this); - SHARED_IMAGES = new SharedImagesResource(this); - } - - public Glance(String endpoint) { - this(endpoint, null); - } - - public final ImagesResource images() { - return IMAGES; - } - - public final SharedImagesResource sharedImages() { - return SHARED_IMAGES; - } - -} +package com.woorea.openstack.glance; + +import com.woorea.openstack.base.client.OpenStackClient; +import com.woorea.openstack.base.client.OpenStackClientConnector; + +public class Glance extends OpenStackClient { + + private final ImagesResource IMAGES; + + private final SharedImagesResource SHARED_IMAGES; + + public Glance(String endpoint, OpenStackClientConnector connector) { + super(endpoint, connector); + IMAGES = new ImagesResource(this); + SHARED_IMAGES = new SharedImagesResource(this); + } + + public Glance(String endpoint) { + this(endpoint, null); + } + + public final ImagesResource images() { + return IMAGES; + } + + public final SharedImagesResource sharedImages() { + return SHARED_IMAGES; + } + +} diff --git a/glance-client/src/main/java/com/woorea/openstack/glance/ImagesResource.java b/glance-client/src/main/java/com/woorea/openstack/glance/ImagesResource.java index ae46548db..1c03b4d7d 100644 --- a/glance-client/src/main/java/com/woorea/openstack/glance/ImagesResource.java +++ b/glance-client/src/main/java/com/woorea/openstack/glance/ImagesResource.java @@ -1,280 +1,279 @@ -package com.woorea.openstack.glance; - -import java.util.Calendar; -import java.util.Collection; -import java.util.HashMap; -import java.util.Map; - -import org.codehaus.jackson.annotate.JsonProperty; - -import com.woorea.openstack.base.client.Entity; -import com.woorea.openstack.base.client.HttpMethod; -import com.woorea.openstack.base.client.OpenStackClient; -import com.woorea.openstack.base.client.OpenStackRequest; -import com.woorea.openstack.base.client.OpenStackResponse; -import com.woorea.openstack.glance.model.Image; -import com.woorea.openstack.glance.model.ImageDownload; -import com.woorea.openstack.glance.model.ImageUpload; -import com.woorea.openstack.glance.model.ImageMember; -import com.woorea.openstack.glance.model.ImageMembers; -import com.woorea.openstack.glance.model.Images; - -public class ImagesResource { - - private final OpenStackClient CLIENT; - - public ImagesResource(OpenStackClient client) { - CLIENT = client; - } - - public List list(boolean detail) { - return new List(detail); - } - - public Create create(Image image) { - return new Create(image); - } - - public Show show(String id) { - return new Show(id); - } - - public Update update(String id, Image image) { - return new Update(id, image); - } - - public Delete delete(String id) { - return new Delete(id); - } - - public Upload upload(ImageUpload image) { - return new Upload(image); - } - - public Upload upload(String id, ImageUpload image) { - return new Upload(id, image); - } - - public Download download(String id) { - return new Download(id); - } - - public ListMembers listMembers(String id) { - return new ListMembers(id); - } - - public ReplaceMembers replaceMembers(String id, Collection4.0.0 ++ +com.woorea +openstack-java-sdk +3.2.2-SNAPSHOT +glance-client +OpenStack Glance Client +OpenStack Glance Client ++ + + +com.woorea +openstack-client +3.2.2-SNAPSHOT ++ +com.woorea +glance-model +3.2.2-SNAPSHOT +members) { - return new ReplaceMembers(id, members); - } - - public AddMember addMember(String id, String tenantId) { - return new AddMember(id, tenantId); - } - - public AddMember removeMember(String id, String tenantId) { - return new AddMember(id, tenantId); - } - - public class List extends OpenStackRequest { - - public List(boolean detail) { - super(CLIENT, HttpMethod.GET, detail ? "/images/detail" : "images", null, Images.class); - } - - } - - public class Create extends OpenStackRequest { - - public Create(Image image) { - super(CLIENT, HttpMethod.POST, "/images", null, Image.class); - for (Map.Entry entry : compose(image).entrySet()) { - header(entry.getKey(), entry.getValue()); - } - } - - } - - public class Update extends OpenStackRequest { - - public Update(String id, Image image) { - super(CLIENT, HttpMethod.PUT, new StringBuilder("/images/").append(id).toString(), Entity.json(image), Image.class); - } - - } - - public class Delete extends OpenStackRequest { - - public Delete(String id) { - super(CLIENT, HttpMethod.DELETE, new StringBuilder("/images/").append(id).toString(), null, Void.class); - } - - } - - public class Show extends OpenStackRequest { - - public Show(String id) { - super(CLIENT, HttpMethod.HEAD, new StringBuilder("/images/").append(id).toString(), null, Image.class); - } - - @Override - public Image execute() { - // custom parsing here - return parse(CLIENT.request(this).headers()); - } - - } - - public class Upload extends OpenStackRequest { - - public Upload(String id, ImageUpload imageUpload) { - super(CLIENT, HttpMethod.PUT, new StringBuilder("/images/").append(id).toString(), - Entity.stream(imageUpload.getInputStream()), Image.class); - } - - public Upload(ImageUpload imageUpload) { - super(CLIENT, HttpMethod.POST, "/images", Entity.stream(imageUpload.getInputStream()), Image.class); - - for (Map.Entry entry : compose(imageUpload.getImage()).entrySet()) { - header(entry.getKey(), entry.getValue()); - } - - //file,s3,swift - header("x-image-meta-store", imageUpload.getStore()); - } - - } - - public class Download extends OpenStackRequest { - - public Download(String id) { - super(CLIENT, HttpMethod.GET, new StringBuilder("/images/").append(id).toString(), null, ImageDownload.class); - header("Accept", "application/octet-stream"); - } - - @Override - public ImageDownload execute() { - // custom parsing here - OpenStackResponse response = CLIENT.request(this); - ImageDownload imageDownload = new ImageDownload(); - imageDownload.setImage(parse(response.headers())); - imageDownload.setInputStream(response.getInputStream()); - return imageDownload; - } - - } - - public class ListMembers extends OpenStackRequest { - - public ListMembers(String id) { - super(CLIENT, HttpMethod.GET, new StringBuilder("/images/").append(id).append("/members").toString(), null, ImageMembers.class); - } - - } - - public class ReplaceMembers extends OpenStackRequest { - - public ReplaceMembers(String id, Collection members) { - super(CLIENT, HttpMethod.PUT, new StringBuilder("/images/").append(id).append("/members").toString(), Entity.json(new Memberships(members)), Void.class); - } - - } - - public class AddMember extends OpenStackRequest { - - public AddMember(String id, String tenantId) { - super(CLIENT, HttpMethod.PUT, new StringBuilder("/images/").append(id).append("/members").append(tenantId).toString(), null, ImageMember.class); - } - - } - - public class RemoveMember extends OpenStackRequest { - - public RemoveMember(String id, String tenantId) { - super(CLIENT, HttpMethod.DELETE, new StringBuilder("/images/").append(id).append("/members/").append(tenantId).toString(), null, Void.class); - } - - } - - public static Map compose(Image image) { - Map headers = new HashMap (); - - headers.put("X-Image-Meta-Name", image.getName()); - headers.put("X-Image-Meta-Disk_format", image.getDiskFormat()); - headers.put("X-Image-Meta-Container_format", image.getContainerFormat()); - headers.put("X-Image-Meta-Id", image.getId()); - headers.put("X-Image-Meta-Size", (image.getSize() != null) ? image.getSize().toString() : null); - headers.put("X-Image-Meta-Checksum", image.getChecksum()); - headers.put("X-Image-Meta-Is_public", String.valueOf(image.isPublic())); - headers.put("X-Image-Meta-Owner", image.getOwner()); - - for(String key : image.getProperties().keySet()) { - image.getProperties().put("x-image-meta-property-" + key, image.getProperties().get(key)); - } - - return headers; - } - - public static Image parse(Map headers) { - Image image = new Image(); - image.setId(headers.get("X-Image-Meta-Id")); - image.setUri(headers.get("Location")); - image.setName(headers.get("X-Image-Meta-Name")); - image.setDiskFormat(headers.get("X-Image-Meta-Disk_format")); - image.setContainerFormat(headers.get("X-Image-Meta-Container_format")); - image.setSize(asLong(headers.get("X-Image-Meta-Size"))); - image.setChecksum(headers.get("X-Image-Meta-Checksum")); - image.setCreatedAt(asCalendar(headers.get("X-Image-Meta-Created_at"))); - image.setUpdatedAt(asCalendar(headers.get("X-Image-Meta-Updated_at"))); - image.setDeletedAt(asCalendar(headers.get("X-Image-Meta-Deleted_at"))); - image.setDeleted(asBoolean(headers.get("X-Image-Meta-Deleted"))); - image.setStatus(headers.get("X-Image-Meta-Status")); - image.setProtected(asBoolean(headers.get("X-Image-Meta-Protected"))); - image.setPublic(asBoolean(headers.get("X-Image-Meta-Is_public"))); - image.setMinRam(asInteger(headers.get("X-Image-Meta-Min_ram"))); - image.setMinDisk(asInteger(headers.get("X-Image-Meta-Min_disk"))); - image.setOwner(headers.get("X-Image-Meta-Owner")); - for(String key : headers.keySet()) { - if(key.startsWith("x-image-meta-property-")) { - image.getProperties().put(key.substring(22), headers.get(key)); - } - } - return image; - } - - private static Calendar asCalendar(String calendarString) { - return Calendar.getInstance(); - } - - private static Integer asInteger(String integerString) { - if(integerString != null) { - return Integer.parseInt(integerString); - } - return 0; - } - - private static Boolean asBoolean(String booleanString) { - if(booleanString != null) { - return Boolean.parseBoolean(booleanString); - } - return Boolean.FALSE; - } - - private static Long asLong(String longString) { - if(longString != null) { - return Long.parseLong(longString); - } - return 0L; - } - - public static class Memberships { - - @JsonProperty("memberships") - private Collection memberships; - - public Memberships(Collection memberships) { - this.memberships = memberships; - } - - } - -} +package com.woorea.openstack.glance; + +import java.util.Calendar; +import java.util.Collection; +import java.util.HashMap; +import java.util.Map; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.woorea.openstack.base.client.Entity; +import com.woorea.openstack.base.client.HttpMethod; +import com.woorea.openstack.base.client.OpenStackClient; +import com.woorea.openstack.base.client.OpenStackRequest; +import com.woorea.openstack.base.client.OpenStackResponse; +import com.woorea.openstack.glance.model.Image; +import com.woorea.openstack.glance.model.ImageDownload; +import com.woorea.openstack.glance.model.ImageMember; +import com.woorea.openstack.glance.model.ImageMembers; +import com.woorea.openstack.glance.model.ImageUpload; +import com.woorea.openstack.glance.model.Images; + +public class ImagesResource { + + private final OpenStackClient CLIENT; + + public ImagesResource(OpenStackClient client) { + CLIENT = client; + } + + public List list(boolean detail) { + return new List(detail); + } + + public Create create(Image image) { + return new Create(image); + } + + public Show show(String id) { + return new Show(id); + } + + public Update update(String id, Image image) { + return new Update(id, image); + } + + public Delete delete(String id) { + return new Delete(id); + } + + public Upload upload(ImageUpload image) { + return new Upload(image); + } + + public Upload upload(String id, ImageUpload image) { + return new Upload(id, image); + } + + public Download download(String id) { + return new Download(id); + } + + public ListMembers listMembers(String id) { + return new ListMembers(id); + } + + public ReplaceMembers replaceMembers(String id, Collection members) { + return new ReplaceMembers(id, members); + } + + public AddMember addMember(String id, String tenantId) { + return new AddMember(id, tenantId); + } + + public AddMember removeMember(String id, String tenantId) { + return new AddMember(id, tenantId); + } + + public class List extends OpenStackRequest { + + public List(boolean detail) { + super(CLIENT, HttpMethod.GET, detail ? "/images/detail" : "images", null, Images.class); + } + + } + + public class Create extends OpenStackRequest { + + public Create(Image image) { + super(CLIENT, HttpMethod.POST, "/images", null, Image.class); + for (Map.Entry entry : compose(image).entrySet()) { + header(entry.getKey(), entry.getValue()); + } + } + + } + + public class Update extends OpenStackRequest { + + public Update(String id, Image image) { + super(CLIENT, HttpMethod.PUT, new StringBuilder("/images/").append(id).toString(), Entity.json(image), Image.class); + } + + } + + public class Delete extends OpenStackRequest { + + public Delete(String id) { + super(CLIENT, HttpMethod.DELETE, new StringBuilder("/images/").append(id).toString(), null, Void.class); + } + + } + + public class Show extends OpenStackRequest { + + public Show(String id) { + super(CLIENT, HttpMethod.HEAD, new StringBuilder("/images/").append(id).toString(), null, Image.class); + } + + @Override + public Image execute() { + // custom parsing here + return parse(CLIENT.request(this).headers()); + } + + } + + public class Upload extends OpenStackRequest { + + public Upload(String id, ImageUpload imageUpload) { + super(CLIENT, HttpMethod.PUT, new StringBuilder("/images/").append(id).toString(), + Entity.stream(imageUpload.getInputStream()), Image.class); + } + + public Upload(ImageUpload imageUpload) { + super(CLIENT, HttpMethod.POST, "/images", Entity.stream(imageUpload.getInputStream()), Image.class); + + for (Map.Entry entry : compose(imageUpload.getImage()).entrySet()) { + header(entry.getKey(), entry.getValue()); + } + + //file,s3,swift + header("x-image-meta-store", imageUpload.getStore()); + } + + } + + public class Download extends OpenStackRequest { + + public Download(String id) { + super(CLIENT, HttpMethod.GET, new StringBuilder("/images/").append(id).toString(), null, ImageDownload.class); + header("Accept", "application/octet-stream"); + } + + @Override + public ImageDownload execute() { + // custom parsing here + OpenStackResponse response = CLIENT.request(this); + ImageDownload imageDownload = new ImageDownload(); + imageDownload.setImage(parse(response.headers())); + imageDownload.setInputStream(response.getInputStream()); + return imageDownload; + } + + } + + public class ListMembers extends OpenStackRequest { + + public ListMembers(String id) { + super(CLIENT, HttpMethod.GET, new StringBuilder("/images/").append(id).append("/members").toString(), null, ImageMembers.class); + } + + } + + public class ReplaceMembers extends OpenStackRequest { + + public ReplaceMembers(String id, Collection members) { + super(CLIENT, HttpMethod.PUT, new StringBuilder("/images/").append(id).append("/members").toString(), Entity.json(new Memberships(members)), Void.class); + } + + } + + public class AddMember extends OpenStackRequest { + + public AddMember(String id, String tenantId) { + super(CLIENT, HttpMethod.PUT, new StringBuilder("/images/").append(id).append("/members").append(tenantId).toString(), null, ImageMember.class); + } + + } + + public class RemoveMember extends OpenStackRequest { + + public RemoveMember(String id, String tenantId) { + super(CLIENT, HttpMethod.DELETE, new StringBuilder("/images/").append(id).append("/members/").append(tenantId).toString(), null, Void.class); + } + + } + + public static Map compose(Image image) { + Map headers = new HashMap (); + + headers.put("X-Image-Meta-Name", image.getName()); + headers.put("X-Image-Meta-Disk_format", image.getDiskFormat()); + headers.put("X-Image-Meta-Container_format", image.getContainerFormat()); + headers.put("X-Image-Meta-Id", image.getId()); + headers.put("X-Image-Meta-Size", (image.getSize() != null) ? image.getSize().toString() : null); + headers.put("X-Image-Meta-Checksum", image.getChecksum()); + headers.put("X-Image-Meta-Is_public", String.valueOf(image.isPublic())); + headers.put("X-Image-Meta-Owner", image.getOwner()); + + for(String key : image.getProperties().keySet()) { + image.getProperties().put("x-image-meta-property-" + key, image.getProperties().get(key)); + } + + return headers; + } + + public static Image parse(Map headers) { + Image image = new Image(); + image.setId(headers.get("X-Image-Meta-Id")); + image.setUri(headers.get("Location")); + image.setName(headers.get("X-Image-Meta-Name")); + image.setDiskFormat(headers.get("X-Image-Meta-Disk_format")); + image.setContainerFormat(headers.get("X-Image-Meta-Container_format")); + image.setSize(asLong(headers.get("X-Image-Meta-Size"))); + image.setChecksum(headers.get("X-Image-Meta-Checksum")); + image.setCreatedAt(asCalendar(headers.get("X-Image-Meta-Created_at"))); + image.setUpdatedAt(asCalendar(headers.get("X-Image-Meta-Updated_at"))); + image.setDeletedAt(asCalendar(headers.get("X-Image-Meta-Deleted_at"))); + image.setDeleted(asBoolean(headers.get("X-Image-Meta-Deleted"))); + image.setStatus(headers.get("X-Image-Meta-Status")); + image.setProtected(asBoolean(headers.get("X-Image-Meta-Protected"))); + image.setPublic(asBoolean(headers.get("X-Image-Meta-Is_public"))); + image.setMinRam(asInteger(headers.get("X-Image-Meta-Min_ram"))); + image.setMinDisk(asInteger(headers.get("X-Image-Meta-Min_disk"))); + image.setOwner(headers.get("X-Image-Meta-Owner")); + for(String key : headers.keySet()) { + if(key.startsWith("x-image-meta-property-")) { + image.getProperties().put(key.substring(22), headers.get(key)); + } + } + return image; + } + + private static Calendar asCalendar(String calendarString) { + return Calendar.getInstance(); + } + + private static Integer asInteger(String integerString) { + if(integerString != null) { + return Integer.parseInt(integerString); + } + return 0; + } + + private static Boolean asBoolean(String booleanString) { + if(booleanString != null) { + return Boolean.parseBoolean(booleanString); + } + return Boolean.FALSE; + } + + private static Long asLong(String longString) { + if(longString != null) { + return Long.parseLong(longString); + } + return 0L; + } + + public static class Memberships { + + @JsonProperty("memberships") + private Collection memberships; + + public Memberships(Collection memberships) { + this.memberships = memberships; + } + + } + +} diff --git a/glance-client/src/main/java/com/woorea/openstack/glance/SharedImagesResource.java b/glance-client/src/main/java/com/woorea/openstack/glance/SharedImagesResource.java index a46155463..d280b4753 100644 --- a/glance-client/src/main/java/com/woorea/openstack/glance/SharedImagesResource.java +++ b/glance-client/src/main/java/com/woorea/openstack/glance/SharedImagesResource.java @@ -1,30 +1,29 @@ -package com.woorea.openstack.glance; - - -import com.woorea.openstack.base.client.HttpMethod; -import com.woorea.openstack.base.client.OpenStackClient; -import com.woorea.openstack.base.client.OpenStackRequest; -import com.woorea.openstack.glance.model.Images; -import com.woorea.openstack.glance.model.SharedImages; - -public class SharedImagesResource { - - private final OpenStackClient CLIENT; - - public SharedImagesResource(OpenStackClient client) { - CLIENT = client; - } - - public List list(String tenantId, boolean detail) { - return new List(tenantId, detail); - } - - public class List extends OpenStackRequest { - - public List(String tenantId, boolean detail) { - super(CLIENT, HttpMethod.GET, new StringBuffer(detail ? "/shared-images/detail" : "/shared-images/").append(tenantId).toString(), null, SharedImages.class); - } - - } - -} +package com.woorea.openstack.glance; + + +import com.woorea.openstack.base.client.HttpMethod; +import com.woorea.openstack.base.client.OpenStackClient; +import com.woorea.openstack.base.client.OpenStackRequest; +import com.woorea.openstack.glance.model.SharedImages; + +public class SharedImagesResource { + + private final OpenStackClient CLIENT; + + public SharedImagesResource(OpenStackClient client) { + CLIENT = client; + } + + public List list(String tenantId, boolean detail) { + return new List(tenantId, detail); + } + + public class List extends OpenStackRequest { + + public List(String tenantId, boolean detail) { + super(CLIENT, HttpMethod.GET, new StringBuffer(detail ? "/shared-images/detail" : "/shared-images/").append(tenantId).toString(), null, SharedImages.class); + } + + } + +} diff --git a/glance-model/pom.xml b/glance-model/pom.xml index 2efc98be8..d5f7f238b 100644 --- a/glance-model/pom.xml +++ b/glance-model/pom.xml @@ -1,11 +1,11 @@ - - 4.0.0 -- -com.woorea -openstack-java-sdk -3.2.2-SNAPSHOT -glance-model -OpenStack Glance Model -OpenStack Glance Model ++ \ No newline at end of file diff --git a/glance-model/src/main/java/com/woorea/openstack/glance/model/Image.java b/glance-model/src/main/java/com/woorea/openstack/glance/model/Image.java index 491fde640..dab85ad05 100644 --- a/glance-model/src/main/java/com/woorea/openstack/glance/model/Image.java +++ b/glance-model/src/main/java/com/woorea/openstack/glance/model/Image.java @@ -1,324 +1,324 @@ -package com.woorea.openstack.glance.model; - -import java.io.Serializable; -import java.util.Calendar; -import java.util.HashMap; -import java.util.Map; - -import org.codehaus.jackson.annotate.JsonProperty; -import org.codehaus.jackson.map.annotate.JsonRootName; - -@JsonRootName("image") -public class Image implements Serializable { - - private String id; - - private String uri; - - private String name; - - @JsonProperty("disk_format") - private String diskFormat; - - @JsonProperty("container_format") - private String containerFormat; - - private Long size; - - private String checksum; - - @JsonProperty("created_at") - private Calendar createdAt; - - @JsonProperty("updated_at") - private Calendar updatedAt; - - @JsonProperty("deleted_at") - private Calendar deletedAt; - - private String status; - - @JsonProperty("is_public") - private boolean isPublic; - - @JsonProperty("min_ram") - private Integer minRam; - - @JsonProperty("min_disk") - private Integer minDisk; - - private String owner; - - @JsonProperty("deleted") - private boolean isDeleted; - - @JsonProperty("protected") - private boolean isProtected; - - private Map4.0.0 ++ +com.woorea +openstack-java-sdk +3.2.2-SNAPSHOT +glance-model +OpenStack Glance Model +OpenStack Glance Model properties; - - /** - * @return the id - */ - public String getId() { - return id; - } - - /** - * @param id the id to set - */ - public void setId(String id) { - this.id = id; - } - - /** - * @return the uri - */ - public String getUri() { - return uri; - } - - /** - * @param uri the uri to set - */ - public void setUri(String uri) { - this.uri = uri; - } - - /** - * @return the name - */ - public String getName() { - return name; - } - - /** - * @param name the name to set - */ - public void setName(String name) { - this.name = name; - } - - /** - * @return the diskFormat - */ - public String getDiskFormat() { - return diskFormat; - } - - /** - * @param diskFormat the diskFormat to set - */ - public void setDiskFormat(String diskFormat) { - this.diskFormat = diskFormat; - } - - /** - * @return the containerFormat - */ - public String getContainerFormat() { - return containerFormat; - } - - /** - * @param containerFormat the containerFormat to set - */ - public void setContainerFormat(String containerFormat) { - this.containerFormat = containerFormat; - } - - /** - * @return the size - */ - public Long getSize() { - return size; - } - - /** - * @param size the size to set - */ - public void setSize(Long size) { - this.size = size; - } - - /** - * @return the checksum - */ - public String getChecksum() { - return checksum; - } - - /** - * @param checksum the checksum to set - */ - public void setChecksum(String checksum) { - this.checksum = checksum; - } - - /** - * @return the createdAt - */ - public Calendar getCreatedAt() { - return createdAt; - } - - /** - * @param createdAt the createdAt to set - */ - public void setCreatedAt(Calendar createdAt) { - this.createdAt = createdAt; - } - - /** - * @return the updatedAt - */ - public Calendar getUpdatedAt() { - return updatedAt; - } - - /** - * @param updatedAt the updatedAt to set - */ - public void setUpdatedAt(Calendar updatedAt) { - this.updatedAt = updatedAt; - } - - /** - * @return the deletedAt - */ - public Calendar getDeletedAt() { - return deletedAt; - } - - /** - * @param deletedAt the deletedAt to set - */ - public void setDeletedAt(Calendar deletedAt) { - this.deletedAt = deletedAt; - } - - /** - * @return the status - */ - public String getStatus() { - return status; - } - - /** - * @param status the status to set - */ - public void setStatus(String status) { - this.status = status; - } - - /** - * @return the isPublic - */ - public boolean isPublic() { - return isPublic; - } - - /** - * @param isPublic the isPublic to set - */ - public void setPublic(boolean isPublic) { - this.isPublic = isPublic; - } - - /** - * @return the minRam - */ - public Integer getMinRam() { - return minRam; - } - - /** - * @param minRam the minRam to set - */ - public void setMinRam(Integer minRam) { - this.minRam = minRam; - } - - /** - * @return the minDisk - */ - public Integer getMinDisk() { - return minDisk; - } - - /** - * @param minDisk the minDisk to set - */ - public void setMinDisk(Integer minDisk) { - this.minDisk = minDisk; - } - - /** - * @return the owner - */ - public String getOwner() { - return owner; - } - - /** - * @param owner the owner to set - */ - public void setOwner(String owner) { - this.owner = owner; - } - - /** - * @return the isDeleted - */ - public boolean isDeleted() { - return isDeleted; - } - - /** - * @param isDeleted the isDeleted to set - */ - public void setDeleted(boolean isDeleted) { - this.isDeleted = isDeleted; - } - - /** - * @return the isProtected - */ - public boolean isProtected() { - return isProtected; - } - - /** - * @param isProtected the isProtected to set - */ - public void setProtected(boolean isProtected) { - this.isProtected = isProtected; - } - - /** - * @return the properties - */ - public Map getProperties() { - if(properties == null) { - properties = new HashMap (); - } - return properties; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "Image [id=" + id + ", uri=" + uri + ", name=" + name - + ", diskFormat=" + diskFormat + ", containerFormat=" - + containerFormat + ", size=" + size + ", checksum=" + checksum - + ", createdAt=" + createdAt + ", updatedAt=" + updatedAt - + ", deletedAt=" + deletedAt + ", status=" + status - + ", isPublic=" + isPublic + ", minRam=" + minRam - + ", minDisk=" + minDisk + ", owner=" + owner + ", isDeleted=" - + isDeleted + ", isProtected=" + isProtected + ", properties=" - + properties + "]"; - } - -} +package com.woorea.openstack.glance.model; + +import java.io.Serializable; +import java.util.Calendar; +import java.util.HashMap; +import java.util.Map; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; + +@JsonRootName("image") +public class Image implements Serializable { + + private String id; + + private String uri; + + private String name; + + @JsonProperty("disk_format") + private String diskFormat; + + @JsonProperty("container_format") + private String containerFormat; + + private Long size; + + private String checksum; + + @JsonProperty("created_at") + private Calendar createdAt; + + @JsonProperty("updated_at") + private Calendar updatedAt; + + @JsonProperty("deleted_at") + private Calendar deletedAt; + + private String status; + + @JsonProperty("is_public") + private boolean isPublic; + + @JsonProperty("min_ram") + private Integer minRam; + + @JsonProperty("min_disk") + private Integer minDisk; + + private String owner; + + @JsonProperty("deleted") + private boolean isDeleted; + + @JsonProperty("protected") + private boolean isProtected; + + private Map properties; + + /** + * @return the id + */ + public String getId() { + return id; + } + + /** + * @param id the id to set + */ + public void setId(String id) { + this.id = id; + } + + /** + * @return the uri + */ + public String getUri() { + return uri; + } + + /** + * @param uri the uri to set + */ + public void setUri(String uri) { + this.uri = uri; + } + + /** + * @return the name + */ + public String getName() { + return name; + } + + /** + * @param name the name to set + */ + public void setName(String name) { + this.name = name; + } + + /** + * @return the diskFormat + */ + public String getDiskFormat() { + return diskFormat; + } + + /** + * @param diskFormat the diskFormat to set + */ + public void setDiskFormat(String diskFormat) { + this.diskFormat = diskFormat; + } + + /** + * @return the containerFormat + */ + public String getContainerFormat() { + return containerFormat; + } + + /** + * @param containerFormat the containerFormat to set + */ + public void setContainerFormat(String containerFormat) { + this.containerFormat = containerFormat; + } + + /** + * @return the size + */ + public Long getSize() { + return size; + } + + /** + * @param size the size to set + */ + public void setSize(Long size) { + this.size = size; + } + + /** + * @return the checksum + */ + public String getChecksum() { + return checksum; + } + + /** + * @param checksum the checksum to set + */ + public void setChecksum(String checksum) { + this.checksum = checksum; + } + + /** + * @return the createdAt + */ + public Calendar getCreatedAt() { + return createdAt; + } + + /** + * @param createdAt the createdAt to set + */ + public void setCreatedAt(Calendar createdAt) { + this.createdAt = createdAt; + } + + /** + * @return the updatedAt + */ + public Calendar getUpdatedAt() { + return updatedAt; + } + + /** + * @param updatedAt the updatedAt to set + */ + public void setUpdatedAt(Calendar updatedAt) { + this.updatedAt = updatedAt; + } + + /** + * @return the deletedAt + */ + public Calendar getDeletedAt() { + return deletedAt; + } + + /** + * @param deletedAt the deletedAt to set + */ + public void setDeletedAt(Calendar deletedAt) { + this.deletedAt = deletedAt; + } + + /** + * @return the status + */ + public String getStatus() { + return status; + } + + /** + * @param status the status to set + */ + public void setStatus(String status) { + this.status = status; + } + + /** + * @return the isPublic + */ + public boolean isPublic() { + return isPublic; + } + + /** + * @param isPublic the isPublic to set + */ + public void setPublic(boolean isPublic) { + this.isPublic = isPublic; + } + + /** + * @return the minRam + */ + public Integer getMinRam() { + return minRam; + } + + /** + * @param minRam the minRam to set + */ + public void setMinRam(Integer minRam) { + this.minRam = minRam; + } + + /** + * @return the minDisk + */ + public Integer getMinDisk() { + return minDisk; + } + + /** + * @param minDisk the minDisk to set + */ + public void setMinDisk(Integer minDisk) { + this.minDisk = minDisk; + } + + /** + * @return the owner + */ + public String getOwner() { + return owner; + } + + /** + * @param owner the owner to set + */ + public void setOwner(String owner) { + this.owner = owner; + } + + /** + * @return the isDeleted + */ + public boolean isDeleted() { + return isDeleted; + } + + /** + * @param isDeleted the isDeleted to set + */ + public void setDeleted(boolean isDeleted) { + this.isDeleted = isDeleted; + } + + /** + * @return the isProtected + */ + public boolean isProtected() { + return isProtected; + } + + /** + * @param isProtected the isProtected to set + */ + public void setProtected(boolean isProtected) { + this.isProtected = isProtected; + } + + /** + * @return the properties + */ + public Map getProperties() { + if(properties == null) { + properties = new HashMap (); + } + return properties; + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "Image [id=" + id + ", uri=" + uri + ", name=" + name + + ", diskFormat=" + diskFormat + ", containerFormat=" + + containerFormat + ", size=" + size + ", checksum=" + checksum + + ", createdAt=" + createdAt + ", updatedAt=" + updatedAt + + ", deletedAt=" + deletedAt + ", status=" + status + + ", isPublic=" + isPublic + ", minRam=" + minRam + + ", minDisk=" + minDisk + ", owner=" + owner + ", isDeleted=" + + isDeleted + ", isProtected=" + isProtected + ", properties=" + + properties + "]"; + } + +} diff --git a/glance-model/src/main/java/com/woorea/openstack/glance/model/ImageDownload.java b/glance-model/src/main/java/com/woorea/openstack/glance/model/ImageDownload.java index d7c575cf2..9d63019b9 100644 --- a/glance-model/src/main/java/com/woorea/openstack/glance/model/ImageDownload.java +++ b/glance-model/src/main/java/com/woorea/openstack/glance/model/ImageDownload.java @@ -1,39 +1,39 @@ -package com.woorea.openstack.glance.model; - -import java.io.InputStream; - -public class ImageDownload { - - private Image image; - - private InputStream inputStream; - - /** - * @return the image - */ - public Image getImage() { - return image; - } - - /** - * @param image the image to set - */ - public void setImage(Image image) { - this.image = image; - } - - /** - * @return the inputStream - */ - public InputStream getInputStream() { - return inputStream; - } - - /** - * @param inputStream the inputStream to set - */ - public void setInputStream(InputStream inputStream) { - this.inputStream = inputStream; - } - -} +package com.woorea.openstack.glance.model; + +import java.io.InputStream; + +public class ImageDownload { + + private Image image; + + private InputStream inputStream; + + /** + * @return the image + */ + public Image getImage() { + return image; + } + + /** + * @param image the image to set + */ + public void setImage(Image image) { + this.image = image; + } + + /** + * @return the inputStream + */ + public InputStream getInputStream() { + return inputStream; + } + + /** + * @param inputStream the inputStream to set + */ + public void setInputStream(InputStream inputStream) { + this.inputStream = inputStream; + } + +} diff --git a/glance-model/src/main/java/com/woorea/openstack/glance/model/ImageMember.java b/glance-model/src/main/java/com/woorea/openstack/glance/model/ImageMember.java index 4b8c3e753..0dd5e9e1b 100644 --- a/glance-model/src/main/java/com/woorea/openstack/glance/model/ImageMember.java +++ b/glance-model/src/main/java/com/woorea/openstack/glance/model/ImageMember.java @@ -1,52 +1,52 @@ -package com.woorea.openstack.glance.model; - -import java.io.Serializable; - -import org.codehaus.jackson.annotate.JsonProperty; - -public class ImageMember implements Serializable { - - @JsonProperty("can_share") - private boolean canShare; - - @JsonProperty("member_id") - private String memberId; - - public ImageMember() { - - } - - public ImageMember(boolean canShare, String memberId) { - this.canShare = canShare; - this.memberId = memberId; - } - - /** - * @return the canShare - */ - public boolean isCanShare() { - return canShare; - } - - /** - * @param canShare the canShare to set - */ - public void setCanShare(boolean canShare) { - this.canShare = canShare; - } - - /** - * @return the memberId - */ - public String getMemberId() { - return memberId; - } - - /** - * @param memberId the memberId to set - */ - public void setMemberId(String memberId) { - this.memberId = memberId; - } - -} +package com.woorea.openstack.glance.model; + +import java.io.Serializable; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class ImageMember implements Serializable { + + @JsonProperty("can_share") + private boolean canShare; + + @JsonProperty("member_id") + private String memberId; + + public ImageMember() { + + } + + public ImageMember(boolean canShare, String memberId) { + this.canShare = canShare; + this.memberId = memberId; + } + + /** + * @return the canShare + */ + public boolean isCanShare() { + return canShare; + } + + /** + * @param canShare the canShare to set + */ + public void setCanShare(boolean canShare) { + this.canShare = canShare; + } + + /** + * @return the memberId + */ + public String getMemberId() { + return memberId; + } + + /** + * @param memberId the memberId to set + */ + public void setMemberId(String memberId) { + this.memberId = memberId; + } + +} diff --git a/glance-model/src/main/java/com/woorea/openstack/glance/model/ImageMembers.java b/glance-model/src/main/java/com/woorea/openstack/glance/model/ImageMembers.java index 68aa17612..23218686d 100644 --- a/glance-model/src/main/java/com/woorea/openstack/glance/model/ImageMembers.java +++ b/glance-model/src/main/java/com/woorea/openstack/glance/model/ImageMembers.java @@ -1,26 +1,26 @@ -package com.woorea.openstack.glance.model; - -import java.io.Serializable; -import java.util.Iterator; -import java.util.List; - -import org.codehaus.jackson.annotate.JsonProperty; - -public class ImageMembers implements Iterable , Serializable { - - @JsonProperty("members") - private List list; - - /** - * @return the list - */ - public List getList() { - return list; - } - - @Override - public Iterator iterator() { - return list.iterator(); - } - +package com.woorea.openstack.glance.model; + +import java.io.Serializable; +import java.util.Iterator; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class ImageMembers implements Iterable , Serializable { + + @JsonProperty("members") + private List list; + + /** + * @return the list + */ + public List getList() { + return list; + } + + @Override + public Iterator iterator() { + return list.iterator(); + } + } \ No newline at end of file diff --git a/glance-model/src/main/java/com/woorea/openstack/glance/model/ImageUpload.java b/glance-model/src/main/java/com/woorea/openstack/glance/model/ImageUpload.java index 326f5e006..c41125b8a 100644 --- a/glance-model/src/main/java/com/woorea/openstack/glance/model/ImageUpload.java +++ b/glance-model/src/main/java/com/woorea/openstack/glance/model/ImageUpload.java @@ -1,67 +1,67 @@ -package com.woorea.openstack.glance.model; - -import java.io.InputStream; -import java.util.HashMap; -import java.util.Map; - -public class ImageUpload { - - private Image image; - - private String store; - - private Map properties; - - private InputStream inputStream; - - public ImageUpload(Image image) { - setImage(image); - } - - public Image getImage() { - return image; - } - - public void setImage(Image image) { - this.image = image; - } - - /** - * @return the store - */ - public String getStore() { - return store; - } - - /** - * @param store the store to set - */ - public void setStore(String store) { - this.store = store; - } - - /** - * @return the properties - */ - public Map getProperties() { - if(properties == null) { - properties = new HashMap (); - } - return properties; - } - - /** - * @return the inputStream - */ - public InputStream getInputStream() { - return inputStream; - } - - /** - * @param inputStream the inputStream to set - */ - public void setInputStream(InputStream inputStream) { - this.inputStream = inputStream; - } - -} +package com.woorea.openstack.glance.model; + +import java.io.InputStream; +import java.util.HashMap; +import java.util.Map; + +public class ImageUpload { + + private Image image; + + private String store; + + private Map properties; + + private InputStream inputStream; + + public ImageUpload(Image image) { + setImage(image); + } + + public Image getImage() { + return image; + } + + public void setImage(Image image) { + this.image = image; + } + + /** + * @return the store + */ + public String getStore() { + return store; + } + + /** + * @param store the store to set + */ + public void setStore(String store) { + this.store = store; + } + + /** + * @return the properties + */ + public Map getProperties() { + if(properties == null) { + properties = new HashMap (); + } + return properties; + } + + /** + * @return the inputStream + */ + public InputStream getInputStream() { + return inputStream; + } + + /** + * @param inputStream the inputStream to set + */ + public void setInputStream(InputStream inputStream) { + this.inputStream = inputStream; + } + +} diff --git a/glance-model/src/main/java/com/woorea/openstack/glance/model/Images.java b/glance-model/src/main/java/com/woorea/openstack/glance/model/Images.java index af612ba1d..55dfc4636 100644 --- a/glance-model/src/main/java/com/woorea/openstack/glance/model/Images.java +++ b/glance-model/src/main/java/com/woorea/openstack/glance/model/Images.java @@ -1,26 +1,26 @@ -package com.woorea.openstack.glance.model; - -import java.io.Serializable; -import java.util.Iterator; -import java.util.List; - -import org.codehaus.jackson.annotate.JsonProperty; - -public class Images implements Iterable , Serializable { - - @JsonProperty("images") - private List list; - - /** - * @return the list - */ - public List getList() { - return list; - } - - @Override - public Iterator iterator() { - return list.iterator(); - } - -} +package com.woorea.openstack.glance.model; + +import java.io.Serializable; +import java.util.Iterator; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class Images implements Iterable , Serializable { + + @JsonProperty("images") + private List list; + + /** + * @return the list + */ + public List getList() { + return list; + } + + @Override + public Iterator iterator() { + return list.iterator(); + } + +} diff --git a/glance-model/src/main/java/com/woorea/openstack/glance/model/SharedImage.java b/glance-model/src/main/java/com/woorea/openstack/glance/model/SharedImage.java index ae23a6688..508579f22 100644 --- a/glance-model/src/main/java/com/woorea/openstack/glance/model/SharedImage.java +++ b/glance-model/src/main/java/com/woorea/openstack/glance/model/SharedImage.java @@ -1,5 +1,5 @@ -package com.woorea.openstack.glance.model; - -public class SharedImage { - +package com.woorea.openstack.glance.model; + +public class SharedImage { + } \ No newline at end of file diff --git a/glance-model/src/main/java/com/woorea/openstack/glance/model/SharedImages.java b/glance-model/src/main/java/com/woorea/openstack/glance/model/SharedImages.java index 111d0942b..b218d1256 100644 --- a/glance-model/src/main/java/com/woorea/openstack/glance/model/SharedImages.java +++ b/glance-model/src/main/java/com/woorea/openstack/glance/model/SharedImages.java @@ -1,26 +1,26 @@ -package com.woorea.openstack.glance.model; - -import java.io.Serializable; -import java.util.Iterator; -import java.util.List; - -import org.codehaus.jackson.annotate.JsonProperty; - -public class SharedImages implements Iterable , Serializable { - - @JsonProperty("shared_images") - private List list; - - /** - * @return the list - */ - public List getList() { - return list; - } - - @Override - public Iterator iterator() { - return list.iterator(); - } - +package com.woorea.openstack.glance.model; + +import java.io.Serializable; +import java.util.Iterator; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class SharedImages implements Iterable , Serializable { + + @JsonProperty("shared_images") + private List list; + + /** + * @return the list + */ + public List getList() { + return list; + } + + @Override + public Iterator iterator() { + return list.iterator(); + } + } \ No newline at end of file diff --git a/heat-client/pom.xml b/heat-client/pom.xml index 7c63daf12..535598a59 100644 --- a/heat-client/pom.xml +++ b/heat-client/pom.xml @@ -1,24 +1,24 @@ - - 4.0.0 -- -com.woorea -openstack-java-sdk -3.2.2-SNAPSHOT -heat-client -OpenStack Heat Client -OpenStack Heat Client -- +- - -com.woorea -openstack-client -3.2.2-SNAPSHOT -- -com.woorea -heat-model -3.2.2-SNAPSHOT -+ \ No newline at end of file diff --git a/heat-client/src/main/java/com/woorea/openstack/heat/Heat.java b/heat-client/src/main/java/com/woorea/openstack/heat/Heat.java index 96e9cd78b..3e4ea1e78 100644 --- a/heat-client/src/main/java/com/woorea/openstack/heat/Heat.java +++ b/heat-client/src/main/java/com/woorea/openstack/heat/Heat.java @@ -1,31 +1,31 @@ -package com.woorea.openstack.heat; - -import com.woorea.openstack.base.client.OpenStackClient; -import com.woorea.openstack.base.client.OpenStackClientConnector; - -/** - * Reference: http://api.openstack.org/api-ref-orchestration.html - */ -public class Heat extends OpenStackClient { - - private final StackResource stacks; - private final ResourcesResource resources; - - public Heat(String endpoint, OpenStackClientConnector connector) { - super(endpoint, connector); - stacks = new StackResource(this); - resources = new ResourcesResource(this); - } - - public Heat(String endpoint) { - this(endpoint, null); - } - - public StackResource getStacks() { - return stacks; - } - - public ResourcesResource getResources() { - return resources; - } -} +package com.woorea.openstack.heat; + +import com.woorea.openstack.base.client.OpenStackClient; +import com.woorea.openstack.base.client.OpenStackClientConnector; + +/** + * Reference: http://api.openstack.org/api-ref-orchestration.html + */ +public class Heat extends OpenStackClient { + + private final StackResource stacks; + private final ResourcesResource resources; + + public Heat(String endpoint, OpenStackClientConnector connector) { + super(endpoint, connector); + stacks = new StackResource(this); + resources = new ResourcesResource(this); + } + + public Heat(String endpoint) { + this(endpoint, null); + } + + public StackResource getStacks() { + return stacks; + } + + public ResourcesResource getResources() { + return resources; + } +} diff --git a/heat-client/src/main/java/com/woorea/openstack/heat/ResourcesResource.java b/heat-client/src/main/java/com/woorea/openstack/heat/ResourcesResource.java index c3635bcbe..20ffd7801 100644 --- a/heat-client/src/main/java/com/woorea/openstack/heat/ResourcesResource.java +++ b/heat-client/src/main/java/com/woorea/openstack/heat/ResourcesResource.java @@ -1,31 +1,31 @@ -package com.woorea.openstack.heat; - -import com.woorea.openstack.base.client.HttpMethod; -import com.woorea.openstack.base.client.OpenStackClient; -import com.woorea.openstack.base.client.OpenStackRequest; -import com.woorea.openstack.heat.model.Resources; - - -/** - * v1/​{tenant_id}​/stacks/​{stack_name}​/resources - */ -public class ResourcesResource { - private final OpenStackClient client; - - public ResourcesResource(OpenStackClient client) { - this.client = client; - } - - public ListResources listResources(String name) { - return new ListResources(name); - } - - /** - * v1/​{tenant_id}​/stacks/​{stack_name}​/resources - */ - public class ListResources extends OpenStackRequest4.0.0 ++ +com.woorea +openstack-java-sdk +3.2.2-SNAPSHOT +heat-client +OpenStack Heat Client +OpenStack Heat Client ++ + + +com.woorea +openstack-client +3.2.2-SNAPSHOT ++ +com.woorea +heat-model +3.2.2-SNAPSHOT +{ - public ListResources(String name) { - super(client, HttpMethod.GET, "/stacks/" + name + "/resources", null, Resources.class); - } - } -} +package com.woorea.openstack.heat; + +import com.woorea.openstack.base.client.HttpMethod; +import com.woorea.openstack.base.client.OpenStackClient; +import com.woorea.openstack.base.client.OpenStackRequest; +import com.woorea.openstack.heat.model.Resources; + + +/** + * v1/​{tenant_id}​/stacks/​{stack_name}​/resources + */ +public class ResourcesResource { + private final OpenStackClient client; + + public ResourcesResource(OpenStackClient client) { + this.client = client; + } + + public ListResources listResources(String name) { + return new ListResources(name); + } + + /** + * v1/​{tenant_id}​/stacks/​{stack_name}​/resources + */ + public class ListResources extends OpenStackRequest { + public ListResources(String name) { + super(client, HttpMethod.GET, "/stacks/" + name + "/resources", null, Resources.class); + } + } +} diff --git a/heat-client/src/main/java/com/woorea/openstack/heat/StackResource.java b/heat-client/src/main/java/com/woorea/openstack/heat/StackResource.java index de4577d3c..f30f9f129 100644 --- a/heat-client/src/main/java/com/woorea/openstack/heat/StackResource.java +++ b/heat-client/src/main/java/com/woorea/openstack/heat/StackResource.java @@ -1,61 +1,61 @@ -package com.woorea.openstack.heat; - -import com.woorea.openstack.base.client.Entity; -import com.woorea.openstack.base.client.HttpMethod; -import com.woorea.openstack.base.client.OpenStackClient; -import com.woorea.openstack.base.client.OpenStackRequest; -import com.woorea.openstack.heat.model.CreateStackParam; -import com.woorea.openstack.heat.model.Stack; -import com.woorea.openstack.heat.model.Stacks; - -public class StackResource { - - private final OpenStackClient client; - - public StackResource(OpenStackClient client) { - this.client = client; - } - - public CreateStack create(CreateStackParam param) { - return new CreateStack(param); - } - - public List list() { - return new List(); - } - - public GetStack byName(String name) { - return new GetStack(name); - } - - public DeleteStack deleteByName(String name) { - return new DeleteStack(name); - } - - public class CreateStack extends OpenStackRequest { - public CreateStack(CreateStackParam params) { - super(client, HttpMethod.POST, "/stacks", Entity.json(params), Stack.class); - } - } - - public class DeleteStack extends OpenStackRequest { - public DeleteStack(String name) { - super(client, HttpMethod.DELETE, "/stacks/" + name, null, Void.class); - } - } - - - public class GetStack extends OpenStackRequest { - public GetStack(String name) { - super(client, HttpMethod.GET, "/stacks/" + name, null, Stack.class); - } - } - - public class List extends OpenStackRequest { - public List() { - super(client, HttpMethod.GET, "/stacks", null, Stacks.class); - } - } - - -} +package com.woorea.openstack.heat; + +import com.woorea.openstack.base.client.Entity; +import com.woorea.openstack.base.client.HttpMethod; +import com.woorea.openstack.base.client.OpenStackClient; +import com.woorea.openstack.base.client.OpenStackRequest; +import com.woorea.openstack.heat.model.CreateStackParam; +import com.woorea.openstack.heat.model.Stack; +import com.woorea.openstack.heat.model.Stacks; + +public class StackResource { + + private final OpenStackClient client; + + public StackResource(OpenStackClient client) { + this.client = client; + } + + public CreateStack create(CreateStackParam param) { + return new CreateStack(param); + } + + public List list() { + return new List(); + } + + public GetStack byName(String name) { + return new GetStack(name); + } + + public DeleteStack deleteByName(String name) { + return new DeleteStack(name); + } + + public class CreateStack extends OpenStackRequest { + public CreateStack(CreateStackParam params) { + super(client, HttpMethod.POST, "/stacks", Entity.json(params), Stack.class); + } + } + + public class DeleteStack extends OpenStackRequest { + public DeleteStack(String name) { + super(client, HttpMethod.DELETE, "/stacks/" + name, null, Void.class); + } + } + + + public class GetStack extends OpenStackRequest { + public GetStack(String name) { + super(client, HttpMethod.GET, "/stacks/" + name, null, Stack.class); + } + } + + public class List extends OpenStackRequest { + public List() { + super(client, HttpMethod.GET, "/stacks", null, Stacks.class); + } + } + + +} diff --git a/heat-model/pom.xml b/heat-model/pom.xml index d7fb92148..cfdb182f6 100644 --- a/heat-model/pom.xml +++ b/heat-model/pom.xml @@ -1,11 +1,11 @@ - - 4.0.0 -- -com.woorea -openstack-java-sdk -3.2.2-SNAPSHOT -heat-model -OpenStack Heat Model -OpenStack Heat Model ++ \ No newline at end of file diff --git a/heat-model/src/main/java/com/woorea/openstack/heat/model/CreateStackParam.java b/heat-model/src/main/java/com/woorea/openstack/heat/model/CreateStackParam.java index ebdddfa09..a34d34e86 100644 --- a/heat-model/src/main/java/com/woorea/openstack/heat/model/CreateStackParam.java +++ b/heat-model/src/main/java/com/woorea/openstack/heat/model/CreateStackParam.java @@ -1,100 +1,100 @@ -package com.woorea.openstack.heat.model; - -import org.codehaus.jackson.annotate.JsonProperty; - -import java.util.Map; - -public class CreateStackParam { - @JsonProperty("stack_name") - private String stackName; - - @JsonProperty("template_url") - private String templateUrl; - - @JsonProperty - private String template; - - @JsonProperty("parameters") - private Map4.0.0 ++ +com.woorea +openstack-java-sdk +3.2.2-SNAPSHOT +heat-model +OpenStack Heat Model +OpenStack Heat Model parameters; - - @JsonProperty("timeout_mins") - private int timeoutMinutes; - - @JsonProperty("environment") - private String environment; - - public String getStackName() { - return stackName; - } - - public void setStackName(String stackName) { - this.stackName = stackName; - } - - public String getTemplateUrl() { - return templateUrl; - } - - /** - * The URL of the template to instantiate. This value is ignored if the template is supplied inline. - * - * @param templateUrl a template url. - */ - public void setTemplateUrl(String templateUrl) { - this.templateUrl = templateUrl; - } - - public Map getParameters() { - return parameters; - } - - public String getTemplate() { - return template; - } - - /** - * A JSON template to instantiate. This value takes precedence over the template URL if both are supplied. - * - * @param template a template json. - */ - public void setTemplate(String template) { - this.template = template; - } - - public void setParameters(Map parameters) { - this.parameters = parameters; - } - - public int getTimeoutMinutes() { - return timeoutMinutes; - } - - public void setTimeoutMinutes(int timeoutMinutes) { - this.timeoutMinutes = timeoutMinutes; - } - - public String getEnvironment() { - return environment; - } - - /** - * A JSON environment for the stack. - * - * @param environment a environment. - */ - public void setEnvironment(String environment) { - this.environment = environment; - } - - @Override - public String toString() { - return "CreateStackParam{" + - "stackName='" + stackName + '\'' + - ", templateUrl='" + templateUrl + '\'' + - ", template='" + template + '\'' + - ", parameters=" + parameters + - ", timeoutMinutes=" + timeoutMinutes + - ", environment='" + environment + '\'' + - '}'; - } -} +package com.woorea.openstack.heat.model; + +import java.util.Map; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class CreateStackParam { + @JsonProperty("stack_name") + private String stackName; + + @JsonProperty("template_url") + private String templateUrl; + + @JsonProperty + private String template; + + @JsonProperty("parameters") + private Map parameters; + + @JsonProperty("timeout_mins") + private int timeoutMinutes; + + @JsonProperty("environment") + private String environment; + + public String getStackName() { + return stackName; + } + + public void setStackName(String stackName) { + this.stackName = stackName; + } + + public String getTemplateUrl() { + return templateUrl; + } + + /** + * The URL of the template to instantiate. This value is ignored if the template is supplied inline. + * + * @param templateUrl a template url. + */ + public void setTemplateUrl(String templateUrl) { + this.templateUrl = templateUrl; + } + + public Map getParameters() { + return parameters; + } + + public String getTemplate() { + return template; + } + + /** + * A JSON template to instantiate. This value takes precedence over the template URL if both are supplied. + * + * @param template a template json. + */ + public void setTemplate(String template) { + this.template = template; + } + + public void setParameters(Map parameters) { + this.parameters = parameters; + } + + public int getTimeoutMinutes() { + return timeoutMinutes; + } + + public void setTimeoutMinutes(int timeoutMinutes) { + this.timeoutMinutes = timeoutMinutes; + } + + public String getEnvironment() { + return environment; + } + + /** + * A JSON environment for the stack. + * + * @param environment a environment. + */ + public void setEnvironment(String environment) { + this.environment = environment; + } + + @Override + public String toString() { + return "CreateStackParam{" + + "stackName='" + stackName + '\'' + + ", templateUrl='" + templateUrl + '\'' + + ", template='" + template + '\'' + + ", parameters=" + parameters + + ", timeoutMinutes=" + timeoutMinutes + + ", environment='" + environment + '\'' + + '}'; + } +} diff --git a/heat-model/src/main/java/com/woorea/openstack/heat/model/Explanation.java b/heat-model/src/main/java/com/woorea/openstack/heat/model/Explanation.java index 7e255643a..ae0bbdb07 100644 --- a/heat-model/src/main/java/com/woorea/openstack/heat/model/Explanation.java +++ b/heat-model/src/main/java/com/woorea/openstack/heat/model/Explanation.java @@ -1,28 +1,28 @@ -package com.woorea.openstack.heat.model; - -import org.codehaus.jackson.annotate.JsonProperty; -import org.codehaus.jackson.map.annotate.JsonRootName; - -@JsonRootName("error") -public class Explanation { - @JsonProperty("explanation") - private String explanation; - - @JsonProperty("code") - private int code; - - @JsonRootName("error") - public static class Error { - @JsonProperty("message") - private String message; - - @JsonProperty("traceback") - private String traceback; - - @JsonProperty("type") - private String type; - - @JsonProperty("title") - private String title; - } -} +package com.woorea.openstack.heat.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; + +@JsonRootName("error") +public class Explanation { + @JsonProperty("explanation") + private String explanation; + + @JsonProperty("code") + private int code; + + @JsonRootName("error") + public static class Error { + @JsonProperty("message") + private String message; + + @JsonProperty("traceback") + private String traceback; + + @JsonProperty("type") + private String type; + + @JsonProperty("title") + private String title; + } +} diff --git a/heat-model/src/main/java/com/woorea/openstack/heat/model/Link.java b/heat-model/src/main/java/com/woorea/openstack/heat/model/Link.java index ec1970fd6..b5bf29516 100644 --- a/heat-model/src/main/java/com/woorea/openstack/heat/model/Link.java +++ b/heat-model/src/main/java/com/woorea/openstack/heat/model/Link.java @@ -1,35 +1,35 @@ -package com.woorea.openstack.heat.model; - -import org.codehaus.jackson.annotate.JsonProperty; - -public class Link { - @JsonProperty("href") - private String href; - - @JsonProperty("rel") - private String rel; - - public String getHref() { - return href; - } - - public void setHref(String href) { - this.href = href; - } - - public String getRel() { - return rel; - } - - public void setRel(String rel) { - this.rel = rel; - } - - @Override - public String toString() { - return "Link{" + - "href='" + href + '\'' + - ", rel='" + rel + '\'' + - '}'; - } -} +package com.woorea.openstack.heat.model; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class Link { + @JsonProperty("href") + private String href; + + @JsonProperty("rel") + private String rel; + + public String getHref() { + return href; + } + + public void setHref(String href) { + this.href = href; + } + + public String getRel() { + return rel; + } + + public void setRel(String rel) { + this.rel = rel; + } + + @Override + public String toString() { + return "Link{" + + "href='" + href + '\'' + + ", rel='" + rel + '\'' + + '}'; + } +} diff --git a/heat-model/src/main/java/com/woorea/openstack/heat/model/Resource.java b/heat-model/src/main/java/com/woorea/openstack/heat/model/Resource.java index 159bbcda2..df2d96480 100644 --- a/heat-model/src/main/java/com/woorea/openstack/heat/model/Resource.java +++ b/heat-model/src/main/java/com/woorea/openstack/heat/model/Resource.java @@ -1,122 +1,122 @@ -package com.woorea.openstack.heat.model; - -import org.codehaus.jackson.annotate.JsonProperty; - -import java.util.Date; -import java.util.List; - -public class Resource { - @JsonProperty("resource_name") - private String name; - - @JsonProperty("links") - private List links; - - @JsonProperty("resource_status") - private String status; - - @JsonProperty("physical_resource_id") - private String physicalResourceId; - - @JsonProperty("logical_resource_id") - private String logicalResourceId; - - @JsonProperty("required_by") - private List requiredBy; - - @JsonProperty("updated_time") - private Date updatedTime; - - @JsonProperty("resource_type") - private String type; - - @JsonProperty("resource_status_reason") - private String statusReason; - - public String getStatusReason() { - return statusReason; - } - - public void setStatusReason(String statusReason) { - this.statusReason = statusReason; - } - - public String getLogicalResourceId() { - return logicalResourceId; - } - - public void setLogicalResourceId(String logicalResourceId) { - this.logicalResourceId = logicalResourceId; - } - - public String getStatus() { - return status; - } - - public void setStatus(String status) { - this.status = status; - } - - public String getPhysicalResourceId() { - return physicalResourceId; - } - - public void setPhysicalResourceId(String physicalResourceId) { - this.physicalResourceId = physicalResourceId; - } - - public List getRequiredBy() { - return requiredBy; - } - - public void setRequiredBy(List requiredBy) { - this.requiredBy = requiredBy; - } - - public Date getUpdatedTime() { - return updatedTime; - } - - public void setUpdatedTime(Date updatedTime) { - this.updatedTime = updatedTime; - } - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public List getLinks() { - return links; - } - - public void setLinks(List links) { - this.links = links; - } - - @Override - public String toString() { - return "Resource{" + - "name='" + name + '\'' + - ", links=" + links + - ", status='" + status + '\'' + - ", physicalResourceId='" + physicalResourceId + '\'' + - ", logicalResourceId='" + logicalResourceId + '\'' + - ", requiredBy=" + requiredBy + - ", updatedTime=" + updatedTime + - ", type='" + type + '\'' + - ", statusReason='" + statusReason + '\'' + - '}'; - } -} +package com.woorea.openstack.heat.model; + +import java.util.Date; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class Resource { + @JsonProperty("resource_name") + private String name; + + @JsonProperty("links") + private List links; + + @JsonProperty("resource_status") + private String status; + + @JsonProperty("physical_resource_id") + private String physicalResourceId; + + @JsonProperty("logical_resource_id") + private String logicalResourceId; + + @JsonProperty("required_by") + private List requiredBy; + + @JsonProperty("updated_time") + private Date updatedTime; + + @JsonProperty("resource_type") + private String type; + + @JsonProperty("resource_status_reason") + private String statusReason; + + public String getStatusReason() { + return statusReason; + } + + public void setStatusReason(String statusReason) { + this.statusReason = statusReason; + } + + public String getLogicalResourceId() { + return logicalResourceId; + } + + public void setLogicalResourceId(String logicalResourceId) { + this.logicalResourceId = logicalResourceId; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public String getPhysicalResourceId() { + return physicalResourceId; + } + + public void setPhysicalResourceId(String physicalResourceId) { + this.physicalResourceId = physicalResourceId; + } + + public List getRequiredBy() { + return requiredBy; + } + + public void setRequiredBy(List requiredBy) { + this.requiredBy = requiredBy; + } + + public Date getUpdatedTime() { + return updatedTime; + } + + public void setUpdatedTime(Date updatedTime) { + this.updatedTime = updatedTime; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public List getLinks() { + return links; + } + + public void setLinks(List links) { + this.links = links; + } + + @Override + public String toString() { + return "Resource{" + + "name='" + name + '\'' + + ", links=" + links + + ", status='" + status + '\'' + + ", physicalResourceId='" + physicalResourceId + '\'' + + ", logicalResourceId='" + logicalResourceId + '\'' + + ", requiredBy=" + requiredBy + + ", updatedTime=" + updatedTime + + ", type='" + type + '\'' + + ", statusReason='" + statusReason + '\'' + + '}'; + } +} diff --git a/heat-model/src/main/java/com/woorea/openstack/heat/model/Resources.java b/heat-model/src/main/java/com/woorea/openstack/heat/model/Resources.java index 068c5e08c..e026456b5 100644 --- a/heat-model/src/main/java/com/woorea/openstack/heat/model/Resources.java +++ b/heat-model/src/main/java/com/woorea/openstack/heat/model/Resources.java @@ -1,28 +1,28 @@ -package com.woorea.openstack.heat.model; - -import org.codehaus.jackson.annotate.JsonProperty; - -import java.io.Serializable; -import java.util.Iterator; -import java.util.List; - -public class Resources implements Iterable , Serializable { - @JsonProperty("resources") - private List list; - - public List getList() { - return list; - } - - @Override - public Iterator iterator() { - return list.iterator(); - } - - @Override - public String toString() { - return "Resources{" + - "list=" + list + - '}'; - } +package com.woorea.openstack.heat.model; + +import java.io.Serializable; +import java.util.Iterator; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class Resources implements Iterable , Serializable { + @JsonProperty("resources") + private List list; + + public List getList() { + return list; + } + + @Override + public Iterator iterator() { + return list.iterator(); + } + + @Override + public String toString() { + return "Resources{" + + "list=" + list + + '}'; + } } \ No newline at end of file diff --git a/heat-model/src/main/java/com/woorea/openstack/heat/model/Stack.java b/heat-model/src/main/java/com/woorea/openstack/heat/model/Stack.java index 9ed8f245c..ac66dcc60 100644 --- a/heat-model/src/main/java/com/woorea/openstack/heat/model/Stack.java +++ b/heat-model/src/main/java/com/woorea/openstack/heat/model/Stack.java @@ -1,115 +1,115 @@ -package com.woorea.openstack.heat.model; - -import org.codehaus.jackson.annotate.JsonIgnoreProperties; -import org.codehaus.jackson.annotate.JsonProperty; -import org.codehaus.jackson.map.annotate.JsonRootName; - -import java.util.Date; -import java.util.List; - -@JsonIgnoreProperties(ignoreUnknown = true) -@JsonRootName("stack") -public class Stack { - @JsonProperty("description") - private String description; - - @JsonProperty("links") - private List links; - - @JsonProperty("stack_status_reason") - private String stackStatusReason; - - @JsonProperty("stack_name") - private String stackName; - - @JsonProperty("updated_time") - private Date updatedTime; - - @JsonProperty("creation_time") - private Date creationTime; - - @JsonProperty("stack_status") - private String stackStatus; - - @JsonProperty("id") - private String id; - - public Date getUpdatedTime() { - return updatedTime; - } - - public void setUpdatedTime(Date updatedTime) { - this.updatedTime = updatedTime; - } - - public String getStackStatus() { - return stackStatus; - } - - public void setStackStatus(String stackStatus) { - this.stackStatus = stackStatus; - } - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public Date getCreationTime() { - return creationTime; - } - - public void setCreationTime(Date creationTime) { - this.creationTime = creationTime; - } - - public String getStackName() { - return stackName; - } - - public void setStackName(String stackName) { - this.stackName = stackName; - } - - public String getStackStatusReason() { - return stackStatusReason; - } - - public void setStackStatusReason(String stackStatusReason) { - this.stackStatusReason = stackStatusReason; - } - - public List getLinks() { - return links; - } - - public void setLinks(List links) { - this.links = links; - } - - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - @Override - public String toString() { - return "Stack{" + - "description='" + description + '\'' + - ", links=" + links + - ", stackStatusReason='" + stackStatusReason + '\'' + - ", stackName='" + stackName + '\'' + - ", updatedTime=" + updatedTime + - ", creationTime=" + creationTime + - ", stackStatus='" + stackStatus + '\'' + - ", id='" + id + '\'' + - '}'; - } -} +package com.woorea.openstack.heat.model; + +import java.util.Date; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; + +@JsonIgnoreProperties(ignoreUnknown = true) +@JsonRootName("stack") +public class Stack { + @JsonProperty("description") + private String description; + + @JsonProperty("links") + private List links; + + @JsonProperty("stack_status_reason") + private String stackStatusReason; + + @JsonProperty("stack_name") + private String stackName; + + @JsonProperty("updated_time") + private Date updatedTime; + + @JsonProperty("creation_time") + private Date creationTime; + + @JsonProperty("stack_status") + private String stackStatus; + + @JsonProperty("id") + private String id; + + public Date getUpdatedTime() { + return updatedTime; + } + + public void setUpdatedTime(Date updatedTime) { + this.updatedTime = updatedTime; + } + + public String getStackStatus() { + return stackStatus; + } + + public void setStackStatus(String stackStatus) { + this.stackStatus = stackStatus; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public Date getCreationTime() { + return creationTime; + } + + public void setCreationTime(Date creationTime) { + this.creationTime = creationTime; + } + + public String getStackName() { + return stackName; + } + + public void setStackName(String stackName) { + this.stackName = stackName; + } + + public String getStackStatusReason() { + return stackStatusReason; + } + + public void setStackStatusReason(String stackStatusReason) { + this.stackStatusReason = stackStatusReason; + } + + public List getLinks() { + return links; + } + + public void setLinks(List links) { + this.links = links; + } + + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + @Override + public String toString() { + return "Stack{" + + "description='" + description + '\'' + + ", links=" + links + + ", stackStatusReason='" + stackStatusReason + '\'' + + ", stackName='" + stackName + '\'' + + ", updatedTime=" + updatedTime + + ", creationTime=" + creationTime + + ", stackStatus='" + stackStatus + '\'' + + ", id='" + id + '\'' + + '}'; + } +} diff --git a/heat-model/src/main/java/com/woorea/openstack/heat/model/Stacks.java b/heat-model/src/main/java/com/woorea/openstack/heat/model/Stacks.java index 6f174aa1b..c53b4c4a5 100644 --- a/heat-model/src/main/java/com/woorea/openstack/heat/model/Stacks.java +++ b/heat-model/src/main/java/com/woorea/openstack/heat/model/Stacks.java @@ -1,17 +1,17 @@ -package com.woorea.openstack.heat.model; - -import org.codehaus.jackson.annotate.JsonProperty; - -import java.io.Serializable; -import java.util.Iterator; -import java.util.List; - -public class Stacks implements Iterable , Serializable { - @JsonProperty("stacks") - private List list; - - @Override - public Iterator iterator() { - return list.iterator(); - } -} +package com.woorea.openstack.heat.model; + +import java.io.Serializable; +import java.util.Iterator; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class Stacks implements Iterable , Serializable { + @JsonProperty("stacks") + private List list; + + @Override + public Iterator iterator() { + return list.iterator(); + } +} diff --git a/keystone-client/.gitignore b/keystone-client/.gitignore new file mode 100644 index 000000000..ea8c4bf7f --- /dev/null +++ b/keystone-client/.gitignore @@ -0,0 +1 @@ +/target diff --git a/keystone-client/pom.xml b/keystone-client/pom.xml index 69a46ed43..89ca9fedf 100644 --- a/keystone-client/pom.xml +++ b/keystone-client/pom.xml @@ -1,23 +1,23 @@ - - 4.0.0 -- -com.woorea -openstack-java-sdk -3.2.2-SNAPSHOT -keystone-client -OpenStack Keystone Client -OpenStack Keystone Client -- +- -com.woorea -openstack-client -3.2.2-SNAPSHOT -- -com.woorea -keystone-model -3.2.2-SNAPSHOT -+ \ No newline at end of file diff --git a/keystone-client/src/main/java/com/woorea/openstack/keystone/Keystone.java b/keystone-client/src/main/java/com/woorea/openstack/keystone/Keystone.java index 38d42f001..670cb4d4a 100644 --- a/keystone-client/src/main/java/com/woorea/openstack/keystone/Keystone.java +++ b/keystone-client/src/main/java/com/woorea/openstack/keystone/Keystone.java @@ -1,65 +1,64 @@ -package com.woorea.openstack.keystone; - -import com.woorea.openstack.keystone.api.EndpointsResource; -import com.woorea.openstack.keystone.api.RolesResource; -import com.woorea.openstack.keystone.api.ServicesResource; -import com.woorea.openstack.keystone.api.TenantsResource; -import com.woorea.openstack.keystone.api.TokensResource; -import com.woorea.openstack.keystone.api.UsersResource; - -import com.woorea.openstack.base.client.OpenStackClient; -import com.woorea.openstack.base.client.OpenStackClientConnector; - -public class Keystone extends OpenStackClient { - - private final TokensResource TOKENS; - - private final TenantsResource TENANTS; - - private final UsersResource USERS; - - private final RolesResource ROLES; - - private final ServicesResource SERVICES; - - private final EndpointsResource ENDPOINTS; - - public Keystone(String endpoint, OpenStackClientConnector connector) { - super(endpoint, connector); - TOKENS = new TokensResource(this); - TENANTS = new TenantsResource(this); - USERS = new UsersResource(this); - ROLES = new RolesResource(this); - SERVICES = new ServicesResource(this); - ENDPOINTS = new EndpointsResource(this); - } - - public Keystone(String endpoint) { - this(endpoint, null); - } - - public TokensResource tokens() { - return TOKENS; - } - - public TenantsResource tenants() { - return TENANTS; - } - - public UsersResource users() { - return USERS; - } - - public RolesResource roles() { - return ROLES; - } - - public ServicesResource services() { - return SERVICES; - } - - public EndpointsResource endpoints() { - return ENDPOINTS; - } - -} +package com.woorea.openstack.keystone; + +import com.woorea.openstack.base.client.OpenStackClient; +import com.woorea.openstack.base.client.OpenStackClientConnector; +import com.woorea.openstack.keystone.api.EndpointsResource; +import com.woorea.openstack.keystone.api.RolesResource; +import com.woorea.openstack.keystone.api.ServicesResource; +import com.woorea.openstack.keystone.api.TenantsResource; +import com.woorea.openstack.keystone.api.TokensResource; +import com.woorea.openstack.keystone.api.UsersResource; + +public class Keystone extends OpenStackClient { + + private final TokensResource TOKENS; + + private final TenantsResource TENANTS; + + private final UsersResource USERS; + + private final RolesResource ROLES; + + private final ServicesResource SERVICES; + + private final EndpointsResource ENDPOINTS; + + public Keystone(String endpoint, OpenStackClientConnector connector) { + super(endpoint, connector); + TOKENS = new TokensResource(this); + TENANTS = new TenantsResource(this); + USERS = new UsersResource(this); + ROLES = new RolesResource(this); + SERVICES = new ServicesResource(this); + ENDPOINTS = new EndpointsResource(this); + } + + public Keystone(String endpoint) { + this(endpoint, null); + } + + public TokensResource tokens() { + return TOKENS; + } + + public TenantsResource tenants() { + return TENANTS; + } + + public UsersResource users() { + return USERS; + } + + public RolesResource roles() { + return ROLES; + } + + public ServicesResource services() { + return SERVICES; + } + + public EndpointsResource endpoints() { + return ENDPOINTS; + } + +} diff --git a/keystone-client/src/main/java/com/woorea/openstack/keystone/api/EndpointsResource.java b/keystone-client/src/main/java/com/woorea/openstack/keystone/api/EndpointsResource.java index acc128b89..a1600b7f5 100644 --- a/keystone-client/src/main/java/com/woorea/openstack/keystone/api/EndpointsResource.java +++ b/keystone-client/src/main/java/com/woorea/openstack/keystone/api/EndpointsResource.java @@ -1,71 +1,71 @@ -package com.woorea.openstack.keystone.api; - - -import com.woorea.openstack.base.client.Entity; -import com.woorea.openstack.base.client.HttpMethod; -import com.woorea.openstack.base.client.OpenStackClient; -import com.woorea.openstack.base.client.OpenStackRequest; -import com.woorea.openstack.keystone.model.Endpoint; -import com.woorea.openstack.keystone.model.Endpoints; - -public class EndpointsResource { - - private OpenStackClient client; - - public EndpointsResource(OpenStackClient client) { - this.client = client; - } - - public List list() { - return new List(); - } - - public Create create(Endpoint endpoint) { - return new Create(endpoint); - } - - public Show show(String id) { - return new Show(id); - } - - - public Delete delete(String id) { - return new Delete(id); - } - - public class List extends OpenStackRequest4.0.0 ++ +com.woorea +openstack-java-sdk +3.2.2-SNAPSHOT +keystone-client +OpenStack Keystone Client +OpenStack Keystone Client ++ + +com.woorea +openstack-client +3.2.2-SNAPSHOT ++ +com.woorea +keystone-model +3.2.2-SNAPSHOT +{ - - public List() { - super(client, HttpMethod.GET, "/endpoints", null, Endpoints.class); - } - - } - - public class Create extends OpenStackRequest { - - private Endpoint endpoint; - - public Create(Endpoint endpoint) { - super(client, HttpMethod.POST, "/endpoints", Entity.json(endpoint), Endpoint.class); - this.endpoint = endpoint; - } - - } - - public class Show extends OpenStackRequest { - - public Show(String id) { - super(client, HttpMethod.GET, new StringBuilder("/endpoints/").append(id).toString(), null, Endpoint.class); - } - - } - - public class Delete extends OpenStackRequest { - - public Delete(String id) { - super(client, HttpMethod.DELETE, new StringBuilder("/endpoints/").append(id).toString(), null, Void.class); - } - - } - -} +package com.woorea.openstack.keystone.api; + + +import com.woorea.openstack.base.client.Entity; +import com.woorea.openstack.base.client.HttpMethod; +import com.woorea.openstack.base.client.OpenStackClient; +import com.woorea.openstack.base.client.OpenStackRequest; +import com.woorea.openstack.keystone.model.Endpoint; +import com.woorea.openstack.keystone.model.Endpoints; + +public class EndpointsResource { + + private OpenStackClient client; + + public EndpointsResource(OpenStackClient client) { + this.client = client; + } + + public List list() { + return new List(); + } + + public Create create(Endpoint endpoint) { + return new Create(endpoint); + } + + public Show show(String id) { + return new Show(id); + } + + + public Delete delete(String id) { + return new Delete(id); + } + + public class List extends OpenStackRequest { + + public List() { + super(client, HttpMethod.GET, "/endpoints", null, Endpoints.class); + } + + } + + public class Create extends OpenStackRequest { + + private Endpoint endpoint; + + public Create(Endpoint endpoint) { + super(client, HttpMethod.POST, "/endpoints", Entity.json(endpoint), Endpoint.class); + this.endpoint = endpoint; + } + + } + + public class Show extends OpenStackRequest { + + public Show(String id) { + super(client, HttpMethod.GET, new StringBuilder("/endpoints/").append(id).toString(), null, Endpoint.class); + } + + } + + public class Delete extends OpenStackRequest { + + public Delete(String id) { + super(client, HttpMethod.DELETE, new StringBuilder("/endpoints/").append(id).toString(), null, Void.class); + } + + } + +} diff --git a/keystone-client/src/main/java/com/woorea/openstack/keystone/api/RolesResource.java b/keystone-client/src/main/java/com/woorea/openstack/keystone/api/RolesResource.java index d39dc770e..94593bb43 100644 --- a/keystone-client/src/main/java/com/woorea/openstack/keystone/api/RolesResource.java +++ b/keystone-client/src/main/java/com/woorea/openstack/keystone/api/RolesResource.java @@ -1,58 +1,58 @@ -package com.woorea.openstack.keystone.api; - - -import com.woorea.openstack.base.client.Entity; -import com.woorea.openstack.base.client.HttpMethod; -import com.woorea.openstack.base.client.OpenStackClient; -import com.woorea.openstack.base.client.OpenStackRequest; -import com.woorea.openstack.keystone.model.Role; -import com.woorea.openstack.keystone.model.Roles; - -public class RolesResource { - - private OpenStackClient client; - - public RolesResource(OpenStackClient client) { - this.client = client; - } - - public List list() { - return new List(); - } - - public Create create(Role role) { - return new Create(role); - } - - public Delete delete(String id) { - return new Delete(id); - } - - public class List extends OpenStackRequest { - - public List() { - super(client, HttpMethod.GET, "/OS-KSADM/roles", null, Roles.class); - } - - } - - public class Create extends OpenStackRequest { - - private Role role; - - public Create(Role role) { - super(client, HttpMethod.POST, "/OS-KSADM/roles", Entity.json(role), Role.class); - this.role = role; - } - - } - - public class Delete extends OpenStackRequest { - - public Delete(String id) { - super(client, HttpMethod.DELETE, new StringBuilder("/OS-KSADM/roles/").append(id).toString(), null, Void.class); - } - - } - -} +package com.woorea.openstack.keystone.api; + + +import com.woorea.openstack.base.client.Entity; +import com.woorea.openstack.base.client.HttpMethod; +import com.woorea.openstack.base.client.OpenStackClient; +import com.woorea.openstack.base.client.OpenStackRequest; +import com.woorea.openstack.keystone.model.Role; +import com.woorea.openstack.keystone.model.Roles; + +public class RolesResource { + + private OpenStackClient client; + + public RolesResource(OpenStackClient client) { + this.client = client; + } + + public List list() { + return new List(); + } + + public Create create(Role role) { + return new Create(role); + } + + public Delete delete(String id) { + return new Delete(id); + } + + public class List extends OpenStackRequest { + + public List() { + super(client, HttpMethod.GET, "/OS-KSADM/roles", null, Roles.class); + } + + } + + public class Create extends OpenStackRequest { + + private Role role; + + public Create(Role role) { + super(client, HttpMethod.POST, "/OS-KSADM/roles", Entity.json(role), Role.class); + this.role = role; + } + + } + + public class Delete extends OpenStackRequest { + + public Delete(String id) { + super(client, HttpMethod.DELETE, new StringBuilder("/OS-KSADM/roles/").append(id).toString(), null, Void.class); + } + + } + +} diff --git a/keystone-client/src/main/java/com/woorea/openstack/keystone/api/ServicesResource.java b/keystone-client/src/main/java/com/woorea/openstack/keystone/api/ServicesResource.java index 5b1893974..a3a6a27d4 100644 --- a/keystone-client/src/main/java/com/woorea/openstack/keystone/api/ServicesResource.java +++ b/keystone-client/src/main/java/com/woorea/openstack/keystone/api/ServicesResource.java @@ -1,70 +1,70 @@ -package com.woorea.openstack.keystone.api; - - -import com.woorea.openstack.base.client.Entity; -import com.woorea.openstack.base.client.HttpMethod; -import com.woorea.openstack.base.client.OpenStackClient; -import com.woorea.openstack.base.client.OpenStackRequest; -import com.woorea.openstack.keystone.model.Service; -import com.woorea.openstack.keystone.model.Services; - -public class ServicesResource { - - private OpenStackClient client; - - public ServicesResource(OpenStackClient client) { - this.client = client; - } - - public List list() { - return new List(); - } - - public Create create(Service service) { - return new Create(service); - } - - public Show show(String id) { - return new Show(id); - } - - public Delete delete(String id) { - return new Delete(id); - } - - public class List extends OpenStackRequest { - - public List() { - super(client, HttpMethod.GET, "/OS-KSADM/services", null, Services.class); - } - - } - - public class Create extends OpenStackRequest { - - private Service service; - - public Create(Service service) { - super(client, HttpMethod.POST, "/OS-KSADM/services", Entity.json(service), Service.class); - this.service = service; - } - - } - - public class Show extends OpenStackRequest { - - public Show(String id) { - super(client, HttpMethod.GET, new StringBuilder("/OS-KSADM/services/").append(id).toString(), null, Service.class); - } - - } - - public class Delete extends OpenStackRequest { - - public Delete(String id) { - super(client, HttpMethod.DELETE, new StringBuilder("/OS-KSADM/services/").append(id).toString(), null, Void.class); - } - - } - -} +package com.woorea.openstack.keystone.api; + + +import com.woorea.openstack.base.client.Entity; +import com.woorea.openstack.base.client.HttpMethod; +import com.woorea.openstack.base.client.OpenStackClient; +import com.woorea.openstack.base.client.OpenStackRequest; +import com.woorea.openstack.keystone.model.Service; +import com.woorea.openstack.keystone.model.Services; + +public class ServicesResource { + + private OpenStackClient client; + + public ServicesResource(OpenStackClient client) { + this.client = client; + } + + public List list() { + return new List(); + } + + public Create create(Service service) { + return new Create(service); + } + + public Show show(String id) { + return new Show(id); + } + + public Delete delete(String id) { + return new Delete(id); + } + + public class List extends OpenStackRequest { + + public List() { + super(client, HttpMethod.GET, "/OS-KSADM/services", null, Services.class); + } + + } + + public class Create extends OpenStackRequest { + + private Service service; + + public Create(Service service) { + super(client, HttpMethod.POST, "/OS-KSADM/services", Entity.json(service), Service.class); + this.service = service; + } + + } + + public class Show extends OpenStackRequest { + + public Show(String id) { + super(client, HttpMethod.GET, new StringBuilder("/OS-KSADM/services/").append(id).toString(), null, Service.class); + } + + } + + public class Delete extends OpenStackRequest { + + public Delete(String id) { + super(client, HttpMethod.DELETE, new StringBuilder("/OS-KSADM/services/").append(id).toString(), null, Void.class); + } + + } + +} diff --git a/keystone-client/src/main/java/com/woorea/openstack/keystone/api/TenantsResource.java b/keystone-client/src/main/java/com/woorea/openstack/keystone/api/TenantsResource.java index 24a91f62f..443e111ad 100644 --- a/keystone-client/src/main/java/com/woorea/openstack/keystone/api/TenantsResource.java +++ b/keystone-client/src/main/java/com/woorea/openstack/keystone/api/TenantsResource.java @@ -1,135 +1,135 @@ -package com.woorea.openstack.keystone.api; - - -import com.woorea.openstack.base.client.Entity; -import com.woorea.openstack.base.client.HttpMethod; -import com.woorea.openstack.base.client.OpenStackClient; -import com.woorea.openstack.base.client.OpenStackRequest; -import com.woorea.openstack.keystone.model.Roles; -import com.woorea.openstack.keystone.model.Tenant; -import com.woorea.openstack.keystone.model.Tenants; -import com.woorea.openstack.keystone.model.Users; - -public class TenantsResource { - - private OpenStackClient client; - - public TenantsResource(OpenStackClient client) { - this.client = client; - } - - public List list() { - return new List(); - } - - public Create create(Tenant tenant) { - return new Create(tenant); - } - - public Show show(String id) { - return new Show(id); - } - - public Update update(String id, Tenant tenant) { - return new Update(id, tenant); - } - - public Delete delete(String id) { - return new Delete(id); - } - - public ListUsers listUsers(String tenantId) { - return new ListUsers(tenantId); - } - - public AddUser addUser(String tenantId, String userId, String roleId) { - return new AddUser(tenantId, userId, roleId); - } - - public RemoveUser removeUser(String tenantId, String userId, String roleId) { - return new RemoveUser(tenantId, userId, roleId); - } - - public ListUserRoles listUserRoles(String tenantId, String userId) { - return new ListUserRoles(tenantId, userId); - } - - public class List extends OpenStackRequest { - - public List() { - super(client, HttpMethod.GET, "/tenants", null, Tenants.class); - } - - } - - public class Create extends OpenStackRequest { - - private Tenant tenant; - - public Create(Tenant tenant) { - super(client, HttpMethod.POST, "/tenants", Entity.json(tenant), Tenant.class); - this.tenant = tenant; - } - - } - - public class Show extends OpenStackRequest { - - public Show(String id) { - super(client, HttpMethod.GET, new StringBuilder("/tenants/").append(id).toString(), null, Tenant.class); - } - - } - - public class Update extends OpenStackRequest { - - private Tenant tenant; - - public Update(String id, Tenant tenant) { - super(client, HttpMethod.PUT, new StringBuilder("/tenants/").append(id).toString(), Entity.json(tenant), Tenant.class); - this.tenant = tenant; - } - - } - - public class Delete extends OpenStackRequest { - - public Delete(String id) { - super(client, HttpMethod.DELETE, new StringBuilder("/tenants/").append(id).toString(), null, Void.class); - } - - } - - public class ListUsers extends OpenStackRequest { - - public ListUsers(String tenantId) { - super(client, HttpMethod.GET, new StringBuilder("/tenants/").append(tenantId).append("/users").toString(), null, Users.class); - } - - } - - public class AddUser extends OpenStackRequest { - - public AddUser(String tenantId, String userId, String roleId) { - super(client, HttpMethod.PUT, new StringBuilder("/tenants/").append(tenantId).append("/users/").append(userId).append("/roles/OS-KSADM/").append(roleId).toString(), null, Void.class); - } - - } - - public class RemoveUser extends OpenStackRequest { - - public RemoveUser(String tenantId, String userId, String roleId) { - super(client, HttpMethod.DELETE, new StringBuilder("/tenants/").append(tenantId).append("/users/").append(userId).append("/roles/OS-KSADM/").append(roleId).toString(), null, Void.class); - } - - } - - public class ListUserRoles extends OpenStackRequest { - - public ListUserRoles(String tenantId, String userId) { - super(client, HttpMethod.GET, new StringBuilder("/tenants/").append(tenantId).append("/users/").append(userId).append("/roles").toString(), null, Roles.class); - } - - } - -} +package com.woorea.openstack.keystone.api; + + +import com.woorea.openstack.base.client.Entity; +import com.woorea.openstack.base.client.HttpMethod; +import com.woorea.openstack.base.client.OpenStackClient; +import com.woorea.openstack.base.client.OpenStackRequest; +import com.woorea.openstack.keystone.model.Roles; +import com.woorea.openstack.keystone.model.Tenant; +import com.woorea.openstack.keystone.model.Tenants; +import com.woorea.openstack.keystone.model.Users; + +public class TenantsResource { + + private OpenStackClient client; + + public TenantsResource(OpenStackClient client) { + this.client = client; + } + + public List list() { + return new List(); + } + + public Create create(Tenant tenant) { + return new Create(tenant); + } + + public Show show(String id) { + return new Show(id); + } + + public Update update(String id, Tenant tenant) { + return new Update(id, tenant); + } + + public Delete delete(String id) { + return new Delete(id); + } + + public ListUsers listUsers(String tenantId) { + return new ListUsers(tenantId); + } + + public AddUser addUser(String tenantId, String userId, String roleId) { + return new AddUser(tenantId, userId, roleId); + } + + public RemoveUser removeUser(String tenantId, String userId, String roleId) { + return new RemoveUser(tenantId, userId, roleId); + } + + public ListUserRoles listUserRoles(String tenantId, String userId) { + return new ListUserRoles(tenantId, userId); + } + + public class List extends OpenStackRequest { + + public List() { + super(client, HttpMethod.GET, "/tenants", null, Tenants.class); + } + + } + + public class Create extends OpenStackRequest { + + private Tenant tenant; + + public Create(Tenant tenant) { + super(client, HttpMethod.POST, "/tenants", Entity.json(tenant), Tenant.class); + this.tenant = tenant; + } + + } + + public class Show extends OpenStackRequest { + + public Show(String id) { + super(client, HttpMethod.GET, new StringBuilder("/tenants/").append(id).toString(), null, Tenant.class); + } + + } + + public class Update extends OpenStackRequest { + + private Tenant tenant; + + public Update(String id, Tenant tenant) { + super(client, HttpMethod.PUT, new StringBuilder("/tenants/").append(id).toString(), Entity.json(tenant), Tenant.class); + this.tenant = tenant; + } + + } + + public class Delete extends OpenStackRequest { + + public Delete(String id) { + super(client, HttpMethod.DELETE, new StringBuilder("/tenants/").append(id).toString(), null, Void.class); + } + + } + + public class ListUsers extends OpenStackRequest { + + public ListUsers(String tenantId) { + super(client, HttpMethod.GET, new StringBuilder("/tenants/").append(tenantId).append("/users").toString(), null, Users.class); + } + + } + + public class AddUser extends OpenStackRequest { + + public AddUser(String tenantId, String userId, String roleId) { + super(client, HttpMethod.PUT, new StringBuilder("/tenants/").append(tenantId).append("/users/").append(userId).append("/roles/OS-KSADM/").append(roleId).toString(), null, Void.class); + } + + } + + public class RemoveUser extends OpenStackRequest { + + public RemoveUser(String tenantId, String userId, String roleId) { + super(client, HttpMethod.DELETE, new StringBuilder("/tenants/").append(tenantId).append("/users/").append(userId).append("/roles/OS-KSADM/").append(roleId).toString(), null, Void.class); + } + + } + + public class ListUserRoles extends OpenStackRequest { + + public ListUserRoles(String tenantId, String userId) { + super(client, HttpMethod.GET, new StringBuilder("/tenants/").append(tenantId).append("/users/").append(userId).append("/roles").toString(), null, Roles.class); + } + + } + +} diff --git a/keystone-client/src/main/java/com/woorea/openstack/keystone/api/TokensResource.java b/keystone-client/src/main/java/com/woorea/openstack/keystone/api/TokensResource.java index b9f1cfc88..fd72ccb9f 100644 --- a/keystone-client/src/main/java/com/woorea/openstack/keystone/api/TokensResource.java +++ b/keystone-client/src/main/java/com/woorea/openstack/keystone/api/TokensResource.java @@ -1,74 +1,74 @@ -package com.woorea.openstack.keystone.api; - - -import com.woorea.openstack.base.client.Entity; -import com.woorea.openstack.base.client.HttpMethod; -import com.woorea.openstack.base.client.OpenStackClient; -import com.woorea.openstack.base.client.OpenStackRequest; -import com.woorea.openstack.keystone.model.Access; -import com.woorea.openstack.keystone.model.Authentication; -import com.woorea.openstack.keystone.model.authentication.AccessKey; -import com.woorea.openstack.keystone.model.authentication.TokenAuthentication; -import com.woorea.openstack.keystone.model.authentication.UsernamePassword; - -public class TokensResource { - - private final OpenStackClient CLIENT; - - public TokensResource(OpenStackClient client) { - CLIENT = client; - } - - public Authenticate.Builder authenticate() { - return new Authenticate().new Builder(); - } - - public Authenticate authenticate(Authentication authentication) { - return new Authenticate(authentication); - } - - public class Authenticate extends OpenStackRequest { - - private Authentication authentication; - - public Authenticate() { - - } - - public Authenticate(Authentication authentication) { - super(CLIENT, HttpMethod.POST, "/tokens", Entity.json(authentication), Access.class); - this.authentication = authentication; - } - - public Authenticate withTenantId(String tenantId) { - authentication.setTenantId(tenantId); - return this; - } - - public Authenticate withTenantName(String tenantName) { - authentication.setTenantName(tenantName); - return this; - } - - public class Builder { - - public Authenticate withUsernamePassword(String username, String password) { - Authentication authentication = new UsernamePassword(username, password); - return new Authenticate(authentication); - } - - public Authenticate withToken(String token) { - Authentication authentication = new TokenAuthentication(token); - return new Authenticate(authentication); - } - - public Authenticate withAccessKey(String accessKey, String secretKey) { - Authentication authentication = new AccessKey(accessKey, secretKey); - return new Authenticate(authentication); - } - - } - - } - -} +package com.woorea.openstack.keystone.api; + + +import com.woorea.openstack.base.client.Entity; +import com.woorea.openstack.base.client.HttpMethod; +import com.woorea.openstack.base.client.OpenStackClient; +import com.woorea.openstack.base.client.OpenStackRequest; +import com.woorea.openstack.keystone.model.Access; +import com.woorea.openstack.keystone.model.Authentication; +import com.woorea.openstack.keystone.model.authentication.AccessKey; +import com.woorea.openstack.keystone.model.authentication.TokenAuthentication; +import com.woorea.openstack.keystone.model.authentication.UsernamePassword; + +public class TokensResource { + + private final OpenStackClient CLIENT; + + public TokensResource(OpenStackClient client) { + CLIENT = client; + } + + public Authenticate.Builder authenticate() { + return new Authenticate().new Builder(); + } + + public Authenticate authenticate(Authentication authentication) { + return new Authenticate(authentication); + } + + public class Authenticate extends OpenStackRequest { + + private Authentication authentication; + + public Authenticate() { + + } + + public Authenticate(Authentication authentication) { + super(CLIENT, HttpMethod.POST, "/tokens", Entity.json(authentication), Access.class); + this.authentication = authentication; + } + + public Authenticate withTenantId(String tenantId) { + authentication.setTenantId(tenantId); + return this; + } + + public Authenticate withTenantName(String tenantName) { + authentication.setTenantName(tenantName); + return this; + } + + public class Builder { + + public Authenticate withUsernamePassword(String username, String password) { + Authentication authentication = new UsernamePassword(username, password); + return new Authenticate(authentication); + } + + public Authenticate withToken(String token) { + Authentication authentication = new TokenAuthentication(token); + return new Authenticate(authentication); + } + + public Authenticate withAccessKey(String accessKey, String secretKey) { + Authentication authentication = new AccessKey(accessKey, secretKey); + return new Authenticate(authentication); + } + + } + + } + +} diff --git a/keystone-client/src/main/java/com/woorea/openstack/keystone/api/UsersResource.java b/keystone-client/src/main/java/com/woorea/openstack/keystone/api/UsersResource.java index dbb897cf5..735dcead2 100644 --- a/keystone-client/src/main/java/com/woorea/openstack/keystone/api/UsersResource.java +++ b/keystone-client/src/main/java/com/woorea/openstack/keystone/api/UsersResource.java @@ -1,5 +1,7 @@ package com.woorea.openstack.keystone.api; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; import com.woorea.openstack.base.client.Entity; import com.woorea.openstack.base.client.HttpMethod; @@ -8,78 +10,88 @@ import com.woorea.openstack.keystone.model.User; import com.woorea.openstack.keystone.model.Users; + + public class UsersResource { - - private OpenStackClient client; - - public UsersResource(OpenStackClient client) { - this.client = client; - } - - public List list() { - return new List(); - } - - public Create create(User user) { - return new Create(user); - } - - public Show show(String id) { - return new Show(id); - } - - public Update update(String id, User user) { - return new Update(id, user); - } - - public Delete delete(String id) { - return new Delete(id); - } - - public class List extends OpenStackRequest { - - public List() { - super(client, HttpMethod.GET, "/users", null, Users.class); - } - - } - - public class Create extends OpenStackRequest { - - private User user; - - public Create(User user) { - super(client, HttpMethod.POST, "/users", Entity.json(user), User.class); - this.user = user; - } - - } - - public class Show extends OpenStackRequest { - - public Show(String id) { - super(client, HttpMethod.GET, new StringBuilder("/users/").append(id).toString(), null, User.class); - } - - } - - public class Update extends OpenStackRequest { - - private User user; - - public Update(String id, User user) { - super(client, HttpMethod.PUT, new StringBuilder("/users/").append(id).toString(), Entity.json(user), User.class); - this.user = user; - } - - } - - public class Delete extends OpenStackRequest { - - public Delete(String id) { - super(client, HttpMethod.DELETE, new StringBuilder("/users/").append(id).toString(), null, Void.class); - } - - } - + private OpenStackClient client; + + public UsersResource(OpenStackClient client) { + this.client = client; + } + + public List list() { + return new List(); + } + + public Create create(User user) { + return new Create(user); + } + + public Show show(String id) { + return new Show(id); + } + + public Find find(String username) { + return new Find(username); + } + + public Update update(String id, User user) { + return new Update(id, user); + } + + public Delete delete(String id) { + return new Delete(id); + } + + public class List extends OpenStackRequest { + public List() { + super(client, HttpMethod.GET, "/users", null, Users.class); + } + } + + public class Create extends OpenStackRequest { + public Create(User user) { + super(client, HttpMethod.POST, "/users/", Entity.json(user), + User.class); + } + } + public class Show extends OpenStackRequest { + public Show(String id) { + super(client, HttpMethod.GET, + new StringBuilder("/users/").append(id).toString(), null, + User.class); + } + } + + public class Find extends OpenStackRequest { + public Find(String username) { + super(client, HttpMethod.GET, new StringBuilder("/users/"), null, + User.class); + + try { + this.queryParam("name", URLEncoder.encode(username, "UTF-8")); + } catch (UnsupportedEncodingException e) { + //ignore + } + } + } + + public class Update extends OpenStackRequest { + private User user; + + public Update(String id, User user) { + super(client, HttpMethod.PUT, + new StringBuilder("/users/").append(id).toString(), + Entity.json(user), User.class); + this.user = user; + } + } + + public class Delete extends OpenStackRequest { + public Delete(String id) { + super(client, HttpMethod.DELETE, + new StringBuilder("/users/").append(id).toString(), null, + Void.class); + } + } } diff --git a/keystone-client/src/main/java/com/woorea/openstack/keystone/utils/KeystoneTokenProvider.java b/keystone-client/src/main/java/com/woorea/openstack/keystone/utils/KeystoneTokenProvider.java index fb5127abe..e7e1deae0 100644 --- a/keystone-client/src/main/java/com/woorea/openstack/keystone/utils/KeystoneTokenProvider.java +++ b/keystone-client/src/main/java/com/woorea/openstack/keystone/utils/KeystoneTokenProvider.java @@ -1,56 +1,56 @@ -package com.woorea.openstack.keystone.utils; - -import java.util.concurrent.ConcurrentHashMap; - -import com.woorea.openstack.base.client.OpenStackTokenProvider; -import com.woorea.openstack.keystone.Keystone; -import com.woorea.openstack.keystone.model.Access; -import com.woorea.openstack.keystone.model.authentication.UsernamePassword; - -public class KeystoneTokenProvider { - - protected Keystone keystone; - - protected String username; - - protected String password; - - ConcurrentHashMap hashTenantAccess; - - public KeystoneTokenProvider(String endpoint, String username, String password) { - this.keystone = new Keystone(endpoint); - this.username = username; - this.password = password; - this.hashTenantAccess = new ConcurrentHashMap (); - } - - public Access getAccessByTenant(String tenantName) { - Access access = hashTenantAccess.get(tenantName); - if (access == null) { - access = keystone.tokens().authenticate(new UsernamePassword(username, password)) - .withTenantName(tenantName) - .execute(); - hashTenantAccess.put(tenantName, access); - } - return access; - } - - public void expireAccessByTenant(String tenantName) { - hashTenantAccess.remove(tenantName); - } - - public OpenStackTokenProvider getProviderByTenant(final String tenantName) { - final KeystoneTokenProvider keystoneTokenProvider = this; - return new OpenStackTokenProvider() { - @Override - public String getToken() { - return keystoneTokenProvider.getAccessByTenant(tenantName) - .getToken().getId(); - } - @Override - public void expireToken() { - keystoneTokenProvider.expireAccessByTenant(tenantName); - } - }; - } -} +package com.woorea.openstack.keystone.utils; + +import java.util.concurrent.ConcurrentHashMap; + +import com.woorea.openstack.base.client.OpenStackTokenProvider; +import com.woorea.openstack.keystone.Keystone; +import com.woorea.openstack.keystone.model.Access; +import com.woorea.openstack.keystone.model.authentication.UsernamePassword; + +public class KeystoneTokenProvider { + + protected Keystone keystone; + + protected String username; + + protected String password; + + ConcurrentHashMap hashTenantAccess; + + public KeystoneTokenProvider(String endpoint, String username, String password) { + this.keystone = new Keystone(endpoint); + this.username = username; + this.password = password; + this.hashTenantAccess = new ConcurrentHashMap (); + } + + public Access getAccessByTenant(String tenantName) { + Access access = hashTenantAccess.get(tenantName); + if (access == null) { + access = keystone.tokens().authenticate(new UsernamePassword(username, password)) + .withTenantName(tenantName) + .execute(); + hashTenantAccess.put(tenantName, access); + } + return access; + } + + public void expireAccessByTenant(String tenantName) { + hashTenantAccess.remove(tenantName); + } + + public OpenStackTokenProvider getProviderByTenant(final String tenantName) { + final KeystoneTokenProvider keystoneTokenProvider = this; + return new OpenStackTokenProvider() { + @Override + public String getToken() { + return keystoneTokenProvider.getAccessByTenant(tenantName) + .getToken().getId(); + } + @Override + public void expireToken() { + keystoneTokenProvider.expireAccessByTenant(tenantName); + } + }; + } +} diff --git a/keystone-client/src/main/java/com/woorea/openstack/keystone/utils/KeystoneUtils.java b/keystone-client/src/main/java/com/woorea/openstack/keystone/utils/KeystoneUtils.java index 8269597db..e679af6d6 100644 --- a/keystone-client/src/main/java/com/woorea/openstack/keystone/utils/KeystoneUtils.java +++ b/keystone-client/src/main/java/com/woorea/openstack/keystone/utils/KeystoneUtils.java @@ -1,28 +1,28 @@ -package com.woorea.openstack.keystone.utils; - -import java.util.List; - -import com.woorea.openstack.keystone.model.Access.Service; - -public class KeystoneUtils { - - public static String findEndpointURL(List serviceCatalog, String type, String region, String facing) { - for(Service service : serviceCatalog) { - if(type.equals(service.getType())) { - for(Service.Endpoint endpoint : service.getEndpoints()) { - if(region == null || region.equals(endpoint.getRegion())) { - if(endpoint.getPublicURL() != null && facing.equals("public")) { - return endpoint.getPublicURL(); - } else if(endpoint.getInternalURL() != null && facing.equals("internal")) { - return endpoint.getInternalURL(); - } else if(endpoint.getAdminURL() != null && facing.equals("admin")) { - return endpoint.getAdminURL(); - } - } - } - } - } - throw new RuntimeException("endpoint url not found"); - } - -} +package com.woorea.openstack.keystone.utils; + +import java.util.List; + +import com.woorea.openstack.keystone.model.Access.Service; + +public class KeystoneUtils { + + public static String findEndpointURL(List serviceCatalog, String type, String region, String facing) { + for(Service service : serviceCatalog) { + if(type.equals(service.getType())) { + for(Service.Endpoint endpoint : service.getEndpoints()) { + if(region == null || region.equals(endpoint.getRegion())) { + if(endpoint.getPublicURL() != null && facing.equals("public")) { + return endpoint.getPublicURL(); + } else if(endpoint.getInternalURL() != null && facing.equals("internal")) { + return endpoint.getInternalURL(); + } else if(endpoint.getAdminURL() != null && facing.equals("admin")) { + return endpoint.getAdminURL(); + } + } + } + } + } + throw new RuntimeException("endpoint url not found"); + } + +} diff --git a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/Keystone.java b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/Keystone.java index 6ff889cb5..fe6383c7a 100644 --- a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/Keystone.java +++ b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/Keystone.java @@ -1,73 +1,73 @@ -package com.woorea.openstack.keystone.v3; - -import com.woorea.openstack.keystone.v3.api.DomainsResource; -import com.woorea.openstack.keystone.v3.api.EndpointsResource; -import com.woorea.openstack.keystone.v3.api.RolesResource; -import com.woorea.openstack.keystone.v3.api.ServicesResource; -import com.woorea.openstack.keystone.v3.api.ProjectsResource; -import com.woorea.openstack.keystone.v3.api.TokensResource; -import com.woorea.openstack.keystone.v3.api.UsersResource; -import com.woorea.openstack.base.client.OpenStackClient; -import com.woorea.openstack.base.client.OpenStackClientConnector; - -public class Keystone extends OpenStackClient { - - private final TokensResource TOKENS; - - private final DomainsResource DOMAINS; - - private final ProjectsResource PROJECTS; - - private final UsersResource USERS; - - private final RolesResource ROLES; - - private final ServicesResource SERVICES; - - private final EndpointsResource ENDPOINTS; - - public Keystone(String endpoint, OpenStackClientConnector connector) { - super(endpoint, connector); - TOKENS = new TokensResource(this); - DOMAINS = new DomainsResource(this); - PROJECTS = new ProjectsResource(this); - USERS = new UsersResource(this); - ROLES = new RolesResource(this); - SERVICES = new ServicesResource(this); - ENDPOINTS = new EndpointsResource(this); - } - - public Keystone(String endpoint) { - this(endpoint, null); - } - - public TokensResource tokens() { - return TOKENS; - } - - public DomainsResource domains() { - return DOMAINS; - } - - public ProjectsResource projects() { - return PROJECTS; - } - - public UsersResource users() { - return USERS; - } - - public RolesResource roles() { - return ROLES; - } - - public ServicesResource services() { - return SERVICES; - } - - public EndpointsResource endpoints() { - return ENDPOINTS; - } - -} - +package com.woorea.openstack.keystone.v3; + +import com.woorea.openstack.base.client.OpenStackClient; +import com.woorea.openstack.base.client.OpenStackClientConnector; +import com.woorea.openstack.keystone.v3.api.DomainsResource; +import com.woorea.openstack.keystone.v3.api.EndpointsResource; +import com.woorea.openstack.keystone.v3.api.ProjectsResource; +import com.woorea.openstack.keystone.v3.api.RolesResource; +import com.woorea.openstack.keystone.v3.api.ServicesResource; +import com.woorea.openstack.keystone.v3.api.TokensResource; +import com.woorea.openstack.keystone.v3.api.UsersResource; + +public class Keystone extends OpenStackClient { + + private final TokensResource TOKENS; + + private final DomainsResource DOMAINS; + + private final ProjectsResource PROJECTS; + + private final UsersResource USERS; + + private final RolesResource ROLES; + + private final ServicesResource SERVICES; + + private final EndpointsResource ENDPOINTS; + + public Keystone(String endpoint, OpenStackClientConnector connector) { + super(endpoint, connector); + TOKENS = new TokensResource(this); + DOMAINS = new DomainsResource(this); + PROJECTS = new ProjectsResource(this); + USERS = new UsersResource(this); + ROLES = new RolesResource(this); + SERVICES = new ServicesResource(this); + ENDPOINTS = new EndpointsResource(this); + } + + public Keystone(String endpoint) { + this(endpoint, null); + } + + public TokensResource tokens() { + return TOKENS; + } + + public DomainsResource domains() { + return DOMAINS; + } + + public ProjectsResource projects() { + return PROJECTS; + } + + public UsersResource users() { + return USERS; + } + + public RolesResource roles() { + return ROLES; + } + + public ServicesResource services() { + return SERVICES; + } + + public EndpointsResource endpoints() { + return ENDPOINTS; + } + +} + diff --git a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/CredentialsResources.java b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/CredentialsResources.java index 7be2620da..01356f683 100644 --- a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/CredentialsResources.java +++ b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/CredentialsResources.java @@ -1,13 +1,13 @@ -package com.woorea.openstack.keystone.v3.api; - -import com.woorea.openstack.base.client.OpenStackClient; -import com.woorea.openstack.keystone.v3.model.Credential; -import com.woorea.openstack.keystone.v3.model.Credentials; - -public class CredentialsResources extends GenericResource { - - public CredentialsResources(OpenStackClient client) { - super(client, "/credentials", Credential.class, Credentials.class); - } - -} +package com.woorea.openstack.keystone.v3.api; + +import com.woorea.openstack.base.client.OpenStackClient; +import com.woorea.openstack.keystone.v3.model.Credential; +import com.woorea.openstack.keystone.v3.model.Credentials; + +public class CredentialsResources extends GenericResource { + + public CredentialsResources(OpenStackClient client) { + super(client, "/credentials", Credential.class, Credentials.class); + } + +} diff --git a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/DomainGroupRolesResource.java b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/DomainGroupRolesResource.java index a041ba20b..6c0e14093 100644 --- a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/DomainGroupRolesResource.java +++ b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/DomainGroupRolesResource.java @@ -1,13 +1,13 @@ -package com.woorea.openstack.keystone.v3.api; - -import com.woorea.openstack.base.client.OpenStackClient; -import com.woorea.openstack.keystone.v3.model.Role; -import com.woorea.openstack.keystone.v3.model.Roles; - -public class DomainGroupRolesResource extends GenericResource { - - public DomainGroupRolesResource(OpenStackClient client, String path) { - super(client, path, Role.class, Roles.class); - } - -} +package com.woorea.openstack.keystone.v3.api; + +import com.woorea.openstack.base.client.OpenStackClient; +import com.woorea.openstack.keystone.v3.model.Role; +import com.woorea.openstack.keystone.v3.model.Roles; + +public class DomainGroupRolesResource extends GenericResource { + + public DomainGroupRolesResource(OpenStackClient client, String path) { + super(client, path, Role.class, Roles.class); + } + +} diff --git a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/DomainUserRolesResource.java b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/DomainUserRolesResource.java index 9a6e8e566..854609293 100644 --- a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/DomainUserRolesResource.java +++ b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/DomainUserRolesResource.java @@ -1,24 +1,24 @@ -package com.woorea.openstack.keystone.v3.api; - -import com.woorea.openstack.base.client.Entity; -import com.woorea.openstack.base.client.HttpMethod; -import com.woorea.openstack.base.client.OpenStackClient; -import com.woorea.openstack.base.client.OpenStackRequest; -import com.woorea.openstack.keystone.model.Role; -import com.woorea.openstack.keystone.model.Roles; - -public class DomainUserRolesResource extends GenericResource { - - public DomainUserRolesResource(OpenStackClient client, String path) { - super(client, path, Role.class, Roles.class); - } - - public OpenStackRequest add(String roleId) { - return new OpenStackRequest (CLIENT, HttpMethod.PUT, new StringBuilder(path).append("/").append(roleId).toString(), Entity.json(""), Void.class); - } - - public OpenStackRequest remove(String roleId) { - return new OpenStackRequest (CLIENT, HttpMethod.DELETE, new StringBuilder(path).append("/").append(roleId).toString(), null, Void.class); - } - -} +package com.woorea.openstack.keystone.v3.api; + +import com.woorea.openstack.base.client.Entity; +import com.woorea.openstack.base.client.HttpMethod; +import com.woorea.openstack.base.client.OpenStackClient; +import com.woorea.openstack.base.client.OpenStackRequest; +import com.woorea.openstack.keystone.model.Role; +import com.woorea.openstack.keystone.model.Roles; + +public class DomainUserRolesResource extends GenericResource { + + public DomainUserRolesResource(OpenStackClient client, String path) { + super(client, path, Role.class, Roles.class); + } + + public OpenStackRequest add(String roleId) { + return new OpenStackRequest (CLIENT, HttpMethod.PUT, new StringBuilder(path).append("/").append(roleId).toString(), Entity.json(""), Void.class); + } + + public OpenStackRequest remove(String roleId) { + return new OpenStackRequest (CLIENT, HttpMethod.DELETE, new StringBuilder(path).append("/").append(roleId).toString(), null, Void.class); + } + +} diff --git a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/DomainsResource.java b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/DomainsResource.java index 28015eec4..d7a405d61 100644 --- a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/DomainsResource.java +++ b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/DomainsResource.java @@ -1,21 +1,21 @@ -package com.woorea.openstack.keystone.v3.api; - -import com.woorea.openstack.base.client.OpenStackClient; -import com.woorea.openstack.keystone.v3.model.Domain; -import com.woorea.openstack.keystone.v3.model.Domains; - -public class DomainsResource extends GenericResource { - - public DomainsResource(OpenStackClient client) { - super(client, "/domains", Domain.class, Domains.class); - } - - public DomainUserRolesResource userRoles(String domainId, String userId) { - return new DomainUserRolesResource(CLIENT, new StringBuilder(path).append("/").append(domainId).append("/users/").append(userId).append("/roles").toString()); - } - - public DomainUserRolesResource groupRoles(String domainId, String groupId) { - return new DomainUserRolesResource(CLIENT, new StringBuilder(path).append("/").append(domainId).append("/groups/").append(groupId).append("/roles").toString()); - } - -} +package com.woorea.openstack.keystone.v3.api; + +import com.woorea.openstack.base.client.OpenStackClient; +import com.woorea.openstack.keystone.v3.model.Domain; +import com.woorea.openstack.keystone.v3.model.Domains; + +public class DomainsResource extends GenericResource { + + public DomainsResource(OpenStackClient client) { + super(client, "/domains", Domain.class, Domains.class); + } + + public DomainUserRolesResource userRoles(String domainId, String userId) { + return new DomainUserRolesResource(CLIENT, new StringBuilder(path).append("/").append(domainId).append("/users/").append(userId).append("/roles").toString()); + } + + public DomainUserRolesResource groupRoles(String domainId, String groupId) { + return new DomainUserRolesResource(CLIENT, new StringBuilder(path).append("/").append(domainId).append("/groups/").append(groupId).append("/roles").toString()); + } + +} diff --git a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/EndpointsResource.java b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/EndpointsResource.java index d1db88a14..a68f1ae18 100644 --- a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/EndpointsResource.java +++ b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/EndpointsResource.java @@ -1,13 +1,13 @@ -package com.woorea.openstack.keystone.v3.api; - -import com.woorea.openstack.base.client.OpenStackClient; -import com.woorea.openstack.keystone.v3.model.Endpoint; -import com.woorea.openstack.keystone.v3.model.Endpoints; - -public class EndpointsResource extends GenericResource { - - public EndpointsResource(OpenStackClient client) { - super(client, "/endpoints", Endpoint.class, Endpoints.class); - } - -} +package com.woorea.openstack.keystone.v3.api; + +import com.woorea.openstack.base.client.OpenStackClient; +import com.woorea.openstack.keystone.v3.model.Endpoint; +import com.woorea.openstack.keystone.v3.model.Endpoints; + +public class EndpointsResource extends GenericResource { + + public EndpointsResource(OpenStackClient client) { + super(client, "/endpoints", Endpoint.class, Endpoints.class); + } + +} diff --git a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/GenericResource.java b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/GenericResource.java index 117e941df..40551f498 100644 --- a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/GenericResource.java +++ b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/GenericResource.java @@ -1,44 +1,44 @@ -package com.woorea.openstack.keystone.v3.api; - -import com.woorea.openstack.base.client.Entity; -import com.woorea.openstack.base.client.HttpMethod; -import com.woorea.openstack.base.client.OpenStackClient; -import com.woorea.openstack.base.client.OpenStackRequest; - -public class GenericResource { - - protected final OpenStackClient CLIENT; - - protected CharSequence path; - - protected Class oneClass; - protected Class manyClass; - - public GenericResource(OpenStackClient client, CharSequence path, Class oneClass, Class manyClass) { - CLIENT = client; - this.path = path; - this.oneClass = oneClass; - this.manyClass = manyClass; - } - - public OpenStackRequest list() { - return new OpenStackRequest (CLIENT, HttpMethod.GET, path, null, manyClass); - } - - public OpenStackRequest create(One one) { - return new OpenStackRequest (CLIENT, HttpMethod.POST, path, Entity.json(one), oneClass); - } - - public OpenStackRequest show(String id) { - return new OpenStackRequest (CLIENT, HttpMethod.GET, new StringBuilder(path).append("/").append(id).toString(), null, oneClass); - } - - public OpenStackRequest update(String id, One one) { - return new OpenStackRequest (CLIENT, HttpMethod.PATCH, new StringBuilder(path).append("/").append(id).toString(), Entity.json(one), oneClass); - } - - public OpenStackRequest delete(String id) { - return new OpenStackRequest