Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,16 +1,8 @@
package org.openstack4j.api.image.v2;

import org.openstack4j.api.AbstractTest;
import org.openstack4j.api.Builders;
import org.openstack4j.model.common.ActionResponse;
import org.openstack4j.model.common.Payload;
import org.openstack4j.model.common.Payloads;
import org.openstack4j.model.image.v2.ContainerFormat;
import org.openstack4j.model.image.v2.DiskFormat;
import org.openstack4j.model.image.v2.Image;
import org.openstack4j.model.image.v2.Member;
import org.openstack4j.model.image.v2.Task;
import org.testng.annotations.Test;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertNotNull;
import static org.testng.Assert.assertTrue;

import java.io.ByteArrayInputStream;
import java.io.File;
Expand All @@ -23,9 +15,17 @@
import java.util.List;
import java.util.Map;

import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertNotNull;
import static org.testng.Assert.assertTrue;
import org.openstack4j.api.AbstractTest;
import org.openstack4j.api.Builders;
import org.openstack4j.model.common.ActionResponse;
import org.openstack4j.model.common.Payload;
import org.openstack4j.model.common.Payloads;
import org.openstack4j.model.image.v2.ContainerFormat;
import org.openstack4j.model.image.v2.DiskFormat;
import org.openstack4j.model.image.v2.Image;
import org.openstack4j.model.image.v2.Member;
import org.openstack4j.model.image.v2.Task;
import org.testng.annotations.Test;

/**
* @author emjburns
Expand Down Expand Up @@ -77,8 +77,8 @@ public void testCreateImage() throws IOException {
String name = "amphora-x64-haproxy";
ContainerFormat cf = ContainerFormat.BARE;
DiskFormat df = DiskFormat.QCOW2;
Integer mindisk = 0;
Integer minram = 0;
Long mindisk = 0L;
Long minram = 0L;
Image.ImageVisibility vis = Image.ImageVisibility.PUBLIC;
Image im = Builders.imageV2()
.id(id)
Expand Down
17 changes: 9 additions & 8 deletions core/src/main/java/org/openstack4j/model/image/v2/Image.java
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
package org.openstack4j.model.image.v2;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import java.util.Date;
import java.util.List;

import org.openstack4j.common.Buildable;
import org.openstack4j.model.common.BasicResource;
import org.openstack4j.model.image.v2.builder.ImageBuilder;

import java.util.Date;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;

/**
* A Glance v2.0-2.3 Image
Expand Down Expand Up @@ -141,7 +142,7 @@ public String value() {
/**
* @return the minimum disk size in GB that is required to boot the image
*/
Integer getMinDisk();
Long getMinDisk();

/**
* @return image protection for deletion
Expand All @@ -157,7 +158,7 @@ public String value() {
/**
* @return the minimum amount of RAM in MB that is required to boot the image
*/
Integer getMinRam();
Long getMinRam();

/**
* @return hash that is used over the image data
Expand All @@ -179,7 +180,7 @@ public String value() {
/**
* @return the size of the image data, in bytes
*/
Integer getSize();
Long getSize();

/**
* @return A list of URLs to access the image file in external store.
Expand Down Expand Up @@ -248,5 +249,5 @@ public String value() {
/**
* @return Virtual size of image in bytes (READ-ONLY)
*/
Integer getVirtualSize();
Long getVirtualSize();
}
279 changes: 140 additions & 139 deletions core/src/main/java/org/openstack4j/model/image/v2/Task.java
Original file line number Diff line number Diff line change
@@ -1,139 +1,140 @@
package org.openstack4j.model.image.v2;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import org.openstack4j.common.Buildable;
import org.openstack4j.model.ModelEntity;
import org.openstack4j.model.image.v2.builder.TaskBuilder;

import java.util.Date;
import java.util.Map;

