├── .gitignore ├── .travis.yml ├── LICENSE.txt ├── NEWS.md ├── README.textile ├── bundle.sh ├── ceilometer-client ├── pom.xml └── src │ └── main │ └── java │ └── com │ └── woorea │ └── openstack │ └── ceilometer │ ├── Ceilometer.java │ ├── QueriableCeilometerCommand.java │ └── v2 │ └── api │ ├── MetersResource.java │ └── ResourcesResource.java ├── ceilometer-model ├── pom.xml └── src │ └── main │ └── java │ └── com │ └── woorea │ └── openstack │ └── ceilometer │ └── v2 │ └── model │ ├── Meter.java │ ├── Resource.java │ ├── Sample.java │ └── Statistics.java ├── cinder-client ├── pom.xml └── src │ └── main │ └── java │ └── com │ └── woorea │ └── openstack │ └── cinder │ ├── Cinder.java │ ├── LimitsExtension.java │ ├── SchedulerStatsExtension.java │ ├── SnapshotsExtension.java │ ├── VolumeTypesExtension.java │ └── VolumesExtension.java ├── cinder-model ├── pom.xml └── src │ └── main │ └── java │ └── com │ └── woorea │ └── openstack │ └── cinder │ └── model │ ├── BaseConnection.java │ ├── Capabilities.java │ ├── ConnectionForInitialize.java │ ├── ConnectionForTerminate.java │ ├── ConnectionInfo.java │ ├── Limits.java │ ├── Metadata.java │ ├── Pool.java │ ├── Pools.java │ ├── Snapshot.java │ ├── SnapshotForCreate.java │ ├── SnapshotForUpdate.java │ ├── Snapshots.java │ ├── Volume.java │ ├── VolumeForCreate.java │ ├── VolumeForExtend.java │ ├── VolumeForImageCreate.java │ ├── VolumeForUpdate.java │ ├── VolumeType.java │ ├── VolumeTypeForCreate.java │ ├── VolumeTypes.java │ └── Volumes.java ├── glance-client ├── pom.xml └── src │ └── main │ └── java │ └── com │ └── woorea │ └── openstack │ └── glance │ ├── Glance.java │ ├── ImagesResource.java │ ├── SharedImagesResource.java │ └── v2 │ ├── Glance.java │ └── ImagesResource.java ├── glance-model ├── pom.xml └── src │ └── main │ └── java │ └── com │ └── woorea │ └── openstack │ └── glance │ └── model │ ├── Image.java │ ├── ImageDownload.java │ ├── ImageMember.java │ ├── ImageMembers.java │ ├── ImageUpload.java │ ├── Images.java │ ├── SharedImage.java │ ├── SharedImages.java │ └── v2 │ ├── Image.java │ ├── ImageDownload.java │ └── Images.java ├── heat-client ├── pom.xml └── src │ └── main │ └── java │ └── com │ └── woorea │ └── openstack │ └── heat │ ├── Heat.java │ ├── ResourcesResource.java │ └── StackResource.java ├── heat-model ├── pom.xml └── src │ └── main │ └── java │ └── com │ └── woorea │ └── openstack │ └── heat │ └── model │ ├── CreateStackParam.java │ ├── Explanation.java │ ├── Link.java │ ├── Resource.java │ ├── Resources.java │ ├── Stack.java │ └── Stacks.java ├── keystone-client ├── pom.xml └── src │ └── main │ └── java │ └── com │ └── woorea │ └── openstack │ └── keystone │ ├── Keystone.java │ ├── api │ ├── EndpointsResource.java │ ├── RolesResource.java │ ├── ServicesResource.java │ ├── TenantsResource.java │ ├── TokensResource.java │ └── UsersResource.java │ ├── utils │ ├── KeystoneTokenProvider.java │ └── KeystoneUtils.java │ └── v3 │ ├── Keystone.java │ └── api │ ├── CredentialsResources.java │ ├── DomainGroupRolesResource.java │ ├── DomainUserRolesResource.java │ ├── DomainsResource.java │ ├── EndpointsResource.java │ ├── GenericResource.java │ ├── GroupUsersResource.java │ ├── GroupsResource.java │ ├── PoliciesResource.java │ ├── ProjectGroupRolesResource.java │ ├── ProjectRolesResource.java │ ├── ProjectUserRolesResource.java │ ├── ProjectsResource.java │ ├── RolesResource.java │ ├── ServicesResource.java │ ├── TokensResource.java │ └── UsersResource.java ├── keystone-model ├── pom.xml └── src │ └── main │ └── java │ └── com │ └── woorea │ └── openstack │ └── keystone │ ├── model │ ├── Access.java │ ├── Authentication.java │ ├── Endpoint.java │ ├── Endpoints.java │ ├── Error.java │ ├── Link.java │ ├── Role.java │ ├── Roles.java │ ├── Service.java │ ├── Services.java │ ├── Tenant.java │ ├── Tenants.java │ ├── Token.java │ ├── User.java │ ├── Users.java │ └── authentication │ │ ├── AccessKey.java │ │ ├── TokenAuthentication.java │ │ └── UsernamePassword.java │ └── v3 │ └── model │ ├── Authentication.java │ ├── Credential.java │ ├── Credentials.java │ ├── Domain.java │ ├── Domains.java │ ├── Endpoint.java │ ├── Endpoints.java │ ├── Group.java │ ├── Groups.java │ ├── Policies.java │ ├── Policy.java │ ├── Project.java │ ├── Projects.java │ ├── Role.java │ ├── Roles.java │ ├── Service.java │ ├── Services.java │ ├── Token.java │ ├── User.java │ └── Users.java ├── nova-client ├── pom.xml └── src │ └── main │ └── java │ └── com │ └── woorea │ └── openstack │ └── nova │ ├── Nova.java │ └── api │ ├── ExtensionsResource.java │ ├── FlavorsResource.java │ ├── HypervisorsResource.java │ ├── ImagesResource.java │ ├── QuotaSetsResource.java │ ├── ServersResource.java │ ├── ServicesResource.java │ └── extensions │ ├── AggregatesExtension.java │ ├── CloudpipesExtension.java │ ├── CredentialsExtension.java │ ├── FloatingIpDnsExtension.java │ ├── FloatingIpPoolsExtension.java │ ├── FloatingIpsExtension.java │ ├── HostsExtension.java │ ├── HypervisorsExtension.java │ ├── KeyPairsExtension.java │ ├── NetworksExtension.java │ ├── SecurityGroupsExtension.java │ ├── SnapshotsExtension.java │ └── VolumesExtension.java ├── nova-model ├── pom.xml └── src │ └── main │ └── java │ └── com │ └── woorea │ └── openstack │ └── nova │ └── model │ ├── Certificate.java │ ├── Cloudpipe.java │ ├── Cloudpipes.java │ ├── Extension.java │ ├── Extensions.java │ ├── Flavor.java │ ├── FlavorForCreate.java │ ├── Flavors.java │ ├── FloatingIp.java │ ├── FloatingIpDomain.java │ ├── FloatingIpDomains.java │ ├── FloatingIpPools.java │ ├── FloatingIps.java │ ├── Host.java │ ├── HostAggregate.java │ ├── HostAggregates.java │ ├── Hosts.java │ ├── Hypervisor.java │ ├── Hypervisors.java │ ├── Image.java │ ├── ImageFromVolume.java │ ├── Images.java │ ├── KeyPair.java │ ├── KeyPairs.java │ ├── Limits.java │ ├── Link.java │ ├── Metadata.java │ ├── Network.java │ ├── NetworkForCreate.java │ ├── Networks.java │ ├── PersonalityFile.java │ ├── QuotaSet.java │ ├── SecurityGroup.java │ ├── SecurityGroupForCreate.java │ ├── SecurityGroupRuleForCreate.java │ ├── SecurityGroups.java │ ├── Server.java │ ├── ServerAction.java │ ├── ServerForCreate.java │ ├── Servers.java │ ├── Service.java │ ├── Services.java │ ├── SimpleTenantUsage.java │ ├── SimpleTenantUsages.java │ ├── Snapshot.java │ ├── SnapshotForCreate.java │ ├── Snapshots.java │ ├── Volume.java │ ├── VolumeAttachment.java │ ├── VolumeAttachments.java │ ├── VolumeForCreate.java │ ├── VolumeForImageCreate.java │ ├── VolumeType.java │ ├── VolumeTypes.java │ └── Volumes.java ├── openstack-client-connectors ├── jersey-connector │ ├── pom.xml │ └── src │ │ └── main │ │ ├── java │ │ └── com │ │ │ └── woorea │ │ │ └── openstack │ │ │ └── connector │ │ │ ├── JerseyConnector.java │ │ │ └── JerseyResponse.java │ │ └── resources │ │ └── META-INF │ │ └── services │ │ └── com.woorea.openstack.base.client.OpenStackClientConnector ├── jersey2-connector │ ├── pom.xml │ └── src │ │ └── main │ │ ├── java │ │ └── com │ │ │ └── woorea │ │ │ └── openstack │ │ │ └── connector │ │ │ ├── JaxRs20Connector.java │ │ │ ├── JaxRs20Response.java │ │ │ └── OpenStack.java │ │ └── resources │ │ └── META-INF │ │ └── services │ │ └── com.woorea.openstack.base.client.OpenStackClientConnector ├── pom.xml └── resteasy-connector │ ├── pom.xml │ └── src │ └── main │ ├── java │ └── com │ │ └── woorea │ │ └── openstack │ │ └── connector │ │ ├── RESTEasyConnector.java │ │ ├── RESTEasyInputStream.java │ │ └── RESTEasyResponse.java │ └── resources │ └── META-INF │ └── services │ └── com.woorea.openstack.base.client.OpenStackClientConnector ├── openstack-client ├── pom.xml └── src │ └── main │ └── java │ └── com │ └── woorea │ └── openstack │ ├── base │ └── client │ │ ├── Entity.java │ │ ├── HttpMethod.java │ │ ├── OpenStackClient.java │ │ ├── OpenStackClientConnector.java │ │ ├── OpenStackCommand.java │ │ ├── OpenStackRequest.java │ │ ├── OpenStackResponse.java │ │ ├── OpenStackResponseException.java │ │ ├── OpenStackResponseStatus.java │ │ ├── OpenStackSimpleTokenProvider.java │ │ └── OpenStackTokenProvider.java │ └── common │ ├── client │ └── AbstractOpenStackClient.java │ └── session │ ├── OpenStackSession.java │ └── OpenStackSessionHolder.java ├── openstack-console ├── pom.xml └── src │ └── main │ ├── java │ └── com │ │ └── woorea │ │ └── openstack │ │ └── console │ │ ├── Command.java │ │ ├── CommandLineHelper.java │ │ ├── Commands.java │ │ ├── Console.java │ │ ├── Environment.java │ │ ├── Main.java │ │ ├── keystone │ │ ├── KeystoneCommand.java │ │ ├── KeystoneEnvironment.java │ │ ├── KeystoneRoleCreate.java │ │ ├── KeystoneRoleDelete.java │ │ ├── KeystoneRoleList.java │ │ ├── KeystoneServiceList.java │ │ ├── KeystoneTenantCreate.java │ │ ├── KeystoneTenantDelete.java │ │ ├── KeystoneTenantList.java │ │ ├── KeystoneUserCreate.java │ │ ├── KeystoneUserDelete.java │ │ ├── KeystoneUserList.java │ │ └── KeystoneUserShow.java │ │ ├── nova │ │ ├── NovaCommand.java │ │ ├── NovaEnvironment.java │ │ └── NovaServerList.java │ │ └── utils │ │ ├── Column.java │ │ ├── ConsoleUtils.java │ │ ├── Table.java │ │ └── TableModel.java │ └── resources │ └── console.properties ├── openstack-examples ├── pom.xml └── src │ └── main │ └── java │ └── com │ └── woorea │ └── openstack │ └── examples │ ├── ExamplesConfiguration.java │ ├── compute │ ├── NovaCreateServer.java │ ├── NovaListFlavors.java │ ├── NovaListImages.java │ ├── NovaListServers.java │ └── NovaStopStartServer.java │ ├── glance │ └── GlanceListImages.java │ ├── heat │ └── HeatListStacks.java │ ├── hpcloud │ ├── Keystone3Authentication.java │ └── KeystoneAuthentication.java │ ├── keystone │ ├── KeystoneCreateTenant.java │ └── KeystoneCreateUser.java │ ├── metering │ └── v2 │ │ └── TestAll.java │ ├── network │ ├── QuantumListNetworks.java │ ├── QuantumNetworkCreate.java │ └── QuantumQueryNetworks.java │ ├── objectstore │ └── SwiftExample.java │ └── simple │ └── OpenStackSimpleClient.java ├── pom.xml ├── quantum-client ├── pom.xml └── src │ └── main │ └── java │ └── com │ └── woorea │ └── openstack │ └── quantum │ ├── Quantum.java │ └── api │ ├── NetworksResource.java │ ├── PortsResource.java │ ├── RoutersResource.java │ ├── SubnetsResource.java │ └── query │ └── AbsOpenStackCmd.java ├── quantum-model ├── pom.xml └── src │ ├── main │ └── java │ │ └── com │ │ └── woorea │ │ └── openstack │ │ └── quantum │ │ └── model │ │ ├── GatewayInfo.java │ │ ├── HostRoute.java │ │ ├── Network.java │ │ ├── NetworkForCreate.java │ │ ├── Networks.java │ │ ├── Pool.java │ │ ├── Port.java │ │ ├── PortForCreate.java │ │ ├── Ports.java │ │ ├── Router.java │ │ ├── RouterForAddInterface.java │ │ ├── RouterForCreate.java │ │ ├── RouterInterface.java │ │ ├── Routers.java │ │ ├── Subnet.java │ │ ├── SubnetForCreate.java │ │ └── Subnets.java │ └── test │ └── java │ └── com │ └── woorea │ └── openstack │ └── quantum │ └── model │ ├── NetworkTest.java │ ├── PortTest.java │ └── SubnetTest.java ├── swift-client ├── pom.xml └── src │ └── main │ └── java │ └── com │ └── woorea │ └── openstack │ └── swift │ ├── Swift.java │ └── api │ ├── AccountResource.java │ ├── ContainerResource.java │ └── ContainersResource.java └── swift-model ├── pom.xml └── src └── main └── java └── com └── woorea └── openstack └── swift └── model ├── Account.java ├── Container.java ├── Object.java ├── ObjectDownload.java └── ObjectForUpload.java /.gitignore: -------------------------------------------------------------------------------- 1 | *~ 2 | *.iml 3 | .idea/ 4 | .settings/ 5 | .classpath 6 | .project 7 | .settings/ 8 | target/ 9 | bin/logs/ 10 | 11 | 12 | openstack-api/test-output/ 13 | openstack-ui/src/main/webapp/META-INF/ 14 | openstack-ui/src/main/webapp/WEB-INF/deploy/ 15 | openstack-ui/src/main/webapp/WEB-INF/classes/ 16 | openstack-ui/src/main/gwt-unitCache/ 17 | openstack-ui/src/main/webapp/ui/ 18 | openstack-ui/src/main/webapp/WEB-INF/lib/ 19 | openstack-ui/.gwt/ 20 | openstack-ui/deploy.sh 21 | test-output/ 22 | bin -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: java 2 | 3 | install: mvn clean package -DskipTests=true -------------------------------------------------------------------------------- /NEWS.md: -------------------------------------------------------------------------------- 1 | # 3.2.9 / 2020-04-07 2 | * glance: Add Support for Image Service API v2 3 | 4 | # 3.2.8 / 2020-01-29 5 | * jackson upgraded to com.fasterxml version 2.9.x 6 | * commons-httpclient upgraded to org.apache.httpcomponents 4.5 7 | 8 | # 3.2.7 / 2019-05-03 9 | * Remove maven-gpg-plugin 10 | 11 | # 3.2.6 / 2019-05-03 12 | * RESTEasyConnector: Support RESTEasy 3.6.3.Final 13 | 14 | # 3.2.5 / 2018-11-14 15 | * neutron: Add support for `port_security_enabled` on Networks 16 | 17 | # 3.2.4 / 2018 18 | * Improved backward compatibility to 3.1.3 19 | 20 | # 3.2.3 / 2018-06-24 21 | * No user visible changes 22 | 23 | # 3.2.2 / 2018-06-23 24 | * Add keystone v3 support 25 | * Add missing nova utility methods for server actions 26 | * Add heat support 27 | * Add router support 28 | * All fixes and improvements up to 3.1.3 29 | 30 | # 3.1.3 / 2018-05-18 31 | * Cinder: Add support for `os-terminate_connection` 32 | * neutron: Support parameter mtu 33 | 34 | # 3.1.2 / 2017-01-28 35 | * RESTEasyConnector: Isolate the creation of ClientExecutor 36 | 37 | # 3.1.1 / 2015-05-06 38 | * cinder: introduce client and model 39 | * java 7 40 | * Fixes and improvements up to 3.0.6 41 | 42 | # 3.2.1 / 2013-07-26 43 | * No user visible changes 44 | 45 | # 3.2.0 / 2013-07-26 46 | * support quota/limits/usage operations 47 | * logging enhancements 48 | 49 | # 3.1.0 / 2013-07-21 50 | 51 | -------------------------------------------------------------------------------- /bundle.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | mvn source:jar javadoc:jar package gpg:sign repository:bundle-create -Dgpg.passphrase=$1 -------------------------------------------------------------------------------- /ceilometer-client/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | 4 | com.woorea 5 | openstack-java-sdk 6 | 3.2.10-SNAPSHOT 7 | 8 | ceilometer-client 9 | OpenStack Ceilometer Client 10 | OpenStack Ceilometer Client 11 | 12 | 13 | com.woorea 14 | openstack-client 15 | 3.2.10-SNAPSHOT 16 | 17 | 18 | com.woorea 19 | ceilometer-model 20 | 3.2.10-SNAPSHOT 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /ceilometer-client/src/main/java/com/woorea/openstack/ceilometer/Ceilometer.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.ceilometer; 2 | 3 | 4 | import com.woorea.openstack.base.client.OpenStackClient; 5 | import com.woorea.openstack.base.client.OpenStackClientConnector; 6 | import com.woorea.openstack.ceilometer.v2.api.MetersResource; 7 | import com.woorea.openstack.ceilometer.v2.api.ResourcesResource; 8 | 9 | public class Ceilometer extends OpenStackClient { 10 | 11 | private final MetersResource METERS; 12 | 13 | private final ResourcesResource RESOURCES; 14 | 15 | public Ceilometer(String endpoint, OpenStackClientConnector connector) { 16 | super(endpoint, connector); 17 | METERS = new MetersResource(this); 18 | RESOURCES = new ResourcesResource(this); 19 | } 20 | 21 | public Ceilometer(String endpoint) { 22 | this(endpoint, null); 23 | 24 | } 25 | 26 | public ResourcesResource resources() { 27 | return RESOURCES; 28 | } 29 | 30 | public MetersResource meters() { 31 | return METERS; 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /ceilometer-client/src/main/java/com/woorea/openstack/ceilometer/QueriableCeilometerCommand.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.ceilometer; 2 | 3 | import java.io.Serializable; 4 | import java.util.ArrayList; 5 | import java.util.List; 6 | 7 | import com.woorea.openstack.base.client.OpenStackRequest; 8 | 9 | public abstract class QueriableCeilometerCommand extends OpenStackRequest { 10 | 11 | protected List fields = new ArrayList(); 12 | 13 | protected List ops = new ArrayList(); 14 | 15 | protected List values = new ArrayList(); 16 | 17 | private T filter(String field, String op, Serializable value) { 18 | fields.add(field); 19 | ops.add(op); 20 | values.add(value); 21 | return (T) this; 22 | } 23 | 24 | public T lt(String field, Serializable value) { 25 | return filter(field, "lt", value); 26 | } 27 | 28 | public T le(String field, Serializable value) { 29 | return filter(field, "le", value); 30 | } 31 | 32 | public T eq(String field, Serializable value) { 33 | return filter(field, "eq", value); 34 | } 35 | 36 | public T ne(String field, Serializable value) { 37 | return filter(field, "ne", value); 38 | } 39 | 40 | public T ge(String field, Serializable value) { 41 | return filter(field, "ge", value); 42 | } 43 | 44 | public T gt(String field, Serializable value) { 45 | return filter(field, "gt", value); 46 | } 47 | 48 | /* 49 | public WebTarget query(WebTarget target) { 50 | if(fields.size() > 0) { 51 | target = target.queryParam("q.field", fields.toArray()); 52 | target = target.queryParam("q.op", ops.toArray()); 53 | target = target.queryParam("q.value", values.toArray()); 54 | } 55 | return target; 56 | } 57 | */ 58 | } 59 | -------------------------------------------------------------------------------- /ceilometer-client/src/main/java/com/woorea/openstack/ceilometer/v2/api/ResourcesResource.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.ceilometer.v2.api; 2 | 3 | import java.util.List; 4 | 5 | import com.woorea.openstack.base.client.OpenStackClient; 6 | import com.woorea.openstack.base.client.OpenStackRequest; 7 | import com.woorea.openstack.ceilometer.QueriableCeilometerCommand; 8 | import com.woorea.openstack.ceilometer.v2.model.Resource; 9 | 10 | public class ResourcesResource { 11 | 12 | private final OpenStackClient CLIENT; 13 | 14 | public ResourcesResource(OpenStackClient client) { 15 | CLIENT = client; 16 | } 17 | 18 | public class ResourceList extends QueriableCeilometerCommand> { 19 | 20 | public ResourceList() { 21 | OpenStackRequest request = new OpenStackRequest(); 22 | //return query(target.path("resources")).request(MediaType.APPLICATION_JSON).get(new GenericType>() {}); 23 | } 24 | 25 | } 26 | 27 | public class ResourceShow extends OpenStackRequest { 28 | 29 | private String id; 30 | 31 | public ResourceShow id(String id) { 32 | this.id = id; 33 | return this; 34 | } 35 | 36 | public ResourceShow(OpenStackClient client) { 37 | // if(id == null) { 38 | // throw new UnsupportedOperationException("resource id is mandatory"); 39 | // } 40 | // return target.path("resources").path(id).request(MediaType.APPLICATION_JSON).get(Resource.class); 41 | } 42 | 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /ceilometer-model/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | 4 | com.woorea 5 | openstack-java-sdk 6 | 3.2.10-SNAPSHOT 7 | 8 | ceilometer-model 9 | OpenStack Ceilometer Model 10 | OpenStack Ceilometer Model 11 | 12 | -------------------------------------------------------------------------------- /ceilometer-model/src/main/java/com/woorea/openstack/ceilometer/v2/model/Meter.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.ceilometer.v2.model; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | 5 | public class Meter { 6 | 7 | @JsonProperty("user_id") 8 | private String user; 9 | 10 | 11 | private String name; 12 | 13 | @JsonProperty("resource_id") 14 | private String resource; 15 | 16 | @JsonProperty("project_id") 17 | private String project; 18 | 19 | private String type; 20 | 21 | private String unit; 22 | 23 | public String getUser() { 24 | return user; 25 | } 26 | 27 | public String getName() { 28 | return name; 29 | } 30 | 31 | public String getResource() { 32 | return resource; 33 | } 34 | 35 | public String getProject() { 36 | return project; 37 | } 38 | 39 | public String getType() { 40 | return type; 41 | } 42 | 43 | public String getUnit() { 44 | return unit; 45 | } 46 | 47 | @Override 48 | public String toString() { 49 | return "Meter [user=" + user + ", name=" + name + ", resource=" 50 | + resource + ", project=" + project + ", type=" + type 51 | + ", unit=" + unit + "]"; 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /ceilometer-model/src/main/java/com/woorea/openstack/ceilometer/v2/model/Resource.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.ceilometer.v2.model; 2 | 3 | import java.util.Map; 4 | 5 | import com.fasterxml.jackson.annotation.JsonProperty; 6 | 7 | public class Resource { 8 | //{"resource_id": "23b55841eedd41e99d5f3f32149ca086", "timestamp": "2013-03-03T15:19:00", "project_id": "23b55841eedd41e99d5f3f32149ca086", "user_id": null, "metadata": {}} 9 | 10 | @JsonProperty("resource_id") 11 | private String resource; 12 | 13 | private String timestamp; 14 | 15 | @JsonProperty("project_id") 16 | private String project; 17 | 18 | @JsonProperty("user_id") 19 | private String user; 20 | 21 | private Map metadata; 22 | 23 | public String getResource() { 24 | return resource; 25 | } 26 | 27 | public String getTimestamp() { 28 | return timestamp; 29 | } 30 | 31 | public String getProject() { 32 | return project; 33 | } 34 | 35 | public String getUser() { 36 | return user; 37 | } 38 | 39 | public Map getMetadata() { 40 | return metadata; 41 | } 42 | 43 | @Override 44 | public String toString() { 45 | return "Resource [resource=" + resource + ", timestamp=" + timestamp 46 | + ", project=" + project + ", user=" + user + ", metadata=" 47 | + metadata + "]"; 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /cinder-client/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | 4 | com.woorea 5 | openstack-java-sdk 6 | 3.2.10-SNAPSHOT 7 | 8 | cinder-client 9 | OpenStack Cinder Client 10 | OpenStack Cinder Client 11 | 12 | 13 | com.woorea 14 | openstack-client 15 | 3.2.10-SNAPSHOT 16 | 17 | 18 | 19 | com.woorea 20 | cinder-model 21 | 3.2.10-SNAPSHOT 22 | 23 | 24 | -------------------------------------------------------------------------------- /cinder-client/src/main/java/com/woorea/openstack/cinder/Cinder.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.cinder; 2 | 3 | import com.woorea.openstack.base.client.OpenStackClient; 4 | import com.woorea.openstack.base.client.OpenStackClientConnector; 5 | 6 | public class Cinder extends OpenStackClient { 7 | 8 | private final VolumesExtension VOLUMES; 9 | 10 | private final SnapshotsExtension SNAPSHOTS; 11 | 12 | private final VolumeTypesExtension VOLUME_TYPES; 13 | 14 | private final LimitsExtension LIMITS; 15 | 16 | private final SchedulerStatsExtension SCHEDULER_STATS; 17 | 18 | public Cinder(String endpoint, OpenStackClientConnector connector) { 19 | super(endpoint, connector); 20 | VOLUMES = new VolumesExtension(this); 21 | SNAPSHOTS = new SnapshotsExtension(this); 22 | VOLUME_TYPES = new VolumeTypesExtension(this); 23 | LIMITS = new LimitsExtension(this); 24 | SCHEDULER_STATS = new SchedulerStatsExtension(this); 25 | } 26 | 27 | public Cinder(String endpoint) { 28 | this(endpoint, null); 29 | } 30 | 31 | public final VolumesExtension volumes() { 32 | return VOLUMES; 33 | } 34 | 35 | public final SnapshotsExtension snapshots() { 36 | return SNAPSHOTS; 37 | } 38 | 39 | public final VolumeTypesExtension volumeTypes() { 40 | return VOLUME_TYPES; 41 | } 42 | 43 | public final LimitsExtension limits() { 44 | return LIMITS; 45 | } 46 | 47 | public final SchedulerStatsExtension schedulerStats() { 48 | return SCHEDULER_STATS; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /cinder-client/src/main/java/com/woorea/openstack/cinder/LimitsExtension.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.cinder; 2 | 3 | import com.woorea.openstack.base.client.HttpMethod; 4 | import com.woorea.openstack.base.client.OpenStackClient; 5 | import com.woorea.openstack.base.client.OpenStackRequest; 6 | import com.woorea.openstack.cinder.model.Limits; 7 | 8 | public class LimitsExtension { 9 | 10 | private final OpenStackClient CLIENT; 11 | 12 | public LimitsExtension(OpenStackClient client) { 13 | CLIENT = client; 14 | } 15 | 16 | public List list() { 17 | return new List(); 18 | } 19 | 20 | public class List extends OpenStackRequest { 21 | 22 | public List() { 23 | super(CLIENT, HttpMethod.GET, "/limits", null, Limits.class); 24 | } 25 | 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /cinder-client/src/main/java/com/woorea/openstack/cinder/SchedulerStatsExtension.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.cinder; 2 | 3 | import com.woorea.openstack.base.client.HttpMethod; 4 | import com.woorea.openstack.base.client.OpenStackClient; 5 | import com.woorea.openstack.base.client.OpenStackRequest; 6 | import com.woorea.openstack.cinder.model.Pools; 7 | 8 | /** 9 | * Cinder Scheduler Stats Management 10 | */ 11 | public class SchedulerStatsExtension { 12 | 13 | private final OpenStackClient CLIENT; 14 | 15 | public SchedulerStatsExtension(OpenStackClient client) { 16 | this.CLIENT = client; 17 | } 18 | 19 | public List list(boolean detail) { 20 | return new List(detail); 21 | } 22 | 23 | public class List extends OpenStackRequest { 24 | 25 | public List(boolean detail) { 26 | super(CLIENT, HttpMethod.GET, (new StringBuilder("/scheduler-stats/get_pools")).append(detail ? "?detail=True":""), null, Pools.class); 27 | } 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /cinder-model/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | 4 | com.woorea 5 | openstack-java-sdk 6 | 3.2.10-SNAPSHOT 7 | 8 | cinder-model 9 | OpenStack Cinder Model 10 | OpenStack Cinder Model 11 | -------------------------------------------------------------------------------- /cinder-model/src/main/java/com/woorea/openstack/cinder/model/BaseConnection.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.cinder.model; 2 | 3 | import java.io.Serializable; 4 | import java.util.HashMap; 5 | import java.util.Map; 6 | 7 | import com.fasterxml.jackson.annotation.JsonProperty; 8 | 9 | public abstract class BaseConnection implements Serializable { 10 | @JsonProperty("connector") 11 | private Map connector = new HashMap(); 12 | 13 | /** 14 | * @return the connector 15 | */ 16 | public Map getConnector() { 17 | return connector; 18 | } 19 | 20 | /** 21 | * @param connector 22 | * the connector to set 23 | */ 24 | public void setConnector(Map connector) { 25 | this.connector = connector; 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /cinder-model/src/main/java/com/woorea/openstack/cinder/model/ConnectionForInitialize.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.cinder.model; 2 | 3 | import com.fasterxml.jackson.annotation.JsonRootName; 4 | 5 | import java.io.Serializable; 6 | 7 | @JsonRootName("os-initialize_connection") 8 | public class ConnectionForInitialize extends BaseConnection implements Serializable { 9 | 10 | /* 11 | * (non-Javadoc) 12 | * 13 | * @see java.lang.Object#toString() 14 | */ 15 | @Override 16 | public String toString() { 17 | return "ConnectionForInitialize [connector=" + getConnector() + "]"; 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /cinder-model/src/main/java/com/woorea/openstack/cinder/model/ConnectionForTerminate.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.cinder.model; 2 | 3 | import com.fasterxml.jackson.annotation.JsonRootName; 4 | 5 | import java.io.Serializable; 6 | 7 | @JsonRootName("os-terminate_connection") 8 | public class ConnectionForTerminate extends BaseConnection implements Serializable { 9 | 10 | /* 11 | * (non-Javadoc) 12 | * 13 | * @see java.lang.Object#toString() 14 | */ 15 | @Override 16 | public String toString() { 17 | return "ConnectionForInitialize [connector=" + getConnector() + "]"; 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /cinder-model/src/main/java/com/woorea/openstack/cinder/model/ConnectionInfo.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.cinder.model; 2 | 3 | import java.io.Serializable; 4 | import java.util.Map; 5 | 6 | import com.fasterxml.jackson.annotation.JsonProperty; 7 | import com.fasterxml.jackson.annotation.JsonRootName; 8 | 9 | @JsonRootName("connection_info") 10 | public class ConnectionInfo implements Serializable { 11 | 12 | @JsonProperty("driver_volume_type") 13 | private String driverVolumeType; 14 | 15 | private Map data; 16 | 17 | /** 18 | * @return the driverVolumeType 19 | */ 20 | public String getDriverVolumeType() { 21 | return driverVolumeType; 22 | } 23 | 24 | /** 25 | * @param driverVolumeType 26 | * the driverVolumeType to set 27 | */ 28 | public void setDriverVolumeType(String driverVolumeType) { 29 | this.driverVolumeType = driverVolumeType; 30 | } 31 | 32 | /** 33 | * @return the data 34 | */ 35 | public Map getData() { 36 | return data; 37 | } 38 | 39 | /** 40 | * @param data 41 | * the data to set 42 | */ 43 | public void setData(Map data) { 44 | this.data = data; 45 | } 46 | 47 | /* 48 | * (non-Javadoc) 49 | * 50 | * @see java.lang.Object#toString() 51 | */ 52 | @Override 53 | public String toString() { 54 | return "ConnectionInfo [driverVolumeType=" + driverVolumeType + "," + 55 | " data=" + data + "]"; 56 | } 57 | 58 | } 59 | -------------------------------------------------------------------------------- /cinder-model/src/main/java/com/woorea/openstack/cinder/model/Metadata.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.cinder.model; 2 | 3 | import java.util.Map; 4 | 5 | public class Metadata { 6 | 7 | private Map metadata; 8 | 9 | /** 10 | * @return the metadata 11 | */ 12 | public Map getMetadata() { 13 | return metadata; 14 | } 15 | 16 | /** 17 | * Set the metadata 18 | * 19 | * @param metadata 20 | */ 21 | public void setMetadata(Map metadata) { 22 | this.metadata = metadata; 23 | } 24 | 25 | /* 26 | * (non-Javadoc) 27 | * 28 | * @see java.lang.Object#toString() 29 | */ 30 | @Override 31 | public String toString() { 32 | return "Metadata [metadata=" + metadata + "]"; 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /cinder-model/src/main/java/com/woorea/openstack/cinder/model/Pool.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.cinder.model; 2 | 3 | import java.io.Serializable; 4 | import java.util.List; 5 | import java.util.Map; 6 | import com.fasterxml.jackson.annotation.JsonProperty; 7 | import com.fasterxml.jackson.annotation.JsonRootName; 8 | 9 | /** 10 | * Model for Pool 11 | */ 12 | @JsonRootName("pool") 13 | public class Pool implements Serializable { 14 | 15 | private String name; 16 | 17 | private Capabilities capabilities; 18 | 19 | public String getName() { 20 | return name; 21 | } 22 | 23 | public void setName(String name) { 24 | this.name = name; 25 | } 26 | 27 | public Capabilities getCapabilities() { 28 | return capabilities; 29 | } 30 | 31 | public void setCapabilities(Capabilities capabilities) { 32 | this.capabilities = capabilities; 33 | } 34 | 35 | @Override 36 | public String toString() { 37 | return "Pool{" 38 | + "name='" + name 39 | + ", capabilities='" + capabilities 40 | + '}'; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /cinder-model/src/main/java/com/woorea/openstack/cinder/model/Pools.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.cinder.model; 2 | 3 | import java.io.Serializable; 4 | import java.util.Iterator; 5 | import java.util.List; 6 | import com.fasterxml.jackson.annotation.JsonProperty; 7 | 8 | /** 9 | * Model for List of pools 10 | */ 11 | public class Pools implements Iterable, Serializable { 12 | 13 | @JsonProperty("pools") 14 | private List list; 15 | 16 | public List getList() { 17 | return list; 18 | } 19 | 20 | public void setList(List list) { 21 | this.list = list; 22 | } 23 | 24 | @Override 25 | public Iterator iterator() { 26 | return list.iterator(); 27 | } 28 | 29 | @Override 30 | public String toString() { 31 | return "Pools [list=" + list + "]"; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /cinder-model/src/main/java/com/woorea/openstack/cinder/model/SnapshotForUpdate.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.cinder.model; 2 | 3 | import java.io.Serializable; 4 | 5 | import com.fasterxml.jackson.annotation.JsonRootName; 6 | 7 | @JsonRootName("snapshot") 8 | public class SnapshotForUpdate implements Serializable { 9 | 10 | private String name; 11 | 12 | private String description; 13 | 14 | /** 15 | * @return the name 16 | */ 17 | public String getName() { 18 | return name; 19 | } 20 | 21 | /** 22 | * @param name 23 | * the name to set 24 | */ 25 | public void setName(String name) { 26 | this.name = name; 27 | } 28 | 29 | /** 30 | * @return the description 31 | */ 32 | public String getDescription() { 33 | return description; 34 | } 35 | 36 | /** 37 | * @param description 38 | * the description to set 39 | */ 40 | public void setDescription(String description) { 41 | this.description = description; 42 | } 43 | 44 | /* 45 | * (non-Javadoc) 46 | * 47 | * @see java.lang.Object#toString() 48 | */ 49 | @Override 50 | public String toString() { 51 | return "SnapshotForUpdate [name=" + name + ", description=" + description + "]"; 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /cinder-model/src/main/java/com/woorea/openstack/cinder/model/Snapshots.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.cinder.model; 2 | 3 | import java.io.Serializable; 4 | import java.util.Iterator; 5 | import java.util.List; 6 | 7 | import com.fasterxml.jackson.annotation.JsonProperty; 8 | 9 | public class Snapshots implements Iterable, Serializable { 10 | 11 | @JsonProperty("snapshots") 12 | private List list; 13 | 14 | /** 15 | * @return the list 16 | */ 17 | public List getList() { 18 | return list; 19 | } 20 | 21 | /* 22 | * (non-Javadoc) 23 | * 24 | * @see java.lang.Object#toString() 25 | */ 26 | @Override 27 | public String toString() { 28 | return "Snapshots [list=" + list + "]"; 29 | } 30 | 31 | @Override 32 | public Iterator iterator() { 33 | return list.iterator(); 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /cinder-model/src/main/java/com/woorea/openstack/cinder/model/VolumeForExtend.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.cinder.model; 2 | 3 | import java.io.Serializable; 4 | 5 | import com.fasterxml.jackson.annotation.JsonProperty; 6 | import com.fasterxml.jackson.annotation.JsonRootName; 7 | 8 | @JsonRootName("os-extend") 9 | public class VolumeForExtend implements Serializable { 10 | 11 | @JsonProperty("new_size") 12 | private Integer size; 13 | 14 | /** 15 | * @return the size 16 | */ 17 | public Integer getSize() { 18 | return size; 19 | } 20 | 21 | /** 22 | * @param size 23 | * the size to set 24 | */ 25 | public void setSize(Integer size) { 26 | this.size = size; 27 | } 28 | 29 | /* 30 | * (non-Javadoc) 31 | * 32 | * @see java.lang.Object#toString() 33 | */ 34 | @Override 35 | public String toString() { 36 | return "VolumeForExtend [size=" + size + "]"; 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /cinder-model/src/main/java/com/woorea/openstack/cinder/model/VolumeForUpdate.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.cinder.model; 2 | 3 | import java.io.Serializable; 4 | 5 | import com.fasterxml.jackson.annotation.JsonRootName; 6 | 7 | @JsonRootName("volume") 8 | public class VolumeForUpdate implements Serializable { 9 | 10 | private String name; 11 | 12 | private String description; 13 | 14 | /** 15 | * @return the name 16 | */ 17 | public String getName() { 18 | return name; 19 | } 20 | 21 | /** 22 | * @param name 23 | * the name to set 24 | */ 25 | public void setName(String name) { 26 | this.name = name; 27 | } 28 | 29 | /** 30 | * @return the description 31 | */ 32 | public String getDescription() { 33 | return description; 34 | } 35 | 36 | /** 37 | * @param description 38 | * the description to set 39 | */ 40 | public void setDescription(String description) { 41 | this.description = description; 42 | } 43 | 44 | /* 45 | * (non-Javadoc) 46 | * 47 | * @see java.lang.Object#toString() 48 | */ 49 | @Override 50 | public String toString() { 51 | return "VolumeForUpdate [name=" + name + ", description=" + description + "]"; 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /cinder-model/src/main/java/com/woorea/openstack/cinder/model/VolumeType.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.cinder.model; 2 | 3 | import java.io.Serializable; 4 | import java.util.Map; 5 | 6 | import com.fasterxml.jackson.annotation.JsonProperty; 7 | import com.fasterxml.jackson.annotation.JsonRootName; 8 | 9 | @JsonRootName("volume_type") 10 | public class VolumeType implements Serializable { 11 | 12 | private String id; 13 | 14 | private String name; 15 | 16 | @JsonProperty("extra_specs") 17 | private Map extraSpecs; 18 | 19 | /** 20 | * @return the id 21 | */ 22 | public String getId() { 23 | return id; 24 | } 25 | 26 | /** 27 | * @return the name 28 | */ 29 | public String getName() { 30 | return name; 31 | } 32 | 33 | /** 34 | * @return the extra_specs 35 | */ 36 | public Map getExtraSpecs() { 37 | return extraSpecs; 38 | } 39 | 40 | /* 41 | * (non-Javadoc) 42 | * 43 | * @see java.lang.Object#toString() 44 | */ 45 | @Override 46 | public String toString() { 47 | return "VolumeType [id=" + id + ", name=" + name + ", extra_specs=" + extraSpecs + "]"; 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /cinder-model/src/main/java/com/woorea/openstack/cinder/model/VolumeTypeForCreate.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.cinder.model; 2 | 3 | import java.io.Serializable; 4 | import java.util.Map; 5 | 6 | import com.fasterxml.jackson.annotation.JsonProperty; 7 | import com.fasterxml.jackson.annotation.JsonRootName; 8 | 9 | @JsonRootName("volume_type") 10 | public class VolumeTypeForCreate implements Serializable { 11 | 12 | private String name; 13 | 14 | @JsonProperty("extra_specs") 15 | private Map extraSpecs; 16 | 17 | /** 18 | * @return the name 19 | */ 20 | public String getName() { 21 | return name; 22 | } 23 | 24 | /** 25 | * @param name 26 | * the name to set 27 | */ 28 | public void setName(String name) { 29 | this.name = name; 30 | } 31 | 32 | /** 33 | * @return the extraSpecs 34 | */ 35 | public Map getExtraSpecs() { 36 | return extraSpecs; 37 | } 38 | 39 | /** 40 | * @param extraSpecs 41 | * the extra_specs to set 42 | */ 43 | public void setExtraSpecs(Map extraSpecs) { 44 | this.extraSpecs = extraSpecs; 45 | } 46 | 47 | /* 48 | * (non-Javadoc) 49 | * 50 | * @see java.lang.Object#toString() 51 | */ 52 | @Override 53 | public String toString() { 54 | return "VolumeForCreate [name=" + name + ", metadata=" + extraSpecs + "]"; 55 | } 56 | 57 | } 58 | -------------------------------------------------------------------------------- /cinder-model/src/main/java/com/woorea/openstack/cinder/model/VolumeTypes.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.cinder.model; 2 | 3 | import java.io.Serializable; 4 | import java.util.Iterator; 5 | import java.util.List; 6 | 7 | import com.fasterxml.jackson.annotation.JsonProperty; 8 | 9 | public class VolumeTypes implements Iterable, Serializable { 10 | 11 | @JsonProperty("volume_types") 12 | private List list; 13 | 14 | /** 15 | * @return the list 16 | */ 17 | public List getList() { 18 | return list; 19 | } 20 | 21 | /* 22 | * (non-Javadoc) 23 | * 24 | * @see java.lang.Object#toString() 25 | */ 26 | @Override 27 | public String toString() { 28 | return "Volume Types [list=" + list + "]"; 29 | } 30 | 31 | @Override 32 | public Iterator iterator() { 33 | return list.iterator(); 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /cinder-model/src/main/java/com/woorea/openstack/cinder/model/Volumes.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.cinder.model; 2 | 3 | import java.io.Serializable; 4 | import java.util.Iterator; 5 | import java.util.List; 6 | 7 | import com.fasterxml.jackson.annotation.JsonProperty; 8 | 9 | public class Volumes implements Iterable, Serializable { 10 | 11 | @JsonProperty("volumes") 12 | private List list; 13 | 14 | /** 15 | * @return the list 16 | */ 17 | public List getList() { 18 | return list; 19 | } 20 | 21 | /* 22 | * (non-Javadoc) 23 | * 24 | * @see java.lang.Object#toString() 25 | */ 26 | @Override 27 | public String toString() { 28 | return "Volumes [list=" + list + "]"; 29 | } 30 | 31 | @Override 32 | public Iterator iterator() { 33 | return list.iterator(); 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /glance-client/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | 4 | com.woorea 5 | openstack-java-sdk 6 | 3.2.10-SNAPSHOT 7 | 8 | glance-client 9 | OpenStack Glance Client 10 | OpenStack Glance Client 11 | 12 | 13 | com.woorea 14 | openstack-client 15 | 3.2.10-SNAPSHOT 16 | 17 | 18 | 19 | com.woorea 20 | glance-model 21 | 3.2.10-SNAPSHOT 22 | 23 | 24 | -------------------------------------------------------------------------------- /glance-client/src/main/java/com/woorea/openstack/glance/Glance.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.glance; 2 | 3 | import com.woorea.openstack.base.client.OpenStackClient; 4 | import com.woorea.openstack.base.client.OpenStackClientConnector; 5 | 6 | public class Glance extends OpenStackClient { 7 | 8 | private final ImagesResource IMAGES; 9 | 10 | private final SharedImagesResource SHARED_IMAGES; 11 | 12 | public Glance(String endpoint, OpenStackClientConnector connector) { 13 | super(endpoint, connector); 14 | IMAGES = new ImagesResource(this); 15 | SHARED_IMAGES = new SharedImagesResource(this); 16 | } 17 | 18 | public Glance(String endpoint) { 19 | this(endpoint, null); 20 | } 21 | 22 | public final ImagesResource images() { 23 | return IMAGES; 24 | } 25 | 26 | public final SharedImagesResource sharedImages() { 27 | return SHARED_IMAGES; 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /glance-client/src/main/java/com/woorea/openstack/glance/SharedImagesResource.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.glance; 2 | 3 | 4 | import com.woorea.openstack.base.client.HttpMethod; 5 | import com.woorea.openstack.base.client.OpenStackClient; 6 | import com.woorea.openstack.base.client.OpenStackRequest; 7 | import com.woorea.openstack.glance.model.Images; 8 | import com.woorea.openstack.glance.model.SharedImages; 9 | 10 | public class SharedImagesResource { 11 | 12 | private final OpenStackClient CLIENT; 13 | 14 | public SharedImagesResource(OpenStackClient client) { 15 | CLIENT = client; 16 | } 17 | 18 | public List list(String tenantId, boolean detail) { 19 | return new List(tenantId, detail); 20 | } 21 | 22 | public class List extends OpenStackRequest { 23 | 24 | public List(String tenantId, boolean detail) { 25 | super(CLIENT, HttpMethod.GET, new StringBuffer(detail ? "/shared-images/detail" : "/shared-images/").append(tenantId).toString(), null, SharedImages.class); 26 | } 27 | 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /glance-client/src/main/java/com/woorea/openstack/glance/v2/Glance.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.glance.v2; 2 | 3 | import com.woorea.openstack.base.client.OpenStackClient; 4 | import com.woorea.openstack.base.client.OpenStackClientConnector; 5 | 6 | public class Glance extends OpenStackClient { 7 | 8 | private final ImagesResource IMAGES; 9 | 10 | public Glance(String endpoint, OpenStackClientConnector connector) { 11 | super(endpoint, connector); 12 | IMAGES = new ImagesResource(this); 13 | } 14 | 15 | public Glance(String endpoint) { 16 | this(endpoint, null); 17 | } 18 | 19 | public final ImagesResource images() { 20 | return IMAGES; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /glance-model/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | 4 | com.woorea 5 | openstack-java-sdk 6 | 3.2.10-SNAPSHOT 7 | 8 | glance-model 9 | OpenStack Glance Model 10 | OpenStack Glance Model 11 | -------------------------------------------------------------------------------- /glance-model/src/main/java/com/woorea/openstack/glance/model/ImageDownload.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.glance.model; 2 | 3 | import java.io.InputStream; 4 | 5 | public class ImageDownload { 6 | 7 | private Image image; 8 | 9 | private InputStream inputStream; 10 | 11 | /** 12 | * @return the image 13 | */ 14 | public Image getImage() { 15 | return image; 16 | } 17 | 18 | /** 19 | * @param image the image to set 20 | */ 21 | public void setImage(Image image) { 22 | this.image = image; 23 | } 24 | 25 | /** 26 | * @return the inputStream 27 | */ 28 | public InputStream getInputStream() { 29 | return inputStream; 30 | } 31 | 32 | /** 33 | * @param inputStream the inputStream to set 34 | */ 35 | public void setInputStream(InputStream inputStream) { 36 | this.inputStream = inputStream; 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /glance-model/src/main/java/com/woorea/openstack/glance/model/ImageMember.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.glance.model; 2 | 3 | import java.io.Serializable; 4 | 5 | import com.fasterxml.jackson.annotation.JsonProperty; 6 | 7 | public class ImageMember implements Serializable { 8 | 9 | @JsonProperty("can_share") 10 | private boolean canShare; 11 | 12 | @JsonProperty("member_id") 13 | private String memberId; 14 | 15 | public ImageMember() { 16 | 17 | } 18 | 19 | public ImageMember(boolean canShare, String memberId) { 20 | this.canShare = canShare; 21 | this.memberId = memberId; 22 | } 23 | 24 | /** 25 | * @return the canShare 26 | */ 27 | public boolean isCanShare() { 28 | return canShare; 29 | } 30 | 31 | /** 32 | * @param canShare the canShare to set 33 | */ 34 | public void setCanShare(boolean canShare) { 35 | this.canShare = canShare; 36 | } 37 | 38 | /** 39 | * @return the memberId 40 | */ 41 | public String getMemberId() { 42 | return memberId; 43 | } 44 | 45 | /** 46 | * @param memberId the memberId to set 47 | */ 48 | public void setMemberId(String memberId) { 49 | this.memberId = memberId; 50 | } 51 | 52 | } 53 | -------------------------------------------------------------------------------- /glance-model/src/main/java/com/woorea/openstack/glance/model/ImageMembers.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.glance.model; 2 | 3 | import java.io.Serializable; 4 | import java.util.Iterator; 5 | import java.util.List; 6 | 7 | import com.fasterxml.jackson.annotation.JsonProperty; 8 | 9 | public class ImageMembers implements Iterable, Serializable { 10 | 11 | @JsonProperty("members") 12 | private List list; 13 | 14 | /** 15 | * @return the list 16 | */ 17 | public List getList() { 18 | return list; 19 | } 20 | 21 | @Override 22 | public Iterator iterator() { 23 | return list.iterator(); 24 | } 25 | 26 | } -------------------------------------------------------------------------------- /glance-model/src/main/java/com/woorea/openstack/glance/model/ImageUpload.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.glance.model; 2 | 3 | import java.io.InputStream; 4 | import java.util.HashMap; 5 | import java.util.Map; 6 | 7 | public class ImageUpload { 8 | 9 | private Image image; 10 | 11 | private String store; 12 | 13 | private Map properties; 14 | 15 | private InputStream inputStream; 16 | 17 | public ImageUpload(Image image) { 18 | setImage(image); 19 | } 20 | 21 | public Image getImage() { 22 | return image; 23 | } 24 | 25 | public void setImage(Image image) { 26 | this.image = image; 27 | } 28 | 29 | /** 30 | * @return the store 31 | */ 32 | public String getStore() { 33 | return store; 34 | } 35 | 36 | /** 37 | * @param store the store to set 38 | */ 39 | public void setStore(String store) { 40 | this.store = store; 41 | } 42 | 43 | /** 44 | * @return the properties 45 | */ 46 | public Map getProperties() { 47 | if(properties == null) { 48 | properties = new HashMap(); 49 | } 50 | return properties; 51 | } 52 | 53 | /** 54 | * @return the inputStream 55 | */ 56 | public InputStream getInputStream() { 57 | return inputStream; 58 | } 59 | 60 | /** 61 | * @param inputStream the inputStream to set 62 | */ 63 | public void setInputStream(InputStream inputStream) { 64 | this.inputStream = inputStream; 65 | } 66 | 67 | } 68 | -------------------------------------------------------------------------------- /glance-model/src/main/java/com/woorea/openstack/glance/model/Images.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.glance.model; 2 | 3 | import java.io.Serializable; 4 | import java.util.Iterator; 5 | import java.util.List; 6 | 7 | import com.fasterxml.jackson.annotation.JsonProperty; 8 | 9 | public class Images implements Iterable, Serializable { 10 | 11 | @JsonProperty("images") 12 | private List list; 13 | 14 | /** 15 | * @return the list 16 | */ 17 | public List getList() { 18 | return list; 19 | } 20 | 21 | @Override 22 | public Iterator iterator() { 23 | return list.iterator(); 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /glance-model/src/main/java/com/woorea/openstack/glance/model/SharedImage.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.glance.model; 2 | 3 | public class SharedImage { 4 | 5 | } -------------------------------------------------------------------------------- /glance-model/src/main/java/com/woorea/openstack/glance/model/SharedImages.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.glance.model; 2 | 3 | import java.io.Serializable; 4 | import java.util.Iterator; 5 | import java.util.List; 6 | 7 | import com.fasterxml.jackson.annotation.JsonProperty; 8 | 9 | public class SharedImages implements Iterable, Serializable { 10 | 11 | @JsonProperty("shared_images") 12 | private List list; 13 | 14 | /** 15 | * @return the list 16 | */ 17 | public List getList() { 18 | return list; 19 | } 20 | 21 | @Override 22 | public Iterator iterator() { 23 | return list.iterator(); 24 | } 25 | 26 | } -------------------------------------------------------------------------------- /glance-model/src/main/java/com/woorea/openstack/glance/model/v2/ImageDownload.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.glance.model.v2; 2 | 3 | import java.io.InputStream; 4 | 5 | public class ImageDownload { 6 | 7 | private InputStream inputStream; 8 | 9 | /** 10 | * @return the inputStream 11 | */ 12 | public InputStream getInputStream() { 13 | return inputStream; 14 | } 15 | 16 | /** 17 | * @param inputStream the inputStream to set 18 | */ 19 | public void setInputStream(InputStream inputStream) { 20 | this.inputStream = inputStream; 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /glance-model/src/main/java/com/woorea/openstack/glance/model/v2/Images.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.glance.model.v2; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | 5 | import java.io.Serializable; 6 | import java.util.Iterator; 7 | import java.util.List; 8 | 9 | public class Images implements Iterable, Serializable { 10 | 11 | @JsonProperty("images") 12 | private List list; 13 | 14 | /** 15 | * @return the list 16 | */ 17 | public List getList() { 18 | return list; 19 | } 20 | 21 | @Override 22 | public Iterator iterator() { 23 | return list.iterator(); 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /heat-client/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | 4 | com.woorea 5 | openstack-java-sdk 6 | 3.2.10-SNAPSHOT 7 | 8 | heat-client 9 | OpenStack Heat Client 10 | OpenStack Heat Client 11 | 12 | 13 | com.woorea 14 | openstack-client 15 | 3.2.10-SNAPSHOT 16 | 17 | 18 | 19 | com.woorea 20 | heat-model 21 | 3.2.10-SNAPSHOT 22 | 23 | 24 | -------------------------------------------------------------------------------- /heat-client/src/main/java/com/woorea/openstack/heat/Heat.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.heat; 2 | 3 | import com.woorea.openstack.base.client.OpenStackClient; 4 | import com.woorea.openstack.base.client.OpenStackClientConnector; 5 | 6 | /** 7 | * Reference: http://api.openstack.org/api-ref-orchestration.html 8 | */ 9 | public class Heat extends OpenStackClient { 10 | 11 | private final StackResource stacks; 12 | private final ResourcesResource resources; 13 | 14 | public Heat(String endpoint, OpenStackClientConnector connector) { 15 | super(endpoint, connector); 16 | stacks = new StackResource(this); 17 | resources = new ResourcesResource(this); 18 | } 19 | 20 | public Heat(String endpoint) { 21 | this(endpoint, null); 22 | } 23 | 24 | public StackResource getStacks() { 25 | return stacks; 26 | } 27 | 28 | public ResourcesResource getResources() { 29 | return resources; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /heat-client/src/main/java/com/woorea/openstack/heat/ResourcesResource.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.heat; 2 | 3 | import com.woorea.openstack.base.client.HttpMethod; 4 | import com.woorea.openstack.base.client.OpenStackClient; 5 | import com.woorea.openstack.base.client.OpenStackRequest; 6 | import com.woorea.openstack.heat.model.Resources; 7 | 8 | 9 | /** 10 | * v1/​{tenant_id}​/stacks/​{stack_name}​/resources 11 | */ 12 | public class ResourcesResource { 13 | private final OpenStackClient client; 14 | 15 | public ResourcesResource(OpenStackClient client) { 16 | this.client = client; 17 | } 18 | 19 | public ListResources listResources(String name) { 20 | return new ListResources(name); 21 | } 22 | 23 | /** 24 | * v1/​{tenant_id}​/stacks/​{stack_name}​/resources 25 | */ 26 | public class ListResources extends OpenStackRequest { 27 | public ListResources(String name) { 28 | super(client, HttpMethod.GET, "/stacks/" + name + "/resources", null, Resources.class); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /heat-model/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | 4 | com.woorea 5 | openstack-java-sdk 6 | 3.2.10-SNAPSHOT 7 | 8 | heat-model 9 | OpenStack Heat Model 10 | OpenStack Heat Model 11 | -------------------------------------------------------------------------------- /heat-model/src/main/java/com/woorea/openstack/heat/model/Explanation.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.heat.model; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import com.fasterxml.jackson.annotation.JsonRootName; 5 | 6 | @JsonRootName("error") 7 | public class Explanation { 8 | @JsonProperty("explanation") 9 | private String explanation; 10 | 11 | @JsonProperty("code") 12 | private int code; 13 | 14 | @JsonRootName("error") 15 | public static class Error { 16 | @JsonProperty("message") 17 | private String message; 18 | 19 | @JsonProperty("traceback") 20 | private String traceback; 21 | 22 | @JsonProperty("type") 23 | private String type; 24 | 25 | @JsonProperty("title") 26 | private String title; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /heat-model/src/main/java/com/woorea/openstack/heat/model/Link.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.heat.model; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | 5 | public class Link { 6 | @JsonProperty("href") 7 | private String href; 8 | 9 | @JsonProperty("rel") 10 | private String rel; 11 | 12 | public String getHref() { 13 | return href; 14 | } 15 | 16 | public void setHref(String href) { 17 | this.href = href; 18 | } 19 | 20 | public String getRel() { 21 | return rel; 22 | } 23 | 24 | public void setRel(String rel) { 25 | this.rel = rel; 26 | } 27 | 28 | @Override 29 | public String toString() { 30 | return "Link{" + 31 | "href='" + href + '\'' + 32 | ", rel='" + rel + '\'' + 33 | '}'; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /heat-model/src/main/java/com/woorea/openstack/heat/model/Resources.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.heat.model; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | 5 | import java.io.Serializable; 6 | import java.util.Iterator; 7 | import java.util.List; 8 | 9 | public class Resources implements Iterable, Serializable { 10 | @JsonProperty("resources") 11 | private List list; 12 | 13 | public List getList() { 14 | return list; 15 | } 16 | 17 | @Override 18 | public Iterator iterator() { 19 | return list.iterator(); 20 | } 21 | 22 | @Override 23 | public String toString() { 24 | return "Resources{" + 25 | "list=" + list + 26 | '}'; 27 | } 28 | } -------------------------------------------------------------------------------- /heat-model/src/main/java/com/woorea/openstack/heat/model/Stacks.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.heat.model; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | 5 | import java.io.Serializable; 6 | import java.util.Iterator; 7 | import java.util.List; 8 | 9 | public class Stacks implements Iterable, Serializable { 10 | @JsonProperty("stacks") 11 | private List list; 12 | 13 | @Override 14 | public Iterator iterator() { 15 | return list.iterator(); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /keystone-client/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | 4 | com.woorea 5 | openstack-java-sdk 6 | 3.2.10-SNAPSHOT 7 | 8 | keystone-client 9 | OpenStack Keystone Client 10 | OpenStack Keystone Client 11 | 12 | 13 | com.woorea 14 | openstack-client 15 | 3.2.10-SNAPSHOT 16 | 17 | 18 | com.woorea 19 | keystone-model 20 | 3.2.10-SNAPSHOT 21 | 22 | 23 | -------------------------------------------------------------------------------- /keystone-client/src/main/java/com/woorea/openstack/keystone/api/RolesResource.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.keystone.api; 2 | 3 | 4 | import com.woorea.openstack.base.client.Entity; 5 | import com.woorea.openstack.base.client.HttpMethod; 6 | import com.woorea.openstack.base.client.OpenStackClient; 7 | import com.woorea.openstack.base.client.OpenStackRequest; 8 | import com.woorea.openstack.keystone.model.Role; 9 | import com.woorea.openstack.keystone.model.Roles; 10 | 11 | public class RolesResource { 12 | 13 | private OpenStackClient client; 14 | 15 | public RolesResource(OpenStackClient client) { 16 | this.client = client; 17 | } 18 | 19 | public List list() { 20 | return new List(); 21 | } 22 | 23 | public Create create(Role role) { 24 | return new Create(role); 25 | } 26 | 27 | public Delete delete(String id) { 28 | return new Delete(id); 29 | } 30 | 31 | public class List extends OpenStackRequest { 32 | 33 | public List() { 34 | super(client, HttpMethod.GET, "/OS-KSADM/roles", null, Roles.class); 35 | } 36 | 37 | } 38 | 39 | public class Create extends OpenStackRequest { 40 | 41 | private Role role; 42 | 43 | public Create(Role role) { 44 | super(client, HttpMethod.POST, "/OS-KSADM/roles", Entity.json(role), Role.class); 45 | this.role = role; 46 | } 47 | 48 | } 49 | 50 | public class Delete extends OpenStackRequest { 51 | 52 | public Delete(String id) { 53 | super(client, HttpMethod.DELETE, new StringBuilder("/OS-KSADM/roles/").append(id).toString(), null, Void.class); 54 | } 55 | 56 | } 57 | 58 | } 59 | -------------------------------------------------------------------------------- /keystone-client/src/main/java/com/woorea/openstack/keystone/utils/KeystoneUtils.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.keystone.utils; 2 | 3 | import java.util.List; 4 | 5 | import com.woorea.openstack.keystone.model.Access.Service; 6 | 7 | public class KeystoneUtils { 8 | 9 | public static String findEndpointURL(List serviceCatalog, String type, String region, String facing) { 10 | for(Service service : serviceCatalog) { 11 | if(type.equals(service.getType())) { 12 | for(Service.Endpoint endpoint : service.getEndpoints()) { 13 | if(region == null || region.equals(endpoint.getRegion())) { 14 | if(endpoint.getPublicURL() != null && facing.equals("public")) { 15 | return endpoint.getPublicURL(); 16 | } else if(endpoint.getInternalURL() != null && facing.equals("internal")) { 17 | return endpoint.getInternalURL(); 18 | } else if(endpoint.getAdminURL() != null && facing.equals("admin")) { 19 | return endpoint.getAdminURL(); 20 | } 21 | } 22 | } 23 | } 24 | } 25 | throw new RuntimeException("endpoint url not found"); 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/CredentialsResources.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.keystone.v3.api; 2 | 3 | import com.woorea.openstack.base.client.OpenStackClient; 4 | import com.woorea.openstack.keystone.v3.model.Credential; 5 | import com.woorea.openstack.keystone.v3.model.Credentials; 6 | 7 | public class CredentialsResources extends GenericResource { 8 | 9 | public CredentialsResources(OpenStackClient client) { 10 | super(client, "/credentials", Credential.class, Credentials.class); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/DomainGroupRolesResource.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.keystone.v3.api; 2 | 3 | import com.woorea.openstack.base.client.OpenStackClient; 4 | import com.woorea.openstack.keystone.v3.model.Role; 5 | import com.woorea.openstack.keystone.v3.model.Roles; 6 | 7 | public class DomainGroupRolesResource extends GenericResource { 8 | 9 | public DomainGroupRolesResource(OpenStackClient client, String path) { 10 | super(client, path, Role.class, Roles.class); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/DomainUserRolesResource.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.keystone.v3.api; 2 | 3 | import com.woorea.openstack.base.client.Entity; 4 | import com.woorea.openstack.base.client.HttpMethod; 5 | import com.woorea.openstack.base.client.OpenStackClient; 6 | import com.woorea.openstack.base.client.OpenStackRequest; 7 | import com.woorea.openstack.keystone.model.Role; 8 | import com.woorea.openstack.keystone.model.Roles; 9 | 10 | public class DomainUserRolesResource extends GenericResource { 11 | 12 | public DomainUserRolesResource(OpenStackClient client, String path) { 13 | super(client, path, Role.class, Roles.class); 14 | } 15 | 16 | public OpenStackRequest add(String roleId) { 17 | return new OpenStackRequest(CLIENT, HttpMethod.PUT, new StringBuilder(path).append("/").append(roleId).toString(), Entity.json(""), Void.class); 18 | } 19 | 20 | public OpenStackRequest remove(String roleId) { 21 | return new OpenStackRequest(CLIENT, HttpMethod.DELETE, new StringBuilder(path).append("/").append(roleId).toString(), null, Void.class); 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/DomainsResource.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.keystone.v3.api; 2 | 3 | import com.woorea.openstack.base.client.OpenStackClient; 4 | import com.woorea.openstack.keystone.v3.model.Domain; 5 | import com.woorea.openstack.keystone.v3.model.Domains; 6 | 7 | public class DomainsResource extends GenericResource { 8 | 9 | public DomainsResource(OpenStackClient client) { 10 | super(client, "/domains", Domain.class, Domains.class); 11 | } 12 | 13 | public DomainUserRolesResource userRoles(String domainId, String userId) { 14 | return new DomainUserRolesResource(CLIENT, new StringBuilder(path).append("/").append(domainId).append("/users/").append(userId).append("/roles").toString()); 15 | } 16 | 17 | public DomainUserRolesResource groupRoles(String domainId, String groupId) { 18 | return new DomainUserRolesResource(CLIENT, new StringBuilder(path).append("/").append(domainId).append("/groups/").append(groupId).append("/roles").toString()); 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/EndpointsResource.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.keystone.v3.api; 2 | 3 | import com.woorea.openstack.base.client.OpenStackClient; 4 | import com.woorea.openstack.keystone.v3.model.Endpoint; 5 | import com.woorea.openstack.keystone.v3.model.Endpoints; 6 | 7 | public class EndpointsResource extends GenericResource { 8 | 9 | public EndpointsResource(OpenStackClient client) { 10 | super(client, "/endpoints", Endpoint.class, Endpoints.class); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/GroupUsersResource.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.keystone.v3.api; 2 | 3 | import com.woorea.openstack.base.client.OpenStackClient; 4 | import com.woorea.openstack.keystone.v3.model.User; 5 | import com.woorea.openstack.keystone.v3.model.Users; 6 | 7 | 8 | public class GroupUsersResource extends GenericResource { 9 | 10 | public GroupUsersResource(OpenStackClient client, String path) { 11 | super(client, path, User.class, Users.class); 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/GroupsResource.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.keystone.v3.api; 2 | 3 | import com.woorea.openstack.base.client.OpenStackClient; 4 | import com.woorea.openstack.keystone.v3.model.Group; 5 | import com.woorea.openstack.keystone.v3.model.Groups; 6 | 7 | public class GroupsResource extends GenericResource { 8 | 9 | public GroupsResource(OpenStackClient client) { 10 | super(client, "/groups", Group.class, Groups.class); 11 | } 12 | 13 | public DomainUserRolesResource userRoles(String domainId, String userId) { 14 | return new DomainUserRolesResource(CLIENT, new StringBuilder(path).append("/").append(domainId).append("/users/").append(userId).append("/roles").toString()); 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/PoliciesResource.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.keystone.v3.api; 2 | 3 | import com.woorea.openstack.base.client.OpenStackClient; 4 | import com.woorea.openstack.keystone.model.Role; 5 | import com.woorea.openstack.keystone.model.Roles; 6 | import com.woorea.openstack.keystone.v3.model.Policies; 7 | import com.woorea.openstack.keystone.v3.model.Policy; 8 | 9 | public class PoliciesResource extends GenericResource { 10 | 11 | public PoliciesResource(OpenStackClient client) { 12 | super(client, "/policies", Policy.class, Policies.class); 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/ProjectGroupRolesResource.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.keystone.v3.api; 2 | 3 | import com.woorea.openstack.base.client.OpenStackClient; 4 | import com.woorea.openstack.base.client.OpenStackRequest; 5 | import com.woorea.openstack.keystone.model.Role; 6 | import com.woorea.openstack.keystone.model.Roles; 7 | 8 | public class ProjectGroupRolesResource extends GenericResource { 9 | 10 | public ProjectGroupRolesResource(OpenStackClient client, String path) { 11 | super(client, path, Role.class, Roles.class); 12 | } 13 | 14 | @Override 15 | public OpenStackRequest create(Role one) { 16 | throw new UnsupportedOperationException(); 17 | } 18 | 19 | @Override 20 | public OpenStackRequest show(String id) { 21 | throw new UnsupportedOperationException(); 22 | } 23 | 24 | @Override 25 | public OpenStackRequest update(String id, Role one) { 26 | throw new UnsupportedOperationException(); 27 | } 28 | 29 | @Override 30 | public OpenStackRequest delete(String id) { 31 | throw new UnsupportedOperationException(); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/ProjectRolesResource.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.keystone.v3.api; 2 | 3 | import com.woorea.openstack.base.client.Entity; 4 | import com.woorea.openstack.base.client.HttpMethod; 5 | import com.woorea.openstack.base.client.OpenStackClient; 6 | import com.woorea.openstack.base.client.OpenStackRequest; 7 | 8 | public class ProjectRolesResource { 9 | 10 | private final OpenStackClient CLIENT; 11 | 12 | private final String PATH; 13 | 14 | public ProjectRolesResource(OpenStackClient client, String path) { 15 | this.CLIENT = client; 16 | this.PATH = path; 17 | } 18 | 19 | public OpenStackRequest add(String roleId) { 20 | return new OpenStackRequest(CLIENT, HttpMethod.PUT, new StringBuilder(PATH).append("/").append(roleId).toString(), Entity.json(""), Void.class); 21 | } 22 | 23 | public OpenStackRequest remove(String roleId) { 24 | return new OpenStackRequest(CLIENT, HttpMethod.DELETE, new StringBuilder(PATH).append("/").append(roleId).toString(), null, Void.class); 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/ProjectUserRolesResource.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.keystone.v3.api; 2 | 3 | import com.woorea.openstack.base.client.Entity; 4 | import com.woorea.openstack.base.client.HttpMethod; 5 | import com.woorea.openstack.base.client.OpenStackClient; 6 | import com.woorea.openstack.base.client.OpenStackRequest; 7 | import com.woorea.openstack.keystone.model.Role; 8 | import com.woorea.openstack.keystone.model.Roles; 9 | 10 | public class ProjectUserRolesResource extends GenericResource { 11 | 12 | public ProjectUserRolesResource(OpenStackClient client, String path) { 13 | super(client, path, Role.class, Roles.class); 14 | } 15 | 16 | public OpenStackRequest add(String roleId) { 17 | return new OpenStackRequest(CLIENT, HttpMethod.PUT, new StringBuilder(path).append("/").append(roleId).toString(), Entity.json(""), Void.class); 18 | } 19 | 20 | public OpenStackRequest remove(String roleId) { 21 | return new OpenStackRequest(CLIENT, HttpMethod.DELETE, new StringBuilder(path).append("/").append(roleId).toString(), null, Void.class); 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/ProjectsResource.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.keystone.v3.api; 2 | 3 | import com.woorea.openstack.base.client.OpenStackClient; 4 | import com.woorea.openstack.base.client.OpenStackRequest; 5 | import com.woorea.openstack.keystone.model.Users; 6 | import com.woorea.openstack.keystone.v3.model.Project; 7 | import com.woorea.openstack.keystone.v3.model.Projects; 8 | 9 | public class ProjectsResource extends GenericResource { 10 | 11 | public ProjectsResource(OpenStackClient client) { 12 | super(client, "/projects", Project.class, Projects.class); 13 | } 14 | 15 | public OpenStackRequest users(String projectId) { 16 | return CLIENT.get(new StringBuilder(path).append("/").append(projectId).append("/users/").toString(), Users.class); 17 | } 18 | 19 | public ProjectUserRolesResource userRoles(String projectId, String userId) { 20 | return new ProjectUserRolesResource(CLIENT, new StringBuilder(path).append("/").append(projectId).append("/users/").append(userId).append("/roles").toString()); 21 | } 22 | 23 | public ProjectUserRolesResource groupRoles(String projectId, String groupId) { 24 | return new ProjectUserRolesResource(CLIENT, new StringBuilder(path).append("/").append(projectId).append("/groups/").append(groupId).append("/roles").toString()); 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/RolesResource.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.keystone.v3.api; 2 | 3 | import com.woorea.openstack.base.client.OpenStackClient; 4 | import com.woorea.openstack.base.client.OpenStackRequest; 5 | import com.woorea.openstack.keystone.v3.model.Role; 6 | import com.woorea.openstack.keystone.v3.model.Roles; 7 | import com.woorea.openstack.keystone.v3.model.Users; 8 | 9 | public class RolesResource extends GenericResource { 10 | 11 | public RolesResource(OpenStackClient client) { 12 | super(client, "/roles", Role.class, Roles.class); 13 | } 14 | 15 | public OpenStackRequest users(String domainId, String userId) { 16 | return CLIENT.get(new StringBuilder(path).append("/").append(domainId).append("/users/").append(userId).append("/roles").toString(), Users.class); 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/ServicesResource.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.keystone.v3.api; 2 | 3 | import com.woorea.openstack.base.client.OpenStackClient; 4 | import com.woorea.openstack.keystone.model.Service; 5 | import com.woorea.openstack.keystone.model.Services; 6 | 7 | public class ServicesResource extends GenericResource { 8 | 9 | public ServicesResource(OpenStackClient client) { 10 | super(client, "/services", Service.class, Services.class); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/TokensResource.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.keystone.v3.api; 2 | 3 | import com.woorea.openstack.base.client.Entity; 4 | import com.woorea.openstack.base.client.HttpMethod; 5 | import com.woorea.openstack.base.client.OpenStackClient; 6 | import com.woorea.openstack.base.client.OpenStackRequest; 7 | import com.woorea.openstack.keystone.v3.model.Authentication; 8 | import com.woorea.openstack.keystone.v3.model.Token; 9 | 10 | public class TokensResource { 11 | 12 | private final OpenStackClient CLIENT; 13 | 14 | public TokensResource(OpenStackClient client) { 15 | CLIENT = client; 16 | } 17 | 18 | public Authenticate authenticate(Authentication authentication) { 19 | return new Authenticate(authentication); 20 | } 21 | 22 | public OpenStackRequest show() { 23 | return CLIENT.get("/auth/tokens", Token.class); 24 | } 25 | 26 | public class Authenticate extends OpenStackRequest { 27 | 28 | private Authentication authentication; 29 | 30 | public Authenticate() { 31 | 32 | } 33 | 34 | public Authenticate(Authentication authentication) { 35 | super(CLIENT, HttpMethod.POST, "/auth/tokens", Entity.json(authentication), Token.class); 36 | this.authentication = authentication; 37 | } 38 | 39 | } 40 | 41 | } 42 | 43 | -------------------------------------------------------------------------------- /keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/UsersResource.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.keystone.v3.api; 2 | 3 | import com.woorea.openstack.base.client.OpenStackClient; 4 | import com.woorea.openstack.base.client.OpenStackRequest; 5 | import com.woorea.openstack.keystone.model.Services; 6 | import com.woorea.openstack.keystone.v3.model.User; 7 | import com.woorea.openstack.keystone.v3.model.Users; 8 | 9 | public class UsersResource extends GenericResource { 10 | 11 | public UsersResource(OpenStackClient client) { 12 | super(client, "/users", User.class, Users.class); 13 | } 14 | 15 | public OpenStackRequest groups(String userId) { 16 | return CLIENT.get(new StringBuilder(path).append("/").append(userId).append("/groups").toString(), Services.class); 17 | } 18 | 19 | public OpenStackRequest projects(String userId) { 20 | return CLIENT.get(new StringBuilder(path).append("/").append(userId).append("/projects").toString(), Services.class); 21 | } 22 | 23 | public OpenStackRequest roles(String userId) { 24 | return CLIENT.get(new StringBuilder(path).append("/").append(userId).append("/roles").toString(), Services.class); 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /keystone-model/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | 4 | com.woorea 5 | openstack-java-sdk 6 | 3.2.10-SNAPSHOT 7 | 8 | keystone-model 9 | OpenStack Keystone Model 10 | OpenStack Keystone Model 11 | -------------------------------------------------------------------------------- /keystone-model/src/main/java/com/woorea/openstack/keystone/model/Authentication.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.keystone.model; 2 | 3 | import java.io.Serializable; 4 | 5 | import com.fasterxml.jackson.annotation.JsonRootName; 6 | 7 | public abstract class Authentication implements Serializable { 8 | 9 | private String tenantId; 10 | 11 | private String tenantName; 12 | 13 | /** 14 | * @return the tenantId 15 | */ 16 | public String getTenantId() { 17 | return tenantId; 18 | } 19 | 20 | /** 21 | * @param tenantId the tenantId to set 22 | */ 23 | public void setTenantId(String tenantId) { 24 | this.tenantId = tenantId; 25 | } 26 | 27 | /** 28 | * @return the tenantName 29 | */ 30 | public String getTenantName() { 31 | return tenantName; 32 | } 33 | 34 | /** 35 | * @param tenantName the tenantName to set 36 | */ 37 | public void setTenantName(String tenantName) { 38 | this.tenantName = tenantName; 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /keystone-model/src/main/java/com/woorea/openstack/keystone/model/Endpoints.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.keystone.model; 2 | 3 | import java.io.Serializable; 4 | import java.util.Iterator; 5 | import java.util.List; 6 | 7 | import com.fasterxml.jackson.annotation.JsonProperty; 8 | 9 | public class Endpoints implements Iterable, Serializable { 10 | 11 | @JsonProperty("endpoints") 12 | private List list; 13 | 14 | /** 15 | * @return the list 16 | */ 17 | public List getList() { 18 | return list; 19 | } 20 | 21 | /* (non-Javadoc) 22 | * @see java.lang.Object#toString() 23 | */ 24 | @Override 25 | public String toString() { 26 | return "Endpoints [list=" + list + "]"; 27 | } 28 | 29 | @Override 30 | public Iterator iterator() { 31 | return list.iterator(); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /keystone-model/src/main/java/com/woorea/openstack/keystone/model/Error.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.keystone.model; 2 | 3 | import java.io.Serializable; 4 | 5 | import com.fasterxml.jackson.annotation.JsonRootName; 6 | 7 | @JsonRootName("error") 8 | public class Error implements Serializable { 9 | 10 | private Integer code; 11 | 12 | private String title; 13 | 14 | private String message; 15 | 16 | /** 17 | * @return the code 18 | */ 19 | public Integer getCode() { 20 | return code; 21 | } 22 | 23 | /** 24 | * @return the title 25 | */ 26 | public String getTitle() { 27 | return title; 28 | } 29 | 30 | /** 31 | * @return the message 32 | */ 33 | public String getMessage() { 34 | return message; 35 | } 36 | 37 | /* (non-Javadoc) 38 | * @see java.lang.Object#toString() 39 | */ 40 | @Override 41 | public String toString() { 42 | return "Error [code=" + code + ", title=" + title + ", message=" 43 | + message + "]"; 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /keystone-model/src/main/java/com/woorea/openstack/keystone/model/Link.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.keystone.model; 2 | 3 | import java.io.Serializable; 4 | 5 | public class Link implements Serializable { 6 | 7 | private String rel; 8 | 9 | private String href; 10 | 11 | private String type; 12 | 13 | /** 14 | * @return the rel 15 | */ 16 | public String getRel() { 17 | return rel; 18 | } 19 | 20 | /** 21 | * @return the href 22 | */ 23 | public String getHref() { 24 | return href; 25 | } 26 | 27 | /** 28 | * @return the type 29 | */ 30 | public String getType() { 31 | return type; 32 | } 33 | 34 | /* (non-Javadoc) 35 | * @see java.lang.Object#toString() 36 | */ 37 | @Override 38 | public String toString() { 39 | return "Link [rel=" + rel + ", href=" + href + ", type=" + type + "]"; 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /keystone-model/src/main/java/com/woorea/openstack/keystone/model/Role.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.keystone.model; 2 | 3 | import java.io.Serializable; 4 | 5 | import com.fasterxml.jackson.annotation.JsonRootName; 6 | 7 | @JsonRootName("role") 8 | public class Role implements Serializable { 9 | 10 | private String id; 11 | 12 | private String name; 13 | 14 | private String description; 15 | 16 | private String enabled; 17 | 18 | /** 19 | * @return the id 20 | */ 21 | public String getId() { 22 | return id; 23 | } 24 | 25 | /** 26 | * @return the name 27 | */ 28 | public String getName() { 29 | return name; 30 | } 31 | 32 | /** 33 | * @param name the name to set 34 | */ 35 | public void setName(String name) { 36 | this.name = name; 37 | } 38 | 39 | /** 40 | * @return the description 41 | */ 42 | public String getDescription() { 43 | return description; 44 | } 45 | 46 | /** 47 | * @param description the description to set 48 | */ 49 | public void setDescription(String description) { 50 | this.description = description; 51 | } 52 | 53 | /** 54 | * @return the enabled 55 | */ 56 | public String getEnabled() { 57 | return enabled; 58 | } 59 | 60 | /** 61 | * @param enabled the enabled to set 62 | */ 63 | public void setEnabled(String enabled) { 64 | this.enabled = enabled; 65 | } 66 | 67 | } 68 | -------------------------------------------------------------------------------- /keystone-model/src/main/java/com/woorea/openstack/keystone/model/Roles.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.keystone.model; 2 | 3 | import java.io.Serializable; 4 | import java.util.Iterator; 5 | import java.util.List; 6 | 7 | import com.fasterxml.jackson.annotation.JsonProperty; 8 | 9 | public class Roles implements Iterable, Serializable { 10 | 11 | @JsonProperty("roles") 12 | private List list; 13 | 14 | /** 15 | * @return the list 16 | */ 17 | public List getList() { 18 | return list; 19 | } 20 | 21 | /* (non-Javadoc) 22 | * @see java.lang.Object#toString() 23 | */ 24 | @Override 25 | public String toString() { 26 | return "Roles [list=" + list + "]"; 27 | } 28 | 29 | @Override 30 | public Iterator iterator() { 31 | return list.iterator(); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /keystone-model/src/main/java/com/woorea/openstack/keystone/model/Service.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.keystone.model; 2 | 3 | import java.io.Serializable; 4 | 5 | import com.fasterxml.jackson.annotation.JsonRootName; 6 | 7 | @JsonRootName("OS-KSADM:service") 8 | public class Service implements Serializable { 9 | 10 | private String id; 11 | 12 | private String type; 13 | 14 | private String name; 15 | 16 | private String description; 17 | 18 | /** 19 | * @return the id 20 | */ 21 | public String getId() { 22 | return id; 23 | } 24 | 25 | /** 26 | * @return the type 27 | */ 28 | public String getType() { 29 | return type; 30 | } 31 | 32 | /** 33 | * @param type the type to set 34 | */ 35 | public void setType(String type) { 36 | this.type = type; 37 | } 38 | 39 | /** 40 | * @return the name 41 | */ 42 | public String getName() { 43 | return name; 44 | } 45 | 46 | /** 47 | * @param name the name to set 48 | */ 49 | public void setName(String name) { 50 | this.name = name; 51 | } 52 | 53 | /** 54 | * @return the description 55 | */ 56 | public String getDescription() { 57 | return description; 58 | } 59 | 60 | /** 61 | * @param description the description to set 62 | */ 63 | public void setDescription(String description) { 64 | this.description = description; 65 | } 66 | 67 | /* (non-Javadoc) 68 | * @see java.lang.Object#toString() 69 | */ 70 | @Override 71 | public String toString() { 72 | return "Service [id=" + id + ", type=" + type + ", name=" + name 73 | + ", description=" + description + "]"; 74 | } 75 | 76 | } 77 | -------------------------------------------------------------------------------- /keystone-model/src/main/java/com/woorea/openstack/keystone/model/Services.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.keystone.model; 2 | 3 | import java.io.Serializable; 4 | import java.util.Iterator; 5 | import java.util.List; 6 | 7 | import com.fasterxml.jackson.annotation.JsonProperty; 8 | 9 | public class Services implements Iterable, Serializable { 10 | 11 | @JsonProperty("OS-KSADM:services") 12 | private List list; 13 | 14 | /** 15 | * @return the list 16 | */ 17 | public List getList() { 18 | return list; 19 | } 20 | 21 | /* (non-Javadoc) 22 | * @see java.lang.Object#toString() 23 | */ 24 | @Override 25 | public String toString() { 26 | return "Services [list=" + list + "]"; 27 | } 28 | 29 | @Override 30 | public Iterator iterator() { 31 | return list.iterator(); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /keystone-model/src/main/java/com/woorea/openstack/keystone/model/Tenants.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.keystone.model; 2 | 3 | import java.io.Serializable; 4 | import java.util.Iterator; 5 | import java.util.List; 6 | 7 | import com.fasterxml.jackson.annotation.JsonProperty; 8 | 9 | public class Tenants implements Iterable, Serializable { 10 | 11 | @JsonProperty("tenants") 12 | private List list; 13 | 14 | @JsonProperty("tenants_links") 15 | private List links; 16 | 17 | /** 18 | * @return the list 19 | */ 20 | public List getList() { 21 | return list; 22 | } 23 | 24 | /** 25 | * @return the links 26 | */ 27 | public List getLinks() { 28 | return links; 29 | } 30 | 31 | /* (non-Javadoc) 32 | * @see java.lang.Object#toString() 33 | */ 34 | @Override 35 | public String toString() { 36 | return "Tenants [list=" + list + ", links=" + links + "]"; 37 | } 38 | 39 | @Override 40 | public Iterator iterator() { 41 | return list.iterator(); 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /keystone-model/src/main/java/com/woorea/openstack/keystone/model/Token.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.keystone.model; 2 | 3 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 4 | 5 | import java.util.Calendar; 6 | 7 | @JsonIgnoreProperties(ignoreUnknown=true) 8 | public final class Token { 9 | 10 | private String id; 11 | 12 | private Calendar issued_at; 13 | 14 | private Calendar expires; 15 | 16 | private Tenant tenant; 17 | 18 | /** 19 | * @return the id 20 | */ 21 | public String getId() { 22 | return id; 23 | } 24 | 25 | /** 26 | * @return the issued_at 27 | */ 28 | public Calendar getIssued_at() { 29 | return issued_at; 30 | } 31 | 32 | /** 33 | * @return the expires 34 | */ 35 | public Calendar getExpires() { 36 | return expires; 37 | } 38 | 39 | /** 40 | * @return the tenant 41 | */ 42 | public Tenant getTenant() { 43 | return tenant; 44 | } 45 | 46 | /* (non-Javadoc) 47 | * @see java.lang.Object#toString() 48 | */ 49 | @Override 50 | public String toString() { 51 | return "Token [id=" + id + ", Issued_at=" + issued_at + ", expires=" + expires + ", tenant=" 52 | + tenant + "]"; 53 | } 54 | 55 | } -------------------------------------------------------------------------------- /keystone-model/src/main/java/com/woorea/openstack/keystone/model/Users.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.keystone.model; 2 | 3 | import java.io.Serializable; 4 | import java.util.Iterator; 5 | import java.util.List; 6 | 7 | import com.fasterxml.jackson.annotation.JsonProperty; 8 | 9 | public class Users implements Iterable, Serializable { 10 | 11 | @JsonProperty("users") 12 | private List list; 13 | 14 | /** 15 | * @return the list 16 | */ 17 | public List getList() { 18 | return list; 19 | } 20 | 21 | /* (non-Javadoc) 22 | * @see java.lang.Object#toString() 23 | */ 24 | @Override 25 | public String toString() { 26 | return "Users [list=" + list + "]"; 27 | } 28 | 29 | @Override 30 | public Iterator iterator() { 31 | return list.iterator(); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /keystone-model/src/main/java/com/woorea/openstack/keystone/model/authentication/TokenAuthentication.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.keystone.model.authentication; 2 | 3 | import com.fasterxml.jackson.annotation.JsonRootName; 4 | 5 | import com.woorea.openstack.keystone.model.Authentication; 6 | 7 | @JsonRootName("auth") 8 | public class TokenAuthentication extends Authentication { 9 | 10 | public static final class Token { 11 | 12 | private String id; 13 | 14 | /** 15 | * @return the id 16 | */ 17 | public String getId() { 18 | return id; 19 | } 20 | 21 | /** 22 | * @param id the id to set 23 | */ 24 | public void setId(String id) { 25 | this.id = id; 26 | } 27 | 28 | } 29 | 30 | private Token token = new Token(); 31 | 32 | public TokenAuthentication(String token) { 33 | this.token.id = token; 34 | } 35 | 36 | /** 37 | * @return the token 38 | */ 39 | public Token getToken() { 40 | return token; 41 | } 42 | 43 | /** 44 | * @param token the token to set 45 | */ 46 | public void setToken(Token token) { 47 | this.token = token; 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Credential.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.keystone.v3.model; 2 | 3 | import java.util.HashMap; 4 | import java.util.Map; 5 | 6 | import com.fasterxml.jackson.annotation.JsonRootName; 7 | 8 | @JsonRootName("credential") 9 | public class Credential { 10 | 11 | private String id; 12 | 13 | private String projectId; 14 | 15 | private String type; 16 | 17 | private String userId; 18 | 19 | private Map blob = new HashMap(); 20 | 21 | public String getId() { 22 | return id; 23 | } 24 | 25 | public void setId(String id) { 26 | this.id = id; 27 | } 28 | 29 | public String getProjectId() { 30 | return projectId; 31 | } 32 | 33 | public void setProjectId(String projectId) { 34 | this.projectId = projectId; 35 | } 36 | 37 | public String getType() { 38 | return type; 39 | } 40 | 41 | public void setType(String type) { 42 | this.type = type; 43 | } 44 | 45 | public String getUserId() { 46 | return userId; 47 | } 48 | 49 | public void setUserId(String userId) { 50 | this.userId = userId; 51 | } 52 | 53 | public Map getBlob() { 54 | return blob; 55 | } 56 | 57 | public void setBlob(Map blob) { 58 | this.blob = blob; 59 | } 60 | 61 | } 62 | -------------------------------------------------------------------------------- /keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Credentials.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.keystone.v3.model; 2 | 3 | import java.io.Serializable; 4 | import java.util.Iterator; 5 | import java.util.List; 6 | 7 | import com.fasterxml.jackson.annotation.JsonProperty; 8 | 9 | public class Credentials implements Iterable, Serializable { 10 | 11 | @JsonProperty("credentials") 12 | private List list; 13 | 14 | /** 15 | * @return the list 16 | */ 17 | public List getList() { 18 | return list; 19 | } 20 | 21 | /* (non-Javadoc) 22 | * @see java.lang.Object#toString() 23 | */ 24 | @Override 25 | public String toString() { 26 | return "Credentials [list=" + list + "]"; 27 | } 28 | 29 | @Override 30 | public Iterator iterator() { 31 | return list.iterator(); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Domain.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.keystone.v3.model; 2 | 3 | import com.fasterxml.jackson.annotation.JsonRootName; 4 | 5 | @JsonRootName("domain") 6 | public class Domain { 7 | 8 | private String id; 9 | 10 | private String name; 11 | 12 | private String description; 13 | 14 | private Boolean enabled; 15 | 16 | public String getId() { 17 | return id; 18 | } 19 | 20 | public void setId(String id) { 21 | this.id = id; 22 | } 23 | 24 | public String getName() { 25 | return name; 26 | } 27 | 28 | public void setName(String name) { 29 | this.name = name; 30 | } 31 | 32 | public String getDescription() { 33 | return description; 34 | } 35 | 36 | public void setDescription(String description) { 37 | this.description = description; 38 | } 39 | 40 | public Boolean getEnabled() { 41 | return enabled; 42 | } 43 | 44 | public void setEnabled(Boolean enabled) { 45 | this.enabled = enabled; 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Domains.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.keystone.v3.model; 2 | 3 | import java.io.Serializable; 4 | import java.util.Iterator; 5 | import java.util.List; 6 | 7 | import com.fasterxml.jackson.annotation.JsonProperty; 8 | 9 | public class Domains implements Iterable, Serializable { 10 | 11 | @JsonProperty("domains") 12 | private List list; 13 | 14 | /** 15 | * @return the list 16 | */ 17 | public List getList() { 18 | return list; 19 | } 20 | 21 | /* (non-Javadoc) 22 | * @see java.lang.Object#toString() 23 | */ 24 | @Override 25 | public String toString() { 26 | return "Domains [list=" + list + "]"; 27 | } 28 | 29 | @Override 30 | public Iterator iterator() { 31 | return list.iterator(); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Endpoint.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.keystone.v3.model; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import com.fasterxml.jackson.annotation.JsonRootName; 5 | 6 | @JsonRootName("endpoint") 7 | public class Endpoint { 8 | 9 | private String id; 10 | 11 | @JsonProperty("interface") 12 | private String iface; 13 | 14 | private String name; 15 | 16 | @JsonProperty("service_id") 17 | private String serviceId; 18 | 19 | public String getId() { 20 | return id; 21 | } 22 | 23 | public void setId(String id) { 24 | this.id = id; 25 | } 26 | 27 | public String getInterface() { 28 | return iface; 29 | } 30 | 31 | public void setInterface(String iface) { 32 | this.iface = iface; 33 | } 34 | 35 | public String getName() { 36 | return name; 37 | } 38 | 39 | public void setName(String name) { 40 | this.name = name; 41 | } 42 | 43 | public String getServiceId() { 44 | return serviceId; 45 | } 46 | 47 | public void setServiceId(String serviceId) { 48 | this.serviceId = serviceId; 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Endpoints.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.keystone.v3.model; 2 | 3 | import java.io.Serializable; 4 | import java.util.Iterator; 5 | import java.util.List; 6 | 7 | import com.fasterxml.jackson.annotation.JsonProperty; 8 | 9 | public class Endpoints implements Iterable, Serializable { 10 | 11 | @JsonProperty("endpoints") 12 | private List list; 13 | 14 | /** 15 | * @return the list 16 | */ 17 | public List getList() { 18 | return list; 19 | } 20 | 21 | /* (non-Javadoc) 22 | * @see java.lang.Object#toString() 23 | */ 24 | @Override 25 | public String toString() { 26 | return "Endpoints [list=" + list + "]"; 27 | } 28 | 29 | @Override 30 | public Iterator iterator() { 31 | return list.iterator(); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Group.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.keystone.v3.model; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import com.fasterxml.jackson.annotation.JsonRootName; 5 | 6 | @JsonRootName("group") 7 | public class Group { 8 | 9 | private String id; 10 | 11 | @JsonProperty("domain_id") 12 | private String domainId; 13 | 14 | private String name; 15 | 16 | private String description; 17 | 18 | public String getId() { 19 | return id; 20 | } 21 | 22 | public void setId(String id) { 23 | this.id = id; 24 | } 25 | 26 | public String getDomainId() { 27 | return domainId; 28 | } 29 | 30 | public void setDomainId(String domainId) { 31 | this.domainId = domainId; 32 | } 33 | 34 | public String getName() { 35 | return name; 36 | } 37 | 38 | public void setName(String name) { 39 | this.name = name; 40 | } 41 | 42 | public String getDescription() { 43 | return description; 44 | } 45 | 46 | public void setDescription(String description) { 47 | this.description = description; 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Groups.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.keystone.v3.model; 2 | 3 | import java.io.Serializable; 4 | import java.util.Iterator; 5 | import java.util.List; 6 | 7 | import com.fasterxml.jackson.annotation.JsonProperty; 8 | 9 | public class Groups implements Iterable, Serializable { 10 | 11 | @JsonProperty("groups") 12 | private List list; 13 | 14 | /** 15 | * @return the list 16 | */ 17 | public List getList() { 18 | return list; 19 | } 20 | 21 | /* (non-Javadoc) 22 | * @see java.lang.Object#toString() 23 | */ 24 | @Override 25 | public String toString() { 26 | return "Groups [list=" + list + "]"; 27 | } 28 | 29 | @Override 30 | public Iterator iterator() { 31 | return list.iterator(); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Policies.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.keystone.v3.model; 2 | 3 | import java.io.Serializable; 4 | import java.util.Iterator; 5 | import java.util.List; 6 | 7 | import com.fasterxml.jackson.annotation.JsonProperty; 8 | 9 | public class Policies implements Iterable, Serializable { 10 | 11 | @JsonProperty("policies") 12 | private List list; 13 | 14 | /** 15 | * @return the list 16 | */ 17 | public List getList() { 18 | return list; 19 | } 20 | 21 | /* (non-Javadoc) 22 | * @see java.lang.Object#toString() 23 | */ 24 | @Override 25 | public String toString() { 26 | return "Policies [list=" + list + "]"; 27 | } 28 | 29 | @Override 30 | public Iterator iterator() { 31 | return list.iterator(); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Policy.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.keystone.v3.model; 2 | 3 | import java.util.HashMap; 4 | import java.util.Map; 5 | 6 | import com.fasterxml.jackson.annotation.JsonRootName; 7 | 8 | @JsonRootName("policy") 9 | public class Policy { 10 | 11 | private String id; 12 | 13 | private String projectId; 14 | 15 | private String type; 16 | 17 | private String userId; 18 | 19 | private Map blob = new HashMap(); 20 | 21 | public String getId() { 22 | return id; 23 | } 24 | 25 | public void setId(String id) { 26 | this.id = id; 27 | } 28 | 29 | public String getProjectId() { 30 | return projectId; 31 | } 32 | 33 | public void setProjectId(String projectId) { 34 | this.projectId = projectId; 35 | } 36 | 37 | public String getType() { 38 | return type; 39 | } 40 | 41 | public void setType(String type) { 42 | this.type = type; 43 | } 44 | 45 | public String getUserId() { 46 | return userId; 47 | } 48 | 49 | public void setUserId(String userId) { 50 | this.userId = userId; 51 | } 52 | 53 | public Map getBlob() { 54 | return blob; 55 | } 56 | 57 | public void setBlob(Map blob) { 58 | this.blob = blob; 59 | } 60 | 61 | } 62 | -------------------------------------------------------------------------------- /keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Project.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.keystone.v3.model; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import com.fasterxml.jackson.annotation.JsonRootName; 5 | 6 | @JsonRootName("project") 7 | public class Project { 8 | 9 | private String id; 10 | 11 | @JsonProperty("domain_id") 12 | private String domainId; 13 | 14 | private String name; 15 | 16 | private Boolean enabled; 17 | 18 | public String getId() { 19 | return id; 20 | } 21 | 22 | public void setId(String id) { 23 | this.id = id; 24 | } 25 | 26 | public String getDomainId() { 27 | return domainId; 28 | } 29 | 30 | public void setDomainId(String domainId) { 31 | this.domainId = domainId; 32 | } 33 | 34 | public String getName() { 35 | return name; 36 | } 37 | 38 | public void setName(String name) { 39 | this.name = name; 40 | } 41 | 42 | public Boolean getEnabled() { 43 | return enabled; 44 | } 45 | 46 | public void setEnabled(Boolean enabled) { 47 | this.enabled = enabled; 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Projects.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.keystone.v3.model; 2 | 3 | import java.io.Serializable; 4 | import java.util.Iterator; 5 | import java.util.List; 6 | 7 | import com.fasterxml.jackson.annotation.JsonProperty; 8 | 9 | public class Projects implements Iterable, Serializable { 10 | 11 | @JsonProperty("projects") 12 | private List list; 13 | 14 | /** 15 | * @return the list 16 | */ 17 | public List getList() { 18 | return list; 19 | } 20 | 21 | /* (non-Javadoc) 22 | * @see java.lang.Object#toString() 23 | */ 24 | @Override 25 | public String toString() { 26 | return "Projects [list=" + list + "]"; 27 | } 28 | 29 | @Override 30 | public Iterator iterator() { 31 | return list.iterator(); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Role.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.keystone.v3.model; 2 | 3 | import java.io.Serializable; 4 | 5 | import com.fasterxml.jackson.annotation.JsonRootName; 6 | 7 | @JsonRootName("role") 8 | public class Role implements Serializable { 9 | 10 | private String id; 11 | 12 | private String name; 13 | 14 | private String description; 15 | 16 | private String enabled; 17 | 18 | /** 19 | * @return the id 20 | */ 21 | public String getId() { 22 | return id; 23 | } 24 | 25 | /** 26 | * @return the name 27 | */ 28 | public String getName() { 29 | return name; 30 | } 31 | 32 | /** 33 | * @param name the name to set 34 | */ 35 | public void setName(String name) { 36 | this.name = name; 37 | } 38 | 39 | /** 40 | * @return the description 41 | */ 42 | public String getDescription() { 43 | return description; 44 | } 45 | 46 | /** 47 | * @param description the description to set 48 | */ 49 | public void setDescription(String description) { 50 | this.description = description; 51 | } 52 | 53 | /** 54 | * @return the enabled 55 | */ 56 | public String getEnabled() { 57 | return enabled; 58 | } 59 | 60 | /** 61 | * @param enabled the enabled to set 62 | */ 63 | public void setEnabled(String enabled) { 64 | this.enabled = enabled; 65 | } 66 | 67 | } 68 | -------------------------------------------------------------------------------- /keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Roles.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.keystone.v3.model; 2 | 3 | import java.io.Serializable; 4 | import java.util.Iterator; 5 | import java.util.List; 6 | 7 | import com.fasterxml.jackson.annotation.JsonProperty; 8 | 9 | public class Roles implements Iterable, Serializable { 10 | 11 | @JsonProperty("roles") 12 | private List list; 13 | 14 | /** 15 | * @return the list 16 | */ 17 | public List getList() { 18 | return list; 19 | } 20 | 21 | /* (non-Javadoc) 22 | * @see java.lang.Object#toString() 23 | */ 24 | @Override 25 | public String toString() { 26 | return "Roles [list=" + list + "]"; 27 | } 28 | 29 | @Override 30 | public Iterator iterator() { 31 | return list.iterator(); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Service.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.keystone.v3.model; 2 | 3 | import com.fasterxml.jackson.annotation.JsonRootName; 4 | 5 | @JsonRootName("service") 6 | public class Service { 7 | 8 | private String id; 9 | 10 | private String type; 11 | 12 | private String name; 13 | 14 | private String description; 15 | 16 | public String getId() { 17 | return id; 18 | } 19 | 20 | public void setId(String id) { 21 | this.id = id; 22 | } 23 | 24 | public String getType() { 25 | return type; 26 | } 27 | 28 | public void setType(String type) { 29 | this.type = type; 30 | } 31 | 32 | public String getName() { 33 | return name; 34 | } 35 | 36 | public void setName(String name) { 37 | this.name = name; 38 | } 39 | 40 | public String getDescription() { 41 | return description; 42 | } 43 | 44 | public void setDescription(String description) { 45 | this.description = description; 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Services.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.keystone.v3.model; 2 | 3 | import java.io.Serializable; 4 | import java.util.Iterator; 5 | import java.util.List; 6 | 7 | import com.fasterxml.jackson.annotation.JsonProperty; 8 | 9 | import com.woorea.openstack.keystone.model.Service; 10 | 11 | public class Services implements Iterable, Serializable { 12 | 13 | @JsonProperty("services") 14 | private List list; 15 | 16 | /** 17 | * @return the list 18 | */ 19 | public List getList() { 20 | return list; 21 | } 22 | 23 | /* (non-Javadoc) 24 | * @see java.lang.Object#toString() 25 | */ 26 | @Override 27 | public String toString() { 28 | return "Services [list=" + list + "]"; 29 | } 30 | 31 | @Override 32 | public Iterator iterator() { 33 | return list.iterator(); 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Users.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.keystone.v3.model; 2 | 3 | import java.io.Serializable; 4 | import java.util.Iterator; 5 | import java.util.List; 6 | 7 | import com.fasterxml.jackson.annotation.JsonProperty; 8 | 9 | import com.woorea.openstack.keystone.model.User; 10 | 11 | public class Users implements Iterable, Serializable { 12 | 13 | @JsonProperty("users") 14 | private List list; 15 | 16 | /** 17 | * @return the list 18 | */ 19 | public List getList() { 20 | return list; 21 | } 22 | 23 | /* (non-Javadoc) 24 | * @see java.lang.Object#toString() 25 | */ 26 | @Override 27 | public String toString() { 28 | return "Users [list=" + list + "]"; 29 | } 30 | 31 | @Override 32 | public Iterator iterator() { 33 | return list.iterator(); 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /nova-client/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | 4 | com.woorea 5 | openstack-java-sdk 6 | 3.2.10-SNAPSHOT 7 | 8 | nova-client 9 | OpenStack Nova Client 10 | OpenStack Nova Client 11 | 12 | 13 | com.woorea 14 | openstack-client 15 | 3.2.10-SNAPSHOT 16 | 17 | 18 | com.woorea 19 | nova-model 20 | 3.2.10-SNAPSHOT 21 | 22 | 23 | -------------------------------------------------------------------------------- /nova-client/src/main/java/com/woorea/openstack/nova/api/ExtensionsResource.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.nova.api; 2 | 3 | 4 | import com.woorea.openstack.base.client.HttpMethod; 5 | import com.woorea.openstack.base.client.OpenStackClient; 6 | import com.woorea.openstack.base.client.OpenStackRequest; 7 | import com.woorea.openstack.nova.model.Extensions; 8 | 9 | public class ExtensionsResource { 10 | 11 | private final OpenStackClient CLIENT; 12 | 13 | public ExtensionsResource(OpenStackClient client) { 14 | CLIENT = client; 15 | } 16 | 17 | public List list(boolean detail) { 18 | return new List(detail); 19 | } 20 | 21 | public class List extends OpenStackRequest { 22 | 23 | public List(boolean detail) { 24 | super(CLIENT, HttpMethod.GET, detail ? buildPath("extensions", "detail") : buildPath("extensions"), null, Extensions.class); 25 | } 26 | 27 | } 28 | 29 | } 30 | 31 | -------------------------------------------------------------------------------- /nova-client/src/main/java/com/woorea/openstack/nova/api/HypervisorsResource.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.nova.api; 2 | 3 | import java.util.HashMap; 4 | 5 | import com.woorea.openstack.base.client.Entity; 6 | import com.woorea.openstack.base.client.HttpMethod; 7 | import com.woorea.openstack.base.client.OpenStackClient; 8 | import com.woorea.openstack.base.client.OpenStackRequest; 9 | import com.woorea.openstack.nova.model.Hypervisor; 10 | import com.woorea.openstack.nova.model.Hypervisors; 11 | 12 | /** 13 | * Model for HypervisorsResource 14 | * 15 | */ 16 | 17 | public class HypervisorsResource { 18 | 19 | private final OpenStackClient CLIENT; 20 | 21 | public HypervisorsResource(OpenStackClient client) { 22 | this.CLIENT = client; 23 | } 24 | 25 | public List list() { 26 | return new List(); 27 | } 28 | 29 | public class List extends OpenStackRequest { 30 | 31 | public List() { 32 | super(CLIENT, HttpMethod.GET, "/os-hypervisors", null, Hypervisors.class); 33 | } 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/CloudpipesExtension.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.nova.api.extensions; 2 | 3 | 4 | import com.woorea.openstack.base.client.Entity; 5 | import com.woorea.openstack.base.client.HttpMethod; 6 | import com.woorea.openstack.base.client.OpenStackClient; 7 | import com.woorea.openstack.base.client.OpenStackRequest; 8 | import com.woorea.openstack.nova.model.Cloudpipe; 9 | import com.woorea.openstack.nova.model.Cloudpipes; 10 | 11 | public class CloudpipesExtension { 12 | 13 | private final OpenStackClient CLIENT; 14 | 15 | public CloudpipesExtension(OpenStackClient client) { 16 | CLIENT = client; 17 | } 18 | 19 | public List list() { 20 | return new List(); 21 | } 22 | 23 | public Create create(Cloudpipe cloudpipe) { 24 | return new Create(cloudpipe); 25 | } 26 | 27 | public class List extends OpenStackRequest { 28 | 29 | 30 | public List() { 31 | super(CLIENT, HttpMethod.GET, "/os-cloudpipes", null, Cloudpipes.class); 32 | } 33 | 34 | } 35 | 36 | public class Create extends OpenStackRequest { 37 | 38 | private Cloudpipe cloudpipe; 39 | 40 | public Create(Cloudpipe cloudpipe) { 41 | super(CLIENT, HttpMethod.POST, "/os-cloudpipes", Entity.json(cloudpipe), Cloudpipe.class); 42 | this.cloudpipe = cloudpipe; 43 | } 44 | 45 | } 46 | 47 | 48 | 49 | } 50 | -------------------------------------------------------------------------------- /nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/CredentialsExtension.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.nova.api.extensions; 2 | 3 | 4 | import com.woorea.openstack.base.client.HttpMethod; 5 | import com.woorea.openstack.base.client.OpenStackClient; 6 | import com.woorea.openstack.base.client.OpenStackRequest; 7 | import com.woorea.openstack.nova.model.Certificate; 8 | 9 | public class CredentialsExtension { 10 | 11 | private final OpenStackClient CLIENT; 12 | 13 | public CredentialsExtension(OpenStackClient client) { 14 | CLIENT = client; 15 | } 16 | 17 | public Create createCertificate(String id) { 18 | return new Create(id); 19 | } 20 | 21 | public Show showCertificate(String id) { 22 | return new Show(); 23 | } 24 | 25 | public class Create extends OpenStackRequest { 26 | 27 | public Create(String id) { 28 | super(CLIENT, HttpMethod.GET, new StringBuffer("/os-certificates").append(id).toString(), null, Certificate.class); 29 | } 30 | 31 | } 32 | 33 | public class Show extends OpenStackRequest { 34 | 35 | public Show() { 36 | super(CLIENT, HttpMethod.GET, "/os-certificates", null, Certificate.class); 37 | } 38 | 39 | } 40 | 41 | 42 | 43 | } 44 | -------------------------------------------------------------------------------- /nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/FloatingIpPoolsExtension.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.nova.api.extensions; 2 | 3 | 4 | import com.woorea.openstack.base.client.HttpMethod; 5 | import com.woorea.openstack.base.client.OpenStackClient; 6 | import com.woorea.openstack.base.client.OpenStackRequest; 7 | import com.woorea.openstack.nova.model.FloatingIpPools; 8 | 9 | public class FloatingIpPoolsExtension { 10 | 11 | private final OpenStackClient CLIENT; 12 | 13 | public FloatingIpPoolsExtension(OpenStackClient client) { 14 | CLIENT = client; 15 | } 16 | 17 | public List list() { 18 | return new List(); 19 | } 20 | 21 | public class List extends OpenStackRequest { 22 | 23 | public List() { 24 | super(CLIENT, HttpMethod.GET, "/os-floating-ip-pools", null, FloatingIpPools.class); 25 | } 26 | 27 | } 28 | 29 | 30 | 31 | } 32 | -------------------------------------------------------------------------------- /nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/HostsExtension.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.nova.api.extensions; 2 | 3 | 4 | import com.woorea.openstack.base.client.HttpMethod; 5 | import com.woorea.openstack.base.client.OpenStackClient; 6 | import com.woorea.openstack.base.client.OpenStackRequest; 7 | import com.woorea.openstack.nova.model.Host; 8 | import com.woorea.openstack.nova.model.Hosts; 9 | 10 | public class HostsExtension { 11 | 12 | private final OpenStackClient CLIENT; 13 | 14 | public HostsExtension(OpenStackClient client) { 15 | CLIENT = client; 16 | } 17 | 18 | public List list() { 19 | return new List(); 20 | } 21 | 22 | public Show show(String id) { 23 | return new Show(id); 24 | } 25 | 26 | public class List extends OpenStackRequest { 27 | 28 | public List() { 29 | super(CLIENT, HttpMethod.GET, "/os-hosts", null, Hosts.class); 30 | } 31 | 32 | } 33 | 34 | public class Show extends OpenStackRequest { 35 | 36 | public Show(String id) { 37 | super(CLIENT, HttpMethod.GET, new StringBuffer("/os-hosts/").append(id).toString(), null, Host.class); 38 | } 39 | 40 | } 41 | 42 | 43 | 44 | } 45 | -------------------------------------------------------------------------------- /nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/HypervisorsExtension.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.nova.api.extensions; 2 | 3 | public class HypervisorsExtension { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /nova-model/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | 4 | com.woorea 5 | openstack-java-sdk 6 | 3.2.10-SNAPSHOT 7 | 8 | 9 | 10 | javax.xml.bind 11 | jaxb-api 12 | 2.2.12 13 | 14 | 15 | nova-model 16 | OpenStack Nova Model 17 | OpenStack Nova Model 18 | -------------------------------------------------------------------------------- /nova-model/src/main/java/com/woorea/openstack/nova/model/Certificate.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.nova.model; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import com.fasterxml.jackson.annotation.JsonRootName; 5 | 6 | @JsonRootName("certificate") 7 | public class Certificate { 8 | 9 | private String data; 10 | 11 | @JsonProperty("private_key") 12 | private String privateKey; 13 | 14 | /** 15 | * @return the data 16 | */ 17 | public String getData() { 18 | return data; 19 | } 20 | 21 | /** 22 | * @return the privateKey 23 | */ 24 | public String getPrivateKey() { 25 | return privateKey; 26 | } 27 | 28 | /* (non-Javadoc) 29 | * @see java.lang.Object#toString() 30 | */ 31 | @Override 32 | public String toString() { 33 | return "Certificate [data=" + data + ", privateKey=" + privateKey + "]"; 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /nova-model/src/main/java/com/woorea/openstack/nova/model/Cloudpipes.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.nova.model; 2 | 3 | import java.io.Serializable; 4 | import java.util.List; 5 | 6 | import com.fasterxml.jackson.annotation.JsonProperty; 7 | 8 | public class Cloudpipes implements Serializable { 9 | 10 | @JsonProperty("cloudpipes") 11 | private List list; 12 | 13 | /** 14 | * @return the list 15 | */ 16 | public List getList() { 17 | return list; 18 | } 19 | 20 | /* (non-Javadoc) 21 | * @see java.lang.Object#toString() 22 | */ 23 | @Override 24 | public String toString() { 25 | return "Flavors [list=" + list + "]"; 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /nova-model/src/main/java/com/woorea/openstack/nova/model/Extension.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.nova.model; 2 | 3 | import java.io.Serializable; 4 | import java.util.Calendar; 5 | import java.util.List; 6 | 7 | import com.fasterxml.jackson.annotation.JsonRootName; 8 | 9 | @JsonRootName("extension") 10 | public class Extension implements Serializable { 11 | 12 | private String alias; 13 | 14 | private String description; 15 | 16 | private String name; 17 | 18 | private String namespace; 19 | 20 | private Calendar updated; 21 | 22 | private List links; 23 | 24 | /** 25 | * @return the alias 26 | */ 27 | public String getAlias() { 28 | return alias; 29 | } 30 | 31 | /** 32 | * @return the description 33 | */ 34 | public String getDescription() { 35 | return description; 36 | } 37 | 38 | /** 39 | * @return the name 40 | */ 41 | public String getName() { 42 | return name; 43 | } 44 | 45 | /** 46 | * @return the namespace 47 | */ 48 | public String getNamespace() { 49 | return namespace; 50 | } 51 | 52 | /** 53 | * @return the updated 54 | */ 55 | public Calendar getUpdated() { 56 | return updated; 57 | } 58 | 59 | /** 60 | * @return the links 61 | */ 62 | public List getLinks() { 63 | return links; 64 | } 65 | 66 | /* (non-Javadoc) 67 | * @see java.lang.Object#toString() 68 | */ 69 | @Override 70 | public String toString() { 71 | return "Extension [alias=" + alias + ", description=" + description 72 | + ", name=" + name + ", namespace=" + namespace + "]"; 73 | } 74 | 75 | } 76 | -------------------------------------------------------------------------------- /nova-model/src/main/java/com/woorea/openstack/nova/model/Extensions.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.nova.model; 2 | 3 | import java.io.Serializable; 4 | import java.util.Iterator; 5 | import java.util.List; 6 | 7 | import com.fasterxml.jackson.annotation.JsonProperty; 8 | 9 | public class Extensions implements Iterable, Serializable { 10 | 11 | @JsonProperty("extensions") 12 | private List list; 13 | 14 | /** 15 | * @return the list 16 | */ 17 | public List getList() { 18 | return list; 19 | } 20 | 21 | @Override 22 | public Iterator iterator() { 23 | return list.iterator(); 24 | } 25 | 26 | /* (non-Javadoc) 27 | * @see java.lang.Object#toString() 28 | */ 29 | @Override 30 | public String toString() { 31 | return "Extensions [list=" + list + "]"; 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /nova-model/src/main/java/com/woorea/openstack/nova/model/Flavors.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.nova.model; 2 | 3 | import java.io.Serializable; 4 | import java.util.Iterator; 5 | import java.util.List; 6 | 7 | import com.fasterxml.jackson.annotation.JsonProperty; 8 | 9 | public class Flavors implements Iterable, Serializable { 10 | 11 | @JsonProperty("flavors") 12 | private List list; 13 | 14 | /** 15 | * @return the list 16 | */ 17 | public List getList() { 18 | return list; 19 | } 20 | 21 | @Override 22 | public Iterator iterator() { 23 | return list.iterator(); 24 | } 25 | 26 | /* (non-Javadoc) 27 | * @see java.lang.Object#toString() 28 | */ 29 | @Override 30 | public String toString() { 31 | return "Flavors [list=" + list + "]"; 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /nova-model/src/main/java/com/woorea/openstack/nova/model/FloatingIp.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.nova.model; 2 | 3 | import java.io.Serializable; 4 | 5 | import com.fasterxml.jackson.annotation.JsonProperty; 6 | import com.fasterxml.jackson.annotation.JsonRootName; 7 | 8 | @JsonRootName("floating_ip") 9 | public class FloatingIp implements Serializable { 10 | 11 | private String id; 12 | 13 | private String pool; 14 | 15 | private String ip; 16 | 17 | @JsonProperty("fixed_ip") 18 | private String fixedIp; 19 | 20 | @JsonProperty("instance_id") 21 | private String instanceId; 22 | 23 | /** 24 | * @return the id 25 | */ 26 | public String getId() { 27 | return id; 28 | } 29 | 30 | /** 31 | * @return the pool 32 | */ 33 | public String getPool() { 34 | return pool; 35 | } 36 | 37 | /** 38 | * @return the ip 39 | */ 40 | public String getIp() { 41 | return ip; 42 | } 43 | 44 | /** 45 | * @return the fixedIp 46 | */ 47 | public String getFixedIp() { 48 | return fixedIp; 49 | } 50 | 51 | /** 52 | * @return the instanceId 53 | */ 54 | public String getInstanceId() { 55 | return instanceId; 56 | } 57 | 58 | /* (non-Javadoc) 59 | * @see java.lang.Object#toString() 60 | */ 61 | @Override 62 | public String toString() { 63 | return "FloatingIp [id=" + id + ", pool=" + pool + ", ip=" + ip 64 | + ", fixedIp=" + fixedIp + ", instanceId=" + instanceId + "]"; 65 | } 66 | 67 | } 68 | -------------------------------------------------------------------------------- /nova-model/src/main/java/com/woorea/openstack/nova/model/FloatingIpDomain.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.nova.model; 2 | 3 | import java.io.Serializable; 4 | 5 | import com.fasterxml.jackson.annotation.JsonProperty; 6 | import com.fasterxml.jackson.annotation.JsonRootName; 7 | 8 | @JsonRootName("floating-ip-pool") 9 | public class FloatingIpDomain implements Serializable { 10 | 11 | private String domain; 12 | 13 | private String scope; 14 | 15 | private String project; 16 | 17 | @JsonProperty("availabilityZone") 18 | private String availabilityZone; 19 | 20 | /** 21 | * @return the domain 22 | */ 23 | public String getDomain() { 24 | return domain; 25 | } 26 | 27 | /** 28 | * @return the scope 29 | */ 30 | public String getScope() { 31 | return scope; 32 | } 33 | 34 | /** 35 | * @return the project 36 | */ 37 | public String getProject() { 38 | return project; 39 | } 40 | 41 | /** 42 | * @return the availabilityZone 43 | */ 44 | public String getAvailabilityZone() { 45 | return availabilityZone; 46 | } 47 | 48 | /* (non-Javadoc) 49 | * @see java.lang.Object#toString() 50 | */ 51 | @Override 52 | public String toString() { 53 | return "FloatingIpDomain [domain=" + domain + ", scope=" + scope 54 | + ", project=" + project + ", availabilityZone=" 55 | + availabilityZone + "]"; 56 | } 57 | 58 | } 59 | -------------------------------------------------------------------------------- /nova-model/src/main/java/com/woorea/openstack/nova/model/FloatingIpDomains.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.nova.model; 2 | 3 | import java.io.Serializable; 4 | import java.util.Iterator; 5 | import java.util.List; 6 | 7 | import com.fasterxml.jackson.annotation.JsonProperty; 8 | 9 | public class FloatingIpDomains implements Iterable, Serializable { 10 | 11 | @JsonProperty("domain_entries") 12 | private List list; 13 | 14 | /** 15 | * @return the list 16 | */ 17 | public List getList() { 18 | return list; 19 | } 20 | 21 | @Override 22 | public Iterator iterator() { 23 | return list.iterator(); 24 | } 25 | 26 | /* (non-Javadoc) 27 | * @see java.lang.Object#toString() 28 | */ 29 | @Override 30 | public String toString() { 31 | return "FloatingIpDomains [list=" + list + "]"; 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /nova-model/src/main/java/com/woorea/openstack/nova/model/FloatingIpPools.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.nova.model; 2 | 3 | import java.io.Serializable; 4 | import java.util.Iterator; 5 | import java.util.List; 6 | 7 | import com.fasterxml.jackson.annotation.JsonProperty; 8 | 9 | import com.woorea.openstack.nova.model.FloatingIpPools.FloatingIpPool; 10 | 11 | public class FloatingIpPools implements Iterable, Serializable { 12 | 13 | public static class FloatingIpPool implements Serializable { 14 | 15 | private String name; 16 | 17 | /** 18 | * @return the name 19 | */ 20 | public String getName() { 21 | return name; 22 | } 23 | 24 | /* (non-Javadoc) 25 | * @see java.lang.Object#toString() 26 | */ 27 | @Override 28 | public String toString() { 29 | return "FloatingIpPool [name=" + name + "]"; 30 | } 31 | 32 | } 33 | 34 | @JsonProperty("floating_ip_pools") 35 | private List list; 36 | 37 | /** 38 | * @return the list 39 | */ 40 | public List getList() { 41 | return list; 42 | } 43 | 44 | @Override 45 | public Iterator iterator() { 46 | return list.iterator(); 47 | } 48 | 49 | /* (non-Javadoc) 50 | * @see java.lang.Object#toString() 51 | */ 52 | @Override 53 | public String toString() { 54 | return "FloatingIpPools [list=" + list + "]"; 55 | } 56 | 57 | } 58 | -------------------------------------------------------------------------------- /nova-model/src/main/java/com/woorea/openstack/nova/model/FloatingIps.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.nova.model; 2 | 3 | import java.io.Serializable; 4 | import java.util.Iterator; 5 | import java.util.List; 6 | 7 | import com.fasterxml.jackson.annotation.JsonProperty; 8 | 9 | public class FloatingIps implements Iterable, Serializable { 10 | 11 | @JsonProperty("floating_ips") 12 | private List list; 13 | 14 | /** 15 | * @return the list 16 | */ 17 | public List getList() { 18 | return list; 19 | } 20 | 21 | /* (non-Javadoc) 22 | * @see java.lang.Object#toString() 23 | */ 24 | @Override 25 | public String toString() { 26 | return "FloatingIps [list=" + list + "]"; 27 | } 28 | 29 | @Override 30 | public Iterator iterator() { 31 | return list.iterator(); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /nova-model/src/main/java/com/woorea/openstack/nova/model/HostAggregates.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.nova.model; 2 | 3 | import java.io.Serializable; 4 | import java.util.Iterator; 5 | import java.util.List; 6 | 7 | import com.fasterxml.jackson.annotation.JsonProperty; 8 | 9 | public class HostAggregates implements Iterable, Serializable { 10 | 11 | @JsonProperty("aggregates") 12 | private List list; 13 | 14 | /** 15 | * @return the list 16 | */ 17 | public List getList() { 18 | return list; 19 | } 20 | 21 | @Override 22 | public Iterator iterator() { 23 | return list.iterator(); 24 | } 25 | 26 | /* (non-Javadoc) 27 | * @see java.lang.Object#toString() 28 | */ 29 | @Override 30 | public String toString() { 31 | return "HostAggregates [list=" + list + "]"; 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /nova-model/src/main/java/com/woorea/openstack/nova/model/Hosts.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.nova.model; 2 | 3 | import java.io.Serializable; 4 | import java.util.Iterator; 5 | import java.util.List; 6 | 7 | import com.fasterxml.jackson.annotation.JsonProperty; 8 | 9 | public class Hosts implements Iterable, Serializable { 10 | 11 | public static final class Host { 12 | 13 | private String zone; 14 | 15 | @JsonProperty("host_name") 16 | private String hostName; 17 | 18 | private String service; 19 | 20 | /** 21 | * @return the hostName 22 | */ 23 | public String getHostName() { 24 | return hostName; 25 | } 26 | 27 | /** 28 | * @return the service 29 | */ 30 | public String getService() { 31 | return service; 32 | } 33 | 34 | public String getZone() { 35 | return zone; 36 | } 37 | 38 | public void setZone(String zone) { 39 | this.zone = zone; 40 | } 41 | 42 | /* (non-Javadoc) 43 | * @see java.lang.Object#toString() 44 | */ 45 | @Override 46 | public String toString() { 47 | return "Host [hostName=" + hostName + ", service=" + service + "]"; 48 | } 49 | 50 | } 51 | 52 | @JsonProperty("hosts") 53 | private List list; 54 | 55 | /** 56 | * @return the list 57 | */ 58 | public List getList() { 59 | return list; 60 | } 61 | 62 | @Override 63 | public Iterator iterator() { 64 | return list.iterator(); 65 | } 66 | 67 | /* (non-Javadoc) 68 | * @see java.lang.Object#toString() 69 | */ 70 | @Override 71 | public String toString() { 72 | return "Hosts [list=" + list + "]"; 73 | } 74 | 75 | 76 | 77 | } 78 | -------------------------------------------------------------------------------- /nova-model/src/main/java/com/woorea/openstack/nova/model/Hypervisor.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.nova.model; 2 | 3 | import java.io.Serializable; 4 | import com.fasterxml.jackson.annotation.JsonProperty; 5 | import com.fasterxml.jackson.annotation.JsonRootName; 6 | 7 | /** 8 | * Model for Hypervisor 9 | * 10 | */ 11 | @JsonRootName("hypervisor") 12 | public class Hypervisor implements Serializable { 13 | 14 | private String id; 15 | private String hypervisor_hostname; 16 | 17 | public String getId() { 18 | return id; 19 | } 20 | 21 | public void setHypervisor_hostname(String hypervisor_hostname) { 22 | this.hypervisor_hostname = hypervisor_hostname; 23 | } 24 | 25 | public String getHypervisor_hostname() { 26 | return hypervisor_hostname; 27 | } 28 | 29 | @Override 30 | public String toString() { 31 | return "Hypervisor {" 32 | + "hypervisor_hostname='" + hypervisor_hostname 33 | + ", id='" + id 34 | + '}'; 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /nova-model/src/main/java/com/woorea/openstack/nova/model/Hypervisors.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.nova.model; 2 | 3 | import java.util.Iterator; 4 | import java.util.List; 5 | import com.fasterxml.jackson.annotation.JsonProperty; 6 | 7 | /** 8 | * Model for List of Hypervisors 9 | * 10 | */ 11 | public class Hypervisors implements Iterable { 12 | 13 | @JsonProperty("hypervisors") 14 | private List list; 15 | 16 | public List getList() { 17 | return list; 18 | } 19 | 20 | public void setList(List list) { 21 | this.list = list; 22 | } 23 | 24 | @Override 25 | public Iterator iterator() { 26 | return list.iterator(); 27 | } 28 | 29 | @Override 30 | public String toString() { 31 | return "Hypervisors [list=" + list + "]"; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /nova-model/src/main/java/com/woorea/openstack/nova/model/Images.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.nova.model; 2 | 3 | import java.io.Serializable; 4 | import java.util.Iterator; 5 | import java.util.List; 6 | 7 | import com.fasterxml.jackson.annotation.JsonProperty; 8 | 9 | public class Images implements Iterable, Serializable { 10 | 11 | @JsonProperty("images") 12 | private List list; 13 | 14 | /** 15 | * @return the list 16 | */ 17 | public List getList() { 18 | return list; 19 | } 20 | 21 | @Override 22 | public Iterator iterator() { 23 | return list.iterator(); 24 | } 25 | 26 | 27 | /* (non-Javadoc) 28 | * @see java.lang.Object#toString() 29 | */ 30 | @Override 31 | public String toString() { 32 | return "Images [list=" + list + "]"; 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /nova-model/src/main/java/com/woorea/openstack/nova/model/KeyPairs.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.nova.model; 2 | 3 | import java.io.Serializable; 4 | import java.util.ArrayList; 5 | import java.util.Iterator; 6 | import java.util.List; 7 | 8 | import com.fasterxml.jackson.annotation.JsonProperty; 9 | 10 | public class KeyPairs implements Iterable, Serializable { 11 | 12 | public static final class KeyPairWrapper implements Serializable { 13 | 14 | @JsonProperty 15 | private KeyPair keypair; 16 | 17 | } 18 | 19 | @JsonProperty("keypairs") 20 | private List list; 21 | 22 | /** 23 | * @return the list 24 | */ 25 | public List getList() { 26 | List list = new ArrayList(); 27 | for(KeyPairWrapper wrapper : this.list) { 28 | list.add(wrapper.keypair); 29 | } 30 | return list; 31 | } 32 | 33 | @Override 34 | public Iterator iterator() { 35 | return getList().iterator(); 36 | } 37 | 38 | /* (non-Javadoc) 39 | * @see java.lang.Object#toString() 40 | */ 41 | @Override 42 | public String toString() { 43 | return "KeyPairs [list=" + getList() + "]"; 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /nova-model/src/main/java/com/woorea/openstack/nova/model/Link.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.nova.model; 2 | 3 | import java.io.Serializable; 4 | 5 | public class Link implements Serializable { 6 | 7 | private String rel; 8 | 9 | private String href; 10 | 11 | private String type; 12 | 13 | /** 14 | * @return the rel 15 | */ 16 | public String getRel() { 17 | return rel; 18 | } 19 | 20 | /** 21 | * @return the href 22 | */ 23 | public String getHref() { 24 | return href; 25 | } 26 | 27 | /** 28 | * @return the type 29 | */ 30 | public String getType() { 31 | return type; 32 | } 33 | 34 | /* (non-Javadoc) 35 | * @see java.lang.Object#toString() 36 | */ 37 | @Override 38 | public String toString() { 39 | return "Link [rel=" + rel + ", href=" + href + ", type=" + type + "]"; 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /nova-model/src/main/java/com/woorea/openstack/nova/model/Metadata.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.nova.model; 2 | 3 | import java.util.Map; 4 | 5 | public class Metadata { 6 | 7 | private Map metadata; 8 | 9 | /** 10 | * @return the metadata 11 | */ 12 | public Map getMetadata() { 13 | return metadata; 14 | } 15 | 16 | /** 17 | * Set the metadata 18 | * @param metadata 19 | */ 20 | public void setMetadata(Map metadata) { 21 | this.metadata = metadata; 22 | } 23 | 24 | 25 | 26 | } 27 | -------------------------------------------------------------------------------- /nova-model/src/main/java/com/woorea/openstack/nova/model/NetworkForCreate.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.nova.model; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import com.fasterxml.jackson.annotation.JsonRootName; 5 | 6 | public class NetworkForCreate { 7 | 8 | @JsonProperty("uuid") 9 | private String id; 10 | @JsonProperty("fixed_ip") 11 | private String fixedIp; 12 | 13 | public String getId() { 14 | return id; 15 | } 16 | 17 | public String getFixedIp() { 18 | return fixedIp; 19 | } 20 | 21 | public void setId(String id) { 22 | this.id = id; 23 | } 24 | 25 | public void setFixedIp(String fixedIp) { 26 | this.fixedIp = fixedIp; 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /nova-model/src/main/java/com/woorea/openstack/nova/model/Networks.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.nova.model; 2 | 3 | import java.io.Serializable; 4 | import java.util.Iterator; 5 | import java.util.List; 6 | 7 | import com.fasterxml.jackson.annotation.JsonProperty; 8 | 9 | public class Networks implements Iterable, Serializable { 10 | 11 | @JsonProperty("networks") 12 | private List list; 13 | 14 | /** 15 | * @return the list 16 | */ 17 | public List getList() { 18 | return list; 19 | } 20 | 21 | /* (non-Javadoc) 22 | * @see java.lang.Object#toString() 23 | */ 24 | @Override 25 | public String toString() { 26 | return "Servers [list=" + list + "]"; 27 | } 28 | 29 | @Override 30 | public Iterator iterator() { 31 | return list.iterator(); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /nova-model/src/main/java/com/woorea/openstack/nova/model/PersonalityFile.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.nova.model; 2 | 3 | import java.io.Serializable; 4 | 5 | public final class PersonalityFile implements Serializable { 6 | 7 | private String path; 8 | 9 | private String contents; 10 | 11 | /** 12 | * @return the path 13 | */ 14 | public String getPath() { 15 | return path; 16 | } 17 | 18 | /** 19 | * @param path the path to set 20 | */ 21 | public void setPath(String path) { 22 | this.path = path; 23 | } 24 | 25 | /** 26 | * @return the contents 27 | */ 28 | public String getContents() { 29 | return contents; 30 | } 31 | 32 | /** 33 | * @param contents the contents to set 34 | */ 35 | public void setContents(String contents) { 36 | this.contents = contents; 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /nova-model/src/main/java/com/woorea/openstack/nova/model/SecurityGroupForCreate.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.nova.model; 2 | 3 | import java.io.Serializable; 4 | 5 | import com.fasterxml.jackson.annotation.JsonRootName; 6 | 7 | @JsonRootName("security_group") 8 | public class SecurityGroupForCreate implements Serializable { 9 | 10 | private String name; 11 | 12 | private String description; 13 | 14 | public SecurityGroupForCreate() { 15 | super(); 16 | } 17 | 18 | public SecurityGroupForCreate(String name) { 19 | this.name = name; 20 | } 21 | 22 | public SecurityGroupForCreate(String name, String description) { 23 | this(name); 24 | this.description = description; 25 | } 26 | 27 | /** 28 | * @return the name 29 | */ 30 | public String getName() { 31 | return name; 32 | } 33 | 34 | /** 35 | * @param name the name to set 36 | */ 37 | public void setName(String name) { 38 | this.name = name; 39 | } 40 | 41 | /** 42 | * @return the description 43 | */ 44 | public String getDescription() { 45 | return description; 46 | } 47 | 48 | /** 49 | * @param description the description to set 50 | */ 51 | public void setDescription(String description) { 52 | this.description = description; 53 | } 54 | 55 | /* (non-Javadoc) 56 | * @see java.lang.Object#toString() 57 | */ 58 | @Override 59 | public String toString() { 60 | return "SecurityGroupForCreate [name=" + name + ", description=" 61 | + description + "]"; 62 | } 63 | 64 | } 65 | -------------------------------------------------------------------------------- /nova-model/src/main/java/com/woorea/openstack/nova/model/SecurityGroups.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.nova.model; 2 | 3 | import java.io.Serializable; 4 | import java.util.Iterator; 5 | import java.util.List; 6 | 7 | import com.fasterxml.jackson.annotation.JsonProperty; 8 | 9 | public class SecurityGroups implements Iterable, Serializable { 10 | 11 | @JsonProperty("security_groups") 12 | private List list; 13 | 14 | /** 15 | * @return the list 16 | */ 17 | public List getList() { 18 | return list; 19 | } 20 | 21 | /* (non-Javadoc) 22 | * @see java.lang.Object#toString() 23 | */ 24 | @Override 25 | public String toString() { 26 | return "SecurityGroups [list=" + list + "]"; 27 | } 28 | 29 | @Override 30 | public Iterator iterator() { 31 | return list.iterator(); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /nova-model/src/main/java/com/woorea/openstack/nova/model/Servers.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.nova.model; 2 | 3 | import java.io.Serializable; 4 | import java.util.Iterator; 5 | import java.util.List; 6 | 7 | import com.fasterxml.jackson.annotation.JsonProperty; 8 | 9 | public class Servers implements Iterable, Serializable { 10 | 11 | @JsonProperty("servers") 12 | private List list; 13 | 14 | /** 15 | * @return the list 16 | */ 17 | public List getList() { 18 | return list; 19 | } 20 | 21 | @Override 22 | public Iterator iterator() { 23 | return list.iterator(); 24 | } 25 | 26 | /* (non-Javadoc) 27 | * @see java.lang.Object#toString() 28 | */ 29 | @Override 30 | public String toString() { 31 | return "Servers [list=" + list + "]"; 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /nova-model/src/main/java/com/woorea/openstack/nova/model/Services.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.nova.model; 2 | 3 | import java.util.Iterator; 4 | import java.util.List; 5 | import com.fasterxml.jackson.annotation.JsonProperty; 6 | 7 | /** 8 | * Model for List of Services 9 | * 10 | */ 11 | public class Services implements Iterable { 12 | 13 | @JsonProperty("services") 14 | private List list; 15 | 16 | public List getList() { 17 | return list; 18 | } 19 | 20 | public void setList(List list) { 21 | this.list = list; 22 | } 23 | 24 | @Override 25 | public Iterator iterator() { 26 | return list.iterator(); 27 | } 28 | 29 | @Override 30 | public String toString() { 31 | return "Services [list=" + list + "]"; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /nova-model/src/main/java/com/woorea/openstack/nova/model/SimpleTenantUsages.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.nova.model; 2 | 3 | import java.io.Serializable; 4 | import java.util.Iterator; 5 | import java.util.List; 6 | 7 | import com.fasterxml.jackson.annotation.JsonProperty; 8 | 9 | public class SimpleTenantUsages implements Iterable, Serializable { 10 | 11 | @JsonProperty("tenant_usages") 12 | private List list; 13 | 14 | /** 15 | * @return the list 16 | */ 17 | public List getList() { 18 | return list; 19 | } 20 | 21 | /* (non-Javadoc) 22 | * @see java.lang.Object#toString() 23 | */ 24 | @Override 25 | public String toString() { 26 | return "SimpleTenantUsage [list=" + list + "]"; 27 | } 28 | 29 | @Override 30 | public Iterator iterator() { 31 | return list.iterator(); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /nova-model/src/main/java/com/woorea/openstack/nova/model/Snapshots.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.nova.model; 2 | 3 | import java.io.Serializable; 4 | import java.util.Iterator; 5 | import java.util.List; 6 | 7 | import com.fasterxml.jackson.annotation.JsonProperty; 8 | 9 | public class Snapshots implements Iterable, Serializable { 10 | 11 | @JsonProperty("snapshots") 12 | private List list; 13 | 14 | /** 15 | * @return the list 16 | */ 17 | public List getList() { 18 | return list; 19 | } 20 | 21 | /* (non-Javadoc) 22 | * @see java.lang.Object#toString() 23 | */ 24 | @Override 25 | public String toString() { 26 | return "Snapshots [list=" + list + "]"; 27 | } 28 | 29 | @Override 30 | public Iterator iterator() { 31 | return list.iterator(); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /nova-model/src/main/java/com/woorea/openstack/nova/model/VolumeAttachment.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.nova.model; 2 | 3 | import java.io.Serializable; 4 | 5 | import com.fasterxml.jackson.annotation.JsonRootName; 6 | 7 | @JsonRootName("volumeAttachment") 8 | public class VolumeAttachment implements Serializable { 9 | 10 | private String id; 11 | 12 | private String volumeId; 13 | 14 | private String serverId; 15 | 16 | private String device; 17 | 18 | public String getId() { 19 | return id; 20 | } 21 | 22 | public void setId(String id) { 23 | this.id = id; 24 | } 25 | 26 | public String getVolumeId() { 27 | return volumeId; 28 | } 29 | 30 | public void setVolumeId(String volumeId) { 31 | this.volumeId = volumeId; 32 | } 33 | 34 | public String getServerId() { 35 | return serverId; 36 | } 37 | 38 | public void setServerId(String serverId) { 39 | this.serverId = serverId; 40 | } 41 | 42 | public String getDevice() { 43 | return device; 44 | } 45 | 46 | public void setDevice(String device) { 47 | this.device = device; 48 | } 49 | 50 | /* (non-Javadoc) 51 | * @see java.lang.Object#toString() 52 | */ 53 | @Override 54 | public String toString() { 55 | return "VolumeAttachment [id=" + id + ", volumeId=" + volumeId 56 | + ", serverId=" + serverId + ", device=" + device + "]"; 57 | } 58 | 59 | } 60 | -------------------------------------------------------------------------------- /nova-model/src/main/java/com/woorea/openstack/nova/model/VolumeAttachments.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.nova.model; 2 | 3 | import java.io.Serializable; 4 | import java.util.Iterator; 5 | import java.util.List; 6 | 7 | import com.fasterxml.jackson.annotation.JsonProperty; 8 | 9 | public class VolumeAttachments implements Iterable, Serializable { 10 | 11 | @JsonProperty("volumeAttachments") 12 | private List list; 13 | 14 | /** 15 | * @return the list 16 | */ 17 | public List getList() { 18 | return list; 19 | } 20 | 21 | @Override 22 | public Iterator iterator() { 23 | return list.iterator(); 24 | } 25 | 26 | /* (non-Javadoc) 27 | * @see java.lang.Object#toString() 28 | */ 29 | @Override 30 | public String toString() { 31 | return "VolumeAttachments [list=" + list + "]"; 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /nova-model/src/main/java/com/woorea/openstack/nova/model/VolumeForImageCreate.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.nova.model; 2 | 3 | import java.io.Serializable; 4 | 5 | import com.fasterxml.jackson.annotation.JsonProperty; 6 | import com.fasterxml.jackson.annotation.JsonRootName; 7 | 8 | @JsonRootName("os-volume_upload_image") 9 | public class VolumeForImageCreate implements Serializable { 10 | String volumeId; 11 | String tenantId; 12 | 13 | public String getTenantId() { 14 | return tenantId; 15 | } 16 | 17 | public void setTenantId(String tenantId) { 18 | this.tenantId = tenantId; 19 | } 20 | 21 | @JsonProperty("force") 22 | private Boolean force; 23 | 24 | public Boolean getForce() { 25 | return force; 26 | } 27 | 28 | public void setForce(Boolean force) { 29 | this.force = force; 30 | } 31 | 32 | @JsonProperty("container_format") 33 | String container_format; 34 | @JsonProperty("disk_format") 35 | String disk_format; 36 | @JsonProperty("image_name") 37 | String image_name; 38 | 39 | public String getVolumeId() { 40 | return volumeId; 41 | } 42 | 43 | public void setVolumeId(String volumeId) { 44 | this.volumeId = volumeId; 45 | } 46 | 47 | public String getContainer_format() { 48 | return container_format; 49 | } 50 | 51 | public void setContainer_format(String container_format) { 52 | this.container_format = container_format; 53 | } 54 | 55 | public String getDisk_format() { 56 | return disk_format; 57 | } 58 | 59 | public void setDisk_format(String disk_format) { 60 | this.disk_format = disk_format; 61 | } 62 | 63 | public String getImage_name() { 64 | return image_name; 65 | } 66 | 67 | public void setImage_name(String image_name) { 68 | this.image_name = image_name; 69 | } 70 | 71 | } 72 | -------------------------------------------------------------------------------- /nova-model/src/main/java/com/woorea/openstack/nova/model/VolumeType.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.nova.model; 2 | 3 | import java.io.Serializable; 4 | 5 | import com.fasterxml.jackson.annotation.JsonRootName; 6 | 7 | @JsonRootName("volume-type") 8 | public class VolumeType implements Serializable { 9 | 10 | } 11 | -------------------------------------------------------------------------------- /nova-model/src/main/java/com/woorea/openstack/nova/model/VolumeTypes.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.nova.model; 2 | 3 | import java.io.Serializable; 4 | import java.util.Iterator; 5 | import java.util.List; 6 | 7 | import com.fasterxml.jackson.annotation.JsonProperty; 8 | 9 | public class VolumeTypes implements Iterable, Serializable { 10 | 11 | @JsonProperty("volume-types") 12 | private List list; 13 | 14 | /** 15 | * @return the list 16 | */ 17 | public List getList() { 18 | return list; 19 | } 20 | 21 | @Override 22 | public Iterator iterator() { 23 | return list.iterator(); 24 | } 25 | 26 | /* (non-Javadoc) 27 | * @see java.lang.Object#toString() 28 | */ 29 | @Override 30 | public String toString() { 31 | return "VolumeTypes [list=" + list + "]"; 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /nova-model/src/main/java/com/woorea/openstack/nova/model/Volumes.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.nova.model; 2 | 3 | import java.io.Serializable; 4 | import java.util.Iterator; 5 | import java.util.List; 6 | 7 | import com.fasterxml.jackson.annotation.JsonProperty; 8 | 9 | public class Volumes implements Iterable, Serializable { 10 | 11 | @JsonProperty("volumes") 12 | private List list; 13 | 14 | /** 15 | * @return the list 16 | */ 17 | public List getList() { 18 | return list; 19 | } 20 | 21 | /* (non-Javadoc) 22 | * @see java.lang.Object#toString() 23 | */ 24 | @Override 25 | public String toString() { 26 | return "Volumes [list=" + list + "]"; 27 | } 28 | 29 | @Override 30 | public Iterator iterator() { 31 | return list.iterator(); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /openstack-client-connectors/jersey-connector/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | 4 | com.woorea 5 | openstack-client-connectors 6 | 3.2.10-SNAPSHOT 7 | 8 | jersey-connector 9 | OpenStack Jersey Connector 10 | OpenStack Jersey Connector 11 | 12 | 13 | com.sun.jersey 14 | jersey-client 15 | 1.17.1 16 | 17 | 18 | com.fasterxml.jackson.jaxrs 19 | jackson-jaxrs-json-provider 20 | 2.9.8 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /openstack-client-connectors/jersey-connector/src/main/java/com/woorea/openstack/connector/JerseyResponse.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.connector; 2 | 3 | import java.io.InputStream; 4 | import java.util.HashMap; 5 | import java.util.Map; 6 | 7 | import com.sun.jersey.api.client.ClientResponse; 8 | import com.woorea.openstack.base.client.OpenStackResponse; 9 | import com.woorea.openstack.base.client.OpenStackResponseException; 10 | 11 | public class JerseyResponse implements OpenStackResponse { 12 | 13 | private ClientResponse response; 14 | 15 | public JerseyResponse(ClientResponse response) { 16 | this.response = response; 17 | } 18 | 19 | @Override 20 | public T getEntity(Class returnType) { 21 | if(response.getStatus() >= 400) { 22 | throw new OpenStackResponseException(response.getClientResponseStatus().getReasonPhrase(), 23 | response.getStatus()); 24 | } 25 | if(response.hasEntity() && returnType != null && Void.class != returnType) { 26 | return response.getEntity(returnType); 27 | } else { 28 | return null; 29 | } 30 | } 31 | 32 | @Override 33 | public InputStream getInputStream() { 34 | if(response.hasEntity()) { 35 | return response.getEntityInputStream(); 36 | } else { 37 | return null; 38 | } 39 | } 40 | 41 | @Override 42 | public String header(String name) { 43 | return response.getHeaders().getFirst(name); 44 | } 45 | 46 | @Override 47 | public Map headers() { 48 | Map headers = new HashMap(); 49 | for(String k : response.getHeaders().keySet()) { 50 | headers.put(k, response.getHeaders().getFirst(k)); 51 | } 52 | return headers; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /openstack-client-connectors/jersey-connector/src/main/resources/META-INF/services/com.woorea.openstack.base.client.OpenStackClientConnector: -------------------------------------------------------------------------------- 1 | com.woorea.openstack.connector.JerseyConnector -------------------------------------------------------------------------------- /openstack-client-connectors/jersey2-connector/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4.0.0 4 | 5 | com.woorea 6 | openstack-client-connectors 7 | 3.2.10-SNAPSHOT 8 | 9 | jersey2-connector 10 | OpenStack Jersey2 Connector 11 | OpenStack Jersey2 Connector 12 | http://maven.apache.org 13 | 14 | UTF-8 15 | 16 | 17 | 18 | org.glassfish.jersey.core 19 | jersey-client 20 | 2.6 21 | 22 | 23 | org.glassfish.jersey.media 24 | jersey-media-json-jackson 25 | 2.6 26 | 27 | 28 | com.woorea 29 | openstack-client 30 | 3.2.10-SNAPSHOT 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /openstack-client-connectors/jersey2-connector/src/main/java/com/woorea/openstack/connector/JaxRs20Response.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.connector; 2 | 3 | import java.io.InputStream; 4 | import java.util.HashMap; 5 | import java.util.Map; 6 | 7 | import javax.ws.rs.core.Response; 8 | 9 | import com.woorea.openstack.base.client.OpenStackResponse; 10 | import com.woorea.openstack.base.client.OpenStackResponseException; 11 | 12 | public class JaxRs20Response implements OpenStackResponse { 13 | 14 | private Response response; 15 | 16 | public JaxRs20Response(Response response) { 17 | this.response = response; 18 | } 19 | 20 | @Override 21 | public T getEntity(Class returnType) { 22 | if(response.getStatus() >= 400) { 23 | throw new OpenStackResponseException(response.getStatusInfo().getReasonPhrase(), 24 | response.getStatusInfo().getStatusCode()); 25 | } 26 | return response.readEntity(returnType); 27 | } 28 | 29 | @Override 30 | public InputStream getInputStream() { 31 | return (InputStream) response.getEntity(); 32 | } 33 | 34 | @Override 35 | public String header(String name) { 36 | return response.getHeaderString(name); 37 | } 38 | 39 | @Override 40 | public Map headers() { 41 | Map headers = new HashMap(); 42 | for(String k : response.getHeaders().keySet()) { 43 | headers.put(k, response.getHeaderString(k)); 44 | } 45 | return headers; 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /openstack-client-connectors/jersey2-connector/src/main/resources/META-INF/services/com.woorea.openstack.base.client.OpenStackClientConnector: -------------------------------------------------------------------------------- 1 | com.woorea.openstack.connector.JaxRs20Connector -------------------------------------------------------------------------------- /openstack-client-connectors/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | 4 | com.woorea 5 | openstack-java-sdk 6 | 3.2.10-SNAPSHOT 7 | 8 | openstack-client-connectors 9 | OpenStack Client Connectors 10 | OpenStack Client Connectors 11 | pom 12 | 13 | 14 | jersey 15 | 16 | true 17 | 18 | 19 | jersey-connector 20 | 21 | 22 | 23 | jersey2 24 | 25 | true 26 | 27 | 28 | jersey2-connector 29 | 30 | 31 | 32 | resteasy 33 | 34 | true 35 | 36 | 37 | resteasy-connector 38 | 39 | 40 | 41 | 42 | 43 | com.woorea 44 | openstack-client 45 | 3.2.10-SNAPSHOT 46 | 47 | 48 | -------------------------------------------------------------------------------- /openstack-client-connectors/resteasy-connector/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | 4 | com.woorea 5 | openstack-client-connectors 6 | 3.2.10-SNAPSHOT 7 | 8 | resteasy-connector 9 | OpenStack RESTEasy Connector 10 | OpenStack RESTEasy Connector 11 | 12 | 13 | org.jboss.resteasy 14 | resteasy-jaxrs 15 | 3.0.26.Final 16 | 17 | 18 | com.fasterxml.jackson.jaxrs 19 | jackson-jaxrs-json-provider 20 | 2.9.8 21 | 22 | 23 | org.apache.httpcomponents 24 | httpclient 25 | 4.5.5 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /openstack-client-connectors/resteasy-connector/src/main/java/com/woorea/openstack/connector/RESTEasyInputStream.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.connector; 2 | 3 | import java.io.FilterInputStream; 4 | import java.io.IOException; 5 | import java.io.InputStream; 6 | import java.net.SocketException; 7 | 8 | import org.jboss.resteasy.client.ClientExecutor; 9 | 10 | 11 | public class RESTEasyInputStream extends FilterInputStream { 12 | 13 | protected ClientExecutor clientExecutor; 14 | 15 | public RESTEasyInputStream(InputStream inputStream, ClientExecutor clientExecutor) { 16 | super(inputStream); 17 | this.clientExecutor = clientExecutor; 18 | } 19 | 20 | @Override 21 | public void close() throws IOException { 22 | try { 23 | clientExecutor.close(); 24 | } catch (Exception e) { 25 | // Silently skip errors in the socket close errors 26 | } 27 | 28 | try { 29 | super.close(); 30 | } catch (SocketException e) { 31 | // We expect this exception because the socket is closed 32 | } catch (IllegalStateException e) { 33 | // We expect this exception because the socket is closed (httpclient 4.2) 34 | } 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /openstack-client-connectors/resteasy-connector/src/main/java/com/woorea/openstack/connector/RESTEasyResponse.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.connector; 2 | 3 | import org.jboss.resteasy.client.ClientRequest; 4 | import org.jboss.resteasy.client.ClientResponse; 5 | import com.woorea.openstack.base.client.OpenStackResponse; 6 | 7 | import javax.ws.rs.core.MultivaluedMap; 8 | import java.io.InputStream; 9 | import java.util.HashMap; 10 | import java.util.Map; 11 | 12 | public class RESTEasyResponse implements OpenStackResponse { 13 | 14 | private ClientRequest client; 15 | 16 | private ClientResponse response; 17 | 18 | public RESTEasyResponse(ClientRequest client, ClientResponse response) { 19 | this.client = client; 20 | this.response = response; 21 | } 22 | 23 | @Override 24 | public T getEntity(Class returnType) { 25 | return (T) response.getEntity(returnType); 26 | } 27 | 28 | @Override 29 | public InputStream getInputStream() { 30 | return new RESTEasyInputStream((InputStream) response.getEntity(InputStream.class), client.getExecutor()); 31 | } 32 | 33 | @Override 34 | public String header(String name) { 35 | return response.getHeaders().getFirst(name).toString(); 36 | } 37 | 38 | @Override 39 | public Map headers() { 40 | Map headers = new HashMap(); 41 | MultivaluedMap responseHeaders = response.getHeaders(); 42 | 43 | for (String key : responseHeaders.keySet()) { 44 | headers.put(key, responseHeaders.getFirst(key).toString()); 45 | } 46 | 47 | return headers; 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /openstack-client-connectors/resteasy-connector/src/main/resources/META-INF/services/com.woorea.openstack.base.client.OpenStackClientConnector: -------------------------------------------------------------------------------- 1 | com.woorea.openstack.connector.RESTEasyConnector -------------------------------------------------------------------------------- /openstack-client/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | 4 | com.woorea 5 | openstack-java-sdk 6 | 3.2.10-SNAPSHOT 7 | 8 | openstack-client 9 | OpenStack Client 10 | OpenStack Client 11 | -------------------------------------------------------------------------------- /openstack-client/src/main/java/com/woorea/openstack/base/client/Entity.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.base.client; 2 | 3 | import java.io.InputStream; 4 | 5 | 6 | public class Entity { 7 | 8 | private T entity; 9 | 10 | private String contentType; 11 | 12 | public static Entity json(T entity) { 13 | return new Entity(entity, "application/json"); 14 | } 15 | 16 | public static Entity stream(T entity) { 17 | return new Entity(entity, "application/octet-stream"); 18 | } 19 | 20 | public Entity(T entity, String contentType) { 21 | super(); 22 | this.entity = entity; 23 | this.contentType = contentType; 24 | } 25 | 26 | /** 27 | * @return the entity 28 | */ 29 | public T getEntity() { 30 | return entity; 31 | } 32 | 33 | /** 34 | * @param entity the entity to set 35 | */ 36 | public void setEntity(T entity) { 37 | this.entity = entity; 38 | } 39 | 40 | /** 41 | * @return the contentType 42 | */ 43 | public String getContentType() { 44 | return contentType; 45 | } 46 | 47 | /** 48 | * @param contentType the contentType to set 49 | */ 50 | public void setContentType(String contentType) { 51 | this.contentType = contentType; 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /openstack-client/src/main/java/com/woorea/openstack/base/client/HttpMethod.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.base.client; 2 | 3 | public enum HttpMethod { 4 | HEAD, GET, POST, PUT, PATCH, DELETE, OPTIONS, TRACE 5 | } 6 | -------------------------------------------------------------------------------- /openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackClientConnector.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.base.client; 2 | 3 | 4 | public interface OpenStackClientConnector { 5 | 6 | public OpenStackResponse request(OpenStackRequest request); 7 | 8 | } 9 | -------------------------------------------------------------------------------- /openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackCommand.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.base.client; 2 | //package org.openstack.base.client; 3 | // 4 | //public interface OpenStackCommand { 5 | // 6 | // OpenStackRequest createRequest(OpenStackClient connector); 7 | // 8 | //} 9 | -------------------------------------------------------------------------------- /openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackResponse.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.base.client; 2 | 3 | import java.io.InputStream; 4 | import java.util.Map; 5 | 6 | public interface OpenStackResponse { 7 | 8 | public T getEntity(Class returnType); 9 | 10 | public InputStream getInputStream(); 11 | 12 | public String header(String name); 13 | 14 | public Map headers(); 15 | 16 | } 17 | -------------------------------------------------------------------------------- /openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackResponseException.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.base.client; 2 | 3 | public class OpenStackResponseException extends RuntimeException { 4 | 5 | private static final long serialVersionUID = 7294957362769575271L; 6 | 7 | protected String message; 8 | 9 | protected int status; 10 | 11 | public OpenStackResponseException(String message, int status) { 12 | this.message = message; 13 | this.status = status; 14 | } 15 | 16 | public String getMessage() { 17 | return message; 18 | } 19 | 20 | public int getStatus() { 21 | return status; 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackResponseStatus.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.base.client; 2 | 3 | public class OpenStackResponseStatus { 4 | 5 | public static final int OK = 200; 6 | 7 | public static final int NOT_AUTHORIZED = 401; 8 | 9 | public static final int CONFLICT = 409; 10 | 11 | } 12 | -------------------------------------------------------------------------------- /openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackSimpleTokenProvider.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.base.client; 2 | 3 | public class OpenStackSimpleTokenProvider implements OpenStackTokenProvider { 4 | 5 | String token; 6 | 7 | public OpenStackSimpleTokenProvider(String token) { 8 | this.token = token; 9 | } 10 | 11 | @Override 12 | public String getToken() { 13 | return this.token; 14 | } 15 | 16 | @Override 17 | public void expireToken() { 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackTokenProvider.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.base.client; 2 | 3 | public interface OpenStackTokenProvider { 4 | 5 | String getToken(); 6 | 7 | void expireToken(); 8 | 9 | } 10 | -------------------------------------------------------------------------------- /openstack-client/src/main/java/com/woorea/openstack/common/session/OpenStackSessionHolder.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.common.session; 2 | //package org.openstack.common.session; 3 | // 4 | //public class OpenStackSessionHolder { 5 | // 6 | // private static final ThreadLocal HOLDER = new ThreadLocal(); 7 | // 8 | // public static OpenStackSession getSession() { 9 | // return HOLDER.get(); 10 | // } 11 | // 12 | // public static void setSession(OpenStackSession session) { 13 | // HOLDER.set(session); 14 | // } 15 | // 16 | //} 17 | -------------------------------------------------------------------------------- /openstack-console/src/main/java/com/woorea/openstack/console/Command.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.console; 2 | 3 | import org.apache.commons.cli.CommandLine; 4 | import org.apache.commons.cli.Options; 5 | 6 | 7 | public abstract class Command { 8 | 9 | protected String name; 10 | 11 | public Command(String name) { 12 | this.name = name; 13 | } 14 | 15 | public abstract void execute(Console console, CommandLine args); 16 | 17 | public Options getOptions() { 18 | return new Options(); 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /openstack-console/src/main/java/com/woorea/openstack/console/Commands.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.console; 2 | 3 | import java.util.Map; 4 | 5 | import org.apache.commons.cli.CommandLine; 6 | 7 | public class Commands { 8 | 9 | public static final Command EXIT = new Command("exit") { 10 | 11 | @Override 12 | public void execute(Console console, CommandLine args) { 13 | console.exit(); 14 | } 15 | 16 | }; 17 | 18 | public static final Command SET = new Command("set") { 19 | 20 | @Override 21 | public void execute(Console console, CommandLine args) { 22 | if(args.getArgs().length == 2) { 23 | console.setProperty(args.getArgs()[0], args.getArgs()[1]); 24 | } else { 25 | console.properties(); 26 | } 27 | } 28 | 29 | }; 30 | 31 | } 32 | -------------------------------------------------------------------------------- /openstack-console/src/main/java/com/woorea/openstack/console/Environment.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.console; 2 | import java.util.Map; 3 | import java.util.TreeMap; 4 | 5 | 6 | public class Environment { 7 | 8 | protected final Environment parent; 9 | 10 | protected Map commands = new TreeMap(); 11 | 12 | public Environment(Environment parent) { 13 | register(Commands.EXIT); 14 | register(Commands.SET); 15 | this.parent = parent; 16 | } 17 | 18 | public Environment() { 19 | this(null); 20 | } 21 | 22 | public void register(Command command) { 23 | commands.put(command.name, command); 24 | } 25 | 26 | public String getPrompt() { 27 | return "> "; 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /openstack-console/src/main/java/com/woorea/openstack/console/Main.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.console; 2 | 3 | import java.io.FileInputStream; 4 | import java.io.IOException; 5 | import java.util.Properties; 6 | 7 | import com.woorea.openstack.console.keystone.KeystoneEnvironment; 8 | import com.woorea.openstack.console.nova.NovaEnvironment; 9 | 10 | public class Main { 11 | 12 | /** 13 | * @param args 14 | */ 15 | public static void main(String[] args) throws IOException { 16 | Environment environment = new Environment(); 17 | environment.register(KeystoneEnvironment.KEYSTONE); 18 | environment.register(NovaEnvironment.NOVA); 19 | 20 | Properties properties = new Properties(); 21 | properties.load(new FileInputStream("src/main/resources/console.properties")); 22 | 23 | Console console = new Console(environment, properties); 24 | console.start(); 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /openstack-console/src/main/java/com/woorea/openstack/console/keystone/KeystoneCommand.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.console.keystone; 2 | 3 | import org.apache.commons.cli.CommandLine; 4 | 5 | import com.woorea.openstack.console.Command; 6 | import com.woorea.openstack.console.Console; 7 | import com.woorea.openstack.keystone.Keystone; 8 | 9 | public abstract class KeystoneCommand extends Command { 10 | 11 | public KeystoneCommand(String name) { 12 | super(name); 13 | } 14 | 15 | @Override 16 | public void execute(Console console, CommandLine args) { 17 | KeystoneEnvironment environment = (KeystoneEnvironment) console.getEnvironment(); 18 | execute(environment.CLIENT, args); 19 | 20 | } 21 | 22 | protected abstract void execute(Keystone keystone, CommandLine args); 23 | 24 | } 25 | -------------------------------------------------------------------------------- /openstack-console/src/main/java/com/woorea/openstack/console/keystone/KeystoneRoleDelete.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.console.keystone; 2 | 3 | import org.apache.commons.cli.CommandLine; 4 | 5 | import com.woorea.openstack.console.utils.ConsoleUtils; 6 | import com.woorea.openstack.keystone.Keystone; 7 | 8 | public class KeystoneRoleDelete extends KeystoneCommand { 9 | 10 | public KeystoneRoleDelete() { 11 | super("role-delete"); 12 | } 13 | 14 | @Override 15 | public void execute(Keystone keystone, CommandLine cmd) { 16 | 17 | String[] args = cmd.getArgs(); 18 | if(args.length == 1) { 19 | keystone.roles().delete(args[0]).execute(); 20 | System.out.println(new ConsoleUtils().green("OK")); 21 | } 22 | 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /openstack-console/src/main/java/com/woorea/openstack/console/keystone/KeystoneRoleList.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.console.keystone; 2 | 3 | import org.apache.commons.cli.CommandLine; 4 | 5 | import com.woorea.openstack.console.utils.Column; 6 | import com.woorea.openstack.console.utils.Table; 7 | import com.woorea.openstack.console.utils.TableModel; 8 | import com.woorea.openstack.keystone.Keystone; 9 | import com.woorea.openstack.keystone.model.Role; 10 | import com.woorea.openstack.keystone.model.Roles; 11 | 12 | public class KeystoneRoleList extends KeystoneCommand { 13 | 14 | public KeystoneRoleList() { 15 | super("role-list"); 16 | } 17 | 18 | @Override 19 | public void execute(Keystone keystone, CommandLine cmd) { 20 | 21 | final Roles roles = keystone.roles().list().execute(); 22 | 23 | Table t = new Table(new TableModel(roles.getList()) { 24 | 25 | @Override 26 | public Column[] getHeaders() { 27 | return new Column[]{ 28 | new Column("id", 32, Column.ALIGN_LEFT), 29 | new Column("name", 10, Column.ALIGN_LEFT), 30 | new Column("description", 32, Column.ALIGN_LEFT), 31 | new Column("enabled", 7, Column.ALIGN_LEFT), 32 | }; 33 | } 34 | 35 | @Override 36 | public String[] getRow(Role role) { 37 | return new String[]{ 38 | role.getId(), 39 | role.getName(), 40 | role.getDescription(), 41 | role.getEnabled() 42 | }; 43 | } 44 | }); 45 | System.out.println(t.render()); 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /openstack-console/src/main/java/com/woorea/openstack/console/keystone/KeystoneServiceList.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.console.keystone; 2 | 3 | import org.apache.commons.cli.CommandLine; 4 | 5 | import com.woorea.openstack.console.utils.Column; 6 | import com.woorea.openstack.console.utils.Table; 7 | import com.woorea.openstack.console.utils.TableModel; 8 | import com.woorea.openstack.keystone.Keystone; 9 | import com.woorea.openstack.keystone.model.Service; 10 | import com.woorea.openstack.keystone.model.Services; 11 | 12 | public class KeystoneServiceList extends KeystoneCommand { 13 | 14 | public KeystoneServiceList() { 15 | super("service-list"); 16 | } 17 | 18 | @Override 19 | public void execute(Keystone keystone, CommandLine cmd) { 20 | 21 | final Services services = keystone.services().list().execute(); 22 | 23 | Table t = new Table(new TableModel(services.getList()) { 24 | 25 | @Override 26 | public Column[] getHeaders() { 27 | return new Column[]{ 28 | new Column("id", 32, Column.ALIGN_LEFT), 29 | new Column("type", 10, Column.ALIGN_LEFT), 30 | new Column("name", 10, Column.ALIGN_LEFT), 31 | new Column("description", 32, Column.ALIGN_LEFT) 32 | }; 33 | } 34 | 35 | @Override 36 | public String[] getRow(Service service) { 37 | return new String[]{ 38 | service.getId(), 39 | service.getType(), 40 | service.getName(), 41 | service.getDescription() 42 | }; 43 | } 44 | }); 45 | System.out.println(t.render()); 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /openstack-console/src/main/java/com/woorea/openstack/console/keystone/KeystoneTenantDelete.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.console.keystone; 2 | 3 | import org.apache.commons.cli.CommandLine; 4 | 5 | import com.woorea.openstack.console.utils.ConsoleUtils; 6 | import com.woorea.openstack.keystone.Keystone; 7 | 8 | public class KeystoneTenantDelete extends KeystoneCommand { 9 | 10 | public KeystoneTenantDelete() { 11 | super("tenant-delete"); 12 | } 13 | 14 | @Override 15 | public void execute(Keystone keystone, CommandLine cmd) { 16 | 17 | String[] args = cmd.getArgs(); 18 | if(args.length == 1) { 19 | keystone.tenants().delete(args[0]).execute(); 20 | System.out.println(new ConsoleUtils().green("OK")); 21 | } 22 | 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /openstack-console/src/main/java/com/woorea/openstack/console/keystone/KeystoneTenantList.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.console.keystone; 2 | 3 | import org.apache.commons.cli.CommandLine; 4 | 5 | import com.woorea.openstack.console.utils.Column; 6 | import com.woorea.openstack.console.utils.Table; 7 | import com.woorea.openstack.console.utils.TableModel; 8 | import com.woorea.openstack.keystone.Keystone; 9 | import com.woorea.openstack.keystone.model.Tenant; 10 | import com.woorea.openstack.keystone.model.Tenants; 11 | 12 | public class KeystoneTenantList extends KeystoneCommand { 13 | 14 | public KeystoneTenantList() { 15 | super("tenant-list"); 16 | } 17 | 18 | @Override 19 | public void execute(Keystone keystone, CommandLine args) { 20 | 21 | final Tenants tenants = keystone.tenants().list().execute(); 22 | 23 | Table t = new Table(new TableModel(tenants.getList()) { 24 | 25 | @Override 26 | public Column[] getHeaders() { 27 | return new Column[]{ 28 | new Column("id", 32, Column.ALIGN_LEFT), 29 | new Column("name", 32, Column.ALIGN_LEFT), 30 | new Column("description", 32, Column.ALIGN_LEFT), 31 | new Column("enabled", 7, Column.ALIGN_LEFT) 32 | }; 33 | } 34 | 35 | @Override 36 | public String[] getRow(Tenant tenant) { 37 | return new String[]{ 38 | tenant.getId(), 39 | tenant.getName(), 40 | tenant.getDescription(), 41 | tenant.getEnabled().toString() 42 | }; 43 | } 44 | }); 45 | System.out.println(t.render()); 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /openstack-console/src/main/java/com/woorea/openstack/console/keystone/KeystoneUserDelete.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.console.keystone; 2 | 3 | import org.apache.commons.cli.CommandLine; 4 | 5 | import com.woorea.openstack.console.utils.ConsoleUtils; 6 | import com.woorea.openstack.keystone.Keystone; 7 | 8 | public class KeystoneUserDelete extends KeystoneCommand { 9 | 10 | public KeystoneUserDelete() { 11 | super("user-delete"); 12 | } 13 | 14 | @Override 15 | public void execute(Keystone keystone, CommandLine cmd) { 16 | 17 | String[] args = cmd.getArgs(); 18 | if(args.length == 1) { 19 | keystone.users().delete(args[0]).execute(); 20 | System.out.println(new ConsoleUtils().green("OK")); 21 | } 22 | 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /openstack-console/src/main/java/com/woorea/openstack/console/keystone/KeystoneUserList.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.console.keystone; 2 | 3 | import org.apache.commons.cli.CommandLine; 4 | 5 | import com.woorea.openstack.console.utils.Column; 6 | import com.woorea.openstack.console.utils.Table; 7 | import com.woorea.openstack.console.utils.TableModel; 8 | import com.woorea.openstack.keystone.Keystone; 9 | import com.woorea.openstack.keystone.model.User; 10 | import com.woorea.openstack.keystone.model.Users; 11 | 12 | public class KeystoneUserList extends KeystoneCommand { 13 | 14 | public KeystoneUserList() { 15 | super("user-list"); 16 | } 17 | 18 | @Override 19 | public void execute(Keystone keystone, CommandLine cmd) { 20 | 21 | final Users users = keystone.users().list().execute(); 22 | 23 | Table t = new Table(new TableModel(users.getList()) { 24 | 25 | @Override 26 | public Column[] getHeaders() { 27 | return new Column[]{ 28 | new Column("id", 32, Column.ALIGN_LEFT), 29 | new Column("name", 10, Column.ALIGN_LEFT), 30 | new Column("email", 22, Column.ALIGN_LEFT), 31 | new Column("tenant", 32, Column.ALIGN_LEFT), 32 | new Column("enabled", 7, Column.ALIGN_LEFT) 33 | }; 34 | } 35 | 36 | @Override 37 | public String[] getRow(User user) { 38 | return new String[]{ 39 | user.getId(), 40 | user.getName(), 41 | user.getEmail(), 42 | user.getTenantId(), 43 | user.getEnabled().toString() 44 | }; 45 | } 46 | }); 47 | System.out.println(t.render()); 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /openstack-console/src/main/java/com/woorea/openstack/console/keystone/KeystoneUserShow.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.console.keystone; 2 | 3 | import java.util.Arrays; 4 | 5 | import org.apache.commons.cli.CommandLine; 6 | 7 | import com.woorea.openstack.console.utils.Column; 8 | import com.woorea.openstack.console.utils.Table; 9 | import com.woorea.openstack.console.utils.TableModel; 10 | import com.woorea.openstack.keystone.Keystone; 11 | import com.woorea.openstack.keystone.model.User; 12 | 13 | public class KeystoneUserShow extends KeystoneCommand { 14 | 15 | public KeystoneUserShow() { 16 | super("user-show"); 17 | } 18 | 19 | @Override 20 | public void execute(Keystone keystone, CommandLine cmd) { 21 | 22 | String[] args = cmd.getArgs(); 23 | if(args.length == 1) { 24 | User user = keystone.users().show(args[0]).execute(); 25 | Table t = new Table(new TableModel(Arrays.asList(user)) { 26 | 27 | @Override 28 | public Column[] getHeaders() { 29 | return new Column[]{ 30 | new Column("id", 32, Column.ALIGN_LEFT), 31 | new Column("name", 10, Column.ALIGN_LEFT), 32 | new Column("email", 22, Column.ALIGN_LEFT), 33 | new Column("tenant", 32, Column.ALIGN_LEFT), 34 | new Column("enabled", 7, Column.ALIGN_LEFT) 35 | }; 36 | } 37 | 38 | @Override 39 | public String[] getRow(User user) { 40 | return new String[]{ 41 | user.getId(), 42 | user.getName(), 43 | user.getEmail(), 44 | user.getTenantId(), 45 | user.getEnabled().toString() 46 | }; 47 | } 48 | }); 49 | System.out.println(t.render()); 50 | } 51 | } 52 | 53 | } 54 | -------------------------------------------------------------------------------- /openstack-console/src/main/java/com/woorea/openstack/console/nova/NovaCommand.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.console.nova; 2 | 3 | import org.apache.commons.cli.CommandLine; 4 | 5 | import com.woorea.openstack.console.Command; 6 | import com.woorea.openstack.console.Console; 7 | import com.woorea.openstack.nova.Nova; 8 | 9 | 10 | public abstract class NovaCommand extends Command { 11 | 12 | public NovaCommand(String name) { 13 | super(name); 14 | } 15 | 16 | @Override 17 | public void execute(Console console, CommandLine args) { 18 | NovaEnvironment environment = (NovaEnvironment) console.getEnvironment(); 19 | execute(environment.CLIENT, args); 20 | 21 | } 22 | 23 | protected abstract void execute(Nova nova, CommandLine args); 24 | 25 | } 26 | -------------------------------------------------------------------------------- /openstack-console/src/main/java/com/woorea/openstack/console/nova/NovaServerList.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.console.nova; 2 | 3 | import org.apache.commons.cli.CommandLine; 4 | 5 | import com.woorea.openstack.console.utils.Column; 6 | import com.woorea.openstack.console.utils.Table; 7 | import com.woorea.openstack.console.utils.TableModel; 8 | import com.woorea.openstack.nova.Nova; 9 | import com.woorea.openstack.nova.model.Server; 10 | import com.woorea.openstack.nova.model.Servers; 11 | 12 | public class NovaServerList extends NovaCommand { 13 | 14 | public NovaServerList() { 15 | super("list"); 16 | } 17 | 18 | @Override 19 | public void execute(Nova nova, CommandLine cmd) { 20 | 21 | final Servers servers = nova.servers().list(true).execute(); 22 | 23 | Table t = new Table(new TableModel(servers.getList()) { 24 | 25 | @Override 26 | public Column[] getHeaders() { 27 | return new Column[]{ 28 | new Column("id", 32, Column.ALIGN_LEFT), 29 | new Column("name", 10, Column.ALIGN_LEFT) 30 | }; 31 | } 32 | 33 | @Override 34 | public String[] getRow(Server server) { 35 | return new String[]{ 36 | server.getId(), 37 | server.getName() 38 | }; 39 | } 40 | }); 41 | System.out.println(t.render()); 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /openstack-console/src/main/java/com/woorea/openstack/console/utils/Column.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.console.utils; 2 | 3 | public class Column { 4 | 5 | public static final int ALIGN_LEFT = -1; 6 | public static final int ALIGN_RIGHT = 1; 7 | 8 | private String name; 9 | 10 | private int size; 11 | 12 | private int align; 13 | 14 | public Column(String name, int size, int align) { 15 | super(); 16 | this.name = name; 17 | this.size = size; 18 | this.align = align; 19 | } 20 | 21 | /** 22 | * @return the name 23 | */ 24 | public String getName() { 25 | return name; 26 | } 27 | 28 | /** 29 | * @param name the name to set 30 | */ 31 | public void setName(String name) { 32 | this.name = name; 33 | } 34 | 35 | /** 36 | * @return the size 37 | */ 38 | public int getSize() { 39 | return size; 40 | } 41 | 42 | /** 43 | * @param size the size to set 44 | */ 45 | public void setSize(int size) { 46 | this.size = size; 47 | } 48 | 49 | /** 50 | * @return the align 51 | */ 52 | public int getAlign() { 53 | return align; 54 | } 55 | 56 | /** 57 | * @param align the align to set 58 | */ 59 | public void setAlign(int align) { 60 | this.align = align; 61 | } 62 | 63 | 64 | 65 | } 66 | -------------------------------------------------------------------------------- /openstack-console/src/main/java/com/woorea/openstack/console/utils/ConsoleUtils.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.console.utils; 2 | 3 | public class ConsoleUtils { 4 | 5 | public static final String RED = "\u001B[31m"; 6 | 7 | public static final String GREEN = "\u001B[32m"; 8 | 9 | public static final String YELLOW = "\u001B[33m"; 10 | 11 | public static final String END = "\u001B[0m"; 12 | 13 | private StringBuilder sb = new StringBuilder(); 14 | 15 | public ConsoleUtils append(String text) { 16 | sb.append(text); 17 | return this; 18 | } 19 | 20 | public ConsoleUtils red(String text) { 21 | sb.append(ConsoleUtils.RED).append(text).append(END); 22 | return this; 23 | } 24 | 25 | public ConsoleUtils green(String text) { 26 | sb.append(ConsoleUtils.GREEN).append(text).append(END); 27 | return this; 28 | } 29 | 30 | public ConsoleUtils yellow(String text) { 31 | sb.append(ConsoleUtils.YELLOW).append(text).append(END); 32 | return this; 33 | } 34 | 35 | public static void log(String text) { 36 | System.out.println(new ConsoleUtils().yellow("| ").append(text)); 37 | } 38 | 39 | /* (non-Javadoc) 40 | * @see java.lang.Object#toString() 41 | */ 42 | @Override 43 | public String toString() { 44 | return sb.toString(); 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /openstack-console/src/main/java/com/woorea/openstack/console/utils/TableModel.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.console.utils; 2 | 3 | import java.util.List; 4 | 5 | public abstract class TableModel { 6 | 7 | protected List data; 8 | 9 | public TableModel(List data) { 10 | this.data = data; 11 | } 12 | 13 | public abstract Column[] getHeaders(); 14 | 15 | public final String[][] getRows() { 16 | String[][] rows = new String[data.size()][]; 17 | for(int i = 0; i < data.size(); i++) { 18 | rows[i] = getRow(data.get(i)); 19 | } 20 | return rows; 21 | } 22 | 23 | public abstract String[] getRow(T data); 24 | 25 | } 26 | -------------------------------------------------------------------------------- /openstack-console/src/main/resources/console.properties: -------------------------------------------------------------------------------- 1 | keystone.endpoint=http://keystone.stacksherpa.org/v2.0 2 | keystone.username=admin 3 | keystone.password=secret0 4 | keystone.tenant_name=admin 5 | 6 | nova.endpoint=http://compute/v2/ -------------------------------------------------------------------------------- /openstack-examples/src/main/java/com/woorea/openstack/examples/ExamplesConfiguration.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.examples; 2 | 3 | 4 | import com.woorea.openstack.base.client.OpenStackSimpleTokenProvider; 5 | import com.woorea.openstack.keystone.Keystone; 6 | import com.woorea.openstack.keystone.model.Tenant; 7 | 8 | public class ExamplesConfiguration { 9 | 10 | public static final String KEYSTONE_AUTH_URL = "https://region-a.geo-1.identity.hpcloudsvc.com:35357/v3"; 11 | 12 | public static final String KEYSTONE_USERNAME = ""; 13 | 14 | public static final String KEYSTONE_PASSWORD = ""; 15 | 16 | public static final String KEYSTONE_ENDPOINT = "https://region-a.geo-1.identity.hpcloudsvc.com:35357/v3"; 17 | 18 | public static final String TENANT_NAME = "admin"; 19 | 20 | public static final String NOVA_ENDPOINT = "http://compute/v2"; 21 | 22 | public static final String CEILOMETER_ENDPOINT = ""; 23 | 24 | public static void main(String[] args) { 25 | Keystone client = new Keystone(KEYSTONE_ENDPOINT); 26 | client.setTokenProvider(new OpenStackSimpleTokenProvider("secret0")); 27 | client.tenants().delete("36c481aec1d54fc49190c92c3ef6840a").execute(); 28 | Tenant tenant = client.tenants().create(new Tenant("new_api")).execute(); 29 | System.out.println(tenant); 30 | System.out.println(client.tenants().list().execute()); 31 | client.tenants().delete(tenant.getId()).execute(); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /openstack-examples/src/main/java/com/woorea/openstack/examples/compute/NovaListServers.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.examples.compute; 2 | 3 | 4 | import com.woorea.openstack.examples.ExamplesConfiguration; 5 | import com.woorea.openstack.keystone.Keystone; 6 | import com.woorea.openstack.keystone.model.Access; 7 | import com.woorea.openstack.keystone.model.authentication.UsernamePassword; 8 | import com.woorea.openstack.nova.Nova; 9 | import com.woorea.openstack.nova.model.Server; 10 | import com.woorea.openstack.nova.model.Servers; 11 | 12 | public class NovaListServers { 13 | 14 | /** 15 | * @param args 16 | */ 17 | public static void main(String[] args) { 18 | Keystone keystone = new Keystone(ExamplesConfiguration.KEYSTONE_AUTH_URL); 19 | Access access = keystone.tokens().authenticate(new UsernamePassword(ExamplesConfiguration.KEYSTONE_USERNAME, ExamplesConfiguration.KEYSTONE_PASSWORD)) 20 | .withTenantName("demo") 21 | .execute(); 22 | 23 | //use the token in the following requests 24 | keystone.token(access.getToken().getId()); 25 | 26 | //NovaClient novaClient = new NovaClient(KeystoneUtils.findEndpointURL(access.getServiceCatalog(), "compute", null, "public"), access.getToken().getId()); 27 | Nova novaClient = new Nova(ExamplesConfiguration.NOVA_ENDPOINT.concat("/").concat(access.getToken().getTenant().getId())); 28 | novaClient.token(access.getToken().getId()); 29 | //novaClient.enableLogging(Logger.getLogger("nova"), 100 * 1024); 30 | 31 | Servers servers = novaClient.servers().list(true).execute(); 32 | for(Server server : servers) { 33 | System.out.println(server); 34 | } 35 | 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /openstack-examples/src/main/java/com/woorea/openstack/examples/hpcloud/Keystone3Authentication.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.examples.hpcloud; 2 | 3 | 4 | import com.woorea.openstack.base.client.OpenStackResponse; 5 | import com.woorea.openstack.examples.ExamplesConfiguration; 6 | import com.woorea.openstack.keystone.v3.model.Authentication; 7 | import com.woorea.openstack.keystone.v3.model.Authentication.Identity; 8 | import com.woorea.openstack.keystone.v3.Keystone; 9 | import com.woorea.openstack.keystone.v3.model.Token; 10 | 11 | public class Keystone3Authentication { 12 | 13 | /** 14 | * @param args 15 | */ 16 | public static void main(String[] args) { 17 | Keystone keystone = new Keystone(ExamplesConfiguration.KEYSTONE_AUTH_URL); 18 | 19 | Authentication auth = new Authentication(); 20 | auth.setIdentity(Identity.password(ExamplesConfiguration.KEYSTONE_USERNAME, ExamplesConfiguration.KEYSTONE_PASSWORD)); 21 | 22 | OpenStackResponse response = keystone.tokens().authenticate(auth).request(); 23 | 24 | String tokenId = response.header("X-Subject-Token"); 25 | 26 | Token token = response.getEntity(Token.class); 27 | 28 | System.out.println(tokenId); 29 | 30 | System.out.println(token); 31 | 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /openstack-examples/src/main/java/com/woorea/openstack/examples/hpcloud/KeystoneAuthentication.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.examples.hpcloud; 2 | 3 | 4 | import com.woorea.openstack.examples.ExamplesConfiguration; 5 | import com.woorea.openstack.keystone.Keystone; 6 | import com.woorea.openstack.keystone.model.Access; 7 | 8 | public class KeystoneAuthentication { 9 | 10 | private static final String KEYSTONE_AUTH_URL = "https://region-a.geo-1.identity.hpcloudsvc.com:35357/v2.0"; 11 | 12 | /** 13 | * @param args 14 | */ 15 | public static void main(String[] args) { 16 | Keystone keystone = new Keystone(KEYSTONE_AUTH_URL); 17 | 18 | // access with unscoped token 19 | Access access = keystone 20 | .tokens() 21 | .authenticate() 22 | .withUsernamePassword(ExamplesConfiguration.KEYSTONE_USERNAME, ExamplesConfiguration.KEYSTONE_PASSWORD) 23 | .execute(); 24 | 25 | System.out.println(access); 26 | 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /openstack-examples/src/main/java/com/woorea/openstack/examples/keystone/KeystoneCreateTenant.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.examples.keystone; 2 | 3 | 4 | import com.woorea.openstack.examples.ExamplesConfiguration; 5 | import com.woorea.openstack.keystone.Keystone; 6 | import com.woorea.openstack.keystone.model.Access; 7 | import com.woorea.openstack.keystone.model.Tenant; 8 | import com.woorea.openstack.keystone.model.authentication.TokenAuthentication; 9 | import com.woorea.openstack.keystone.model.authentication.UsernamePassword; 10 | 11 | public class KeystoneCreateTenant { 12 | 13 | /** 14 | * @param args 15 | */ 16 | public static void main(String[] args) { 17 | Keystone keystone = new Keystone(ExamplesConfiguration.KEYSTONE_AUTH_URL); 18 | //access with unscoped token 19 | Access access = keystone.tokens().authenticate( 20 | new UsernamePassword(ExamplesConfiguration.KEYSTONE_USERNAME, ExamplesConfiguration.KEYSTONE_PASSWORD)) 21 | .execute(); 22 | 23 | access = keystone.tokens().authenticate(new TokenAuthentication(access.getToken().getId())).withTenantName("admin").execute(); 24 | 25 | Tenant tenant = new Tenant(); 26 | tenant.setName("benn.cs"); 27 | tenant.setDescription("benn.cs"); 28 | tenant.setEnabled(true); 29 | //Get the adminURL client and use the token got above 30 | keystone = new Keystone("http://keystone.x.org/v2.0"); 31 | keystone.token(access.getToken().getId()); 32 | tenant = keystone.tenants().create(tenant).execute(); 33 | System.out.println(tenant); 34 | keystone.tenants().delete(tenant.getId()); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /openstack-examples/src/main/java/com/woorea/openstack/examples/keystone/KeystoneCreateUser.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.examples.keystone; 2 | 3 | 4 | import com.woorea.openstack.base.client.OpenStackSimpleTokenProvider; 5 | import com.woorea.openstack.examples.ExamplesConfiguration; 6 | import com.woorea.openstack.keystone.Keystone; 7 | import com.woorea.openstack.keystone.model.Access; 8 | import com.woorea.openstack.keystone.model.User; 9 | import com.woorea.openstack.keystone.model.authentication.UsernamePassword; 10 | 11 | public class KeystoneCreateUser { 12 | 13 | /** 14 | * @param args 15 | */ 16 | public static void main(String[] args) { 17 | Keystone keystone = new Keystone(ExamplesConfiguration.KEYSTONE_AUTH_URL); 18 | //access with unscoped token 19 | Access access = keystone.tokens() 20 | .authenticate(new UsernamePassword(ExamplesConfiguration.KEYSTONE_USERNAME, ExamplesConfiguration.KEYSTONE_PASSWORD)) 21 | .withTenantName("admin") 22 | .execute(); 23 | 24 | User user = new User(); 25 | user.setEmail("luis@woorea.es"); 26 | user.setUsername("luis.gervaso"); 27 | user.setPassword("password.0"); 28 | user.setName("Luis"); 29 | user.setEnabled(Boolean.TRUE); 30 | 31 | keystone = new Keystone("http://keystone.x.org/v2.0"); 32 | keystone.setTokenProvider(new OpenStackSimpleTokenProvider(access.getToken().getId())); 33 | //keystone.enableLogging(Logger.getLogger("keystone"), 10000); 34 | user = keystone.users().create(user).execute(); 35 | System.out.println(user); 36 | keystone.users().delete(user.getId()).execute(); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /openstack-examples/src/main/java/com/woorea/openstack/examples/simple/OpenStackSimpleClient.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.examples.simple; 2 | 3 | 4 | public class OpenStackSimpleClient { 5 | 6 | /** 7 | * @param args 8 | */ 9 | public static void main(String[] args) { 10 | // OpenStackClient client = new OpenStackClient(ExamplesConfiguration.KEYSTONE_AUTH_URL); 11 | // Access access = client.request("/tokens").execute("POST", Entity.json("{\"auth\":{\"passwordCredentials\":{\"username\":\"\",\"password\":\"\"}}}"), Access.class); 12 | // System.out.println(access); 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /quantum-client/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | 4 | com.woorea 5 | openstack-java-sdk 6 | 3.2.10-SNAPSHOT 7 | 8 | quantum-client 9 | OpenStack Quantum Client 10 | OpenStack Quantum Client 11 | 12 | 13 | com.woorea 14 | openstack-client 15 | 3.2.10-SNAPSHOT 16 | 17 | 18 | com.woorea 19 | quantum-model 20 | 3.2.10-SNAPSHOT 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /quantum-client/src/main/java/com/woorea/openstack/quantum/Quantum.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.quantum; 2 | 3 | 4 | import com.woorea.openstack.base.client.OpenStackClient; 5 | import com.woorea.openstack.base.client.OpenStackClientConnector; 6 | import com.woorea.openstack.quantum.api.NetworksResource; 7 | import com.woorea.openstack.quantum.api.PortsResource; 8 | import com.woorea.openstack.quantum.api.RoutersResource; 9 | import com.woorea.openstack.quantum.api.SubnetsResource; 10 | 11 | 12 | public class Quantum extends OpenStackClient { 13 | 14 | private final NetworksResource NETWORKS; 15 | 16 | private final PortsResource PORTS; 17 | 18 | private final SubnetsResource SUBNETS; 19 | private final RoutersResource ROUTERS; 20 | 21 | public Quantum(String endpoint, OpenStackClientConnector connector) { 22 | super(endpoint, connector); 23 | NETWORKS = new NetworksResource(this); 24 | PORTS = new PortsResource(this); 25 | SUBNETS = new SubnetsResource(this); 26 | ROUTERS=new RoutersResource(this); 27 | 28 | } 29 | 30 | public Quantum(String endpoint) { 31 | this(endpoint, null); 32 | } 33 | 34 | public NetworksResource networks() { 35 | return NETWORKS; 36 | } 37 | 38 | public PortsResource ports() { 39 | return PORTS; 40 | } 41 | 42 | public SubnetsResource subnets() { 43 | return SUBNETS; 44 | } 45 | public RoutersResource routers() 46 | { 47 | return ROUTERS; 48 | } 49 | 50 | 51 | } 52 | -------------------------------------------------------------------------------- /quantum-model/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | 4 | com.woorea 5 | openstack-java-sdk 6 | 3.2.10-SNAPSHOT 7 | 8 | quantum-model 9 | OpenStack Quantum Model 10 | OpenStack Quantum Model 11 | 12 | 13 | junit 14 | junit 15 | 4.11 16 | test 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /quantum-model/src/main/java/com/woorea/openstack/quantum/model/GatewayInfo.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.quantum.model; 2 | 3 | import java.util.List; 4 | import java.io.Serializable; 5 | 6 | import com.fasterxml.jackson.annotation.JsonProperty; 7 | 8 | public class GatewayInfo implements Serializable { 9 | 10 | @JsonProperty("network_id") 11 | private String networkId; 12 | 13 | public String getNetworkId() { 14 | return networkId; 15 | } 16 | 17 | public void setNetworkId(String id) { 18 | this.networkId = id; 19 | } 20 | 21 | @Override public String toString() { 22 | return "[networkId=" + networkId + "]"; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /quantum-model/src/main/java/com/woorea/openstack/quantum/model/HostRoute.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.quantum.model; 2 | 3 | import java.io.Serializable; 4 | 5 | public class HostRoute implements Serializable { 6 | 7 | private String destination; 8 | private String nexthop; 9 | 10 | public String getDestination() { 11 | return destination; 12 | } 13 | public void setDestination(String destination) { 14 | this.destination = destination; 15 | } 16 | 17 | public String getNexthop() { 18 | return nexthop; 19 | } 20 | public void setNexthop(String nexthop) { 21 | this.nexthop = nexthop; 22 | } 23 | 24 | @Override public String toString() { 25 | return "[destination=" + destination + ", nexthop=" + nexthop + "]"; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /quantum-model/src/main/java/com/woorea/openstack/quantum/model/NetworkForCreate.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.quantum.model; 2 | 3 | import com.fasterxml.jackson.annotation.JsonRootName; 4 | 5 | @SuppressWarnings("serial") 6 | @JsonRootName("network") 7 | @Deprecated 8 | public class NetworkForCreate extends Network { 9 | } 10 | -------------------------------------------------------------------------------- /quantum-model/src/main/java/com/woorea/openstack/quantum/model/Networks.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.quantum.model; 2 | 3 | import java.io.Serializable; 4 | import java.util.Iterator; 5 | import java.util.List; 6 | import com.fasterxml.jackson.annotation.JsonProperty; 7 | 8 | public class Networks implements Iterable, Serializable{ 9 | 10 | @JsonProperty("networks") 11 | private List list; 12 | 13 | /** 14 | * @return the list 15 | */ 16 | public List getList() { 17 | return list; 18 | } 19 | 20 | 21 | /** 22 | * @param list the list to set 23 | */ 24 | public void setList(List list) { 25 | this.list = list; 26 | } 27 | 28 | 29 | public String toString() { 30 | return "Networks [list=" + list + "]"; 31 | } 32 | 33 | 34 | public Iterator iterator() { 35 | return list.iterator(); 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /quantum-model/src/main/java/com/woorea/openstack/quantum/model/Pool.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.quantum.model; 2 | 3 | import java.io.Serializable; 4 | 5 | public class Pool implements Serializable{ 6 | 7 | private String start; 8 | private String end; 9 | 10 | /** 11 | * @return the start 12 | */ 13 | public String getStart() { 14 | return start; 15 | } 16 | /** 17 | * @param start the start to set 18 | */ 19 | public void setStart(String start) { 20 | this.start = start; 21 | } 22 | /** 23 | * @return the end 24 | */ 25 | public String getEnd() { 26 | return end; 27 | } 28 | /** 29 | * @param end the end to set 30 | */ 31 | public void setEnd(String end) { 32 | this.end = end; 33 | } 34 | 35 | @Override 36 | public String toString() { 37 | return "Allocation_pool [start=" + start + ", end=" + end + "]"; 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /quantum-model/src/main/java/com/woorea/openstack/quantum/model/PortForCreate.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.quantum.model; 2 | 3 | import com.fasterxml.jackson.annotation.JsonRootName; 4 | 5 | /** 6 | * @deprecated Please use {@link Port} directly. 7 | */ 8 | @SuppressWarnings("serial") 9 | @JsonRootName("port") 10 | @Deprecated 11 | public class PortForCreate extends Port { 12 | } 13 | -------------------------------------------------------------------------------- /quantum-model/src/main/java/com/woorea/openstack/quantum/model/Ports.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.quantum.model; 2 | 3 | import java.io.Serializable; 4 | import java.util.Iterator; 5 | import java.util.List; 6 | 7 | import com.fasterxml.jackson.annotation.JsonProperty; 8 | 9 | @SuppressWarnings("serial") 10 | public class Ports implements Iterable, Serializable { 11 | 12 | @JsonProperty("ports") 13 | private List list; 14 | 15 | /** 16 | * @return the list 17 | */ 18 | public List getList() { 19 | return list; 20 | } 21 | 22 | /** 23 | * @param list 24 | * the list to set 25 | */ 26 | public void setList(List list) { 27 | this.list = list; 28 | } 29 | 30 | @Override 31 | public Iterator iterator() { 32 | return list.iterator(); 33 | } 34 | 35 | @Override 36 | public String toString() { 37 | return "Ports [list=" + list + "]"; 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /quantum-model/src/main/java/com/woorea/openstack/quantum/model/RouterForAddInterface.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.quantum.model; 2 | 3 | import java.io.Serializable; 4 | 5 | import com.fasterxml.jackson.annotation.JsonProperty; 6 | 7 | public class RouterForAddInterface implements Serializable { 8 | 9 | @JsonProperty("subnet_id") 10 | String subnetId; 11 | String routerId; 12 | 13 | public String getSubnetId() { 14 | return subnetId; 15 | } 16 | 17 | public void setSubnetId(String subnetId) { 18 | this.subnetId = subnetId; 19 | } 20 | 21 | public String getRouterId() { 22 | return routerId; 23 | } 24 | 25 | public void setRouterId(String routerId) { 26 | this.routerId = routerId; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /quantum-model/src/main/java/com/woorea/openstack/quantum/model/RouterInterface.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.quantum.model; 2 | 3 | import java.io.Serializable; 4 | 5 | import com.fasterxml.jackson.annotation.JsonProperty; 6 | import com.fasterxml.jackson.annotation.JsonRootName; 7 | 8 | public class RouterInterface implements Serializable { 9 | 10 | @JsonProperty("subnet_id") 11 | String subnetId; 12 | @JsonProperty("port_id") 13 | String portId; 14 | @JsonProperty("tenant_id") 15 | String tenantId; 16 | @JsonProperty("id") 17 | String id; 18 | 19 | } 20 | -------------------------------------------------------------------------------- /quantum-model/src/main/java/com/woorea/openstack/quantum/model/Routers.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.quantum.model; 2 | 3 | import java.io.Serializable; 4 | import java.util.Iterator; 5 | import java.util.List; 6 | import com.fasterxml.jackson.annotation.JsonProperty; 7 | 8 | public class Routers implements Iterable, Serializable{ 9 | 10 | @JsonProperty("routers") 11 | private List list; 12 | 13 | /** 14 | * @return the list 15 | */ 16 | public List getList() { 17 | return list; 18 | } 19 | 20 | 21 | /** 22 | * @param list the list to set 23 | */ 24 | public void setList(List list) { 25 | this.list = list; 26 | } 27 | 28 | 29 | public String toString() { 30 | return "Routers [list=" + list + "]"; 31 | } 32 | 33 | 34 | public Iterator iterator() { 35 | return list.iterator(); 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /quantum-model/src/main/java/com/woorea/openstack/quantum/model/SubnetForCreate.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.quantum.model; 2 | 3 | import com.fasterxml.jackson.annotation.JsonIgnore; 4 | import com.fasterxml.jackson.annotation.JsonRootName; 5 | 6 | /** 7 | * Please use {@link Subnet} directly. 8 | */ 9 | @SuppressWarnings("serial") 10 | @JsonRootName("subnet") 11 | @Deprecated 12 | public class SubnetForCreate extends Subnet { 13 | 14 | /** 15 | * @return the ipVersion 16 | * @deprecated 17 | */ 18 | @Deprecated 19 | @JsonIgnore 20 | public int getIpVersion() { 21 | return getIpversion().code(); 22 | } 23 | 24 | /** 25 | * @param ipVersion 26 | * the ipVersion to set 27 | * @deprecated 28 | */ 29 | @Deprecated 30 | @JsonIgnore 31 | public void setIpVersion(int ipVersion) { 32 | setIpversion(IpVersion.valueOf(ipVersion)); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /quantum-model/src/main/java/com/woorea/openstack/quantum/model/Subnets.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.quantum.model; 2 | 3 | import java.io.Serializable; 4 | import java.util.Iterator; 5 | import java.util.List; 6 | 7 | import com.fasterxml.jackson.annotation.JsonProperty; 8 | 9 | public class Subnets implements Serializable, Iterable { 10 | 11 | @JsonProperty("subnets") 12 | private List list; 13 | 14 | /** 15 | * @return the list 16 | */ 17 | public List getList() { 18 | return list; 19 | } 20 | 21 | /** 22 | * @param list the list to set 23 | */ 24 | public void setList(List list) { 25 | this.list = list; 26 | } 27 | 28 | public String toString() { 29 | return "Subnets [list=" + list + "]"; 30 | } 31 | 32 | public Iterator iterator() { 33 | return list.iterator(); 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /swift-client/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | 4 | com.woorea 5 | openstack-java-sdk 6 | 3.2.10-SNAPSHOT 7 | 8 | swift-client 9 | OpenStack Swift Client 10 | OpenStack Swift Client 11 | 12 | 13 | com.woorea 14 | openstack-client 15 | 3.2.10-SNAPSHOT 16 | 17 | 18 | com.woorea 19 | swift-model 20 | 3.2.10-SNAPSHOT 21 | 22 | 23 | -------------------------------------------------------------------------------- /swift-client/src/main/java/com/woorea/openstack/swift/Swift.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.swift; 2 | 3 | 4 | import com.woorea.openstack.base.client.OpenStackClient; 5 | import com.woorea.openstack.base.client.OpenStackClientConnector; 6 | import com.woorea.openstack.swift.api.AccountResource; 7 | import com.woorea.openstack.swift.api.ContainersResource; 8 | 9 | public class Swift extends OpenStackClient { 10 | 11 | private final AccountResource ACCOUNT; 12 | 13 | private final ContainersResource CONTAINERS; 14 | 15 | public Swift(String endpoint, OpenStackClientConnector connector) { 16 | super(endpoint, connector); 17 | CONTAINERS = new ContainersResource(this); 18 | ACCOUNT = new AccountResource(this); 19 | } 20 | 21 | public Swift(String endpoint) { 22 | this(endpoint, null); 23 | } 24 | 25 | public ContainersResource containers() { 26 | return CONTAINERS; 27 | } 28 | 29 | public AccountResource account() { 30 | return ACCOUNT; 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /swift-client/src/main/java/com/woorea/openstack/swift/api/AccountResource.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.swift.api; 2 | 3 | import com.woorea.openstack.base.client.OpenStackClient; 4 | import com.woorea.openstack.base.client.OpenStackRequest; 5 | 6 | public class AccountResource { 7 | 8 | private final OpenStackClient CLIENT; 9 | 10 | public AccountResource(OpenStackClient client) { 11 | CLIENT = client; 12 | } 13 | 14 | public class ShowAccount extends OpenStackRequest { 15 | 16 | public ShowAccount() { 17 | // return target.request(MediaType.APPLICATION_JSON).head(); 18 | } 19 | 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /swift-model/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | 4 | com.woorea 5 | openstack-java-sdk 6 | 3.2.10-SNAPSHOT 7 | 8 | swift-model 9 | OpenStack Swift Model 10 | OpenStack Swift Model 11 | -------------------------------------------------------------------------------- /swift-model/src/main/java/com/woorea/openstack/swift/model/Account.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.swift.model; 2 | 3 | import java.io.Serializable; 4 | 5 | public class Account implements Serializable { 6 | 7 | private Integer containerCount; 8 | 9 | private Integer objectCount; 10 | 11 | private Integer bytesUsed; 12 | 13 | /** 14 | * @return the containerCount 15 | */ 16 | public Integer getContainerCount() { 17 | return containerCount; 18 | } 19 | 20 | /** 21 | * @param containerCount the containerCount to set 22 | */ 23 | public void setContainerCount(Integer containerCount) { 24 | this.containerCount = containerCount; 25 | } 26 | 27 | /** 28 | * @return the objectCount 29 | */ 30 | public Integer getObjectCount() { 31 | return objectCount; 32 | } 33 | 34 | /** 35 | * @param objectCount the objectCount to set 36 | */ 37 | public void setObjectCount(Integer objectCount) { 38 | this.objectCount = objectCount; 39 | } 40 | 41 | /** 42 | * @return the bytesUsed 43 | */ 44 | public Integer getBytesUsed() { 45 | return bytesUsed; 46 | } 47 | 48 | /** 49 | * @param bytesUsed the bytesUsed to set 50 | */ 51 | public void setBytesUsed(Integer bytesUsed) { 52 | this.bytesUsed = bytesUsed; 53 | } 54 | 55 | /* (non-Javadoc) 56 | * @see java.lang.Object#toString() 57 | */ 58 | @Override 59 | public String toString() { 60 | return "Account [containerCount=" + containerCount + ", objectCount=" 61 | + objectCount + ", bytesUsed=" + bytesUsed + "]"; 62 | } 63 | 64 | } 65 | -------------------------------------------------------------------------------- /swift-model/src/main/java/com/woorea/openstack/swift/model/Container.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.swift.model; 2 | 3 | import java.io.Serializable; 4 | 5 | import com.fasterxml.jackson.annotation.JsonProperty; 6 | 7 | public class Container implements Serializable { 8 | 9 | private String name; 10 | 11 | @JsonProperty("count") 12 | private Integer objectCount; 13 | 14 | @JsonProperty("bytes") 15 | private Long bytesUsed; 16 | 17 | /** 18 | * @return the name 19 | */ 20 | public String getName() { 21 | return name; 22 | } 23 | 24 | /** 25 | * @param name the name to set 26 | */ 27 | public void setName(String name) { 28 | this.name = name; 29 | } 30 | 31 | /** 32 | * @return the objectCount 33 | */ 34 | public Integer getObjectCount() { 35 | return objectCount; 36 | } 37 | 38 | /** 39 | * @param objectCount the objectCount to set 40 | */ 41 | public void setObjectCount(Integer objectCount) { 42 | this.objectCount = objectCount; 43 | } 44 | 45 | /** 46 | * @return the bytesUsed 47 | */ 48 | public Long getBytesUsed() { 49 | return bytesUsed; 50 | } 51 | 52 | /** 53 | * @param bytesUsed the bytesUsed to set 54 | */ 55 | public void setBytesUsed(Long bytesUsed) { 56 | this.bytesUsed = bytesUsed; 57 | } 58 | 59 | /* (non-Javadoc) 60 | * @see java.lang.Object#toString() 61 | */ 62 | @Override 63 | public String toString() { 64 | return "Container [name=" + name + ", objectCount=" + objectCount 65 | + ", bytesUsed=" + bytesUsed + "]"; 66 | } 67 | 68 | 69 | 70 | } 71 | -------------------------------------------------------------------------------- /swift-model/src/main/java/com/woorea/openstack/swift/model/ObjectDownload.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.swift.model; 2 | 3 | import java.io.InputStream; 4 | 5 | 6 | 7 | public class ObjectDownload { 8 | 9 | private Object object; 10 | 11 | private InputStream inputStream; 12 | 13 | /** 14 | * @return the object 15 | */ 16 | public Object getObject() { 17 | return object; 18 | } 19 | 20 | /** 21 | * @param object the object to set 22 | */ 23 | public void setObject(Object object) { 24 | this.object = object; 25 | } 26 | 27 | /** 28 | * @return the inputStream 29 | */ 30 | public InputStream getInputStream() { 31 | return inputStream; 32 | } 33 | 34 | /** 35 | * @param inputStream the inputStream to set 36 | */ 37 | public void setInputStream(InputStream inputStream) { 38 | this.inputStream = inputStream; 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /swift-model/src/main/java/com/woorea/openstack/swift/model/ObjectForUpload.java: -------------------------------------------------------------------------------- 1 | package com.woorea.openstack.swift.model; 2 | 3 | import java.io.InputStream; 4 | import java.util.HashMap; 5 | import java.util.Map; 6 | 7 | 8 | public class ObjectForUpload { 9 | 10 | private String container; 11 | 12 | private String name; 13 | 14 | private Map properties; 15 | 16 | private InputStream inputStream; 17 | 18 | /** 19 | * @return the container 20 | */ 21 | public String getContainer() { 22 | return container; 23 | } 24 | 25 | /** 26 | * @param container the container to set 27 | */ 28 | public void setContainer(String container) { 29 | this.container = container; 30 | } 31 | 32 | /** 33 | * @return the name 34 | */ 35 | public String getName() { 36 | return name; 37 | } 38 | 39 | /** 40 | * @param name the name to set 41 | */ 42 | public void setName(String name) { 43 | this.name = name; 44 | } 45 | 46 | /** 47 | * @return the properties 48 | */ 49 | public Map getProperties() { 50 | if(properties == null) { 51 | properties = new HashMap(); 52 | } 53 | return properties; 54 | } 55 | 56 | /** 57 | * @return the inputStream 58 | */ 59 | public InputStream getInputStream() { 60 | return inputStream; 61 | } 62 | 63 | /** 64 | * @param inputStream the inputStream to set 65 | */ 66 | public void setInputStream(InputStream inputStream) { 67 | this.inputStream = inputStream; 68 | } 69 | 70 | 71 | 72 | } 73 | --------------------------------------------------------------------------------