diff options
author | Smokowski, Steve (ss835w) <ss835w@us.att.com> | 2019-05-02 09:42:55 -0400 |
---|---|---|
committer | Smokowski, Steve (ss835w) <ss835w@us.att.com> | 2019-05-02 12:15:48 -0400 |
commit | e153f0adfbed711ce1e215748594a4d04fd1edaf (patch) | |
tree | 15a1f4d7b8af126e2061633c1547881992cfbb6f | |
parent | f9b78e1d7ca2b64badd8529aa4600250387ddae7 (diff) |
Enhance Openstack Client
Update Openstack Client to support Cinder, and drop null query params
Issue-ID: SO-1844
Change-Id: If58717656e0468ec0ce5d53055c381fe7d1c03f5
Signed-off-by: Smokowski, Steve (ss835w) <ss835w@us.att.com>
38 files changed, 2883 insertions, 143 deletions
diff --git a/cinder-client/pom.xml b/cinder-client/pom.xml new file mode 100755 index 0000000..47978ac --- /dev/null +++ b/cinder-client/pom.xml @@ -0,0 +1,26 @@ +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.onap.so.libs</groupId> + <artifactId>openstack-java-sdk</artifactId> + <version>1.4.0-SNAPSHOT</version> + </parent> + <artifactId>cinder-client</artifactId> + <name>OpenStack Cinder Client</name> + <description>OpenStack Cinder Client</description> + <dependencies> + <dependency> + <groupId>org.onap.so.libs.openstack-java-sdk</groupId> + <artifactId>openstack-client</artifactId> + <version>${project.version}</version> + </dependency> + + <dependency> + <groupId>org.onap.so.libs.openstack-java-sdk</groupId> + <artifactId>cinder-model</artifactId> + <version>${project.version}</version> + </dependency> + </dependencies> + <groupId>org.onap.so.libs.openstack-java-sdk</groupId> +</project>
\ No newline at end of file diff --git a/cinder-client/src/main/java/com/woorea/openstack/cinder/Cinder.java b/cinder-client/src/main/java/com/woorea/openstack/cinder/Cinder.java new file mode 100755 index 0000000..ca65d3f --- /dev/null +++ b/cinder-client/src/main/java/com/woorea/openstack/cinder/Cinder.java @@ -0,0 +1,65 @@ +/* ============LICENSE_START======================================================= + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package com.woorea.openstack.cinder; + +import com.woorea.openstack.base.client.OpenStackClient; +import com.woorea.openstack.base.client.OpenStackClientConnector; + +public class Cinder extends OpenStackClient { + + private final VolumesExtension VOLUMES; + + private final SnapshotsExtension SNAPSHOTS; + + private final VolumeTypesExtension VOLUME_TYPES; + + private final LimitsExtension LIMITS; + + private final SchedulerStatsExtension SCHEDULER_STATS; + + public Cinder(String endpoint, OpenStackClientConnector connector) { + super(endpoint, connector); + VOLUMES = new VolumesExtension(this); + SNAPSHOTS = new SnapshotsExtension(this); + VOLUME_TYPES = new VolumeTypesExtension(this); + LIMITS = new LimitsExtension(this); + SCHEDULER_STATS = new SchedulerStatsExtension(this); + } + + public Cinder(String endpoint) { + this(endpoint, null); + } + + public final VolumesExtension volumes() { + return VOLUMES; + } + + public final SnapshotsExtension snapshots() { + return SNAPSHOTS; + } + + public final VolumeTypesExtension volumeTypes() { + return VOLUME_TYPES; + } + + public final LimitsExtension limits() { + return LIMITS; + } + + public final SchedulerStatsExtension schedulerStats() { + return SCHEDULER_STATS; + } +} diff --git a/cinder-client/src/main/java/com/woorea/openstack/cinder/LimitsExtension.java b/cinder-client/src/main/java/com/woorea/openstack/cinder/LimitsExtension.java new file mode 100755 index 0000000..32c05d7 --- /dev/null +++ b/cinder-client/src/main/java/com/woorea/openstack/cinder/LimitsExtension.java @@ -0,0 +1,42 @@ +/* ============LICENSE_START======================================================= + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package com.woorea.openstack.cinder; + +import com.woorea.openstack.base.client.HttpMethod; +import com.woorea.openstack.base.client.OpenStackClient; +import com.woorea.openstack.base.client.OpenStackRequest; +import com.woorea.openstack.cinder.model.Limits; + +public class LimitsExtension { + + private final OpenStackClient CLIENT; + + public LimitsExtension(OpenStackClient client) { + CLIENT = client; + } + + public List list() { + return new List(); + } + + public class List extends OpenStackRequest<Limits> { + + public List() { + super(CLIENT, HttpMethod.GET, "/limits", null, Limits.class); + } + + } + +} diff --git a/cinder-client/src/main/java/com/woorea/openstack/cinder/SchedulerStatsExtension.java b/cinder-client/src/main/java/com/woorea/openstack/cinder/SchedulerStatsExtension.java new file mode 100755 index 0000000..09ad3ac --- /dev/null +++ b/cinder-client/src/main/java/com/woorea/openstack/cinder/SchedulerStatsExtension.java @@ -0,0 +1,44 @@ +/* ============LICENSE_START======================================================= + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package com.woorea.openstack.cinder; + +import com.woorea.openstack.base.client.HttpMethod; +import com.woorea.openstack.base.client.OpenStackClient; +import com.woorea.openstack.base.client.OpenStackRequest; +import com.woorea.openstack.cinder.model.Pools; + +/** + * Cinder Scheduler Stats Management + */ +public class SchedulerStatsExtension { + + private final OpenStackClient CLIENT; + + public SchedulerStatsExtension(OpenStackClient client) { + this.CLIENT = client; + } + + public List list(boolean detail) { + return new List(detail); + } + + public class List extends OpenStackRequest<Pools> { + + public List(boolean detail) { + super(CLIENT, HttpMethod.GET, (new StringBuilder("/scheduler-stats/get_pools")).append(detail ? "?detail=True":""), null, Pools.class); + } + } + +} diff --git a/cinder-client/src/main/java/com/woorea/openstack/cinder/SnapshotsExtension.java b/cinder-client/src/main/java/com/woorea/openstack/cinder/SnapshotsExtension.java new file mode 100755 index 0000000..d01bdc9 --- /dev/null +++ b/cinder-client/src/main/java/com/woorea/openstack/cinder/SnapshotsExtension.java @@ -0,0 +1,125 @@ +/* ============LICENSE_START======================================================= + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package com.woorea.openstack.cinder; + +import com.woorea.openstack.base.client.Entity; +import com.woorea.openstack.base.client.HttpMethod; +import com.woorea.openstack.base.client.OpenStackClient; +import com.woorea.openstack.base.client.OpenStackRequest; +import com.woorea.openstack.cinder.model.Metadata; +import com.woorea.openstack.cinder.model.Snapshot; +import com.woorea.openstack.cinder.model.SnapshotForCreate; +import com.woorea.openstack.cinder.model.SnapshotForUpdate; +import com.woorea.openstack.cinder.model.Snapshots; + +public class SnapshotsExtension { + + private final OpenStackClient CLIENT; + + public SnapshotsExtension(OpenStackClient client) { + CLIENT = client; + } + + public List list(boolean detail) { + return new List(detail); + } + + public Create create(SnapshotForCreate snapshotForCreate) { + return new Create(snapshotForCreate); + } + + public Show show(String id) { + return new Show(id); + } + + public ShowMetadata showMetadata(String snapshotId) { + return new ShowMetadata(snapshotId); + } + + public UpdateMetadata updateMetadata(String snapshotId, Metadata metadata) { + return new UpdateMetadata(snapshotId, metadata); + } + + public Delete delete(String id) { + return new Delete(id); + } + + public Update update(String id, SnapshotForUpdate snapshot) { + return new Update(id, snapshot); + } + + public class List extends OpenStackRequest<Snapshots> { + + public List(boolean detail) { + super(CLIENT, HttpMethod.GET, detail ? "/snapshots/detail" : "/snapshots", null, Snapshots.class); + } + + } + + public class Create extends OpenStackRequest<Snapshot> { + + public Create(SnapshotForCreate snapshotForCreate) { + super(CLIENT, HttpMethod.POST, "/snapshots", Entity.json(snapshotForCreate), Snapshot.class); + } + + } + + public class Show extends OpenStackRequest<Snapshot> { + + public Show(String id) { + super(CLIENT, HttpMethod.GET, new StringBuilder("/snapshots/").append(id).toString(), null, Snapshot.class); + } + + } + + public class Delete extends OpenStackRequest<Void> { + + public Delete(String id) { + super(CLIENT, HttpMethod.DELETE, new StringBuilder("/snapshots/").append(id).toString(), null, Void.class); + } + + } + + public class Update extends OpenStackRequest<Void> { + + public Update(String id, SnapshotForUpdate snapshot) { + super(CLIENT, HttpMethod.PUT, new StringBuilder("/snapshots/").append(id).toString(), + Entity.json(snapshot), Void.class); + } + + } + + public class ShowMetadata extends OpenStackRequest<Metadata> { + + public ShowMetadata(String id) { + super(CLIENT, + HttpMethod.GET, + new StringBuilder("/snapshots/").append(id).append("/metadata").toString(), + null, + Metadata.class); + } + + } + + public class UpdateMetadata extends OpenStackRequest<Void> { + + public UpdateMetadata(String snapshotId, Metadata metadata) { + super(CLIENT, HttpMethod.PUT, new StringBuilder("/snapshots/").append(snapshotId) + .append("/metadata") + .toString(), Entity.json(metadata), Void.class); + } + + } +} diff --git a/cinder-client/src/main/java/com/woorea/openstack/cinder/VolumeTypesExtension.java b/cinder-client/src/main/java/com/woorea/openstack/cinder/VolumeTypesExtension.java new file mode 100755 index 0000000..ded5768 --- /dev/null +++ b/cinder-client/src/main/java/com/woorea/openstack/cinder/VolumeTypesExtension.java @@ -0,0 +1,84 @@ +/* ============LICENSE_START======================================================= + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package com.woorea.openstack.cinder; + +import com.woorea.openstack.base.client.Entity; +import com.woorea.openstack.base.client.HttpMethod; +import com.woorea.openstack.base.client.OpenStackClient; +import com.woorea.openstack.base.client.OpenStackRequest; +import com.woorea.openstack.cinder.model.VolumeType; +import com.woorea.openstack.cinder.model.VolumeTypeForCreate; +import com.woorea.openstack.cinder.model.VolumeTypes; + +public class VolumeTypesExtension { + + private final OpenStackClient CLIENT; + + public VolumeTypesExtension(OpenStackClient client) { + CLIENT = client; + } + + public List list() { + return new List(); + } + + public Create create(VolumeTypeForCreate volumeTypeForCreate) { + return new Create(volumeTypeForCreate); + } + + public Show show(String id) { + return new Show(id); + } + + public Delete delete(String id) { + return new Delete(id); + } + + public class List extends OpenStackRequest<VolumeTypes> { + + public List() { + super(CLIENT, HttpMethod.GET, "/types", null, VolumeTypes.class); + } + + } + + public class Create extends OpenStackRequest<VolumeType> { + + private VolumeTypeForCreate volumeTypeForCreate; + + public Create(VolumeTypeForCreate volumeTypeForCreate) { + super(CLIENT, HttpMethod.POST, "/types", Entity.json(volumeTypeForCreate), VolumeType.class); + this.volumeTypeForCreate = volumeTypeForCreate; + } + + } + + public class Show extends OpenStackRequest<VolumeType> { + + public Show(String id) { + super(CLIENT, HttpMethod.GET, new StringBuilder("/types/").append(id).toString(), null, VolumeType.class); + } + + } + + public class Delete extends OpenStackRequest<Void> { + + public Delete(String id) { + super(CLIENT, HttpMethod.DELETE, new StringBuilder("/types/").append(id).toString(), null, Void.class); + } + + } + +} diff --git a/cinder-client/src/main/java/com/woorea/openstack/cinder/VolumesExtension.java b/cinder-client/src/main/java/com/woorea/openstack/cinder/VolumesExtension.java new file mode 100755 index 0000000..3e6bf97 --- /dev/null +++ b/cinder-client/src/main/java/com/woorea/openstack/cinder/VolumesExtension.java @@ -0,0 +1,178 @@ +/* ============LICENSE_START======================================================= + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package com.woorea.openstack.cinder; + +import com.woorea.openstack.base.client.Entity; +import com.woorea.openstack.base.client.HttpMethod; +import com.woorea.openstack.base.client.OpenStackClient; +import com.woorea.openstack.base.client.OpenStackRequest; +import com.woorea.openstack.cinder.model.ConnectionForInitialize; +import com.woorea.openstack.cinder.model.ConnectionForTerminate; +import com.woorea.openstack.cinder.model.ConnectionInfo; +import com.woorea.openstack.cinder.model.Metadata; +import com.woorea.openstack.cinder.model.Volume; +import com.woorea.openstack.cinder.model.VolumeForCreate; +import com.woorea.openstack.cinder.model.VolumeForExtend; +import com.woorea.openstack.cinder.model.VolumeForImageCreate; +import com.woorea.openstack.cinder.model.VolumeForUpdate; +import com.woorea.openstack.cinder.model.Volumes; + +public class VolumesExtension { + + private final OpenStackClient CLIENT; + + public VolumesExtension(OpenStackClient client) { + CLIENT = client; + } + + public List list(boolean detail) { + return new List(detail); + } + + public Create create(VolumeForCreate volume) { + return new Create(volume); + } + + public UploadToImage uploadToImage(VolumeForImageCreate volumeForImage) { + return new UploadToImage(volumeForImage); + } + + public Show show(String id) { + return new Show(id); + } + + public ShowMetadata showMetadata(String id) { + return new ShowMetadata(id); + } + + public Delete delete(String id) { + return new Delete(id); + } + + public Update update(String id, VolumeForUpdate volume) { + return new Update(id, volume); + } + + public Extend extend(String id, int newSize) { + VolumeForExtend volume = new VolumeForExtend(); + volume.setSize(newSize); + return new Extend(id, volume); + } + + public InitializeConnection initializeConnection(String id, ConnectionForInitialize connectionForInitialize) { + return new InitializeConnection(id, connectionForInitialize); + } + + public TerminateConnection terminateConnection(String id, ConnectionForTerminate connectionForTerminate) { + return new TerminateConnection(id, connectionForTerminate); + } + + public class List extends OpenStackRequest<Volumes> { + + public List(boolean detail) { + super(CLIENT, HttpMethod.GET, detail ? "/volumes/detail" + : "/volumes", null, Volumes.class); + } + + } + + public class Create extends OpenStackRequest<Volume> { + + public Create(VolumeForCreate volume) { + super(CLIENT, HttpMethod.POST, "/volumes", Entity.json(volume), + Volume.class); + } + + } + + // Upload volume to image service as image + + public class UploadToImage extends OpenStackRequest<Void> { + + public UploadToImage(VolumeForImageCreate volumeForImageCreate) { + super(CLIENT, HttpMethod.POST, new StringBuilder("/volumes/") + .append(volumeForImageCreate.getVolumeId() + "/action").toString(), + Entity.json(volumeForImageCreate), Void.class); + } + + } + + public class Show extends OpenStackRequest<Volume> { + + public Show(String id) { + super(CLIENT, HttpMethod.GET, new StringBuilder("/volumes/") + .append(id).toString(), null, Volume.class); + } + + } + + public class ShowMetadata extends OpenStackRequest<Metadata> { + + public ShowMetadata(String id) { + super(CLIENT, HttpMethod.GET, new StringBuilder("/volumes/") + .append(id).append("/metadata").toString(), null, + Metadata.class); + } + + } + + public class Delete extends OpenStackRequest<Void> { + + public Delete(String id) { + super(CLIENT, HttpMethod.DELETE, new StringBuilder("/volumes/") + .append(id).toString(), null, Void.class); + } + + } + + public class Update extends OpenStackRequest<Void> { + + public Update(String id, VolumeForUpdate volume) { + super(CLIENT, HttpMethod.PUT, new StringBuilder("/volumes/").append(id).toString(), + Entity.json(volume), Void.class); + } + + } + + public class Extend extends OpenStackRequest<Void> { + + public Extend(String id, VolumeForExtend volume) { + super(CLIENT, HttpMethod.POST, new StringBuilder("/volumes/").append(id).append("/action").toString(), + Entity.json(volume), Void.class); + } + + } + + public class InitializeConnection extends OpenStackRequest<ConnectionInfo> { + + public InitializeConnection(String id, ConnectionForInitialize connectionForInitialize) { + super(CLIENT, HttpMethod.POST, new StringBuilder("/volumes/") + .append(id).append("/action").toString(), + Entity.json(connectionForInitialize), ConnectionInfo.class); + } + + } + + public class TerminateConnection extends OpenStackRequest<Void> { + + public TerminateConnection(String id, ConnectionForTerminate connectionForTerminate) { + super(CLIENT, HttpMethod.POST, new StringBuilder("/volumes/") + .append(id).append("/action").toString(), + Entity.json(connectionForTerminate), Void.class); + } + + } + +} diff --git a/cinder-model/pom.xml b/cinder-model/pom.xml new file mode 100755 index 0000000..a739859 --- /dev/null +++ b/cinder-model/pom.xml @@ -0,0 +1,12 @@ +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.onap.so.libs</groupId> + <artifactId>openstack-java-sdk</artifactId> + <version>1.4.0-SNAPSHOT</version> + </parent> + <groupId>org.onap.so.libs.openstack-java-sdk</groupId> + <artifactId>cinder-model</artifactId> + <name>OpenStack Cinder Model</name> + <description>OpenStack Cinder Model</description> +</project>
\ No newline at end of file diff --git a/cinder-model/src/main/java/com/woorea/openstack/cinder/model/BaseConnection.java b/cinder-model/src/main/java/com/woorea/openstack/cinder/model/BaseConnection.java new file mode 100755 index 0000000..16be17b --- /dev/null +++ b/cinder-model/src/main/java/com/woorea/openstack/cinder/model/BaseConnection.java @@ -0,0 +1,42 @@ +/* ============LICENSE_START======================================================= + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package com.woorea.openstack.cinder.model; + +import java.io.Serializable; +import java.util.HashMap; +import java.util.Map; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public abstract class BaseConnection implements Serializable { + @JsonProperty("connector") + private Map<String, Object> connector = new HashMap<String, Object>(); + + /** + * @return the connector + */ + public Map<String, Object> getConnector() { + return connector; + } + + /** + * @param connector + * the connector to set + */ + public void setConnector(Map<String, Object> connector) { + this.connector = connector; + } + +} diff --git a/cinder-model/src/main/java/com/woorea/openstack/cinder/model/Capabilities.java b/cinder-model/src/main/java/com/woorea/openstack/cinder/model/Capabilities.java new file mode 100755 index 0000000..7a1609c --- /dev/null +++ b/cinder-model/src/main/java/com/woorea/openstack/cinder/model/Capabilities.java @@ -0,0 +1,153 @@ +/* ============LICENSE_START======================================================= + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package com.woorea.openstack.cinder.model; + +import java.io.Serializable; +import java.util.List; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; + +/** + * Model for Volume + */ +@JsonRootName("capabilities") +public class Capabilities implements Serializable { + + @JsonProperty("pool_name") + private String poolName; + @JsonProperty("QoS_support") + private boolean qosSupport; + @JsonProperty("allocated_capacity_gb") + private Long allocatedCapacityGb; + @JsonProperty("driver_version") + private String driverVersion; + @JsonProperty("free_capacity_gb") + private Long freeCapacityGb; + @JsonProperty("location_info") + private String locationInfo; + + private String timestamp; + @JsonProperty("volume_backend_name") + private String volumeBackendName; + @JsonProperty("total_capacity_gb") + private Long totalCapacityGb; + @JsonProperty("reserved_percentage") + private Integer reservedPercentage; + @JsonProperty("vendor_name") + private String vendorName; + @JsonProperty("storage_protocol") + private String storageProtocol; + @JsonProperty("extra_specs") + private Map<String, String> extraSpecs; + + public String getPoolName() { + return poolName; + } + public void setPoolName(String poolName) { + this.poolName = poolName; + } + public boolean isQosSupport() { + return qosSupport; + } + public void setQosSupport(boolean qosSupport) { + this.qosSupport = qosSupport; + } + public Long getAllocatedCapacityGb() { + return allocatedCapacityGb; + } + public void setAllocatedCapacityGb(Long allocatedCapacityGb) { + this.allocatedCapacityGb = allocatedCapacityGb; + } + public String getDriverVersion() { + return driverVersion; + } + public void setDriverVersion(String driverVersion) { + this.driverVersion = driverVersion; + } + public Long getFreeCapacityGb() { + return freeCapacityGb; + } + public void setFreeCapacityGb(Long freeCapacityGb) { + this.freeCapacityGb = freeCapacityGb; + } + public String getLocationInfo() { + return locationInfo; + } + public void setLocationInfo(String locationInfo) { + this.locationInfo = locationInfo; + } + public String getTimestamp() { + return timestamp; + } + public void setTimestamp(String timestamp) { + this.timestamp = timestamp; + } + public String getVolumeBackendName() { + return volumeBackendName; + } + public void setVolumeBackendName(String volumeBackendName) { + this.volumeBackendName = volumeBackendName; + } + public Long getTotalCapacityGb() { + return totalCapacityGb; + } + public void setTotalCapacityGb(Long totalCapacityGb) { + this.totalCapacityGb = totalCapacityGb; + } + public Integer getReservedPercentage() { + return reservedPercentage; + } + public void setReservedPercentage(Integer reservedPercentage) { + this.reservedPercentage = reservedPercentage; + } + public String getVendorName() { + return vendorName; + } + public void setVendorName(String vendorName) { + this.vendorName = vendorName; + } + public String getStorageProtocol() { + return storageProtocol; + } + public void setStorageProtocol(String storageProtocol) { + this.storageProtocol = storageProtocol; + } + public Map<String, String> getExtraSpecs() { + return extraSpecs; + } + public void setExtraSpecs(Map<String, String> extraSpecs) { + this.extraSpecs = extraSpecs; + } + + @Override + public String toString() { + return "Capabilities{" + + "poolName='" + poolName + + ", qosSupport='" + qosSupport + + ", allocatedCapacityGb='" + allocatedCapacityGb + + ", driverVersion='" + driverVersion + + ", freeCapacityGb='" + freeCapacityGb + + ", locationInfo='" + locationInfo + + ", timestamp='" + timestamp + + ", volumeBackendName='" + volumeBackendName + + ", totalCapacityGb='" + totalCapacityGb + + ", reservedPercentage='" + reservedPercentage + + ", vendorName='" + vendorName + + ", storageProtocol='" + storageProtocol + + ", extraSpecs='" + extraSpecs + + '}'; + } +} diff --git a/cinder-model/src/main/java/com/woorea/openstack/cinder/model/ConnectionForInitialize.java b/cinder-model/src/main/java/com/woorea/openstack/cinder/model/ConnectionForInitialize.java new file mode 100755 index 0000000..7406eea --- /dev/null +++ b/cinder-model/src/main/java/com/woorea/openstack/cinder/model/ConnectionForInitialize.java @@ -0,0 +1,34 @@ +/* ============LICENSE_START======================================================= + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package com.woorea.openstack.cinder.model; + +import com.fasterxml.jackson.annotation.JsonRootName; + +import java.io.Serializable; + +@JsonRootName("os-initialize_connection") +public class ConnectionForInitialize extends BaseConnection implements Serializable { + + /* + * (non-Javadoc) + * + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "ConnectionForInitialize [connector=" + getConnector() + "]"; + } + +} diff --git a/cinder-model/src/main/java/com/woorea/openstack/cinder/model/ConnectionForTerminate.java b/cinder-model/src/main/java/com/woorea/openstack/cinder/model/ConnectionForTerminate.java new file mode 100755 index 0000000..208fc54 --- /dev/null +++ b/cinder-model/src/main/java/com/woorea/openstack/cinder/model/ConnectionForTerminate.java @@ -0,0 +1,34 @@ +/* ============LICENSE_START======================================================= + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package com.woorea.openstack.cinder.model; + +import com.fasterxml.jackson.annotation.JsonRootName; + +import java.io.Serializable; + +@JsonRootName("os-terminate_connection") +public class ConnectionForTerminate extends BaseConnection implements Serializable { + + /* + * (non-Javadoc) + * + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "ConnectionForInitialize [connector=" + getConnector() + "]"; + } + +} diff --git a/cinder-model/src/main/java/com/woorea/openstack/cinder/model/ConnectionInfo.java b/cinder-model/src/main/java/com/woorea/openstack/cinder/model/ConnectionInfo.java new file mode 100755 index 0000000..1bf9677 --- /dev/null +++ b/cinder-model/src/main/java/com/woorea/openstack/cinder/model/ConnectionInfo.java @@ -0,0 +1,72 @@ +/* ============LICENSE_START======================================================= + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package com.woorea.openstack.cinder.model; + +import java.io.Serializable; +import java.util.Map; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; + +@JsonRootName("connection_info") +public class ConnectionInfo implements Serializable { + + @JsonProperty("driver_volume_type") + private String driverVolumeType; + + private Map<String, Object> data; + + /** + * @return the driverVolumeType + */ + public String getDriverVolumeType() { + return driverVolumeType; + } + + /** + * @param driverVolumeType + * the driverVolumeType to set + */ + public void setDriverVolumeType(String driverVolumeType) { + this.driverVolumeType = driverVolumeType; + } + + /** + * @return the data + */ + public Map<String, Object> getData() { + return data; + } + + /** + * @param data + * the data to set + */ + public void setData(Map<String, Object> data) { + this.data = data; + } + + /* + * (non-Javadoc) + * + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "ConnectionInfo [driverVolumeType=" + driverVolumeType + "," + + " data=" + data + "]"; + } + +} diff --git a/cinder-model/src/main/java/com/woorea/openstack/cinder/model/Limits.java b/cinder-model/src/main/java/com/woorea/openstack/cinder/model/Limits.java new file mode 100755 index 0000000..6c83845 --- /dev/null +++ b/cinder-model/src/main/java/com/woorea/openstack/cinder/model/Limits.java @@ -0,0 +1,260 @@ +/* ============LICENSE_START======================================================= + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package com.woorea.openstack.cinder.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; + +import java.io.Serializable; +import java.util.Calendar; +import java.util.List; + +@JsonRootName("limits") +public class Limits implements Serializable { + + public static final class RateLimit implements Serializable { + + public static final class LimitEntry implements Serializable { + + @JsonProperty("next-available") + private Calendar nextAvailable; + + private String unit; + + private String verb; + + private Integer remaining; + + private Integer available; + + private Integer value; + + /** + * @return the nextAvailable + */ + public Calendar getNextAvailable() { + return nextAvailable; + } + + /** + * @return the unit + */ + public String getUnit() { + return unit; + } + + /** + * @return the verb + */ + public String getVerb() { + return verb; + } + + /** + * @return the remaining + */ + public Integer getRemaining() { + return remaining; + } + + /** + * @return the available + */ + public Integer getAvailable() { + return available; + } + + /** + * @return the value + */ + public Integer getValue() { + return value; + } + + /* + * (non-Javadoc) + * + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "LimitEntry [nextAvailable=" + nextAvailable + ", unit=" + + unit + ", verb=" + verb + ", remaining=" + remaining + + ", available=" + available + ", value=" + value + "]"; + } + + } + + private String regex; + + private String uri; + + private List<LimitEntry> limit; + + /** + * @return the regex + */ + public String getRegex() { + return regex; + } + + /** + * @return the uri + */ + public String getUri() { + return uri; + } + + /** + * @return the limit + */ + public List<LimitEntry> getLimit() { + return limit; + } + + /* + * (non-Javadoc) + * + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "RateLimit [regex=" + regex + ", uri=" + uri + ", limit=" + + limit + "]"; + } + + } + + public static final class AbsoluteLimit { + + private Integer maxTotalVolumes; + private Integer totalVolumesUsed; + + private Integer maxTotalSnapshots; + private Integer totalSnapshotsUsed; + + private Integer maxTotalVolumeGigabytes; + private Integer totalGigabytesUsed; + + private Integer maxTotalBackups; + private Integer totalBackupsUsed; + + private Integer maxTotalBackupGigabytes; + private Integer totalBackupGigabytesUsed; + + /** + * @return the maxTotalVolumes + */ + public Integer getMaxTotalVolumes() { + return maxTotalVolumes; + } + + /** + * @return the totalVolumesUsed + */ + public Integer getTotalVolumesUsed() { + return totalVolumesUsed; + } + + /** + * @return the maxTotalSnapshots + */ + public Integer getMaxTotalSnapshots() { + return maxTotalSnapshots; + } + + /** + * @return the totalSnapshotsUsed + */ + public Integer getTotalSnapshotsUsed() { + return totalSnapshotsUsed; + } + + /** + * @return the maxTotalVolumeGigabytes + */ + public Integer getMaxTotalVolumeGigabytes() { + return maxTotalVolumeGigabytes; + } + + /** + * @return the totalGigabytesUsed + */ + public Integer getTotalGigabytesUsed() { + return totalGigabytesUsed; + } + + /** + * @return the maxTotalBackupGigabytes + */ + public Integer getMaxTotalBackupGigabytes() { + return maxTotalBackupGigabytes; + } + + /** + * @return the totalBackupGigabytesUsed + */ + public Integer getTotalBackupGigabytesUsed() { + return totalBackupGigabytesUsed; + } + + /* + * (non-Javadoc) + * + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "AbsoluteLimit [maxTotalVolumes=" + maxTotalVolumes + + ", totalVolumesUsed=" + totalVolumesUsed + + ", maxTotalSnapshots=" + maxTotalSnapshots + + ", totalSnapshotsUsed=" + totalSnapshotsUsed + + ", maxTotalVolumeGigabytes=" + maxTotalVolumeGigabytes + + ", totalGigabytesUsed=" + totalGigabytesUsed + + ", maxTotalBackupGigabytes=" + maxTotalBackupGigabytes + + ", totalBackupGigabytesUsed=" + totalBackupGigabytesUsed +"]"; + } + + } + + private List<RateLimit> rate; + + private AbsoluteLimit absolute; + + /** + * @return the rate + */ + public List<RateLimit> getRate() { + return rate; + } + + /** + * @return the absolute + */ + public AbsoluteLimit getAbsolute() { + return absolute; + } + + /* + * (non-Javadoc) + * + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "Limits [rate=" + rate + ", absolute=" + absolute + "]"; + } + +} diff --git a/cinder-model/src/main/java/com/woorea/openstack/cinder/model/Metadata.java b/cinder-model/src/main/java/com/woorea/openstack/cinder/model/Metadata.java new file mode 100755 index 0000000..b8ed1df --- /dev/null +++ b/cinder-model/src/main/java/com/woorea/openstack/cinder/model/Metadata.java @@ -0,0 +1,49 @@ +/* ============LICENSE_START======================================================= + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package com.woorea.openstack.cinder.model; + +import java.util.Map; + +public class Metadata { + + private Map<String, String> metadata; + + /** + * @return the metadata + */ + public Map<String, String> getMetadata() { + return metadata; + } + + /** + * Set the metadata + * + * @param metadata + */ + public void setMetadata(Map<String, String> metadata) { + this.metadata = metadata; + } + + /* + * (non-Javadoc) + * + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "Metadata [metadata=" + metadata + "]"; + } + +} diff --git a/cinder-model/src/main/java/com/woorea/openstack/cinder/model/Pool.java b/cinder-model/src/main/java/com/woorea/openstack/cinder/model/Pool.java new file mode 100755 index 0000000..4f292c4 --- /dev/null +++ b/cinder-model/src/main/java/com/woorea/openstack/cinder/model/Pool.java @@ -0,0 +1,56 @@ +/* ============LICENSE_START======================================================= + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package com.woorea.openstack.cinder.model; + +import java.io.Serializable; +import java.util.List; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; + +/** + * Model for Pool + */ +@JsonRootName("pool") +public class Pool implements Serializable { + + private String name; + + private Capabilities capabilities; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public Capabilities getCapabilities() { + return capabilities; + } + + public void setCapabilities(Capabilities capabilities) { + this.capabilities = capabilities; + } + + @Override + public String toString() { + return "Pool{" + + "name='" + name + + ", capabilities='" + capabilities + + '}'; + } +} diff --git a/cinder-model/src/main/java/com/woorea/openstack/cinder/model/Pools.java b/cinder-model/src/main/java/com/woorea/openstack/cinder/model/Pools.java new file mode 100755 index 0000000..771b0ac --- /dev/null +++ b/cinder-model/src/main/java/com/woorea/openstack/cinder/model/Pools.java @@ -0,0 +1,47 @@ +/* ============LICENSE_START======================================================= + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package com.woorea.openstack.cinder.model; + +import java.io.Serializable; +import java.util.Iterator; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Model for List of pools + */ +public class Pools implements Iterable<Pool>, Serializable { + + @JsonProperty("pools") + private List<Pool> list; + + public List<Pool> getList() { + return list; + } + + public void setList(List<Pool> list) { + this.list = list; + } + + @Override + public Iterator<Pool> iterator() { + return list.iterator(); + } + + @Override + public String toString() { + return "Pools [list=" + list + "]"; + } +} diff --git a/cinder-model/src/main/java/com/woorea/openstack/cinder/model/Snapshot.java b/cinder-model/src/main/java/com/woorea/openstack/cinder/model/Snapshot.java new file mode 100755 index 0000000..6f78c8f --- /dev/null +++ b/cinder-model/src/main/java/com/woorea/openstack/cinder/model/Snapshot.java @@ -0,0 +1,113 @@ +/* ============LICENSE_START======================================================= + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package com.woorea.openstack.cinder.model; + +import java.io.Serializable; +import java.util.Map; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; + +@JsonRootName("snapshot") +public class Snapshot implements Serializable { + + private String id; + + private String status; + + private String name; + + private String description; + + @JsonProperty("volume_id") + private String volumeId; + + private Integer size; + + @JsonProperty("created_at") + private String createdAt; + + private Map<String, String> metadata; + + /** + * @return the id + */ + public String getId() { + return id; + } + + /** + * @return the status + */ + public String getStatus() { + return status; + } + + /** + * @return the name + */ + public String getName() { + return name; + } + + /** + * @return the description + */ + public String getDescription() { + return description; + } + + /** + * @return the volumeId + */ + public String getVolumeId() { + return volumeId; + } + + /** + * @return the size + */ + public Integer getSize() { + return size; + } + + /** + * @return the createdAt + */ + public String getCreatedAt() { + return createdAt; + } + + /** + * @return the metadata + */ + public Map<String, String> getMetadata() { + return metadata; + } + + /* + * (non-Javadoc) + * + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "Snapshot [id=" + id + ", status=" + status + + ", name=" + name + ", description=" + description + + ", volumeId=" + volumeId + ", size=" + size + + ", createdAt=" + createdAt + ", metadata=" + metadata + "]"; + } + +} diff --git a/cinder-model/src/main/java/com/woorea/openstack/cinder/model/SnapshotForCreate.java b/cinder-model/src/main/java/com/woorea/openstack/cinder/model/SnapshotForCreate.java new file mode 100755 index 0000000..e2896b8 --- /dev/null +++ b/cinder-model/src/main/java/com/woorea/openstack/cinder/model/SnapshotForCreate.java @@ -0,0 +1,105 @@ +/* ============LICENSE_START======================================================= + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package com.woorea.openstack.cinder.model; + +import java.io.Serializable; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; + +@JsonRootName("snapshot") +public class SnapshotForCreate implements Serializable { + + @JsonProperty("volume_id") + private String volumeId; + + private Boolean force; + + private String name; + + private String description; + + /** + * @return the volumeId + */ + public String getVolumeId() { + return volumeId; + } + + /** + * @param volumeId + * the volumeId to set + */ + public void setVolumeId(String volumeId) { + this.volumeId = volumeId; + } + + /** + * @return the force + */ + public Boolean getForce() { + return force; + } + + /** + * @param force + * the force to set + */ + public void setForce(Boolean force) { + this.force = force; + } + + /** + * @return the name + */ + public String getName() { + return name; + } + + /** + * @param name + * the name to set + */ + public void setName(String name) { + this.name = name; + } + + /** + * @return the description + */ + public String getDescription() { + return description; + } + + /** + * @param description + * the description to set + */ + public void setDescription(String description) { + this.description = description; + } + + /* + * (non-Javadoc) + * + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "SnapshotForCreate [volumeId=" + volumeId + ", force=" + force + + ", name=" + name + ", description=" + description + "]"; + } + +} diff --git a/cinder-model/src/main/java/com/woorea/openstack/cinder/model/SnapshotForUpdate.java b/cinder-model/src/main/java/com/woorea/openstack/cinder/model/SnapshotForUpdate.java new file mode 100755 index 0000000..dd16b55 --- /dev/null +++ b/cinder-model/src/main/java/com/woorea/openstack/cinder/model/SnapshotForUpdate.java @@ -0,0 +1,68 @@ +/* ============LICENSE_START======================================================= + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package com.woorea.openstack.cinder.model; + +import java.io.Serializable; + +import com.fasterxml.jackson.annotation.JsonRootName; + +@JsonRootName("snapshot") +public class SnapshotForUpdate implements Serializable { + + private String name; + + private String description; + + /** + * @return the name + */ + public String getName() { + return name; + } + + /** + * @param name + * the name to set + */ + public void setName(String name) { + this.name = name; + } + + /** + * @return the description + */ + public String getDescription() { + return description; + } + + /** + * @param description + * the description to set + */ + public void setDescription(String description) { + this.description = description; + } + + /* + * (non-Javadoc) + * + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "SnapshotForUpdate [name=" + name + ", description=" + description + "]"; + } + +} diff --git a/cinder-model/src/main/java/com/woorea/openstack/cinder/model/Snapshots.java b/cinder-model/src/main/java/com/woorea/openstack/cinder/model/Snapshots.java new file mode 100755 index 0000000..aec991a --- /dev/null +++ b/cinder-model/src/main/java/com/woorea/openstack/cinder/model/Snapshots.java @@ -0,0 +1,50 @@ +/* ============LICENSE_START======================================================= + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package com.woorea.openstack.cinder.model; + +import java.io.Serializable; +import java.util.Iterator; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class Snapshots implements Iterable<Snapshot>, Serializable { + + @JsonProperty("snapshots") + private List<Snapshot> list; + + /** + * @return the list + */ + public List<Snapshot> getList() { + return list; + } + + /* + * (non-Javadoc) + * + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "Snapshots [list=" + list + "]"; + } + + @Override + public Iterator<Snapshot> iterator() { + return list.iterator(); + } + +} diff --git a/cinder-model/src/main/java/com/woorea/openstack/cinder/model/Volume.java b/cinder-model/src/main/java/com/woorea/openstack/cinder/model/Volume.java new file mode 100755 index 0000000..6d0068c --- /dev/null +++ b/cinder-model/src/main/java/com/woorea/openstack/cinder/model/Volume.java @@ -0,0 +1,180 @@ +/* ============LICENSE_START======================================================= + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package com.woorea.openstack.cinder.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; + +import java.io.Serializable; +import java.util.List; +import java.util.Map; + +@JsonRootName("volume") +public class Volume implements Serializable { + + private String id; + + private String status; + + private String name; + + private String description; + + @JsonProperty("availability_zone") + private String availabilityZone; + + @JsonProperty("volume_type") + private String volumeType; + + @JsonProperty("snapshot_id") + private String snapshotId; + + @JsonProperty("source_volid") + private String sourceVolid; + + @JsonProperty("bootable") + private Boolean bootable; + + private List<Map<String, Object>> attachments; + + private Map<String, String> metadata; + + @JsonProperty("created_at") + private String createdAt; + + private Integer size; + + /** + * @return the id + */ + public String getId() { + return id; + } + + /** + * @return the status + */ + public String getStatus() { + return status; + } + + /** + * @return the name + */ + public String getName() { + return name; + } + + /** + * @return the description + */ + public String getDescription() { + return description; + } + + /** + * @return the availabilityZone + */ + public String getAvailabilityZone() { + return availabilityZone; + } + + /** + * @return the volumeType + */ + public String getVolumeType() { + return volumeType; + } + + /** + * @return the snapshotId + */ + public String getSnapshotId() { + return snapshotId; + } + + /** + * @return the ID of an existing volume (specify in order to create a volume from an existing volume) + */ + public String getSourceVolid() { + return sourceVolid; + } + + /** + * @param sourceVolid + * to set + */ + public void setSourceVolid(String sourceVolid) { + this.sourceVolid = sourceVolid; + } + + /** + * @param volumeType + * to set + */ + public void setVolumeType(String volumeType) { + this.volumeType = volumeType; + } + + /** + * @return the bootable flag to set + */ + public Boolean getBootable() { + return bootable; + } + + /** + * @return the attachments + */ + public List<Map<String, Object>> getAttachments() { + return attachments; + } + + /** + * @return the metadata + */ + public Map<String, String> getMetadata() { + return metadata; + } + + /** + * @return the createdAt + */ + public String getCreatedAt() { + return createdAt; + } + + /** + * @return the size + */ + public Integer getSize() { + return size; + } + + /* + * (non-Javadoc) + * + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "Volume [id=" + id + ", status=" + status + + ", name=" + name + ", description=" + description + + ", availabilityZone=" + availabilityZone + ", volumeType=" + volumeType + + ", snapshotId=" + snapshotId + ", attachments=" + attachments + + ", metadata=" + metadata + ", createdAt=" + createdAt + ", size=" + size + "]"; + } + +} diff --git a/cinder-model/src/main/java/com/woorea/openstack/cinder/model/VolumeForCreate.java b/cinder-model/src/main/java/com/woorea/openstack/cinder/model/VolumeForCreate.java new file mode 100755 index 0000000..dd70820 --- /dev/null +++ b/cinder-model/src/main/java/com/woorea/openstack/cinder/model/VolumeForCreate.java @@ -0,0 +1,225 @@ +/* ============LICENSE_START======================================================= + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package com.woorea.openstack.cinder.model; + +import java.io.Serializable; +import java.util.Map; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; + +@JsonRootName("volume") +public class VolumeForCreate implements Serializable { + + private Integer size; + + @JsonProperty("availability_zone") + private String availabilityZone; + + @JsonProperty("display_name") + private String name; + + @JsonProperty("display_description") + private String description; + + @JsonProperty("snapshot_id") + private String snapshotId; + + @JsonProperty("source_volid") + private String sourceVolid; + + @JsonProperty("imageRef") + private String imageRef; + + @JsonProperty("volume_type") + private String volumeType; + + @JsonProperty("bootable") + private Boolean bootable; + + private Map<String, String> metadata; + + /** + * @return the size + */ + public Integer getSize() { + return size; + } + + /** + * @param size + * the size to set + */ + public void setSize(Integer size) { + this.size = size; + } + + /** + * @return the availabilityZone + */ + public String getAvailabilityZone() { + return availabilityZone; + } + + /** + * @param availabilityZone + * the availabilityZone to set + */ + public void setAvailabilityZone(String availabilityZone) { + this.availabilityZone = availabilityZone; + } + + /** + * @return the name + */ + public String getName() { + return name; + } + + /** + * @param name + * the name to set + */ + public void setName(String name) { + this.name = name; + } + + /** + * @return the description + */ + public String getDescription() { + return description; + } + + /** + * @param description + * the description to set + */ + public void setDescription(String description) { + this.description = description; + } + + /** + * @return the snapshotId + */ + public String getSnapshotId() { + return snapshotId; + } + + /** + * @param snapshotId + * the snapshotId to set + */ + public void setSnapshotId(String snapshotId) { + this.snapshotId = snapshotId; + } + + /** + * @return the ID of an existing volume (specify in order to create a volume from an existing volume) + */ + public String getSourceVolid() { + return sourceVolid; + } + + /** + * @param sourceVolid + * to set + */ + public void setSourceVolid(String sourceVolid) { + this.sourceVolid = sourceVolid; + } + + /** + * @return the ID of the image from which you want to create the volume (required to create a bootable volume) + */ + public String getImageRef() { + return imageRef; + } + + /** + * @param imageRef + * to set + */ + public void setImageRef(String imageRef) { + this.imageRef = imageRef; + } + + /** + * @return the associated volume type + */ + public String getVolumeType() { + return volumeType; + } + + /** + * @param volumeType + * to set + */ + public void setVolumeType(String volumeType) { + this.volumeType = volumeType; + } + + /** + * @return the bootable flag to set + */ + public Boolean getBootable() { + return bootable; + } + + /** + * Enables or disables the bootable attribute. You can boot an instance from a bootable volume. + * + * @param bootable + * flag + */ + public void setBootable(Boolean bootable) { + this.bootable = bootable; + } + + /** + * @return the metadata + */ + public Map<String, String> getMetadata() { + return metadata; + } + + /** + * @param metadata + * the metadata to set + */ + public void setMetadata(Map<String, String> metadata) { + this.metadata = metadata; + } + + /* + * (non-Javadoc) + * + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "VolumeForCreate [size=" + size + + ", availabilityZone=" + availabilityZone + + ", name=" + name + + ", description=" + description + + ", snapshotId=" + snapshotId + + ", source_volid=" + sourceVolid + + ", imageRef=" + imageRef + + ", volume_type=" + volumeType + + ", bootable=" + bootable + + ", metadata=" + metadata + "]"; + } + +} diff --git a/cinder-model/src/main/java/com/woorea/openstack/cinder/model/VolumeForExtend.java b/cinder-model/src/main/java/com/woorea/openstack/cinder/model/VolumeForExtend.java new file mode 100755 index 0000000..75eee2d --- /dev/null +++ b/cinder-model/src/main/java/com/woorea/openstack/cinder/model/VolumeForExtend.java @@ -0,0 +1,53 @@ +/* ============LICENSE_START======================================================= + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package com.woorea.openstack.cinder.model; + +import java.io.Serializable; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; + +@JsonRootName("os-extend") +public class VolumeForExtend implements Serializable { + + @JsonProperty("new_size") + private Integer size; + + /** + * @return the size + */ + public Integer getSize() { + return size; + } + + /** + * @param size + * the size to set + */ + public void setSize(Integer size) { + this.size = size; + } + + /* + * (non-Javadoc) + * + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "VolumeForExtend [size=" + size + "]"; + } + +} diff --git a/cinder-model/src/main/java/com/woorea/openstack/cinder/model/VolumeForImageCreate.java b/cinder-model/src/main/java/com/woorea/openstack/cinder/model/VolumeForImageCreate.java new file mode 100755 index 0000000..916892f --- /dev/null +++ b/cinder-model/src/main/java/com/woorea/openstack/cinder/model/VolumeForImageCreate.java @@ -0,0 +1,85 @@ +/* ============LICENSE_START======================================================= + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package com.woorea.openstack.cinder.model; + +import java.io.Serializable; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; + +@JsonRootName("os-volume_upload_image") +public class VolumeForImageCreate implements Serializable { + String volumeId; + String tenantId; + + public String getTenantId() { + return tenantId; + } + + public void setTenantId(String tenantId) { + this.tenantId = tenantId; + } + + @JsonProperty("force") + private Boolean force; + + public Boolean getForce() { + return force; + } + + public void setForce(Boolean force) { + this.force = force; + } + + @JsonProperty("container_format") + String container_format; + @JsonProperty("disk_format") + String disk_format; + @JsonProperty("image_name") + String image_name; + + public String getVolumeId() { + return volumeId; + } + + public void setVolumeId(String volumeId) { + this.volumeId = volumeId; + } + + public String getContainer_format() { + return container_format; + } + + public void setContainer_format(String container_format) { + this.container_format = container_format; + } + + public String getDisk_format() { + return disk_format; + } + + public void setDisk_format(String disk_format) { + this.disk_format = disk_format; + } + + public String getImage_name() { + return image_name; + } + + public void setImage_name(String image_name) { + this.image_name = image_name; + } + +} diff --git a/cinder-model/src/main/java/com/woorea/openstack/cinder/model/VolumeForUpdate.java b/cinder-model/src/main/java/com/woorea/openstack/cinder/model/VolumeForUpdate.java new file mode 100755 index 0000000..5746f49 --- /dev/null +++ b/cinder-model/src/main/java/com/woorea/openstack/cinder/model/VolumeForUpdate.java @@ -0,0 +1,68 @@ +/* ============LICENSE_START======================================================= + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package com.woorea.openstack.cinder.model; + +import java.io.Serializable; + +import com.fasterxml.jackson.annotation.JsonRootName; + +@JsonRootName("volume") +public class VolumeForUpdate implements Serializable { + + private String name; + + private String description; + + /** + * @return the name + */ + public String getName() { + return name; + } + + /** + * @param name + * the name to set + */ + public void setName(String name) { + this.name = name; + } + + /** + * @return the description + */ + public String getDescription() { + return description; + } + + /** + * @param description + * the description to set + */ + public void setDescription(String description) { + this.description = description; + } + + /* + * (non-Javadoc) + * + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "VolumeForUpdate [name=" + name + ", description=" + description + "]"; + } + +} diff --git a/cinder-model/src/main/java/com/woorea/openstack/cinder/model/VolumeType.java b/cinder-model/src/main/java/com/woorea/openstack/cinder/model/VolumeType.java new file mode 100755 index 0000000..73fdfe1 --- /dev/null +++ b/cinder-model/src/main/java/com/woorea/openstack/cinder/model/VolumeType.java @@ -0,0 +1,64 @@ +/* ============LICENSE_START======================================================= + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package com.woorea.openstack.cinder.model; + +import java.io.Serializable; +import java.util.Map; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; + +@JsonRootName("volume_type") +public class VolumeType implements Serializable { + + private String id; + + private String name; + + @JsonProperty("extra_specs") + private Map<String, String> extraSpecs; + + /** + * @return the id + */ + public String getId() { + return id; + } + + /** + * @return the name + */ + public String getName() { + return name; + } + + /** + * @return the extra_specs + */ + public Map<String, String> getExtraSpecs() { + return extraSpecs; + } + + /* + * (non-Javadoc) + * + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "VolumeType [id=" + id + ", name=" + name + ", extra_specs=" + extraSpecs + "]"; + } + +} diff --git a/cinder-model/src/main/java/com/woorea/openstack/cinder/model/VolumeTypeForCreate.java b/cinder-model/src/main/java/com/woorea/openstack/cinder/model/VolumeTypeForCreate.java new file mode 100755 index 0000000..e228c27 --- /dev/null +++ b/cinder-model/src/main/java/com/woorea/openstack/cinder/model/VolumeTypeForCreate.java @@ -0,0 +1,71 @@ +/* ============LICENSE_START======================================================= + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package com.woorea.openstack.cinder.model; + +import java.io.Serializable; +import java.util.Map; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; + +@JsonRootName("volume_type") +public class VolumeTypeForCreate implements Serializable { + + private String name; + + @JsonProperty("extra_specs") + private Map<String, String> extraSpecs; + + /** + * @return the name + */ + public String getName() { + return name; + } + + /** + * @param name + * the name to set + */ + public void setName(String name) { + this.name = name; + } + + /** + * @return the extraSpecs + */ + public Map<String, String> getExtraSpecs() { + return extraSpecs; + } + + /** + * @param extraSpecs + * the extra_specs to set + */ + public void setExtraSpecs(Map<String, String> extraSpecs) { + this.extraSpecs = extraSpecs; + } + + /* + * (non-Javadoc) + * + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "VolumeForCreate [name=" + name + ", metadata=" + extraSpecs + "]"; + } + +} diff --git a/cinder-model/src/main/java/com/woorea/openstack/cinder/model/VolumeTypes.java b/cinder-model/src/main/java/com/woorea/openstack/cinder/model/VolumeTypes.java new file mode 100755 index 0000000..761a702 --- /dev/null +++ b/cinder-model/src/main/java/com/woorea/openstack/cinder/model/VolumeTypes.java @@ -0,0 +1,50 @@ +/* ============LICENSE_START======================================================= + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package com.woorea.openstack.cinder.model; + +import java.io.Serializable; +import java.util.Iterator; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class VolumeTypes implements Iterable<VolumeType>, Serializable { + + @JsonProperty("volume_types") + private List<VolumeType> list; + + /** + * @return the list + */ + public List<VolumeType> getList() { + return list; + } + + /* + * (non-Javadoc) + * + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "Volume Types [list=" + list + "]"; + } + + @Override + public Iterator<VolumeType> iterator() { + return list.iterator(); + } + +} diff --git a/cinder-model/src/main/java/com/woorea/openstack/cinder/model/Volumes.java b/cinder-model/src/main/java/com/woorea/openstack/cinder/model/Volumes.java new file mode 100755 index 0000000..096bf9a --- /dev/null +++ b/cinder-model/src/main/java/com/woorea/openstack/cinder/model/Volumes.java @@ -0,0 +1,50 @@ +/* ============LICENSE_START======================================================= + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package com.woorea.openstack.cinder.model; + +import java.io.Serializable; +import java.util.Iterator; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class Volumes implements Iterable<Volume>, Serializable { + + @JsonProperty("volumes") + private List<Volume> list; + + /** + * @return the list + */ + public List<Volume> getList() { + return list; + } + + /* + * (non-Javadoc) + * + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "Volumes [list=" + list + "]"; + } + + @Override + public Iterator<Volume> iterator() { + return list.iterator(); + } + +} diff --git a/heat-client/src/main/java/com/woorea/openstack/heat/Heat.java b/heat-client/src/main/java/com/woorea/openstack/heat/Heat.java index 35317da..e12f9f7 100644 --- a/heat-client/src/main/java/com/woorea/openstack/heat/Heat.java +++ b/heat-client/src/main/java/com/woorea/openstack/heat/Heat.java @@ -18,6 +18,7 @@ package com.woorea.openstack.heat; import com.woorea.openstack.base.client.OpenStackClient; import com.woorea.openstack.base.client.OpenStackClientConnector; +import com.woorea.openstack.heat.model.Events; /** * Reference: http://api.openstack.org/api-ref-orchestration.html @@ -26,11 +27,13 @@ public class Heat extends OpenStackClient { private final StackResource stacks; private final ResourcesResource resources; + private final StackEvents events; public Heat(String endpoint, OpenStackClientConnector connector) { super(endpoint, connector); stacks = new StackResource(this); resources = new ResourcesResource(this); + events = new StackEvents(this); } public Heat(String endpoint) { @@ -44,4 +47,8 @@ public class Heat extends OpenStackClient { public ResourcesResource getResources() { return resources; } + + public StackEvents getEvents() { + return events; + } } diff --git a/heat-client/src/main/java/com/woorea/openstack/heat/StackEvents.java b/heat-client/src/main/java/com/woorea/openstack/heat/StackEvents.java new file mode 100644 index 0000000..ca54d73 --- /dev/null +++ b/heat-client/src/main/java/com/woorea/openstack/heat/StackEvents.java @@ -0,0 +1,46 @@ +/*- + * ============LICENSE_START======================================================= + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package com.woorea.openstack.heat; + +import com.woorea.openstack.base.client.HttpMethod; +import com.woorea.openstack.base.client.OpenStackClient; +import com.woorea.openstack.base.client.OpenStackRequest; +import com.woorea.openstack.heat.model.Events; + +/** + * v1/{tenant_id}/stacks/{stack_name}/{stack_id}/events + */ +public class StackEvents { + private final OpenStackClient client; + + public StackEvents(OpenStackClient client) { + this.client = client; + } + + public ListEvents listEvents(String name, String id) { + return new ListEvents(name, id); + } + + /** + * v1/{tenant_id}/stacks/{stack_name}/resources + */ + public class ListEvents extends OpenStackRequest<Events> { + public ListEvents(String name, String id) { + super(client, HttpMethod.GET, "/stacks/" + name + "/" + id + "/events", null, Events.class); + } + } +} diff --git a/heat-model/src/main/java/com/woorea/openstack/heat/model/Event.java b/heat-model/src/main/java/com/woorea/openstack/heat/model/Event.java new file mode 100644 index 0000000..8abcdd5 --- /dev/null +++ b/heat-model/src/main/java/com/woorea/openstack/heat/model/Event.java @@ -0,0 +1,127 @@ + +package com.woorea.openstack.heat.model; + +import java.util.List; +/*- + * ============LICENSE_START======================================================= + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({ "event_time", "id", "links", "logical_resource_id", "physical_resource_id", "resource_name", + "resource_status", "resource_status_reason" }) +public class Event { + + @JsonProperty("event_time") + private String eventTime; + @JsonProperty("id") + private String id; + @JsonProperty("links") + private List<Link> links = null; + @JsonProperty("logical_resource_id") + private String logicalResourceId; + @JsonProperty("physical_resource_id") + private Object physicalResourceId; + @JsonProperty("resource_name") + private String resourceName; + @JsonProperty("resource_status") + private String resourceStatus; + @JsonProperty("resource_status_reason") + private String resourceStatusReason; + + @JsonProperty("event_time") + public String getEventTime() { + return eventTime; + } + + @JsonProperty("event_time") + public void setEventTime(String eventTime) { + this.eventTime = eventTime; + } + + @JsonProperty("id") + public String getId() { + return id; + } + + @JsonProperty("id") + public void setId(String id) { + this.id = id; + } + + @JsonProperty("links") + public List<Link> getLinks() { + return links; + } + + @JsonProperty("links") + public void setLinks(List<Link> links) { + this.links = links; + } + + @JsonProperty("logical_resource_id") + public String getLogicalResourceId() { + return logicalResourceId; + } + + @JsonProperty("logical_resource_id") + public void setLogicalResourceId(String logicalResourceId) { + this.logicalResourceId = logicalResourceId; + } + + @JsonProperty("physical_resource_id") + public Object getPhysicalResourceId() { + return physicalResourceId; + } + + @JsonProperty("physical_resource_id") + public void setPhysicalResourceId(Object physicalResourceId) { + this.physicalResourceId = physicalResourceId; + } + + @JsonProperty("resource_name") + public String getResourceName() { + return resourceName; + } + + @JsonProperty("resource_name") + public void setResourceName(String resourceName) { + this.resourceName = resourceName; + } + + @JsonProperty("resource_status") + public String getResourceStatus() { + return resourceStatus; + } + + @JsonProperty("resource_status") + public void setResourceStatus(String resourceStatus) { + this.resourceStatus = resourceStatus; + } + + @JsonProperty("resource_status_reason") + public String getResourceStatusReason() { + return resourceStatusReason; + } + + @JsonProperty("resource_status_reason") + public void setResourceStatusReason(String resourceStatusReason) { + this.resourceStatusReason = resourceStatusReason; + } + +} diff --git a/heat-model/src/main/java/com/woorea/openstack/heat/model/Events.java b/heat-model/src/main/java/com/woorea/openstack/heat/model/Events.java new file mode 100644 index 0000000..ca4fdff --- /dev/null +++ b/heat-model/src/main/java/com/woorea/openstack/heat/model/Events.java @@ -0,0 +1,49 @@ +/*- + * ============LICENSE_START======================================================= + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package com.woorea.openstack.heat.model; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonProperty; + + + +public class Events implements Iterable<Event>, Serializable { + + /** + * + */ + private static final long serialVersionUID = 3598543745379474704L; + + @JsonProperty("events") + private List<Event> events = new ArrayList<>(); + + public List<Event> getEvents() { + return events; + } + + @Override + public Iterator<Event> iterator() { + return events.iterator(); + } + + + +} diff --git a/heat-model/src/main/java/com/woorea/openstack/heat/model/Resources.java b/heat-model/src/main/java/com/woorea/openstack/heat/model/Resources.java index dd2b935..db99f04 100644 --- a/heat-model/src/main/java/com/woorea/openstack/heat/model/Resources.java +++ b/heat-model/src/main/java/com/woorea/openstack/heat/model/Resources.java @@ -21,6 +21,8 @@ import java.util.Iterator; import java.util.List; import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; + public class Resources implements Iterable<Resource>, Serializable { @JsonProperty("resources") diff --git a/openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackRequest.java b/openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackRequest.java index 3374a10..07b6f70 100644 --- a/openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackRequest.java +++ b/openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackRequest.java @@ -24,136 +24,138 @@ import java.util.ArrayList; import java.util.Map; public class OpenStackRequest<R> { - - private OpenStackClient client; - - private String endpoint; - - private HttpMethod method; - - private StringBuilder path = new StringBuilder(); - - private Map<String, List<Object>> headers = new HashMap<>(); - - private Entity<?> entity; - - private Class<R> returnType; - - public OpenStackRequest() { - - } - - public OpenStackRequest(OpenStackClient client, HttpMethod method, CharSequence path, Entity<?> entity, Class<R> returnType) { - this.client = client; - this.method = method; - this.path = new StringBuilder(path); - this.entity = entity; - this.returnType = returnType; - header("Accept", "application/json"); - } - - - public OpenStackRequest<R> endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - public String endpoint() { - return endpoint; - } - - public OpenStackRequest<R> method(HttpMethod method) { - this.method = method; - return this; - } - - public HttpMethod method() { - return method; - } - - public OpenStackRequest<R> path(String path) { - this.path.append(path); - return this; - } - - public String path() { - return path.toString(); - } - - public OpenStackRequest<R> header(String name, Object value) { - if(value != null) { - headers.put(name, Arrays.asList(value)); - } - return this; - } - - public Map<String, List<Object>> headers() { - return headers; - } - - public <T> Entity<T> entity(T entity, String contentType) { - return new Entity<>(entity, contentType); - } - - public Entity<?> entity() { - return entity; - } - - public <T> Entity<T> json(T entity) { - return entity(entity, "application/json"); - } - - public void returnType(Class<R> returnType) { - this.returnType = returnType; - } - - public Class<R> returnType() { - return returnType; - } - - public R execute() { - return client.execute(this); - } - - public OpenStackResponse request() { - return client.request(this); - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "OpenStackRequest [endpoint=" + endpoint + ", method=" + method - + ", path=" + path + ", headers=" + headers + ", entity=" - + entity + ", returnType=" + returnType + "]"; - } - - private Map<String, List<Object> > queryParams = new LinkedHashMap<>(); - - public Map<String, List<Object> > queryParams() { - return queryParams; - } - - public OpenStackRequest<R> queryParam(String key, Object value) { - if (queryParams.containsKey(key)) { - List<Object> values = queryParams.get(key); - values.add(value); - } else { - List<Object> values = new ArrayList<>(); - values.add(value); - queryParams.put(key, values); - } - - return this; - } - - protected static String buildPath(String ... elements) { - StringBuilder stringBuilder = new StringBuilder(); - for (String element : elements) { - stringBuilder.append(element); - } - - return stringBuilder.toString(); - } + + private OpenStackClient client; + + private String endpoint; + + private HttpMethod method; + + private StringBuilder path = new StringBuilder(); + + private Map<String, List<Object>> headers = new HashMap<>(); + + private Entity<?> entity; + + private Class<R> returnType; + + public OpenStackRequest() { + + } + + public OpenStackRequest(OpenStackClient client, HttpMethod method, CharSequence path, Entity<?> entity, + Class<R> returnType) { + this.client = client; + this.method = method; + this.path = new StringBuilder(path); + this.entity = entity; + this.returnType = returnType; + header("Accept", "application/json"); + } + + public OpenStackRequest<R> endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + public String endpoint() { + return endpoint; + } + + public OpenStackRequest<R> method(HttpMethod method) { + this.method = method; + return this; + } + + public HttpMethod method() { + return method; + } + + public OpenStackRequest<R> path(String path) { + this.path.append(path); + return this; + } + + public String path() { + return path.toString(); + } + + public OpenStackRequest<R> header(String name, Object value) { + if (value != null) { + headers.put(name, Arrays.asList(value)); + } + return this; + } + + public Map<String, List<Object>> headers() { + return headers; + } + + public <T> Entity<T> entity(T entity, String contentType) { + return new Entity<>(entity, contentType); + } + + public Entity<?> entity() { + return entity; + } + + public <T> Entity<T> json(T entity) { + return entity(entity, "application/json"); + } + + public void returnType(Class<R> returnType) { + this.returnType = returnType; + } + + public Class<R> returnType() { + return returnType; + } + + public R execute() { + return client.execute(this); + } + + public OpenStackResponse request() { + return client.request(this); + } + + /* + * (non-Javadoc) + * + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "OpenStackRequest [endpoint=" + endpoint + ", method=" + method + ", path=" + path + ", headers=" + + headers + ", entity=" + entity + ", returnType=" + returnType + "]"; + } + + private Map<String, List<Object>> queryParams = new LinkedHashMap<>(); + + public Map<String, List<Object>> queryParams() { + return queryParams; + } + + public OpenStackRequest<R> queryParam(String key, Object value) { + if (value != null) { + if (queryParams.containsKey(key)) { + List<Object> values = queryParams.get(key); + values.add(value); + } else { + List<Object> values = new ArrayList<>(); + values.add(value); + queryParams.put(key, values); + } + } + return this; + } + + protected static String buildPath(String... elements) { + StringBuilder stringBuilder = new StringBuilder(); + for (String element : elements) { + stringBuilder.append(element); + } + + return stringBuilder.toString(); + } } @@ -55,6 +55,8 @@ <module>ceilometer-client</module> <module>openstack-client-connectors</module> <module>heat-model</module> + <module>cinder-model</module> + <module>cinder-client</module> </modules> <licenses> <license> diff --git a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Network.java b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Network.java index 95fb6a4..bec7dbf 100644 --- a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Network.java +++ b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Network.java @@ -74,7 +74,7 @@ public class Network implements Serializable { /** * @return the status */ - @JsonIgnore + public String getStatus() { return status; } @@ -91,7 +91,7 @@ public class Network implements Serializable { /** * @return the subnets */ - @JsonIgnore + public List<String> getSubnets() { return subnets; } @@ -125,7 +125,7 @@ public class Network implements Serializable { * @deprecated */ @Deprecated - @JsonIgnore + public String getProviderPhyNet() { return getProviderPhysicalNetwork(); } @@ -136,7 +136,7 @@ public class Network implements Serializable { * @deprecated */ @Deprecated - @JsonIgnore + public void setProviderPhyNet(String providerPhyNet) { setProviderPhysicalNetwork(providerPhyNet); } @@ -144,7 +144,7 @@ public class Network implements Serializable { /** * @return the adminStateUp */ - @JsonIgnore + public boolean isAdminStateUp() { return adminStateUp; } @@ -181,7 +181,7 @@ public class Network implements Serializable { * @deprecated */ @Deprecated - @JsonIgnore + public String getNetType() { return getProviderNetworkType(); } @@ -192,7 +192,7 @@ public class Network implements Serializable { * @deprecated */ @Deprecated - @JsonIgnore + public void setNetType(String netType) { setProviderNetworkType(netType); } @@ -215,7 +215,7 @@ public class Network implements Serializable { /** * @return the id */ - @JsonIgnore + public String getId() { return id; } @@ -249,7 +249,7 @@ public class Network implements Serializable { * @deprecated */ @Deprecated - @JsonIgnore + public String getProviderSegID() { return getProviderSegmentationId() == null ? null : Integer.toString(getProviderSegmentationId()); } @@ -260,7 +260,7 @@ public class Network implements Serializable { * @deprecated */ @Deprecated - @JsonIgnore + public void setProviderSegID(String providerSegID) { setProviderSegmentationId(providerSegID == null ? null : Integer.parseInt(providerSegID)); } @@ -302,7 +302,7 @@ public class Network implements Serializable { */ public enum NetworkType { BASIC, PROVIDER, MULTI_PROVIDER }; - @JsonIgnore + public NetworkType getNetworkType () { if (segments != null) return NetworkType.MULTI_PROVIDER; |