/**
* An object representing a Glance V2 task.
* Tasks offer end users a front end to long
* running asynchronous operations.
* @author emjburns
*/
public interface Task extends ModelEntity, Buildable<TaskBuilder> {

public enum TaskStatus {
/**
*The task identifier has been reserved for a task in the Glance.
* No processing has begun on it yet.
*/
PENDING,
/**
* The task has been picked up by the underlying executor and is
* being run using the backend Glance execution logic for that task type.
*/
PROCESSING,
/**
* Denotes that the task has had a successful run within Glance.
* The result field of the task shows more details about the outcome.
*/
SUCCESS,
/**
* Denotes that an error occurred during the execution of the task and it cannot continue processing.
* The message field of the task shows what the error was.
*/
FAILURE,
/**
* Task status is not a known value.
*/
UNKNOWN;

@JsonCreator
public static TaskStatus value(String v)
{
if (v == null) return UNKNOWN;
try {
return valueOf(v.toUpperCase());
} catch (IllegalArgumentException e) {
return UNKNOWN;
}
}

@JsonValue
public String value() {
return name().toLowerCase();
}
}

/**
* Date and time task was created.
* @return
*/
Date getCreatedAt();

/**
* The date and time the task is subject to removal.
* The result of the task will still exist.
* @return
*/
Date getExpiresAt();

/**
* The date and time the task was updated.
* @return
*/
Date getUpdatedAt();

/**
* Identifier for the task, a UUID.
* @return
*/
String getId();

/**
* A JSON object specifying the input parameters of the task.
* @return
*/
Map<String, Object> getInput();

/**
* Human readable text, possibly and empty string, usually
* displayed in an error situation to provide more information
* about what has occurred.
* @return
*/
String getMessage();

/**
* Identifier for owner of the task, usually tenant ID.
* @return
*/
String getOwner();

/**
* A JSON object specifying information about the ultimate
* outcome of the task.
* @return
*/
String getResult();

/**
* The URI for the schema describing an image task.
* @return
*/
String getSchema();

/**
* The status of the task.
* @return taskStatus
*/
TaskStatus getStatus();

/**
* The type of task represented by this content.
* @return
*/
String getType();

/**
* A URI for this task.
* @return
*/
String getSelf();

}
package org.openstack4j.model.image.v2;

import java.util.Date;
import java.util.Map;

import org.openstack4j.common.Buildable;
import org.openstack4j.model.ModelEntity;
import org.openstack4j.model.image.v2.builder.TaskBuilder;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;

/**
* An object representing a Glance V2 task.
* Tasks offer end users a front end to long
* running asynchronous operations.
* @author emjburns
*/
public interface Task extends ModelEntity, Buildable<TaskBuilder> {

public enum TaskStatus {
/**
*The task identifier has been reserved for a task in the Glance.
* No processing has begun on it yet.
*/
PENDING,
/**
* The task has been picked up by the underlying executor and is
* being run using the backend Glance execution logic for that task type.
*/
PROCESSING,
/**
* Denotes that the task has had a successful run within Glance.
* The result field of the task shows more details about the outcome.
*/
SUCCESS,
/**
* Denotes that an error occurred during the execution of the task and it cannot continue processing.
* The message field of the task shows what the error was.
*/
FAILURE,
/**
* Task status is not a known value.
*/
UNKNOWN;

@JsonCreator
public static TaskStatus value(String v)
{
if (v == null) return UNKNOWN;
try {
return valueOf(v.toUpperCase());
} catch (IllegalArgumentException e) {
return UNKNOWN;
}
}

@JsonValue
public String value() {
return name().toLowerCase();
}
}

/**
* Date and time task was created.
* @return
*/
Date getCreatedAt();

/**
* The date and time the task is subject to removal.
* The result of the task will still exist.
* @return
*/
Date getExpiresAt();

/**
* The date and time the task was updated.
* @return
*/
Date getUpdatedAt();

/**
* Identifier for the task, a UUID.
* @return
*/
String getId();

/**
* A JSON object specifying the input parameters of the task.
* @return
*/
Map<String, Object> getInput();

/**
* Human readable text, possibly and empty string, usually
* displayed in an error situation to provide more information
* about what has occurred.
* @return
*/
String getMessage();

/**
* Identifier for owner of the task, usually tenant ID.
* @return
*/
String getOwner();

/**
* A JSON object specifying information about the ultimate
* outcome of the task.
* @return
*/
Map<String, String> getResult();

/**
* The URI for the schema describing an image task.
* @return
*/
String getSchema();

/**
* The status of the task.
* @return taskStatus
*/
TaskStatus getStatus();

/**
* The type of task represented by this content.
* @return
*/
String getType();

/**
* A URI for this task.
* @return
*/
String getSelf();

}
Loading