You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jclouds.apache.org by na...@apache.org on 2013/11/14 12:23:04 UTC
[01/13] Fix code style of the cloudsigma2 provider.
Updated Branches:
refs/heads/master d9717a432 -> 0d70c84a3
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0d70c84a/cloudsigma2/src/test/java/org/jclouds/cloudsigma2/functions/ServerInfoToJsonTest.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/test/java/org/jclouds/cloudsigma2/functions/ServerInfoToJsonTest.java b/cloudsigma2/src/test/java/org/jclouds/cloudsigma2/functions/ServerInfoToJsonTest.java
index 774260e..c1453fe 100644
--- a/cloudsigma2/src/test/java/org/jclouds/cloudsigma2/functions/ServerInfoToJsonTest.java
+++ b/cloudsigma2/src/test/java/org/jclouds/cloudsigma2/functions/ServerInfoToJsonTest.java
@@ -38,120 +38,120 @@ import java.util.Map;
@Test(groups = "unit")
public class ServerInfoToJsonTest {
- private final static ServerInfoToJson SERVER_INFO_TO_JSON = Guice.createInjector().getInstance(ServerInfoToJson.class);
-
- private ServerInfo input;
- private JsonObject expected = new JsonObject();
-
- @BeforeMethod
- public void setUp() throws Exception {
- Owner owner = new Owner.Builder()
- .resourceUri(new URI("/api/2.0/user/5b4a69a3-8e78-4c45-a8ba-8b13f0895e23/"))
- .uuid("5b4a69a3-8e78-4c45-a8ba-8b13f0895e23")
- .build();
-
- Map<String, String> meta = new HashMap<String, String>();
- meta.put("description", "A full server with description");
-
- input = new ServerInfo.Builder()
- .cpu(1000)
- .cpusInsteadOfCores(false)
- .drives(ImmutableList.of(
- new ServerDrive.Builder()
- .deviceChannel("0:0")
- .deviceEmulationType(DeviceEmulationType.IDE)
- .drive(new Drive.Builder()
- .resourceUri(new URI("/api/2.0/drives/ae78e68c-9daa-4471-8878-0bb87fa80260/"))
- .uuid("ae78e68c-9daa-4471-8878-0bb87fa80260")
- .build())
- .build()
- , new ServerDrive.Builder()
- .bootOrder(1)
+ private final static ServerInfoToJson SERVER_INFO_TO_JSON = Guice.createInjector().getInstance(ServerInfoToJson.class);
+
+ private ServerInfo input;
+ private JsonObject expected = new JsonObject();
+
+ @BeforeMethod
+ public void setUp() throws Exception {
+ Owner owner = new Owner.Builder()
+ .resourceUri(new URI("/api/2.0/user/5b4a69a3-8e78-4c45-a8ba-8b13f0895e23/"))
+ .uuid("5b4a69a3-8e78-4c45-a8ba-8b13f0895e23")
+ .build();
+
+ Map<String, String> meta = new HashMap<String, String>();
+ meta.put("description", "A full server with description");
+
+ input = new ServerInfo.Builder()
+ .cpu(1000)
+ .cpusInsteadOfCores(false)
+ .drives(ImmutableList.of(
+ new ServerDrive.Builder()
.deviceChannel("0:0")
- .deviceEmulationType(DeviceEmulationType.VIRTIO)
+ .deviceEmulationType(DeviceEmulationType.IDE)
.drive(new Drive.Builder()
- .resourceUri(new URI("/api/2.0/drives/22826af4-d6c8-4d39-bd41-9cea86df2976/"))
- .uuid("22826af4-d6c8-4d39-bd41-9cea86df2976")
- .build())
+ .resourceUri(new URI("/api/2.0/drives/ae78e68c-9daa-4471-8878-0bb87fa80260/"))
+ .uuid("ae78e68c-9daa-4471-8878-0bb87fa80260")
+ .build())
.build()
- ))
- .enableNuma(false)
- .hvRelaxed(false)
- .hvTsc(false)
- .memory(new BigInteger("268435456"))
- .meta(meta)
- .name("test_acc_full_server")
- .nics(ImmutableList.of(
- new NIC.Builder()
- .firewallPolicy(null)
- .ipV4Configuration(new IPConfiguration(IPConfigurationType.DHCP, null))
- .ipV6Configuration(null)
- .mac("22:a7:a0:0d:43:48")
- .model(Model.VIRTIO)
- .runtime(null)
- .vlan(null)
- .build()
- ))
- .owner(owner)
- .requirements(new ArrayList<String>())
- .resourceUri(new URI("/api/2.0/servers/a19a425f-9e92-42f6-89fb-6361203071bb/"))
- .runtime(null)
- .smp(1)
- .status(ServerStatus.STOPPED)
- .tags(ImmutableList.of("tag_uuid_1", "tag_uuid_2"))
- .uuid("a19a425f-9e92-42f6-89fb-6361203071bb")
- .vncPassword("tester")
- .build();
-
- expected.addProperty("name", "test_acc_full_server");
- expected.addProperty("cpu", 1000);
- expected.addProperty("mem", "268435456");
-
- JsonObject metaObject = new JsonObject();
- metaObject.addProperty("description", "A full server with description");
-
- expected.add("meta", metaObject);
- expected.add("requirements", new JsonArray());
-
- JsonArray tagsArray = new JsonArray();
- tagsArray.add(new JsonPrimitive("tag_uuid_1"));
- tagsArray.add(new JsonPrimitive("tag_uuid_2"));
- expected.add("tags", tagsArray);
- expected.addProperty("vnc_password", "tester");
-
- JsonObject nicJson = new JsonObject();
-
- JsonObject ipv4ConfObject = new JsonObject();
- ipv4ConfObject.addProperty("conf", "dhcp");
- nicJson.add("ip_v4_conf", ipv4ConfObject);
- nicJson.addProperty("model", "virtio");
- nicJson.addProperty("mac", "22:a7:a0:0d:43:48");
-
- JsonArray nicsArray = new JsonArray();
- nicsArray.add(nicJson);
-
- expected.add("nics", nicsArray);
-
- JsonArray drivesArray = new JsonArray();
- JsonObject driveJson1 = new JsonObject();
- driveJson1.addProperty("boot_order", 0);
- driveJson1.addProperty("dev_channel", "0:0");
- driveJson1.addProperty("device", "ide");
- driveJson1.addProperty("drive", "ae78e68c-9daa-4471-8878-0bb87fa80260");
-
- JsonObject driveJson2 = new JsonObject();
- driveJson2.addProperty("boot_order", 1);
- driveJson2.addProperty("dev_channel", "0:0");
- driveJson2.addProperty("device", "virtio");
- driveJson2.addProperty("drive", "22826af4-d6c8-4d39-bd41-9cea86df2976");
-
- drivesArray.add(driveJson1);
- drivesArray.add(driveJson2);
-
- expected.add("drives", drivesArray);
- }
-
- public void test(){
- Assert.assertEquals(SERVER_INFO_TO_JSON.apply(input), expected);
- }
+ , new ServerDrive.Builder()
+ .bootOrder(1)
+ .deviceChannel("0:0")
+ .deviceEmulationType(DeviceEmulationType.VIRTIO)
+ .drive(new Drive.Builder()
+ .resourceUri(new URI("/api/2.0/drives/22826af4-d6c8-4d39-bd41-9cea86df2976/"))
+ .uuid("22826af4-d6c8-4d39-bd41-9cea86df2976")
+ .build())
+ .build()
+ ))
+ .enableNuma(false)
+ .hvRelaxed(false)
+ .hvTsc(false)
+ .memory(new BigInteger("268435456"))
+ .meta(meta)
+ .name("test_acc_full_server")
+ .nics(ImmutableList.of(
+ new NIC.Builder()
+ .firewallPolicy(null)
+ .ipV4Configuration(new IPConfiguration(IPConfigurationType.DHCP, null))
+ .ipV6Configuration(null)
+ .mac("22:a7:a0:0d:43:48")
+ .model(Model.VIRTIO)
+ .runtime(null)
+ .vlan(null)
+ .build()
+ ))
+ .owner(owner)
+ .requirements(new ArrayList<String>())
+ .resourceUri(new URI("/api/2.0/servers/a19a425f-9e92-42f6-89fb-6361203071bb/"))
+ .runtime(null)
+ .smp(1)
+ .status(ServerStatus.STOPPED)
+ .tags(ImmutableList.of("tag_uuid_1", "tag_uuid_2"))
+ .uuid("a19a425f-9e92-42f6-89fb-6361203071bb")
+ .vncPassword("tester")
+ .build();
+
+ expected.addProperty("name", "test_acc_full_server");
+ expected.addProperty("cpu", 1000);
+ expected.addProperty("mem", "268435456");
+
+ JsonObject metaObject = new JsonObject();
+ metaObject.addProperty("description", "A full server with description");
+
+ expected.add("meta", metaObject);
+ expected.add("requirements", new JsonArray());
+
+ JsonArray tagsArray = new JsonArray();
+ tagsArray.add(new JsonPrimitive("tag_uuid_1"));
+ tagsArray.add(new JsonPrimitive("tag_uuid_2"));
+ expected.add("tags", tagsArray);
+ expected.addProperty("vnc_password", "tester");
+
+ JsonObject nicJson = new JsonObject();
+
+ JsonObject ipv4ConfObject = new JsonObject();
+ ipv4ConfObject.addProperty("conf", "dhcp");
+ nicJson.add("ip_v4_conf", ipv4ConfObject);
+ nicJson.addProperty("model", "virtio");
+ nicJson.addProperty("mac", "22:a7:a0:0d:43:48");
+
+ JsonArray nicsArray = new JsonArray();
+ nicsArray.add(nicJson);
+
+ expected.add("nics", nicsArray);
+
+ JsonArray drivesArray = new JsonArray();
+ JsonObject driveJson1 = new JsonObject();
+ driveJson1.addProperty("boot_order", 0);
+ driveJson1.addProperty("dev_channel", "0:0");
+ driveJson1.addProperty("device", "ide");
+ driveJson1.addProperty("drive", "ae78e68c-9daa-4471-8878-0bb87fa80260");
+
+ JsonObject driveJson2 = new JsonObject();
+ driveJson2.addProperty("boot_order", 1);
+ driveJson2.addProperty("dev_channel", "0:0");
+ driveJson2.addProperty("device", "virtio");
+ driveJson2.addProperty("drive", "22826af4-d6c8-4d39-bd41-9cea86df2976");
+
+ drivesArray.add(driveJson1);
+ drivesArray.add(driveJson2);
+
+ expected.add("drives", drivesArray);
+ }
+
+ public void test() {
+ Assert.assertEquals(SERVER_INFO_TO_JSON.apply(input), expected);
+ }
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0d70c84a/cloudsigma2/src/test/java/org/jclouds/cloudsigma2/functions/TagToJsonTest.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/test/java/org/jclouds/cloudsigma2/functions/TagToJsonTest.java b/cloudsigma2/src/test/java/org/jclouds/cloudsigma2/functions/TagToJsonTest.java
index 5526adf..91d315f 100644
--- a/cloudsigma2/src/test/java/org/jclouds/cloudsigma2/functions/TagToJsonTest.java
+++ b/cloudsigma2/src/test/java/org/jclouds/cloudsigma2/functions/TagToJsonTest.java
@@ -39,61 +39,61 @@ import java.util.Map;
@Test(groups = "unit")
public class TagToJsonTest {
- private static final TagToJson TAG_TO_JSON = Guice.createInjector().getInstance(TagToJson.class);
+ private static final TagToJson TAG_TO_JSON = Guice.createInjector().getInstance(TagToJson.class);
- private Tag input;
- private JsonObject expected;
+ private Tag input;
+ private JsonObject expected;
- @BeforeMethod
- public void setUp() throws Exception {
- Owner owner = new Owner.Builder()
- .resourceUri(new URI("/api/2.0/user/5b4a69a3-8e78-4c45-a8ba-8b13f0895e23/"))
- .uuid("5b4a69a3-8e78-4c45-a8ba-8b13f0895e23")
- .build();
+ @BeforeMethod
+ public void setUp() throws Exception {
+ Owner owner = new Owner.Builder()
+ .resourceUri(new URI("/api/2.0/user/5b4a69a3-8e78-4c45-a8ba-8b13f0895e23/"))
+ .uuid("5b4a69a3-8e78-4c45-a8ba-8b13f0895e23")
+ .build();
- Map<String, String> meta = new HashMap<String, String>();
- meta.put("description", "test tag");
+ Map<String, String> meta = new HashMap<String, String>();
+ meta.put("description", "test tag");
- input = new Tag.Builder()
- .meta(meta)
- .name("TagCreatedWithResource")
- .resources(ImmutableList.of(
- new TagResource.Builder()
- .uuid("96537817-f4b6-496b-a861-e74192d3ccb0")
- .build()
- , new TagResource.Builder()
- .uuid("61bcc398-c034-42f1-81c9-f6d7f62c4ea0")
- .build()
- , new TagResource.Builder()
- .uuid("3610d935-514a-4552-acf3-a40dd0a5f961")
- .build()
- , new TagResource.Builder()
- .resourceType(TagResourceType.IPS)
- .resourceUri(new URI("/api/2.0/ips/185.12.6.183/"))
- .uuid("185.12.6.183")
- .owner(owner)
- .build()
- ))
- .build();
+ input = new Tag.Builder()
+ .meta(meta)
+ .name("TagCreatedWithResource")
+ .resources(ImmutableList.of(
+ new TagResource.Builder()
+ .uuid("96537817-f4b6-496b-a861-e74192d3ccb0")
+ .build()
+ , new TagResource.Builder()
+ .uuid("61bcc398-c034-42f1-81c9-f6d7f62c4ea0")
+ .build()
+ , new TagResource.Builder()
+ .uuid("3610d935-514a-4552-acf3-a40dd0a5f961")
+ .build()
+ , new TagResource.Builder()
+ .resourceType(TagResourceType.IPS)
+ .resourceUri(new URI("/api/2.0/ips/185.12.6.183/"))
+ .uuid("185.12.6.183")
+ .owner(owner)
+ .build()
+ ))
+ .build();
- expected = new JsonObject();
+ expected = new JsonObject();
- JsonObject metaObject = new JsonObject();
- metaObject.addProperty("description", "test tag");
+ JsonObject metaObject = new JsonObject();
+ metaObject.addProperty("description", "test tag");
- expected.add("meta", metaObject);
- expected.addProperty("name", "TagCreatedWithResource");
+ expected.add("meta", metaObject);
+ expected.addProperty("name", "TagCreatedWithResource");
- JsonArray resourcesArray = new JsonArray();
- resourcesArray.add(new JsonPrimitive("96537817-f4b6-496b-a861-e74192d3ccb0"));
- resourcesArray.add(new JsonPrimitive("61bcc398-c034-42f1-81c9-f6d7f62c4ea0"));
- resourcesArray.add(new JsonPrimitive("3610d935-514a-4552-acf3-a40dd0a5f961"));
- resourcesArray.add(new JsonPrimitive("185.12.6.183"));
+ JsonArray resourcesArray = new JsonArray();
+ resourcesArray.add(new JsonPrimitive("96537817-f4b6-496b-a861-e74192d3ccb0"));
+ resourcesArray.add(new JsonPrimitive("61bcc398-c034-42f1-81c9-f6d7f62c4ea0"));
+ resourcesArray.add(new JsonPrimitive("3610d935-514a-4552-acf3-a40dd0a5f961"));
+ resourcesArray.add(new JsonPrimitive("185.12.6.183"));
- expected.add("resources", resourcesArray);
- }
+ expected.add("resources", resourcesArray);
+ }
- public void test(){
- Assert.assertEquals(TAG_TO_JSON.apply(input), expected);
- }
+ public void test() {
+ Assert.assertEquals(TAG_TO_JSON.apply(input), expected);
+ }
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0d70c84a/cloudsigma2/src/test/java/org/jclouds/cloudsigma2/functions/VLANInfoToJsonTest.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/test/java/org/jclouds/cloudsigma2/functions/VLANInfoToJsonTest.java b/cloudsigma2/src/test/java/org/jclouds/cloudsigma2/functions/VLANInfoToJsonTest.java
index 8a940c8..3aab795 100644
--- a/cloudsigma2/src/test/java/org/jclouds/cloudsigma2/functions/VLANInfoToJsonTest.java
+++ b/cloudsigma2/src/test/java/org/jclouds/cloudsigma2/functions/VLANInfoToJsonTest.java
@@ -40,46 +40,47 @@ import java.util.Map;
@Test(groups = "unit")
public class VLANInfoToJsonTest {
- private static final VLANInfoToJson VLAN_INFO_TO_JSON = Guice.createInjector().getInstance(VLANInfoToJson.class);
+ private static final VLANInfoToJson VLAN_INFO_TO_JSON = Guice.createInjector().getInstance(VLANInfoToJson.class);
- private VLANInfo input;
- private JsonObject expected;
- {
- Map<String, String> meta = new HashMap<String, String>();
- meta.put("description", "test vlan");
- meta.put("test_key_1", "test_value_1");
- meta.put("test_key_2", "test_value_2");
+ private VLANInfo input;
+ private JsonObject expected;
- try {
- input = new VLANInfo.Builder()
- .meta(meta)
- .resourceUri(new URI("/api/2.0/vlans/96537817-f4b6-496b-a861-e74192d3ccb0/"))
- .servers(ImmutableList.of(
- new Server.Builder()
- .uuid("81f911f9-5152-4328-8671-02543bafbd0e")
- .resourceUri(new URI("/api/2.0/servers/81f911f9-5152-4328-8671-02543bafbd0e/"))
- .build()
- , new Server.Builder()
- .uuid("19163e1a-a6d6-4e73-8087-157dd302c373")
- .resourceUri(new URI("/api/2.0/servers/19163e1a-a6d6-4e73-8087-157dd302c373/"))
- .build()
- ))
- .subscription(new Subscription.Builder()
- .id("7272")
- .resourceUri(new URI("/api/2.0/subscriptions/7272/"))
- .build())
- .tags(new ArrayList<Tag>())
- .uuid("96537817-f4b6-496b-a861-e74192d3ccb0")
- .build();
- } catch (URISyntaxException e) {
- e.printStackTrace();
- }
+ {
+ Map<String, String> meta = new HashMap<String, String>();
+ meta.put("description", "test vlan");
+ meta.put("test_key_1", "test_value_1");
+ meta.put("test_key_2", "test_value_2");
- expected = new JsonObject();
- expected.add("meta", new JsonParser().parse(new Gson().toJson(meta)));
- }
+ try {
+ input = new VLANInfo.Builder()
+ .meta(meta)
+ .resourceUri(new URI("/api/2.0/vlans/96537817-f4b6-496b-a861-e74192d3ccb0/"))
+ .servers(ImmutableList.of(
+ new Server.Builder()
+ .uuid("81f911f9-5152-4328-8671-02543bafbd0e")
+ .resourceUri(new URI("/api/2.0/servers/81f911f9-5152-4328-8671-02543bafbd0e/"))
+ .build()
+ , new Server.Builder()
+ .uuid("19163e1a-a6d6-4e73-8087-157dd302c373")
+ .resourceUri(new URI("/api/2.0/servers/19163e1a-a6d6-4e73-8087-157dd302c373/"))
+ .build()
+ ))
+ .subscription(new Subscription.Builder()
+ .id("7272")
+ .resourceUri(new URI("/api/2.0/subscriptions/7272/"))
+ .build())
+ .tags(new ArrayList<Tag>())
+ .uuid("96537817-f4b6-496b-a861-e74192d3ccb0")
+ .build();
+ } catch (URISyntaxException e) {
+ e.printStackTrace();
+ }
- public void test(){
- Assert.assertEquals(VLAN_INFO_TO_JSON.apply(input), expected);
- }
+ expected = new JsonObject();
+ expected.add("meta", new JsonParser().parse(new Gson().toJson(meta)));
+ }
+
+ public void test() {
+ Assert.assertEquals(VLAN_INFO_TO_JSON.apply(input), expected);
+ }
}
[03/13] Fix code style of the cloudsigma2 provider.
Posted by na...@apache.org.
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0d70c84a/cloudsigma2/src/test/java/org/jclouds/cloudsigma2/CloudSigma2ApiExpectTest.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/test/java/org/jclouds/cloudsigma2/CloudSigma2ApiExpectTest.java b/cloudsigma2/src/test/java/org/jclouds/cloudsigma2/CloudSigma2ApiExpectTest.java
index 3d3b12a..65f6623 100644
--- a/cloudsigma2/src/test/java/org/jclouds/cloudsigma2/CloudSigma2ApiExpectTest.java
+++ b/cloudsigma2/src/test/java/org/jclouds/cloudsigma2/CloudSigma2ApiExpectTest.java
@@ -65,808 +65,892 @@ import static org.testng.Assert.assertNotNull;
@Test(groups = "unit")
public class CloudSigma2ApiExpectTest extends BaseRestApiExpectTest<CloudSigma2Api> {
- protected String endpoint = "https://zrh.cloudsigma.com/api/2.0/";
-
- public CloudSigma2ApiExpectTest() {
- provider = "cloudsigma2";
- }
-
- protected HttpRequest.Builder<?> getBuilder() {
- return HttpRequest.builder()
- .method("GET")
- .addHeader("Accept", MediaType.APPLICATION_JSON)
- .addHeader("Authorization", "Basic aWRlbnRpdHk6Y3JlZGVudGlhbA==");
- }
-
- protected HttpRequest.Builder<?> postBuilder() {
- return HttpRequest.builder()
- .method("POST")
- .addHeader("Accept", MediaType.APPLICATION_JSON)
- .addHeader("Authorization", "Basic aWRlbnRpdHk6Y3JlZGVudGlhbA==");
- }
-
- protected HttpRequest.Builder<?> deleteBuilder() {
- return HttpRequest.builder()
- .method("DELETE")
- .addHeader("Accept", MediaType.APPLICATION_JSON)
- .addHeader("Authorization", "Basic aWRlbnRpdHk6Y3JlZGVudGlhbA==");
- }
-
- protected HttpRequest.Builder<?> putBuilder() {
- return HttpRequest.builder()
- .method("PUT")
- .addHeader("Accept", MediaType.APPLICATION_JSON)
- .addHeader("Authorization", "Basic aWRlbnRpdHk6Y3JlZGVudGlhbA==");
- }
-
- protected HttpResponse.Builder<?> responseBuilder() {
- return HttpResponse.builder()
- .statusCode(200)
- .message("OK");
- }
-
- @Test
- public void testListDrives() throws Exception {
- CloudSigma2Api api = requestsSendResponses(
- getBuilder()
- .endpoint(endpoint + "drives/")
- .build()
- , responseBuilder()
- .payload(payloadFromResourceWithContentType("/drives.json", MediaType.APPLICATION_JSON))
- .build()
- , getBuilder()
- .endpoint(endpoint + "drives/")
- .addQueryParam("limit", "2")
- .addQueryParam("offset", "2")
- .build()
- , responseBuilder()
- .payload(payloadFromResourceWithContentType("/drives-last-page.json", MediaType.APPLICATION_JSON))
- .build());
-
- List<Drive> drives = api.listDrives().concat().toList();
-
- Assert.assertEquals(drives.size(), 3);
- Assert.assertEquals(drives.get(0).getUuid(), "92ca1450-417e-4cc1-983b-1015777e2591");
- Assert.assertEquals(drives.get(1).getUuid(), "414ad24b-ba41-47c0-9751-ef5060b6c391");
- Assert.assertEquals(drives.get(2).getUuid(), "7bc04bc5-bd09-4269-b45d-16b58d6f71b4");
- }
-
- @Test
- public void testListDrivesPaginatedCollection() throws Exception {
- CloudSigma2Api api = requestSendsResponse(
- getBuilder()
- .endpoint(endpoint + "drives/?limit=3&offset=3")
- .build()
- , responseBuilder()
- .payload(payloadFromResourceWithContentType("/drives.json", MediaType.APPLICATION_JSON))
- .build());
-
- for(Drive drive : api.listDrives(new PaginationOptions.Builder().limit(3).offset(3).build())){
- assertNotNull(drive);
- }
- }
-
- @Test
- public void testListDrivesInfo() throws Exception {
- CloudSigma2Api api = requestsSendResponses(
- getBuilder()
- .endpoint(endpoint + "drives/detail/")
- .build()
- , responseBuilder()
- .payload(payloadFromResourceWithContentType("/drives-detail-first-page.json", MediaType.APPLICATION_JSON))
- .build()
- , getBuilder()
- .endpoint(endpoint + "drives/detail/")
- .addQueryParam("limit", "2")
- .addQueryParam("offset", "2")
- .build()
- , responseBuilder()
- .payload(payloadFromResourceWithContentType("/drives-detail-last-page.json", MediaType.APPLICATION_JSON))
- .build());
-
- List<DriveInfo> drives = api.listDrivesInfo().concat().toList();
-
- Assert.assertEquals(drives.size(), 3);
- Assert.assertEquals(drives.get(0).getUuid(), "92ca1450-417e-4cc1-983b-1015777e2591");
- Assert.assertEquals(drives.get(1).getUuid(), "414ad24b-ba41-47c0-9751-ef5060b6c391");
- Assert.assertEquals(drives.get(2).getUuid(), "7bc04bc5-bd09-4269-b45d-16b58d6f71b4");
- }
-
- @Test
- public void testListDrivesInfoPaginatedCollection() throws Exception {
- CloudSigma2Api api = requestSendsResponse(
- getBuilder()
- .endpoint(endpoint + "drives/detail/?limit=3&offset=3")
- .build()
- , responseBuilder()
- .payload(payloadFromResourceWithContentType("/drives-detail.json", MediaType.APPLICATION_JSON))
- .build());
-
- for(DriveInfo driveInfo : api.listDrivesInfo(new PaginationOptions.Builder().limit(3).offset(3).build())){
- assertNotNull(driveInfo);
- }
- }
-
- @Test
- public void testGetDriveInfo() throws Exception {
- String uuid = "e96f3c63-6f50-47eb-9401-a56c5ccf6b32";
- CloudSigma2Api api = requestSendsResponse(
- getBuilder()
- .endpoint(endpoint + "drives/" + uuid + "/")
- .build()
- , responseBuilder()
- .payload(payloadFromResourceWithContentType("/drives-detail.json", MediaType.APPLICATION_JSON))
- .build());
-
- DriveInfo result = api.getDriveInfo(uuid);
- assertNotNull(result);
- }
-
- @Test
- public void testCreateDrive() throws Exception {
- CloudSigma2Api api = requestSendsResponse(
- postBuilder()
- .payload(payloadFromResourceWithContentType("/drives-create-request.json", MediaType.APPLICATION_JSON))
- .endpoint(endpoint + "drives/")
- .build()
- , responseBuilder()
- .payload(payloadFromResourceWithContentType("/drives-single.json", MediaType.APPLICATION_JSON))
- .build());
-
- DriveInfo result = api.createDrive(new DriveInfo.Builder()
- .media(org.jclouds.cloudsigma2.domain.MediaType.DISK)
- .name("test_drive_0")
- .size(new BigInteger("1024000000"))
- .allowMultimount(false)
- .build());
- assertNotNull(result);
- }
-
- @Test
- public void testCreateDrives() throws Exception {
- CloudSigma2Api api = requestSendsResponse(
- postBuilder()
- .payload(payloadFromResourceWithContentType("/drives-create-multiple-request.json", MediaType.APPLICATION_JSON))
- .endpoint(endpoint + "drives/")
- .build()
- , responseBuilder()
- .payload(payloadFromResourceWithContentType("/drives-detail.json", MediaType.APPLICATION_JSON))
- .build());
-
- List<DriveInfo> result = api.createDrives(ImmutableList.of(
- new DriveInfo.Builder()
- .media(org.jclouds.cloudsigma2.domain.MediaType.DISK)
- .name("test_drive_0")
- .size(new BigInteger("1024000000"))
- .allowMultimount(false)
- .build()
- , new DriveInfo.Builder()
- .media(org.jclouds.cloudsigma2.domain.MediaType.DISK)
- .name("test_drive_1")
- .size(new BigInteger("1024000000"))
- .allowMultimount(false)
- .build()
- , new DriveInfo.Builder()
- .media(org.jclouds.cloudsigma2.domain.MediaType.DISK)
- .name("test_drive_2")
- .size(new BigInteger("1024000000"))
- .allowMultimount(false)
- .build()));
- assertNotNull(result);
- assertEquals(result.size(), 3);
- }
-
- @Test
- public void testDeleteDrive() throws Exception {
- String uuid = "e96f3c63-6f50-47eb-9401-a56c5ccf6b32";
- CloudSigma2Api api = requestSendsResponse(
- deleteBuilder()
- .endpoint(endpoint + "drives/" + uuid + "/")
- .build()
- , responseBuilder()
- .build());
-
- api.deleteDrive(uuid);
- }
-
- @Test
- public void testDeleteDrives() throws Exception {
- List<String> deleteList = ImmutableList.of(
- "b137e217-42b6-4ecf-8575-d72efc2d3dbd"
- ,"e035a488-8587-4a15-ab25-9b7343236bc9"
- ,"feded33c-106f-49fa-a1c4-be5c718ad1b5");
-
- CloudSigma2Api api = requestSendsResponse(
- deleteBuilder()
- .endpoint(endpoint + "drives/")
- .payload(payloadFromResourceWithContentType("/drives-delete-multiple.json", MediaType.APPLICATION_JSON))
- .build()
- , responseBuilder()
- .build());
-
- api.deleteDrives(deleteList);
- }
-
- @Test
- public void testEditDrive() throws Exception {
- String uuid = "e96f3c63-6f50-47eb-9401-a56c5ccf6b32";
- CloudSigma2Api api = requestSendsResponse(
- putBuilder()
- .payload(payloadFromResourceWithContentType("/drives-create-request.json", MediaType.APPLICATION_JSON))
- .endpoint(endpoint + "drives/" + uuid + "/")
- .build()
- , responseBuilder()
- .payload(payloadFromResourceWithContentType("/drives-detail.json", MediaType.APPLICATION_JSON))
- .build());
-
- DriveInfo result = api.editDrive(uuid, new DriveInfo.Builder()
- .media(org.jclouds.cloudsigma2.domain.MediaType.DISK)
- .name("test_drive_0")
- .size(new BigInteger("1024000000"))
- .allowMultimount(false)
- .build());
- assertNotNull(result);
- }
-
- @Test
- public void testCloneDrive() throws Exception {
- String uuid = "e96f3c63-6f50-47eb-9401-a56c5ccf6b32";
- CloudSigma2Api api = requestSendsResponse(
- postBuilder()
- .payload(payloadFromResourceWithContentType("/drives-create-request.json", MediaType.APPLICATION_JSON))
- .endpoint(endpoint + "drives/" + uuid + "/action/?do=clone")
- .build()
- , responseBuilder()
- .payload(payloadFromResourceWithContentType("/drives-detail.json", MediaType.APPLICATION_JSON))
- .build());
-
- DriveInfo result = api.cloneDrive(uuid, new DriveInfo.Builder()
- .media(org.jclouds.cloudsigma2.domain.MediaType.DISK)
- .name("test_drive_0")
- .size(new BigInteger("1024000000"))
- .allowMultimount(false)
- .build());
- assertNotNull(result);
- }
-
- @Test
- public void testListLibraryDrives() throws Exception {
- CloudSigma2Api api = requestsSendResponses(
- getBuilder()
- .endpoint(endpoint + "libdrives/")
- .build()
- , responseBuilder()
- .payload(payloadFromResourceWithContentType("/libdrives.json", MediaType.APPLICATION_JSON))
- .build()
- , getBuilder()
- .endpoint(endpoint + "libdrives/")
- .addQueryParam("limit", "2")
- .addQueryParam("offset", "2")
- .build()
- , responseBuilder()
- .payload(payloadFromResourceWithContentType("/libdrives-last-page.json", MediaType.APPLICATION_JSON))
- .build());
-
- List<LibraryDrive> drives = api.listLibraryDrives().concat().toList();
-
- Assert.assertEquals(drives.size(), 3);
- Assert.assertEquals(drives.get(0).getUuid(), "8c45d8d9-4efd-44ec-9833-8d52004b4298");
- Assert.assertEquals(drives.get(1).getUuid(), "d1ec9f26-ba44-4002-bbdf-82a31a84b611");
- Assert.assertEquals(drives.get(2).getUuid(), "dd9da460-b1ab-419a-9fa1-804540eee4c3");
- }
-
- @Test
- public void testListLibraryDrivesPaginatedCollection() throws Exception {
- CloudSigma2Api api = requestSendsResponse(
- getBuilder()
- .endpoint(endpoint + "libdrives/?limit=3&offset=3")
- .build()
- , responseBuilder()
- .payload(payloadFromResourceWithContentType("/libdrives.json", MediaType.APPLICATION_JSON))
- .build());
-
- for (LibraryDrive libraryDrive : api.listLibraryDrives(new PaginationOptions.Builder()
- .limit(3)
- .offset(3)
- .build())) {
- assertNotNull(libraryDrive);
- }
- }
-
- @Test
- public void testGetLibraryDrive() throws Exception {
- String uuid = "6d53b92c-42dc-472b-a7b6-7021f45f377a";
- CloudSigma2Api api = requestSendsResponse(
- getBuilder()
- .endpoint(endpoint + "libdrives/" + uuid + "/")
- .build()
- , responseBuilder()
- .payload(payloadFromResourceWithContentType("/libdrives-single.json", MediaType.APPLICATION_JSON))
- .build());
-
- LibraryDrive result = api.getLibraryDrive(uuid);
- assertNotNull(result);
- }
-
- @Test
- public void testCloneLibraryDrive() throws Exception {
- String uuid = "e96f3c63-6f50-47eb-9401-a56c5ccf6b32";
- CloudSigma2Api api = requestSendsResponse(
- postBuilder()
- .payload(payloadFromResourceWithContentType("/libdrives-create-request.json", MediaType.APPLICATION_JSON))
- .endpoint(endpoint + "libdrives/" + uuid + "/action/?do=clone")
- .build()
- , responseBuilder()
- .payload(payloadFromResourceWithContentType("/libdrives-single.json", MediaType.APPLICATION_JSON))
- .build());
-
- DriveInfo result = api.cloneLibraryDrive(uuid, new LibraryDrive.Builder()
- .media(org.jclouds.cloudsigma2.domain.MediaType.DISK)
- .name("test_drive_0")
- .size(new BigInteger("1024000000"))
- .allowMultimount(false)
- .build());
- assertNotNull(result);
- }
-
- @Test
- public void testListServers() throws Exception {
- CloudSigma2Api api = requestsSendResponses(
- getBuilder()
- .endpoint(endpoint + "servers/")
- .build()
- , responseBuilder()
- .payload(payloadFromResourceWithContentType("/servers.json", MediaType.APPLICATION_JSON))
- .build()
- , getBuilder()
- .endpoint(endpoint + "servers/")
- .addQueryParam("limit", "2")
- .addQueryParam("offset", "2")
- .build()
- , responseBuilder()
- .payload(payloadFromResourceWithContentType("/servers-last-page.json", MediaType.APPLICATION_JSON))
- .build());
-
- List<Server> servers = api.listServers().concat().toList();
-
- Assert.assertEquals(servers.size(), 3);
- Assert.assertEquals(servers.get(0).getUuid(), "61d61337-884b-4c87-b4de-f7f48f9cfc84");
- Assert.assertEquals(servers.get(1).getUuid(), "33e71c37-0d0a-4a3a-a1ea-dc7265c9a154");
- Assert.assertEquals(servers.get(2).getUuid(), "05c16b9a-f2f5-4da6-a1cb-b90722c32212");
- }
-
- @Test
- public void testListServersPaginatedCollection() throws Exception {
- CloudSigma2Api api = requestSendsResponse(
- getBuilder()
- .endpoint(endpoint + "servers/?limit=3&offset=3")
- .build()
- , responseBuilder()
- .payload(payloadFromResourceWithContentType("/servers.json", MediaType.APPLICATION_JSON))
- .build());
-
- for (Server sever : api.listServers(new PaginationOptions.Builder().limit(3).offset(3).build())) {
- assertNotNull(sever);
- }
- }
-
- @Test
- public void testListServersInfo() throws Exception {
- CloudSigma2Api api = requestsSendResponses(
- getBuilder()
- .endpoint(endpoint + "servers/detail/")
- .build()
- , responseBuilder()
- .payload(payloadFromResourceWithContentType("/server-detail-first-page.json", MediaType.APPLICATION_JSON))
- .build()
- , getBuilder()
- .endpoint(endpoint + "servers/detail/")
- .addQueryParam("limit", "2")
- .addQueryParam("offset", "2")
- .build()
- , responseBuilder()
- .payload(payloadFromResourceWithContentType("/server-detail-last-page.json", MediaType.APPLICATION_JSON))
- .build());
-
- List<ServerInfo> serverInfos = api.listServersInfo().concat().toList();
-
- Assert.assertEquals(serverInfos.size(), 3);
- Assert.assertEquals(serverInfos.get(0).getUuid(), "a19a425f-9e92-42f6-89fb-6361203071bb");
- Assert.assertEquals(serverInfos.get(1).getUuid(), "61d61337-884b-4c87-b4de-f7f48f9cfc84");
- Assert.assertEquals(serverInfos.get(2).getUuid(), "33e71c37-0d0a-4a3a-a1ea-dc7265c9a154");
- }
-
- @Test
- public void testListServersInfoPaginatedCollection() throws Exception {
- CloudSigma2Api api = requestSendsResponse(
- getBuilder()
- .endpoint(endpoint + "servers/detail/?limit=3&offset=3")
- .build()
- , responseBuilder()
- .payload(payloadFromResourceWithContentType("/server-detail.json", MediaType.APPLICATION_JSON))
- .build());
-
- for(ServerInfo serverInfo : api.listServersInfo(new PaginationOptions.Builder().limit(3).offset(3).build())){
- assertNotNull(serverInfo);
- }
- }
-
- @Test
- public void testCreateServer() throws Exception {
- CloudSigma2Api api = requestSendsResponse(
- postBuilder()
- .endpoint(endpoint + "servers/")
- .payload(payloadFromResourceWithContentType("/servers-create-request.json", MediaType.APPLICATION_JSON))
- .build()
- , responseBuilder()
- .payload(payloadFromResourceWithContentType("/servers-single.json", MediaType.APPLICATION_JSON))
- .build());
-
- ServerInfo result = api.createServer(new ServerInfo.Builder()
- .cpu(100)
- .memory(new BigInteger("536870912"))
- .name("testServerAcc")
- .vncPassword("testserver")
- .build());
- assertNotNull(result);
- }
-
- @Test
- public void testCreateServers() throws Exception {
- CloudSigma2Api api = requestSendsResponse(
- postBuilder()
- .endpoint(endpoint + "servers/")
- .payload(payloadFromResourceWithContentType("/servers-create-multiple-request.json", MediaType.APPLICATION_JSON))
- .build()
- , responseBuilder()
- .payload(payloadFromResourceWithContentType("/server-detail.json", MediaType.APPLICATION_JSON))
- .build());
- List<ServerInfo> result = api.createServers(ImmutableList.of(
- new ServerInfo.Builder()
- .cpu(100)
- .memory(new BigInteger("536870912"))
- .name("test_server_0")
- .vncPassword("testserver")
- .build()
- , new ServerInfo.Builder()
- .cpu(100)
- .memory(new BigInteger("536870912"))
- .name("test_server_1")
- .vncPassword("testserver")
- .build()
- , new ServerInfo.Builder()
- .cpu(100)
- .memory(new BigInteger("536870912"))
- .name("test_server_2")
- .vncPassword("testserver")
- .build()));
-
- assertNotNull(result);
- }
-
- @Test
- public void testEditServer() throws Exception {
- String uuid = "a19a425f-9e92-42f6-89fb-6361203071bb";
- CloudSigma2Api api = requestSendsResponse(
- putBuilder()
- .endpoint(endpoint + "servers/" + uuid + "/")
- .payload(payloadFromResourceWithContentType("/servers-create-request.json", MediaType.APPLICATION_JSON))
- .build()
- , responseBuilder()
- .payload(payloadFromResourceWithContentType("/servers-single.json", MediaType.APPLICATION_JSON))
- .build());
-
- ServerInfo result = api.editServer(uuid, new ServerInfo.Builder()
- .name("testServerAcc")
- .cpu(100)
- .memory(new BigInteger("536870912"))
- .vncPassword("testserver")
- .build());
- assertNotNull(result);
- }
-
- @Test
- public void testDeleteServer() throws Exception {
- String uuid = "a19a425f-9e92-42f6-89fb-6361203071bb";
- CloudSigma2Api api = requestSendsResponse(
- deleteBuilder()
- .endpoint(endpoint + "servers/" + uuid + "/")
- .build()
- , responseBuilder()
- .build());
-
- api.deleteServer(uuid);
- }
-
- @Test
- public void testDeleteServers() throws Exception {
- List<String> deleteUuids = ImmutableList.of(
- "33e71c37-0d0a-4a3a-a1ea-dc7265c9a154"
- , "61d61337-884b-4c87-b4de-f7f48f9cfc84"
- , "a19a425f-9e92-42f6-89fb-6361203071bb"
- );
- CloudSigma2Api api = requestSendsResponse(
- deleteBuilder()
- .endpoint(endpoint + "servers/")
- .payload(payloadFromResourceWithContentType("/servers-delete-multiple-request.json", MediaType.APPLICATION_JSON))
- .build()
- , responseBuilder()
- .build());
-
- api.deleteServers(deleteUuids);
- }
-
- @Test
- public void testCloneServer() throws Exception {
-
- }
-
- @Test
- public void testGetServerInfo() throws Exception {
- String uuid = "61d61337-884b-4c87-b4de-f7f48f9cfc84";
- CloudSigma2Api api = requestSendsResponse(
- getBuilder()
- .endpoint(endpoint + "servers/" + uuid + "/")
- .build()
- , responseBuilder()
- .payload(payloadFromResourceWithContentType("/servers-single.json", MediaType.APPLICATION_JSON))
- .build());
-
- api.getServerInfo(uuid);
- }
-
- @Test
- public void testStartServer() throws Exception {
- String uuid = "61d61337-884b-4c87-b4de-f7f48f9cfc84";
- CloudSigma2Api api = requestSendsResponse(
- postBuilder()
- .endpoint(endpoint + "servers/" + uuid + "/action/?do=start")
- .build()
- , responseBuilder()
- .build());
-
- api.startServer(uuid);
- }
-
- @Test
- public void testStopServer() throws Exception {
- String uuid = "61d61337-884b-4c87-b4de-f7f48f9cfc84";
- CloudSigma2Api api = requestSendsResponse(
- postBuilder()
- .endpoint(endpoint + "servers/" + uuid + "/action/?do=stop")
- .build()
- , responseBuilder()
- .build());
-
- api.stopServer(uuid);
- }
-
- @Test
- public void testStartServerInSeparateAvailabilityGroup() throws Exception {
- String uuid = "61d61337-884b-4c87-b4de-f7f48f9cfc84";
- List<String> uuidGroup = ImmutableList.of(
- "313e73a4-592f-48cf-81c4-a6c079d005a5",
- "e035a488-8587-4a15-ab25-9b7343236bc9");
- CloudSigma2Api api = requestSendsResponse(
- postBuilder()
- .endpoint(endpoint + "servers/" + uuid + "/action/?do=start?avoid=" + uuidGroup.get(0) + "&avoid=" + uuidGroup.get(1))
- .build()
- , responseBuilder()
- .build());
-
- api.startServerInSeparateAvailabilityGroup(uuid, uuidGroup);
- }
-
- @Test
- public void testOpenServerVNCTunnel() throws Exception {
- String uuid = "61d61337-884b-4c87-b4de-f7f48f9cfc84";
- CloudSigma2Api api = requestSendsResponse(
- postBuilder()
- .endpoint(endpoint + "servers/" + uuid + "/action/?do=open_vnc")
- .build()
- , responseBuilder()
- .build());
-
- api.openServerVNCTunnel(uuid);
- }
-
- @Test
- public void testCloseServerVCNTunnel() throws Exception {
- String uuid = "61d61337-884b-4c87-b4de-f7f48f9cfc84";
- CloudSigma2Api api = requestSendsResponse(
- postBuilder()
- .endpoint(endpoint + "servers/" + uuid + "/action/?do=close_vnc")
- .build()
- , responseBuilder()
- .build());
-
- api.closeServerVCNTunnel(uuid);
- }
-
- @Test
- public void testListServerAvailabilityGroup() throws Exception {
- CloudSigma2Api api = requestSendsResponse(
- getBuilder()
- .endpoint(endpoint + "servers/availability_groups/")
- .build()
- , responseBuilder()
- .payload(payloadFromResourceWithContentType("/servers-availability-groups.json", MediaType.APPLICATION_JSON))
- .build());
-
- for(List<String> availabilityGroup : api.listServerAvailabilityGroup()){
- assertNotNull(availabilityGroup);
- }
- }
-
- @Test
- public void testListFirewallPolicies() throws Exception {
- CloudSigma2Api api = requestsSendResponses(
- getBuilder()
- .endpoint(endpoint + "fwpolicies/")
- .build()
- , responseBuilder()
- .payload(payloadFromResourceWithContentType("/fwpolicies-detail-first-page.json", MediaType.APPLICATION_JSON))
- .build()
- , getBuilder()
- .endpoint(endpoint + "fwpolicies/")
- .addQueryParam("limit", "1")
- .addQueryParam("offset", "1")
- .build()
- , responseBuilder()
- .payload(payloadFromResourceWithContentType("/fwpolicies-detail-last-page.json", MediaType.APPLICATION_JSON))
- .build());
-
- List<FirewallPolicy> firewallPolicies = api.listFirewallPolicies().concat().toList();
-
- Assert.assertEquals(firewallPolicies.size(), 2);
- Assert.assertEquals(firewallPolicies.get(0).getUuid(), "b68dd907-69fc-4b3c-b954-c39d0046525b");
- Assert.assertEquals(firewallPolicies.get(1).getUuid(), "cf8479b4-c98b-46c8-ab9c-108bb00c8218");
- }
-
- @Test
- public void testListFirewallPoliciesPaginatedCollection() throws Exception {
- CloudSigma2Api api = requestSendsResponse(
- getBuilder()
- .endpoint(endpoint + "fwpolicies/?limit=2&offset=2")
- .build()
- , responseBuilder()
- .payload(payloadFromResourceWithContentType("/fwpolicies-detail.json", MediaType.APPLICATION_JSON))
- .build());
-
- for(FirewallPolicy firewallPolicy : api.listFirewallPolicies(new PaginationOptions.Builder().limit(2).offset(2).build())){
- assertNotNull(firewallPolicy);
- }
- }
-
- @Test
- public void testListFirewallPoliciesInfo() throws Exception {
- CloudSigma2Api api = requestsSendResponses(
- getBuilder()
- .endpoint(endpoint + "fwpolicies/detail/")
- .build()
- , responseBuilder()
- .payload(payloadFromResourceWithContentType("/fwpolicies-detail-first-page.json", MediaType.APPLICATION_JSON))
- .build()
- , getBuilder()
- .endpoint(endpoint + "fwpolicies/detail/")
- .addQueryParam("limit", "1")
- .addQueryParam("offset", "1")
- .build()
- , responseBuilder()
- .payload(payloadFromResourceWithContentType("/fwpolicies-detail-last-page.json", MediaType.APPLICATION_JSON))
- .build());
-
- List<FirewallPolicy> firewallPolicies = api.listFirewallPoliciesInfo().concat().toList();
-
- Assert.assertEquals(firewallPolicies.size(), 2);
- Assert.assertEquals(firewallPolicies.get(0).getUuid(), "b68dd907-69fc-4b3c-b954-c39d0046525b");
- Assert.assertEquals(firewallPolicies.get(1).getUuid(), "cf8479b4-c98b-46c8-ab9c-108bb00c8218");
- }
-
- @Test
- public void testListFirewallPoliciesInfoPaginatedCollection() throws Exception {
- CloudSigma2Api api = requestSendsResponse(
- getBuilder()
- .endpoint(endpoint + "fwpolicies/detail/?limit=2&offset=2")
- .build()
- , responseBuilder()
- .payload(payloadFromResourceWithContentType("/fwpolicies-detail.json", MediaType.APPLICATION_JSON))
- .build());
-
- for(FirewallPolicy firewallPolicy : api.listFirewallPoliciesInfo(new PaginationOptions.Builder().limit(2).offset(2).build())){
- assertNotNull(firewallPolicy);
- }
- }
-
- @Test
- public void testCreateFirewallPolicies() throws Exception {
- CloudSigma2Api api = requestSendsResponse(
- postBuilder()
- .endpoint(endpoint + "fwpolicies/")
- .payload(payloadFromResourceWithContentType("/fwpolicies-create-multiple-request.json", MediaType.APPLICATION_JSON))
- .build()
- , responseBuilder()
- .payload(payloadFromResourceWithContentType("/fwpolicies-detail.json", MediaType.APPLICATION_JSON))
- .build());
-
- List<FirewallPolicy> result = api.createFirewallPolicies(ImmutableList.of(
- new FirewallPolicy.Builder()
- .name("New policy")
- .rules(ImmutableList.of(
- new FirewallRule.Builder()
- .action(FirewallAction.ACCEPT)
- .comment("Test comment")
- .direction(FirewallDirection.IN)
- .destinationIp("192.168.1.132/32")
- .destinationPort("1233")
- .ipProtocol(FirewallIpProtocol.TCP)
- .sourceIp("255.255.255.12/32")
- .sourcePort("321")
- .build()
- ))
- .build()
- , new FirewallPolicy.Builder()
- .name("My awesome policy")
- .rules(ImmutableList.of(
+ protected String endpoint = "https://zrh.cloudsigma.com/api/2.0/";
+
+ public CloudSigma2ApiExpectTest() {
+ provider = "cloudsigma2";
+ }
+
+ protected HttpRequest.Builder<?> getBuilder() {
+ return HttpRequest.builder()
+ .method("GET")
+ .addHeader("Accept", MediaType.APPLICATION_JSON)
+ .addHeader("Authorization", "Basic aWRlbnRpdHk6Y3JlZGVudGlhbA==");
+ }
+
+ protected HttpRequest.Builder<?> postBuilder() {
+ return HttpRequest.builder()
+ .method("POST")
+ .addHeader("Accept", MediaType.APPLICATION_JSON)
+ .addHeader("Authorization", "Basic aWRlbnRpdHk6Y3JlZGVudGlhbA==");
+ }
+
+ protected HttpRequest.Builder<?> deleteBuilder() {
+ return HttpRequest.builder()
+ .method("DELETE")
+ .addHeader("Accept", MediaType.APPLICATION_JSON)
+ .addHeader("Authorization", "Basic aWRlbnRpdHk6Y3JlZGVudGlhbA==");
+ }
+
+ protected HttpRequest.Builder<?> putBuilder() {
+ return HttpRequest.builder()
+ .method("PUT")
+ .addHeader("Accept", MediaType.APPLICATION_JSON)
+ .addHeader("Authorization", "Basic aWRlbnRpdHk6Y3JlZGVudGlhbA==");
+ }
+
+ protected HttpResponse.Builder<?> responseBuilder() {
+ return HttpResponse.builder()
+ .statusCode(200)
+ .message("OK");
+ }
+
+ @Test
+ public void testListDrives() throws Exception {
+ CloudSigma2Api api = requestsSendResponses(
+ getBuilder()
+ .endpoint(endpoint + "drives/")
+ .build()
+ , responseBuilder()
+ .payload(payloadFromResourceWithContentType("/drives.json", MediaType.APPLICATION_JSON))
+ .build()
+ , getBuilder()
+ .endpoint(endpoint + "drives/")
+ .addQueryParam("limit", "2")
+ .addQueryParam("offset", "2")
+ .build()
+ , responseBuilder()
+ .payload(payloadFromResourceWithContentType("/drives-last-page.json", MediaType.APPLICATION_JSON))
+ .build());
+
+ List<Drive> drives = api.listDrives().concat().toList();
+
+ Assert.assertEquals(drives.size(), 3);
+ Assert.assertEquals(drives.get(0).getUuid(), "92ca1450-417e-4cc1-983b-1015777e2591");
+ Assert.assertEquals(drives.get(1).getUuid(), "414ad24b-ba41-47c0-9751-ef5060b6c391");
+ Assert.assertEquals(drives.get(2).getUuid(), "7bc04bc5-bd09-4269-b45d-16b58d6f71b4");
+ }
+
+ @Test
+ public void testListDrivesPaginatedCollection() throws Exception {
+ CloudSigma2Api api = requestSendsResponse(
+ getBuilder()
+ .endpoint(endpoint + "drives/?limit=3&offset=3")
+ .build()
+ , responseBuilder()
+ .payload(payloadFromResourceWithContentType("/drives.json", MediaType.APPLICATION_JSON))
+ .build());
+
+ for (Drive drive : api.listDrives(new PaginationOptions.Builder().limit(3).offset(3).build())) {
+ assertNotNull(drive);
+ }
+ }
+
+ @Test
+ public void testListDrivesInfo() throws Exception {
+ CloudSigma2Api api = requestsSendResponses(
+ getBuilder()
+ .endpoint(endpoint + "drives/detail/")
+ .build()
+ , responseBuilder()
+ .payload(payloadFromResourceWithContentType("/drives-detail-first-page.json", MediaType.APPLICATION_JSON))
+ .build()
+ , getBuilder()
+ .endpoint(endpoint + "drives/detail/")
+ .addQueryParam("limit", "2")
+ .addQueryParam("offset", "2")
+ .build()
+ , responseBuilder()
+ .payload(payloadFromResourceWithContentType("/drives-detail-last-page.json", MediaType.APPLICATION_JSON))
+ .build());
+
+ List<DriveInfo> drives = api.listDrivesInfo().concat().toList();
+
+ Assert.assertEquals(drives.size(), 3);
+ Assert.assertEquals(drives.get(0).getUuid(), "92ca1450-417e-4cc1-983b-1015777e2591");
+ Assert.assertEquals(drives.get(1).getUuid(), "414ad24b-ba41-47c0-9751-ef5060b6c391");
+ Assert.assertEquals(drives.get(2).getUuid(), "7bc04bc5-bd09-4269-b45d-16b58d6f71b4");
+ }
+
+ @Test
+ public void testListDrivesInfoPaginatedCollection() throws Exception {
+ CloudSigma2Api api = requestSendsResponse(
+ getBuilder()
+ .endpoint(endpoint + "drives/detail/?limit=3&offset=3")
+ .build()
+ , responseBuilder()
+ .payload(payloadFromResourceWithContentType("/drives-detail.json", MediaType.APPLICATION_JSON))
+ .build());
+
+ for (DriveInfo driveInfo : api.listDrivesInfo(new PaginationOptions.Builder().limit(3).offset(3).build())) {
+ assertNotNull(driveInfo);
+ }
+ }
+
+ @Test
+ public void testGetDriveInfo() throws Exception {
+ String uuid = "e96f3c63-6f50-47eb-9401-a56c5ccf6b32";
+ CloudSigma2Api api = requestSendsResponse(
+ getBuilder()
+ .endpoint(endpoint + "drives/" + uuid + "/")
+ .build()
+ , responseBuilder()
+ .payload(payloadFromResourceWithContentType("/drives-detail.json", MediaType.APPLICATION_JSON))
+ .build());
+
+ DriveInfo result = api.getDriveInfo(uuid);
+ assertNotNull(result);
+ }
+
+ @Test
+ public void testCreateDrive() throws Exception {
+ CloudSigma2Api api = requestSendsResponse(
+ postBuilder()
+ .payload(payloadFromResourceWithContentType("/drives-create-request.json"
+ , MediaType.APPLICATION_JSON))
+ .endpoint(endpoint + "drives/")
+ .build()
+ , responseBuilder()
+ .payload(payloadFromResourceWithContentType("/drives-single.json", MediaType.APPLICATION_JSON))
+ .build());
+
+ DriveInfo result = api.createDrive(new DriveInfo.Builder()
+ .media(org.jclouds.cloudsigma2.domain.MediaType.DISK)
+ .name("test_drive_0")
+ .size(new BigInteger("1024000000"))
+ .allowMultimount(false)
+ .build());
+ assertNotNull(result);
+ }
+
+ @Test
+ public void testCreateDrives() throws Exception {
+ CloudSigma2Api api = requestSendsResponse(
+ postBuilder()
+ .payload(payloadFromResourceWithContentType("/drives-create-multiple-request.json"
+ , MediaType.APPLICATION_JSON))
+ .endpoint(endpoint + "drives/")
+ .build()
+ , responseBuilder()
+ .payload(payloadFromResourceWithContentType("/drives-detail.json", MediaType.APPLICATION_JSON))
+ .build());
+
+ List<DriveInfo> result = api.createDrives(ImmutableList.of(
+ new DriveInfo.Builder()
+ .media(org.jclouds.cloudsigma2.domain.MediaType.DISK)
+ .name("test_drive_0")
+ .size(new BigInteger("1024000000"))
+ .allowMultimount(false)
+ .build()
+ , new DriveInfo.Builder()
+ .media(org.jclouds.cloudsigma2.domain.MediaType.DISK)
+ .name("test_drive_1")
+ .size(new BigInteger("1024000000"))
+ .allowMultimount(false)
+ .build()
+ , new DriveInfo.Builder()
+ .media(org.jclouds.cloudsigma2.domain.MediaType.DISK)
+ .name("test_drive_2")
+ .size(new BigInteger("1024000000"))
+ .allowMultimount(false)
+ .build()));
+ assertNotNull(result);
+ assertEquals(result.size(), 3);
+ }
+
+ @Test
+ public void testDeleteDrive() throws Exception {
+ String uuid = "e96f3c63-6f50-47eb-9401-a56c5ccf6b32";
+ CloudSigma2Api api = requestSendsResponse(
+ deleteBuilder()
+ .endpoint(endpoint + "drives/" + uuid + "/")
+ .build()
+ , responseBuilder()
+ .build());
+
+ api.deleteDrive(uuid);
+ }
+
+ @Test
+ public void testDeleteDrives() throws Exception {
+ List<String> deleteList = ImmutableList.of(
+ "b137e217-42b6-4ecf-8575-d72efc2d3dbd"
+ , "e035a488-8587-4a15-ab25-9b7343236bc9"
+ , "feded33c-106f-49fa-a1c4-be5c718ad1b5");
+
+ CloudSigma2Api api = requestSendsResponse(
+ deleteBuilder()
+ .endpoint(endpoint + "drives/")
+ .payload(payloadFromResourceWithContentType("/drives-delete-multiple.json"
+ , MediaType.APPLICATION_JSON))
+ .build()
+ , responseBuilder()
+ .build());
+
+ api.deleteDrives(deleteList);
+ }
+
+ @Test
+ public void testEditDrive() throws Exception {
+ String uuid = "e96f3c63-6f50-47eb-9401-a56c5ccf6b32";
+ CloudSigma2Api api = requestSendsResponse(
+ putBuilder()
+ .payload(payloadFromResourceWithContentType("/drives-create-request.json"
+ , MediaType.APPLICATION_JSON))
+ .endpoint(endpoint + "drives/" + uuid + "/")
+ .build()
+ , responseBuilder()
+ .payload(payloadFromResourceWithContentType("/drives-detail.json", MediaType.APPLICATION_JSON))
+ .build());
+
+ DriveInfo result = api.editDrive(uuid, new DriveInfo.Builder()
+ .media(org.jclouds.cloudsigma2.domain.MediaType.DISK)
+ .name("test_drive_0")
+ .size(new BigInteger("1024000000"))
+ .allowMultimount(false)
+ .build());
+ assertNotNull(result);
+ }
+
+ @Test
+ public void testCloneDrive() throws Exception {
+ String uuid = "e96f3c63-6f50-47eb-9401-a56c5ccf6b32";
+ CloudSigma2Api api = requestSendsResponse(
+ postBuilder()
+ .payload(payloadFromResourceWithContentType("/drives-create-request.json"
+ , MediaType.APPLICATION_JSON))
+ .endpoint(endpoint + "drives/" + uuid + "/action/?do=clone")
+ .build()
+ , responseBuilder()
+ .payload(payloadFromResourceWithContentType("/drives-detail.json", MediaType.APPLICATION_JSON))
+ .build());
+
+ DriveInfo result = api.cloneDrive(uuid, new DriveInfo.Builder()
+ .media(org.jclouds.cloudsigma2.domain.MediaType.DISK)
+ .name("test_drive_0")
+ .size(new BigInteger("1024000000"))
+ .allowMultimount(false)
+ .build());
+ assertNotNull(result);
+ }
+
+ @Test
+ public void testListLibraryDrives() throws Exception {
+ CloudSigma2Api api = requestsSendResponses(
+ getBuilder()
+ .endpoint(endpoint + "libdrives/")
+ .build()
+ , responseBuilder()
+ .payload(payloadFromResourceWithContentType("/libdrives.json", MediaType.APPLICATION_JSON))
+ .build()
+ , getBuilder()
+ .endpoint(endpoint + "libdrives/")
+ .addQueryParam("limit", "2")
+ .addQueryParam("offset", "2")
+ .build()
+ , responseBuilder()
+ .payload(payloadFromResourceWithContentType("/libdrives-last-page.json", MediaType.APPLICATION_JSON))
+ .build());
+
+ List<LibraryDrive> drives = api.listLibraryDrives().concat().toList();
+
+ Assert.assertEquals(drives.size(), 3);
+ Assert.assertEquals(drives.get(0).getUuid(), "8c45d8d9-4efd-44ec-9833-8d52004b4298");
+ Assert.assertEquals(drives.get(1).getUuid(), "d1ec9f26-ba44-4002-bbdf-82a31a84b611");
+ Assert.assertEquals(drives.get(2).getUuid(), "dd9da460-b1ab-419a-9fa1-804540eee4c3");
+ }
+
+ @Test
+ public void testListLibraryDrivesPaginatedCollection() throws Exception {
+ CloudSigma2Api api = requestSendsResponse(
+ getBuilder()
+ .endpoint(endpoint + "libdrives/?limit=3&offset=3")
+ .build()
+ , responseBuilder()
+ .payload(payloadFromResourceWithContentType("/libdrives.json", MediaType.APPLICATION_JSON))
+ .build());
+
+ for (LibraryDrive libraryDrive : api.listLibraryDrives(new PaginationOptions.Builder()
+ .limit(3)
+ .offset(3)
+ .build())) {
+ assertNotNull(libraryDrive);
+ }
+ }
+
+ @Test
+ public void testGetLibraryDrive() throws Exception {
+ String uuid = "6d53b92c-42dc-472b-a7b6-7021f45f377a";
+ CloudSigma2Api api = requestSendsResponse(
+ getBuilder()
+ .endpoint(endpoint + "libdrives/" + uuid + "/")
+ .build()
+ , responseBuilder()
+ .payload(payloadFromResourceWithContentType("/libdrives-single.json", MediaType.APPLICATION_JSON))
+ .build());
+
+ LibraryDrive result = api.getLibraryDrive(uuid);
+ assertNotNull(result);
+ }
+
+ @Test
+ public void testCloneLibraryDrive() throws Exception {
+ String uuid = "e96f3c63-6f50-47eb-9401-a56c5ccf6b32";
+ CloudSigma2Api api = requestSendsResponse(
+ postBuilder()
+ .payload(payloadFromResourceWithContentType("/libdrives-create-request.json"
+ , MediaType.APPLICATION_JSON))
+ .endpoint(endpoint + "libdrives/" + uuid + "/action/?do=clone")
+ .build()
+ , responseBuilder()
+ .payload(payloadFromResourceWithContentType("/libdrives-single.json", MediaType.APPLICATION_JSON))
+ .build());
+
+ DriveInfo result = api.cloneLibraryDrive(uuid, new LibraryDrive.Builder()
+ .media(org.jclouds.cloudsigma2.domain.MediaType.DISK)
+ .name("test_drive_0")
+ .size(new BigInteger("1024000000"))
+ .allowMultimount(false)
+ .build());
+ assertNotNull(result);
+ }
+
+ @Test
+ public void testListServers() throws Exception {
+ CloudSigma2Api api = requestsSendResponses(
+ getBuilder()
+ .endpoint(endpoint + "servers/")
+ .build()
+ , responseBuilder()
+ .payload(payloadFromResourceWithContentType("/servers.json", MediaType.APPLICATION_JSON))
+ .build()
+ , getBuilder()
+ .endpoint(endpoint + "servers/")
+ .addQueryParam("limit", "2")
+ .addQueryParam("offset", "2")
+ .build()
+ , responseBuilder()
+ .payload(payloadFromResourceWithContentType("/servers-last-page.json", MediaType.APPLICATION_JSON))
+ .build());
+
+ List<Server> servers = api.listServers().concat().toList();
+
+ Assert.assertEquals(servers.size(), 3);
+ Assert.assertEquals(servers.get(0).getUuid(), "61d61337-884b-4c87-b4de-f7f48f9cfc84");
+ Assert.assertEquals(servers.get(1).getUuid(), "33e71c37-0d0a-4a3a-a1ea-dc7265c9a154");
+ Assert.assertEquals(servers.get(2).getUuid(), "05c16b9a-f2f5-4da6-a1cb-b90722c32212");
+ }
+
+ @Test
+ public void testListServersPaginatedCollection() throws Exception {
+ CloudSigma2Api api = requestSendsResponse(
+ getBuilder()
+ .endpoint(endpoint + "servers/?limit=3&offset=3")
+ .build()
+ , responseBuilder()
+ .payload(payloadFromResourceWithContentType("/servers.json", MediaType.APPLICATION_JSON))
+ .build());
+
+ for (Server sever : api.listServers(new PaginationOptions.Builder().limit(3).offset(3).build())) {
+ assertNotNull(sever);
+ }
+ }
+
+ @Test
+ public void testListServersInfo() throws Exception {
+ CloudSigma2Api api = requestsSendResponses(
+ getBuilder()
+ .endpoint(endpoint + "servers/detail/")
+ .build()
+ , responseBuilder()
+ .payload(payloadFromResourceWithContentType("/server-detail-first-page.json", MediaType.APPLICATION_JSON))
+ .build()
+ , getBuilder()
+ .endpoint(endpoint + "servers/detail/")
+ .addQueryParam("limit", "2")
+ .addQueryParam("offset", "2")
+ .build()
+ , responseBuilder()
+ .payload(payloadFromResourceWithContentType("/server-detail-last-page.json", MediaType.APPLICATION_JSON))
+ .build());
+
+ List<ServerInfo> serverInfos = api.listServersInfo().concat().toList();
+
+ Assert.assertEquals(serverInfos.size(), 3);
+ Assert.assertEquals(serverInfos.get(0).getUuid(), "a19a425f-9e92-42f6-89fb-6361203071bb");
+ Assert.assertEquals(serverInfos.get(1).getUuid(), "61d61337-884b-4c87-b4de-f7f48f9cfc84");
+ Assert.assertEquals(serverInfos.get(2).getUuid(), "33e71c37-0d0a-4a3a-a1ea-dc7265c9a154");
+ }
+
+ @Test
+ public void testListServersInfoPaginatedCollection() throws Exception {
+ CloudSigma2Api api = requestSendsResponse(
+ getBuilder()
+ .endpoint(endpoint + "servers/detail/?limit=3&offset=3")
+ .build()
+ , responseBuilder()
+ .payload(payloadFromResourceWithContentType("/server-detail.json", MediaType.APPLICATION_JSON))
+ .build());
+
+ for (ServerInfo serverInfo : api.listServersInfo(new PaginationOptions.Builder().limit(3).offset(3).build())) {
+ assertNotNull(serverInfo);
+ }
+ }
+
+ @Test
+ public void testCreateServer() throws Exception {
+ CloudSigma2Api api = requestSendsResponse(
+ postBuilder()
+ .endpoint(endpoint + "servers/")
+ .payload(payloadFromResourceWithContentType("/servers-create-request.json"
+ , MediaType.APPLICATION_JSON))
+ .build()
+ , responseBuilder()
+ .payload(payloadFromResourceWithContentType("/servers-single.json", MediaType.APPLICATION_JSON))
+ .build());
+
+ ServerInfo result = api.createServer(new ServerInfo.Builder()
+ .cpu(100)
+ .memory(new BigInteger("536870912"))
+ .name("testServerAcc")
+ .vncPassword("testserver")
+ .build());
+ assertNotNull(result);
+ }
+
+ @Test
+ public void testCreateServers() throws Exception {
+ CloudSigma2Api api = requestSendsResponse(
+ postBuilder()
+ .endpoint(endpoint + "servers/")
+ .payload(payloadFromResourceWithContentType("/servers-create-multiple-request.json"
+ , MediaType.APPLICATION_JSON))
+ .build()
+ , responseBuilder()
+ .payload(payloadFromResourceWithContentType("/server-detail.json", MediaType.APPLICATION_JSON))
+ .build());
+ List<ServerInfo> result = api.createServers(ImmutableList.of(
+ new ServerInfo.Builder()
+ .cpu(100)
+ .memory(new BigInteger("536870912"))
+ .name("test_server_0")
+ .vncPassword("testserver")
+ .build()
+ , new ServerInfo.Builder()
+ .cpu(100)
+ .memory(new BigInteger("536870912"))
+ .name("test_server_1")
+ .vncPassword("testserver")
+ .build()
+ , new ServerInfo.Builder()
+ .cpu(100)
+ .memory(new BigInteger("536870912"))
+ .name("test_server_2")
+ .vncPassword("testserver")
+ .build()));
+
+ assertNotNull(result);
+ }
+
+ @Test
+ public void testEditServer() throws Exception {
+ String uuid = "a19a425f-9e92-42f6-89fb-6361203071bb";
+ CloudSigma2Api api = requestSendsResponse(
+ putBuilder()
+ .endpoint(endpoint + "servers/" + uuid + "/")
+ .payload(payloadFromResourceWithContentType("/servers-create-request.json"
+ , MediaType.APPLICATION_JSON))
+ .build()
+ , responseBuilder()
+ .payload(payloadFromResourceWithContentType("/servers-single.json", MediaType.APPLICATION_JSON))
+ .build());
+
+ ServerInfo result = api.editServer(uuid, new ServerInfo.Builder()
+ .name("testServerAcc")
+ .cpu(100)
+ .memory(new BigInteger("536870912"))
+ .vncPassword("testserver")
+ .build());
+ assertNotNull(result);
+ }
+
+ @Test
+ public void testDeleteServer() throws Exception {
+ String uuid = "a19a425f-9e92-42f6-89fb-6361203071bb";
+ CloudSigma2Api api = requestSendsResponse(
+ deleteBuilder()
+ .endpoint(endpoint + "servers/" + uuid + "/")
+ .build()
+ , responseBuilder()
+ .build());
+
+ api.deleteServer(uuid);
+ }
+
+ @Test
+ public void testDeleteServers() throws Exception {
+ List<String> deleteUuids = ImmutableList.of(
+ "33e71c37-0d0a-4a3a-a1ea-dc7265c9a154"
+ , "61d61337-884b-4c87-b4de-f7f48f9cfc84"
+ , "a19a425f-9e92-42f6-89fb-6361203071bb"
+ );
+ CloudSigma2Api api = requestSendsResponse(
+ deleteBuilder()
+ .endpoint(endpoint + "servers/")
+ .payload(payloadFromResourceWithContentType("/servers-delete-multiple-request.json"
+ , MediaType.APPLICATION_JSON))
+ .build()
+ , responseBuilder()
+ .build());
+
+ api.deleteServers(deleteUuids);
+ }
+
+ @Test
+ public void testCloneServer() throws Exception {
+
+ }
+
+ @Test
+ public void testGetServerInfo() throws Exception {
+ String uuid = "61d61337-884b-4c87-b4de-f7f48f9cfc84";
+ CloudSigma2Api api = requestSendsResponse(
+ getBuilder()
+ .endpoint(endpoint + "servers/" + uuid + "/")
+ .build()
+ , responseBuilder()
+ .payload(payloadFromResourceWithContentType("/servers-single.json", MediaType.APPLICATION_JSON))
+ .build());
+
+ api.getServerInfo(uuid);
+ }
+
+ @Test
+ public void testStartServer() throws Exception {
+ String uuid = "61d61337-884b-4c87-b4de-f7f48f9cfc84";
+ CloudSigma2Api api = requestSendsResponse(
+ postBuilder()
+ .endpoint(endpoint + "servers/" + uuid + "/action/?do=start")
+ .build()
+ , responseBuilder()
+ .build());
+
+ api.startServer(uuid);
+ }
+
+ @Test
+ public void testStopServer() throws Exception {
+ String uuid = "61d61337-884b-4c87-b4de-f7f48f9cfc84";
+ CloudSigma2Api api = requestSendsResponse(
+ postBuilder()
+ .endpoint(endpoint + "servers/" + uuid + "/action/?do=stop")
+ .build()
+ , responseBuilder()
+ .build());
+
+ api.stopServer(uuid);
+ }
+
+ @Test
+ public void testStartServerInSeparateAvailabilityGroup() throws Exception {
+ String uuid = "61d61337-884b-4c87-b4de-f7f48f9cfc84";
+ List<String> uuidGroup = ImmutableList.of(
+ "313e73a4-592f-48cf-81c4-a6c079d005a5",
+ "e035a488-8587-4a15-ab25-9b7343236bc9");
+ CloudSigma2Api api = requestSendsResponse(
+ postBuilder()
+ .endpoint(endpoint + "servers/"
+ + uuid
+ + "/action/?do=start?avoid="
+ + uuidGroup.get(0)
+ + "&avoid="
+ + uuidGroup.get(1))
+ .build()
+ , responseBuilder()
+ .build());
+
+ api.startServerInSeparateAvailabilityGroup(uuid, uuidGroup);
+ }
+
+ @Test
+ public void testOpenServerVNCTunnel() throws Exception {
+ String uuid = "61d61337-884b-4c87-b4de-f7f48f9cfc84";
+ CloudSigma2Api api = requestSendsResponse(
+ postBuilder()
+ .endpoint(endpoint + "servers/" + uuid + "/action/?do=open_vnc")
+ .build()
+ , responseBuilder()
+ .build());
+
+ api.openServerVNCTunnel(uuid);
+ }
+
+ @Test
+ public void testCloseServerVCNTunnel() throws Exception {
+ String uuid = "61d61337-884b-4c87-b4de-f7f48f9cfc84";
+ CloudSigma2Api api = requestSendsResponse(
+ postBuilder()
+ .endpoint(endpoint + "servers/" + uuid + "/action/?do=close_vnc")
+ .build()
+ , responseBuilder()
+ .build());
+
+ api.closeServerVCNTunnel(uuid);
+ }
+
+ @Test
+ public void testListServerAvailabilityGroup() throws Exception {
+ CloudSigma2Api api = requestSendsResponse(
+ getBuilder()
+ .endpoint(endpoint + "servers/availability_groups/")
+ .build()
+ , responseBuilder()
+ .payload(payloadFromResourceWithContentType("/servers-availability-groups.json"
+ , MediaType.APPLICATION_JSON))
+ .build());
+
+ for (List<String> availabilityGroup : api.listServerAvailabilityGroup()) {
+ assertNotNull(availabilityGroup);
+ }
+ }
+
+ @Test
+ public void testListFirewallPolicies() throws Exception {
+ CloudSigma2Api api = requestsSendResponses(
+ getBuilder()
+ .endpoint(endpoint + "fwpolicies/")
+ .build()
+ , responseBuilder()
+ .payload(payloadFromResourceWithContentType("/fwpolicies-detail-first-page.json"
+ , MediaType.APPLICATION_JSON))
+ .build()
+ , getBuilder()
+ .endpoint(endpoint + "fwpolicies/")
+ .addQueryParam("limit", "1")
+ .addQueryParam("offset", "1")
+ .build()
+ , responseBuilder()
+ .payload(payloadFromResourceWithContentType("/fwpolicies-detail-last-page.json"
+ , MediaType.APPLICATION_JSON))
+ .build());
+
+ List<FirewallPolicy> firewallPolicies = api.listFirewallPolicies().concat().toList();
+
+ Assert.assertEquals(firewallPolicies.size(), 2);
+ Assert.assertEquals(firewallPolicies.get(0).getUuid(), "b68dd907-69fc-4b3c-b954-c39d0046525b");
+ Assert.assertEquals(firewallPolicies.get(1).getUuid(), "cf8479b4-c98b-46c8-ab9c-108bb00c8218");
+ }
+
+ @Test
+ public void testListFirewallPoliciesPaginatedCollection() throws Exception {
+ CloudSigma2Api api = requestSendsResponse(
+ getBuilder()
+ .endpoint(endpoint + "fwpolicies/?limit=2&offset=2")
+ .build()
+ , responseBuilder()
+ .payload(payloadFromResourceWithContentType("/fwpolicies-detail.json", MediaType.APPLICATION_JSON))
+ .build());
+
+ for (FirewallPolicy firewallPolicy : api.listFirewallPolicies(new PaginationOptions.Builder()
+ .limit(2)
+ .offset(2)
+ .build())) {
+ assertNotNull(firewallPolicy);
+ }
+ }
+
+ @Test
+ public void testListFirewallPoliciesInfo() throws Exception {
+ CloudSigma2Api api = requestsSendResponses(
+ getBuilder()
+ .endpoint(endpoint + "fwpolicies/detail/")
+ .build()
+ , responseBuilder()
+ .payload(payloadFromResourceWithContentType("/fwpolicies-detail-first-page.json"
+ , MediaType.APPLICATION_JSON))
+ .build()
+ , getBuilder()
+ .endpoint(endpoint + "fwpolicies/detail/")
+ .addQueryParam("limit", "1")
+ .addQueryParam("offset", "1")
+ .build()
+ , responseBuilder()
+ .payload(payloadFromResourceWithContentType("/fwpolicies-detail-last-page.json"
+ , MediaType.APPLICATION_JSON))
+ .build());
+
+ List<FirewallPolicy> firewallPolicies = api.listFirewallPoliciesInfo().concat().toList();
+
+ Assert.assertEquals(firewallPolicies.size(), 2);
+ Assert.assertEquals(firewallPolicies.get(0).getUuid(), "b68dd907-69fc-4b3c-b954-c39d0046525b");
+ Assert.assertEquals(firewallPolicies.get(1).getUuid(), "cf8479b4-c98b-46c8-ab9c-108bb00c8218");
+ }
+
+ @Test
+ public void testListFirewallPoliciesInfoPaginatedCollection() throws Exception {
+ CloudSigma2Api api = requestSendsResponse(
+ getBuilder()
+ .endpoint(endpoint + "fwpolicies/detail/?limit=2&offset=2")
+ .build()
+ , responseBuilder()
+ .payload(payloadFromResourceWithContentType("/fwpolicies-detail.json", MediaType.APPLICATION_JSON))
+ .build());
+
+ for (FirewallPolicy firewallPolicy : api.listFirewallPoliciesInfo(new PaginationOptions.Builder()
+ .limit(2)
+ .offset(2)
+ .build())) {
+ assertNotNull(firewallPolicy);
+ }
+ }
+
+ @Test
+ public void testCreateFirewallPolicies() throws Exception {
+ CloudSigma2Api api = requestSendsResponse(
+ postBuilder()
+ .endpoint(endpoint + "fwpolicies/")
+ .payload(payloadFromResourceWithContentType("/fwpolicies-create-multiple-request.json"
+ , MediaType.APPLICATION_JSON))
+ .build()
+ , responseBuilder()
+ .payload(payloadFromResourceWithContentType("/fwpolicies-detail.json", MediaType.APPLICATION_JSON))
+ .build());
+
+ List<FirewallPolicy> result = api.createFirewallPolicies(ImmutableList.of(
+ new FirewallPolicy.Builder()
+ .name("New policy")
+ .rules(ImmutableList.of(
new FirewallRule.Builder()
- .action(FirewallAction.DROP)
- .comment("Drop traffic from the VM to IP address 23.0.0.0/32")
- .direction(FirewallDirection.OUT)
- .destinationIp("23.0.0.0/32")
- .build()
- , new FirewallRule.Builder()
- .action(FirewallAction.ACCEPT)
- .comment("Allow SSH traffic to the VM from our office in Dubai")
- .direction(FirewallDirection.IN)
- .destinationPort("22")
- .ipProtocol(FirewallIpProtocol.TCP)
- .sourceIp("172.66.32.0/24")
- .build()
- , new FirewallRule.Builder()
+ .action(FirewallAction.ACCEPT)
+ .comment("Test comment")
+ .direction(FirewallDirection.IN)
+ .destinationIp("192.168.1.132/32")
+ .destinationPort("1233")
+ .ipProtocol(FirewallIpProtocol.TCP)
+ .sourceIp("255.255.255.12/32")
+ .sourcePort("321")
+ .build()
+ ))
+ .build()
+ , new FirewallPolicy.Builder()
+ .name("My awesome policy")
+ .rules(ImmutableList.of(
+ new FirewallRule.Builder()
.action(FirewallAction.DROP)
- .comment("Drop all other SSH traffic to the VM")
- .direction(FirewallDirection.IN)
- .destinationPort("22")
- .ipProtocol(FirewallIpProtocol.TCP)
- .build()
- , new FirewallRule.Builder()
+ .comment("Drop traffic from the VM to IP address 23.0.0.0/32")
+ .direction(FirewallDirection.OUT)
+ .destinationIp("23.0.0.0/32")
+ .build()
+ , new FirewallRule.Builder()
+ .action(FirewallAction.ACCEPT)
+ .comment("Allow SSH traffic to the VM from our office in Dubai")
+ .direction(FirewallDirection.IN)
+ .destinationPort("22")
+ .ipProtocol(FirewallIpProtocol.TCP)
+ .sourceIp("172.66.32.0/24")
+ .build()
+ , new FirewallRule.Builder()
+ .action(FirewallAction.DROP)
+ .comment("Drop all other SSH traffic to the VM")
+ .direction(FirewallDirection.IN)
+ .destinationPort("22")
+ .ipProtocol(FirewallIpProtocol.TCP)
+ .build()
+ , new FirewallRule.Builder()
+ .action(FirewallAction.DROP)
+ .comment("Drop all UDP traffic to the VM, not originating from 172.66.32.55")
+ .direction(FirewallDirection.IN)
+ .ipProtocol(FirewallIpProtocol.UDP)
+ .sourceIp("!172.66.32.55/32")
+ .build()
+ , new FirewallRule.Builder()
+ .action(FirewallAction.DROP)
+ .comment("Drop any traffic, to the VM with destination port not between 1-1024")
+ .direction(FirewallDirection.IN)
+ .destinationPort("!1:1024")
+ .ipProtocol(FirewallIpProtocol.TCP)
+ .build()))
+ .build()));
+ assertNotNull(result);
+ }
+
+ @Test
+ public void testCreateFirewallPolicy() throws Exception {
+ CloudSigma2Api api = requestSendsResponse(
+ postBuilder()
+ .endpoint(endpoint + "fwpolicies/")
+ .payload(payloadFromResourceWithContentType("/fwpolicies-create-request.json"
+ , MediaType.APPLICATION_JSON))
+ .build()
+ , responseBuilder()
+ .payload(payloadFromResourceWithContentType("/fwpolicies-single.json", MediaType.APPLICATION_JSON))
+ .build());
+
+ FirewallPolicy result = api.createFirewallPolicy(new FirewallPolicy.Builder()
+ .name("My awesome policy")
+ .rules(ImmutableList.of(
+ new FirewallRule.Builder()
.action(FirewallAction.DROP)
- .comment("Drop all UDP traffic to the VM, not originating from 172.66.32.55")
- .direction(FirewallDirection.IN)
- .ipProtocol(FirewallIpProtocol.UDP)
- .sourceIp("!172.66.32.55/32")
- .build()
- , new FirewallRule.Builder()
- .action(FirewallAction.DROP)
- .comment("Drop any traffic, to the VM with destination port not between 1-1024")
- .direction(FirewallDirection.IN)
- .destinationPort("!1:1024")
- .ipProtocol(FirewallIpProtocol.TCP)
- .build()))
- .build()));
- assertNotNull(result);
- }
-
- @Test
- public void testCreateFirewallPolicy() throws Exception {
- CloudSigma2Api api = requestSendsResponse(
- postBuilder()
- .endpoint(endpoint + "fwpolicies/")
- .payload(payloadFromResourceWithContentType("/fwpolicies-create-request.json", MediaType.APPLICATION_JSON))
- .build()
- , responseBuilder()
- .payload(payloadFromResourceWithContentType("/fwpolicies-single.json", MediaType.APPLICATION_JSON))
- .build());
-
- FirewallPolicy result = api.createFirewallPolicy(new FirewallPolicy.Builder()
- .name("My awesome policy")
- .rules(ImmutableList.of(
+ .comment("Drop traffic from the VM to IP address 23.0.0.0/32")
+ .direction(FirewallDirection.OUT)
+ .destinationIp("23.0.0.0/32")
+ .build()
+ , new FirewallRule.Builder()
+ .action(FirewallAction.ACCEPT)
+ .comment("Allow SSH traffic to the VM from our office in Dubai")
+ .direction(FirewallDirection.IN)
+ .destinationPort("22")
+ .ipProtocol(FirewallIpProtocol.TCP)
+ .sourceIp("172.66.32.0/24")
+ .build()
+ , new FirewallRule.Builder()
+ .action(FirewallAction.DROP)
+ .comment("Drop all other SSH traffic to the VM")
+ .direction(FirewallDirection.IN)
+ .destinationPort("22")
+ .ipProtocol(FirewallIpProtocol.TCP)
+ .build()
+ , new FirewallRule.Builder()
+ .action(FirewallAction.DROP)
+ .comment("Drop all UDP traffic to the VM, not originating from 172.66.32.55")
+ .direction(FirewallDirection.IN)
+ .ipProtocol(FirewallIpProtocol.UDP)
+ .sourceIp("!172.66.32.55/32")
+ .build()
+ , new FirewallRule.Builder()
+ .action(FirewallAction.DROP)
+ .comment("Drop any traffic, to the VM with destination port not between 1-1024")
+ .direction(FirewallDirection.IN)
+ .destinationPort("!1:1024")
+ .ipProtocol(FirewallIpProtocol.TCP)
+ .build()))
+ .build());
+ assertNotNull(result);
+ }
+
+ @Test
+ public void testEditFirewallPolicy() throws Exception {
+ String uuid = "cf8479b4-c98b-46c8-ab9c-108bb00c8218";
+ CloudSigma2Api api = requestSendsResponse(
+ putBuilder()
+ .endpoint(endpoint + "fwpolicies/" + uuid + "/")
+ .payload(payloadFromResourceWithContentType("/fwpolicies-create-request.json"
+ , MediaType.APPLICATION_JSON))
+ .build()
+ , responseBuilder()
+ .payload(payloadFromResourceWithContentType("/fwpolicies-single.json", MediaType.APPLICATION_JSON))
+ .build());
+
+ FirewallPolicy result = api.editFirewallPolicy(uuid,
+ new FirewallPolicy.Builder()
+ .name("My awesome policy")
+ .rules(ImmutableList.of(
new FirewallRule.Builder()
- .action(FirewallAction.DROP)
- .comment("Drop traffic from the VM to IP address 23.0.0.0/32")
- .direction(FirewallDirection.OUT)
- .destinationIp("23.0.0.0/32")
- .build()
+ .action(FirewallAction.DROP)
+ .comment("Drop traffic from the VM to IP address 23.0.0.0/32")
+ .direction(FirewallDirection.OUT)
+ .destinationIp("23.0.0.0/32")
+ .build()
, new FirewallRule.Builder()
.action(FirewallAction.ACCEPT)
.comment("Allow SSH traffic to the VM from our office in Dubai")
@@ -896,894 +980,848 @@ public class CloudSigma2ApiExpectTest extends BaseRestApiExpectTest<CloudSigma2A
.destinationPort("!1:1024")
.ipProtocol(FirewallIpProtocol.TCP)
.build()))
- .build());
- assertNotNull(result);
- }
-
- @Test
- public void testEditFirewallPolicy() throws Exception {
- String uuid = "cf8479b4-c98b-46c8-ab9c-108bb00c8218";
- CloudSigma2Api api = requestSendsResponse(
- putBuilder()
- .endpoint(endpoint + "fwpolicies/" + uuid + "/")
- .payload(payloadFromResourceWithContentType("/fwpolicies-create-request.json", MediaType.APPLICATION_JSON))
- .build()
- , responseBuilder()
- .payload(payloadFromResourceWithContentType("/fwpolicies-single.json", MediaType.APPLICATION_JSON))
- .build());
-
- FirewallPolicy result = api.editFirewallPolicy(uuid,
- new FirewallPolicy.Builder()
- .name("My awesome policy")
- .rules(ImmutableList.of(
- new FirewallRule.Builder()
- .action(FirewallAction.DROP)
- .comment("Drop traffic from the VM to IP address 23.0.0.0/32")
- .direction(FirewallDirection.OUT)
- .destinationIp("23.0.0.0/32")
- .build()
- , new FirewallRule.Builder()
- .action(FirewallAction.ACCEPT)
- .comment("Allow SSH traffic to the VM from our office in Dubai")
- .direction(FirewallDirection.IN)
- .destinationPort("22")
- .ipProtocol(FirewallIpProtocol.TCP)
- .sourceIp("172.66.32.0/24")
- .build()
- , new FirewallRule.Builder()
- .action(FirewallAction.DROP)
- .comment("Drop all other SSH traffic to the VM")
- .direction(FirewallDirection.IN)
- .destinationPort("22")
- .ipProtocol(FirewallIpProtocol.TCP)
- .build()
- , new FirewallRule.Builder()
- .action(FirewallAction.DROP)
- .comment("Drop all UDP traffic to the VM, not originating from 172.66.32.55")
- .direction(FirewallDirection.IN)
- .ipProtocol(FirewallIpProtocol.UDP)
- .sourceIp("!172.66.32.55/32")
- .build()
- , new FirewallRule.Builder()
- .action(FirewallAction.DROP)
- .comment("Drop any traffic, to the VM with destination port not between 1-1024")
- .direction(FirewallDirection.IN)
- .destinationPort("!1:1024")
- .ipProtocol(FirewallIpProtocol.TCP)
- .build()))
- .build());
- assertNotNull(result);
- }
-
- @Test
- public void testGetVLANInfo() throws Exception {
- String uuid = "96537817-f4b6-496b-a861-e74192d3ccb0";
- CloudSigma2Api api = requestSendsResponse(
- getBuilder()
- .endpoint(endpoint + "vlans/" + uuid + "/")
- .build()
- , responseBuilder()
- .payload(payloadFromResourceWithContentType("/vlan-single.json", MediaType.APPLICATION_JSON))
- .build());
-
- VLANInfo result = api.getVLANInfo(uuid);
- assertNotNull(result);
- }
-
- @Test
- public void testListVLANs() throws Exception {
- CloudSigma2Api api = requestsSendResponses(
- getBuilder()
- .endpoint(endpoint + "vlans/")
- .build()
- , responseBuilder()
- .payload(payloadFromResourceWithContentType("/vlans.json", MediaType.APPLICATION_JSON))
- .build()
- , getBuilder()
- .endpoint(endpoint + "vlans/")
- .addQueryParam("limit", "1")
- .addQueryParam("offset", "1")
- .build()
- , responseBuilder()
- .payload(payloadFromResourceWithContentType("/vlans-last-page.json", MediaType.APPLICATION_JSON))
- .build());
-
- List<VLANInfo> vlans = api.listVLANs().concat().toList();
-
- Assert.assertEquals(vlans.size(), 2);
- Assert.assertEquals(vlans.get(0).getUuid(), "96537817-f4b6-496b-a861-e74192d3ccb0");
- Assert.assertEquals(vlans.get(1).getUuid(), "00b445a9-3936-47e5-ba8a-38adcf43db20");
- }
-
- @Test
- public void testListVLANsPaginatedCollection() throws Exception {
- CloudSigma2Api api = requestSendsResponse(
- getBuilder()
- .endpoint(endpoint + "vlans/?limit=2&offset=2")
- .build()
- , responseBuilder()
- .payload(payloadFromResourceWithContentType("/vlans.json", MediaType.APPLICATION_JSON))
- .build());
-
- for(VLANInfo vlanInfo : api.listVLANs(new PaginationOptions.Builder().limit(2).offset(2).build())){
- assertNotNull(vlanInfo);
- }
- }
-
- @Test
- public void testListVLANInfo() throws Exception {
- CloudSigma2Api api = requestsSendResponses(
- getBuilder()
- .endpoint(endpoint + "vlans/detail/")
- .build()
- , responseBuilder()
- .payload(payloadFromResourceWithContentType("/vlans.json", MediaType.APPLICATION_JSON))
- .build()
- , getBuilder()
- .endpoint(endpoint + "vlans/detail/")
- .addQueryParam("limit", "1")
- .addQueryParam("offset", "1")
- .build()
- , responseBuilder()
- .payload(payloadFromResourceWithContentType("/vlans-last-page.json", MediaType.APPLICATION_JSON))
- .build());
-
- List<VLANInfo> vlanInfos = api.listVLANInfo().concat().toList();
-
- Assert.assertEquals(vlanInfos.size(), 2);
- Assert.assertEquals(vlanInfos.get(0).getUuid(), "96537817-f4b6-496b-a861-e74192d3ccb0");
- Assert.assertEquals(vlanInfos.get(1).getUuid(), "00b445a9-3936-47e5-ba8a-38adcf43db20");
- }
-
- @Test
- public void testListVLANInfoPaginatedCollection() throws Exception {
- CloudSigma2Api api = requestSendsResponse(
- getBuilder()
- .endpoint(endpoint + "vlans/detail/?limit=2&offset=2")
- .build()
- , responseBuilder()
- .payload(payloadFromResourceWithContentType("/vlans.json", MediaType.APPLICATION_JSON))
- .build());
-
- for(VLANInfo vlanInfo : api.listVLANInfo(new PaginationOptions.Builder().limit(2).offset(2).build())){
- assertNotNull(vlanInfo);
- }
- }
-
- @Test
- public void testEditVLAN() throws Exception {
- String uuid = "96537817-f4b6-496b-a861-e74192d3ccb0";
- Map<String, String> meta = new HashMap<String, String>();
- meta.put("description", "test vlan");
- meta.put("test_key_1", "test_value_1");
- meta.put("test_key_2", "test_value_2");
-
- CloudSigma2Api api = requestSendsResponse(
- putBuilder()
- .endpoint(endpoint + "vlans/" + uuid + "/")
- .payload(payloadFromResourceWithContentType("/vlans-edit-request.json", MediaType.APPLICATION_JSON))
- .build()
- , responseBuilder()
- .payload(payloadFromResourceWithContentType("/vlan-single.json", MediaType.APPLICATION_JSON))
- .build());
-
- VLANInfo result = api.editVLAN(uuid
- , new VLANInfo.Builder()
- .meta(meta)
- .build());
- assertNotNull(result);
- }
-
- @Test
- public void testListIPs() throws Exception {
- CloudSigma2Api api = requestsSendResponses(
- getBuilder()
- .endpoint(endpoint + "ips/")
- .build()
- , responseBuilder()
- .payload(payloadFromResourceWithContentType("/ips.json", MediaType.APPLICATION_JSON))
- .build()
- , getBuilder()
- .endpoint(endpoint + "ips/")
- .addQueryParam("limit", "1")
- .addQueryParam("offset", "1")
- .build()
- , responseBuilder()
- .payload(payloadFromResourceWithContentType("/ips-last-page.json", MediaType.APPLICATION_JSON))
- .build());
-
- List<IP> ips = api.listIPs().concat().toList();
-
- Assert.assertEquals(ips.size(), 2);
- Assert.assertEquals(ips.get(0).getUuid(), "185.12.6.183");
- Assert.assertEquals(ips.get(1).getUuid(), "185.12.5.233");
- }
-
- @Test
- public void testListIPsPaginatedCollection() throws Exception {
- CloudSigma2Api api = requestSendsResponse(
- getBuilder()
- .endpoint(endpoint + "ips/?limit=2&offset=2")
- .build()
- , responseBuilder()
- .payload(payloadFromResourceWithContentType("/ips.json", MediaType.APPLICATION_JSON))
- .build());
-
- for(IP ip : api.listIPs(new PaginationOptions.Builder().limit(2).offset(2).build())){
- assertNotNull(ip);
- }
- }
-
- @Test
- public void testListIPInfo() throws Exception {
- CloudSigma2Api api = requestsSendResponses(
- getBuilder()
- .endpoint(endpoint + "ips/detail/")
- .build()
- , responseBuilder()
- .payload(payloadFromResourceWithContentType("/ips.json", MediaType.APPLICATION_JSON))
- .build()
- , getBuilder()
- .endpoint(endpoint + "ips/detail/")
- .addQueryParam("limit", "1")
- .addQueryParam("offset", "1")
- .build()
- , responseBuilder()
- .payload(payloadFromResourceWithContentType("/ips-last-page.json", MediaType.APPLICATION_JSON))
- .build());
-
- List<IPInfo> ipInfos = api.listIPInfo().concat().toList();
-
- Assert.assertEquals(ipInfos.size(), 2);
- Assert.assertEquals(ipInfos.get(0).getUuid(), "185.12.6.183");
- Assert.assertEquals(ipInfos.get(1).getUuid(), "185.12.5.233");
- }
-
- @Test
- public void testListIPInfoPaginatedCollection() throws Exception {
- CloudSigma2Api api = requestSendsResponse(
- getBuilder()
- .endpoint(endpoint + "ips/detail/?limit=2&offset=2")
- .build()
- , responseBuilder()
- .payload(payloadFromResourceWithContentType("/ips.json", MediaType.APPLICATION_JSON))
- .build());
-
- for(IPInfo ipInfo : api.listIPInfo(new PaginationOptions.Builder().limit(2).offset(2).build())){
- assertNotNull(ipInfo);
- }
- }
-
- @Test
- public void testGetIPInfo() throws Exception {
- String uuid = "185.12.6.183";
- CloudSigma2Api api = requestSendsResponse(
- getBuilder()
- .endpoint(endpoint + "ips/" + uuid + "/")
- .build()
- , responseBuilder()
- .payload(payloadFromResourceWithContentType("/ips-single.json", MediaType.APPLICATION_JSON))
- .build());
-
- IPInfo result = api.getIPInfo(uuid);
- assertNotNull(result);
- }
-
- @Test
- public void testEditIP() throws Exception {
- String uuid = "96537817-f4b6-496b-a861-e74192d3ccb0";
- Map<String, String> meta = new HashMap<String, String>();
- meta.put("description", "test vlan");
- meta.put("test_key_1", "test_value_1");
- meta.put("test_key_2", "test_value_2");
-
- CloudSigma2Api api = requestSendsResponse(
- putBuilder()
- .endpoint(endpoint + "ips/" + uuid + "/")
- .payload(payloadFromResourceWithContentType("/ips-edit-request.json", MediaType.APPLICATION_JSON))
- .build()
- , responseBuilder()
- .payload(payloadFromResourceWithContentType("/ips-single.json", MediaType.APPLICATION_JSON))
- .build());
-
- IPInfo result = api.editIP(uuid
- , new IPInfo.Builder()
- .meta(meta)
- .build());
- assertNotNull(result);
- }
-
- @Test
- public void testListTags() throws Exception {
- CloudSigma2Api api = requestsSendResponses(
- getBuilder()
- .endpoint(endpoint + "tags/")
- .build()
- , responseBuilder()
- .payload(payloadFromResourceWithContentType("/tags-detail-first-page.json", MediaType.APPLICATION_JSON))
- .build()
- , getBuilder()
- .endpoint(endpoint + "tags/")
- .addQueryParam("limit", "1")
- .addQueryParam("offset", "1")
- .build()
- , responseBuilder()
- .payload(payloadFromResourceWithContentType("/tags-detail-last-page.json", MediaType.APPLICATION_JSON))
- .build());
-
- List<Tag> tags = api.listTags().concat().toList();
-
- Assert.assertEquals(tags.size(), 2);
- Assert.assertEquals(tags.get(0).getUuid(), "956e2ca0-dee3-4b3f-a1be-a6e86f90946f");
- Assert.assertEquals(tags.get(1).getUuid(), "68bb0cfc-0c76-4f37-847d-7bb705c5ae46");
- }
-
- @Test
- public void testListTagsPaginatedCollection() throws Exception {
- CloudSigma2Api api = requestSendsResponse(
- getBuilder()
- .endpoint(endpoint + "tags/?limit=2&offset=2")
- .build()
- , responseBuilder()
- .payload(payloadFromResourceWithContentType("/tags-detail.json", MediaType.APPLICATION_JSON))
- .build());
-
- for(Tag tag : api.listTags(new PaginationOptions.Builder().limit(2).offset(2).build())){
- assertNotNull(tag);
- }
- }
-
- @Test
- public void testListTagsInfo() throws Exception {
- CloudSigma2Api api = requestsSendResponses(
- getBuilder()
- .endpoint(endpoint + "tags/detail/")
- .build()
- , responseBuilder()
- .payload(payloadFromResourceWithContentType("/tags-detail-first-page.json", MediaType.APPLICATION_JSON))
- .build()
- , getBuilder()
- .endpoint(endpoint + "tags/detail/")
- .addQueryParam("limit", "1")
- .addQueryParam("offset", "1")
- .build()
- , responseBuilder()
- .payload(payloadFromResourceWithContentType("/tags-detail-last-page.json", MediaType.APPLICATION_JSON))
- .build());
-
- List<Tag> tags = api.listTagsInfo().concat().toList();
-
- Assert.assertEquals(tags.size(), 2);
- Assert.assertEquals(tags.get(0).getUuid(), "956e2ca0-dee3-4b3f-a1be-a6e86f90946f");
- Assert.assertEquals(tags.get(1).getUuid(), "68bb0cfc-0c76-4f37-847d-7bb705c5ae46");
- }
-
-
- @Test
- public void testListTagsInfoPaginatedCollection() throws Exception {
- CloudSigma2Api api = requestSendsResponse(
- getBuilder()
- .endpoint(endpoint + "tags/detail/?limit=2&offset=2")
- .build()
- , responseBuilder()
- .payload(payloadFromResourceWithContentType("/tags-detail.json", MediaType.APPLICATION_JSON))
- .build());
-
- for(Tag tag : api.listTagsInfo(new PaginationOptions.Builder().limit(2).offset(2).build())){
- assertNotNull(tag);
- }
- }
-
- @Test
- public void testGetTagInfo() throws Exception {
-
<TRUNCATED>
[10/13] Fix code style of the cloudsigma2 provider.
Posted by na...@apache.org.
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0d70c84a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindCreateSubscriptionRequest.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindCreateSubscriptionRequest.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindCreateSubscriptionRequest.java
index 92c0eab..5a857f0 100644
--- a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindCreateSubscriptionRequest.java
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindCreateSubscriptionRequest.java
@@ -34,21 +34,22 @@ import static com.google.common.base.Preconditions.checkArgument;
@Singleton
public class BindCreateSubscriptionRequest implements Binder {
- private final CreateSubscriptionRequestToJson subscriptionRequestJsonObjectFunction;
-
- @Inject
- public BindCreateSubscriptionRequest(CreateSubscriptionRequestToJson subscriptionRequestJsonObjectFunction) {
- this.subscriptionRequestJsonObjectFunction = subscriptionRequestJsonObjectFunction;
- }
-
- @Override
- public <R extends HttpRequest> R bindToRequest(R request, Object input) {
- checkArgument(input instanceof CreateSubscriptionRequest, "this binder is only valid for CreateSubscriptionRequest!");
- CreateSubscriptionRequest create = CreateSubscriptionRequest.class.cast(input);
- JsonObject subscriptionObject = subscriptionRequestJsonObjectFunction.apply(create);
-
- request.setPayload(subscriptionObject.toString());
- request.getPayload().getContentMetadata().setContentType(MediaType.APPLICATION_JSON);
- return request;
- }
+ private final CreateSubscriptionRequestToJson subscriptionRequestJsonObjectFunction;
+
+ @Inject
+ public BindCreateSubscriptionRequest(CreateSubscriptionRequestToJson subscriptionRequestJsonObjectFunction) {
+ this.subscriptionRequestJsonObjectFunction = subscriptionRequestJsonObjectFunction;
+ }
+
+ @Override
+ public <R extends HttpRequest> R bindToRequest(R request, Object input) {
+ checkArgument(input instanceof CreateSubscriptionRequest
+ , "this binder is only valid for CreateSubscriptionRequest!");
+ CreateSubscriptionRequest create = CreateSubscriptionRequest.class.cast(input);
+ JsonObject subscriptionObject = subscriptionRequestJsonObjectFunction.apply(create);
+
+ request.setPayload(subscriptionObject.toString());
+ request.getPayload().getContentMetadata().setContentType(MediaType.APPLICATION_JSON);
+ return request;
+ }
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0d70c84a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindCreateSubscriptionRequestList.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindCreateSubscriptionRequestList.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindCreateSubscriptionRequestList.java
index 45fe4a2..706bf9c 100644
--- a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindCreateSubscriptionRequestList.java
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindCreateSubscriptionRequestList.java
@@ -36,33 +36,34 @@ import static com.google.common.base.Preconditions.checkArgument;
@Singleton
public class BindCreateSubscriptionRequestList implements Binder {
- private final CreateSubscriptionRequestToJson subscriptionRequestJsonObjectFunction;
+ private final CreateSubscriptionRequestToJson subscriptionRequestJsonObjectFunction;
- @Inject
- public BindCreateSubscriptionRequestList(CreateSubscriptionRequestToJson subscriptionRequestJsonObjectFunction) {
- this.subscriptionRequestJsonObjectFunction = subscriptionRequestJsonObjectFunction;
- }
+ @Inject
+ public BindCreateSubscriptionRequestList(CreateSubscriptionRequestToJson subscriptionRequestJsonObjectFunction) {
+ this.subscriptionRequestJsonObjectFunction = subscriptionRequestJsonObjectFunction;
+ }
- @Override
- public <R extends HttpRequest> R bindToRequest(R request, Object input) {
- checkArgument(input instanceof List, "this binder is only valid for List<CreateSubscriptionRequest>!");
- List list = List.class.cast(input);
- for(Object o : list){
- checkArgument(o instanceof CreateSubscriptionRequest, "this binder is only valid for List<CreateSubscriptionRequest>!");
- }
- List<CreateSubscriptionRequest> createSubscriptionRequests = (List<CreateSubscriptionRequest>) input;
- JsonArray subscriptionsJsonArray = new JsonArray();
+ @Override
+ public <R extends HttpRequest> R bindToRequest(R request, Object input) {
+ checkArgument(input instanceof List, "this binder is only valid for List<CreateSubscriptionRequest>!");
+ List list = List.class.cast(input);
+ for (Object o : list) {
+ checkArgument(o instanceof CreateSubscriptionRequest
+ , "this binder is only valid for List<CreateSubscriptionRequest>!");
+ }
+ List<CreateSubscriptionRequest> createSubscriptionRequests = (List<CreateSubscriptionRequest>) input;
+ JsonArray subscriptionsJsonArray = new JsonArray();
- for(CreateSubscriptionRequest createSubscriptionRequest : createSubscriptionRequests){
- JsonObject sunbscriptionRequestObject = subscriptionRequestJsonObjectFunction.apply(createSubscriptionRequest);
- subscriptionsJsonArray.add(sunbscriptionRequestObject);
- }
+ for (CreateSubscriptionRequest createSubscriptionRequest : createSubscriptionRequests) {
+ JsonObject sunbscriptionRequestObject = subscriptionRequestJsonObjectFunction.apply(createSubscriptionRequest);
+ subscriptionsJsonArray.add(sunbscriptionRequestObject);
+ }
- JsonObject json = new JsonObject();
- json.add("objects", subscriptionsJsonArray);
+ JsonObject json = new JsonObject();
+ json.add("objects", subscriptionsJsonArray);
- request.setPayload(json.toString());
- request.getPayload().getContentMetadata().setContentType(MediaType.APPLICATION_JSON);
- return request;
- }
+ request.setPayload(json.toString());
+ request.getPayload().getContentMetadata().setContentType(MediaType.APPLICATION_JSON);
+ return request;
+ }
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0d70c84a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindDriveToJson.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindDriveToJson.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindDriveToJson.java
index 73d72ce..30e20ea 100644
--- a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindDriveToJson.java
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindDriveToJson.java
@@ -29,26 +29,26 @@ import javax.ws.rs.core.MediaType;
import static com.google.common.base.Preconditions.checkArgument;
/**
- *
* @author Vladimir Shevchenko
*/
@Singleton
public class BindDriveToJson implements Binder {
- private final DriveToJson createDriveRequestToJson;
-
- @Inject
- public BindDriveToJson(DriveToJson createDriveRequestToJson) {
- this.createDriveRequestToJson = createDriveRequestToJson;
- }
- @Override
- public <R extends HttpRequest> R bindToRequest(R request, Object payload) {
- checkArgument(payload instanceof DriveInfo, "this binder is only valid for DriveInfo!");
- DriveInfo create = DriveInfo.class.cast(payload);
- JsonObject driveJson = createDriveRequestToJson.apply(create);
-
- request.setPayload(driveJson.toString());
- request.getPayload().getContentMetadata().setContentType(MediaType.APPLICATION_JSON);
- return request;
- }
+ private final DriveToJson createDriveRequestToJson;
+
+ @Inject
+ public BindDriveToJson(DriveToJson createDriveRequestToJson) {
+ this.createDriveRequestToJson = createDriveRequestToJson;
+ }
+
+ @Override
+ public <R extends HttpRequest> R bindToRequest(R request, Object payload) {
+ checkArgument(payload instanceof DriveInfo, "this binder is only valid for DriveInfo!");
+ DriveInfo create = DriveInfo.class.cast(payload);
+ JsonObject driveJson = createDriveRequestToJson.apply(create);
+
+ request.setPayload(driveJson.toString());
+ request.getPayload().getContentMetadata().setContentType(MediaType.APPLICATION_JSON);
+ return request;
+ }
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0d70c84a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindDrivesToJson.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindDrivesToJson.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindDrivesToJson.java
index 869168f..c387243 100644
--- a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindDrivesToJson.java
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindDrivesToJson.java
@@ -35,32 +35,33 @@ import static com.google.common.base.Preconditions.checkArgument;
*/
@Singleton
public class BindDrivesToJson implements Binder {
- private final DriveToJson createDriveRequestJson;
+ private final DriveToJson createDriveRequestJson;
- @Inject
- public BindDrivesToJson(DriveToJson createDriveRequestToMap) {
- this.createDriveRequestJson = createDriveRequestToMap;
- }
- @Override
- public <R extends HttpRequest> R bindToRequest(R request, Object payload) {
- checkArgument(payload instanceof List, "this binder is only valid for List<DriveInfo>!");
- List list = List.class.cast(payload);
- for(Object o : list){
- checkArgument(o instanceof DriveInfo, "this binder is only valid for List<DriveInfo>!");
- }
- List<DriveInfo> drivesList = (List<DriveInfo>) payload;
- JsonArray drivesJsonArray = new JsonArray();
+ @Inject
+ public BindDrivesToJson(DriveToJson createDriveRequestToMap) {
+ this.createDriveRequestJson = createDriveRequestToMap;
+ }
- for(DriveInfo drive : drivesList){
- JsonObject driveObject = createDriveRequestJson.apply(drive);
- drivesJsonArray.add(driveObject);
- }
+ @Override
+ public <R extends HttpRequest> R bindToRequest(R request, Object payload) {
+ checkArgument(payload instanceof List, "this binder is only valid for List<DriveInfo>!");
+ List list = List.class.cast(payload);
+ for (Object o : list) {
+ checkArgument(o instanceof DriveInfo, "this binder is only valid for List<DriveInfo>!");
+ }
+ List<DriveInfo> drivesList = (List<DriveInfo>) payload;
+ JsonArray drivesJsonArray = new JsonArray();
- JsonObject json = new JsonObject();
- json.add("objects", drivesJsonArray);
+ for (DriveInfo drive : drivesList) {
+ JsonObject driveObject = createDriveRequestJson.apply(drive);
+ drivesJsonArray.add(driveObject);
+ }
- request.setPayload(json.toString());
- request.getPayload().getContentMetadata().setContentType(MediaType.APPLICATION_JSON);
- return request;
- }
+ JsonObject json = new JsonObject();
+ json.add("objects", drivesJsonArray);
+
+ request.setPayload(json.toString());
+ request.getPayload().getContentMetadata().setContentType(MediaType.APPLICATION_JSON);
+ return request;
+ }
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0d70c84a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindFirewallPoliciesListToJsonRequest.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindFirewallPoliciesListToJsonRequest.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindFirewallPoliciesListToJsonRequest.java
index 2f7f45c..84b0235 100644
--- a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindFirewallPoliciesListToJsonRequest.java
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindFirewallPoliciesListToJsonRequest.java
@@ -34,33 +34,33 @@ import static com.google.common.base.Preconditions.checkArgument;
*/
public class BindFirewallPoliciesListToJsonRequest implements Binder {
- private final FirewallPolicyToJson policyJsonObjectFunction;
+ private final FirewallPolicyToJson policyJsonObjectFunction;
- @Inject
- public BindFirewallPoliciesListToJsonRequest(FirewallPolicyToJson policyJsonObjectFunction) {
- this.policyJsonObjectFunction = policyJsonObjectFunction;
- }
+ @Inject
+ public BindFirewallPoliciesListToJsonRequest(FirewallPolicyToJson policyJsonObjectFunction) {
+ this.policyJsonObjectFunction = policyJsonObjectFunction;
+ }
- @Override
- public <R extends HttpRequest> R bindToRequest(R request, Object input) {
- checkArgument(input instanceof List, "this binder is only valid for List<FirewallPolicy>!");
- List list = List.class.cast(input);
- for(Object o : list){
- checkArgument(o instanceof FirewallPolicy, "this binder is only valid for List<FirewallPolicy>!");
- }
- List<FirewallPolicy> firewallPolicies = (List<FirewallPolicy>) input;
- JsonArray firewalsJsonArray = new JsonArray();
+ @Override
+ public <R extends HttpRequest> R bindToRequest(R request, Object input) {
+ checkArgument(input instanceof List, "this binder is only valid for List<FirewallPolicy>!");
+ List list = List.class.cast(input);
+ for (Object o : list) {
+ checkArgument(o instanceof FirewallPolicy, "this binder is only valid for List<FirewallPolicy>!");
+ }
+ List<FirewallPolicy> firewallPolicies = (List<FirewallPolicy>) input;
+ JsonArray firewalsJsonArray = new JsonArray();
- for(FirewallPolicy firewallPolicy : firewallPolicies){
- JsonObject firewallObject = policyJsonObjectFunction.apply(firewallPolicy);
- firewalsJsonArray.add(firewallObject);
- }
+ for (FirewallPolicy firewallPolicy : firewallPolicies) {
+ JsonObject firewallObject = policyJsonObjectFunction.apply(firewallPolicy);
+ firewalsJsonArray.add(firewallObject);
+ }
- JsonObject json = new JsonObject();
- json.add("objects", firewalsJsonArray);
+ JsonObject json = new JsonObject();
+ json.add("objects", firewalsJsonArray);
- request.setPayload(json.toString());
- request.getPayload().getContentMetadata().setContentType(MediaType.APPLICATION_JSON);
- return request;
- }
+ request.setPayload(json.toString());
+ request.getPayload().getContentMetadata().setContentType(MediaType.APPLICATION_JSON);
+ return request;
+ }
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0d70c84a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindFirewallPolicyToJsonRequest.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindFirewallPolicyToJsonRequest.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindFirewallPolicyToJsonRequest.java
index f86d981..e306015 100644
--- a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindFirewallPolicyToJsonRequest.java
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindFirewallPolicyToJsonRequest.java
@@ -34,21 +34,21 @@ import static com.google.common.base.Preconditions.checkArgument;
@Singleton
public class BindFirewallPolicyToJsonRequest implements Binder {
- private final FirewallPolicyToJson policyJsonObjectFunction;
-
- @Inject
- public BindFirewallPolicyToJsonRequest(FirewallPolicyToJson policyJsonObjectFunction) {
- this.policyJsonObjectFunction = policyJsonObjectFunction;
- }
-
- @Override
- public <R extends HttpRequest> R bindToRequest(R request, Object input) {
- checkArgument(input instanceof FirewallPolicy, "this binder is only valid for FirewallPolicy!");
- FirewallPolicy create = FirewallPolicy.class.cast(input);
- JsonObject firewallJsonObject = policyJsonObjectFunction.apply(create);
-
- request.setPayload(firewallJsonObject.toString());
- request.getPayload().getContentMetadata().setContentType(MediaType.APPLICATION_JSON);
- return request;
- }
+ private final FirewallPolicyToJson policyJsonObjectFunction;
+
+ @Inject
+ public BindFirewallPolicyToJsonRequest(FirewallPolicyToJson policyJsonObjectFunction) {
+ this.policyJsonObjectFunction = policyJsonObjectFunction;
+ }
+
+ @Override
+ public <R extends HttpRequest> R bindToRequest(R request, Object input) {
+ checkArgument(input instanceof FirewallPolicy, "this binder is only valid for FirewallPolicy!");
+ FirewallPolicy create = FirewallPolicy.class.cast(input);
+ JsonObject firewallJsonObject = policyJsonObjectFunction.apply(create);
+
+ request.setPayload(firewallJsonObject.toString());
+ request.getPayload().getContentMetadata().setContentType(MediaType.APPLICATION_JSON);
+ return request;
+ }
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0d70c84a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindIPInfoToJsonRequest.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindIPInfoToJsonRequest.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindIPInfoToJsonRequest.java
index db2586d..98b1fae 100644
--- a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindIPInfoToJsonRequest.java
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindIPInfoToJsonRequest.java
@@ -34,21 +34,21 @@ import static com.google.common.base.Preconditions.checkArgument;
@Singleton
public class BindIPInfoToJsonRequest implements Binder {
- private final IPInfoToJson ipInfoJsonObjectFunction;
-
- @Inject
- public BindIPInfoToJsonRequest(IPInfoToJson ipInfoJsonObjectFunction) {
- this.ipInfoJsonObjectFunction = ipInfoJsonObjectFunction;
- }
-
- @Override
- public <R extends HttpRequest> R bindToRequest(R request, Object input) {
- checkArgument(input instanceof IPInfo, "this binder is only valid for IPInfo!");
- IPInfo create = IPInfo.class.cast(input);
- JsonObject ipJsonObject = ipInfoJsonObjectFunction.apply(create);
-
- request.setPayload(ipJsonObject.toString());
- request.getPayload().getContentMetadata().setContentType(MediaType.APPLICATION_JSON);
- return request;
- }
+ private final IPInfoToJson ipInfoJsonObjectFunction;
+
+ @Inject
+ public BindIPInfoToJsonRequest(IPInfoToJson ipInfoJsonObjectFunction) {
+ this.ipInfoJsonObjectFunction = ipInfoJsonObjectFunction;
+ }
+
+ @Override
+ public <R extends HttpRequest> R bindToRequest(R request, Object input) {
+ checkArgument(input instanceof IPInfo, "this binder is only valid for IPInfo!");
+ IPInfo create = IPInfo.class.cast(input);
+ JsonObject ipJsonObject = ipInfoJsonObjectFunction.apply(create);
+
+ request.setPayload(ipJsonObject.toString());
+ request.getPayload().getContentMetadata().setContentType(MediaType.APPLICATION_JSON);
+ return request;
+ }
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0d70c84a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindLibraryDriveToJson.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindLibraryDriveToJson.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindLibraryDriveToJson.java
index bd3c8d0..10a3f38 100644
--- a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindLibraryDriveToJson.java
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindLibraryDriveToJson.java
@@ -34,20 +34,20 @@ import static com.google.common.base.Preconditions.checkArgument;
@Singleton
public class BindLibraryDriveToJson implements Binder {
- private final LibraryDriveToJson createDriveJsonObjectFunction;
+ private final LibraryDriveToJson createDriveJsonObjectFunction;
- @Inject
- public BindLibraryDriveToJson(LibraryDriveToJson createDriveJsonObjectFunction) {
- this.createDriveJsonObjectFunction = createDriveJsonObjectFunction;
- }
+ @Inject
+ public BindLibraryDriveToJson(LibraryDriveToJson createDriveJsonObjectFunction) {
+ this.createDriveJsonObjectFunction = createDriveJsonObjectFunction;
+ }
- @Override
- public <R extends HttpRequest> R bindToRequest(R request, Object input) {
- checkArgument(input instanceof LibraryDrive, "this binder is only valid for LibraryDrive!");
- LibraryDrive create = LibraryDrive.class.cast(input);
- JsonObject profileInfoJsonObject = createDriveJsonObjectFunction.apply(create);
- request.setPayload(profileInfoJsonObject.toString());
- request.getPayload().getContentMetadata().setContentType(MediaType.APPLICATION_JSON);
- return request;
- }
+ @Override
+ public <R extends HttpRequest> R bindToRequest(R request, Object input) {
+ checkArgument(input instanceof LibraryDrive, "this binder is only valid for LibraryDrive!");
+ LibraryDrive create = LibraryDrive.class.cast(input);
+ JsonObject profileInfoJsonObject = createDriveJsonObjectFunction.apply(create);
+ request.setPayload(profileInfoJsonObject.toString());
+ request.getPayload().getContentMetadata().setContentType(MediaType.APPLICATION_JSON);
+ return request;
+ }
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0d70c84a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindProfileInfoToJsonRequest.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindProfileInfoToJsonRequest.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindProfileInfoToJsonRequest.java
index 7026f15..6fca184 100644
--- a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindProfileInfoToJsonRequest.java
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindProfileInfoToJsonRequest.java
@@ -34,20 +34,20 @@ import static com.google.common.base.Preconditions.checkArgument;
@Singleton
public class BindProfileInfoToJsonRequest implements Binder {
- private final ProfileInfoToJson createProfileRequestToJson;
+ private final ProfileInfoToJson createProfileRequestToJson;
- @Inject
- public BindProfileInfoToJsonRequest(ProfileInfoToJson createProfileRequestToJson) {
- this.createProfileRequestToJson = createProfileRequestToJson;
- }
+ @Inject
+ public BindProfileInfoToJsonRequest(ProfileInfoToJson createProfileRequestToJson) {
+ this.createProfileRequestToJson = createProfileRequestToJson;
+ }
- @Override
- public <R extends HttpRequest> R bindToRequest(R request, Object input) {
- checkArgument(input instanceof ProfileInfo, "this binder is only valid for ProfileInfo!");
- ProfileInfo create = ProfileInfo.class.cast(input);
- JsonObject profileInfoJsonObject = createProfileRequestToJson.apply(create);
- request.setPayload(profileInfoJsonObject.toString());
- request.getPayload().getContentMetadata().setContentType(MediaType.APPLICATION_JSON);
- return request;
- }
+ @Override
+ public <R extends HttpRequest> R bindToRequest(R request, Object input) {
+ checkArgument(input instanceof ProfileInfo, "this binder is only valid for ProfileInfo!");
+ ProfileInfo create = ProfileInfo.class.cast(input);
+ JsonObject profileInfoJsonObject = createProfileRequestToJson.apply(create);
+ request.setPayload(profileInfoJsonObject.toString());
+ request.getPayload().getContentMetadata().setContentType(MediaType.APPLICATION_JSON);
+ return request;
+ }
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0d70c84a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindServerInfoListToJsonRequest.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindServerInfoListToJsonRequest.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindServerInfoListToJsonRequest.java
index ee3fdb5..a7210c3 100644
--- a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindServerInfoListToJsonRequest.java
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindServerInfoListToJsonRequest.java
@@ -35,32 +35,33 @@ import static com.google.common.base.Preconditions.checkArgument;
*/
@Singleton
public class BindServerInfoListToJsonRequest implements Binder {
- private final ServerInfoToJson createServerInfoRequestToJson;
+ private final ServerInfoToJson createServerInfoRequestToJson;
- @Inject
- public BindServerInfoListToJsonRequest(ServerInfoToJson createServerInfoRequestToJson) {
- this.createServerInfoRequestToJson = createServerInfoRequestToJson;
- }
- @Override
- public <R extends HttpRequest> R bindToRequest(R request, Object payload) {
- checkArgument(payload instanceof List, "this binder is only valid for List<ServerInfo>!");
- List list = List.class.cast(payload);
- for(Object o : list){
- checkArgument(o instanceof ServerInfo, "this binder is only valid for List<ServerInfo>!");
- }
- Iterable<ServerInfo> serverInfoList = (Iterable<ServerInfo>) payload;
- JsonArray serversJsonArray = new JsonArray();
+ @Inject
+ public BindServerInfoListToJsonRequest(ServerInfoToJson createServerInfoRequestToJson) {
+ this.createServerInfoRequestToJson = createServerInfoRequestToJson;
+ }
- for(ServerInfo serverInfo : serverInfoList){
- JsonObject driveObject = createServerInfoRequestToJson.apply(serverInfo);
- serversJsonArray.add(driveObject);
- }
+ @Override
+ public <R extends HttpRequest> R bindToRequest(R request, Object payload) {
+ checkArgument(payload instanceof List, "this binder is only valid for List<ServerInfo>!");
+ List list = List.class.cast(payload);
+ for (Object o : list) {
+ checkArgument(o instanceof ServerInfo, "this binder is only valid for List<ServerInfo>!");
+ }
+ Iterable<ServerInfo> serverInfoList = (Iterable<ServerInfo>) payload;
+ JsonArray serversJsonArray = new JsonArray();
- JsonObject json = new JsonObject();
- json.add("objects", serversJsonArray);
+ for (ServerInfo serverInfo : serverInfoList) {
+ JsonObject driveObject = createServerInfoRequestToJson.apply(serverInfo);
+ serversJsonArray.add(driveObject);
+ }
- request.setPayload(json.toString());
- request.getPayload().getContentMetadata().setContentType(MediaType.APPLICATION_JSON);
- return request;
- }
+ JsonObject json = new JsonObject();
+ json.add("objects", serversJsonArray);
+
+ request.setPayload(json.toString());
+ request.getPayload().getContentMetadata().setContentType(MediaType.APPLICATION_JSON);
+ return request;
+ }
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0d70c84a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindServerInfoToJsonRequest.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindServerInfoToJsonRequest.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindServerInfoToJsonRequest.java
index 0e557f8..76eabab 100644
--- a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindServerInfoToJsonRequest.java
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindServerInfoToJsonRequest.java
@@ -33,21 +33,21 @@ import static com.google.common.base.Preconditions.checkArgument;
*/
@Singleton
public class BindServerInfoToJsonRequest implements Binder {
- private final ServerInfoToJson createServerInfoRequestToJson;
+ private final ServerInfoToJson createServerInfoRequestToJson;
- @Inject
- public BindServerInfoToJsonRequest(ServerInfoToJson createServerInfoRequestToJson) {
- this.createServerInfoRequestToJson = createServerInfoRequestToJson;
- }
+ @Inject
+ public BindServerInfoToJsonRequest(ServerInfoToJson createServerInfoRequestToJson) {
+ this.createServerInfoRequestToJson = createServerInfoRequestToJson;
+ }
- @Override
- public <R extends HttpRequest> R bindToRequest(R request, Object input) {
- checkArgument(input instanceof ServerInfo, "this binder is only valid for ServerInfo!");
- ServerInfo create = ServerInfo.class.cast(input);
+ @Override
+ public <R extends HttpRequest> R bindToRequest(R request, Object input) {
+ checkArgument(input instanceof ServerInfo, "this binder is only valid for ServerInfo!");
+ ServerInfo create = ServerInfo.class.cast(input);
- JsonObject serverInfoJson = createServerInfoRequestToJson.apply(create);
- request.setPayload(serverInfoJson.toString());
- request.getPayload().getContentMetadata().setContentType(MediaType.APPLICATION_JSON);
- return request;
- }
+ JsonObject serverInfoJson = createServerInfoRequestToJson.apply(create);
+ request.setPayload(serverInfoJson.toString());
+ request.getPayload().getContentMetadata().setContentType(MediaType.APPLICATION_JSON);
+ return request;
+ }
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0d70c84a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindTagListToJsonRequest.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindTagListToJsonRequest.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindTagListToJsonRequest.java
index aff2c4b..8e1c9ff 100644
--- a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindTagListToJsonRequest.java
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindTagListToJsonRequest.java
@@ -35,33 +35,33 @@ import static com.google.common.base.Preconditions.checkArgument;
*/
@Singleton
public class BindTagListToJsonRequest implements Binder {
- private final TagToJson tagJsonObjectFunction;
+ private final TagToJson tagJsonObjectFunction;
- @Inject
- public BindTagListToJsonRequest(TagToJson tagJsonObjectFunction) {
- this.tagJsonObjectFunction = tagJsonObjectFunction;
- }
+ @Inject
+ public BindTagListToJsonRequest(TagToJson tagJsonObjectFunction) {
+ this.tagJsonObjectFunction = tagJsonObjectFunction;
+ }
- @Override
- public <R extends HttpRequest> R bindToRequest(R request, Object payload) {
- checkArgument(payload instanceof List, "this binder is only valid for List<Tag>!");
- List list = List.class.cast(payload);
- for(Object o : list){
- checkArgument(o instanceof Tag, "this binder is only valid for List<Tag>!");
- }
- Iterable<Tag> tags = (Iterable<Tag>) payload;
- JsonArray tagJsonArray = new JsonArray();
+ @Override
+ public <R extends HttpRequest> R bindToRequest(R request, Object payload) {
+ checkArgument(payload instanceof List, "this binder is only valid for List<Tag>!");
+ List list = List.class.cast(payload);
+ for (Object o : list) {
+ checkArgument(o instanceof Tag, "this binder is only valid for List<Tag>!");
+ }
+ Iterable<Tag> tags = (Iterable<Tag>) payload;
+ JsonArray tagJsonArray = new JsonArray();
- for(Tag tag : tags){
- JsonObject driveObject = tagJsonObjectFunction.apply(tag);
- tagJsonArray.add(driveObject);
- }
+ for (Tag tag : tags) {
+ JsonObject driveObject = tagJsonObjectFunction.apply(tag);
+ tagJsonArray.add(driveObject);
+ }
- JsonObject json = new JsonObject();
- json.add("objects", tagJsonArray);
+ JsonObject json = new JsonObject();
+ json.add("objects", tagJsonArray);
- request.setPayload(json.toString());
- request.getPayload().getContentMetadata().setContentType(MediaType.APPLICATION_JSON);
- return request;
- }
+ request.setPayload(json.toString());
+ request.getPayload().getContentMetadata().setContentType(MediaType.APPLICATION_JSON);
+ return request;
+ }
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0d70c84a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindTagToJsonRequest.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindTagToJsonRequest.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindTagToJsonRequest.java
index ac0f1db..b82c0b7 100644
--- a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindTagToJsonRequest.java
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindTagToJsonRequest.java
@@ -33,22 +33,22 @@ import static com.google.common.base.Preconditions.checkArgument;
*/
@Singleton
public class BindTagToJsonRequest implements Binder {
- private final TagToJson createTagRequestToJson;
-
- @Inject
- public BindTagToJsonRequest(TagToJson createTagRequestToJson) {
- this.createTagRequestToJson = createTagRequestToJson;
- }
-
- @Override
- public <R extends HttpRequest> R bindToRequest(R request, Object input) {
- checkArgument(input instanceof Tag, "this binder is only valid for Tag!");
- Tag create = Tag.class.cast(input);
-
- JsonObject serverInfoJson = createTagRequestToJson.apply(create);
- request.setPayload(serverInfoJson.toString());
- request.getPayload().getContentMetadata().setContentType(MediaType.APPLICATION_JSON);
- return request;
- }
+ private final TagToJson createTagRequestToJson;
+
+ @Inject
+ public BindTagToJsonRequest(TagToJson createTagRequestToJson) {
+ this.createTagRequestToJson = createTagRequestToJson;
+ }
+
+ @Override
+ public <R extends HttpRequest> R bindToRequest(R request, Object input) {
+ checkArgument(input instanceof Tag, "this binder is only valid for Tag!");
+ Tag create = Tag.class.cast(input);
+
+ JsonObject serverInfoJson = createTagRequestToJson.apply(create);
+ request.setPayload(serverInfoJson.toString());
+ request.getPayload().getContentMetadata().setContentType(MediaType.APPLICATION_JSON);
+ return request;
+ }
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0d70c84a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindUuidStringsToJsonArray.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindUuidStringsToJsonArray.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindUuidStringsToJsonArray.java
index 12991a1..7327808 100644
--- a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindUuidStringsToJsonArray.java
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindUuidStringsToJsonArray.java
@@ -18,7 +18,6 @@ package org.jclouds.cloudsigma2.binders;
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
-import org.jclouds.cloudsigma2.domain.ServerInfo;
import org.jclouds.http.HttpRequest;
import org.jclouds.rest.Binder;
@@ -33,26 +32,26 @@ import static com.google.common.base.Preconditions.checkArgument;
*/
@Singleton
public class BindUuidStringsToJsonArray implements Binder {
- @Override
- public <R extends HttpRequest> R bindToRequest(R request, Object payload) {
- checkArgument(payload instanceof List, "this binder is only valid for List<String>!");
- List list = List.class.cast(payload);
- for(Object o : list){
- checkArgument(o instanceof String, "this binder is only valid for List<String>!");
- }
- Iterable<String> uuids = (Iterable<String>) payload;
- JsonArray uuidJsonArray = new JsonArray();
- JsonObject json = new JsonObject();
+ @Override
+ public <R extends HttpRequest> R bindToRequest(R request, Object payload) {
+ checkArgument(payload instanceof List, "this binder is only valid for List<String>!");
+ List list = List.class.cast(payload);
+ for (Object o : list) {
+ checkArgument(o instanceof String, "this binder is only valid for List<String>!");
+ }
+ Iterable<String> uuids = (Iterable<String>) payload;
+ JsonArray uuidJsonArray = new JsonArray();
+ JsonObject json = new JsonObject();
- for(String uuid : uuids){
- JsonObject uuidObject = new JsonObject();
- uuidObject.addProperty("uuid", uuid);
- uuidJsonArray.add(uuidObject);
- }
+ for (String uuid : uuids) {
+ JsonObject uuidObject = new JsonObject();
+ uuidObject.addProperty("uuid", uuid);
+ uuidJsonArray.add(uuidObject);
+ }
- json.add("objects", uuidJsonArray);
- request.setPayload(json.toString());
- request.getPayload().getContentMetadata().setContentType(MediaType.APPLICATION_JSON);
- return request;
- }
+ json.add("objects", uuidJsonArray);
+ request.setPayload(json.toString());
+ request.getPayload().getContentMetadata().setContentType(MediaType.APPLICATION_JSON);
+ return request;
+ }
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0d70c84a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindVLANToJsonRequest.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindVLANToJsonRequest.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindVLANToJsonRequest.java
index a46e47c..9a58bb0 100644
--- a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindVLANToJsonRequest.java
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindVLANToJsonRequest.java
@@ -32,23 +32,23 @@ import static com.google.common.base.Preconditions.checkArgument;
* @author Vladimir Shevchenko
*/
@Singleton
-public class BindVLANToJsonRequest implements Binder{
+public class BindVLANToJsonRequest implements Binder {
- private final VLANInfoToJson vlanInfoJsonObjectFunction;
+ private final VLANInfoToJson vlanInfoJsonObjectFunction;
- @Inject
- public BindVLANToJsonRequest(VLANInfoToJson vlanInfoJsonObjectFunction) {
- this.vlanInfoJsonObjectFunction = vlanInfoJsonObjectFunction;
- }
+ @Inject
+ public BindVLANToJsonRequest(VLANInfoToJson vlanInfoJsonObjectFunction) {
+ this.vlanInfoJsonObjectFunction = vlanInfoJsonObjectFunction;
+ }
- @Override
- public <R extends HttpRequest> R bindToRequest(R request, Object input) {
- checkArgument(input instanceof VLANInfo, "this binder is only valid for VLANInfo!");
- VLANInfo create = VLANInfo.class.cast(input);
- JsonObject vlanJsonObject = vlanInfoJsonObjectFunction.apply(create);
+ @Override
+ public <R extends HttpRequest> R bindToRequest(R request, Object input) {
+ checkArgument(input instanceof VLANInfo, "this binder is only valid for VLANInfo!");
+ VLANInfo create = VLANInfo.class.cast(input);
+ JsonObject vlanJsonObject = vlanInfoJsonObjectFunction.apply(create);
- request.setPayload(vlanJsonObject.toString());
- request.getPayload().getContentMetadata().setContentType(MediaType.APPLICATION_JSON);
- return request;
- }
+ request.setPayload(vlanJsonObject.toString());
+ request.getPayload().getContentMetadata().setContentType(MediaType.APPLICATION_JSON);
+ return request;
+ }
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0d70c84a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/config/CloudSigma2HttpApiModule.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/config/CloudSigma2HttpApiModule.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/config/CloudSigma2HttpApiModule.java
index a8bcdce..1434be5 100644
--- a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/config/CloudSigma2HttpApiModule.java
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/config/CloudSigma2HttpApiModule.java
@@ -33,10 +33,10 @@ import org.jclouds.rest.config.HttpApiModule;
@ConfiguresHttpApi
public class CloudSigma2HttpApiModule extends HttpApiModule<CloudSigma2Api> {
- @Override
- protected void bindErrorHandlers() {
- bind(HttpErrorHandler.class).annotatedWith(Redirection.class).to(CloudSigmaErrorHandler.class);
- bind(HttpErrorHandler.class).annotatedWith(ClientError.class).to(CloudSigmaErrorHandler.class);
- bind(HttpErrorHandler.class).annotatedWith(ServerError.class).to(CloudSigmaErrorHandler.class);
- }
+ @Override
+ protected void bindErrorHandlers() {
+ bind(HttpErrorHandler.class).annotatedWith(Redirection.class).to(CloudSigmaErrorHandler.class);
+ bind(HttpErrorHandler.class).annotatedWith(ClientError.class).to(CloudSigmaErrorHandler.class);
+ bind(HttpErrorHandler.class).annotatedWith(ServerError.class).to(CloudSigmaErrorHandler.class);
+ }
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0d70c84a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/config/CloudSigma2ParserModule.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/config/CloudSigma2ParserModule.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/config/CloudSigma2ParserModule.java
index 4de8dbd..3dd3906 100644
--- a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/config/CloudSigma2ParserModule.java
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/config/CloudSigma2ParserModule.java
@@ -22,9 +22,9 @@ import org.jclouds.json.config.GsonModule;
/**
* @author Vladimir Shevchenko
*/
-public class CloudSigma2ParserModule extends AbstractModule{
- @Override
- protected void configure() {
- bind(GsonModule.DateAdapter.class).to(GsonModule.Iso8601DateAdapter.class);
- }
+public class CloudSigma2ParserModule extends AbstractModule {
+ @Override
+ protected void configure() {
+ bind(GsonModule.DateAdapter.class).to(GsonModule.Iso8601DateAdapter.class);
+ }
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0d70c84a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/config/CloudSigma2Properties.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/config/CloudSigma2Properties.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/config/CloudSigma2Properties.java
index e552f5d..296fbc5 100644
--- a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/config/CloudSigma2Properties.java
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/config/CloudSigma2Properties.java
@@ -17,14 +17,13 @@
package org.jclouds.cloudsigma2.config;
/**
- *
* @author Vladimir Shevchenko
*/
public class CloudSigma2Properties {
- /**
- * default VNC password used on new machines
- */
- public static final String PROPERTY_VNC_PASSWORD = "jclouds.cloudsigma.vnc-password";
-
+ /**
+ * default VNC password used on new machines
+ */
+ public static final String PROPERTY_VNC_PASSWORD = "jclouds.cloudsigma.vnc-password";
+
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0d70c84a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/AccountBalance.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/AccountBalance.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/AccountBalance.java
index 3593acc..54619dd 100644
--- a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/AccountBalance.java
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/AccountBalance.java
@@ -23,59 +23,59 @@ import java.beans.ConstructorProperties;
*/
public class AccountBalance {
- private final double balance;
- private final String currency;
+ private final double balance;
+ private final String currency;
- @ConstructorProperties({
- "balance", "currency"
- })
- public AccountBalance(double balance, String currency) {
- this.balance = balance;
- this.currency = currency;
- }
+ @ConstructorProperties({
+ "balance", "currency"
+ })
+ public AccountBalance(double balance, String currency) {
+ this.balance = balance;
+ this.currency = currency;
+ }
- /**
- * @return Amount of money in account
- */
- public double getBalance() {
- return balance;
- }
+ /**
+ * @return Amount of money in account
+ */
+ public double getBalance() {
+ return balance;
+ }
- /**
- * @return Currency of the account
- */
- public String getCurrency() {
- return currency;
- }
+ /**
+ * @return Currency of the account
+ */
+ public String getCurrency() {
+ return currency;
+ }
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (!(o instanceof AccountBalance)) return false;
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (!(o instanceof AccountBalance)) return false;
- AccountBalance that = (AccountBalance) o;
+ AccountBalance that = (AccountBalance) o;
- if (Double.compare(that.balance, balance) != 0) return false;
- if (currency != null ? !currency.equals(that.currency) : that.currency != null) return false;
+ if (Double.compare(that.balance, balance) != 0) return false;
+ if (currency != null ? !currency.equals(that.currency) : that.currency != null) return false;
- return true;
- }
+ return true;
+ }
- @Override
- public int hashCode() {
- int result;
- long temp;
- temp = Double.doubleToLongBits(balance);
- result = (int) (temp ^ (temp >>> 32));
- result = 31 * result + (currency != null ? currency.hashCode() : 0);
- return result;
- }
+ @Override
+ public int hashCode() {
+ int result;
+ long temp;
+ temp = Double.doubleToLongBits(balance);
+ result = (int) (temp ^ (temp >>> 32));
+ result = 31 * result + (currency != null ? currency.hashCode() : 0);
+ return result;
+ }
- @Override
- public String toString() {
- return "[" +
- "balance=" + balance +
- ", currency='" + currency + '\'' +
- "]";
- }
+ @Override
+ public String toString() {
+ return "[" +
+ "balance=" + balance +
+ ", currency='" + currency + '\'' +
+ "]";
+ }
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0d70c84a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/AccountUsage.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/AccountUsage.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/AccountUsage.java
index 2864fd0..08b1182 100644
--- a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/AccountUsage.java
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/AccountUsage.java
@@ -25,211 +25,218 @@ import java.beans.ConstructorProperties;
*/
public class AccountUsage {
- public static class Builder{
- private Usage cpu;
- private Usage dssd;
- private Usage ip;
- private Usage mem;
- private Usage windowsWebServer2008;
- private Usage windowsServer2008Standard;
- private Usage sqlServerStandard2008;
- private Usage sms;
- private Usage ssd;
- private Usage tx;
- private Usage vlan;
-
- public Builder cpu(Usage cpu) {
- this.cpu = cpu;
- return this;
- }
-
- public Builder dssd(Usage dssd) {
- this.dssd = dssd;
- return this;
- }
-
- public Builder ip(Usage ip) {
- this.ip = ip;
- return this;
- }
-
- public Builder mem(Usage mem) {
- this.mem = mem;
- return this;
- }
-
- public Builder windowsWebServer2008(Usage windowsWebServer2008) {
- this.windowsWebServer2008 = windowsWebServer2008;
- return this;
- }
-
- public Builder windowsServer2008Standard(Usage windowsServer2008Standard) {
- this.windowsServer2008Standard = windowsServer2008Standard;
- return this;
- }
-
- public Builder sqlServerStandard2008(Usage sqlServerStandard2008) {
- this.sqlServerStandard2008 = sqlServerStandard2008;
- return this;
- }
-
- public Builder ssd(Usage ssd) {
- this.ssd = ssd;
- return this;
- }
-
- public Builder vlan(Usage vlan) {
- this.vlan = vlan;
- return this;
- }
-
- public Builder tx(Usage tx) {
- this.tx = tx;
- return this;
- }
-
- public Builder sms(Usage sms) {
- this.sms = sms;
- return this;
- }
-
- public AccountUsage build(){
- return new AccountUsage(cpu, dssd, ip, mem, windowsWebServer2008, windowsServer2008Standard, sqlServerStandard2008, sms, ssd, tx, vlan);
- }
- }
-
- private final Usage cpu;
- private final Usage dssd;
- private final Usage ip;
- private final Usage mem;
- @Named("msft_lwa_00135")
- private final Usage windowsWebServer2008;
- @Named("msft_p37_04837")
- private final Usage windowsServer2008Standard;
- @Named("msft_tfa_00009")
- private final Usage sqlServerStandard2008;
- private final Usage sms;
- private final Usage ssd;
- private final Usage tx;
- private final Usage vlan;
-
- @ConstructorProperties({
- "cpu", "dssd", "ip", "mem", "msft_lwa_00135", "msft_p37_04837", "msft_tfa_00009", "sms", "ssd", "tx", "vlan"
- })
- public AccountUsage(Usage cpu, Usage dssd, Usage ip, Usage mem, Usage windowsWebServer2008
- , Usage windowsServer2008Standard, Usage sqlServerStandard2008, Usage sms, Usage ssd, Usage tx, Usage vlan) {
- this.cpu = cpu;
- this.dssd = dssd;
- this.ip = ip;
- this.mem = mem;
- this.windowsWebServer2008 = windowsWebServer2008;
- this.windowsServer2008Standard = windowsServer2008Standard;
- this.sqlServerStandard2008 = sqlServerStandard2008;
- this.sms = sms;
- this.ssd = ssd;
- this.tx = tx;
- this.vlan = vlan;
- }
-
- public Usage getVlan() {
- return vlan;
- }
-
- public Usage getCpu() {
- return cpu;
- }
-
- public Usage getDssd() {
- return dssd;
- }
-
- public Usage getIp() {
- return ip;
- }
-
- public Usage getMem() {
- return mem;
- }
-
- public Usage getSsd() {
- return ssd;
- }
-
- public Usage getWindowsWebServer2008() {
- return windowsWebServer2008;
- }
-
- public Usage getWindowsServer2008Standard() {
- return windowsServer2008Standard;
- }
-
- public Usage getSqlServerStandard2008() {
- return sqlServerStandard2008;
- }
-
- public Usage getSms() {
- return sms;
- }
-
- public Usage getTx() {
- return tx;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (!(o instanceof AccountUsage)) return false;
-
- AccountUsage that = (AccountUsage) o;
-
- if (cpu != null ? !cpu.equals(that.cpu) : that.cpu != null) return false;
- if (dssd != null ? !dssd.equals(that.dssd) : that.dssd != null) return false;
- if (ip != null ? !ip.equals(that.ip) : that.ip != null) return false;
- if (mem != null ? !mem.equals(that.mem) : that.mem != null) return false;
- if (sms != null ? !sms.equals(that.sms) : that.sms != null) return false;
- if (sqlServerStandard2008 != null ? !sqlServerStandard2008.equals(that.sqlServerStandard2008) : that.sqlServerStandard2008 != null)
- return false;
- if (ssd != null ? !ssd.equals(that.ssd) : that.ssd != null) return false;
- if (tx != null ? !tx.equals(that.tx) : that.tx != null) return false;
- if (vlan != null ? !vlan.equals(that.vlan) : that.vlan != null) return false;
- if (windowsServer2008Standard != null ? !windowsServer2008Standard.equals(that.windowsServer2008Standard) : that.windowsServer2008Standard != null)
- return false;
- if (windowsWebServer2008 != null ? !windowsWebServer2008.equals(that.windowsWebServer2008) : that.windowsWebServer2008 != null)
- return false;
-
- return true;
- }
-
- @Override
- public int hashCode() {
- int result = cpu != null ? cpu.hashCode() : 0;
- result = 31 * result + (dssd != null ? dssd.hashCode() : 0);
- result = 31 * result + (ip != null ? ip.hashCode() : 0);
- result = 31 * result + (mem != null ? mem.hashCode() : 0);
- result = 31 * result + (windowsWebServer2008 != null ? windowsWebServer2008.hashCode() : 0);
- result = 31 * result + (windowsServer2008Standard != null ? windowsServer2008Standard.hashCode() : 0);
- result = 31 * result + (sqlServerStandard2008 != null ? sqlServerStandard2008.hashCode() : 0);
- result = 31 * result + (sms != null ? sms.hashCode() : 0);
- result = 31 * result + (ssd != null ? ssd.hashCode() : 0);
- result = 31 * result + (tx != null ? tx.hashCode() : 0);
- result = 31 * result + (vlan != null ? vlan.hashCode() : 0);
- return result;
- }
-
- @Override
- public String toString() {
- return "[" +
- "cpu=" + cpu +
- ", dssd=" + dssd +
- ", ip=" + ip +
- ", mem=" + mem +
- ", windowsWebServer2008=" + windowsWebServer2008 +
- ", windowsServer2008Standard=" + windowsServer2008Standard +
- ", sqlServerStandard2008=" + sqlServerStandard2008 +
- ", sms=" + sms +
- ", ssd=" + ssd +
- ", tx=" + tx +
- ", vlan=" + vlan +
- "]";
- }
+ public static class Builder {
+ private Usage cpu;
+ private Usage dssd;
+ private Usage ip;
+ private Usage mem;
+ private Usage windowsWebServer2008;
+ private Usage windowsServer2008Standard;
+ private Usage sqlServerStandard2008;
+ private Usage sms;
+ private Usage ssd;
+ private Usage tx;
+ private Usage vlan;
+
+ public Builder cpu(Usage cpu) {
+ this.cpu = cpu;
+ return this;
+ }
+
+ public Builder dssd(Usage dssd) {
+ this.dssd = dssd;
+ return this;
+ }
+
+ public Builder ip(Usage ip) {
+ this.ip = ip;
+ return this;
+ }
+
+ public Builder mem(Usage mem) {
+ this.mem = mem;
+ return this;
+ }
+
+ public Builder windowsWebServer2008(Usage windowsWebServer2008) {
+ this.windowsWebServer2008 = windowsWebServer2008;
+ return this;
+ }
+
+ public Builder windowsServer2008Standard(Usage windowsServer2008Standard) {
+ this.windowsServer2008Standard = windowsServer2008Standard;
+ return this;
+ }
+
+ public Builder sqlServerStandard2008(Usage sqlServerStandard2008) {
+ this.sqlServerStandard2008 = sqlServerStandard2008;
+ return this;
+ }
+
+ public Builder ssd(Usage ssd) {
+ this.ssd = ssd;
+ return this;
+ }
+
+ public Builder vlan(Usage vlan) {
+ this.vlan = vlan;
+ return this;
+ }
+
+ public Builder tx(Usage tx) {
+ this.tx = tx;
+ return this;
+ }
+
+ public Builder sms(Usage sms) {
+ this.sms = sms;
+ return this;
+ }
+
+ public AccountUsage build() {
+ return new AccountUsage(cpu, dssd, ip, mem, windowsWebServer2008, windowsServer2008Standard
+ , sqlServerStandard2008, sms, ssd, tx, vlan);
+ }
+ }
+
+ private final Usage cpu;
+ private final Usage dssd;
+ private final Usage ip;
+ private final Usage mem;
+ @Named("msft_lwa_00135")
+ private final Usage windowsWebServer2008;
+ @Named("msft_p37_04837")
+ private final Usage windowsServer2008Standard;
+ @Named("msft_tfa_00009")
+ private final Usage sqlServerStandard2008;
+ private final Usage sms;
+ private final Usage ssd;
+ private final Usage tx;
+ private final Usage vlan;
+
+ @ConstructorProperties({
+ "cpu", "dssd", "ip", "mem", "msft_lwa_00135", "msft_p37_04837", "msft_tfa_00009", "sms", "ssd", "tx", "vlan"
+ })
+ public AccountUsage(Usage cpu, Usage dssd, Usage ip, Usage mem, Usage windowsWebServer2008
+ , Usage windowsServer2008Standard, Usage sqlServerStandard2008, Usage sms, Usage ssd, Usage tx, Usage vlan) {
+ this.cpu = cpu;
+ this.dssd = dssd;
+ this.ip = ip;
+ this.mem = mem;
+ this.windowsWebServer2008 = windowsWebServer2008;
+ this.windowsServer2008Standard = windowsServer2008Standard;
+ this.sqlServerStandard2008 = sqlServerStandard2008;
+ this.sms = sms;
+ this.ssd = ssd;
+ this.tx = tx;
+ this.vlan = vlan;
+ }
+
+ public Usage getVlan() {
+ return vlan;
+ }
+
+ public Usage getCpu() {
+ return cpu;
+ }
+
+ public Usage getDssd() {
+ return dssd;
+ }
+
+ public Usage getIp() {
+ return ip;
+ }
+
+ public Usage getMem() {
+ return mem;
+ }
+
+ public Usage getSsd() {
+ return ssd;
+ }
+
+ public Usage getWindowsWebServer2008() {
+ return windowsWebServer2008;
+ }
+
+ public Usage getWindowsServer2008Standard() {
+ return windowsServer2008Standard;
+ }
+
+ public Usage getSqlServerStandard2008() {
+ return sqlServerStandard2008;
+ }
+
+ public Usage getSms() {
+ return sms;
+ }
+
+ public Usage getTx() {
+ return tx;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (!(o instanceof AccountUsage)) return false;
+
+ AccountUsage that = (AccountUsage) o;
+
+ if (cpu != null ? !cpu.equals(that.cpu) : that.cpu != null) return false;
+ if (dssd != null ? !dssd.equals(that.dssd) : that.dssd != null) return false;
+ if (ip != null ? !ip.equals(that.ip) : that.ip != null) return false;
+ if (mem != null ? !mem.equals(that.mem) : that.mem != null) return false;
+ if (sms != null ? !sms.equals(that.sms) : that.sms != null) return false;
+ if (sqlServerStandard2008 != null
+ ? !sqlServerStandard2008.equals(that.sqlServerStandard2008)
+ : that.sqlServerStandard2008 != null)
+ return false;
+ if (ssd != null ? !ssd.equals(that.ssd) : that.ssd != null) return false;
+ if (tx != null ? !tx.equals(that.tx) : that.tx != null) return false;
+ if (vlan != null ? !vlan.equals(that.vlan) : that.vlan != null) return false;
+ if (windowsServer2008Standard != null
+ ? !windowsServer2008Standard.equals(that.windowsServer2008Standard)
+ : that.windowsServer2008Standard != null)
+ return false;
+ if (windowsWebServer2008 != null
+ ? !windowsWebServer2008.equals(that.windowsWebServer2008)
+ : that.windowsWebServer2008 != null)
+ return false;
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = cpu != null ? cpu.hashCode() : 0;
+ result = 31 * result + (dssd != null ? dssd.hashCode() : 0);
+ result = 31 * result + (ip != null ? ip.hashCode() : 0);
+ result = 31 * result + (mem != null ? mem.hashCode() : 0);
+ result = 31 * result + (windowsWebServer2008 != null ? windowsWebServer2008.hashCode() : 0);
+ result = 31 * result + (windowsServer2008Standard != null ? windowsServer2008Standard.hashCode() : 0);
+ result = 31 * result + (sqlServerStandard2008 != null ? sqlServerStandard2008.hashCode() : 0);
+ result = 31 * result + (sms != null ? sms.hashCode() : 0);
+ result = 31 * result + (ssd != null ? ssd.hashCode() : 0);
+ result = 31 * result + (tx != null ? tx.hashCode() : 0);
+ result = 31 * result + (vlan != null ? vlan.hashCode() : 0);
+ return result;
+ }
+
+ @Override
+ public String toString() {
+ return "[" +
+ "cpu=" + cpu +
+ ", dssd=" + dssd +
+ ", ip=" + ip +
+ ", mem=" + mem +
+ ", windowsWebServer2008=" + windowsWebServer2008 +
+ ", windowsServer2008Standard=" + windowsServer2008Standard +
+ ", sqlServerStandard2008=" + sqlServerStandard2008 +
+ ", sms=" + sms +
+ ", ssd=" + ssd +
+ ", tx=" + tx +
+ ", vlan=" + vlan +
+ "]";
+ }
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0d70c84a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/BurstLevel.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/BurstLevel.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/BurstLevel.java
index 97ee3c6..03f8703 100644
--- a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/BurstLevel.java
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/BurstLevel.java
@@ -25,208 +25,208 @@ import java.beans.ConstructorProperties;
*/
public class BurstLevel {
- public static class Builder{
- private int cpu;
- private int dssd;
- private int ip;
- private int mem;
- private int windowsWebServer2008;
- private int windowsServer2008Standard;
- private int sqlServerStandard2008;
- private int sms;
- private int ssd;
- private int tx;
- private int vlan;
-
- public Builder cpu(int cpu) {
- this.cpu = cpu;
- return this;
- }
-
- public Builder dssd(int dssd) {
- this.dssd = dssd;
- return this;
- }
-
- public Builder ip(int ip) {
- this.ip = ip;
- return this;
- }
-
- public Builder mem(int mem) {
- this.mem = mem;
- return this;
- }
-
- public Builder windowsWebServer2008(int windowsWebServer2008) {
- this.windowsWebServer2008 = windowsWebServer2008;
- return this;
- }
-
- public Builder windowsServer2008Standard(int windowsServer2008Standard) {
- this.windowsServer2008Standard = windowsServer2008Standard;
- return this;
- }
-
- public Builder sqlServerStandard2008(int sqlServerStandard2008) {
- this.sqlServerStandard2008 = sqlServerStandard2008;
- return this;
- }
-
- public Builder ssd(int ssd) {
- this.ssd = ssd;
- return this;
- }
-
- public Builder vlan(int vlan) {
- this.vlan = vlan;
- return this;
- }
-
- public Builder tx(int tx) {
- this.tx = tx;
- return this;
- }
-
- public Builder sms(int sms) {
- this.sms = sms;
- return this;
- }
-
- public BurstLevel build(){
- return new BurstLevel(cpu, dssd, ip, mem, windowsWebServer2008, windowsServer2008Standard, sqlServerStandard2008, sms, ssd, tx, vlan);
- }
- }
-
- private final int cpu;
- private final int dssd;
- private final int ip;
- private final int mem;
- @Named("msft_lwa_00135")
- private final int windowsWebServer2008;
- @Named("msft_p37_04837")
- private final int windowsServer2008Standard;
- @Named("msft_tfa_00009")
- private final int sqlServerStandard2008;
- private final int sms;
- private final int ssd;
- private final int tx;
- private final int vlan;
-
- @ConstructorProperties({
- "cpu", "dssd", "ip", "mem", "msft_lwa_00135", "msft_p37_04837", "msft_tfa_00009", "sms", "ssd", "tx", "vlan"
- })
- public BurstLevel(int cpu, int dssd, int ip, int mem, int windowsWebServer2008
- , int windowsServer2008Standard, int sqlServerStandard2008, int sms, int ssd, int tx, int vlan) {
- this.cpu = cpu;
- this.dssd = dssd;
- this.ip = ip;
- this.mem = mem;
- this.windowsWebServer2008 = windowsWebServer2008;
- this.windowsServer2008Standard = windowsServer2008Standard;
- this.sqlServerStandard2008 = sqlServerStandard2008;
- this.sms = sms;
- this.ssd = ssd;
- this.tx = tx;
- this.vlan = vlan;
- }
-
- public int getVlan() {
- return vlan;
- }
-
- public int getCpu() {
- return cpu;
- }
-
- public int getDssd() {
- return dssd;
- }
-
- public int getIp() {
- return ip;
- }
-
- public int getMem() {
- return mem;
- }
-
- public int getSsd() {
- return ssd;
- }
-
- public int getWindowsWebServer2008() {
- return windowsWebServer2008;
- }
-
- public int getWindowsServer2008Standard() {
- return windowsServer2008Standard;
- }
-
- public int getSqlServerStandard2008() {
- return sqlServerStandard2008;
- }
-
- public int getSms() {
- return sms;
- }
-
- public int getTx() {
- return tx;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (!(o instanceof BurstLevel)) return false;
-
- BurstLevel that = (BurstLevel) o;
-
- if (cpu != that.cpu) return false;
- if (dssd != that.dssd) return false;
- if (ip != that.ip) return false;
- if (mem != that.mem) return false;
- if (sms != that.sms) return false;
- if (sqlServerStandard2008 != that.sqlServerStandard2008) return false;
- if (ssd != that.ssd) return false;
- if (tx != that.tx) return false;
- if (vlan != that.vlan) return false;
- if (windowsServer2008Standard != that.windowsServer2008Standard) return false;
- if (windowsWebServer2008 != that.windowsWebServer2008) return false;
-
- return true;
- }
-
- @Override
- public int hashCode() {
- int result = cpu;
- result = 31 * result + dssd;
- result = 31 * result + ip;
- result = 31 * result + mem;
- result = 31 * result + windowsWebServer2008;
- result = 31 * result + windowsServer2008Standard;
- result = 31 * result + sqlServerStandard2008;
- result = 31 * result + sms;
- result = 31 * result + ssd;
- result = 31 * result + tx;
- result = 31 * result + vlan;
- return result;
- }
-
- @Override
- public String toString() {
- return "[" +
- "cpu=" + cpu +
- ", dssd=" + dssd +
- ", ip=" + ip +
- ", mem=" + mem +
- ", windowsWebServer2008=" + windowsWebServer2008 +
- ", windowsServer2008Standard=" + windowsServer2008Standard +
- ", sqlServerStandard2008=" + sqlServerStandard2008 +
- ", sms=" + sms +
- ", ssd=" + ssd +
- ", tx=" + tx +
- ", vlan=" + vlan +
- "]";
- }
+ public static class Builder {
+ private int cpu;
+ private int dssd;
+ private int ip;
+ private int mem;
+ private int windowsWebServer2008;
+ private int windowsServer2008Standard;
+ private int sqlServerStandard2008;
+ private int sms;
+ private int ssd;
+ private int tx;
+ private int vlan;
+
+ public Builder cpu(int cpu) {
+ this.cpu = cpu;
+ return this;
+ }
+
+ public Builder dssd(int dssd) {
+ this.dssd = dssd;
+ return this;
+ }
+
+ public Builder ip(int ip) {
+ this.ip = ip;
+ return this;
+ }
+
+ public Builder mem(int mem) {
+ this.mem = mem;
+ return this;
+ }
+
+ public Builder windowsWebServer2008(int windowsWebServer2008) {
+ this.windowsWebServer2008 = windowsWebServer2008;
+ return this;
+ }
+
+ public Builder windowsServer2008Standard(int windowsServer2008Standard) {
+ this.windowsServer2008Standard = windowsServer2008Standard;
+ return this;
+ }
+
+ public Builder sqlServerStandard2008(int sqlServerStandard2008) {
+ this.sqlServerStandard2008 = sqlServerStandard2008;
+ return this;
+ }
+
+ public Builder ssd(int ssd) {
+ this.ssd = ssd;
+ return this;
+ }
+
+ public Builder vlan(int vlan) {
+ this.vlan = vlan;
+ return this;
+ }
+
+ public Builder tx(int tx) {
+ this.tx = tx;
+ return this;
+ }
+
+ public Builder sms(int sms) {
+ this.sms = sms;
+ return this;
+ }
+
+ public BurstLevel build() {
+ return new BurstLevel(cpu, dssd, ip, mem, windowsWebServer2008, windowsServer2008Standard, sqlServerStandard2008, sms, ssd, tx, vlan);
+ }
+ }
+
+ private final int cpu;
+ private final int dssd;
+ private final int ip;
+ private final int mem;
+ @Named("msft_lwa_00135")
+ private final int windowsWebServer2008;
+ @Named("msft_p37_04837")
+ private final int windowsServer2008Standard;
+ @Named("msft_tfa_00009")
+ private final int sqlServerStandard2008;
+ private final int sms;
+ private final int ssd;
+ private final int tx;
+ private final int vlan;
+
+ @ConstructorProperties({
+ "cpu", "dssd", "ip", "mem", "msft_lwa_00135", "msft_p37_04837", "msft_tfa_00009", "sms", "ssd", "tx", "vlan"
+ })
+ public BurstLevel(int cpu, int dssd, int ip, int mem, int windowsWebServer2008
+ , int windowsServer2008Standard, int sqlServerStandard2008, int sms, int ssd, int tx, int vlan) {
+ this.cpu = cpu;
+ this.dssd = dssd;
+ this.ip = ip;
+ this.mem = mem;
+ this.windowsWebServer2008 = windowsWebServer2008;
+ this.windowsServer2008Standard = windowsServer2008Standard;
+ this.sqlServerStandard2008 = sqlServerStandard2008;
+ this.sms = sms;
+ this.ssd = ssd;
+ this.tx = tx;
+ this.vlan = vlan;
+ }
+
+ public int getVlan() {
+ return vlan;
+ }
+
+ public int getCpu() {
+ return cpu;
+ }
+
+ public int getDssd() {
+ return dssd;
+ }
+
+ public int getIp() {
+ return ip;
+ }
+
+ public int getMem() {
+ return mem;
+ }
+
+ public int getSsd() {
+ return ssd;
+ }
+
+ public int getWindowsWebServer2008() {
+ return windowsWebServer2008;
+ }
+
+ public int getWindowsServer2008Standard() {
+ return windowsServer2008Standard;
+ }
+
+ public int getSqlServerStandard2008() {
+ return sqlServerStandard2008;
+ }
+
+ public int getSms() {
+ return sms;
+ }
+
+ public int getTx() {
+ return tx;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (!(o instanceof BurstLevel)) return false;
+
+ BurstLevel that = (BurstLevel) o;
+
+ if (cpu != that.cpu) return false;
+ if (dssd != that.dssd) return false;
+ if (ip != that.ip) return false;
+ if (mem != that.mem) return false;
+ if (sms != that.sms) return false;
+ if (sqlServerStandard2008 != that.sqlServerStandard2008) return false;
+ if (ssd != that.ssd) return false;
+ if (tx != that.tx) return false;
+ if (vlan != that.vlan) return false;
+ if (windowsServer2008Standard != that.windowsServer2008Standard) return false;
+ if (windowsWebServer2008 != that.windowsWebServer2008) return false;
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = cpu;
+ result = 31 * result + dssd;
+ result = 31 * result + ip;
+ result = 31 * result + mem;
+ result = 31 * result + windowsWebServer2008;
+ result = 31 * result + windowsServer2008Standard;
+ result = 31 * result + sqlServerStandard2008;
+ result = 31 * result + sms;
+ result = 31 * result + ssd;
+ result = 31 * result + tx;
+ result = 31 * result + vlan;
+ return result;
+ }
+
+ @Override
+ public String toString() {
+ return "[" +
+ "cpu=" + cpu +
+ ", dssd=" + dssd +
+ ", ip=" + ip +
+ ", mem=" + mem +
+ ", windowsWebServer2008=" + windowsWebServer2008 +
+ ", windowsServer2008Standard=" + windowsServer2008Standard +
+ ", sqlServerStandard2008=" + sqlServerStandard2008 +
+ ", sms=" + sms +
+ ", ssd=" + ssd +
+ ", tx=" + tx +
+ ", vlan=" + vlan +
+ "]";
+ }
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0d70c84a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/CreateSubscriptionRequest.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/CreateSubscriptionRequest.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/CreateSubscriptionRequest.java
index 160f44a..6214d29 100644
--- a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/CreateSubscriptionRequest.java
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/CreateSubscriptionRequest.java
@@ -21,80 +21,80 @@ package org.jclouds.cloudsigma2.domain;
*/
public class CreateSubscriptionRequest {
- public static class Builder{
- private String amount;
- private String period;
- private SubscriptionResource resource;
+ public static class Builder {
+ private String amount;
+ private String period;
+ private SubscriptionResource resource;
- /**
- * @param amount Subscription amount
- * CreateSubscriptionRequest Builder
- */
- public Builder amount(String amount){
- this.amount = amount;
- return this;
- }
+ /**
+ * @param amount Subscription amount
+ * CreateSubscriptionRequest Builder
+ */
+ public Builder amount(String amount) {
+ this.amount = amount;
+ return this;
+ }
- /**
- * @param period Duration of the subscription
- * CreateSubscriptionRequest Builder
- */
- public Builder period(String period){
- this.period = period;
- return this;
- }
+ /**
+ * @param period Duration of the subscription
+ * CreateSubscriptionRequest Builder
+ */
+ public Builder period(String period) {
+ this.period = period;
+ return this;
+ }
- /**
- * @param resource Name of resource associated with the subscription
- * CreateSubscriptionRequest Builder
- */
- public Builder resource(SubscriptionResource resource){
- this.resource = resource;
- return this;
- }
+ /**
+ * @param resource Name of resource associated with the subscription
+ * CreateSubscriptionRequest Builder
+ */
+ public Builder resource(SubscriptionResource resource) {
+ this.resource = resource;
+ return this;
+ }
- public CreateSubscriptionRequest build(){
- return new CreateSubscriptionRequest(amount, period, resource);
- }
- }
+ public CreateSubscriptionRequest build() {
+ return new CreateSubscriptionRequest(amount, period, resource);
+ }
+ }
- private final String amount;
- private final String period;
- private final SubscriptionResource resource;
+ private final String amount;
+ private final String period;
+ private final SubscriptionResource resource;
- public CreateSubscriptionRequest(String amount, String period, SubscriptionResource resource) {
- this.amount = amount;
- this.period = period;
- this.resource = resource;
- }
+ public CreateSubscriptionRequest(String amount, String period, SubscriptionResource resource) {
+ this.amount = amount;
+ this.period = period;
+ this.resource = resource;
+ }
- /**
- * @return Subscription amount
- */
- public String getAmount() {
- return amount;
- }
+ /**
+ * @return Subscription amount
+ */
+ public String getAmount() {
+ return amount;
+ }
- /**
- * @return Duration of the subscription
- */
- public String getPeriod() {
- return period;
- }
+ /**
+ * @return Duration of the subscription
+ */
+ public String getPeriod() {
+ return period;
+ }
- /**
- * @return Name of resource associated with the subscription
- */
- public SubscriptionResource getResource() {
- return resource;
- }
+ /**
+ * @return Name of resource associated with the subscription
+ */
+ public SubscriptionResource getResource() {
+ return resource;
+ }
- @Override
- public String toString() {
- return "[" +
- "amount='" + amount + '\'' +
- ", period='" + period + '\'' +
- ", resource=" + resource +
- "]";
- }
+ @Override
+ public String toString() {
+ return "[" +
+ "amount='" + amount + '\'' +
+ ", period='" + period + '\'' +
+ ", resource=" + resource +
+ "]";
+ }
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0d70c84a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/CurrentUsage.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/CurrentUsage.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/CurrentUsage.java
index c7ffabb..48d59e2 100644
--- a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/CurrentUsage.java
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/CurrentUsage.java
@@ -23,69 +23,69 @@ import java.beans.ConstructorProperties;
*/
public class CurrentUsage {
- public static class Builder{
- private AccountBalance balance;
- private AccountUsage usage;
-
- public Builder balance(AccountBalance balance) {
- this.balance = balance;
- return this;
- }
-
- public Builder usage(AccountUsage usage) {
- this.usage = usage;
- return this;
- }
-
- public CurrentUsage build(){
- return new CurrentUsage(balance, usage);
- }
- }
-
- private final AccountBalance balance;
- private final AccountUsage usage;
-
- @ConstructorProperties({
- "balance", "usage"
- })
- public CurrentUsage(AccountBalance balance, AccountUsage usage) {
- this.balance = balance;
- this.usage = usage;
- }
-
- public AccountBalance getBalance() {
- return balance;
- }
-
- public AccountUsage getUsage() {
- return usage;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (!(o instanceof CurrentUsage)) return false;
-
- CurrentUsage that = (CurrentUsage) o;
-
- if (balance != null ? !balance.equals(that.balance) : that.balance != null) return false;
- if (usage != null ? !usage.equals(that.usage) : that.usage != null) return false;
-
- return true;
- }
-
- @Override
- public int hashCode() {
- int result = balance != null ? balance.hashCode() : 0;
- result = 31 * result + (usage != null ? usage.hashCode() : 0);
- return result;
- }
-
- @Override
- public String toString() {
- return "[" +
- "balance=" + balance +
- ", usage=" + usage +
- "]";
- }
+ public static class Builder {
+ private AccountBalance balance;
+ private AccountUsage usage;
+
+ public Builder balance(AccountBalance balance) {
+ this.balance = balance;
+ return this;
+ }
+
+ public Builder usage(AccountUsage usage) {
+ this.usage = usage;
+ return this;
+ }
+
+ public CurrentUsage build() {
+ return new CurrentUsage(balance, usage);
+ }
+ }
+
+ private final AccountBalance balance;
+ private final AccountUsage usage;
+
+ @ConstructorProperties({
+ "balance", "usage"
+ })
+ public CurrentUsage(AccountBalance balance, AccountUsage usage) {
+ this.balance = balance;
+ this.usage = usage;
+ }
+
+ public AccountBalance getBalance() {
+ return balance;
+ }
+
+ public AccountUsage getUsage() {
+ return usage;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (!(o instanceof CurrentUsage)) return false;
+
+ CurrentUsage that = (CurrentUsage) o;
+
+ if (balance != null ? !balance.equals(that.balance) : that.balance != null) return false;
+ if (usage != null ? !usage.equals(that.usage) : that.usage != null) return false;
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = balance != null ? balance.hashCode() : 0;
+ result = 31 * result + (usage != null ? usage.hashCode() : 0);
+ return result;
+ }
+
+ @Override
+ public String toString() {
+ return "[" +
+ "balance=" + balance +
+ ", usage=" + usage +
+ "]";
+ }
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0d70c84a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/DeviceEmulationType.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/DeviceEmulationType.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/DeviceEmulationType.java
index e3b72f0..98e2005 100644
--- a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/DeviceEmulationType.java
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/DeviceEmulationType.java
@@ -22,22 +22,22 @@ import static com.google.common.base.Preconditions.checkNotNull;
* @author Vladimir Shevchenko
*/
public enum DeviceEmulationType {
- IDE, VIRTIO, UNRECOGNIZED;
+ IDE, VIRTIO, UNRECOGNIZED;
- public String value() {
- return name().toLowerCase();
- }
+ public String value() {
+ return name().toLowerCase();
+ }
- @Override
- public String toString() {
- return value();
- }
+ @Override
+ public String toString() {
+ return value();
+ }
- public static DeviceEmulationType fromValue(String type) {
- try {
- return valueOf(checkNotNull(type, "type").toUpperCase());
- } catch (IllegalArgumentException e) {
- return UNRECOGNIZED;
- }
- }
+ public static DeviceEmulationType fromValue(String type) {
+ try {
+ return valueOf(checkNotNull(type, "type").toUpperCase());
+ } catch (IllegalArgumentException e) {
+ return UNRECOGNIZED;
+ }
+ }
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0d70c84a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/Discount.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/Discount.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/Discount.java
index a33b5b8..d0e6671 100644
--- a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/Discount.java
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/Discount.java
@@ -23,56 +23,56 @@ import java.beans.ConstructorProperties;
*/
public class Discount {
- private final String period;
- private final Double value;
+ private final String period;
+ private final Double value;
- @ConstructorProperties({
- "period", "value"
- })
- public Discount(String period, Double value) {
- this.period = period;
- this.value = value;
- }
+ @ConstructorProperties({
+ "period", "value"
+ })
+ public Discount(String period, Double value) {
+ this.period = period;
+ this.value = value;
+ }
- /**
- * @return The minimum period for this discount
- */
- public String getPeriod() {
- return period;
- }
+ /**
+ * @return The minimum period for this discount
+ */
+ public String getPeriod() {
+ return period;
+ }
- /**
- * @return The value of the discount
- */
- public Double getValue() {
- return value;
- }
+ /**
+ * @return The value of the discount
+ */
+ public Double getValue() {
+ return value;
+ }
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (!(o instanceof Discount)) return false;
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (!(o instanceof Discount)) return false;
- Discount discount = (Discount) o;
+ Discount discount = (Discount) o;
- if (period != null ? !period.equals(discount.period) : discount.period != null) return false;
- if (value != null ? !value.equals(discount.value) : discount.value != null) return false;
+ if (period != null ? !period.equals(discount.period) : discount.period != null) return false;
+ if (value != null ? !value.equals(discount.value) : discount.value != null) return false;
- return true;
- }
+ return true;
+ }
- @Override
- public int hashCode() {
- int result = period != null ? period.hashCode() : 0;
- result = 31 * result + (value != null ? value.hashCode() : 0);
- return result;
- }
+ @Override
+ public int hashCode() {
+ int result = period != null ? period.hashCode() : 0;
+ result = 31 * result + (value != null ? value.hashCode() : 0);
+ return result;
+ }
- @Override
- public String toString() {
- return "[" +
- "period='" + period + '\'' +
- ", value=" + value +
- "]";
- }
+ @Override
+ public String toString() {
+ return "[" +
+ "period='" + period + '\'' +
+ ", value=" + value +
+ "]";
+ }
}
[06/13] Fix code style of the cloudsigma2 provider.
Posted by na...@apache.org.
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0d70c84a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/ServerInfo.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/ServerInfo.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/ServerInfo.java
index 130f9ce..ba079e7 100644
--- a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/ServerInfo.java
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/ServerInfo.java
@@ -31,406 +31,430 @@ import java.util.Map;
*/
public class ServerInfo extends Server {
- public static class Builder extends Server.Builder {
- private int cpu;
- private boolean cpusInsteadOfCores;
- private List<ServerDrive> drives;
- private boolean enableNuma;
- private boolean hvRelaxed;
- private boolean hvTsc;
- private BigInteger memory;
- private Map<String, String> meta;
- private List<NIC> nics;
- private List<String> requirements;
- private List<String> tags;
- private String vncPassword;
- private int smp;
-
- /**
- * @param cpu server’s CPU Clock speed measured in MHz
- * @return ServerInfo Builder
- */
- public Builder cpu(int cpu) {
- this.cpu = cpu;
- return this;
- }
-
- /**
- * @param cpusInsteadOfCores expose server SMPs as separate CPUs, instead of cores of a single CPU
- * @return ServerInfo Builder
- */
- public Builder cpusInsteadOfCores(boolean cpusInsteadOfCores) {
- this.cpusInsteadOfCores = cpusInsteadOfCores;
- return this;
- }
-
- /**
- * @param drives list of attached Drives to server
- * @return ServerInfo Builder
- */
- public Builder drives(List<ServerDrive> drives) {
- this.drives = ImmutableList.copyOf(drives);
- return this;
- }
-
- /**
- * @param enableNuma expose NUMA topology to the server
- * @return ServerInfo Builder
- */
- public Builder enableNuma(boolean enableNuma) {
- this.enableNuma = enableNuma;
- return this;
- }
-
- /**
- * @param hvRelaxed improve performance of Windows servers
- * @return ServerInfo Builder
- */
- public Builder hvRelaxed(boolean hvRelaxed) {
- this.hvRelaxed = hvRelaxed;
- return this;
- }
-
- /**
- * @param hvTsc improves performance of Windows servers with the trade off that the servers
- * @return ServerInfo Builder
- */
- public Builder hvTsc(boolean hvTsc) {
- this.hvTsc = hvTsc;
- return this;
- }
-
- /**
- * @param memory server’s Random Access Memory measured in bytes
- * @return ServerInfo Builder
- */
- public Builder memory(BigInteger memory) {
- this.memory = memory;
- return this;
- }
-
- /**
- * @param meta user assigned meta information for this server
- * @return ServerInfo Builder
- */
- public Builder meta(Map<String, String> meta) {
- this.meta = meta;
- return this;
- }
-
- /**
- * @param nics list of nics attached to this server
- * @return ServerInfo Builder
- */
- public Builder nics(List<NIC> nics) {
- this.nics = ImmutableList.copyOf(nics);
- return this;
- }
-
- /**
- * @param requirements a collection of special requirements for this server
- * @return ServerInfo Builder
- */
- public Builder requirements(List<String> requirements) {
- this.requirements = ImmutableList.copyOf(requirements);
- return this;
- }
-
- /**
- * @param tags list of tags this server is associated with
- * @return ServerInfo Builder
- */
- public Builder tags(List<String> tags) {
- this.tags = ImmutableList.copyOf(tags);
- return this;
- }
-
- /**
- * @param vncPassword VNC Password to connect to server
- * @return ServerInfo Builder
- */
- public Builder vncPassword(String vncPassword) {
- this.vncPassword = vncPassword;
- return this;
- }
-
- /**
- * @param smp Symmetric Multiprocessing (SMP) i.e. number of CPU cores
- * @return ServerInfo Builder
- */
- public Builder smp(int smp) {
- this.smp = smp;
- return this;
- }
-
- /**
- * {@inheritDoc}
- * @return ServerInfo Builder
- */
- @Override
- public Builder owner(Owner owner) {
- return Builder.class.cast(super.owner(owner));
- }
-
- /**
- * {@inheritDoc}
- * @return ServerInfo Builder
- */
- @Override
- public Builder status(ServerStatus status) {
- return Builder.class.cast(super.status(status));
- }
-
- /**
- * {@inheritDoc}
- * @return ServerInfo Builder
- */
- @Override
- public Builder runtime(ServerRuntime runtime) {
- return Builder.class.cast(super.runtime(runtime));
- }
-
- /**
- * {@inheritDoc}
- * @return ServerInfo Builder
- */
- @Override
- public Builder uuid(String uuid) {
- return Builder.class.cast(super.uuid(uuid));
- }
-
- /**
- * {@inheritDoc}
- * @return ServerInfo Builder
- */
- @Override
- public Builder name(String name) {
- return Builder.class.cast(super.name(name));
- }
-
- /**
- * {@inheritDoc}
- * @return ServerInfo Builder
- */
- @Override
- public Builder resourceUri(URI resourceUri) {
- return Builder.class.cast(super.resourceUri(resourceUri));
- }
-
- public static Builder fromServerInfo(ServerInfo serverInfo) {
- return new Builder().uuid(serverInfo.getUuid()).name(serverInfo.getName()).resourceUri(serverInfo.getResourceUri())
- .owner(serverInfo.getOwner()).status(serverInfo.getStatus()).runtime(serverInfo.getRuntime())
- .cpusInsteadOfCores(serverInfo.isCpusInsteadOfCores()).drives(serverInfo.getDrives())
- .enableNuma(serverInfo.isNumaEnabled()).hvRelaxed(serverInfo.isHvRelaxed()).hvTsc(serverInfo.isHvTsc())
- .memory(serverInfo.getMemory()).meta(serverInfo.getMeta()).nics(serverInfo.getNics())
- .requirements(serverInfo.getRequirements()).tags(serverInfo.getTags()).vncPassword(serverInfo.getVncPassword())
- .smp(serverInfo.getSmp());
- }
-
- public static Builder fromServer(Server in) {
- return new Builder().uuid(in.getUuid()).name(in.getName()).resourceUri(in.getResourceUri()).owner(in.getOwner()).status(in.getStatus())
- .runtime(in.getRuntime());
- }
-
- /**
- * Warning: name, cpu, memory & vncPassword should be specified
- *
- * @return server with details
- */
- public ServerInfo build() {
- return new ServerInfo(uuid, name, resourceUri, owner, status, runtime, cpu, cpusInsteadOfCores, drives
- , enableNuma, hvRelaxed, hvTsc, memory, meta, nics, requirements, tags, vncPassword, smp);
- }
- }
-
- private final int cpu;
- @Named("cpus_instead_of_cores")
- private final boolean cpusInsteadOfCores;
- private final List<ServerDrive> drives;
- @Named("enable_numa")
- private final boolean enableNuma;
- @Named("hv_relaxed")
- private final boolean hvRelaxed;
- @Named("hv_tsc")
- private final boolean hvTsc;
- @Named("mem")
- private final BigInteger memory;
- private final Map<String, String> meta;
- private final List<NIC> nics;
- private final List<String> requirements;
- private final List<String> tags;
- @Named("vnc_password")
- private final String vncPassword;
- private final int smp;
-
- @ConstructorProperties({
- "uuid", "name", "resource_uri", "owner", "status", "runtime",
- "cpu", "cpus_instead_of_cores", "drives", "enable_numa",
- "hv_relaxed", "hv_tsc", "mem", "meta", "nics",
- "requirements", "tags", "vnc_password", "smp"
- })
- public ServerInfo(String uuid, String name, URI resourceUri, Owner owner, ServerStatus status, ServerRuntime runtime
- , int cpu, boolean cpusInsteadOfCores, List<ServerDrive> drives, boolean enableNuma
- , boolean hvRelaxed, boolean hvTsc, BigInteger memory, Map<String, String> meta, List<NIC> nics
- , List<String> requirements, List<String> tags, String vncPassword, int smp) {
- super(uuid, name, resourceUri, owner, status, runtime);
- this.cpu = cpu;
- this.cpusInsteadOfCores = cpusInsteadOfCores;
- this.drives = drives == null ? new ArrayList<ServerDrive>() : drives;
- this.enableNuma = enableNuma;
- this.hvRelaxed = hvRelaxed;
- this.hvTsc = hvTsc;
- this.memory = memory;
- this.meta = meta;
- this.nics = nics == null ? new ArrayList<NIC>() : nics;
- this.requirements = requirements;
- this.tags = tags;
- this.vncPassword = vncPassword;
- this.smp = smp;
- }
-
- /**
- * @return server’s CPU Clock speed measured in MHz
- */
- public int getCpu() {
- return cpu;
- }
-
- /**
- * @return expose server SMPs as separate CPUs, instead of cores of a single CPU
- */
- public boolean isCpusInsteadOfCores() {
- return cpusInsteadOfCores;
- }
-
- /**
- * @return list of attached Drives to server
- */
- public List<ServerDrive> getDrives() {
- return drives;
- }
-
- /**
- * @return expose NUMA topology to the server
- */
- public boolean isNumaEnabled() {
- return enableNuma;
- }
-
- /**
- * @return improve performance of Windows servers
- */
- public boolean isHvRelaxed() {
- return hvRelaxed;
- }
-
- /**
- * @return improves performance of Windows servers with the trade off that the servers
- */
- public boolean isHvTsc() {
- return hvTsc;
- }
-
- /**
- * @return server’s Random Access Memory measured in bytes
- */
- public BigInteger getMemory() {
- return memory;
- }
-
- /**
- * @return user assigned meta information for this server
- */
- public Map<String, String> getMeta() {
- return meta;
- }
-
- /**
- * @return list of nics attached to this server
- */
- public List<NIC> getNics() {
- return nics;
- }
-
- /**
- * @return a collection of special requirements for this server
- */
- public List<String> getRequirements() {
- return requirements;
- }
-
- /**
- * @return list of tags this server is associated with
- */
- public List<String> getTags() {
- return tags;
- }
-
- /**
- * @return VNC Password to connect to server
- */
- public String getVncPassword() {
- return vncPassword;
- }
-
- /**
- * @return Symmetric Multiprocessing (SMP) i.e. number of CPU cores
- */
- public int getSmp() {
- return smp;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (!(o instanceof ServerInfo)) return false;
- if (!super.equals(o)) return false;
-
- ServerInfo that = (ServerInfo) o;
-
- if (cpu != that.cpu) return false;
- if (cpusInsteadOfCores != that.cpusInsteadOfCores) return false;
- if (enableNuma != that.enableNuma) return false;
- if (hvRelaxed != that.hvRelaxed) return false;
- if (hvTsc != that.hvTsc) return false;
- if (smp != that.smp) return false;
- if (drives != null ? !drives.equals(that.drives) : that.drives != null) return false;
- if (memory != null ? !memory.equals(that.memory) : that.memory != null) return false;
- if (meta != null ? !meta.equals(that.meta) : that.meta != null) return false;
- if (nics != null ? !nics.equals(that.nics) : that.nics != null) return false;
- if (requirements != null ? !requirements.equals(that.requirements) : that.requirements != null) return false;
- if (tags != null ? !tags.equals(that.tags) : that.tags != null) return false;
- if (vncPassword != null ? !vncPassword.equals(that.vncPassword) : that.vncPassword != null) return false;
-
- return true;
- }
-
- @Override
- public int hashCode() {
- int result = super.hashCode();
- result = 31 * result + cpu;
- result = 31 * result + (cpusInsteadOfCores ? 1 : 0);
- result = 31 * result + (drives != null ? drives.hashCode() : 0);
- result = 31 * result + (enableNuma ? 1 : 0);
- result = 31 * result + (hvRelaxed ? 1 : 0);
- result = 31 * result + (hvTsc ? 1 : 0);
- result = 31 * result + (memory != null ? memory.hashCode() : 0);
- result = 31 * result + (meta != null ? meta.hashCode() : 0);
- result = 31 * result + (nics != null ? nics.hashCode() : 0);
- result = 31 * result + (requirements != null ? requirements.hashCode() : 0);
- result = 31 * result + (tags != null ? tags.hashCode() : 0);
- result = 31 * result + (vncPassword != null ? vncPassword.hashCode() : 0);
- result = 31 * result + smp;
- return result;
- }
-
- @Override
- public String toString() {
- return "[uuid=" + uuid + ", name=" + name + ", resourceUri=" + resourceUri + ", owner=" + owner
- + ", status=" + status + ", runtime=" + runtime + ", cpu=" + cpu + ", cpusInsteadOfCores=" + cpusInsteadOfCores
- + ", enableNuma=" + enableNuma + ", hvRelaxed=" + hvRelaxed + ", hvTsc=" + hvTsc + ", memory=" + memory
- + ", drives=" + drives + ", meta=" + meta + ", nics=" + nics + ", requirements=" + requirements
- + ", tags=" + tags + ", vncPassword=" + vncPassword + ", smp=" + smp + "]";
- }
+ public static class Builder extends Server.Builder {
+ private int cpu;
+ private boolean cpusInsteadOfCores;
+ private List<ServerDrive> drives;
+ private boolean enableNuma;
+ private boolean hvRelaxed;
+ private boolean hvTsc;
+ private BigInteger memory;
+ private Map<String, String> meta;
+ private List<NIC> nics;
+ private List<String> requirements;
+ private List<String> tags;
+ private String vncPassword;
+ private int smp;
+
+ /**
+ * @param cpu server’s CPU Clock speed measured in MHz
+ * @return ServerInfo Builder
+ */
+ public Builder cpu(int cpu) {
+ this.cpu = cpu;
+ return this;
+ }
+
+ /**
+ * @param cpusInsteadOfCores expose server SMPs as separate CPUs, instead of cores of a single CPU
+ * @return ServerInfo Builder
+ */
+ public Builder cpusInsteadOfCores(boolean cpusInsteadOfCores) {
+ this.cpusInsteadOfCores = cpusInsteadOfCores;
+ return this;
+ }
+
+ /**
+ * @param drives list of attached Drives to server
+ * @return ServerInfo Builder
+ */
+ public Builder drives(List<ServerDrive> drives) {
+ this.drives = ImmutableList.copyOf(drives);
+ return this;
+ }
+
+ /**
+ * @param enableNuma expose NUMA topology to the server
+ * @return ServerInfo Builder
+ */
+ public Builder enableNuma(boolean enableNuma) {
+ this.enableNuma = enableNuma;
+ return this;
+ }
+
+ /**
+ * @param hvRelaxed improve performance of Windows servers
+ * @return ServerInfo Builder
+ */
+ public Builder hvRelaxed(boolean hvRelaxed) {
+ this.hvRelaxed = hvRelaxed;
+ return this;
+ }
+
+ /**
+ * @param hvTsc improves performance of Windows servers with the trade off that the servers
+ * @return ServerInfo Builder
+ */
+ public Builder hvTsc(boolean hvTsc) {
+ this.hvTsc = hvTsc;
+ return this;
+ }
+
+ /**
+ * @param memory server’s Random Access Memory measured in bytes
+ * @return ServerInfo Builder
+ */
+ public Builder memory(BigInteger memory) {
+ this.memory = memory;
+ return this;
+ }
+
+ /**
+ * @param meta user assigned meta information for this server
+ * @return ServerInfo Builder
+ */
+ public Builder meta(Map<String, String> meta) {
+ this.meta = meta;
+ return this;
+ }
+
+ /**
+ * @param nics list of nics attached to this server
+ * @return ServerInfo Builder
+ */
+ public Builder nics(List<NIC> nics) {
+ this.nics = ImmutableList.copyOf(nics);
+ return this;
+ }
+
+ /**
+ * @param requirements a collection of special requirements for this server
+ * @return ServerInfo Builder
+ */
+ public Builder requirements(List<String> requirements) {
+ this.requirements = ImmutableList.copyOf(requirements);
+ return this;
+ }
+
+ /**
+ * @param tags list of tags this server is associated with
+ * @return ServerInfo Builder
+ */
+ public Builder tags(List<String> tags) {
+ this.tags = ImmutableList.copyOf(tags);
+ return this;
+ }
+
+ /**
+ * @param vncPassword VNC Password to connect to server
+ * @return ServerInfo Builder
+ */
+ public Builder vncPassword(String vncPassword) {
+ this.vncPassword = vncPassword;
+ return this;
+ }
+
+ /**
+ * @param smp Symmetric Multiprocessing (SMP) i.e. number of CPU cores
+ * @return ServerInfo Builder
+ */
+ public Builder smp(int smp) {
+ this.smp = smp;
+ return this;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @return ServerInfo Builder
+ */
+ @Override
+ public Builder owner(Owner owner) {
+ return Builder.class.cast(super.owner(owner));
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @return ServerInfo Builder
+ */
+ @Override
+ public Builder status(ServerStatus status) {
+ return Builder.class.cast(super.status(status));
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @return ServerInfo Builder
+ */
+ @Override
+ public Builder runtime(ServerRuntime runtime) {
+ return Builder.class.cast(super.runtime(runtime));
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @return ServerInfo Builder
+ */
+ @Override
+ public Builder uuid(String uuid) {
+ return Builder.class.cast(super.uuid(uuid));
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @return ServerInfo Builder
+ */
+ @Override
+ public Builder name(String name) {
+ return Builder.class.cast(super.name(name));
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @return ServerInfo Builder
+ */
+ @Override
+ public Builder resourceUri(URI resourceUri) {
+ return Builder.class.cast(super.resourceUri(resourceUri));
+ }
+
+ public static Builder fromServerInfo(ServerInfo serverInfo) {
+ return new Builder()
+ .uuid(serverInfo.getUuid())
+ .name(serverInfo.getName())
+ .resourceUri(serverInfo.getResourceUri())
+ .owner(serverInfo.getOwner())
+ .status(serverInfo.getStatus())
+ .runtime(serverInfo.getRuntime())
+ .cpusInsteadOfCores(serverInfo.isCpusInsteadOfCores())
+ .drives(serverInfo.getDrives())
+ .enableNuma(serverInfo.isNumaEnabled())
+ .hvRelaxed(serverInfo.isHvRelaxed())
+ .hvTsc(serverInfo.isHvTsc())
+ .memory(serverInfo.getMemory())
+ .meta(serverInfo.getMeta())
+ .nics(serverInfo.getNics())
+ .requirements(serverInfo.getRequirements())
+ .tags(serverInfo.getTags())
+ .vncPassword(serverInfo.getVncPassword())
+ .smp(serverInfo.getSmp());
+ }
+
+ public static Builder fromServer(Server in) {
+ return new Builder()
+ .uuid(in.getUuid())
+ .name(in.getName())
+ .resourceUri(in.getResourceUri())
+ .owner(in.getOwner())
+ .status(in.getStatus())
+ .runtime(in.getRuntime());
+ }
+
+ /**
+ * Warning: name, cpu, memory & vncPassword should be specified
+ *
+ * @return server with details
+ */
+ public ServerInfo build() {
+ return new ServerInfo(uuid, name, resourceUri, owner, status, runtime, cpu, cpusInsteadOfCores, drives
+ , enableNuma, hvRelaxed, hvTsc, memory, meta, nics, requirements, tags, vncPassword, smp);
+ }
+ }
+
+ private final int cpu;
+ @Named("cpus_instead_of_cores")
+ private final boolean cpusInsteadOfCores;
+ private final List<ServerDrive> drives;
+ @Named("enable_numa")
+ private final boolean enableNuma;
+ @Named("hv_relaxed")
+ private final boolean hvRelaxed;
+ @Named("hv_tsc")
+ private final boolean hvTsc;
+ @Named("mem")
+ private final BigInteger memory;
+ private final Map<String, String> meta;
+ private final List<NIC> nics;
+ private final List<String> requirements;
+ private final List<String> tags;
+ @Named("vnc_password")
+ private final String vncPassword;
+ private final int smp;
+
+ @ConstructorProperties({
+ "uuid", "name", "resource_uri", "owner", "status", "runtime",
+ "cpu", "cpus_instead_of_cores", "drives", "enable_numa",
+ "hv_relaxed", "hv_tsc", "mem", "meta", "nics",
+ "requirements", "tags", "vnc_password", "smp"
+ })
+ public ServerInfo(String uuid, String name, URI resourceUri, Owner owner, ServerStatus status, ServerRuntime runtime
+ , int cpu, boolean cpusInsteadOfCores, List<ServerDrive> drives, boolean enableNuma
+ , boolean hvRelaxed, boolean hvTsc, BigInteger memory, Map<String, String> meta, List<NIC> nics
+ , List<String> requirements, List<String> tags, String vncPassword, int smp) {
+ super(uuid, name, resourceUri, owner, status, runtime);
+ this.cpu = cpu;
+ this.cpusInsteadOfCores = cpusInsteadOfCores;
+ this.drives = drives == null ? new ArrayList<ServerDrive>() : drives;
+ this.enableNuma = enableNuma;
+ this.hvRelaxed = hvRelaxed;
+ this.hvTsc = hvTsc;
+ this.memory = memory;
+ this.meta = meta;
+ this.nics = nics == null ? new ArrayList<NIC>() : nics;
+ this.requirements = requirements;
+ this.tags = tags;
+ this.vncPassword = vncPassword;
+ this.smp = smp;
+ }
+
+ /**
+ * @return server’s CPU Clock speed measured in MHz
+ */
+ public int getCpu() {
+ return cpu;
+ }
+
+ /**
+ * @return expose server SMPs as separate CPUs, instead of cores of a single CPU
+ */
+ public boolean isCpusInsteadOfCores() {
+ return cpusInsteadOfCores;
+ }
+
+ /**
+ * @return list of attached Drives to server
+ */
+ public List<ServerDrive> getDrives() {
+ return drives;
+ }
+
+ /**
+ * @return expose NUMA topology to the server
+ */
+ public boolean isNumaEnabled() {
+ return enableNuma;
+ }
+
+ /**
+ * @return improve performance of Windows servers
+ */
+ public boolean isHvRelaxed() {
+ return hvRelaxed;
+ }
+
+ /**
+ * @return improves performance of Windows servers with the trade off that the servers
+ */
+ public boolean isHvTsc() {
+ return hvTsc;
+ }
+
+ /**
+ * @return server’s Random Access Memory measured in bytes
+ */
+ public BigInteger getMemory() {
+ return memory;
+ }
+
+ /**
+ * @return user assigned meta information for this server
+ */
+ public Map<String, String> getMeta() {
+ return meta;
+ }
+
+ /**
+ * @return list of nics attached to this server
+ */
+ public List<NIC> getNics() {
+ return nics;
+ }
+
+ /**
+ * @return a collection of special requirements for this server
+ */
+ public List<String> getRequirements() {
+ return requirements;
+ }
+
+ /**
+ * @return list of tags this server is associated with
+ */
+ public List<String> getTags() {
+ return tags;
+ }
+
+ /**
+ * @return VNC Password to connect to server
+ */
+ public String getVncPassword() {
+ return vncPassword;
+ }
+
+ /**
+ * @return Symmetric Multiprocessing (SMP) i.e. number of CPU cores
+ */
+ public int getSmp() {
+ return smp;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (!(o instanceof ServerInfo)) return false;
+ if (!super.equals(o)) return false;
+
+ ServerInfo that = (ServerInfo) o;
+
+ if (cpu != that.cpu) return false;
+ if (cpusInsteadOfCores != that.cpusInsteadOfCores) return false;
+ if (enableNuma != that.enableNuma) return false;
+ if (hvRelaxed != that.hvRelaxed) return false;
+ if (hvTsc != that.hvTsc) return false;
+ if (smp != that.smp) return false;
+ if (drives != null ? !drives.equals(that.drives) : that.drives != null) return false;
+ if (memory != null ? !memory.equals(that.memory) : that.memory != null) return false;
+ if (meta != null ? !meta.equals(that.meta) : that.meta != null) return false;
+ if (nics != null ? !nics.equals(that.nics) : that.nics != null) return false;
+ if (requirements != null ? !requirements.equals(that.requirements) : that.requirements != null) return false;
+ if (tags != null ? !tags.equals(that.tags) : that.tags != null) return false;
+ if (vncPassword != null ? !vncPassword.equals(that.vncPassword) : that.vncPassword != null) return false;
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = super.hashCode();
+ result = 31 * result + cpu;
+ result = 31 * result + (cpusInsteadOfCores ? 1 : 0);
+ result = 31 * result + (drives != null ? drives.hashCode() : 0);
+ result = 31 * result + (enableNuma ? 1 : 0);
+ result = 31 * result + (hvRelaxed ? 1 : 0);
+ result = 31 * result + (hvTsc ? 1 : 0);
+ result = 31 * result + (memory != null ? memory.hashCode() : 0);
+ result = 31 * result + (meta != null ? meta.hashCode() : 0);
+ result = 31 * result + (nics != null ? nics.hashCode() : 0);
+ result = 31 * result + (requirements != null ? requirements.hashCode() : 0);
+ result = 31 * result + (tags != null ? tags.hashCode() : 0);
+ result = 31 * result + (vncPassword != null ? vncPassword.hashCode() : 0);
+ result = 31 * result + smp;
+ return result;
+ }
+
+ @Override
+ public String toString() {
+ return "[uuid=" + uuid + ", name=" + name + ", resourceUri=" + resourceUri + ", owner=" + owner
+ + ", status=" + status + ", runtime=" + runtime + ", cpu=" + cpu + ", cpusInsteadOfCores="
+ + cpusInsteadOfCores + ", enableNuma=" + enableNuma + ", hvRelaxed=" + hvRelaxed + ", "
+ + "hvTsc=" + hvTsc + ", memory=" + memory + ", drives=" + drives + ", meta=" + meta + ", "
+ + "nics=" + nics + ", requirements=" + requirements + ", tags=" + tags + ", "
+ +"vncPassword=" + vncPassword + ", smp=" + smp + "]";
+ }
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0d70c84a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/ServerRuntime.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/ServerRuntime.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/ServerRuntime.java
index a0e4fa6..462f741 100644
--- a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/ServerRuntime.java
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/ServerRuntime.java
@@ -25,72 +25,72 @@ import java.util.Date;
*/
public class ServerRuntime {
- public static class Builder{
- private Date activeSince;
- private Iterable<NICStats> nicStats;
+ public static class Builder {
+ private Date activeSince;
+ private Iterable<NICStats> nicStats;
- public Builder activeSince(Date activeSince) {
- this.activeSince = activeSince;
- return this;
- }
+ public Builder activeSince(Date activeSince) {
+ this.activeSince = activeSince;
+ return this;
+ }
- public Builder nicStats(Iterable<NICStats> nicStats) {
- this.nicStats = nicStats;
- return this;
- }
+ public Builder nicStats(Iterable<NICStats> nicStats) {
+ this.nicStats = nicStats;
+ return this;
+ }
- public ServerRuntime build() {
- return new ServerRuntime(activeSince, nicStats);
- }
- }
+ public ServerRuntime build() {
+ return new ServerRuntime(activeSince, nicStats);
+ }
+ }
- @Named("active_since")
- private final Date activeSince;
- @Named("nics")
- private final Iterable<NICStats> nicStats;
+ @Named("active_since")
+ private final Date activeSince;
+ @Named("nics")
+ private final Iterable<NICStats> nicStats;
- @ConstructorProperties({
- "active_since", "nics"
- })
- public ServerRuntime(Date activeSince, Iterable<NICStats> nicStats){
- this.activeSince = activeSince;
- this.nicStats = nicStats;
- }
+ @ConstructorProperties({
+ "active_since", "nics"
+ })
+ public ServerRuntime(Date activeSince, Iterable<NICStats> nicStats) {
+ this.activeSince = activeSince;
+ this.nicStats = nicStats;
+ }
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = super.hashCode();
- result = prime * result + ((nicStats == null) ? 0 : nicStats.hashCode());
- result = prime * result + ((activeSince == null) ? 0 : activeSince.hashCode());
- return result;
- }
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = super.hashCode();
+ result = prime * result + ((nicStats == null) ? 0 : nicStats.hashCode());
+ result = prime * result + ((activeSince == null) ? 0 : activeSince.hashCode());
+ return result;
+ }
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (!super.equals(obj))
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (!super.equals(obj))
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ ServerRuntime other = (ServerRuntime) obj;
+ if (nicStats == null) {
+ if (other.nicStats != null)
return false;
- if (getClass() != obj.getClass())
+ } else if (!nicStats.equals(other.nicStats))
+ return false;
+ if (activeSince == null) {
+ if (other.activeSince != null)
return false;
- ServerRuntime other = (ServerRuntime) obj;
- if (nicStats == null) {
- if (other.nicStats != null)
- return false;
- } else if (!nicStats.equals(other.nicStats))
- return false;
- if (activeSince == null) {
- if (other.activeSince != null)
- return false;
- } else if (!activeSince.equals(other.activeSince))
- return false;
- return true;
- }
+ } else if (!activeSince.equals(other.activeSince))
+ return false;
+ return true;
+ }
- @Override
- public String toString() {
- return "[activeSince=" + activeSince + ", nicStats=" + nicStats + "]";
- }
+ @Override
+ public String toString() {
+ return "[activeSince=" + activeSince + ", nicStats=" + nicStats + "]";
+ }
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0d70c84a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/ServerStatus.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/ServerStatus.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/ServerStatus.java
index 0fd720f..82cb8eb 100644
--- a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/ServerStatus.java
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/ServerStatus.java
@@ -19,11 +19,11 @@ package org.jclouds.cloudsigma2.domain;
import static com.google.common.base.Preconditions.checkNotNull;
/**
- *
* @author Adrian Cole
*/
public enum ServerStatus {
RUNNING, STARTING, STOPPING, STOPPED, PAUSED, UNAVAILABLE, UNRECOGNIZED;
+
public String value() {
return name().toLowerCase();
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0d70c84a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/Subscription.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/Subscription.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/Subscription.java
index c63898a..1d0495f 100644
--- a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/Subscription.java
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/Subscription.java
@@ -29,436 +29,436 @@ import java.util.List;
*/
public class Subscription {
- public static class Builder{
- private String amount;
- private boolean isAutoRenewEnabled;
- private List<URI> descendants;
- private double discountAmount;
- private double discountPercent;
- private Date endTime;
- private String id;
- private Date lastNotification;
- private String period;
- private double price;
- private String remaining;
- private SubscriptionResource resource;
- private URI resourceUri;
- private Date startTime;
- private String status;
- private String subscribedObject;
- private String uuid;
-
- /**
- * @param amount
- * @return Subscription Binder
- */
- public Builder amount(String amount){
- this.amount = amount;
- return this;
- }
-
- /**
- * @param isAutoRenewEnabled States if the subscription will auto renew on expire
- * @return Subscription Binder
- */
- public Builder isAutoRenewEnabled(boolean isAutoRenewEnabled){
- this.isAutoRenewEnabled = isAutoRenewEnabled;
- return this;
- }
-
- /**
- * @param descendants Subscriptions that have been extended from the current one
- * @return Subscription Binder
- */
- public Builder descendants(List<URI> descendants){
- this.descendants = ImmutableList.copyOf(descendants);
- return this;
- }
-
- /**
- * @param discountAmount Amount of discount
- * @return Subscription Binder
- */
- public Builder discountAmount(double discountAmount){
- this.discountAmount = discountAmount;
- return this;
- }
-
- /**
- * @param discountPercent Percent of discount
- * @return Subscription Binder
- */
- public Builder discountPercent(double discountPercent){
- this.discountPercent = discountPercent;
- return this;
- }
-
- /**
- * @param endTime End time of subscription
- * @return Subscription Binder
- */
- public Builder endTime(Date endTime){
- this.endTime = endTime;
- return this;
- }
-
- /**
- * @param id unique id
- * @return Subscription Binder
- */
- public Builder id(String id){
- this.id = id;
- return this;
- }
-
- /**
- * @param lastNotification A date & time of last notification
- * @return Subscription Binder
- */
- public Builder lastNotification(Date lastNotification){
- this.lastNotification = lastNotification;
- return this;
- }
-
- /**
- * @param period Duration of the subscription
- * @return Subscription Binder
- */
- public Builder period(String period){
- this.period = period;
- return this;
- }
-
- /**
- * @param price Subscription price
- * @return Subscription Binder
- */
- public Builder price(double price){
- this.price = price;
- return this;
- }
-
- /**
- * @param remaining Amount remaining
- * @return Subscription Binder
- */
- public Builder remaining(String remaining){
- this.remaining = remaining;
- return this;
- }
-
- /**
- * @param resource Name of resource associated with the subscription
- * @return Subscription Binder
- */
- public Builder resource(SubscriptionResource resource){
- this.resource = resource;
- return this;
- }
-
- /**
- * @param resourceUri Resource URI
- * @return Subscription Binder
- */
- public Builder resourceUri(URI resourceUri){
- this.resourceUri = resourceUri;
- return this;
- }
-
- /**
- * @param startTime Start time of subscription
- * @return Subscription Binder
- */
- public Builder startTime(Date startTime){
- this.startTime = startTime;
- return this;
- }
-
- /**
- * @param status Status of the subscription
- * @return Subscription Binder
- */
- public Builder status(String status){
- this.status = status;
- return this;
- }
-
- /**
- * @param subscribedObject Subscribed object - the target of this subscription, if applicable
- * @return Subscription Binder
- */
- public Builder subscribedObject(String subscribedObject){
- this.subscribedObject = subscribedObject;
- return this;
- }
-
- /**
- * @param uuid Subscription uuid
- * @return Subscription Binder
- */
- public Builder uuid(String uuid){
- this.uuid = uuid;
- return this;
- }
-
- public Subscription build(){
- return new Subscription(amount, isAutoRenewEnabled, descendants, discountAmount, discountPercent, endTime
- , id, lastNotification, period, price, remaining, resource, resourceUri, startTime, status
- , subscribedObject, uuid);
- }
- }
-
- private final String amount;
- @Named("auto_renew")
- private final boolean isAutoRenewEnabled;
- private final List<URI> descendants;
- @Named("discount_amount")
- private final double discountAmount;
- @Named("discount_percent")
- private final double discountPercent;
- @Named("end_time")
- private final Date endTime;
- private final String id;
- @Named("last_notification")
- private final Date lastNotification;
- private final String period;
- private final double price;
- private final String remaining;
- private final SubscriptionResource resource;
- @Named("resource_uri")
- private final URI resourceUri;
- @Named("start_time")
- private final Date startTime;
- private final String status;
- @Named("subscribed_object")
- private final String subscribedObject;
- private final String uuid;
-
- @ConstructorProperties({
- "amount", "auto_renew", "descendants", "discount_amount"
- , "discount_percent", "end_time", "id", "last_notification", "period", "price"
- , "remaining", "resource", "resource_uri", "start_time", "status"
- , "subscribed_object", "uuid"
- })
- public Subscription(String amount, boolean autoRenewEnabled, List<URI> descendants, double discountAmount
- , double discountPercent, Date endTime, String id, Date lastNotification, String period, double price
- , String remaining, SubscriptionResource resource, URI resourceUri, Date startTime, String status
- , String subscribedObject, String uuid) {
- this.amount = amount;
- isAutoRenewEnabled = autoRenewEnabled;
- this.descendants = descendants;
- this.discountAmount = discountAmount;
- this.discountPercent = discountPercent;
- this.endTime = endTime;
- this.id = id;
- this.lastNotification = lastNotification;
- this.period = period;
- this.price = price;
- this.remaining = remaining;
- this.resource = resource;
- this.resourceUri = resourceUri;
- this.startTime = startTime;
- this.status = status;
- this.subscribedObject = subscribedObject;
- this.uuid = uuid;
- }
-
- /**
- * @return Subscription amount
- */
- public String getAmount() {
- return amount;
- }
-
- /**
- * @return States if the subscription will auto renew on expire
- */
- public boolean isAutoRenewEnabled() {
- return isAutoRenewEnabled;
- }
-
- /**
- * @return Subscriptions that have been extended from the current one
- */
- public List<URI> getDescendants() {
- return descendants;
- }
-
- /**
- * @return Amount of discount
- */
- public double getDiscountAmount() {
- return discountAmount;
- }
-
- /**
- * @return Percent of discount
- */
- public double getDiscountPercent() {
- return discountPercent;
- }
-
- /**
- * @return End time of subscription
- */
- public Date getEndTime() {
- return endTime;
- }
-
- /**
- * @return "Unicode id
- */
- public String getId() {
- return id;
- }
-
- /**
- * @return A date & time of last notification
- */
- public Date getLastNotification() {
- return lastNotification;
- }
-
- /**
- * @return Duration of the subscription
- */
- public String getPeriod() {
- return period;
- }
-
- /**
- * @return Subscription price
- */
- public double getPrice() {
- return price;
- }
-
- /**
- * @return Amount remaining
- */
- public String getRemaining() {
- return remaining;
- }
-
- /**
- * @return Name of resource associated with the subscription
- */
- public SubscriptionResource getResource() {
- return resource;
- }
-
- /**
- * @return resource uri
- */
- public URI getResourceUri() {
- return resourceUri;
- }
-
- /**
- * @return Start time of subscription
- */
- public Date getStartTime() {
- return startTime;
- }
-
- /**
- * @return "Status of the subscription
- */
- public String getStatus() {
- return status;
- }
-
- /**
- * @return Subscribed object - the target of this subscription, if applicable
- */
- public String getSubscribedObject() {
- return subscribedObject;
- }
-
- /**
- * @return subscription uuid
- */
- public String getUuid() {
- return uuid;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (!(o instanceof Subscription)) return false;
-
- Subscription that = (Subscription) o;
-
- if (Double.compare(that.discountAmount, discountAmount) != 0) return false;
- if (Double.compare(that.discountPercent, discountPercent) != 0) return false;
- if (isAutoRenewEnabled != that.isAutoRenewEnabled) return false;
- if (Double.compare(that.price, price) != 0) return false;
- if (amount != null ? !amount.equals(that.amount) : that.amount != null) return false;
- if (descendants != null ? !descendants.equals(that.descendants) : that.descendants != null) return false;
- if (endTime != null ? !endTime.equals(that.endTime) : that.endTime != null) return false;
- if (id != null ? !id.equals(that.id) : that.id != null) return false;
- if (lastNotification != null ? !lastNotification.equals(that.lastNotification) : that.lastNotification != null)
- return false;
- if (period != null ? !period.equals(that.period) : that.period != null) return false;
- if (remaining != null ? !remaining.equals(that.remaining) : that.remaining != null) return false;
- if (resource != null ? !resource.equals(that.resource) : that.resource != null) return false;
- if (resourceUri != null ? !resourceUri.equals(that.resourceUri) : that.resourceUri != null) return false;
- if (startTime != null ? !startTime.equals(that.startTime) : that.startTime != null) return false;
- if (status != null ? !status.equals(that.status) : that.status != null) return false;
- if (subscribedObject != null ? !subscribedObject.equals(that.subscribedObject) : that.subscribedObject != null)
- return false;
- if (uuid != null ? !uuid.equals(that.uuid) : that.uuid != null) return false;
-
- return true;
- }
-
- @Override
- public int hashCode() {
- int result;
- long temp;
- result = amount != null ? amount.hashCode() : 0;
- result = 31 * result + (isAutoRenewEnabled ? 1 : 0);
- result = 31 * result + (descendants != null ? descendants.hashCode() : 0);
- temp = Double.doubleToLongBits(discountAmount);
- result = 31 * result + (int) (temp ^ (temp >>> 32));
- temp = Double.doubleToLongBits(discountPercent);
- result = 31 * result + (int) (temp ^ (temp >>> 32));
- result = 31 * result + (endTime != null ? endTime.hashCode() : 0);
- result = 31 * result + (id != null ? id.hashCode() : 0);
- result = 31 * result + (lastNotification != null ? lastNotification.hashCode() : 0);
- result = 31 * result + (period != null ? period.hashCode() : 0);
- temp = Double.doubleToLongBits(price);
- result = 31 * result + (int) (temp ^ (temp >>> 32));
- result = 31 * result + (remaining != null ? remaining.hashCode() : 0);
- result = 31 * result + (resource != null ? resource.hashCode() : 0);
- result = 31 * result + (resourceUri != null ? resourceUri.hashCode() : 0);
- result = 31 * result + (startTime != null ? startTime.hashCode() : 0);
- result = 31 * result + (status != null ? status.hashCode() : 0);
- result = 31 * result + (subscribedObject != null ? subscribedObject.hashCode() : 0);
- result = 31 * result + (uuid != null ? uuid.hashCode() : 0);
- return result;
- }
-
- @Override
- public String toString() {
- return "[" +
- "amount='" + amount + '\'' +
- ", isAutoRenewEnabled=" + isAutoRenewEnabled +
- ", descendants=" + descendants +
- ", discountAmount=" + discountAmount +
- ", discountPercent=" + discountPercent +
- ", endTime=" + endTime +
- ", id='" + id + '\'' +
- ", lastNotification=" + lastNotification +
- ", period='" + period + '\'' +
- ", price=" + price +
- ", remaining='" + remaining + '\'' +
- ", resource='" + resource + '\'' +
- ", resourceUri=" + resourceUri +
- ", startTime=" + startTime +
- ", status='" + status + '\'' +
- ", subscribedObject='" + subscribedObject + '\'' +
- ", uuid='" + uuid + '\'' +
- "]";
- }
+ public static class Builder {
+ private String amount;
+ private boolean isAutoRenewEnabled;
+ private List<URI> descendants;
+ private double discountAmount;
+ private double discountPercent;
+ private Date endTime;
+ private String id;
+ private Date lastNotification;
+ private String period;
+ private double price;
+ private String remaining;
+ private SubscriptionResource resource;
+ private URI resourceUri;
+ private Date startTime;
+ private String status;
+ private String subscribedObject;
+ private String uuid;
+
+ /**
+ * @param amount
+ * @return Subscription Binder
+ */
+ public Builder amount(String amount) {
+ this.amount = amount;
+ return this;
+ }
+
+ /**
+ * @param isAutoRenewEnabled States if the subscription will auto renew on expire
+ * @return Subscription Binder
+ */
+ public Builder isAutoRenewEnabled(boolean isAutoRenewEnabled) {
+ this.isAutoRenewEnabled = isAutoRenewEnabled;
+ return this;
+ }
+
+ /**
+ * @param descendants Subscriptions that have been extended from the current one
+ * @return Subscription Binder
+ */
+ public Builder descendants(List<URI> descendants) {
+ this.descendants = ImmutableList.copyOf(descendants);
+ return this;
+ }
+
+ /**
+ * @param discountAmount Amount of discount
+ * @return Subscription Binder
+ */
+ public Builder discountAmount(double discountAmount) {
+ this.discountAmount = discountAmount;
+ return this;
+ }
+
+ /**
+ * @param discountPercent Percent of discount
+ * @return Subscription Binder
+ */
+ public Builder discountPercent(double discountPercent) {
+ this.discountPercent = discountPercent;
+ return this;
+ }
+
+ /**
+ * @param endTime End time of subscription
+ * @return Subscription Binder
+ */
+ public Builder endTime(Date endTime) {
+ this.endTime = endTime;
+ return this;
+ }
+
+ /**
+ * @param id unique id
+ * @return Subscription Binder
+ */
+ public Builder id(String id) {
+ this.id = id;
+ return this;
+ }
+
+ /**
+ * @param lastNotification A date & time of last notification
+ * @return Subscription Binder
+ */
+ public Builder lastNotification(Date lastNotification) {
+ this.lastNotification = lastNotification;
+ return this;
+ }
+
+ /**
+ * @param period Duration of the subscription
+ * @return Subscription Binder
+ */
+ public Builder period(String period) {
+ this.period = period;
+ return this;
+ }
+
+ /**
+ * @param price Subscription price
+ * @return Subscription Binder
+ */
+ public Builder price(double price) {
+ this.price = price;
+ return this;
+ }
+
+ /**
+ * @param remaining Amount remaining
+ * @return Subscription Binder
+ */
+ public Builder remaining(String remaining) {
+ this.remaining = remaining;
+ return this;
+ }
+
+ /**
+ * @param resource Name of resource associated with the subscription
+ * @return Subscription Binder
+ */
+ public Builder resource(SubscriptionResource resource) {
+ this.resource = resource;
+ return this;
+ }
+
+ /**
+ * @param resourceUri Resource URI
+ * @return Subscription Binder
+ */
+ public Builder resourceUri(URI resourceUri) {
+ this.resourceUri = resourceUri;
+ return this;
+ }
+
+ /**
+ * @param startTime Start time of subscription
+ * @return Subscription Binder
+ */
+ public Builder startTime(Date startTime) {
+ this.startTime = startTime;
+ return this;
+ }
+
+ /**
+ * @param status Status of the subscription
+ * @return Subscription Binder
+ */
+ public Builder status(String status) {
+ this.status = status;
+ return this;
+ }
+
+ /**
+ * @param subscribedObject Subscribed object - the target of this subscription, if applicable
+ * @return Subscription Binder
+ */
+ public Builder subscribedObject(String subscribedObject) {
+ this.subscribedObject = subscribedObject;
+ return this;
+ }
+
+ /**
+ * @param uuid Subscription uuid
+ * @return Subscription Binder
+ */
+ public Builder uuid(String uuid) {
+ this.uuid = uuid;
+ return this;
+ }
+
+ public Subscription build() {
+ return new Subscription(amount, isAutoRenewEnabled, descendants, discountAmount, discountPercent, endTime
+ , id, lastNotification, period, price, remaining, resource, resourceUri, startTime, status
+ , subscribedObject, uuid);
+ }
+ }
+
+ private final String amount;
+ @Named("auto_renew")
+ private final boolean isAutoRenewEnabled;
+ private final List<URI> descendants;
+ @Named("discount_amount")
+ private final double discountAmount;
+ @Named("discount_percent")
+ private final double discountPercent;
+ @Named("end_time")
+ private final Date endTime;
+ private final String id;
+ @Named("last_notification")
+ private final Date lastNotification;
+ private final String period;
+ private final double price;
+ private final String remaining;
+ private final SubscriptionResource resource;
+ @Named("resource_uri")
+ private final URI resourceUri;
+ @Named("start_time")
+ private final Date startTime;
+ private final String status;
+ @Named("subscribed_object")
+ private final String subscribedObject;
+ private final String uuid;
+
+ @ConstructorProperties({
+ "amount", "auto_renew", "descendants", "discount_amount"
+ , "discount_percent", "end_time", "id", "last_notification", "period", "price"
+ , "remaining", "resource", "resource_uri", "start_time", "status"
+ , "subscribed_object", "uuid"
+ })
+ public Subscription(String amount, boolean autoRenewEnabled, List<URI> descendants, double discountAmount
+ , double discountPercent, Date endTime, String id, Date lastNotification, String period, double price
+ , String remaining, SubscriptionResource resource, URI resourceUri, Date startTime, String status
+ , String subscribedObject, String uuid) {
+ this.amount = amount;
+ isAutoRenewEnabled = autoRenewEnabled;
+ this.descendants = descendants;
+ this.discountAmount = discountAmount;
+ this.discountPercent = discountPercent;
+ this.endTime = endTime;
+ this.id = id;
+ this.lastNotification = lastNotification;
+ this.period = period;
+ this.price = price;
+ this.remaining = remaining;
+ this.resource = resource;
+ this.resourceUri = resourceUri;
+ this.startTime = startTime;
+ this.status = status;
+ this.subscribedObject = subscribedObject;
+ this.uuid = uuid;
+ }
+
+ /**
+ * @return Subscription amount
+ */
+ public String getAmount() {
+ return amount;
+ }
+
+ /**
+ * @return States if the subscription will auto renew on expire
+ */
+ public boolean isAutoRenewEnabled() {
+ return isAutoRenewEnabled;
+ }
+
+ /**
+ * @return Subscriptions that have been extended from the current one
+ */
+ public List<URI> getDescendants() {
+ return descendants;
+ }
+
+ /**
+ * @return Amount of discount
+ */
+ public double getDiscountAmount() {
+ return discountAmount;
+ }
+
+ /**
+ * @return Percent of discount
+ */
+ public double getDiscountPercent() {
+ return discountPercent;
+ }
+
+ /**
+ * @return End time of subscription
+ */
+ public Date getEndTime() {
+ return endTime;
+ }
+
+ /**
+ * @return "Unicode id
+ */
+ public String getId() {
+ return id;
+ }
+
+ /**
+ * @return A date & time of last notification
+ */
+ public Date getLastNotification() {
+ return lastNotification;
+ }
+
+ /**
+ * @return Duration of the subscription
+ */
+ public String getPeriod() {
+ return period;
+ }
+
+ /**
+ * @return Subscription price
+ */
+ public double getPrice() {
+ return price;
+ }
+
+ /**
+ * @return Amount remaining
+ */
+ public String getRemaining() {
+ return remaining;
+ }
+
+ /**
+ * @return Name of resource associated with the subscription
+ */
+ public SubscriptionResource getResource() {
+ return resource;
+ }
+
+ /**
+ * @return resource uri
+ */
+ public URI getResourceUri() {
+ return resourceUri;
+ }
+
+ /**
+ * @return Start time of subscription
+ */
+ public Date getStartTime() {
+ return startTime;
+ }
+
+ /**
+ * @return "Status of the subscription
+ */
+ public String getStatus() {
+ return status;
+ }
+
+ /**
+ * @return Subscribed object - the target of this subscription, if applicable
+ */
+ public String getSubscribedObject() {
+ return subscribedObject;
+ }
+
+ /**
+ * @return subscription uuid
+ */
+ public String getUuid() {
+ return uuid;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (!(o instanceof Subscription)) return false;
+
+ Subscription that = (Subscription) o;
+
+ if (Double.compare(that.discountAmount, discountAmount) != 0) return false;
+ if (Double.compare(that.discountPercent, discountPercent) != 0) return false;
+ if (isAutoRenewEnabled != that.isAutoRenewEnabled) return false;
+ if (Double.compare(that.price, price) != 0) return false;
+ if (amount != null ? !amount.equals(that.amount) : that.amount != null) return false;
+ if (descendants != null ? !descendants.equals(that.descendants) : that.descendants != null) return false;
+ if (endTime != null ? !endTime.equals(that.endTime) : that.endTime != null) return false;
+ if (id != null ? !id.equals(that.id) : that.id != null) return false;
+ if (lastNotification != null ? !lastNotification.equals(that.lastNotification) : that.lastNotification != null)
+ return false;
+ if (period != null ? !period.equals(that.period) : that.period != null) return false;
+ if (remaining != null ? !remaining.equals(that.remaining) : that.remaining != null) return false;
+ if (resource != null ? !resource.equals(that.resource) : that.resource != null) return false;
+ if (resourceUri != null ? !resourceUri.equals(that.resourceUri) : that.resourceUri != null) return false;
+ if (startTime != null ? !startTime.equals(that.startTime) : that.startTime != null) return false;
+ if (status != null ? !status.equals(that.status) : that.status != null) return false;
+ if (subscribedObject != null ? !subscribedObject.equals(that.subscribedObject) : that.subscribedObject != null)
+ return false;
+ if (uuid != null ? !uuid.equals(that.uuid) : that.uuid != null) return false;
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int result;
+ long temp;
+ result = amount != null ? amount.hashCode() : 0;
+ result = 31 * result + (isAutoRenewEnabled ? 1 : 0);
+ result = 31 * result + (descendants != null ? descendants.hashCode() : 0);
+ temp = Double.doubleToLongBits(discountAmount);
+ result = 31 * result + (int) (temp ^ (temp >>> 32));
+ temp = Double.doubleToLongBits(discountPercent);
+ result = 31 * result + (int) (temp ^ (temp >>> 32));
+ result = 31 * result + (endTime != null ? endTime.hashCode() : 0);
+ result = 31 * result + (id != null ? id.hashCode() : 0);
+ result = 31 * result + (lastNotification != null ? lastNotification.hashCode() : 0);
+ result = 31 * result + (period != null ? period.hashCode() : 0);
+ temp = Double.doubleToLongBits(price);
+ result = 31 * result + (int) (temp ^ (temp >>> 32));
+ result = 31 * result + (remaining != null ? remaining.hashCode() : 0);
+ result = 31 * result + (resource != null ? resource.hashCode() : 0);
+ result = 31 * result + (resourceUri != null ? resourceUri.hashCode() : 0);
+ result = 31 * result + (startTime != null ? startTime.hashCode() : 0);
+ result = 31 * result + (status != null ? status.hashCode() : 0);
+ result = 31 * result + (subscribedObject != null ? subscribedObject.hashCode() : 0);
+ result = 31 * result + (uuid != null ? uuid.hashCode() : 0);
+ return result;
+ }
+
+ @Override
+ public String toString() {
+ return "[" +
+ "amount='" + amount + '\'' +
+ ", isAutoRenewEnabled=" + isAutoRenewEnabled +
+ ", descendants=" + descendants +
+ ", discountAmount=" + discountAmount +
+ ", discountPercent=" + discountPercent +
+ ", endTime=" + endTime +
+ ", id='" + id + '\'' +
+ ", lastNotification=" + lastNotification +
+ ", period='" + period + '\'' +
+ ", price=" + price +
+ ", remaining='" + remaining + '\'' +
+ ", resource='" + resource + '\'' +
+ ", resourceUri=" + resourceUri +
+ ", startTime=" + startTime +
+ ", status='" + status + '\'' +
+ ", subscribedObject='" + subscribedObject + '\'' +
+ ", uuid='" + uuid + '\'' +
+ "]";
+ }
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0d70c84a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/SubscriptionResource.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/SubscriptionResource.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/SubscriptionResource.java
index 9713bc1..dd9b8ac 100644
--- a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/SubscriptionResource.java
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/SubscriptionResource.java
@@ -22,21 +22,22 @@ import static com.google.common.base.Preconditions.checkNotNull;
* @author Vladimir Shevchenko
*/
public enum SubscriptionResource {
- DSSD, CPU, MEM, TX, IP, VLAN;
- public String value() {
- return name().toLowerCase();
- }
+ DSSD, CPU, MEM, TX, IP, VLAN;
- @Override
- public String toString() {
- return value();
- }
+ public String value() {
+ return name().toLowerCase();
+ }
- public static SubscriptionResource fromValue(String status) {
- try {
- return valueOf(checkNotNull(status, "status").toUpperCase());
- } catch (IllegalArgumentException e) {
- return null;
- }
- }
+ @Override
+ public String toString() {
+ return value();
+ }
+
+ public static SubscriptionResource fromValue(String status) {
+ try {
+ return valueOf(checkNotNull(status, "status").toUpperCase());
+ } catch (IllegalArgumentException e) {
+ return null;
+ }
+ }
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0d70c84a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/Tag.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/Tag.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/Tag.java
index f6f8ef1..0fe76fa 100644
--- a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/Tag.java
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/Tag.java
@@ -27,122 +27,120 @@ import java.util.Map;
/**
* @author Vladimir Shevchenko
*/
-public class Tag extends Item{
-
- public static class Builder extends Item.Builder{
- private Map<String, String> meta;
- private Owner owner;
- private List<TagResource> resources;
-
- public Builder meta(Map<String, String> meta) {
- this.meta = meta;
- return this;
- }
-
- public Builder owner(Owner owner) {
- this.owner = owner;
- return this;
- }
-
- public Builder resources(List<TagResource> resources) {
- this.resources = ImmutableList.copyOf(resources);
- return this;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Builder uuid(String uuid) {
- return Builder.class.cast(super.uuid(uuid));
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Builder name(String name) {
- return Builder.class.cast(super.name(name));
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Builder resourceUri(URI resourceUri) {
- return Builder.class.cast(super.resourceUri(resourceUri));
- }
-
- public Tag build(){
- return new Tag(uuid, name, resourceUri, meta, owner, resources);
- }
- }
-
- private final Map<String, String> meta;
- private final Owner owner;
- private final List<TagResource> resources;
-
- @ConstructorProperties({
- "uuid", "name", "resource_uri", "meta", "owner", "resources"
- })
- public Tag(String uuid, String name, URI resourceUri, Map<String, String> meta, Owner owner, List<TagResource> resources) {
- super(uuid, name, resourceUri);
- this.meta = meta;
- this.owner = owner;
- this.resources = resources == null ? new ArrayList<TagResource>() : resources;
- }
-
- /**
- *
- * @return tag meta data
- */
- public Map<String, String> getMeta() {
- return meta;
- }
-
- /**
- *
- * @return tag owner
- */
- public Owner getOwner() {
- return owner;
- }
-
- /**
- *
- * @return tag's resource list
- */
- public List<TagResource> getResources() {
- return resources;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (!(o instanceof Tag)) return false;
- if (!super.equals(o)) return false;
-
- Tag tag = (Tag) o;
-
- if (meta != null ? !meta.equals(tag.meta) : tag.meta != null) return false;
- if (owner != null ? !owner.equals(tag.owner) : tag.owner != null) return false;
- if (resources != null ? !resources.equals(tag.resources) : tag.resources != null) return false;
-
- return true;
- }
-
- @Override
- public int hashCode() {
- int result = super.hashCode();
- result = 31 * result + (meta != null ? meta.hashCode() : 0);
- result = 31 * result + (owner != null ? owner.hashCode() : 0);
- result = 31 * result + (resources != null ? resources.hashCode() : 0);
- return result;
- }
-
- @Override
- public String toString() {
- return "[uuid=" + uuid + ", name=" + name + ", resourceUri=" + resourceUri
- + ", meta=" + meta + ", owner=" + owner + ", resources=" + resources + "]";
- }
+public class Tag extends Item {
+
+ public static class Builder extends Item.Builder {
+ private Map<String, String> meta;
+ private Owner owner;
+ private List<TagResource> resources;
+
+ public Builder meta(Map<String, String> meta) {
+ this.meta = meta;
+ return this;
+ }
+
+ public Builder owner(Owner owner) {
+ this.owner = owner;
+ return this;
+ }
+
+ public Builder resources(List<TagResource> resources) {
+ this.resources = ImmutableList.copyOf(resources);
+ return this;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder uuid(String uuid) {
+ return Builder.class.cast(super.uuid(uuid));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder name(String name) {
+ return Builder.class.cast(super.name(name));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder resourceUri(URI resourceUri) {
+ return Builder.class.cast(super.resourceUri(resourceUri));
+ }
+
+ public Tag build() {
+ return new Tag(uuid, name, resourceUri, meta, owner, resources);
+ }
+ }
+
+ private final Map<String, String> meta;
+ private final Owner owner;
+ private final List<TagResource> resources;
+
+ @ConstructorProperties({
+ "uuid", "name", "resource_uri", "meta", "owner", "resources"
+ })
+ public Tag(String uuid, String name, URI resourceUri, Map<String, String> meta, Owner owner
+ , List<TagResource> resources) {
+ super(uuid, name, resourceUri);
+ this.meta = meta;
+ this.owner = owner;
+ this.resources = resources == null ? new ArrayList<TagResource>() : resources;
+ }
+
+ /**
+ * @return tag meta data
+ */
+ public Map<String, String> getMeta() {
+ return meta;
+ }
+
+ /**
+ * @return tag owner
+ */
+ public Owner getOwner() {
+ return owner;
+ }
+
+ /**
+ * @return tag's resource list
+ */
+ public List<TagResource> getResources() {
+ return resources;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (!(o instanceof Tag)) return false;
+ if (!super.equals(o)) return false;
+
+ Tag tag = (Tag) o;
+
+ if (meta != null ? !meta.equals(tag.meta) : tag.meta != null) return false;
+ if (owner != null ? !owner.equals(tag.owner) : tag.owner != null) return false;
+ if (resources != null ? !resources.equals(tag.resources) : tag.resources != null) return false;
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = super.hashCode();
+ result = 31 * result + (meta != null ? meta.hashCode() : 0);
+ result = 31 * result + (owner != null ? owner.hashCode() : 0);
+ result = 31 * result + (resources != null ? resources.hashCode() : 0);
+ return result;
+ }
+
+ @Override
+ public String toString() {
+ return "[uuid=" + uuid + ", name=" + name + ", resourceUri=" + resourceUri
+ + ", meta=" + meta + ", owner=" + owner + ", resources=" + resources + "]";
+ }
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0d70c84a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/TagResource.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/TagResource.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/TagResource.java
index 01f0821..1187e93 100644
--- a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/TagResource.java
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/TagResource.java
@@ -25,133 +25,129 @@ import java.net.URI;
*/
public class TagResource {
- public static class Builder{
- private Owner owner;
- private URI resourceUri;
- private String uuid;
- private TagResourceType resourceType;
-
- public Builder uuid(String uuid) {
- this.uuid = uuid;
- return this;
- }
-
- public Builder resourceUri(URI resourceUri) {
- this.resourceUri = resourceUri;
- return this;
- }
-
- public Builder owner(Owner owner) {
- this.owner = owner;
- return this;
- }
-
- public Builder resourceType(TagResourceType resourceType) {
- this.resourceType = resourceType;
- return this;
- }
-
- public TagResource build() {
- return new TagResource(uuid, resourceType, owner, resourceUri);
- }
- }
-
- private final Owner owner;
- @Named("resource_uri")
- private final URI resourceUri;
- private final String uuid;
- @Named("resource_type")
- private final TagResourceType resourceType;
-
- @ConstructorProperties({
- "uuid", "resource_type", "owner", "resource_uri"
- })
- public TagResource(String uuid, TagResourceType resourceType, Owner owner, URI resourceUri) {
- this.owner = owner;
- this.resourceUri = resourceUri;
- this.uuid = uuid;
- this.resourceType = resourceType;
- }
-
- /**
- *
- * @return resource owner
- */
- public Owner getOwner() {
- return owner;
- }
-
- /**
- *
- * @return resource type
- */
- public TagResourceType getResourceType() {
- return resourceType;
- }
-
- /**
- *
- * @return resource uri
- */
- public URI getResourceUri() {
- return resourceUri;
- }
-
- /**
- *
- * @return resource uuid
- */
- public String getUuid() {
- return uuid;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
+ public static class Builder {
+ private Owner owner;
+ private URI resourceUri;
+ private String uuid;
+ private TagResourceType resourceType;
+
+ public Builder uuid(String uuid) {
+ this.uuid = uuid;
+ return this;
+ }
+
+ public Builder resourceUri(URI resourceUri) {
+ this.resourceUri = resourceUri;
+ return this;
+ }
+
+ public Builder owner(Owner owner) {
+ this.owner = owner;
+ return this;
+ }
+
+ public Builder resourceType(TagResourceType resourceType) {
+ this.resourceType = resourceType;
+ return this;
+ }
+
+ public TagResource build() {
+ return new TagResource(uuid, resourceType, owner, resourceUri);
+ }
+ }
+
+ private final Owner owner;
+ @Named("resource_uri")
+ private final URI resourceUri;
+ private final String uuid;
+ @Named("resource_type")
+ private final TagResourceType resourceType;
+
+ @ConstructorProperties({
+ "uuid", "resource_type", "owner", "resource_uri"
+ })
+ public TagResource(String uuid, TagResourceType resourceType, Owner owner, URI resourceUri) {
+ this.owner = owner;
+ this.resourceUri = resourceUri;
+ this.uuid = uuid;
+ this.resourceType = resourceType;
+ }
+
+ /**
+ * @return resource owner
+ */
+ public Owner getOwner() {
+ return owner;
+ }
+
+ /**
+ * @return resource type
+ */
+ public TagResourceType getResourceType() {
+ return resourceType;
+ }
+
+ /**
+ * @return resource uri
+ */
+ public URI getResourceUri() {
+ return resourceUri;
+ }
+
+ /**
+ * @return resource uuid
+ */
+ public String getUuid() {
+ return uuid;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ TagResource other = (TagResource) obj;
+ if (owner == null) {
+ if (other.owner != null)
return false;
- if (getClass() != obj.getClass())
+ } else if (!owner.equals(other.owner))
+ return false;
+ if (uuid == null) {
+ if (other.uuid != null)
return false;
- TagResource other = (TagResource) obj;
- if (owner == null) {
- if (other.owner != null)
- return false;
- } else if (!owner.equals(other.owner))
+ } else if (!uuid.equals(other.uuid))
+ return false;
+ if (resourceUri == null) {
+ if (other.resourceUri != null)
return false;
- if (uuid == null) {
- if (other.uuid != null)
- return false;
- } else if (!uuid.equals(other.uuid))
+ } else if (!resourceUri.equals(other.resourceUri))
+ return false;
+ if (resourceType == null) {
+ if (other.resourceType != null)
return false;
- if (resourceUri == null) {
- if (other.resourceUri != null)
- return false;
- } else if (!resourceUri.equals(other.resourceUri))
- return false;
- if (resourceType == null) {
- if (other.resourceType != null)
- return false;
- } else if (!resourceType.equals(other.resourceType))
- return false;
-
- return true;
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((uuid == null) ? 0 : uuid.hashCode());
- result = prime * result + ((owner == null) ? 0 : owner.hashCode());
- result = prime * result + ((resourceUri == null) ? 0 : resourceUri.hashCode());
- result = prime * result + ((resourceType == null) ? 0 : resourceType.hashCode());
- return result;
- }
-
- @Override
- public String toString() {
- return "[uuid=" + uuid + ", owner=" + owner
- + ", resourceUri=" + resourceUri + ", resourceType=" + resourceType + "]";
- }
+ } else if (!resourceType.equals(other.resourceType))
+ return false;
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((uuid == null) ? 0 : uuid.hashCode());
+ result = prime * result + ((owner == null) ? 0 : owner.hashCode());
+ result = prime * result + ((resourceUri == null) ? 0 : resourceUri.hashCode());
+ result = prime * result + ((resourceType == null) ? 0 : resourceType.hashCode());
+ return result;
+ }
+
+ @Override
+ public String toString() {
+ return "[uuid=" + uuid + ", owner=" + owner
+ + ", resourceUri=" + resourceUri + ", resourceType=" + resourceType + "]";
+ }
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0d70c84a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/TagResourceType.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/TagResourceType.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/TagResourceType.java
index 57d1196..4ed5e68 100644
--- a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/TagResourceType.java
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/TagResourceType.java
@@ -22,22 +22,22 @@ import static com.google.common.base.Preconditions.checkNotNull;
* @author Vladimir Shevchenko
*/
public enum TagResourceType {
- VLANS, DRIVES, SERVERS, IPS, UNRECOGNIZED;
+ VLANS, DRIVES, SERVERS, IPS, UNRECOGNIZED;
- public String value() {
- return name().toLowerCase();
- }
+ public String value() {
+ return name().toLowerCase();
+ }
- @Override
- public String toString() {
- return value();
- }
+ @Override
+ public String toString() {
+ return value();
+ }
- public static TagResourceType fromValue(String type) {
- try {
- return valueOf(checkNotNull(type, "type").toUpperCase());
- } catch (IllegalArgumentException e) {
- return UNRECOGNIZED;
- }
- }
+ public static TagResourceType fromValue(String type) {
+ try {
+ return valueOf(checkNotNull(type, "type").toUpperCase());
+ } catch (IllegalArgumentException e) {
+ return UNRECOGNIZED;
+ }
+ }
}
[08/13] Fix code style of the cloudsigma2 provider.
Posted by na...@apache.org.
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0d70c84a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/IPConfiguration.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/IPConfiguration.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/IPConfiguration.java
index 84fd239..f194ace 100644
--- a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/IPConfiguration.java
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/IPConfiguration.java
@@ -24,79 +24,77 @@ import java.beans.ConstructorProperties;
*/
public class IPConfiguration {
- public static class Builder{
- private IPConfigurationType configurationType;
- private IP ip;
-
- public Builder configurationType(IPConfigurationType configurationType) {
- this.configurationType = configurationType;
- return this;
- }
-
- public Builder ip(IP ip) {
- this.ip = ip;
- return this;
- }
-
- public IPConfiguration build(){
- return new IPConfiguration(configurationType, ip);
- }
- }
-
- @Named("conf")
- private final IPConfigurationType configurationType;
- @Named("ip")
- private final IP ip;
-
- @ConstructorProperties({
- "conf", "ip"
- })
- public IPConfiguration(IPConfigurationType configurationType, IP ip) {
- this.configurationType = configurationType;
- this.ip = ip;
- }
-
- /**
- *
- * @return configuration type
- */
- public IPConfigurationType getConfigurationType() {
- return configurationType;
- }
-
- /**
- *
- * @return An IP address reference. Only used in ’static’ IP configuration.
- */
- public IP getIp() {
- return ip;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (!(o instanceof IPConfiguration)) return false;
-
- IPConfiguration that = (IPConfiguration) o;
-
- if (configurationType != that.configurationType) return false;
- if (ip != null ? !ip.equals(that.ip) : that.ip != null) return false;
-
- return true;
- }
-
- @Override
- public int hashCode() {
- int result = configurationType != null ? configurationType.hashCode() : 0;
- result = 31 * result + (ip != null ? ip.hashCode() : 0);
- return result;
- }
-
- @Override
- public String toString() {
- return "[" +
- "configurationType=" + configurationType +
- ", ip=" + ip +
- "]";
- }
+ public static class Builder {
+ private IPConfigurationType configurationType;
+ private IP ip;
+
+ public Builder configurationType(IPConfigurationType configurationType) {
+ this.configurationType = configurationType;
+ return this;
+ }
+
+ public Builder ip(IP ip) {
+ this.ip = ip;
+ return this;
+ }
+
+ public IPConfiguration build() {
+ return new IPConfiguration(configurationType, ip);
+ }
+ }
+
+ @Named("conf")
+ private final IPConfigurationType configurationType;
+ @Named("ip")
+ private final IP ip;
+
+ @ConstructorProperties({
+ "conf", "ip"
+ })
+ public IPConfiguration(IPConfigurationType configurationType, IP ip) {
+ this.configurationType = configurationType;
+ this.ip = ip;
+ }
+
+ /**
+ * @return configuration type
+ */
+ public IPConfigurationType getConfigurationType() {
+ return configurationType;
+ }
+
+ /**
+ * @return An IP address reference. Only used in ’static’ IP configuration.
+ */
+ public IP getIp() {
+ return ip;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (!(o instanceof IPConfiguration)) return false;
+
+ IPConfiguration that = (IPConfiguration) o;
+
+ if (configurationType != that.configurationType) return false;
+ if (ip != null ? !ip.equals(that.ip) : that.ip != null) return false;
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = configurationType != null ? configurationType.hashCode() : 0;
+ result = 31 * result + (ip != null ? ip.hashCode() : 0);
+ return result;
+ }
+
+ @Override
+ public String toString() {
+ return "[" +
+ "configurationType=" + configurationType +
+ ", ip=" + ip +
+ "]";
+ }
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0d70c84a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/IPConfigurationType.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/IPConfigurationType.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/IPConfigurationType.java
index 1d6dae1..6433a9f 100644
--- a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/IPConfigurationType.java
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/IPConfigurationType.java
@@ -22,22 +22,22 @@ import static com.google.common.base.Preconditions.checkNotNull;
* @author Vladimir Shevchenko
*/
public enum IPConfigurationType {
- DHCP, STATIC, MANUAL, UNRECOGNIZED;
+ DHCP, STATIC, MANUAL, UNRECOGNIZED;
- public String value() {
- return name().toLowerCase();
- }
+ public String value() {
+ return name().toLowerCase();
+ }
- @Override
- public String toString() {
- return value();
- }
+ @Override
+ public String toString() {
+ return value();
+ }
- public static IPConfigurationType fromValue(String type) {
- try {
- return valueOf(checkNotNull(type, "type").toUpperCase());
- } catch (IllegalArgumentException e) {
- return UNRECOGNIZED;
- }
- }
+ public static IPConfigurationType fromValue(String type) {
+ try {
+ return valueOf(checkNotNull(type, "type").toUpperCase());
+ } catch (IllegalArgumentException e) {
+ return UNRECOGNIZED;
+ }
+ }
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0d70c84a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/IPInfo.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/IPInfo.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/IPInfo.java
index 898eb90..796303c 100644
--- a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/IPInfo.java
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/IPInfo.java
@@ -27,221 +27,229 @@ import java.util.Map;
* @author Vladimir Shevchenko
*/
public class IPInfo extends IP {
- public static class Builder extends IP.Builder {
- private Map<String, String> meta;
- private Subscription subscription;
- private List<Tag> tags;
- private List<String> nameservers;
- private int netmask;
- private String gateway;
-
- /**
- * @param meta User defined meta information
- * @return IPInfo Builder
- */
- public Builder meta(Map<String, String> meta) {
- this.meta = meta;
- return this;
- }
-
- /**
- * @param subscription Subscription related to this VLAN
- * @return IPInfo Builder
- */
- public Builder subscription(Subscription subscription) {
- this.subscription = subscription;
- return this;
- }
-
- /**
- * @param tags Tags added to this VLAN
- * @return IPInfo Builder
- */
- public Builder tags(List<Tag> tags) {
- this.tags = ImmutableList.copyOf(tags);
- return this;
- }
-
- /**
- * @param nameservers Servers added to this IP
- * @return IPInfo Builder
- */
- public Builder nameservers(List<String> nameservers) {
- this.nameservers = ImmutableList.copyOf(nameservers);
- return this;
- }
-
- /**
- * @param netmask IP netmask
- * @return IPInfo Builder
- */
- public Builder netmask(int netmask) {
- this.netmask = netmask;
- return this;
- }
-
- /**
- * @param gateway getaway
- * @return IPInfo Builder
- */
- public Builder gateway(String gateway) {
- this.gateway = gateway;
- return this;
- }
-
- /**
- * {@inheritDoc}
- * @return IPInfo Builder
- */
- @Override
- public Builder uuid(String uuid) {
- return Builder.class.cast(super.uuid(uuid));
- }
-
- /**
- * {@inheritDoc}
- * @return IPInfo Builder
- */
- @Override
- public Builder owner(Owner owner) {
- return Builder.class.cast(super.owner(owner));
- }
-
- /**
- * {@inheritDoc}
- * @return IPInfo Builder
- */
- @Override
- public Builder server(Server server) {
- return Builder.class.cast(super.server(server));
- }
-
- /**
- * {@inheritDoc}
- * @return IPInfo Builder
- */
- @Override
- public Builder resourceUri(URI resourceUri) {
- return Builder.class.cast(super.resourceUri(resourceUri));
- }
-
- public IPInfo build() {
- return new IPInfo(uuid, owner, server, resourceUri, meta, subscription, tags, nameservers, netmask, gateway);
- }
-
- public Builder fromIP(IP ip){
- return new Builder().uuid(ip.getUuid()).owner(ip.getOwner()).server(ip.getServer()).resourceUri(ip.getResourceUri());
- }
- }
-
- private final Map<String, String> meta;
- private final Subscription subscription;
- private final List<Tag> tags;
- private final List<String> nameservers;
- private final int netmask;
- private final String gateway;
-
- @ConstructorProperties({
- "uuid", "owner", "server", "resource_uri", "meta", "subscription",
- "tags", "nameservers", "netmask", "gateway"
- })
- public IPInfo(String uuid, Owner owner, Server server, URI resourceUri, Map<String, String> meta, Subscription subscription
- , List<Tag> tags, List<String> nameservers, int netmask, String gateway) {
- super(uuid, owner, server, resourceUri);
- this.meta = meta;
- this.subscription = subscription;
- this.tags = tags;
- this.nameservers = nameservers;
- this.netmask = netmask;
- this.gateway = gateway;
- }
-
- /**
- * @return User defined meta information
- */
- public Map<String, String> getMeta() {
- return meta;
- }
-
- /**
- * @return Subscription related to this VLAN
- */
- public Subscription getSubscription() {
- return subscription;
- }
-
- /**
- * @return Tags added to this VLAN
- */
- public List<Tag> getTags() {
- return tags;
- }
-
- /**
- * @return Servers added to this IP
- */
- public List<String> getNameservers() {
- return nameservers;
- }
-
- /**
- * @return IP netmask
- */
- public int getNetmask() {
- return netmask;
- }
-
- /**
- * @return getaway
- */
- public String getGateway() {
- return gateway;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (!(o instanceof IPInfo)) return false;
- if (!super.equals(o)) return false;
-
- IPInfo ipInfo = (IPInfo) o;
-
- if (netmask != ipInfo.netmask) return false;
- if (gateway != null ? !gateway.equals(ipInfo.gateway) : ipInfo.gateway != null) return false;
- if (meta != null ? !meta.equals(ipInfo.meta) : ipInfo.meta != null) return false;
- if (nameservers != null ? !nameservers.equals(ipInfo.nameservers) : ipInfo.nameservers != null) return false;
- if (subscription != null ? !subscription.equals(ipInfo.subscription) : ipInfo.subscription != null)
- return false;
- if (tags != null ? !tags.equals(ipInfo.tags) : ipInfo.tags != null) return false;
-
- return true;
- }
-
- @Override
- public int hashCode() {
- int result = super.hashCode();
- result = 31 * result + (meta != null ? meta.hashCode() : 0);
- result = 31 * result + (subscription != null ? subscription.hashCode() : 0);
- result = 31 * result + (tags != null ? tags.hashCode() : 0);
- result = 31 * result + (nameservers != null ? nameservers.hashCode() : 0);
- result = 31 * result + netmask;
- result = 31 * result + (gateway != null ? gateway.hashCode() : 0);
- return result;
- }
-
- @Override
- public String toString() {
- return "[" +
- "owner=" + owner +
- ", uuid='" + uuid + '\'' +
- ", server=" + server +
- ", resourceUri=" + resourceUri +
- ", meta=" + meta +
- ", subscription=" + subscription +
- ", tags=" + tags +
- ", nameservers=" + nameservers +
- ", netmask=" + netmask +
- ", gateway='" + gateway + '\'' +
- "]";
- }
+ public static class Builder extends IP.Builder {
+ private Map<String, String> meta;
+ private Subscription subscription;
+ private List<Tag> tags;
+ private List<String> nameservers;
+ private int netmask;
+ private String gateway;
+
+ /**
+ * @param meta User defined meta information
+ * @return IPInfo Builder
+ */
+ public Builder meta(Map<String, String> meta) {
+ this.meta = meta;
+ return this;
+ }
+
+ /**
+ * @param subscription Subscription related to this VLAN
+ * @return IPInfo Builder
+ */
+ public Builder subscription(Subscription subscription) {
+ this.subscription = subscription;
+ return this;
+ }
+
+ /**
+ * @param tags Tags added to this VLAN
+ * @return IPInfo Builder
+ */
+ public Builder tags(List<Tag> tags) {
+ this.tags = ImmutableList.copyOf(tags);
+ return this;
+ }
+
+ /**
+ * @param nameservers Servers added to this IP
+ * @return IPInfo Builder
+ */
+ public Builder nameservers(List<String> nameservers) {
+ this.nameservers = ImmutableList.copyOf(nameservers);
+ return this;
+ }
+
+ /**
+ * @param netmask IP netmask
+ * @return IPInfo Builder
+ */
+ public Builder netmask(int netmask) {
+ this.netmask = netmask;
+ return this;
+ }
+
+ /**
+ * @param gateway getaway
+ * @return IPInfo Builder
+ */
+ public Builder gateway(String gateway) {
+ this.gateway = gateway;
+ return this;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @return IPInfo Builder
+ */
+ @Override
+ public Builder uuid(String uuid) {
+ return Builder.class.cast(super.uuid(uuid));
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @return IPInfo Builder
+ */
+ @Override
+ public Builder owner(Owner owner) {
+ return Builder.class.cast(super.owner(owner));
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @return IPInfo Builder
+ */
+ @Override
+ public Builder server(Server server) {
+ return Builder.class.cast(super.server(server));
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @return IPInfo Builder
+ */
+ @Override
+ public Builder resourceUri(URI resourceUri) {
+ return Builder.class.cast(super.resourceUri(resourceUri));
+ }
+
+ public IPInfo build() {
+ return new IPInfo(uuid, owner, server, resourceUri, meta, subscription, tags, nameservers, netmask, gateway);
+ }
+
+ public Builder fromIP(IP ip) {
+ return new Builder()
+ .uuid(ip.getUuid())
+ .owner(ip.getOwner())
+ .server(ip.getServer())
+ .resourceUri(ip.getResourceUri());
+ }
+ }
+
+ private final Map<String, String> meta;
+ private final Subscription subscription;
+ private final List<Tag> tags;
+ private final List<String> nameservers;
+ private final int netmask;
+ private final String gateway;
+
+ @ConstructorProperties({
+ "uuid", "owner", "server", "resource_uri", "meta", "subscription",
+ "tags", "nameservers", "netmask", "gateway"
+ })
+ public IPInfo(String uuid, Owner owner, Server server, URI resourceUri, Map<String, String> meta
+ , Subscription subscription, List<Tag> tags, List<String> nameservers, int netmask, String gateway) {
+ super(uuid, owner, server, resourceUri);
+ this.meta = meta;
+ this.subscription = subscription;
+ this.tags = tags;
+ this.nameservers = nameservers;
+ this.netmask = netmask;
+ this.gateway = gateway;
+ }
+
+ /**
+ * @return User defined meta information
+ */
+ public Map<String, String> getMeta() {
+ return meta;
+ }
+
+ /**
+ * @return Subscription related to this VLAN
+ */
+ public Subscription getSubscription() {
+ return subscription;
+ }
+
+ /**
+ * @return Tags added to this VLAN
+ */
+ public List<Tag> getTags() {
+ return tags;
+ }
+
+ /**
+ * @return Servers added to this IP
+ */
+ public List<String> getNameservers() {
+ return nameservers;
+ }
+
+ /**
+ * @return IP netmask
+ */
+ public int getNetmask() {
+ return netmask;
+ }
+
+ /**
+ * @return getaway
+ */
+ public String getGateway() {
+ return gateway;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (!(o instanceof IPInfo)) return false;
+ if (!super.equals(o)) return false;
+
+ IPInfo ipInfo = (IPInfo) o;
+
+ if (netmask != ipInfo.netmask) return false;
+ if (gateway != null ? !gateway.equals(ipInfo.gateway) : ipInfo.gateway != null) return false;
+ if (meta != null ? !meta.equals(ipInfo.meta) : ipInfo.meta != null) return false;
+ if (nameservers != null ? !nameservers.equals(ipInfo.nameservers) : ipInfo.nameservers != null) return false;
+ if (subscription != null ? !subscription.equals(ipInfo.subscription) : ipInfo.subscription != null)
+ return false;
+ if (tags != null ? !tags.equals(ipInfo.tags) : ipInfo.tags != null) return false;
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = super.hashCode();
+ result = 31 * result + (meta != null ? meta.hashCode() : 0);
+ result = 31 * result + (subscription != null ? subscription.hashCode() : 0);
+ result = 31 * result + (tags != null ? tags.hashCode() : 0);
+ result = 31 * result + (nameservers != null ? nameservers.hashCode() : 0);
+ result = 31 * result + netmask;
+ result = 31 * result + (gateway != null ? gateway.hashCode() : 0);
+ return result;
+ }
+
+ @Override
+ public String toString() {
+ return "[" +
+ "owner=" + owner +
+ ", uuid='" + uuid + '\'' +
+ ", server=" + server +
+ ", resourceUri=" + resourceUri +
+ ", meta=" + meta +
+ ", subscription=" + subscription +
+ ", tags=" + tags +
+ ", nameservers=" + nameservers +
+ ", netmask=" + netmask +
+ ", gateway='" + gateway + '\'' +
+ "]";
+ }
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0d70c84a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/InterfaceType.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/InterfaceType.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/InterfaceType.java
index c3de2ce..cf7fcc5 100644
--- a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/InterfaceType.java
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/InterfaceType.java
@@ -22,22 +22,22 @@ import static com.google.common.base.Preconditions.checkNotNull;
* @author Vladimir Shevchenko
*/
public enum InterfaceType {
- PUBLIC, PRIVATE;
+ PUBLIC, PRIVATE;
- public String value() {
- return name().toLowerCase();
- }
+ public String value() {
+ return name().toLowerCase();
+ }
- @Override
- public String toString() {
- return value();
- }
+ @Override
+ public String toString() {
+ return value();
+ }
- public static InterfaceType fromValue(String type) {
- try {
- return valueOf(checkNotNull(type, "type").toUpperCase());
- } catch (IllegalArgumentException e) {
- return PUBLIC;
- }
- }
+ public static InterfaceType fromValue(String type) {
+ try {
+ return valueOf(checkNotNull(type, "type").toUpperCase());
+ } catch (IllegalArgumentException e) {
+ return PUBLIC;
+ }
+ }
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0d70c84a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/Item.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/Item.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/Item.java
index 554056c..1299c23 100644
--- a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/Item.java
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/Item.java
@@ -26,150 +26,148 @@ import java.net.URI;
* @author Vladimir Shevchenko
*/
public class Item {
- public static class Builder {
- protected String uuid;
- protected String name;
- protected URI resourceUri;
-
- public Builder uuid(String uuid) {
- this.uuid = uuid;
- return this;
- }
-
- public Builder name(String name) {
- this.name = name;
- return this;
- }
-
- public Builder resourceUri(URI resourceUri) {
- this.resourceUri = resourceUri;
- return this;
- }
-
- public Item build() {
- return new Item(uuid, name, resourceUri);
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((name == null) ? 0 : name.hashCode());
- result = prime * result + ((uuid == null) ? 0 : uuid.hashCode());
- result = prime * result + ((resourceUri == null) ? 0 : resourceUri.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- Builder other = (Builder) obj;
- if (name == null) {
- if (other.name != null)
- return false;
- } else if (!name.equals(other.name))
- return false;
- if (uuid == null) {
- if (other.uuid != null)
- return false;
- } else if (!uuid.equals(other.uuid))
- return false;
- if (resourceUri == null) {
- if (other.resourceUri != null)
- return false;
- } else if (!resourceUri.equals(other.resourceUri))
- return false;
+ public static class Builder {
+ protected String uuid;
+ protected String name;
+ protected URI resourceUri;
+
+ public Builder uuid(String uuid) {
+ this.uuid = uuid;
+ return this;
+ }
+
+ public Builder name(String name) {
+ this.name = name;
+ return this;
+ }
+
+ public Builder resourceUri(URI resourceUri) {
+ this.resourceUri = resourceUri;
+ return this;
+ }
+
+ public Item build() {
+ return new Item(uuid, name, resourceUri);
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((name == null) ? 0 : name.hashCode());
+ result = prime * result + ((uuid == null) ? 0 : uuid.hashCode());
+ result = prime * result + ((resourceUri == null) ? 0 : resourceUri.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
return true;
- }
- }
-
- @Nullable
- protected final String uuid;
- @Nullable
- protected final String name;
- @Nullable
- @Named("resource_uri")
- protected final URI resourceUri;
-
- @ConstructorProperties({
- "uuid", "name", "resource_uri"
- })
- public Item(@Nullable String uuid, @Nullable String name, @Nullable URI resourceUri) {
- this.uuid = uuid;
- this.name = name;
- this.resourceUri = resourceUri;
- }
-
- /**
- *
- * @return uuid of the item.
- */
- @Nullable
- public String getUuid() {
- return uuid;
- }
-
- /**
- * @return Human readable name
- */
- public String getName() {
- return name;
- }
-
- /**
- *
- * @return Unicode string data.
- */
- @Nullable
- public URI getResourceUri() {
- return resourceUri;
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((name == null) ? 0 : name.hashCode());
- return result;
- }
-
- @Override
-
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
+ if (obj == null)
return false;
- if (getClass() != obj.getClass())
+ if (getClass() != obj.getClass())
return false;
- Item other = (Item) obj;
- if (name == null) {
+ Builder other = (Builder) obj;
+ if (name == null) {
if (other.name != null)
- return false;
- } else if (!name.equals(other.name))
+ return false;
+ } else if (!name.equals(other.name))
return false;
- if (uuid == null) {
+ if (uuid == null) {
if (other.uuid != null)
- return false;
- } else if (!uuid.equals(other.uuid))
+ return false;
+ } else if (!uuid.equals(other.uuid))
return false;
- if (resourceUri == null) {
+ if (resourceUri == null) {
if (other.resourceUri != null)
- return false;
- } else if (!resourceUri.equals(other.resourceUri))
+ return false;
+ } else if (!resourceUri.equals(other.resourceUri))
+ return false;
+ return true;
+ }
+ }
+
+ @Nullable
+ protected final String uuid;
+ @Nullable
+ protected final String name;
+ @Nullable
+ @Named("resource_uri")
+ protected final URI resourceUri;
+
+ @ConstructorProperties({
+ "uuid", "name", "resource_uri"
+ })
+ public Item(@Nullable String uuid, @Nullable String name, @Nullable URI resourceUri) {
+ this.uuid = uuid;
+ this.name = name;
+ this.resourceUri = resourceUri;
+ }
+
+ /**
+ * @return uuid of the item.
+ */
+ @Nullable
+ public String getUuid() {
+ return uuid;
+ }
+
+ /**
+ * @return Human readable name
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * @return Unicode string data.
+ */
+ @Nullable
+ public URI getResourceUri() {
+ return resourceUri;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((name == null) ? 0 : name.hashCode());
+ return result;
+ }
+
+ @Override
+
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ Item other = (Item) obj;
+ if (name == null) {
+ if (other.name != null)
+ return false;
+ } else if (!name.equals(other.name))
+ return false;
+ if (uuid == null) {
+ if (other.uuid != null)
+ return false;
+ } else if (!uuid.equals(other.uuid))
+ return false;
+ if (resourceUri == null) {
+ if (other.resourceUri != null)
return false;
+ } else if (!resourceUri.equals(other.resourceUri))
+ return false;
- return true;
- }
+ return true;
+ }
- @Override
+ @Override
- public String toString() {
- return "[uuid=" + uuid + ", name=" + name + ", resourceUri=" + resourceUri + "]";
- }
+ public String toString() {
+ return "[uuid=" + uuid + ", name=" + name + ", resourceUri=" + resourceUri + "]";
+ }
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0d70c84a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/LibraryDrive.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/LibraryDrive.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/LibraryDrive.java
index c233650..90f1864 100644
--- a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/LibraryDrive.java
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/LibraryDrive.java
@@ -30,347 +30,357 @@ import java.util.Map;
*/
public class LibraryDrive extends DriveInfo {
- public static class Builder extends DriveInfo.Builder{
- private String arch;
- private List<String> category;
- private String description;
- private boolean isFavorite;
- private String imageType;
- private String installNotes;
- private String os;
- private boolean isPaid;
- private String url;
-
- public Builder arch(String arch){
- this.arch = arch;
- return this;
- }
-
- public Builder category(List<String> category){
- this.category = ImmutableList.copyOf(category);
- return this;
- }
-
- public Builder description(String description){
- this.description = description;
- return this;
- }
-
- public Builder isFavorite(boolean isFavorite){
- this.isFavorite = isFavorite;
- return this;
- }
-
- public Builder imageType(String imageType){
- this.imageType = imageType;
- return this;
- }
-
- public Builder installNotes(String installNotes){
- this.installNotes = installNotes;
- return this;
- }
-
- public Builder isPaid(boolean isPaid){
- this.isPaid = isPaid;
- return this;
- }
-
- public Builder os(String os){
- this.os = os;
- return this;
- }
-
- public Builder url(String url){
- this.url = url;
- return this;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Builder size(BigInteger size) {
- this.size = size;
- return this;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Builder allowMultimount(boolean allowMultimount) {
- this.allowMultimount = allowMultimount;
- return this;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Builder affinities(List<String> affinities) {
- this.affinities = ImmutableList.copyOf(affinities);
- return this;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Builder jobs(List<String> jobs) {
- this.jobs = ImmutableList.copyOf(jobs);
- return this;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Builder licenses(List<DriveLicense> licenses) {
- this.licenses = licenses;
- return this;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Builder media(MediaType media) {
- this.media = media;
- return this;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Builder meta(Map<String,String> meta) {
- this.meta = meta;
- return this;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Builder mountedOn(List<Server> mountedOn) {
- this.mountedOn = ImmutableList.copyOf(mountedOn);
- return this;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Builder tags(List<String> tags) {
- this.tags = ImmutableList.copyOf(tags);
- return this;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Builder uuid(String uuid) {
- return Builder.class.cast(super.uuid(uuid));
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Builder name(String name) {
- return Builder.class.cast(super.name(name));
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Builder resourceUri(URI resourceUri) {
- return Builder.class.cast(super.resourceUri(resourceUri));
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Builder owner(Owner owner) {
- return Builder.class.cast(super.owner(owner));
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Builder status(DriveStatus status) {
- return Builder.class.cast(super.status(status));
- }
-
- public static Builder fromDriveInfo(DriveInfo in) {
- return new Builder().uuid(in.getUuid()).name(in.getName()).resourceUri(in.getResourceUri())
- .owner(in.getOwner()).status(in.getStatus()).size(in.getSize())
- .allowMultimount(in.isAllowMultimount()).affinities(in.getAffinities()).jobs(in.getJobs())
- .licenses(in.getLicenses()).media(in.getMedia()).meta(in.getMeta()).mountedOn(in.getMountedOn())
- .tags(in.getTags());
- }
-
- public LibraryDrive build(){
- return new LibraryDrive(uuid, name, resourceUri, size, owner, status, allowMultimount, affinities, jobs, licenses
- , media, meta, mountedOn, tags, arch, category, description, isFavorite, imageType, installNotes, os
- , isPaid, url);
- }
- }
-
- private final String arch;
- private final List<String> category;
- private final String description;
- @Named("favourite")
- private final boolean isFavorite;
- @Named("image_type")
- private final String imageType;
- @Named("install_notes")
- private final String installNotes;
- private final String os;
- @Named("paid")
- private final boolean isPaid;
- private final String url;
-
- @ConstructorProperties({
- "uuid", "name", "resource_uri", "size", "owner", "status",
- "allow_multimount", "affinities", "jobs", "licenses",
- "media", "meta", "mounted_on", "tags", "arch", "category",
- "description", "favourite", "image_type", "install_notes", "os", "paid", "url"
- })
- public LibraryDrive(String uuid, String name, URI resourceUri, BigInteger size, Owner owner, DriveStatus status
- , boolean allowMultimount, List<String> affinities, List<String> jobs, List<DriveLicense> licenses
- , MediaType media, Map<String,String> meta, List<Server> mountedOn, List<String> tags, String arch, List<String> category
- , String description, boolean favorite, String imageType, String installNotes, String os, boolean paid, String url) {
- super(uuid, name, resourceUri, size, owner, status, allowMultimount, affinities, jobs, licenses, media, meta, mountedOn, tags);
- this.arch = arch;
- this.category = category;
- this.description = description;
- this.isFavorite = favorite;
- this.imageType = imageType;
- this.installNotes = installNotes;
- this.os = os;
- this.isPaid = paid;
- this.url = url;
- }
-
- /**
- * @return Operating system bit architecture the drive.
- */
- public String getArch() {
- return arch;
- }
-
- /**
- * @return Category of the drive.
- */
- public List<String> getCategory() {
- return category;
- }
-
- /**
- * @return Description of drive image.
- */
- public String getDescription() {
- return description;
- }
-
- /**
- * @return Type of drive image
- */
- public String getImageType() {
- return imageType;
- }
-
- /**
- * @return Install notes for the drive image.
- */
- public String getInstallNotes() {
- return installNotes;
- }
-
- /**
- * @return Favourite drive image for user.
- */
- public boolean isFavorite() {
- return isFavorite;
- }
-
- /**
- * @return Paid or free.
- */
- public boolean isPaid() {
- return isPaid;
- }
-
- /**
- * @return Operating system of the drive.
- */
- public String getOs() {
- return os;
- }
-
- /**
- * @return Operating system bit architecture the drive.
- */
- public String getUrl() {
- return url;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (!(o instanceof LibraryDrive)) return false;
- if (!super.equals(o)) return false;
-
- LibraryDrive that = (LibraryDrive) o;
-
- if (isFavorite != that.isFavorite) return false;
- if (isPaid != that.isPaid) return false;
- if (arch != null ? !arch.equals(that.arch) : that.arch != null) return false;
- if (category != null ? !category.equals(that.category) : that.category != null) return false;
- if (description != null ? !description.equals(that.description) : that.description != null) return false;
- if (imageType != null ? !imageType.equals(that.imageType) : that.imageType != null) return false;
- if (installNotes != null ? !installNotes.equals(that.installNotes) : that.installNotes != null) return false;
- if (os != null ? !os.equals(that.os) : that.os != null) return false;
- if (url != null ? !url.equals(that.url) : that.url != null) return false;
-
- return true;
- }
-
- @Override
- public int hashCode() {
- int result = super.hashCode();
- result = 31 * result + (arch != null ? arch.hashCode() : 0);
- result = 31 * result + (category != null ? category.hashCode() : 0);
- result = 31 * result + (description != null ? description.hashCode() : 0);
- result = 31 * result + (isFavorite ? 1 : 0);
- result = 31 * result + (imageType != null ? imageType.hashCode() : 0);
- result = 31 * result + (installNotes != null ? installNotes.hashCode() : 0);
- result = 31 * result + (os != null ? os.hashCode() : 0);
- result = 31 * result + (isPaid ? 1 : 0);
- result = 31 * result + (url != null ? url.hashCode() : 0);
- return result;
- }
-
- @Override
- public String toString() {
- return "[uuid=" + uuid + ", name=" + name + ", size=" + size + ", owner=" + owner + ", status=" + status
- + ", affinities=" + affinities + ", jobs=" + jobs + ", licenses=" + licenses + ", media=" + media
- + ", meta=" + meta + ", mountedOn=" + mountedOn + ", tags=" + tags +
- ", arch='" + arch + '\'' +
- ", category=" + category +
- ", description='" + description + '\'' +
- ", isFavorite=" + isFavorite +
- ", imageType='" + imageType + '\'' +
- ", installNotes='" + installNotes + '\'' +
- ", os='" + os + '\'' +
- ", isPaid=" + isPaid +
- ", url='" + url + '\'' +
- "]";
- }
+ public static class Builder extends DriveInfo.Builder {
+ private String arch;
+ private List<String> category;
+ private String description;
+ private boolean isFavorite;
+ private String imageType;
+ private String installNotes;
+ private String os;
+ private boolean isPaid;
+ private String url;
+
+ public Builder arch(String arch) {
+ this.arch = arch;
+ return this;
+ }
+
+ public Builder category(List<String> category) {
+ this.category = ImmutableList.copyOf(category);
+ return this;
+ }
+
+ public Builder description(String description) {
+ this.description = description;
+ return this;
+ }
+
+ public Builder isFavorite(boolean isFavorite) {
+ this.isFavorite = isFavorite;
+ return this;
+ }
+
+ public Builder imageType(String imageType) {
+ this.imageType = imageType;
+ return this;
+ }
+
+ public Builder installNotes(String installNotes) {
+ this.installNotes = installNotes;
+ return this;
+ }
+
+ public Builder isPaid(boolean isPaid) {
+ this.isPaid = isPaid;
+ return this;
+ }
+
+ public Builder os(String os) {
+ this.os = os;
+ return this;
+ }
+
+ public Builder url(String url) {
+ this.url = url;
+ return this;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder size(BigInteger size) {
+ this.size = size;
+ return this;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder allowMultimount(boolean allowMultimount) {
+ this.allowMultimount = allowMultimount;
+ return this;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder affinities(List<String> affinities) {
+ this.affinities = ImmutableList.copyOf(affinities);
+ return this;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder jobs(List<String> jobs) {
+ this.jobs = ImmutableList.copyOf(jobs);
+ return this;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder licenses(List<DriveLicense> licenses) {
+ this.licenses = licenses;
+ return this;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder media(MediaType media) {
+ this.media = media;
+ return this;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder meta(Map<String, String> meta) {
+ this.meta = meta;
+ return this;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder mountedOn(List<Server> mountedOn) {
+ this.mountedOn = ImmutableList.copyOf(mountedOn);
+ return this;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder tags(List<String> tags) {
+ this.tags = ImmutableList.copyOf(tags);
+ return this;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder uuid(String uuid) {
+ return Builder.class.cast(super.uuid(uuid));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder name(String name) {
+ return Builder.class.cast(super.name(name));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder resourceUri(URI resourceUri) {
+ return Builder.class.cast(super.resourceUri(resourceUri));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder owner(Owner owner) {
+ return Builder.class.cast(super.owner(owner));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder status(DriveStatus status) {
+ return Builder.class.cast(super.status(status));
+ }
+
+ public static Builder fromDriveInfo(DriveInfo in) {
+ return new Builder()
+ .uuid(in.getUuid())
+ .name(in.getName())
+ .resourceUri(in.getResourceUri())
+ .owner(in.getOwner())
+ .status(in.getStatus())
+ .size(in.getSize())
+ .allowMultimount(in.isAllowMultimount())
+ .affinities(in.getAffinities())
+ .jobs(in.getJobs())
+ .licenses(in.getLicenses())
+ .media(in.getMedia())
+ .meta(in.getMeta())
+ .mountedOn(in.getMountedOn())
+ .tags(in.getTags());
+ }
+
+ public LibraryDrive build() {
+ return new LibraryDrive(uuid, name, resourceUri, size, owner, status, allowMultimount, affinities, jobs
+ , licenses, media, meta, mountedOn, tags, arch, category, description, isFavorite, imageType
+ , installNotes, os, isPaid, url);
+ }
+ }
+
+ private final String arch;
+ private final List<String> category;
+ private final String description;
+ @Named("favourite")
+ private final boolean isFavorite;
+ @Named("image_type")
+ private final String imageType;
+ @Named("install_notes")
+ private final String installNotes;
+ private final String os;
+ @Named("paid")
+ private final boolean isPaid;
+ private final String url;
+
+ @ConstructorProperties({
+ "uuid", "name", "resource_uri", "size", "owner", "status",
+ "allow_multimount", "affinities", "jobs", "licenses",
+ "media", "meta", "mounted_on", "tags", "arch", "category",
+ "description", "favourite", "image_type", "install_notes", "os", "paid", "url"
+ })
+ public LibraryDrive(String uuid, String name, URI resourceUri, BigInteger size, Owner owner, DriveStatus status
+ , boolean allowMultimount, List<String> affinities, List<String> jobs, List<DriveLicense> licenses
+ , MediaType media, Map<String, String> meta, List<Server> mountedOn, List<String> tags, String arch, List<String> category
+ , String description, boolean favorite, String imageType, String installNotes, String os, boolean paid, String url) {
+ super(uuid, name, resourceUri, size, owner, status, allowMultimount, affinities, jobs, licenses, media, meta, mountedOn, tags);
+ this.arch = arch;
+ this.category = category;
+ this.description = description;
+ this.isFavorite = favorite;
+ this.imageType = imageType;
+ this.installNotes = installNotes;
+ this.os = os;
+ this.isPaid = paid;
+ this.url = url;
+ }
+
+ /**
+ * @return Operating system bit architecture the drive.
+ */
+ public String getArch() {
+ return arch;
+ }
+
+ /**
+ * @return Category of the drive.
+ */
+ public List<String> getCategory() {
+ return category;
+ }
+
+ /**
+ * @return Description of drive image.
+ */
+ public String getDescription() {
+ return description;
+ }
+
+ /**
+ * @return Type of drive image
+ */
+ public String getImageType() {
+ return imageType;
+ }
+
+ /**
+ * @return Install notes for the drive image.
+ */
+ public String getInstallNotes() {
+ return installNotes;
+ }
+
+ /**
+ * @return Favourite drive image for user.
+ */
+ public boolean isFavorite() {
+ return isFavorite;
+ }
+
+ /**
+ * @return Paid or free.
+ */
+ public boolean isPaid() {
+ return isPaid;
+ }
+
+ /**
+ * @return Operating system of the drive.
+ */
+ public String getOs() {
+ return os;
+ }
+
+ /**
+ * @return Operating system bit architecture the drive.
+ */
+ public String getUrl() {
+ return url;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (!(o instanceof LibraryDrive)) return false;
+ if (!super.equals(o)) return false;
+
+ LibraryDrive that = (LibraryDrive) o;
+
+ if (isFavorite != that.isFavorite) return false;
+ if (isPaid != that.isPaid) return false;
+ if (arch != null ? !arch.equals(that.arch) : that.arch != null) return false;
+ if (category != null ? !category.equals(that.category) : that.category != null) return false;
+ if (description != null ? !description.equals(that.description) : that.description != null) return false;
+ if (imageType != null ? !imageType.equals(that.imageType) : that.imageType != null) return false;
+ if (installNotes != null ? !installNotes.equals(that.installNotes) : that.installNotes != null) return false;
+ if (os != null ? !os.equals(that.os) : that.os != null) return false;
+ if (url != null ? !url.equals(that.url) : that.url != null) return false;
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = super.hashCode();
+ result = 31 * result + (arch != null ? arch.hashCode() : 0);
+ result = 31 * result + (category != null ? category.hashCode() : 0);
+ result = 31 * result + (description != null ? description.hashCode() : 0);
+ result = 31 * result + (isFavorite ? 1 : 0);
+ result = 31 * result + (imageType != null ? imageType.hashCode() : 0);
+ result = 31 * result + (installNotes != null ? installNotes.hashCode() : 0);
+ result = 31 * result + (os != null ? os.hashCode() : 0);
+ result = 31 * result + (isPaid ? 1 : 0);
+ result = 31 * result + (url != null ? url.hashCode() : 0);
+ return result;
+ }
+
+ @Override
+ public String toString() {
+ return "[uuid=" + uuid + ", name=" + name + ", size=" + size + ", owner=" + owner + ", status=" + status
+ + ", affinities=" + affinities + ", jobs=" + jobs + ", licenses=" + licenses + ", media=" + media
+ + ", meta=" + meta + ", mountedOn=" + mountedOn + ", tags=" + tags +
+ ", arch='" + arch + '\'' +
+ ", category=" + category +
+ ", description='" + description + '\'' +
+ ", isFavorite=" + isFavorite +
+ ", imageType='" + imageType + '\'' +
+ ", installNotes='" + installNotes + '\'' +
+ ", os='" + os + '\'' +
+ ", isPaid=" + isPaid +
+ ", url='" + url + '\'' +
+ "]";
+ }
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0d70c84a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/License.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/License.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/License.java
index e5c9f51..13c7e30 100644
--- a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/License.java
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/License.java
@@ -25,150 +25,150 @@ import java.net.URI;
*/
public class License {
- public static class Builder{
- private boolean burstable;
- private String longName;
- private String name;
- private URI resourceUri;
- private String type;
- private String userMetric;
-
- public Builder isBurstable(boolean burstable){
- this.burstable = burstable;
- return this;
- }
-
- public Builder longName(String longName){
- this.longName = longName;
- return this;
- }
-
- public Builder name(String name){
- this.name = name;
- return this;
- }
-
- public Builder resourceUri(URI resourceUri){
- this.resourceUri = resourceUri;
- return this;
- }
-
- public Builder type(String type){
- this.type = type;
- return this;
- }
-
- public Builder userMetric(String userMetric){
- this.userMetric = userMetric;
- return this;
- }
-
- public License build(){
- return new License(burstable, longName, name, resourceUri, type, userMetric);
- }
- }
-
- private final boolean burstable;
- @Named("long_name")
- private final String longName;
- private final String name;
- @Named("resource_uri")
- private final URI resourceUri;
- private final String type;
- @Named("user_metric")
- private final String userMetric;
-
- @ConstructorProperties({
- "burstable", "long_name", "name", "resource_uri", "type", "user_metric"
- })
- public License(boolean burstable, String longName, String name, URI resourceUri, String type, String userMetric) {
- this.burstable = burstable;
- this.longName = longName;
- this.name = name;
- this.resourceUri = resourceUri;
- this.type = type;
- this.userMetric = userMetric;
- }
-
- /**
- * @return Whether this resource can be used on burst
- */
- public boolean isBurstable() {
- return burstable;
- }
-
- /**
- * @return A human readable name for the resource.
- */
- public String getLongName() {
- return longName;
- }
-
- /**
- * @return Name that should be used when purchasing
- */
- public String getName() {
- return name;
- }
-
- /**
- * @return Unique resource uri
- */
- public URI getResourceUri() {
- return resourceUri;
- }
-
- /**
- * @return Type of billing
- */
- public String getType() {
- return type;
- }
-
- /**
- * @return The metric that the user is charged for
- */
- public String getUserMetric() {
- return userMetric;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (!(o instanceof License)) return false;
-
- License that = (License) o;
-
- if (burstable != that.burstable) return false;
- if (longName != null ? !longName.equals(that.longName) : that.longName != null) return false;
- if (name != null ? !name.equals(that.name) : that.name != null) return false;
- if (resourceUri != null ? !resourceUri.equals(that.resourceUri) : that.resourceUri != null) return false;
- if (type != null ? !type.equals(that.type) : that.type != null) return false;
- if (userMetric != null ? !userMetric.equals(that.userMetric) : that.userMetric != null) return false;
-
- return true;
- }
-
- @Override
- public int hashCode() {
- int result = (burstable ? 1 : 0);
- result = 31 * result + (longName != null ? longName.hashCode() : 0);
- result = 31 * result + (name != null ? name.hashCode() : 0);
- result = 31 * result + (resourceUri != null ? resourceUri.hashCode() : 0);
- result = 31 * result + (type != null ? type.hashCode() : 0);
- result = 31 * result + (userMetric != null ? userMetric.hashCode() : 0);
- return result;
- }
-
- @Override
- public String toString() {
- return "[" +
- "burstable=" + burstable +
- ", longName='" + longName + '\'' +
- ", name='" + name + '\'' +
- ", resourceUri='" + resourceUri + '\'' +
- ", type='" + type + '\'' +
- ", userMetric='" + userMetric + '\'' +
- "]";
- }
+ public static class Builder {
+ private boolean burstable;
+ private String longName;
+ private String name;
+ private URI resourceUri;
+ private String type;
+ private String userMetric;
+
+ public Builder isBurstable(boolean burstable) {
+ this.burstable = burstable;
+ return this;
+ }
+
+ public Builder longName(String longName) {
+ this.longName = longName;
+ return this;
+ }
+
+ public Builder name(String name) {
+ this.name = name;
+ return this;
+ }
+
+ public Builder resourceUri(URI resourceUri) {
+ this.resourceUri = resourceUri;
+ return this;
+ }
+
+ public Builder type(String type) {
+ this.type = type;
+ return this;
+ }
+
+ public Builder userMetric(String userMetric) {
+ this.userMetric = userMetric;
+ return this;
+ }
+
+ public License build() {
+ return new License(burstable, longName, name, resourceUri, type, userMetric);
+ }
+ }
+
+ private final boolean burstable;
+ @Named("long_name")
+ private final String longName;
+ private final String name;
+ @Named("resource_uri")
+ private final URI resourceUri;
+ private final String type;
+ @Named("user_metric")
+ private final String userMetric;
+
+ @ConstructorProperties({
+ "burstable", "long_name", "name", "resource_uri", "type", "user_metric"
+ })
+ public License(boolean burstable, String longName, String name, URI resourceUri, String type, String userMetric) {
+ this.burstable = burstable;
+ this.longName = longName;
+ this.name = name;
+ this.resourceUri = resourceUri;
+ this.type = type;
+ this.userMetric = userMetric;
+ }
+
+ /**
+ * @return Whether this resource can be used on burst
+ */
+ public boolean isBurstable() {
+ return burstable;
+ }
+
+ /**
+ * @return A human readable name for the resource.
+ */
+ public String getLongName() {
+ return longName;
+ }
+
+ /**
+ * @return Name that should be used when purchasing
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * @return Unique resource uri
+ */
+ public URI getResourceUri() {
+ return resourceUri;
+ }
+
+ /**
+ * @return Type of billing
+ */
+ public String getType() {
+ return type;
+ }
+
+ /**
+ * @return The metric that the user is charged for
+ */
+ public String getUserMetric() {
+ return userMetric;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (!(o instanceof License)) return false;
+
+ License that = (License) o;
+
+ if (burstable != that.burstable) return false;
+ if (longName != null ? !longName.equals(that.longName) : that.longName != null) return false;
+ if (name != null ? !name.equals(that.name) : that.name != null) return false;
+ if (resourceUri != null ? !resourceUri.equals(that.resourceUri) : that.resourceUri != null) return false;
+ if (type != null ? !type.equals(that.type) : that.type != null) return false;
+ if (userMetric != null ? !userMetric.equals(that.userMetric) : that.userMetric != null) return false;
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = (burstable ? 1 : 0);
+ result = 31 * result + (longName != null ? longName.hashCode() : 0);
+ result = 31 * result + (name != null ? name.hashCode() : 0);
+ result = 31 * result + (resourceUri != null ? resourceUri.hashCode() : 0);
+ result = 31 * result + (type != null ? type.hashCode() : 0);
+ result = 31 * result + (userMetric != null ? userMetric.hashCode() : 0);
+ return result;
+ }
+
+ @Override
+ public String toString() {
+ return "[" +
+ "burstable=" + burstable +
+ ", longName='" + longName + '\'' +
+ ", name='" + name + '\'' +
+ ", resourceUri='" + resourceUri + '\'' +
+ ", type='" + type + '\'' +
+ ", userMetric='" + userMetric + '\'' +
+ "]";
+ }
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0d70c84a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/MediaType.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/MediaType.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/MediaType.java
index 9b66cfd..0d2432d 100644
--- a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/MediaType.java
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/MediaType.java
@@ -21,7 +21,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
/**
* Media type - set to 'cdrom' to simulate a cdrom, set to 'disk' or leave unset to simulate a hard
* disk.
- *
+ *
* @author Adrian Cole
*/
public enum MediaType {
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0d70c84a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/Model.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/Model.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/Model.java
index 44ff213..70f2e1c 100644
--- a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/Model.java
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/Model.java
@@ -19,7 +19,6 @@ package org.jclouds.cloudsigma2.domain;
import static com.google.common.base.Preconditions.checkNotNull;
/**
- *
* @author Adrian Cole
*/
public enum Model {
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0d70c84a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/NIC.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/NIC.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/NIC.java
index 2fb7528..3a6846d 100644
--- a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/NIC.java
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/NIC.java
@@ -23,204 +23,204 @@ import java.beans.ConstructorProperties;
* @author Vladimir Shevchenko
*/
public class NIC {
- public static class Builder {
- private int bootOrder;
- private FirewallPolicy firewallPolicy;
- private IPConfiguration ipV4Configuration;
- private IPConfiguration ipV6Configuration;
- private String mac;
- private Model model;
- private NICStats runtime;
- private VLANInfo vlan;
-
- public Builder bootOrder(int bootOrder) {
- this.bootOrder = bootOrder;
- return this;
- }
-
- public Builder model(Model model) {
- this.model = model;
- return this;
- }
-
- public Builder vlan(VLANInfo vlan) {
- this.vlan = vlan;
- return this;
- }
-
- public Builder mac(String mac) {
- this.mac = mac;
- return this;
- }
-
- public Builder runtime(NICStats runtime) {
- this.runtime = runtime;
- return this;
- }
-
- public Builder firewallPolicy(FirewallPolicy firewallPolicy) {
- this.firewallPolicy = firewallPolicy;
- return this;
- }
-
- public Builder ipV4Configuration(IPConfiguration ipV4Configuration) {
- this.ipV4Configuration = ipV4Configuration;
- return this;
- }
-
- public Builder ipV6Configuration(IPConfiguration ipV6Configuration) {
- this.ipV6Configuration = ipV6Configuration;
- return this;
- }
-
- public NIC build() {
- return new NIC(bootOrder, firewallPolicy, ipV4Configuration, ipV6Configuration, mac, model, runtime, vlan);
- }
-
- public Builder fromNIC(NIC nic){
- return new Builder()
- .bootOrder(nic.getBootOrder())
- .firewallPolicy(nic.getFirewallPolicy())
- .ipV4Configuration(nic.getIpV4Configuration())
- .ipV6Configuration(nic.getIpV6Configuration())
- .mac(nic.getMac())
- .model(nic.getModel())
- .runtime(nic.getRuntime())
- .vlan(nic.getVlan());
- }
- }
-
- @Named("boot_order")
- private final int bootOrder;
- @Named("firewall_policy")
- private final FirewallPolicy firewallPolicy;
- @Named("ip_v4_conf")
- private final IPConfiguration ipV4Configuration;
- @Named("ip_v6_conf")
- private final IPConfiguration ipV6Configuration;
- private final String mac;
- private final Model model;
- private final NICStats runtime;
- private final VLANInfo vlan;
-
- @ConstructorProperties({
- "boot_order", "firewall_policy", "ip_v4_conf", "ip_v6_conf",
- "mac", "model", "runtime", "vlan"
- })
- public NIC(int bootOrder, FirewallPolicy firewallPolicy, IPConfiguration ipV4Configuration, IPConfiguration ipV6Configuration
- , String mac, Model model, NICStats runtime, VLANInfo vlan) {
- this.bootOrder = bootOrder;
- this.firewallPolicy = firewallPolicy;
- this.ipV4Configuration = ipV4Configuration;
- this.ipV6Configuration = ipV6Configuration;
- this.mac = mac;
- this.model = model;
- this.runtime = runtime;
- this.vlan = vlan;
- }
-
- /**
- * @return Model of NIC.
- */
- public Model getModel() {
- return model;
- }
-
- /**
- * @return UUID of the private VLAN.
- */
- public VLANInfo getVlan() {
- return vlan;
- }
-
- /**
- * @return MAC address of the server NIC.
- */
- public String getMac() {
- return mac;
- }
-
- /**
- * @return Device boot order.
- */
- public int getBootOrder() {
- return bootOrder;
- }
-
- /**
- * @return Public IPv4 configuration.
- */
- public IPConfiguration getIpV4Configuration() {
- return ipV4Configuration;
- }
-
- /**
- * @return Public IPv6 configuration.
- */
- public IPConfiguration getIpV6Configuration() {
- return ipV6Configuration;
- }
-
- /**
- * @return Firewall policy
- */
- public FirewallPolicy getFirewallPolicy() {
- return firewallPolicy;
- }
-
- /**
- * @return NIC runtime information
- */
- public NICStats getRuntime() {
- return runtime;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (!(o instanceof NIC)) return false;
-
- NIC nic = (NIC) o;
-
- if (bootOrder != nic.bootOrder) return false;
- if (firewallPolicy != null ? !firewallPolicy.equals(nic.firewallPolicy) : nic.firewallPolicy != null)
- return false;
- if (ipV4Configuration != null ? !ipV4Configuration.equals(nic.ipV4Configuration) : nic.ipV4Configuration != null)
- return false;
- if (ipV6Configuration != null ? !ipV6Configuration.equals(nic.ipV6Configuration) : nic.ipV6Configuration != null)
- return false;
- if (mac != null ? !mac.equals(nic.mac) : nic.mac != null) return false;
- if (model != nic.model) return false;
- if (runtime != null ? !runtime.equals(nic.runtime) : nic.runtime != null) return false;
- if (vlan != null ? !vlan.equals(nic.vlan) : nic.vlan != null) return false;
-
- return true;
- }
-
- @Override
- public int hashCode() {
- int result = bootOrder;
- result = 31 * result + (firewallPolicy != null ? firewallPolicy.hashCode() : 0);
- result = 31 * result + (ipV4Configuration != null ? ipV4Configuration.hashCode() : 0);
- result = 31 * result + (ipV6Configuration != null ? ipV6Configuration.hashCode() : 0);
- result = 31 * result + (mac != null ? mac.hashCode() : 0);
- result = 31 * result + (model != null ? model.hashCode() : 0);
- result = 31 * result + (runtime != null ? runtime.hashCode() : 0);
- result = 31 * result + (vlan != null ? vlan.hashCode() : 0);
- return result;
- }
-
- @Override
- public String toString() {
- return "[" +
- "bootOrder=" + bootOrder +
- ", firewallPolicy='" + firewallPolicy + '\'' +
- ", ipV4Configuration=" + ipV4Configuration +
- ", ipV6Configuration=" + ipV6Configuration +
- ", mac='" + mac + '\'' +
- ", model=" + model +
- ", runtime=" + runtime +
- ", vlan='" + vlan + '\'' +
- "]";
- }
+ public static class Builder {
+ private int bootOrder;
+ private FirewallPolicy firewallPolicy;
+ private IPConfiguration ipV4Configuration;
+ private IPConfiguration ipV6Configuration;
+ private String mac;
+ private Model model;
+ private NICStats runtime;
+ private VLANInfo vlan;
+
+ public Builder bootOrder(int bootOrder) {
+ this.bootOrder = bootOrder;
+ return this;
+ }
+
+ public Builder model(Model model) {
+ this.model = model;
+ return this;
+ }
+
+ public Builder vlan(VLANInfo vlan) {
+ this.vlan = vlan;
+ return this;
+ }
+
+ public Builder mac(String mac) {
+ this.mac = mac;
+ return this;
+ }
+
+ public Builder runtime(NICStats runtime) {
+ this.runtime = runtime;
+ return this;
+ }
+
+ public Builder firewallPolicy(FirewallPolicy firewallPolicy) {
+ this.firewallPolicy = firewallPolicy;
+ return this;
+ }
+
+ public Builder ipV4Configuration(IPConfiguration ipV4Configuration) {
+ this.ipV4Configuration = ipV4Configuration;
+ return this;
+ }
+
+ public Builder ipV6Configuration(IPConfiguration ipV6Configuration) {
+ this.ipV6Configuration = ipV6Configuration;
+ return this;
+ }
+
+ public NIC build() {
+ return new NIC(bootOrder, firewallPolicy, ipV4Configuration, ipV6Configuration, mac, model, runtime, vlan);
+ }
+
+ public Builder fromNIC(NIC nic) {
+ return new Builder()
+ .bootOrder(nic.getBootOrder())
+ .firewallPolicy(nic.getFirewallPolicy())
+ .ipV4Configuration(nic.getIpV4Configuration())
+ .ipV6Configuration(nic.getIpV6Configuration())
+ .mac(nic.getMac())
+ .model(nic.getModel())
+ .runtime(nic.getRuntime())
+ .vlan(nic.getVlan());
+ }
+ }
+
+ @Named("boot_order")
+ private final int bootOrder;
+ @Named("firewall_policy")
+ private final FirewallPolicy firewallPolicy;
+ @Named("ip_v4_conf")
+ private final IPConfiguration ipV4Configuration;
+ @Named("ip_v6_conf")
+ private final IPConfiguration ipV6Configuration;
+ private final String mac;
+ private final Model model;
+ private final NICStats runtime;
+ private final VLANInfo vlan;
+
+ @ConstructorProperties({
+ "boot_order", "firewall_policy", "ip_v4_conf", "ip_v6_conf",
+ "mac", "model", "runtime", "vlan"
+ })
+ public NIC(int bootOrder, FirewallPolicy firewallPolicy, IPConfiguration ipV4Configuration
+ , IPConfiguration ipV6Configuration, String mac, Model model, NICStats runtime, VLANInfo vlan) {
+ this.bootOrder = bootOrder;
+ this.firewallPolicy = firewallPolicy;
+ this.ipV4Configuration = ipV4Configuration;
+ this.ipV6Configuration = ipV6Configuration;
+ this.mac = mac;
+ this.model = model;
+ this.runtime = runtime;
+ this.vlan = vlan;
+ }
+
+ /**
+ * @return Model of NIC.
+ */
+ public Model getModel() {
+ return model;
+ }
+
+ /**
+ * @return UUID of the private VLAN.
+ */
+ public VLANInfo getVlan() {
+ return vlan;
+ }
+
+ /**
+ * @return MAC address of the server NIC.
+ */
+ public String getMac() {
+ return mac;
+ }
+
+ /**
+ * @return Device boot order.
+ */
+ public int getBootOrder() {
+ return bootOrder;
+ }
+
+ /**
+ * @return Public IPv4 configuration.
+ */
+ public IPConfiguration getIpV4Configuration() {
+ return ipV4Configuration;
+ }
+
+ /**
+ * @return Public IPv6 configuration.
+ */
+ public IPConfiguration getIpV6Configuration() {
+ return ipV6Configuration;
+ }
+
+ /**
+ * @return Firewall policy
+ */
+ public FirewallPolicy getFirewallPolicy() {
+ return firewallPolicy;
+ }
+
+ /**
+ * @return NIC runtime information
+ */
+ public NICStats getRuntime() {
+ return runtime;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (!(o instanceof NIC)) return false;
+
+ NIC nic = (NIC) o;
+
+ if (bootOrder != nic.bootOrder) return false;
+ if (firewallPolicy != null ? !firewallPolicy.equals(nic.firewallPolicy) : nic.firewallPolicy != null)
+ return false;
+ if (ipV4Configuration != null ? !ipV4Configuration.equals(nic.ipV4Configuration) : nic.ipV4Configuration != null)
+ return false;
+ if (ipV6Configuration != null ? !ipV6Configuration.equals(nic.ipV6Configuration) : nic.ipV6Configuration != null)
+ return false;
+ if (mac != null ? !mac.equals(nic.mac) : nic.mac != null) return false;
+ if (model != nic.model) return false;
+ if (runtime != null ? !runtime.equals(nic.runtime) : nic.runtime != null) return false;
+ if (vlan != null ? !vlan.equals(nic.vlan) : nic.vlan != null) return false;
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = bootOrder;
+ result = 31 * result + (firewallPolicy != null ? firewallPolicy.hashCode() : 0);
+ result = 31 * result + (ipV4Configuration != null ? ipV4Configuration.hashCode() : 0);
+ result = 31 * result + (ipV6Configuration != null ? ipV6Configuration.hashCode() : 0);
+ result = 31 * result + (mac != null ? mac.hashCode() : 0);
+ result = 31 * result + (model != null ? model.hashCode() : 0);
+ result = 31 * result + (runtime != null ? runtime.hashCode() : 0);
+ result = 31 * result + (vlan != null ? vlan.hashCode() : 0);
+ return result;
+ }
+
+ @Override
+ public String toString() {
+ return "[" +
+ "bootOrder=" + bootOrder +
+ ", firewallPolicy='" + firewallPolicy + '\'' +
+ ", ipV4Configuration=" + ipV4Configuration +
+ ", ipV6Configuration=" + ipV6Configuration +
+ ", mac='" + mac + '\'' +
+ ", model=" + model +
+ ", runtime=" + runtime +
+ ", vlan='" + vlan + '\'' +
+ "]";
+ }
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0d70c84a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/NICStats.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/NICStats.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/NICStats.java
index af7966a..601c3bb 100644
--- a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/NICStats.java
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/NICStats.java
@@ -24,96 +24,96 @@ import java.beans.ConstructorProperties;
*/
public class NICStats {
- @Named("interface_type")
- private final InterfaceType interfaceType;
- @Named("io")
- private final IOStats ioStats;
- @Named("ip_v4")
- private final String ipV4;
- @Named("ip_v6")
- private final String ipV6;
- private final String mac;
+ @Named("interface_type")
+ private final InterfaceType interfaceType;
+ @Named("io")
+ private final IOStats ioStats;
+ @Named("ip_v4")
+ private final String ipV4;
+ @Named("ip_v6")
+ private final String ipV6;
+ private final String mac;
- @ConstructorProperties({
- "interface_type", "io", "ip_v4", "ip_v6", "mac"
- })
- public NICStats(InterfaceType interfaceType, IOStats ioStats, String ipV4, String ipV6, String mac) {
- this.interfaceType = interfaceType;
- this.ioStats = ioStats;
- this.ipV4 = ipV4;
- this.ipV6 = ipV6;
- this.mac = mac;
- }
+ @ConstructorProperties({
+ "interface_type", "io", "ip_v4", "ip_v6", "mac"
+ })
+ public NICStats(InterfaceType interfaceType, IOStats ioStats, String ipV4, String ipV6, String mac) {
+ this.interfaceType = interfaceType;
+ this.ioStats = ioStats;
+ this.ipV4 = ipV4;
+ this.ipV6 = ipV6;
+ this.mac = mac;
+ }
- /**
- * @return Type of interface
- */
- public InterfaceType getInterfaceType() {
- return interfaceType;
- }
+ /**
+ * @return Type of interface
+ */
+ public InterfaceType getInterfaceType() {
+ return interfaceType;
+ }
- /**
- * @return NIC runtime Input and Output data"
- */
- public IOStats getIoStats() {
- return ioStats;
- }
+ /**
+ * @return NIC runtime Input and Output data"
+ */
+ public IOStats getIoStats() {
+ return ioStats;
+ }
- /**
- * @return Public IPv4 configuration
- */
- public String getIpV4() {
- return ipV4;
- }
+ /**
+ * @return Public IPv4 configuration
+ */
+ public String getIpV4() {
+ return ipV4;
+ }
- /**
- * @return Public IPv6 configuration
- */
- public String getIpV6() {
- return ipV6;
- }
+ /**
+ * @return Public IPv6 configuration
+ */
+ public String getIpV6() {
+ return ipV6;
+ }
- /**
- * @return MAC address of this NIC
- */
- public String getMac() {
- return mac;
- }
+ /**
+ * @return MAC address of this NIC
+ */
+ public String getMac() {
+ return mac;
+ }
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (!(o instanceof NICStats)) return false;
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (!(o instanceof NICStats)) return false;
- NICStats nicStats = (NICStats) o;
+ NICStats nicStats = (NICStats) o;
- if (interfaceType != nicStats.interfaceType) return false;
- if (ioStats != null ? !ioStats.equals(nicStats.ioStats) : nicStats.ioStats != null) return false;
- if (ipV4 != null ? !ipV4.equals(nicStats.ipV4) : nicStats.ipV4 != null) return false;
- if (ipV6 != null ? !ipV6.equals(nicStats.ipV6) : nicStats.ipV6 != null) return false;
- if (mac != null ? !mac.equals(nicStats.mac) : nicStats.mac != null) return false;
+ if (interfaceType != nicStats.interfaceType) return false;
+ if (ioStats != null ? !ioStats.equals(nicStats.ioStats) : nicStats.ioStats != null) return false;
+ if (ipV4 != null ? !ipV4.equals(nicStats.ipV4) : nicStats.ipV4 != null) return false;
+ if (ipV6 != null ? !ipV6.equals(nicStats.ipV6) : nicStats.ipV6 != null) return false;
+ if (mac != null ? !mac.equals(nicStats.mac) : nicStats.mac != null) return false;
- return true;
- }
+ return true;
+ }
- @Override
- public int hashCode() {
- int result = interfaceType != null ? interfaceType.hashCode() : 0;
- result = 31 * result + (ioStats != null ? ioStats.hashCode() : 0);
- result = 31 * result + (ipV4 != null ? ipV4.hashCode() : 0);
- result = 31 * result + (ipV6 != null ? ipV6.hashCode() : 0);
- result = 31 * result + (mac != null ? mac.hashCode() : 0);
- return result;
- }
+ @Override
+ public int hashCode() {
+ int result = interfaceType != null ? interfaceType.hashCode() : 0;
+ result = 31 * result + (ioStats != null ? ioStats.hashCode() : 0);
+ result = 31 * result + (ipV4 != null ? ipV4.hashCode() : 0);
+ result = 31 * result + (ipV6 != null ? ipV6.hashCode() : 0);
+ result = 31 * result + (mac != null ? mac.hashCode() : 0);
+ return result;
+ }
- @Override
- public String toString() {
- return "[" +
- "interfaceType=" + interfaceType +
- ", ioStats=" + ioStats +
- ", ipV4='" + ipV4 + '\'' +
- ", ipV6='" + ipV6 + '\'' +
- ", mac='" + mac + '\'' +
- "]";
- }
+ @Override
+ public String toString() {
+ return "[" +
+ "interfaceType=" + interfaceType +
+ ", ioStats=" + ioStats +
+ ", ipV4='" + ipV4 + '\'' +
+ ", ipV6='" + ipV6 + '\'' +
+ ", mac='" + mac + '\'' +
+ "]";
+ }
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0d70c84a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/Owner.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/Owner.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/Owner.java
index d98658d..48ad311 100644
--- a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/Owner.java
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/Owner.java
@@ -24,146 +24,145 @@ import java.net.URI;
* @author Vladimir Shevchenko
*/
public class Owner {
- public static class Builder{
- private String uuid;
- private URI resourceUri;
- private String email;
-
- public Builder uuid(String uuid) {
- this.uuid = uuid;
- return this;
- }
-
- public Builder resourceUri(URI resourceUri) {
- this.resourceUri = resourceUri;
- return this;
- }
-
- public Builder email(String email) {
- this.email = email;
- return this;
- }
-
- public Owner build() {
- return new Owner(uuid, resourceUri, email);
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((uuid == null) ? 0 : uuid.hashCode());
- result = prime * result + ((resourceUri == null) ? 0 : resourceUri.hashCode());
- result = prime * result + ((email == null) ? 0 : email.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- Builder other = (Builder) obj;
- if (uuid == null) {
- if (other.uuid != null)
- return false;
- } else if (!uuid.equals(other.uuid))
- return false;
- if (resourceUri == null) {
- if (other.resourceUri != null)
- return false;
- } else if (!resourceUri.equals(other.resourceUri))
- return false;
- if (email == null) {
- if (other.email != null)
- return false;
- } else if (!email.equals(other.email))
- return false;
+ public static class Builder {
+ private String uuid;
+ private URI resourceUri;
+ private String email;
+
+ public Builder uuid(String uuid) {
+ this.uuid = uuid;
+ return this;
+ }
+
+ public Builder resourceUri(URI resourceUri) {
+ this.resourceUri = resourceUri;
+ return this;
+ }
+
+ public Builder email(String email) {
+ this.email = email;
+ return this;
+ }
+
+ public Owner build() {
+ return new Owner(uuid, resourceUri, email);
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((uuid == null) ? 0 : uuid.hashCode());
+ result = prime * result + ((resourceUri == null) ? 0 : resourceUri.hashCode());
+ result = prime * result + ((email == null) ? 0 : email.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
return true;
- }
- }
- private String uuid;
- @Named("resoource_uri")
- private URI resourceUri;
- private String email;
-
- @ConstructorProperties({
- "uuid", "resource_uri", "email"
- })
- public Owner(String uuid, URI resourceUri, String email){
- this.uuid = uuid;
- this.resourceUri = resourceUri;
- this.email = email;
- }
-
- /**
- *
- * @return uuid of the owner.
- */
- public String getUuid() {
- return uuid;
- }
-
- /**
- *
- * @return resource uri of the profile.
- */
- public URI getResourceUri() {
- return resourceUri;
- }
-
- public String getEmail() {
- return email;
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((uuid == null) ? 0 : uuid.hashCode());
- result = prime * result + ((resourceUri == null) ? 0 : resourceUri.hashCode());
- result = prime * result + ((email == null) ? 0 : email.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
-
- if (obj == null)
+ if (obj == null)
return false;
-
- if (getClass() != obj.getClass())
+ if (getClass() != obj.getClass())
return false;
-
- Owner other = (Owner) obj;
-
- if (resourceUri == null) {
+ Builder other = (Builder) obj;
+ if (uuid == null) {
+ if (other.uuid != null)
+ return false;
+ } else if (!uuid.equals(other.uuid))
+ return false;
+ if (resourceUri == null) {
if (other.resourceUri != null)
- return false;
- } else if (!resourceUri.equals(other.resourceUri))
+ return false;
+ } else if (!resourceUri.equals(other.resourceUri))
return false;
-
- if (uuid == null) {
- if (other.uuid != null)
- return false;
- } else if (!uuid.equals(other.uuid))
+ if (email == null) {
+ if (other.email != null)
+ return false;
+ } else if (!email.equals(other.email))
return false;
+ return true;
+ }
+ }
+
+ private String uuid;
+ @Named("resoource_uri")
+ private URI resourceUri;
+ private String email;
+
+ @ConstructorProperties({
+ "uuid", "resource_uri", "email"
+ })
+ public Owner(String uuid, URI resourceUri, String email) {
+ this.uuid = uuid;
+ this.resourceUri = resourceUri;
+ this.email = email;
+ }
+
+ /**
+ * @return uuid of the owner.
+ */
+ public String getUuid() {
+ return uuid;
+ }
+
+ /**
+ * @return resource uri of the profile.
+ */
+ public URI getResourceUri() {
+ return resourceUri;
+ }
+
+ public String getEmail() {
+ return email;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((uuid == null) ? 0 : uuid.hashCode());
+ result = prime * result + ((resourceUri == null) ? 0 : resourceUri.hashCode());
+ result = prime * result + ((email == null) ? 0 : email.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+
+ if (obj == null)
+ return false;
+
+ if (getClass() != obj.getClass())
+ return false;
+
+ Owner other = (Owner) obj;
+
+ if (resourceUri == null) {
+ if (other.resourceUri != null)
+ return false;
+ } else if (!resourceUri.equals(other.resourceUri))
+ return false;
- if (email == null) {
- if (other.email != null)
- return false;
- } else if (!email.equals(other.email))
+ if (uuid == null) {
+ if (other.uuid != null)
return false;
- return true;
- }
+ } else if (!uuid.equals(other.uuid))
+ return false;
- @Override
- public String toString() {
- return "[uuid=" + uuid + ", email=" + email + ", resourceUri=" + resourceUri + "]";
- }
+ if (email == null) {
+ if (other.email != null)
+ return false;
+ } else if (!email.equals(other.email))
+ return false;
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ return "[uuid=" + uuid + ", email=" + email + ", resourceUri=" + resourceUri + "]";
+ }
}
[07/13] Fix code style of the cloudsigma2 provider.
Posted by na...@apache.org.
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0d70c84a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/PaginatedCollection.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/PaginatedCollection.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/PaginatedCollection.java
index ec4f718..6061240 100644
--- a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/PaginatedCollection.java
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/PaginatedCollection.java
@@ -27,32 +27,32 @@ import java.util.Iterator;
*/
public class PaginatedCollection<T> extends IterableWithMarker<T> {
- private Iterable<T> objects;
- private PaginationOptions paginationOptions;
-
- public PaginatedCollection(Iterable<T> objects, PaginationOptions paginationOptions) {
- this.objects = objects;
- this.paginationOptions = paginationOptions;
- }
-
- @Override
- public Optional<Object> nextMarker() {
- if(paginationOptions.getLimit() == 0){
- return Optional.absent();
- }
-
- if(paginationOptions.getTotalCount() - paginationOptions.getOffset() > paginationOptions.getLimit()){
- return Optional.of((Object) new PaginationOptions.Builder()
- .limit(paginationOptions.getLimit())
- .offset(paginationOptions.getOffset() + paginationOptions.getLimit())
- .build());
- }
-
- return Optional.absent();
- }
-
- @Override
- public Iterator<T> iterator() {
- return objects.iterator();
- }
+ private Iterable<T> objects;
+ private PaginationOptions paginationOptions;
+
+ public PaginatedCollection(Iterable<T> objects, PaginationOptions paginationOptions) {
+ this.objects = objects;
+ this.paginationOptions = paginationOptions;
+ }
+
+ @Override
+ public Optional<Object> nextMarker() {
+ if (paginationOptions.getLimit() == 0) {
+ return Optional.absent();
+ }
+
+ if (paginationOptions.getTotalCount() - paginationOptions.getOffset() > paginationOptions.getLimit()) {
+ return Optional.of((Object) new PaginationOptions.Builder()
+ .limit(paginationOptions.getLimit())
+ .offset(paginationOptions.getOffset() + paginationOptions.getLimit())
+ .build());
+ }
+
+ return Optional.absent();
+ }
+
+ @Override
+ public Iterator<T> iterator() {
+ return objects.iterator();
+ }
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0d70c84a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/Price.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/Price.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/Price.java
index 4a18f2e..4e19a21 100644
--- a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/Price.java
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/Price.java
@@ -24,197 +24,197 @@ import java.math.BigInteger;
*/
public class Price {
- public static class Builder{
- private String currency;
- private String id;
- private Integer level;
- private BigInteger multiplier;
- private double price;
- private SubscriptionResource resource;
- private String unit;
-
- /**
- * @param currency The currency of the price
- * Price Builder
- */
- public Builder currency(String currency) {
- this.currency = currency;
- return this;
- }
-
- /**
- * @param id Unique identificator
- * Price Builder
- */
- public Builder id(String id) {
- this.id = id;
- return this;
- }
-
- /**
- * @param level The burst level the price applies to
- * Price Builder
- */
- public Builder level(int level) {
- this.level = level;
- return this;
- }
-
- /**
- * @param multiplier The multiplier applied to get the price of one unit per second, from the unit of the price
- * Price Builder
- */
- public Builder multiplier(BigInteger multiplier) {
- this.multiplier = multiplier;
- return this;
- }
-
- /**
- * @param price Price
- * Price Builder
- */
- public Builder price(double price) {
- this.price = price;
- return this;
- }
-
- /**
- * @param resource The resource the price applies to
- * Price Builder
- */
- public Builder resource(SubscriptionResource resource) {
- this.resource = resource;
- return this;
- }
-
- /**
- * @param unit The unit of the price
- * Price Builder
- */
- public Builder unit(String unit) {
- this.unit = unit;
- return this;
- }
-
- public Price build(){
- return new Price(currency, id, level, multiplier, price, resource, unit);
- }
- }
-
- private final String currency;
- private final String id;
- private final Integer level;
- private final BigInteger multiplier;
- private final double price;
- private final SubscriptionResource resource;
- private final String unit;
-
- @ConstructorProperties({
- "currency", "id", "level", "multiplier", "price", "resource", "unit"
- })
- public Price(String currency, String id, Integer level, BigInteger multiplier, double price
- , SubscriptionResource resource, String unit) {
- this.currency = currency;
- this.id = id;
- this.level = level;
- this.multiplier = multiplier;
- this.price = price;
- this.resource = resource;
- this.unit = unit;
- }
-
- /**
- * @return The currency of the price
- */
- public String getCurrency() {
- return currency;
- }
-
- /**
- * @return Unique identificator
- */
- public String getId() {
- return id;
- }
-
- /**
- * @return The burst level the price applies to
- */
- public Integer getLevel() {
- return level;
- }
-
- /**
- * @return The multiplier applied to get the price of one unit per second, from the unit of the price
- */
- public BigInteger getMultiplier() {
- return multiplier;
- }
-
- /**
- * @return Price
- */
- public double getPrice() {
- return price;
- }
-
- /**
- * @return The resource the price applies to
- */
- public SubscriptionResource getResource() {
- return resource;
- }
-
- /**
- * @return The unit of the price
- */
- public String getUnit() {
- return unit;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (!(o instanceof Price)) return false;
-
- Price price1 = (Price) o;
-
- if (Double.compare(price1.price, price) != 0) return false;
- if (currency != null ? !currency.equals(price1.currency) : price1.currency != null) return false;
- if (id != null ? !id.equals(price1.id) : price1.id != null) return false;
- if (level != null ? !level.equals(price1.level) : price1.level != null) return false;
- if (multiplier != null ? !multiplier.equals(price1.multiplier) : price1.multiplier != null) return false;
- if (resource != price1.resource) return false;
- if (unit != null ? !unit.equals(price1.unit) : price1.unit != null) return false;
-
- return true;
- }
-
- @Override
- public int hashCode() {
- int result;
- long temp;
- result = currency != null ? currency.hashCode() : 0;
- result = 31 * result + (id != null ? id.hashCode() : 0);
- result = 31 * result + (level != null ? level.hashCode() : 0);
- result = 31 * result + (multiplier != null ? multiplier.hashCode() : 0);
- temp = Double.doubleToLongBits(price);
- result = 31 * result + (int) (temp ^ (temp >>> 32));
- result = 31 * result + (resource != null ? resource.hashCode() : 0);
- result = 31 * result + (unit != null ? unit.hashCode() : 0);
- return result;
- }
-
- @Override
- public String toString() {
- return "[" +
- "currency='" + currency + '\'' +
- ", id='" + id + '\'' +
- ", level=" + level +
- ", multiplier=" + multiplier +
- ", price='" + price + '\'' +
- ", resource=" + resource +
- ", unit='" + unit + '\'' +
- "]";
- }
+ public static class Builder {
+ private String currency;
+ private String id;
+ private Integer level;
+ private BigInteger multiplier;
+ private double price;
+ private SubscriptionResource resource;
+ private String unit;
+
+ /**
+ * @param currency The currency of the price
+ * Price Builder
+ */
+ public Builder currency(String currency) {
+ this.currency = currency;
+ return this;
+ }
+
+ /**
+ * @param id Unique identificator
+ * Price Builder
+ */
+ public Builder id(String id) {
+ this.id = id;
+ return this;
+ }
+
+ /**
+ * @param level The burst level the price applies to
+ * Price Builder
+ */
+ public Builder level(int level) {
+ this.level = level;
+ return this;
+ }
+
+ /**
+ * @param multiplier The multiplier applied to get the price of one unit per second, from the unit of the price
+ * Price Builder
+ */
+ public Builder multiplier(BigInteger multiplier) {
+ this.multiplier = multiplier;
+ return this;
+ }
+
+ /**
+ * @param price Price
+ * Price Builder
+ */
+ public Builder price(double price) {
+ this.price = price;
+ return this;
+ }
+
+ /**
+ * @param resource The resource the price applies to
+ * Price Builder
+ */
+ public Builder resource(SubscriptionResource resource) {
+ this.resource = resource;
+ return this;
+ }
+
+ /**
+ * @param unit The unit of the price
+ * Price Builder
+ */
+ public Builder unit(String unit) {
+ this.unit = unit;
+ return this;
+ }
+
+ public Price build() {
+ return new Price(currency, id, level, multiplier, price, resource, unit);
+ }
+ }
+
+ private final String currency;
+ private final String id;
+ private final Integer level;
+ private final BigInteger multiplier;
+ private final double price;
+ private final SubscriptionResource resource;
+ private final String unit;
+
+ @ConstructorProperties({
+ "currency", "id", "level", "multiplier", "price", "resource", "unit"
+ })
+ public Price(String currency, String id, Integer level, BigInteger multiplier, double price
+ , SubscriptionResource resource, String unit) {
+ this.currency = currency;
+ this.id = id;
+ this.level = level;
+ this.multiplier = multiplier;
+ this.price = price;
+ this.resource = resource;
+ this.unit = unit;
+ }
+
+ /**
+ * @return The currency of the price
+ */
+ public String getCurrency() {
+ return currency;
+ }
+
+ /**
+ * @return Unique identificator
+ */
+ public String getId() {
+ return id;
+ }
+
+ /**
+ * @return The burst level the price applies to
+ */
+ public Integer getLevel() {
+ return level;
+ }
+
+ /**
+ * @return The multiplier applied to get the price of one unit per second, from the unit of the price
+ */
+ public BigInteger getMultiplier() {
+ return multiplier;
+ }
+
+ /**
+ * @return Price
+ */
+ public double getPrice() {
+ return price;
+ }
+
+ /**
+ * @return The resource the price applies to
+ */
+ public SubscriptionResource getResource() {
+ return resource;
+ }
+
+ /**
+ * @return The unit of the price
+ */
+ public String getUnit() {
+ return unit;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (!(o instanceof Price)) return false;
+
+ Price price1 = (Price) o;
+
+ if (Double.compare(price1.price, price) != 0) return false;
+ if (currency != null ? !currency.equals(price1.currency) : price1.currency != null) return false;
+ if (id != null ? !id.equals(price1.id) : price1.id != null) return false;
+ if (level != null ? !level.equals(price1.level) : price1.level != null) return false;
+ if (multiplier != null ? !multiplier.equals(price1.multiplier) : price1.multiplier != null) return false;
+ if (resource != price1.resource) return false;
+ if (unit != null ? !unit.equals(price1.unit) : price1.unit != null) return false;
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int result;
+ long temp;
+ result = currency != null ? currency.hashCode() : 0;
+ result = 31 * result + (id != null ? id.hashCode() : 0);
+ result = 31 * result + (level != null ? level.hashCode() : 0);
+ result = 31 * result + (multiplier != null ? multiplier.hashCode() : 0);
+ temp = Double.doubleToLongBits(price);
+ result = 31 * result + (int) (temp ^ (temp >>> 32));
+ result = 31 * result + (resource != null ? resource.hashCode() : 0);
+ result = 31 * result + (unit != null ? unit.hashCode() : 0);
+ return result;
+ }
+
+ @Override
+ public String toString() {
+ return "[" +
+ "currency='" + currency + '\'' +
+ ", id='" + id + '\'' +
+ ", level=" + level +
+ ", multiplier=" + multiplier +
+ ", price='" + price + '\'' +
+ ", resource=" + resource +
+ ", unit='" + unit + '\'' +
+ "]";
+ }
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0d70c84a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/Pricing.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/Pricing.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/Pricing.java
index b87a5ed..162f825 100644
--- a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/Pricing.java
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/Pricing.java
@@ -26,84 +26,84 @@ import java.util.List;
*/
public class Pricing {
- public static class Builder{
- private BurstLevel current;
- private BurstLevel next;
- private List<Price> priceList;
-
- public Builder current(BurstLevel current) {
- this.current = current;
- return this;
- }
-
- public Builder next(BurstLevel next) {
- this.next = next;
- return this;
- }
-
- public Builder priceList(List<Price> priceList) {
- this.priceList = ImmutableList.copyOf(priceList);
- return this;
- }
-
- public Pricing build(){
- return new Pricing(current, next, priceList);
- }
- }
-
- private final BurstLevel current;
- private final BurstLevel next;
- private final List<Price> priceList;
-
- @ConstructorProperties({
- "current", "next", "objects"
- })
- public Pricing(BurstLevel current, BurstLevel next, List<Price> priceList) {
- this.current = current;
- this.next = next;
- this.priceList = priceList;
- }
-
- public BurstLevel getCurrent() {
- return current;
- }
-
- public BurstLevel getNext() {
- return next;
- }
-
- public List<Price> getPriceList() {
- return priceList;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (!(o instanceof Pricing)) return false;
-
- Pricing pricing = (Pricing) o;
-
- if (current != null ? !current.equals(pricing.current) : pricing.current != null) return false;
- if (next != null ? !next.equals(pricing.next) : pricing.next != null) return false;
- if (priceList != null ? !priceList.equals(pricing.priceList) : pricing.priceList != null) return false;
-
- return true;
- }
-
- @Override
- public int hashCode() {
- int result = current != null ? current.hashCode() : 0;
- result = 31 * result + (next != null ? next.hashCode() : 0);
- result = 31 * result + (priceList != null ? priceList.hashCode() : 0);
- return result;
- }
-
- @Override
- public String toString() {
- return "[" +
- "current=" + current +
- ", next=" + next +
- ", priceList=" + priceList +
- "]";
- }
+ public static class Builder {
+ private BurstLevel current;
+ private BurstLevel next;
+ private List<Price> priceList;
+
+ public Builder current(BurstLevel current) {
+ this.current = current;
+ return this;
+ }
+
+ public Builder next(BurstLevel next) {
+ this.next = next;
+ return this;
+ }
+
+ public Builder priceList(List<Price> priceList) {
+ this.priceList = ImmutableList.copyOf(priceList);
+ return this;
+ }
+
+ public Pricing build() {
+ return new Pricing(current, next, priceList);
+ }
+ }
+
+ private final BurstLevel current;
+ private final BurstLevel next;
+ private final List<Price> priceList;
+
+ @ConstructorProperties({
+ "current", "next", "objects"
+ })
+ public Pricing(BurstLevel current, BurstLevel next, List<Price> priceList) {
+ this.current = current;
+ this.next = next;
+ this.priceList = priceList;
+ }
+
+ public BurstLevel getCurrent() {
+ return current;
+ }
+
+ public BurstLevel getNext() {
+ return next;
+ }
+
+ public List<Price> getPriceList() {
+ return priceList;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (!(o instanceof Pricing)) return false;
+
+ Pricing pricing = (Pricing) o;
+
+ if (current != null ? !current.equals(pricing.current) : pricing.current != null) return false;
+ if (next != null ? !next.equals(pricing.next) : pricing.next != null) return false;
+ if (priceList != null ? !priceList.equals(pricing.priceList) : pricing.priceList != null) return false;
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = current != null ? current.hashCode() : 0;
+ result = 31 * result + (next != null ? next.hashCode() : 0);
+ result = 31 * result + (priceList != null ? priceList.hashCode() : 0);
+ return result;
+ }
+
+ @Override
+ public String toString() {
+ return "[" +
+ "current=" + current +
+ ", next=" + next +
+ ", priceList=" + priceList +
+ "]";
+ }
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0d70c84a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/ProfileInfo.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/ProfileInfo.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/ProfileInfo.java
index 2a548de..9060ef2 100644
--- a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/ProfileInfo.java
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/ProfileInfo.java
@@ -26,493 +26,524 @@ import java.util.Map;
*/
public class ProfileInfo {
- public static class Builder {
- private String address;
- private boolean isApiHttpsOnly;
- private String autotopupAmount;
- private String autotopupThreshold;
- private String bankReference;
- private String company;
- private String country;
- private String currency;
- private String email;
- private String firstName;
- private boolean hasAutotopup;
- private boolean invoicing;
- private boolean isKeyAuth;
- private String language;
- private String lastName;
- private boolean isMailingListEnabled;
- private Map<String, String> meta;
- private String myNotes;
- private String nickname;
- private String phone;
- private String postcode;
- private String reseller;
- private Date signupTime;
- private String state;
- private String taxName;
- private double taxRate;
- private String title;
- private String town;
- private String uuid;
- private String vat;
-
- public Builder uuid(String uuid) {
- this.uuid = uuid;
- return this;
- }
- public Builder address(String address) {
- this.address = address;
- return this;
- }
- public Builder isApiHttpsOnly(boolean isApiHttpsOnly) {
- this.isApiHttpsOnly = isApiHttpsOnly;
- return this;
- }
- public Builder autotopupAmount(String autotopupAmount) {
- this.autotopupAmount = autotopupAmount;
- return this;
- }
- public Builder autotopupThreshold(String autotopupThreshold) {
- this.autotopupThreshold = autotopupThreshold;
- return this;
- }
- public Builder bankReference(String bankReference) {
- this.bankReference = bankReference;
- return this;
- }
- public Builder company(String company) {
- this.company = company;
- return this;
- }
- public Builder country(String country) {
- this.country = country;
- return this;
- }
- public Builder currency(String currency) {
- this.currency = currency;
- return this;
- }
- public Builder email(String email) {
- this.email = email;
- return this;
- }
- public Builder firstName(String firstName) {
- this.firstName = firstName;
- return this;
- }
- public Builder hasAutotopup(boolean hasAutotopup) {
- this.hasAutotopup = hasAutotopup;
- return this;
- }
- public Builder invoicing(boolean invoicing) {
- this.invoicing = invoicing;
- return this;
- }
- public Builder isKeyAuth(boolean isKeyAuth) {
- this.isKeyAuth = isKeyAuth;
- return this;
- }
- public Builder language(String language) {
- this.language = language;
- return this;
- }
- public Builder lastName(String lastName) {
- this.lastName = lastName;
- return this;
- }
- public Builder isMailingListEnabled(boolean isMailingListEnabled) {
- this.isMailingListEnabled = isMailingListEnabled;
- return this;
- }
- public Builder meta(Map<String, String> meta) {
- this.meta = meta;
- return this;
- }
- public Builder myNotes(String myNotes) {
- this.myNotes = myNotes;
- return this;
- }
- public Builder nickname(String nickname) {
- this.nickname = nickname;
- return this;
- }
- public Builder phone(String phone) {
- this.phone = phone;
- return this;
- }
- public Builder postcode(String postcode) {
- this.postcode = postcode;
- return this;
- }
- public Builder reseller(String reseller) {
- this.reseller = reseller;
- return this;
- }
- public Builder signupTime(Date signupTime) {
- this.signupTime = signupTime;
- return this;
- }
- public Builder state(String state) {
- this.state = state;
- return this;
- }
- public Builder taxName(String taxName) {
- this.taxName = taxName;
- return this;
- }
- public Builder taxRate(double taxRate) {
- this.taxRate = taxRate;
- return this;
- }
- public Builder title(String title) {
- this.title = title;
- return this;
- }
- public Builder town(String town) {
- this.town = town;
- return this;
- }
- public Builder vat(String vat) {
- this.vat = vat;
- return this;
- }
-
- public ProfileInfo build() {
- return new ProfileInfo(address, isApiHttpsOnly, autotopupAmount, autotopupThreshold, bankReference, company
- , country, currency, email, firstName, hasAutotopup, invoicing, isKeyAuth, language, lastName
- , isMailingListEnabled, meta, myNotes, nickname, phone , postcode, reseller, signupTime, state
- , taxName, taxRate, title, town, uuid, vat);
- }
-
- }
-
- private final String address;
- @Named("api_https_only")
- private final boolean isApiHttpsOnly;
- @Named("autotopup_amount")
- private final String autotopupAmount;
- @Named("autotopup_threshold")
- private final String autotopupThreshold;
- @Named("bank_reference")
- private final String bankReference;
- private final String company;
- private final String country;
- private final String currency;
- private final String email;
- @Named("first_name")
- private final String firstName;
- @Named("has_autotopup")
- private final boolean hasAutotopup;
- private final boolean invoicing;
- @Named("key_auth")
- private final boolean isKeyAuth;
- private final String language;
- @Named("last_name")
- private final String lastName;
- @Named("mailing_list")
- private final boolean isMailingListEnabled;
- private final Map<String, String> meta;
- @Named("my_notes")
- private final String myNotes;
- private final String nickname;
- private final String phone;
- private final String postcode;
- private final String reseller;
- @Named("signup_time")
- private final Date signupTime;
- private final String state;
- @Named("tax_name")
- private final String taxName;
- @Named("tax_rate")
- private final double taxRate;
- private final String title;
- private final String town;
- private final String uuid;
- private final String vat;
-
- @ConstructorProperties({
- "address", "api_https_only", "autopopup_amount", "autopopup_threshold"
- , "bank_reference", "company", "country", "currency", "email", "first_name"
- , "has_autotopup", "invoicing", "key_auth", "language", "last_name"
- , "mailing_list", "meta", "my_notes", "nickname", "phone"
- , "postcode", "reseller", "signup_time", "state", "tax_name", "tax_rate"
- , "title", "town", "uuid", "vat"
- })
- public ProfileInfo(String address, boolean apiHttpsOnly, String autotopupAmount, String autotopupThreshold
- , String bankReference, String company, String country, String currency, String email, String firstName
- , boolean hasAutotopup, boolean invoicing, boolean keyAuth, String language, String lastName
- , boolean mailingListEnabled, Map<String, String> meta, String myNotes, String nickname, String phone
- , String postcode, String reseller, Date signupTime, String state, String taxName, double taxRate
- , String title, String town, String uuid, String vat) {
- this.address = address;
- isApiHttpsOnly = apiHttpsOnly;
- this.autotopupAmount = autotopupAmount;
- this.autotopupThreshold = autotopupThreshold;
- this.bankReference = bankReference;
- this.company = company;
- this.country = country;
- this.currency = currency;
- this.email = email;
- this.firstName = firstName;
- this.hasAutotopup = hasAutotopup;
- this.invoicing = invoicing;
- isKeyAuth = keyAuth;
- this.language = language;
- this.lastName = lastName;
- isMailingListEnabled = mailingListEnabled;
- this.meta = meta;
- this.myNotes = myNotes;
- this.nickname = nickname;
- this.phone = phone;
- this.postcode = postcode;
- this.reseller = reseller;
- this.signupTime = signupTime;
- this.state = state;
- this.taxName = taxName;
- this.taxRate = taxRate;
- this.title = title;
- this.town = town;
- this.uuid = uuid;
- this.vat = vat;
- }
-
- public String getAddress() {
- return address;
- }
-
- public boolean isApiHttpsOnly() {
- return isApiHttpsOnly;
- }
-
- public String getAutotopupAmount() {
- return autotopupAmount;
- }
-
- public String getAutotopupThreshold() {
- return autotopupThreshold;
- }
-
- public String getBankReference() {
- return bankReference;
- }
-
- public String getCompany() {
- return company;
- }
-
- public String getCountry() {
- return country;
- }
-
- public String getCurrency() {
- return currency;
- }
-
- public String getEmail() {
- return email;
- }
-
- public String getFirstName() {
- return firstName;
- }
-
- public boolean isHasAutotopup() {
- return hasAutotopup;
- }
-
- public boolean isInvoicing() {
- return invoicing;
- }
-
- public boolean isKeyAuth() {
- return isKeyAuth;
- }
-
- public String getLanguage() {
- return language;
- }
-
- public String getLastName() {
- return lastName;
- }
-
- public boolean isMailingListEnabled() {
- return isMailingListEnabled;
- }
-
- public Map<String, String> getMeta() {
- return meta;
- }
-
- public String getMyNotes() {
- return myNotes;
- }
-
- public String getNickname() {
- return nickname;
- }
-
- public String getPhone() {
- return phone;
- }
-
- public String getPostcode() {
- return postcode;
- }
-
- public String getReseller() {
- return reseller;
- }
-
- public Date getSignupTime() {
- return signupTime;
- }
-
- public String getState() {
- return state;
- }
-
- public String getTaxName() {
- return taxName;
- }
-
- public double getTaxRate() {
- return taxRate;
- }
-
- public String getTitle() {
- return title;
- }
-
- public String getTown() {
- return town;
- }
-
- public String getUuid() {
- return uuid;
- }
-
- public String getVat() {
- return vat;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (!(o instanceof ProfileInfo)) return false;
-
- ProfileInfo that = (ProfileInfo) o;
-
- if (hasAutotopup != that.hasAutotopup) return false;
- if (invoicing != that.invoicing) return false;
- if (isApiHttpsOnly != that.isApiHttpsOnly) return false;
- if (isKeyAuth != that.isKeyAuth) return false;
- if (isMailingListEnabled != that.isMailingListEnabled) return false;
- if (Double.compare(that.taxRate, taxRate) != 0) return false;
- if (address != null ? !address.equals(that.address) : that.address != null) return false;
- if (autotopupAmount != null ? !autotopupAmount.equals(that.autotopupAmount) : that.autotopupAmount != null)
- return false;
- if (autotopupThreshold != null ? !autotopupThreshold.equals(that.autotopupThreshold) : that.autotopupThreshold != null)
- return false;
- if (bankReference != null ? !bankReference.equals(that.bankReference) : that.bankReference != null)
- return false;
- if (company != null ? !company.equals(that.company) : that.company != null) return false;
- if (country != null ? !country.equals(that.country) : that.country != null) return false;
- if (currency != null ? !currency.equals(that.currency) : that.currency != null) return false;
- if (email != null ? !email.equals(that.email) : that.email != null) return false;
- if (firstName != null ? !firstName.equals(that.firstName) : that.firstName != null) return false;
- if (language != null ? !language.equals(that.language) : that.language != null) return false;
- if (lastName != null ? !lastName.equals(that.lastName) : that.lastName != null) return false;
- if (meta != null ? !meta.equals(that.meta) : that.meta != null) return false;
- if (myNotes != null ? !myNotes.equals(that.myNotes) : that.myNotes != null) return false;
- if (nickname != null ? !nickname.equals(that.nickname) : that.nickname != null) return false;
- if (phone != null ? !phone.equals(that.phone) : that.phone != null) return false;
- if (postcode != null ? !postcode.equals(that.postcode) : that.postcode != null) return false;
- if (reseller != null ? !reseller.equals(that.reseller) : that.reseller != null) return false;
- if (signupTime != null ? !signupTime.equals(that.signupTime) : that.signupTime != null) return false;
- if (state != null ? !state.equals(that.state) : that.state != null) return false;
- if (taxName != null ? !taxName.equals(that.taxName) : that.taxName != null) return false;
- if (title != null ? !title.equals(that.title) : that.title != null) return false;
- if (town != null ? !town.equals(that.town) : that.town != null) return false;
- if (uuid != null ? !uuid.equals(that.uuid) : that.uuid != null) return false;
- if (vat != null ? !vat.equals(that.vat) : that.vat != null) return false;
-
- return true;
- }
-
- @Override
- public int hashCode() {
- int result;
- long temp;
- result = address != null ? address.hashCode() : 0;
- result = 31 * result + (isApiHttpsOnly ? 1 : 0);
- result = 31 * result + (autotopupAmount != null ? autotopupAmount.hashCode() : 0);
- result = 31 * result + (autotopupThreshold != null ? autotopupThreshold.hashCode() : 0);
- result = 31 * result + (bankReference != null ? bankReference.hashCode() : 0);
- result = 31 * result + (company != null ? company.hashCode() : 0);
- result = 31 * result + (country != null ? country.hashCode() : 0);
- result = 31 * result + (currency != null ? currency.hashCode() : 0);
- result = 31 * result + (email != null ? email.hashCode() : 0);
- result = 31 * result + (firstName != null ? firstName.hashCode() : 0);
- result = 31 * result + (hasAutotopup ? 1 : 0);
- result = 31 * result + (invoicing ? 1 : 0);
- result = 31 * result + (isKeyAuth ? 1 : 0);
- result = 31 * result + (language != null ? language.hashCode() : 0);
- result = 31 * result + (lastName != null ? lastName.hashCode() : 0);
- result = 31 * result + (isMailingListEnabled ? 1 : 0);
- result = 31 * result + (meta != null ? meta.hashCode() : 0);
- result = 31 * result + (myNotes != null ? myNotes.hashCode() : 0);
- result = 31 * result + (nickname != null ? nickname.hashCode() : 0);
- result = 31 * result + (phone != null ? phone.hashCode() : 0);
- result = 31 * result + (postcode != null ? postcode.hashCode() : 0);
- result = 31 * result + (reseller != null ? reseller.hashCode() : 0);
- result = 31 * result + (signupTime != null ? signupTime.hashCode() : 0);
- result = 31 * result + (state != null ? state.hashCode() : 0);
- result = 31 * result + (taxName != null ? taxName.hashCode() : 0);
- temp = Double.doubleToLongBits(taxRate);
- result = 31 * result + (int) (temp ^ (temp >>> 32));
- result = 31 * result + (title != null ? title.hashCode() : 0);
- result = 31 * result + (town != null ? town.hashCode() : 0);
- result = 31 * result + (uuid != null ? uuid.hashCode() : 0);
- result = 31 * result + (vat != null ? vat.hashCode() : 0);
- return result;
- }
-
- @Override
- public String toString() {
- return "[" +
- "address='" + address + '\'' +
- ", isApiHttpsOnly=" + isApiHttpsOnly +
- ", autotopupAmount='" + autotopupAmount + '\'' +
- ", autotopupThreshold='" + autotopupThreshold + '\'' +
- ", bankReference='" + bankReference + '\'' +
- ", company='" + company + '\'' +
- ", country='" + country + '\'' +
- ", currency='" + currency + '\'' +
- ", email='" + email + '\'' +
- ", firstName='" + firstName + '\'' +
- ", hasAutotopup=" + hasAutotopup +
- ", invoicing=" + invoicing +
- ", isKeyAuth=" + isKeyAuth +
- ", language='" + language + '\'' +
- ", lastName='" + lastName + '\'' +
- ", isMailingListEnabled=" + isMailingListEnabled +
- ", meta=" + meta +
- ", myNotes='" + myNotes + '\'' +
- ", nickname='" + nickname + '\'' +
- ", phone='" + phone + '\'' +
- ", postcode='" + postcode + '\'' +
- ", reseller='" + reseller + '\'' +
- ", signupTime='" + signupTime + '\'' +
- ", state='" + state + '\'' +
- ", taxName='" + taxName + '\'' +
- ", taxRate=" + taxRate +
- ", title='" + title + '\'' +
- ", town='" + town + '\'' +
- ", uuid='" + uuid + '\'' +
- ", vat='" + vat + '\'' +
- "]";
- }
+ public static class Builder {
+ private String address;
+ private boolean isApiHttpsOnly;
+ private String autotopupAmount;
+ private String autotopupThreshold;
+ private String bankReference;
+ private String company;
+ private String country;
+ private String currency;
+ private String email;
+ private String firstName;
+ private boolean hasAutotopup;
+ private boolean invoicing;
+ private boolean isKeyAuth;
+ private String language;
+ private String lastName;
+ private boolean isMailingListEnabled;
+ private Map<String, String> meta;
+ private String myNotes;
+ private String nickname;
+ private String phone;
+ private String postcode;
+ private String reseller;
+ private Date signupTime;
+ private String state;
+ private String taxName;
+ private double taxRate;
+ private String title;
+ private String town;
+ private String uuid;
+ private String vat;
+
+ public Builder uuid(String uuid) {
+ this.uuid = uuid;
+ return this;
+ }
+
+ public Builder address(String address) {
+ this.address = address;
+ return this;
+ }
+
+ public Builder isApiHttpsOnly(boolean isApiHttpsOnly) {
+ this.isApiHttpsOnly = isApiHttpsOnly;
+ return this;
+ }
+
+ public Builder autotopupAmount(String autotopupAmount) {
+ this.autotopupAmount = autotopupAmount;
+ return this;
+ }
+
+ public Builder autotopupThreshold(String autotopupThreshold) {
+ this.autotopupThreshold = autotopupThreshold;
+ return this;
+ }
+
+ public Builder bankReference(String bankReference) {
+ this.bankReference = bankReference;
+ return this;
+ }
+
+ public Builder company(String company) {
+ this.company = company;
+ return this;
+ }
+
+ public Builder country(String country) {
+ this.country = country;
+ return this;
+ }
+
+ public Builder currency(String currency) {
+ this.currency = currency;
+ return this;
+ }
+
+ public Builder email(String email) {
+ this.email = email;
+ return this;
+ }
+
+ public Builder firstName(String firstName) {
+ this.firstName = firstName;
+ return this;
+ }
+
+ public Builder hasAutotopup(boolean hasAutotopup) {
+ this.hasAutotopup = hasAutotopup;
+ return this;
+ }
+
+ public Builder invoicing(boolean invoicing) {
+ this.invoicing = invoicing;
+ return this;
+ }
+
+ public Builder isKeyAuth(boolean isKeyAuth) {
+ this.isKeyAuth = isKeyAuth;
+ return this;
+ }
+
+ public Builder language(String language) {
+ this.language = language;
+ return this;
+ }
+
+ public Builder lastName(String lastName) {
+ this.lastName = lastName;
+ return this;
+ }
+
+ public Builder isMailingListEnabled(boolean isMailingListEnabled) {
+ this.isMailingListEnabled = isMailingListEnabled;
+ return this;
+ }
+
+ public Builder meta(Map<String, String> meta) {
+ this.meta = meta;
+ return this;
+ }
+
+ public Builder myNotes(String myNotes) {
+ this.myNotes = myNotes;
+ return this;
+ }
+
+ public Builder nickname(String nickname) {
+ this.nickname = nickname;
+ return this;
+ }
+
+ public Builder phone(String phone) {
+ this.phone = phone;
+ return this;
+ }
+
+ public Builder postcode(String postcode) {
+ this.postcode = postcode;
+ return this;
+ }
+
+ public Builder reseller(String reseller) {
+ this.reseller = reseller;
+ return this;
+ }
+
+ public Builder signupTime(Date signupTime) {
+ this.signupTime = signupTime;
+ return this;
+ }
+
+ public Builder state(String state) {
+ this.state = state;
+ return this;
+ }
+
+ public Builder taxName(String taxName) {
+ this.taxName = taxName;
+ return this;
+ }
+
+ public Builder taxRate(double taxRate) {
+ this.taxRate = taxRate;
+ return this;
+ }
+
+ public Builder title(String title) {
+ this.title = title;
+ return this;
+ }
+
+ public Builder town(String town) {
+ this.town = town;
+ return this;
+ }
+
+ public Builder vat(String vat) {
+ this.vat = vat;
+ return this;
+ }
+
+ public ProfileInfo build() {
+ return new ProfileInfo(address, isApiHttpsOnly, autotopupAmount, autotopupThreshold, bankReference, company
+ , country, currency, email, firstName, hasAutotopup, invoicing, isKeyAuth, language, lastName
+ , isMailingListEnabled, meta, myNotes, nickname, phone, postcode, reseller, signupTime, state
+ , taxName, taxRate, title, town, uuid, vat);
+ }
+
+ }
+
+ private final String address;
+ @Named("api_https_only")
+ private final boolean isApiHttpsOnly;
+ @Named("autotopup_amount")
+ private final String autotopupAmount;
+ @Named("autotopup_threshold")
+ private final String autotopupThreshold;
+ @Named("bank_reference")
+ private final String bankReference;
+ private final String company;
+ private final String country;
+ private final String currency;
+ private final String email;
+ @Named("first_name")
+ private final String firstName;
+ @Named("has_autotopup")
+ private final boolean hasAutotopup;
+ private final boolean invoicing;
+ @Named("key_auth")
+ private final boolean isKeyAuth;
+ private final String language;
+ @Named("last_name")
+ private final String lastName;
+ @Named("mailing_list")
+ private final boolean isMailingListEnabled;
+ private final Map<String, String> meta;
+ @Named("my_notes")
+ private final String myNotes;
+ private final String nickname;
+ private final String phone;
+ private final String postcode;
+ private final String reseller;
+ @Named("signup_time")
+ private final Date signupTime;
+ private final String state;
+ @Named("tax_name")
+ private final String taxName;
+ @Named("tax_rate")
+ private final double taxRate;
+ private final String title;
+ private final String town;
+ private final String uuid;
+ private final String vat;
+
+ @ConstructorProperties({
+ "address", "api_https_only", "autopopup_amount", "autopopup_threshold"
+ , "bank_reference", "company", "country", "currency", "email", "first_name"
+ , "has_autotopup", "invoicing", "key_auth", "language", "last_name"
+ , "mailing_list", "meta", "my_notes", "nickname", "phone"
+ , "postcode", "reseller", "signup_time", "state", "tax_name", "tax_rate"
+ , "title", "town", "uuid", "vat"
+ })
+ public ProfileInfo(String address, boolean apiHttpsOnly, String autotopupAmount, String autotopupThreshold
+ , String bankReference, String company, String country, String currency, String email, String firstName
+ , boolean hasAutotopup, boolean invoicing, boolean keyAuth, String language, String lastName
+ , boolean mailingListEnabled, Map<String, String> meta, String myNotes, String nickname, String phone
+ , String postcode, String reseller, Date signupTime, String state, String taxName, double taxRate
+ , String title, String town, String uuid, String vat) {
+ this.address = address;
+ isApiHttpsOnly = apiHttpsOnly;
+ this.autotopupAmount = autotopupAmount;
+ this.autotopupThreshold = autotopupThreshold;
+ this.bankReference = bankReference;
+ this.company = company;
+ this.country = country;
+ this.currency = currency;
+ this.email = email;
+ this.firstName = firstName;
+ this.hasAutotopup = hasAutotopup;
+ this.invoicing = invoicing;
+ isKeyAuth = keyAuth;
+ this.language = language;
+ this.lastName = lastName;
+ isMailingListEnabled = mailingListEnabled;
+ this.meta = meta;
+ this.myNotes = myNotes;
+ this.nickname = nickname;
+ this.phone = phone;
+ this.postcode = postcode;
+ this.reseller = reseller;
+ this.signupTime = signupTime;
+ this.state = state;
+ this.taxName = taxName;
+ this.taxRate = taxRate;
+ this.title = title;
+ this.town = town;
+ this.uuid = uuid;
+ this.vat = vat;
+ }
+
+ public String getAddress() {
+ return address;
+ }
+
+ public boolean isApiHttpsOnly() {
+ return isApiHttpsOnly;
+ }
+
+ public String getAutotopupAmount() {
+ return autotopupAmount;
+ }
+
+ public String getAutotopupThreshold() {
+ return autotopupThreshold;
+ }
+
+ public String getBankReference() {
+ return bankReference;
+ }
+
+ public String getCompany() {
+ return company;
+ }
+
+ public String getCountry() {
+ return country;
+ }
+
+ public String getCurrency() {
+ return currency;
+ }
+
+ public String getEmail() {
+ return email;
+ }
+
+ public String getFirstName() {
+ return firstName;
+ }
+
+ public boolean isHasAutotopup() {
+ return hasAutotopup;
+ }
+
+ public boolean isInvoicing() {
+ return invoicing;
+ }
+
+ public boolean isKeyAuth() {
+ return isKeyAuth;
+ }
+
+ public String getLanguage() {
+ return language;
+ }
+
+ public String getLastName() {
+ return lastName;
+ }
+
+ public boolean isMailingListEnabled() {
+ return isMailingListEnabled;
+ }
+
+ public Map<String, String> getMeta() {
+ return meta;
+ }
+
+ public String getMyNotes() {
+ return myNotes;
+ }
+
+ public String getNickname() {
+ return nickname;
+ }
+
+ public String getPhone() {
+ return phone;
+ }
+
+ public String getPostcode() {
+ return postcode;
+ }
+
+ public String getReseller() {
+ return reseller;
+ }
+
+ public Date getSignupTime() {
+ return signupTime;
+ }
+
+ public String getState() {
+ return state;
+ }
+
+ public String getTaxName() {
+ return taxName;
+ }
+
+ public double getTaxRate() {
+ return taxRate;
+ }
+
+ public String getTitle() {
+ return title;
+ }
+
+ public String getTown() {
+ return town;
+ }
+
+ public String getUuid() {
+ return uuid;
+ }
+
+ public String getVat() {
+ return vat;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (!(o instanceof ProfileInfo)) return false;
+
+ ProfileInfo that = (ProfileInfo) o;
+
+ if (hasAutotopup != that.hasAutotopup) return false;
+ if (invoicing != that.invoicing) return false;
+ if (isApiHttpsOnly != that.isApiHttpsOnly) return false;
+ if (isKeyAuth != that.isKeyAuth) return false;
+ if (isMailingListEnabled != that.isMailingListEnabled) return false;
+ if (Double.compare(that.taxRate, taxRate) != 0) return false;
+ if (address != null ? !address.equals(that.address) : that.address != null) return false;
+ if (autotopupAmount != null ? !autotopupAmount.equals(that.autotopupAmount) : that.autotopupAmount != null)
+ return false;
+ if (autotopupThreshold != null
+ ? !autotopupThreshold.equals(that.autotopupThreshold)
+ : that.autotopupThreshold != null)
+ return false;
+ if (bankReference != null ? !bankReference.equals(that.bankReference) : that.bankReference != null)
+ return false;
+ if (company != null ? !company.equals(that.company) : that.company != null) return false;
+ if (country != null ? !country.equals(that.country) : that.country != null) return false;
+ if (currency != null ? !currency.equals(that.currency) : that.currency != null) return false;
+ if (email != null ? !email.equals(that.email) : that.email != null) return false;
+ if (firstName != null ? !firstName.equals(that.firstName) : that.firstName != null) return false;
+ if (language != null ? !language.equals(that.language) : that.language != null) return false;
+ if (lastName != null ? !lastName.equals(that.lastName) : that.lastName != null) return false;
+ if (meta != null ? !meta.equals(that.meta) : that.meta != null) return false;
+ if (myNotes != null ? !myNotes.equals(that.myNotes) : that.myNotes != null) return false;
+ if (nickname != null ? !nickname.equals(that.nickname) : that.nickname != null) return false;
+ if (phone != null ? !phone.equals(that.phone) : that.phone != null) return false;
+ if (postcode != null ? !postcode.equals(that.postcode) : that.postcode != null) return false;
+ if (reseller != null ? !reseller.equals(that.reseller) : that.reseller != null) return false;
+ if (signupTime != null ? !signupTime.equals(that.signupTime) : that.signupTime != null) return false;
+ if (state != null ? !state.equals(that.state) : that.state != null) return false;
+ if (taxName != null ? !taxName.equals(that.taxName) : that.taxName != null) return false;
+ if (title != null ? !title.equals(that.title) : that.title != null) return false;
+ if (town != null ? !town.equals(that.town) : that.town != null) return false;
+ if (uuid != null ? !uuid.equals(that.uuid) : that.uuid != null) return false;
+ if (vat != null ? !vat.equals(that.vat) : that.vat != null) return false;
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int result;
+ long temp;
+ result = address != null ? address.hashCode() : 0;
+ result = 31 * result + (isApiHttpsOnly ? 1 : 0);
+ result = 31 * result + (autotopupAmount != null ? autotopupAmount.hashCode() : 0);
+ result = 31 * result + (autotopupThreshold != null ? autotopupThreshold.hashCode() : 0);
+ result = 31 * result + (bankReference != null ? bankReference.hashCode() : 0);
+ result = 31 * result + (company != null ? company.hashCode() : 0);
+ result = 31 * result + (country != null ? country.hashCode() : 0);
+ result = 31 * result + (currency != null ? currency.hashCode() : 0);
+ result = 31 * result + (email != null ? email.hashCode() : 0);
+ result = 31 * result + (firstName != null ? firstName.hashCode() : 0);
+ result = 31 * result + (hasAutotopup ? 1 : 0);
+ result = 31 * result + (invoicing ? 1 : 0);
+ result = 31 * result + (isKeyAuth ? 1 : 0);
+ result = 31 * result + (language != null ? language.hashCode() : 0);
+ result = 31 * result + (lastName != null ? lastName.hashCode() : 0);
+ result = 31 * result + (isMailingListEnabled ? 1 : 0);
+ result = 31 * result + (meta != null ? meta.hashCode() : 0);
+ result = 31 * result + (myNotes != null ? myNotes.hashCode() : 0);
+ result = 31 * result + (nickname != null ? nickname.hashCode() : 0);
+ result = 31 * result + (phone != null ? phone.hashCode() : 0);
+ result = 31 * result + (postcode != null ? postcode.hashCode() : 0);
+ result = 31 * result + (reseller != null ? reseller.hashCode() : 0);
+ result = 31 * result + (signupTime != null ? signupTime.hashCode() : 0);
+ result = 31 * result + (state != null ? state.hashCode() : 0);
+ result = 31 * result + (taxName != null ? taxName.hashCode() : 0);
+ temp = Double.doubleToLongBits(taxRate);
+ result = 31 * result + (int) (temp ^ (temp >>> 32));
+ result = 31 * result + (title != null ? title.hashCode() : 0);
+ result = 31 * result + (town != null ? town.hashCode() : 0);
+ result = 31 * result + (uuid != null ? uuid.hashCode() : 0);
+ result = 31 * result + (vat != null ? vat.hashCode() : 0);
+ return result;
+ }
+
+ @Override
+ public String toString() {
+ return "[" +
+ "address='" + address + '\'' +
+ ", isApiHttpsOnly=" + isApiHttpsOnly +
+ ", autotopupAmount='" + autotopupAmount + '\'' +
+ ", autotopupThreshold='" + autotopupThreshold + '\'' +
+ ", bankReference='" + bankReference + '\'' +
+ ", company='" + company + '\'' +
+ ", country='" + country + '\'' +
+ ", currency='" + currency + '\'' +
+ ", email='" + email + '\'' +
+ ", firstName='" + firstName + '\'' +
+ ", hasAutotopup=" + hasAutotopup +
+ ", invoicing=" + invoicing +
+ ", isKeyAuth=" + isKeyAuth +
+ ", language='" + language + '\'' +
+ ", lastName='" + lastName + '\'' +
+ ", isMailingListEnabled=" + isMailingListEnabled +
+ ", meta=" + meta +
+ ", myNotes='" + myNotes + '\'' +
+ ", nickname='" + nickname + '\'' +
+ ", phone='" + phone + '\'' +
+ ", postcode='" + postcode + '\'' +
+ ", reseller='" + reseller + '\'' +
+ ", signupTime='" + signupTime + '\'' +
+ ", state='" + state + '\'' +
+ ", taxName='" + taxName + '\'' +
+ ", taxRate=" + taxRate +
+ ", title='" + title + '\'' +
+ ", town='" + town + '\'' +
+ ", uuid='" + uuid + '\'' +
+ ", vat='" + vat + '\'' +
+ "]";
+ }
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0d70c84a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/Server.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/Server.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/Server.java
index f9878fe..8c9f901 100644
--- a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/Server.java
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/Server.java
@@ -26,139 +26,148 @@ import java.net.URI;
*/
public class Server extends Item {
- public static class Builder extends Item.Builder {
- protected Owner owner;
- protected ServerStatus status;
- protected ServerRuntime runtime;
-
- /**
- * @param owner server's owner.
- * @return Server Builder
- */
- public Builder owner(Owner owner) {
- this.owner = owner;
- return this;
- }
-
- /**
- * @param status Status of the guest.
- * @return Server Builder
- */
- public Builder status(ServerStatus status) {
- this.status = status;
- return this;
- }
-
- /**
- * @param runtime Runtime information of the guest
- * @return Server Builder
- */
- public Builder runtime(ServerRuntime runtime) {
- this.runtime = runtime;
- return this;
- }
-
- /**
- * {@inheritDoc}
- * @return Server Builder
- */
- @Override
- public Builder uuid(String uuid) {
- return Builder.class.cast(super.uuid(uuid));
- }
-
- /**
- * {@inheritDoc}
- * @return Server Builder
- */
- @Override
- public Builder name(String name) {
- return Builder.class.cast(super.name(name));
- }
-
- /**
- * {@inheritDoc}
- * @return Server Builder
- */
- @Override
- public Builder resourceUri(URI resourceUri) {
- return Builder.class.cast(super.resourceUri(resourceUri));
- }
-
- public Server build() {
- return new Server(uuid, name, resourceUri, owner, status, runtime);
- }
-
- public static Builder fromServer(Server in) {
- return new Builder().uuid(in.getUuid()).name(in.getName()).resourceUri(in.getResourceUri()).owner(in.getOwner()).status(in.getStatus())
- .runtime(in.getRuntime());
- }
- }
-
- protected final Owner owner;
- protected final ServerStatus status;
- protected final ServerRuntime runtime;
-
- @ConstructorProperties({
- "uuid", "name", "resource_uri", "owner", "status", "runtime"
- })
- public Server(@Nullable String uuid, String name, URI resourceUri, Owner owner, ServerStatus status, ServerRuntime runtime) {
- super(uuid, name, resourceUri);
- this.owner = owner;
- this.status = status;
- this.runtime = runtime;
- }
-
- /**
- * @return server's owner.
- */
- public Owner getOwner() {
- return owner;
- }
-
- /**
- * @return Status of the guest.
- */
- public ServerStatus getStatus() {
- return status;
- }
-
- /**
- * @return Runtime information of the guest
- */
- public ServerRuntime getRuntime() {
- return runtime;
- }
-
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (!(o instanceof Server)) return false;
- if (!super.equals(o)) return false;
-
- Server server = (Server) o;
-
- if (owner != null ? !owner.equals(server.owner) : server.owner != null) return false;
- if (runtime != null ? !runtime.equals(server.runtime) : server.runtime != null) return false;
- if (status != server.status) return false;
-
- return true;
- }
-
- @Override
- public int hashCode() {
- int result = super.hashCode();
- result = 31 * result + (owner != null ? owner.hashCode() : 0);
- result = 31 * result + (status != null ? status.hashCode() : 0);
- result = 31 * result + (runtime != null ? runtime.hashCode() : 0);
- return result;
- }
-
- @Override
- public String toString() {
- return "[uuid=" + uuid + ", name=" + name + ", resourceUri=" + resourceUri + ", owner=" + owner
- + ", status=" + status + ", runtime=" + runtime + "]";
- }
+ public static class Builder extends Item.Builder {
+ protected Owner owner;
+ protected ServerStatus status;
+ protected ServerRuntime runtime;
+
+ /**
+ * @param owner server's owner.
+ * @return Server Builder
+ */
+ public Builder owner(Owner owner) {
+ this.owner = owner;
+ return this;
+ }
+
+ /**
+ * @param status Status of the guest.
+ * @return Server Builder
+ */
+ public Builder status(ServerStatus status) {
+ this.status = status;
+ return this;
+ }
+
+ /**
+ * @param runtime Runtime information of the guest
+ * @return Server Builder
+ */
+ public Builder runtime(ServerRuntime runtime) {
+ this.runtime = runtime;
+ return this;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @return Server Builder
+ */
+ @Override
+ public Builder uuid(String uuid) {
+ return Builder.class.cast(super.uuid(uuid));
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @return Server Builder
+ */
+ @Override
+ public Builder name(String name) {
+ return Builder.class.cast(super.name(name));
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @return Server Builder
+ */
+ @Override
+ public Builder resourceUri(URI resourceUri) {
+ return Builder.class.cast(super.resourceUri(resourceUri));
+ }
+
+ public Server build() {
+ return new Server(uuid, name, resourceUri, owner, status, runtime);
+ }
+
+ public static Builder fromServer(Server in) {
+ return new Builder()
+ .uuid(in.getUuid())
+ .name(in.getName())
+ .resourceUri(in.getResourceUri())
+ .owner(in.getOwner())
+ .status(in.getStatus())
+ .runtime(in.getRuntime());
+ }
+ }
+
+ protected final Owner owner;
+ protected final ServerStatus status;
+ protected final ServerRuntime runtime;
+
+ @ConstructorProperties({
+ "uuid", "name", "resource_uri", "owner", "status", "runtime"
+ })
+ public Server(@Nullable String uuid, String name, URI resourceUri, Owner owner, ServerStatus status
+ , ServerRuntime runtime) {
+ super(uuid, name, resourceUri);
+ this.owner = owner;
+ this.status = status;
+ this.runtime = runtime;
+ }
+
+ /**
+ * @return server's owner.
+ */
+ public Owner getOwner() {
+ return owner;
+ }
+
+ /**
+ * @return Status of the guest.
+ */
+ public ServerStatus getStatus() {
+ return status;
+ }
+
+ /**
+ * @return Runtime information of the guest
+ */
+ public ServerRuntime getRuntime() {
+ return runtime;
+ }
+
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (!(o instanceof Server)) return false;
+ if (!super.equals(o)) return false;
+
+ Server server = (Server) o;
+
+ if (owner != null ? !owner.equals(server.owner) : server.owner != null) return false;
+ if (runtime != null ? !runtime.equals(server.runtime) : server.runtime != null) return false;
+ if (status != server.status) return false;
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = super.hashCode();
+ result = 31 * result + (owner != null ? owner.hashCode() : 0);
+ result = 31 * result + (status != null ? status.hashCode() : 0);
+ result = 31 * result + (runtime != null ? runtime.hashCode() : 0);
+ return result;
+ }
+
+ @Override
+ public String toString() {
+ return "[uuid=" + uuid + ", name=" + name + ", resourceUri=" + resourceUri + ", owner=" + owner
+ + ", status=" + status + ", runtime=" + runtime + "]";
+ }
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0d70c84a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/ServerAvailabilityGroup.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/ServerAvailabilityGroup.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/ServerAvailabilityGroup.java
index 7375ede..d1bee88 100644
--- a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/ServerAvailabilityGroup.java
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/ServerAvailabilityGroup.java
@@ -24,47 +24,47 @@ import java.util.List;
*/
public class ServerAvailabilityGroup {
- private final List<String> uuids;
+ private final List<String> uuids;
- public ServerAvailabilityGroup(List<String> uuids) {
- this.uuids = uuids;
- }
+ public ServerAvailabilityGroup(List<String> uuids) {
+ this.uuids = uuids;
+ }
- public List<String> getUuids() {
- return uuids;
- }
+ public List<String> getUuids() {
+ return uuids;
+ }
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (!(o instanceof ServerAvailabilityGroup)) return false;
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (!(o instanceof ServerAvailabilityGroup)) return false;
- ServerAvailabilityGroup that = (ServerAvailabilityGroup) o;
+ ServerAvailabilityGroup that = (ServerAvailabilityGroup) o;
- if (uuids != null ? !uuids.equals(that.uuids) : that.uuids != null) return false;
+ if (uuids != null ? !uuids.equals(that.uuids) : that.uuids != null) return false;
- return true;
- }
+ return true;
+ }
- @Override
- public int hashCode() {
- return uuids != null ? uuids.hashCode() : 0;
- }
+ @Override
+ public int hashCode() {
+ return uuids != null ? uuids.hashCode() : 0;
+ }
- @Override
- public String toString() {
- String returnString = "";
+ @Override
+ public String toString() {
+ String returnString = "";
- Iterator iterator = uuids.iterator();
+ Iterator iterator = uuids.iterator();
- while (iterator.hasNext()){
- returnString += iterator.next();
+ while (iterator.hasNext()) {
+ returnString += iterator.next();
- if(iterator.hasNext()){
- returnString += ",";
- }
- }
+ if (iterator.hasNext()) {
+ returnString += ",";
+ }
+ }
- return returnString;
- }
+ return returnString;
+ }
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0d70c84a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/ServerDrive.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/ServerDrive.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/ServerDrive.java
index 9d5cbb0..1785b8a 100644
--- a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/ServerDrive.java
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/ServerDrive.java
@@ -24,148 +24,141 @@ import java.beans.ConstructorProperties;
*/
public class ServerDrive {
- public static class Builder{
- private int bootOrder;
- private String deviceChannel;
- private DeviceEmulationType deviceEmulationType;
- private Drive drive;
-
- public Builder bootOrder(int bootOrder){
- this.bootOrder = bootOrder;
- return this;
- }
-
- public Builder deviceChannel(String deviceChannel){
- this.deviceChannel = deviceChannel;
- return this;
- }
-
- public Builder deviceEmulationType(DeviceEmulationType deviceEmulationType){
- this.deviceEmulationType = deviceEmulationType;
- return this;
- }
-
- public Builder drive(Drive drive){
- this.drive = drive;
- return this;
- }
-
- public ServerDrive build(){
- return new ServerDrive(bootOrder, deviceChannel, deviceEmulationType, drive);
- }
- }
-
- @Named("boot_order")
- private final int bootOrder;
- @Named("dev_channel")
- private final String deviceChannel;
- @Named("device")
- private final DeviceEmulationType deviceEmulationType;
- @Named("drive")
- private final Drive drive;
- private final String driveUuid;
-
- /**
- *
- * @param bootOrder drive boot order
- * @param deviceChannel device channel in format {controller:unit} ex. 0:1, 0:2, etc.
- * @param deviceEmulationType device emulation type
- * @param drive drive to attach. UUID Required.
- */
- @ConstructorProperties({
- "boot_order", "dev_channel", "device", "drive"
- })
- public ServerDrive(int bootOrder, String deviceChannel, DeviceEmulationType deviceEmulationType, Drive drive) {
- this.bootOrder = bootOrder;
- this.deviceChannel = deviceChannel;
- this.deviceEmulationType = deviceEmulationType;
- this.drive = drive;
- this.driveUuid = drive.getUuid();
- }
-
- /**
- *
- * @param bootOrder drive boot order
- * @param deviceChannel device channel in format {controller:unit} ex. 0:1, 0:2, etc.
- * @param deviceEmulationType device emulation type
- * @param driveUuid drive uuid.
- */
- public ServerDrive(int bootOrder, String deviceChannel, DeviceEmulationType deviceEmulationType, String driveUuid) {
- this.bootOrder = bootOrder;
- this.deviceChannel = deviceChannel;
- this.deviceEmulationType = deviceEmulationType;
- this.driveUuid = driveUuid;
- this.drive = null;
- }
-
- /**
- *
- * @return drive boot order
- */
- public int getBootOrder() {
- return bootOrder;
- }
-
- /**
- *
- * @return device channel in format {controller:unit} ex. 0:1, 0:2, etc.
- */
- public String getDeviceChannel() {
- return deviceChannel;
- }
-
- /**
- *
- * @return device emulation type
- */
- public DeviceEmulationType getDeviceEmulationType() {
- return deviceEmulationType;
- }
-
- /**
- *
- * @return drive
- */
- public Drive getDrive() {
- return drive;
- }
-
- /**
- *
- * @return drive uuid
- */
- public String getDriveUuid() {
- return driveUuid;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (!(o instanceof ServerDrive)) return false;
-
- ServerDrive that = (ServerDrive) o;
-
- if (bootOrder != that.bootOrder) return false;
- if (deviceChannel != null ? !deviceChannel.equals(that.deviceChannel) : that.deviceChannel != null)
- return false;
- if (deviceEmulationType != that.deviceEmulationType) return false;
- if (drive != null ? !drive.equals(that.drive) : that.drive != null) return false;
-
- return true;
- }
-
- @Override
- public int hashCode() {
- int result = bootOrder;
- result = 31 * result + (deviceChannel != null ? deviceChannel.hashCode() : 0);
- result = 31 * result + (deviceEmulationType != null ? deviceEmulationType.hashCode() : 0);
- result = 31 * result + (drive != null ? drive.hashCode() : 0);
- return result;
- }
-
- @Override
- public String toString() {
- return "[bootOrder=" + bootOrder + ", deviceChannel=" + deviceChannel + ", deviceEmulationType=" + deviceEmulationType
- + ", drive=" + drive + "]";
- }
+ public static class Builder {
+ private int bootOrder;
+ private String deviceChannel;
+ private DeviceEmulationType deviceEmulationType;
+ private Drive drive;
+
+ public Builder bootOrder(int bootOrder) {
+ this.bootOrder = bootOrder;
+ return this;
+ }
+
+ public Builder deviceChannel(String deviceChannel) {
+ this.deviceChannel = deviceChannel;
+ return this;
+ }
+
+ public Builder deviceEmulationType(DeviceEmulationType deviceEmulationType) {
+ this.deviceEmulationType = deviceEmulationType;
+ return this;
+ }
+
+ public Builder drive(Drive drive) {
+ this.drive = drive;
+ return this;
+ }
+
+ public ServerDrive build() {
+ return new ServerDrive(bootOrder, deviceChannel, deviceEmulationType, drive);
+ }
+ }
+
+ @Named("boot_order")
+ private final int bootOrder;
+ @Named("dev_channel")
+ private final String deviceChannel;
+ @Named("device")
+ private final DeviceEmulationType deviceEmulationType;
+ @Named("drive")
+ private final Drive drive;
+ private final String driveUuid;
+
+ /**
+ * @param bootOrder drive boot order
+ * @param deviceChannel device channel in format {controller:unit} ex. 0:1, 0:2, etc.
+ * @param deviceEmulationType device emulation type
+ * @param drive drive to attach. UUID Required.
+ */
+ @ConstructorProperties({
+ "boot_order", "dev_channel", "device", "drive"
+ })
+ public ServerDrive(int bootOrder, String deviceChannel, DeviceEmulationType deviceEmulationType, Drive drive) {
+ this.bootOrder = bootOrder;
+ this.deviceChannel = deviceChannel;
+ this.deviceEmulationType = deviceEmulationType;
+ this.drive = drive;
+ this.driveUuid = drive.getUuid();
+ }
+
+ /**
+ * @param bootOrder drive boot order
+ * @param deviceChannel device channel in format {controller:unit} ex. 0:1, 0:2, etc.
+ * @param deviceEmulationType device emulation type
+ * @param driveUuid drive uuid.
+ */
+ public ServerDrive(int bootOrder, String deviceChannel, DeviceEmulationType deviceEmulationType, String driveUuid) {
+ this.bootOrder = bootOrder;
+ this.deviceChannel = deviceChannel;
+ this.deviceEmulationType = deviceEmulationType;
+ this.driveUuid = driveUuid;
+ this.drive = null;
+ }
+
+ /**
+ * @return drive boot order
+ */
+ public int getBootOrder() {
+ return bootOrder;
+ }
+
+ /**
+ * @return device channel in format {controller:unit} ex. 0:1, 0:2, etc.
+ */
+ public String getDeviceChannel() {
+ return deviceChannel;
+ }
+
+ /**
+ * @return device emulation type
+ */
+ public DeviceEmulationType getDeviceEmulationType() {
+ return deviceEmulationType;
+ }
+
+ /**
+ * @return drive
+ */
+ public Drive getDrive() {
+ return drive;
+ }
+
+ /**
+ * @return drive uuid
+ */
+ public String getDriveUuid() {
+ return driveUuid;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (!(o instanceof ServerDrive)) return false;
+
+ ServerDrive that = (ServerDrive) o;
+
+ if (bootOrder != that.bootOrder) return false;
+ if (deviceChannel != null ? !deviceChannel.equals(that.deviceChannel) : that.deviceChannel != null)
+ return false;
+ if (deviceEmulationType != that.deviceEmulationType) return false;
+ if (drive != null ? !drive.equals(that.drive) : that.drive != null) return false;
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = bootOrder;
+ result = 31 * result + (deviceChannel != null ? deviceChannel.hashCode() : 0);
+ result = 31 * result + (deviceEmulationType != null ? deviceEmulationType.hashCode() : 0);
+ result = 31 * result + (drive != null ? drive.hashCode() : 0);
+ return result;
+ }
+
+ @Override
+ public String toString() {
+ return "[bootOrder=" + bootOrder + ", deviceChannel=" + deviceChannel
+ + ", deviceEmulationType=" + deviceEmulationType + ", drive=" + drive + "]";
+ }
}
[13/13] git commit: JCLOUDS-291: Add pagination support to the
cloudsigma2 provider.
Posted by na...@apache.org.
JCLOUDS-291: Add pagination support to the cloudsigma2 provider.
https://issues.apache.org/jira/browse/JCLOUDS-291
Project: http://git-wip-us.apache.org/repos/asf/jclouds-labs/repo
Commit: http://git-wip-us.apache.org/repos/asf/jclouds-labs/commit/0bebb584
Tree: http://git-wip-us.apache.org/repos/asf/jclouds-labs/tree/0bebb584
Diff: http://git-wip-us.apache.org/repos/asf/jclouds-labs/diff/0bebb584
Branch: refs/heads/master
Commit: 0bebb584662d30fd7f9b772f787feeebdc9d9d0a
Parents: d9717a4
Author: Vladimir Shevchenko <sh...@gmail.com>
Authored: Sat Nov 9 20:18:25 2013 +0700
Committer: Ignasi Barrera <na...@apache.org>
Committed: Thu Nov 14 12:20:57 2013 +0100
----------------------------------------------------------------------
.../org/jclouds/cloudsigma2/CloudSigma2Api.java | 356 +++++++++--
.../cloudsigma2/domain/PaginatedCollection.java | 58 ++
.../functions/internal/ParseDiscounts.java | 73 +++
.../functions/internal/ParseDriveInfos.java | 74 +++
.../functions/internal/ParseDrives.java | 73 +++
.../internal/ParseFirewallPolicies.java | 94 +++
.../functions/internal/ParseIPInfos.java | 73 +++
.../functions/internal/ParseIPs.java | 73 +++
.../functions/internal/ParseLibraryDrives.java | 73 +++
.../functions/internal/ParseLicenses.java | 73 +++
.../functions/internal/ParseServerInfos.java | 74 +++
.../functions/internal/ParseServers.java | 74 +++
.../functions/internal/ParseSubscriptions.java | 95 +++
.../functions/internal/ParseTags.java | 94 +++
.../functions/internal/ParseTransactions.java | 73 +++
.../functions/internal/ParseVLANs.java | 94 +++
.../cloudsigma2/options/PaginationOptions.java | 117 ++++
.../cloudsigma2/CloudSigma2ApiExpectTest.java | 602 +++++++++++++++++--
.../cloudsigma2/CloudSigma2ApiLiveTest.java | 43 +-
.../src/test/resources/discount-last-page.json | 17 +
cloudsigma2/src/test/resources/discount.json | 10 +-
.../resources/drives-detail-first-page.json | 88 +++
.../test/resources/drives-detail-last-page.json | 31 +
.../src/test/resources/drives-last-page.json | 18 +
cloudsigma2/src/test/resources/drives.json | 11 +-
.../resources/fwpolicies-detail-first-page.json | 32 +
.../resources/fwpolicies-detail-last-page.json | 79 +++
.../src/test/resources/ips-last-page.json | 28 +
cloudsigma2/src/test/resources/ips.json | 21 +-
.../src/test/resources/ledger-last-page.json | 27 +
cloudsigma2/src/test/resources/ledger.json | 24 +-
.../src/test/resources/libdrives-last-page.json | 36 ++
cloudsigma2/src/test/resources/libdrives.json | 33 +-
.../src/test/resources/licences-last-page.json | 17 +
cloudsigma2/src/test/resources/licences.json | 12 +-
.../resources/server-detail-first-page.json | 96 +++
.../test/resources/server-detail-last-page.json | 34 ++
.../src/test/resources/servers-last-page.json | 20 +
cloudsigma2/src/test/resources/servers.json | 13 +-
.../resources/subscriptions-first-page.json | 47 ++
.../test/resources/subscriptions-last-page.json | 28 +
.../test/resources/tags-detail-first-page.json | 20 +
.../test/resources/tags-detail-last-page.json | 59 ++
.../src/test/resources/vlans-last-page.json | 21 +
cloudsigma2/src/test/resources/vlans.json | 14 +-
45 files changed, 2857 insertions(+), 265 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0bebb584/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/CloudSigma2Api.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/CloudSigma2Api.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/CloudSigma2Api.java
index 31eafa2..b594169 100644
--- a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/CloudSigma2Api.java
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/CloudSigma2Api.java
@@ -46,6 +46,7 @@ import org.jclouds.cloudsigma2.domain.IP;
import org.jclouds.cloudsigma2.domain.IPInfo;
import org.jclouds.cloudsigma2.domain.LibraryDrive;
import org.jclouds.cloudsigma2.domain.License;
+import org.jclouds.cloudsigma2.domain.PaginatedCollection;
import org.jclouds.cloudsigma2.domain.Pricing;
import org.jclouds.cloudsigma2.domain.ProfileInfo;
import org.jclouds.cloudsigma2.domain.Server;
@@ -55,14 +56,32 @@ import org.jclouds.cloudsigma2.domain.Subscription;
import org.jclouds.cloudsigma2.domain.Tag;
import org.jclouds.cloudsigma2.domain.Transaction;
import org.jclouds.cloudsigma2.domain.VLANInfo;
+import org.jclouds.cloudsigma2.functions.internal.ParseDiscounts;
+import org.jclouds.cloudsigma2.functions.internal.ParseDriveInfos;
+import org.jclouds.cloudsigma2.functions.internal.ParseDrives;
+import org.jclouds.cloudsigma2.functions.internal.ParseFirewallPolicies;
+import org.jclouds.cloudsigma2.functions.internal.ParseIPInfos;
+import org.jclouds.cloudsigma2.functions.internal.ParseIPs;
+import org.jclouds.cloudsigma2.functions.internal.ParseLibraryDrives;
+import org.jclouds.cloudsigma2.functions.internal.ParseLicenses;
+import org.jclouds.cloudsigma2.functions.internal.ParseServerInfos;
+import org.jclouds.cloudsigma2.functions.internal.ParseServers;
+import org.jclouds.cloudsigma2.functions.internal.ParseSubscriptions;
+import org.jclouds.cloudsigma2.functions.internal.ParseTags;
+import org.jclouds.cloudsigma2.functions.internal.ParseTransactions;
+import org.jclouds.cloudsigma2.functions.internal.ParseVLANs;
+import org.jclouds.cloudsigma2.options.PaginationOptions;
+import org.jclouds.collect.PagedIterable;
import org.jclouds.http.filters.BasicAuthentication;
import org.jclouds.javax.annotation.Nullable;
import org.jclouds.rest.annotations.BinderParam;
import org.jclouds.rest.annotations.Fallback;
import org.jclouds.rest.annotations.OnlyElement;
import org.jclouds.rest.annotations.RequestFilters;
+import org.jclouds.rest.annotations.ResponseParser;
import org.jclouds.rest.annotations.SelectJson;
import org.jclouds.rest.annotations.SkipEncoding;
+import org.jclouds.rest.annotations.Transform;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
@@ -94,9 +113,21 @@ public interface CloudSigma2Api extends Closeable {
*/
@Named("drive:listDrives")
@GET
- @Path("/drives/?limit=0")
- @SelectJson("objects")
- List<Drive> listDrives();
+ @Path("/drives/")
+ @ResponseParser(ParseDrives.class)
+ @Transform(ParseDrives.ToPagedIterable.class)
+ PagedIterable<Drive> listDrives();
+
+ /**
+ * Gets the list of drives to which the authenticated user has access.
+ *
+ * @return PaginatedCollection of drives
+ */
+ @Named("drive:listDrives")
+ @GET
+ @Path("/drives/")
+ @ResponseParser(ParseDrives.class)
+ PaginatedCollection<Drive> listDrives(PaginationOptions options);
/**
* Gets the list of drives to which the authenticated user has access.
@@ -107,7 +138,7 @@ public interface CloudSigma2Api extends Closeable {
*/
@Named("drive:listDrives")
@GET
- @Path("/drives/?limit=0")
+ @Path("/drives/")
@SelectJson("objects")
List<DriveInfo> listDrives(@QueryParam("fields") DrivesListRequestFieldsGroup fields
, @DefaultValue("0") @QueryParam("limit") int limit);
@@ -119,9 +150,21 @@ public interface CloudSigma2Api extends Closeable {
*/
@Named("drive:listDrivesInfo")
@GET
- @Path("/drives/detail/?limit=0")
- @SelectJson("objects")
- List<DriveInfo> listDrivesInfo();
+ @Path("/drives/detail/")
+ @ResponseParser(ParseDriveInfos.class)
+ @Transform(ParseDriveInfos.ToPagedIterable.class)
+ PagedIterable<DriveInfo> listDrivesInfo();
+
+ /**
+ * Gets the detailed list of drives with additional information to which the authenticated user has access.
+ *
+ * @return PaginatedCollection of drives
+ */
+ @Named("drive:listDrivesInfo")
+ @GET
+ @Path("/drives/detail/")
+ @ResponseParser(ParseDriveInfos.class)
+ PaginatedCollection<DriveInfo> listDrivesInfo(PaginationOptions options);
/**
* Gets detailed information for drive identified by drive uuid
@@ -220,9 +263,21 @@ public interface CloudSigma2Api extends Closeable {
*/
@Named("libdrive:listLibraryDrives")
@GET
- @Path("/libdrives/?limit=0")
- @SelectJson("objects")
- List<LibraryDrive> listLibraryDrives();
+ @Path("/libdrives/")
+ @ResponseParser(ParseLibraryDrives.class)
+ @Transform(ParseLibraryDrives.ToPagedIterable.class)
+ PagedIterable<LibraryDrive> listLibraryDrives();
+
+ /**
+ * Gets the list of library drives to which the authenticated user has access.
+ *
+ * @return PaginatedCollection of library drives
+ */
+ @Named("libdrive:listLibraryDrives")
+ @GET
+ @Path("/libdrives/")
+ @ResponseParser(ParseLibraryDrives.class)
+ PaginatedCollection<LibraryDrive> listLibraryDrives(PaginationOptions options);
/**
* Gets detailed information for library drive identified by uuid.
@@ -257,9 +312,21 @@ public interface CloudSigma2Api extends Closeable {
*/
@Named("server:listServers")
@GET
- @Path("/servers/?limit=0")
- @SelectJson("objects")
- List<Server> listServers();
+ @Path("/servers/")
+ @ResponseParser(ParseServers.class)
+ @Transform(ParseServers.ToPagedIterable.class)
+ PagedIterable<Server> listServers();
+
+ /**
+ * Gets the list of servers to which the authenticated user has access.
+ *
+ * @return PaginatedCollection of servers
+ */
+ @Named("server:listServers")
+ @GET
+ @Path("/servers/")
+ @ResponseParser(ParseServers.class)
+ PaginatedCollection<Server> listServers(PaginationOptions options);
/**
* Gets the detailed list of servers to which the authenticated user has access.
@@ -268,9 +335,21 @@ public interface CloudSigma2Api extends Closeable {
*/
@Named("server:listServersInfo")
@GET
- @Path("/servers/detail/?limit=0")
- @SelectJson("objects")
- List<ServerInfo> listServersInfo();
+ @Path("/servers/detail/")
+ @ResponseParser(ParseServerInfos.class)
+ @Transform(ParseServerInfos.ToPagedIterable.class)
+ PagedIterable<ServerInfo> listServersInfo();
+
+ /**
+ * Gets the detailed list of servers to which the authenticated user has access.
+ *
+ * @return PaginatedCollection of servers
+ */
+ @Named("server:listServersInfo")
+ @GET
+ @Path("/servers/detail/")
+ @ResponseParser(ParseServerInfos.class)
+ PaginatedCollection<ServerInfo> listServersInfo(PaginationOptions options);
/**
* Creates a new virtual server or multiple servers.
@@ -433,7 +512,7 @@ public interface CloudSigma2Api extends Closeable {
*/
@Named("server:listServerAvailabilityGroup")
@GET
- @Path("/servers/availability_groups/?limit=0")
+ @Path("/servers/availability_groups/")
List<List<String>> listServerAvailabilityGroup();
/**
@@ -456,9 +535,21 @@ public interface CloudSigma2Api extends Closeable {
*/
@Named("fwpolicy:listFirewallPolicies")
@GET
- @Path("/fwpolicies/?limit=0")
- @SelectJson("objects")
- List<FirewallPolicy> listFirewallPolicies();
+ @Path("/fwpolicies/")
+ @ResponseParser(ParseFirewallPolicies.class)
+ @Transform(ParseFirewallPolicies.ToPagedIterable.class)
+ PagedIterable<FirewallPolicy> listFirewallPolicies();
+
+ /**
+ * Gets the list of firewall policies to which the authenticated user has access.
+ *
+ * @return PaginatedCollection of firewall policies
+ */
+ @Named("fwpolicy:listFirewallPolicies")
+ @GET
+ @Path("/fwpolicies/")
+ @ResponseParser(ParseFirewallPolicies.class)
+ PaginatedCollection<FirewallPolicy> listFirewallPolicies(PaginationOptions options);
/**
* Gets a detailed list of firewall policies to which the authenticated user has access.
@@ -467,9 +558,21 @@ public interface CloudSigma2Api extends Closeable {
*/
@Named("fwpolicy:listFirewallPoliciesInfo")
@GET
- @Path("/fwpolicies/detail/?limit=0")
- @SelectJson("objects")
- List<FirewallPolicy> listFirewallPoliciesInfo();
+ @Path("/fwpolicies/detail/")
+ @ResponseParser(ParseFirewallPolicies.class)
+ @Transform(ParseFirewallPolicies.ToPagedIterableInfo.class)
+ PagedIterable<FirewallPolicy> listFirewallPoliciesInfo();
+
+ /**
+ * Gets a detailed list of firewall policies to which the authenticated user has access.
+ *
+ * @return PaginatedCollection of firewall policies
+ */
+ @Named("fwpolicy:listFirewallPoliciesInfo")
+ @GET
+ @Path("/fwpolicies/detail/")
+ @ResponseParser(ParseFirewallPolicies.class)
+ PaginatedCollection<FirewallPolicy> listFirewallPoliciesInfo(PaginationOptions options);
/**
* Creates firewall policies.
@@ -482,7 +585,7 @@ public interface CloudSigma2Api extends Closeable {
@Path("/fwpolicies/")
@SelectJson("objects")
List<FirewallPolicy> createFirewallPolicies(
- @BinderParam(BindFirewallPoliciesListToJsonRequest.class) List<FirewallPolicy> firewallPolicies);
+ @BinderParam(BindFirewallPoliciesListToJsonRequest.class) List< FirewallPolicy > firewallPolicies);
/**
* Creates a firewall policy.
@@ -530,9 +633,21 @@ public interface CloudSigma2Api extends Closeable {
*/
@Named("vlan:listVLANs")
@GET
- @Path("/vlans/?limit=0")
- @SelectJson("objects")
- List<VLANInfo> listVLANs();
+ @Path("/vlans/")
+ @ResponseParser(ParseVLANs.class)
+ @Transform(ParseVLANs.ToPagedIterable.class)
+ PagedIterable<VLANInfo> listVLANs();
+
+ /**
+ * Gets the list of VLANs to which the authenticated user has access.
+ *
+ * @return PaginatedCollection of VLANs
+ */
+ @Named("vlan:listVLANs")
+ @GET
+ @Path("/vlans/")
+ @ResponseParser(ParseVLANs.class)
+ PaginatedCollection<VLANInfo> listVLANs(PaginationOptions options);
/**
* Gets the list of VLANs to which the authenticated user has access.
@@ -541,9 +656,21 @@ public interface CloudSigma2Api extends Closeable {
*/
@Named("vlan:listVLANInfo")
@GET
- @Path("/vlans/detail/?limit=0")
- @SelectJson("objects")
- List<VLANInfo> listVLANInfo();
+ @Path("/vlans/detail/")
+ @ResponseParser(ParseVLANs.class)
+ @Transform(ParseVLANs.ToPagedIterableInfo.class)
+ PagedIterable<VLANInfo> listVLANInfo();
+
+ /**
+ * Gets the list of VLANs to which the authenticated user has access.
+ *
+ * @return PaginatedCollection of VLANs
+ */
+ @Named("vlan:listVLANInfo")
+ @GET
+ @Path("/vlans/detail/")
+ @ResponseParser(ParseVLANs.class)
+ PaginatedCollection<VLANInfo> listVLANInfo(PaginationOptions options);
/**
* Currently only VLAN meta field can be edited.
@@ -566,9 +693,21 @@ public interface CloudSigma2Api extends Closeable {
*/
@Named("ip:listIPs")
@GET
- @Path("/ips/?limit=0")
- @SelectJson("objects")
- List<IP> listIPs();
+ @Path("/ips/")
+ @ResponseParser(ParseIPs.class)
+ @Transform(ParseIPs.ToPagedIterable.class)
+ PagedIterable<IP> listIPs();
+
+ /**
+ * Gets the list of IPs to which the authenticated user has access.
+ *
+ * @return PaginatedCollection of IPs
+ */
+ @Named("ip:listIPs")
+ @GET
+ @Path("/ips/")
+ @ResponseParser(ParseIPs.class)
+ PaginatedCollection<IP> listIPs(PaginationOptions options);
/**
* Gets the detailed list of IPs with additional information to which the authenticated user has access.
@@ -577,9 +716,21 @@ public interface CloudSigma2Api extends Closeable {
*/
@Named("ip:listIPInfo")
@GET
- @Path("/ips/detail/?limit=0")
- @SelectJson("objects")
- List<IPInfo> listIPInfo();
+ @Path("/ips/detail/")
+ @ResponseParser(ParseIPInfos.class)
+ @Transform(ParseIPInfos.ToPagedIterable.class)
+ PagedIterable<IPInfo> listIPInfo();
+
+ /**
+ * Gets the detailed list of IPs with additional information to which the authenticated user has access.
+ *
+ * @return PaginatedCollection of IPs
+ */
+ @Named("ip:listIPInfo")
+ @GET
+ @Path("/ips/detail/")
+ @ResponseParser(ParseIPInfos.class)
+ PaginatedCollection<IPInfo> listIPInfo(PaginationOptions options);
/**
* Gets detailed information for IP identified by IP uuid.
@@ -614,9 +765,21 @@ public interface CloudSigma2Api extends Closeable {
*/
@Named("tag:listTags")
@GET
- @Path("/tags/?limit=0")
- @SelectJson("objects")
- List<Tag> listTags();
+ @Path("/tags/")
+ @ResponseParser(ParseTags.class)
+ @Transform(ParseTags.ToPagedIterable.class)
+ PagedIterable<Tag> listTags();
+
+ /**
+ * Gets the list of tags to which the authenticated user has access.
+ *
+ * @return PaginatedCollection of tags to which the authenticated user has access
+ */
+ @Named("tag:listTags")
+ @GET
+ @Path("/tags/")
+ @ResponseParser(ParseTags.class)
+ PaginatedCollection<Tag> listTags(PaginationOptions options);
/**
* Gets the detailed list of tags with additional information to which the authenticated user has access,
@@ -626,9 +789,22 @@ public interface CloudSigma2Api extends Closeable {
*/
@Named("tag:listTagsInfo")
@GET
- @Path("/tags/detail/?limit=0")
- @SelectJson("objects")
- List<Tag> listTagsInfo();
+ @Path("/tags/detail/")
+ @ResponseParser(ParseTags.class)
+ @Transform(ParseTags.ToPagedIterableInfo.class)
+ PagedIterable<Tag> listTagsInfo();
+
+ /**
+ * Gets the detailed list of tags with additional information to which the authenticated user has access,
+ * like the tagged resource
+ *
+ * @return PaginatedCollection of detailed tags
+ */
+ @Named("tag:listTagsInfo")
+ @GET
+ @Path("/tags/detail/")
+ @ResponseParser(ParseTags.class)
+ PaginatedCollection<Tag> listTagsInfo(PaginationOptions options);
/**
* Gets detailed information for tag identified by tag uuid.
@@ -740,9 +916,21 @@ public interface CloudSigma2Api extends Closeable {
*/
@Named("subscription:listSubscriptions")
@GET
- @Path("/subscriptions/?limit=0")
- @SelectJson("objects")
- List<Subscription> listSubscriptions();
+ @Path("/subscriptions/")
+ @ResponseParser(ParseSubscriptions.class)
+ @Transform(ParseSubscriptions.ToPagedIterable.class)
+ PagedIterable<Subscription> listSubscriptions();
+
+ /**
+ * Gets the list of subscriptions of the user.
+ *
+ * @return PaginatedCollection of subscriptions of the user.
+ */
+ @Named("subscription:listSubscriptions")
+ @GET
+ @Path("/subscriptions/")
+ @ResponseParser(ParseSubscriptions.class)
+ PaginatedCollection<Subscription> listSubscriptions(PaginationOptions options);
/**
* Returns requested subscription
@@ -762,9 +950,21 @@ public interface CloudSigma2Api extends Closeable {
*/
@Named("subscription:listSubscriptionsCalculator")
@GET
- @Path("/subscriptioncalculator/?limit=0")
- @SelectJson("objects")
- List<Subscription> listSubscriptionsCalculator();
+ @Path("/subscriptioncalculator/")
+ @ResponseParser(ParseSubscriptions.class)
+ @Transform(ParseSubscriptions.ToPagedIterableCalculator.class)
+ PagedIterable<Subscription> listSubscriptionsCalculator();
+
+ /**
+ * This is identical to the listSubscriptions(), except that subscriptions are not actually bought.
+ *
+ * @return PaginatedCollection of subscriptions that are not actually bought.
+ */
+ @Named("subscription:listSubscriptionsCalculator")
+ @GET
+ @Path("/subscriptioncalculator/")
+ @ResponseParser(ParseSubscriptions.class)
+ PaginatedCollection<Subscription> listSubscriptionsCalculator(PaginationOptions options);
/**
* Creates a new subscription.
@@ -849,9 +1049,21 @@ public interface CloudSigma2Api extends Closeable {
*/
@Named("discount:listDiscounts")
@GET
- @Path("/discount/?limit=0")
- @SelectJson("objects")
- List<Discount> listDiscounts();
+ @Path("/discount/")
+ @ResponseParser(ParseDiscounts.class)
+ @Transform(ParseDiscounts.ToPagedIterable.class)
+ PagedIterable<Discount> listDiscounts();
+
+ /**
+ * Get discount information.
+ *
+ * @return PaginatedCollection of discount information.
+ */
+ @Named("discount:listDiscounts")
+ @GET
+ @Path("/discount/")
+ @ResponseParser(ParseDiscounts.class)
+ PaginatedCollection<Discount> listDiscounts(PaginationOptions options);
/**
* Get the transactions for the account.
@@ -860,9 +1072,21 @@ public interface CloudSigma2Api extends Closeable {
*/
@Named("ledger:listTransactions")
@GET
- @Path("/ledger/?limit=0")
- @SelectJson("objects")
- List<Transaction> listTransactions();
+ @Path("/ledger/")
+ @ResponseParser(ParseTransactions.class)
+ @Transform(ParseTransactions.ToPagedIterable.class)
+ PagedIterable<Transaction> listTransactions();
+
+ /**
+ * Get the transactions for the account.
+ *
+ * @return PaginatedCollection of account's transactions.
+ */
+ @Named("ledger:listTransactions")
+ @GET
+ @Path("/ledger/")
+ @ResponseParser(ParseTransactions.class)
+ PaginatedCollection<Transaction> listTransactions(PaginationOptions options);
/**
* Get the licenses available on the cloud. The type of the license can be one of:
@@ -877,7 +1101,25 @@ public interface CloudSigma2Api extends Closeable {
*/
@Named("license:listLicenses")
@GET
- @Path("/licenses/?limit=0")
- @SelectJson("objects")
- List<License> listLicenses();
+ @Path("/licenses/")
+ @ResponseParser(ParseLicenses.class)
+ @Transform(ParseLicenses.ToPagedIterable.class)
+ PagedIterable<License> listLicenses();
+
+ /**
+ * Get the licenses available on the cloud. The type of the license can be one of:
+ * install - These licenses are billed per installation, regardless of whether it is attached to a running guests or not.
+ * instance - These licenses are billed per running instance of a guest. A license attached to a guest that’s stopped is not billed.
+ * stub - These licenses are billed per a metric specified by the customer (i.e. per number of users license)
+ *
+ * The user metric field specifies what attribute on the instance of the guest is used for determining the number of licenses.
+ * For example, “smp” will count one license for each CPU/core in the virtual machine.
+ *
+ * @return PaginatedCollection of licenses available on the cloud
+ */
+ @Named("license:listLicenses")
+ @GET
+ @Path("/licenses/")
+ @ResponseParser(ParseLicenses.class)
+ PaginatedCollection<License> listLicenses(PaginationOptions options);
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0bebb584/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/PaginatedCollection.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/PaginatedCollection.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/PaginatedCollection.java
new file mode 100644
index 0000000..ec4f718
--- /dev/null
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/PaginatedCollection.java
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.cloudsigma2.domain;
+
+import com.google.common.base.Optional;
+import org.jclouds.cloudsigma2.options.PaginationOptions;
+import org.jclouds.collect.IterableWithMarker;
+
+import java.util.Iterator;
+
+/**
+ * @author Vladimir Shevchenko
+ */
+public class PaginatedCollection<T> extends IterableWithMarker<T> {
+
+ private Iterable<T> objects;
+ private PaginationOptions paginationOptions;
+
+ public PaginatedCollection(Iterable<T> objects, PaginationOptions paginationOptions) {
+ this.objects = objects;
+ this.paginationOptions = paginationOptions;
+ }
+
+ @Override
+ public Optional<Object> nextMarker() {
+ if(paginationOptions.getLimit() == 0){
+ return Optional.absent();
+ }
+
+ if(paginationOptions.getTotalCount() - paginationOptions.getOffset() > paginationOptions.getLimit()){
+ return Optional.of((Object) new PaginationOptions.Builder()
+ .limit(paginationOptions.getLimit())
+ .offset(paginationOptions.getOffset() + paginationOptions.getLimit())
+ .build());
+ }
+
+ return Optional.absent();
+ }
+
+ @Override
+ public Iterator<T> iterator() {
+ return objects.iterator();
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0bebb584/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/internal/ParseDiscounts.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/internal/ParseDiscounts.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/internal/ParseDiscounts.java
new file mode 100644
index 0000000..8085563
--- /dev/null
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/internal/ParseDiscounts.java
@@ -0,0 +1,73 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.cloudsigma2.functions.internal;
+
+import com.google.common.base.Function;
+import com.google.inject.Inject;
+import com.google.inject.TypeLiteral;
+import org.jclouds.cloudsigma2.CloudSigma2Api;
+import org.jclouds.cloudsigma2.domain.Discount;
+import org.jclouds.cloudsigma2.domain.PaginatedCollection;
+import org.jclouds.cloudsigma2.options.PaginationOptions;
+import org.jclouds.collect.IterableWithMarker;
+import org.jclouds.collect.internal.ArgsToPagedIterable;
+import org.jclouds.http.functions.ParseJson;
+import org.jclouds.json.Json;
+
+import javax.inject.Singleton;
+import java.beans.ConstructorProperties;
+import java.util.List;
+
+/**
+ * @author Vladimir Shevchenko
+ */
+@Singleton
+public class ParseDiscounts extends ParseJson<ParseDiscounts.Discounts>{
+ static class Discounts extends PaginatedCollection<Discount> {
+
+ @ConstructorProperties({"objects", "meta"})
+ public Discounts(Iterable<Discount> objects, PaginationOptions paginationOptions) {
+ super(objects, paginationOptions);
+ }
+ }
+
+ @Inject
+ public ParseDiscounts(Json json) {
+ super(json, TypeLiteral.get(Discounts.class));
+ }
+
+ public static class ToPagedIterable extends ArgsToPagedIterable<Discount, ToPagedIterable> {
+
+ private CloudSigma2Api api;
+
+ @Inject
+ public ToPagedIterable(CloudSigma2Api api) {
+ this.api = api;
+ }
+
+ @Override
+ protected Function<Object, IterableWithMarker<Discount>> markerToNextForArgs(List<Object> args) {
+ return new Function<Object, IterableWithMarker<Discount>>() {
+ @Override
+ public IterableWithMarker<Discount> apply(Object input) {
+ PaginationOptions paginationOptions = PaginationOptions.class.cast(input);
+ return api.listDiscounts(paginationOptions);
+ }
+ };
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0bebb584/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/internal/ParseDriveInfos.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/internal/ParseDriveInfos.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/internal/ParseDriveInfos.java
new file mode 100644
index 0000000..791d78c
--- /dev/null
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/internal/ParseDriveInfos.java
@@ -0,0 +1,74 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.cloudsigma2.functions.internal;
+
+import com.google.common.base.Function;
+import com.google.inject.Inject;
+import com.google.inject.TypeLiteral;
+import org.jclouds.cloudsigma2.CloudSigma2Api;
+import org.jclouds.cloudsigma2.domain.DriveInfo;
+import org.jclouds.cloudsigma2.domain.PaginatedCollection;
+import org.jclouds.cloudsigma2.options.PaginationOptions;
+import org.jclouds.collect.IterableWithMarker;
+import org.jclouds.collect.internal.ArgsToPagedIterable;
+import org.jclouds.http.functions.ParseJson;
+import org.jclouds.json.Json;
+
+import javax.inject.Singleton;
+import java.beans.ConstructorProperties;
+import java.util.List;
+
+/**
+ * @author Vladimir Shevchenko
+ */
+@Singleton
+public class ParseDriveInfos extends ParseJson<ParseDriveInfos.DriveInfos> {
+
+ static class DriveInfos extends PaginatedCollection<DriveInfo>{
+
+ @ConstructorProperties({"objects", "meta"})
+ public DriveInfos(Iterable<DriveInfo> objects, PaginationOptions paginationOptions) {
+ super(objects, paginationOptions);
+ }
+ }
+
+ @Inject
+ public ParseDriveInfos(Json json) {
+ super(json, TypeLiteral.get(DriveInfos.class));
+ }
+
+ public static class ToPagedIterable extends ArgsToPagedIterable<DriveInfo, ToPagedIterable> {
+
+ private CloudSigma2Api api;
+
+ @Inject
+ public ToPagedIterable(CloudSigma2Api api) {
+ this.api = api;
+ }
+
+ @Override
+ protected Function<Object, IterableWithMarker<DriveInfo>> markerToNextForArgs(List<Object> args) {
+ return new Function<Object, IterableWithMarker<DriveInfo>>() {
+ @Override
+ public IterableWithMarker<DriveInfo> apply(Object input) {
+ PaginationOptions paginationOptions = PaginationOptions.class.cast(input);
+ return api.listDrivesInfo(paginationOptions);
+ }
+ };
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0bebb584/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/internal/ParseDrives.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/internal/ParseDrives.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/internal/ParseDrives.java
new file mode 100644
index 0000000..0338a84
--- /dev/null
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/internal/ParseDrives.java
@@ -0,0 +1,73 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.cloudsigma2.functions.internal;
+
+import com.google.common.base.Function;
+import com.google.inject.TypeLiteral;
+import org.jclouds.cloudsigma2.CloudSigma2Api;
+import org.jclouds.cloudsigma2.domain.Drive;
+import org.jclouds.cloudsigma2.domain.PaginatedCollection;
+import org.jclouds.cloudsigma2.options.PaginationOptions;
+import org.jclouds.collect.IterableWithMarker;
+import org.jclouds.collect.internal.ArgsToPagedIterable;
+import org.jclouds.http.functions.ParseJson;
+import org.jclouds.json.Json;
+
+import javax.inject.Inject;
+import javax.inject.Singleton;
+import java.beans.ConstructorProperties;
+import java.util.List;
+
+/**
+ * @author Vladimir Shevchenko
+ */
+@Singleton
+public class ParseDrives extends ParseJson<ParseDrives.Drives> {
+ static class Drives extends PaginatedCollection<Drive>{
+
+ @ConstructorProperties({"objects", "meta"})
+ public Drives(Iterable<Drive> objects, PaginationOptions paginationOptions) {
+ super(objects, paginationOptions);
+ }
+ }
+
+ @Inject
+ public ParseDrives(Json json) {
+ super(json, TypeLiteral.get(Drives.class));
+ }
+
+ public static class ToPagedIterable extends ArgsToPagedIterable<Drive, ToPagedIterable> {
+
+ private CloudSigma2Api api;
+
+ @Inject
+ public ToPagedIterable(CloudSigma2Api api) {
+ this.api = api;
+ }
+
+ @Override
+ protected Function<Object, IterableWithMarker<Drive>> markerToNextForArgs(List<Object> args) {
+ return new Function<Object, IterableWithMarker<Drive>>() {
+ @Override
+ public IterableWithMarker<Drive> apply(Object input) {
+ PaginationOptions paginationOptions = PaginationOptions.class.cast(input);
+ return api.listDrives(paginationOptions);
+ }
+ };
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0bebb584/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/internal/ParseFirewallPolicies.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/internal/ParseFirewallPolicies.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/internal/ParseFirewallPolicies.java
new file mode 100644
index 0000000..f4d50bd
--- /dev/null
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/internal/ParseFirewallPolicies.java
@@ -0,0 +1,94 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.cloudsigma2.functions.internal;
+
+import com.google.common.base.Function;
+import com.google.inject.TypeLiteral;
+import org.jclouds.cloudsigma2.CloudSigma2Api;
+import org.jclouds.cloudsigma2.domain.FirewallPolicy;
+import org.jclouds.cloudsigma2.domain.PaginatedCollection;
+import org.jclouds.cloudsigma2.options.PaginationOptions;
+import org.jclouds.collect.IterableWithMarker;
+import org.jclouds.collect.internal.ArgsToPagedIterable;
+import org.jclouds.http.functions.ParseJson;
+import org.jclouds.json.Json;
+
+import javax.inject.Inject;
+import javax.inject.Singleton;
+import java.beans.ConstructorProperties;
+import java.util.List;
+
+/**
+ * @author Vladimir Shevchenko
+ */
+@Singleton
+public class ParseFirewallPolicies extends ParseJson<ParseFirewallPolicies.FirewallPolicies>{
+ static class FirewallPolicies extends PaginatedCollection<FirewallPolicy>{
+
+ @ConstructorProperties({"objects", "meta"})
+ FirewallPolicies(Iterable<FirewallPolicy> objects, PaginationOptions paginationOptions) {
+ super(objects, paginationOptions);
+ }
+ }
+
+ @Inject
+ public ParseFirewallPolicies(Json json) {
+ super(json, TypeLiteral.get(FirewallPolicies.class));
+ }
+
+ public static class ToPagedIterable extends ArgsToPagedIterable<FirewallPolicy, ToPagedIterable> {
+
+ private CloudSigma2Api api;
+
+ @Inject
+ public ToPagedIterable(CloudSigma2Api api) {
+ this.api = api;
+ }
+
+ @Override
+ protected Function<Object, IterableWithMarker<FirewallPolicy>> markerToNextForArgs(List<Object> args) {
+ return new Function<Object, IterableWithMarker<FirewallPolicy>>() {
+ @Override
+ public IterableWithMarker<FirewallPolicy> apply(Object input) {
+ PaginationOptions paginationOptions = PaginationOptions.class.cast(input);
+ return api.listFirewallPolicies(paginationOptions);
+ }
+ };
+ }
+ }
+
+ public static class ToPagedIterableInfo extends ArgsToPagedIterable<FirewallPolicy, ToPagedIterable> {
+
+ private CloudSigma2Api api;
+
+ @Inject
+ public ToPagedIterableInfo(CloudSigma2Api api) {
+ this.api = api;
+ }
+
+ @Override
+ protected Function<Object, IterableWithMarker<FirewallPolicy>> markerToNextForArgs(List<Object> args) {
+ return new Function<Object, IterableWithMarker<FirewallPolicy>>() {
+ @Override
+ public IterableWithMarker<FirewallPolicy> apply(Object input) {
+ PaginationOptions paginationOptions = PaginationOptions.class.cast(input);
+ return api.listFirewallPoliciesInfo(paginationOptions);
+ }
+ };
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0bebb584/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/internal/ParseIPInfos.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/internal/ParseIPInfos.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/internal/ParseIPInfos.java
new file mode 100644
index 0000000..29f23c2
--- /dev/null
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/internal/ParseIPInfos.java
@@ -0,0 +1,73 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.cloudsigma2.functions.internal;
+
+import com.google.common.base.Function;
+import com.google.inject.Inject;
+import com.google.inject.Singleton;
+import com.google.inject.TypeLiteral;
+import org.jclouds.cloudsigma2.CloudSigma2Api;
+import org.jclouds.cloudsigma2.domain.IPInfo;
+import org.jclouds.cloudsigma2.domain.PaginatedCollection;
+import org.jclouds.cloudsigma2.options.PaginationOptions;
+import org.jclouds.collect.IterableWithMarker;
+import org.jclouds.collect.internal.ArgsToPagedIterable;
+import org.jclouds.http.functions.ParseJson;
+import org.jclouds.json.Json;
+
+import java.beans.ConstructorProperties;
+import java.util.List;
+
+/**
+ * @author Vladimir Shevchenko
+ */
+@Singleton
+public class ParseIPInfos extends ParseJson<ParseIPInfos.IPInfos>{
+ static class IPInfos extends PaginatedCollection<IPInfo> {
+
+ @ConstructorProperties({"objects", "meta"})
+ public IPInfos(Iterable<IPInfo> objects, PaginationOptions paginationOptions) {
+ super(objects, paginationOptions);
+ }
+ }
+
+ @Inject
+ public ParseIPInfos(Json json) {
+ super(json, TypeLiteral.get(IPInfos.class));
+ }
+
+ public static class ToPagedIterable extends ArgsToPagedIterable<IPInfo, ToPagedIterable> {
+
+ private CloudSigma2Api api;
+
+ @Inject
+ public ToPagedIterable(CloudSigma2Api api) {
+ this.api = api;
+ }
+
+ @Override
+ protected Function<Object, IterableWithMarker<IPInfo>> markerToNextForArgs(List<Object> args) {
+ return new Function<Object, IterableWithMarker<IPInfo>>() {
+ @Override
+ public IterableWithMarker<IPInfo> apply(Object input) {
+ PaginationOptions paginationOptions = PaginationOptions.class.cast(input);
+ return api.listIPInfo(paginationOptions);
+ }
+ };
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0bebb584/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/internal/ParseIPs.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/internal/ParseIPs.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/internal/ParseIPs.java
new file mode 100644
index 0000000..d8bf6b9
--- /dev/null
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/internal/ParseIPs.java
@@ -0,0 +1,73 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.cloudsigma2.functions.internal;
+
+import com.google.common.base.Function;
+import com.google.inject.Inject;
+import com.google.inject.TypeLiteral;
+import org.jclouds.cloudsigma2.CloudSigma2Api;
+import org.jclouds.cloudsigma2.domain.IP;
+import org.jclouds.cloudsigma2.domain.PaginatedCollection;
+import org.jclouds.cloudsigma2.options.PaginationOptions;
+import org.jclouds.collect.IterableWithMarker;
+import org.jclouds.collect.internal.ArgsToPagedIterable;
+import org.jclouds.http.functions.ParseJson;
+import org.jclouds.json.Json;
+
+import javax.inject.Singleton;
+import java.beans.ConstructorProperties;
+import java.util.List;
+
+/**
+ * @author Vladimir Shevchenko
+ */
+@Singleton
+public class ParseIPs extends ParseJson<ParseIPs.IPs> {
+ static class IPs extends PaginatedCollection<IP> {
+
+ @ConstructorProperties({"objects", "meta"})
+ public IPs(Iterable<IP> objects, PaginationOptions paginationOptions) {
+ super(objects, paginationOptions);
+ }
+ }
+
+ @Inject
+ public ParseIPs(Json json) {
+ super(json, TypeLiteral.get(IPs.class));
+ }
+
+ public static class ToPagedIterable extends ArgsToPagedIterable<IP, ToPagedIterable> {
+
+ private CloudSigma2Api api;
+
+ @Inject
+ public ToPagedIterable(CloudSigma2Api api) {
+ this.api = api;
+ }
+
+ @Override
+ protected Function<Object, IterableWithMarker<IP>> markerToNextForArgs(List<Object> args) {
+ return new Function<Object, IterableWithMarker<IP>>() {
+ @Override
+ public IterableWithMarker<IP> apply(Object input) {
+ PaginationOptions paginationOptions = PaginationOptions.class.cast(input);
+ return api.listIPs(paginationOptions);
+ }
+ };
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0bebb584/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/internal/ParseLibraryDrives.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/internal/ParseLibraryDrives.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/internal/ParseLibraryDrives.java
new file mode 100644
index 0000000..457e855
--- /dev/null
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/internal/ParseLibraryDrives.java
@@ -0,0 +1,73 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.cloudsigma2.functions.internal;
+
+import com.google.common.base.Function;
+import com.google.inject.Inject;
+import com.google.inject.TypeLiteral;
+import org.jclouds.cloudsigma2.CloudSigma2Api;
+import org.jclouds.cloudsigma2.domain.LibraryDrive;
+import org.jclouds.cloudsigma2.domain.PaginatedCollection;
+import org.jclouds.cloudsigma2.options.PaginationOptions;
+import org.jclouds.collect.IterableWithMarker;
+import org.jclouds.collect.internal.ArgsToPagedIterable;
+import org.jclouds.http.functions.ParseJson;
+import org.jclouds.json.Json;
+
+import javax.inject.Singleton;
+import java.beans.ConstructorProperties;
+import java.util.List;
+
+/**
+ * @author Vladimir Shevchenko
+ */
+@Singleton
+public class ParseLibraryDrives extends ParseJson<ParseLibraryDrives.LibraryDrives> {
+ static class LibraryDrives extends PaginatedCollection<LibraryDrive>{
+
+ @ConstructorProperties({"objects", "meta"})
+ public LibraryDrives(Iterable<LibraryDrive> objects, PaginationOptions paginationOptions) {
+ super(objects, paginationOptions);
+ }
+ }
+
+ @Inject
+ public ParseLibraryDrives(Json json) {
+ super(json, TypeLiteral.get(LibraryDrives.class));
+ }
+
+ public static class ToPagedIterable extends ArgsToPagedIterable<LibraryDrive, ToPagedIterable> {
+
+ private CloudSigma2Api api;
+
+ @Inject
+ public ToPagedIterable(CloudSigma2Api api) {
+ this.api = api;
+ }
+
+ @Override
+ protected Function<Object, IterableWithMarker<LibraryDrive>> markerToNextForArgs(List<Object> args) {
+ return new Function<Object, IterableWithMarker<LibraryDrive>>() {
+ @Override
+ public IterableWithMarker<LibraryDrive> apply(Object input) {
+ PaginationOptions paginationOptions = PaginationOptions.class.cast(input);
+ return api.listLibraryDrives(paginationOptions);
+ }
+ };
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0bebb584/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/internal/ParseLicenses.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/internal/ParseLicenses.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/internal/ParseLicenses.java
new file mode 100644
index 0000000..0b9b6c6
--- /dev/null
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/internal/ParseLicenses.java
@@ -0,0 +1,73 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.cloudsigma2.functions.internal;
+
+import com.google.common.base.Function;
+import com.google.inject.Inject;
+import com.google.inject.TypeLiteral;
+import org.jclouds.cloudsigma2.CloudSigma2Api;
+import org.jclouds.cloudsigma2.domain.License;
+import org.jclouds.cloudsigma2.domain.PaginatedCollection;
+import org.jclouds.cloudsigma2.options.PaginationOptions;
+import org.jclouds.collect.IterableWithMarker;
+import org.jclouds.collect.internal.ArgsToPagedIterable;
+import org.jclouds.http.functions.ParseJson;
+import org.jclouds.json.Json;
+
+import javax.inject.Singleton;
+import java.beans.ConstructorProperties;
+import java.util.List;
+
+/**
+ * @author Vladimir Shevchenko
+ */
+@Singleton
+public class ParseLicenses extends ParseJson<ParseLicenses.Licenses> {
+ static class Licenses extends PaginatedCollection<License> {
+
+ @ConstructorProperties({"objects", "meta"})
+ public Licenses(Iterable<License> objects, PaginationOptions meta) {
+ super(objects, meta);
+ }
+ }
+
+ @Inject
+ public ParseLicenses(Json json) {
+ super(json, TypeLiteral.get(Licenses.class));
+ }
+
+ public static class ToPagedIterable extends ArgsToPagedIterable<License, ToPagedIterable> {
+
+ private CloudSigma2Api api;
+
+ @Inject
+ public ToPagedIterable(CloudSigma2Api api) {
+ this.api = api;
+ }
+
+ @Override
+ protected Function<Object, IterableWithMarker<License>> markerToNextForArgs(List<Object> args) {
+ return new Function<Object, IterableWithMarker<License>>() {
+ @Override
+ public IterableWithMarker<License> apply(Object input) {
+ PaginationOptions paginationOptions = PaginationOptions.class.cast(input);
+ return api.listLicenses(paginationOptions);
+ }
+ };
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0bebb584/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/internal/ParseServerInfos.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/internal/ParseServerInfos.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/internal/ParseServerInfos.java
new file mode 100644
index 0000000..7dca37c
--- /dev/null
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/internal/ParseServerInfos.java
@@ -0,0 +1,74 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.cloudsigma2.functions.internal;
+
+import com.google.common.base.Function;
+import com.google.inject.Inject;
+import com.google.inject.TypeLiteral;
+import org.jclouds.cloudsigma2.CloudSigma2Api;
+import org.jclouds.cloudsigma2.domain.PaginatedCollection;
+import org.jclouds.cloudsigma2.domain.ServerInfo;
+import org.jclouds.cloudsigma2.options.PaginationOptions;
+import org.jclouds.collect.IterableWithMarker;
+import org.jclouds.collect.internal.ArgsToPagedIterable;
+import org.jclouds.http.functions.ParseJson;
+import org.jclouds.json.Json;
+
+import javax.inject.Singleton;
+import java.beans.ConstructorProperties;
+import java.util.List;
+
+/**
+ * @author Vladimir Shevchenko
+ */
+@Singleton
+public class ParseServerInfos extends ParseJson<ParseServerInfos.ServerInfos> {
+
+ static class ServerInfos extends PaginatedCollection<ServerInfo> {
+
+ @ConstructorProperties({"objects", "meta"})
+ public ServerInfos(Iterable<ServerInfo> objects, PaginationOptions paginationOptions) {
+ super(objects, paginationOptions);
+ }
+ }
+
+ @Inject
+ public ParseServerInfos(Json json) {
+ super(json, TypeLiteral.get(ServerInfos.class));
+ }
+
+ public static class ToPagedIterable extends ArgsToPagedIterable<ServerInfo, ToPagedIterable> {
+
+ private CloudSigma2Api api;
+
+ @Inject
+ public ToPagedIterable(CloudSigma2Api api) {
+ this.api = api;
+ }
+
+ @Override
+ protected Function<Object, IterableWithMarker<ServerInfo>> markerToNextForArgs(List<Object> args) {
+ return new Function<Object, IterableWithMarker<ServerInfo>>() {
+ @Override
+ public IterableWithMarker<ServerInfo> apply(Object input) {
+ PaginationOptions paginationOptions = PaginationOptions.class.cast(input);
+ return api.listServersInfo(paginationOptions);
+ }
+ };
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0bebb584/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/internal/ParseServers.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/internal/ParseServers.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/internal/ParseServers.java
new file mode 100644
index 0000000..4de20fa
--- /dev/null
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/internal/ParseServers.java
@@ -0,0 +1,74 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.cloudsigma2.functions.internal;
+
+import com.google.common.base.Function;
+import com.google.inject.Inject;
+import com.google.inject.TypeLiteral;
+import org.jclouds.cloudsigma2.CloudSigma2Api;
+import org.jclouds.cloudsigma2.domain.PaginatedCollection;
+import org.jclouds.cloudsigma2.domain.Server;
+import org.jclouds.cloudsigma2.options.PaginationOptions;
+import org.jclouds.collect.IterableWithMarker;
+import org.jclouds.collect.internal.ArgsToPagedIterable;
+import org.jclouds.http.functions.ParseJson;
+import org.jclouds.json.Json;
+
+import javax.inject.Singleton;
+import java.beans.ConstructorProperties;
+import java.util.List;
+
+/**
+ * @author Vladimir Shevchenko
+ */
+@Singleton
+public class ParseServers extends ParseJson<ParseServers.Servers> {
+
+ static class Servers extends PaginatedCollection<Server>{
+
+ @ConstructorProperties({"objects", "meta"})
+ public Servers(Iterable<Server> objects, PaginationOptions paginationOptions) {
+ super(objects, paginationOptions);
+ }
+ }
+
+ @Inject
+ public ParseServers(Json json) {
+ super(json, TypeLiteral.get(Servers.class));
+ }
+
+ public static class ToPagedIterable extends ArgsToPagedIterable<Server, ToPagedIterable> {
+
+ private CloudSigma2Api api;
+
+ @Inject
+ public ToPagedIterable(CloudSigma2Api api) {
+ this.api = api;
+ }
+
+ @Override
+ protected Function<Object, IterableWithMarker<Server>> markerToNextForArgs(List<Object> args) {
+ return new Function<Object, IterableWithMarker<Server>>() {
+ @Override
+ public IterableWithMarker<Server> apply(Object input) {
+ PaginationOptions paginationOptions = PaginationOptions.class.cast(input);
+ return api.listServers(paginationOptions);
+ }
+ };
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0bebb584/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/internal/ParseSubscriptions.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/internal/ParseSubscriptions.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/internal/ParseSubscriptions.java
new file mode 100644
index 0000000..c8d4895
--- /dev/null
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/internal/ParseSubscriptions.java
@@ -0,0 +1,95 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.cloudsigma2.functions.internal;
+
+import com.google.common.base.Function;
+import com.google.inject.Inject;
+import com.google.inject.TypeLiteral;
+import org.jclouds.cloudsigma2.CloudSigma2Api;
+import org.jclouds.cloudsigma2.domain.PaginatedCollection;
+import org.jclouds.cloudsigma2.domain.Subscription;
+import org.jclouds.cloudsigma2.options.PaginationOptions;
+import org.jclouds.collect.IterableWithMarker;
+import org.jclouds.collect.internal.ArgsToPagedIterable;
+import org.jclouds.http.functions.ParseJson;
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.json.Json;
+
+import javax.inject.Singleton;
+import java.beans.ConstructorProperties;
+import java.util.List;
+
+/**
+ * @author Vladimir Shevchenko
+ */
+@Singleton
+public class ParseSubscriptions extends ParseJson<ParseSubscriptions.Subscriptions>{
+ static class Subscriptions extends PaginatedCollection<Subscription> {
+
+ @ConstructorProperties({"objects", "meta"})
+ public Subscriptions(Iterable<Subscription> objects, PaginationOptions paginationOptions) {
+ super(objects, paginationOptions);
+ }
+ }
+
+ @Inject
+ public ParseSubscriptions(Json json) {
+ super(json, TypeLiteral.get(Subscriptions.class));
+ }
+
+ public static class ToPagedIterable extends ArgsToPagedIterable<Subscription, ToPagedIterable> {
+
+ private CloudSigma2Api api;
+
+ @Inject
+ public ToPagedIterable(CloudSigma2Api api) {
+ this.api = api;
+ }
+
+ @Override
+ protected Function<Object, IterableWithMarker<Subscription>> markerToNextForArgs(List<Object> args) {
+ return new Function<Object, IterableWithMarker<Subscription>>() {
+ @Override
+ public IterableWithMarker<Subscription> apply(Object input) {
+ PaginationOptions paginationOptions = PaginationOptions.class.cast(input);
+ return api.listSubscriptions(paginationOptions);
+ }
+ };
+ }
+ }
+
+ public static class ToPagedIterableCalculator extends ArgsToPagedIterable<Subscription, ToPagedIterable> {
+
+ private CloudSigma2Api api;
+
+ @Inject
+ public ToPagedIterableCalculator(CloudSigma2Api api) {
+ this.api = api;
+ }
+
+ @Override
+ protected Function<Object, IterableWithMarker<Subscription>> markerToNextForArgs(List<Object> args) {
+ return new Function<Object, IterableWithMarker<Subscription>>() {
+ @Override
+ public IterableWithMarker<Subscription> apply(@Nullable Object input) {
+ PaginationOptions paginationOptions = PaginationOptions.class.cast(input);
+ return api.listSubscriptionsCalculator(paginationOptions);
+ }
+ };
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0bebb584/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/internal/ParseTags.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/internal/ParseTags.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/internal/ParseTags.java
new file mode 100644
index 0000000..5757fa1
--- /dev/null
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/internal/ParseTags.java
@@ -0,0 +1,94 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.cloudsigma2.functions.internal;
+
+import com.google.common.base.Function;
+import com.google.inject.Inject;
+import com.google.inject.TypeLiteral;
+import org.jclouds.cloudsigma2.CloudSigma2Api;
+import org.jclouds.cloudsigma2.domain.PaginatedCollection;
+import org.jclouds.cloudsigma2.domain.Tag;
+import org.jclouds.cloudsigma2.options.PaginationOptions;
+import org.jclouds.collect.IterableWithMarker;
+import org.jclouds.collect.internal.ArgsToPagedIterable;
+import org.jclouds.http.functions.ParseJson;
+import org.jclouds.json.Json;
+
+import javax.inject.Singleton;
+import java.beans.ConstructorProperties;
+import java.util.List;
+
+/**
+ * @author Vladimir Shevchenko
+ */
+@Singleton
+public class ParseTags extends ParseJson<ParseTags.Tags> {
+ static class Tags extends PaginatedCollection<Tag> {
+
+ @ConstructorProperties({"objects", "meta"})
+ public Tags(Iterable<Tag> objects, PaginationOptions paginationOptions) {
+ super(objects, paginationOptions);
+ }
+ }
+
+ @Inject
+ public ParseTags(Json json) {
+ super(json, TypeLiteral.get(Tags.class));
+ }
+
+ public static class ToPagedIterable extends ArgsToPagedIterable<Tag, ToPagedIterable> {
+
+ private CloudSigma2Api api;
+
+ @Inject
+ public ToPagedIterable(CloudSigma2Api api) {
+ this.api = api;
+ }
+
+ @Override
+ protected Function<Object, IterableWithMarker<Tag>> markerToNextForArgs(List<Object> args) {
+ return new Function<Object, IterableWithMarker<Tag>>() {
+ @Override
+ public IterableWithMarker<Tag> apply(Object input) {
+ PaginationOptions paginationOptions = PaginationOptions.class.cast(input);
+ return api.listTags(paginationOptions);
+ }
+ };
+ }
+ }
+
+ public static class ToPagedIterableInfo extends ArgsToPagedIterable<Tag, ToPagedIterable> {
+
+ private CloudSigma2Api api;
+
+ @Inject
+ public ToPagedIterableInfo(CloudSigma2Api api) {
+ this.api = api;
+ }
+
+ @Override
+ protected Function<Object, IterableWithMarker<Tag>> markerToNextForArgs(List<Object> args) {
+ return new Function<Object, IterableWithMarker<Tag>>() {
+ @Override
+ public IterableWithMarker<Tag> apply(Object input) {
+ PaginationOptions paginationOptions = PaginationOptions.class.cast(input);
+ return api.listTagsInfo(paginationOptions);
+ }
+ };
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0bebb584/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/internal/ParseTransactions.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/internal/ParseTransactions.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/internal/ParseTransactions.java
new file mode 100644
index 0000000..4d51701
--- /dev/null
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/internal/ParseTransactions.java
@@ -0,0 +1,73 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.cloudsigma2.functions.internal;
+
+import com.google.common.base.Function;
+import com.google.inject.Inject;
+import com.google.inject.TypeLiteral;
+import org.jclouds.cloudsigma2.CloudSigma2Api;
+import org.jclouds.cloudsigma2.domain.PaginatedCollection;
+import org.jclouds.cloudsigma2.domain.Transaction;
+import org.jclouds.cloudsigma2.options.PaginationOptions;
+import org.jclouds.collect.IterableWithMarker;
+import org.jclouds.collect.internal.ArgsToPagedIterable;
+import org.jclouds.http.functions.ParseJson;
+import org.jclouds.json.Json;
+
+import javax.inject.Singleton;
+import java.beans.ConstructorProperties;
+import java.util.List;
+
+/**
+ * @author Vladimir Shevchenko
+ */
+@Singleton
+public class ParseTransactions extends ParseJson<ParseTransactions.Transactions> {
+ static class Transactions extends PaginatedCollection<Transaction> {
+
+ @ConstructorProperties({"objects", "meta"})
+ public Transactions(Iterable<Transaction> objects, PaginationOptions paginationOptions) {
+ super(objects, paginationOptions);
+ }
+ }
+
+ @Inject
+ public ParseTransactions(Json json) {
+ super(json, TypeLiteral.get(Transactions.class));
+ }
+
+ public static class ToPagedIterable extends ArgsToPagedIterable<Transaction, ToPagedIterable> {
+
+ private CloudSigma2Api api;
+
+ @Inject
+ public ToPagedIterable(CloudSigma2Api api) {
+ this.api = api;
+ }
+
+ @Override
+ protected Function<Object, IterableWithMarker<Transaction>> markerToNextForArgs(List<Object> args) {
+ return new Function<Object, IterableWithMarker<Transaction>>() {
+ @Override
+ public IterableWithMarker<Transaction> apply(Object input) {
+ PaginationOptions paginationOptions = PaginationOptions.class.cast(input);
+ return api.listTransactions(paginationOptions);
+ }
+ };
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0bebb584/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/internal/ParseVLANs.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/internal/ParseVLANs.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/internal/ParseVLANs.java
new file mode 100644
index 0000000..c04d22c
--- /dev/null
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/internal/ParseVLANs.java
@@ -0,0 +1,94 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.cloudsigma2.functions.internal;
+
+import com.google.common.base.Function;
+import com.google.inject.TypeLiteral;
+import org.jclouds.cloudsigma2.CloudSigma2Api;
+import org.jclouds.cloudsigma2.domain.PaginatedCollection;
+import org.jclouds.cloudsigma2.domain.VLANInfo;
+import org.jclouds.cloudsigma2.options.PaginationOptions;
+import org.jclouds.collect.IterableWithMarker;
+import org.jclouds.collect.internal.ArgsToPagedIterable;
+import org.jclouds.http.functions.ParseJson;
+import org.jclouds.json.Json;
+
+import javax.inject.Inject;
+import javax.inject.Singleton;
+import java.beans.ConstructorProperties;
+import java.util.List;
+
+/**
+ * @author Vladimir Shevchenko
+ */
+@Singleton
+public class ParseVLANs extends ParseJson<ParseVLANs.VLANs> {
+ static class VLANs extends PaginatedCollection<VLANInfo> {
+
+ @ConstructorProperties({"objects", "meta"})
+ public VLANs(Iterable<VLANInfo> objects, PaginationOptions paginationOptions) {
+ super(objects, paginationOptions);
+ }
+ }
+
+ @Inject
+ public ParseVLANs(Json json) {
+ super(json, TypeLiteral.get(VLANs.class));
+ }
+
+ public static class ToPagedIterable extends ArgsToPagedIterable<VLANInfo, ToPagedIterable> {
+
+ private CloudSigma2Api api;
+
+ @Inject
+ public ToPagedIterable(CloudSigma2Api api) {
+ this.api = api;
+ }
+
+ @Override
+ protected Function<Object, IterableWithMarker<VLANInfo>> markerToNextForArgs(List<Object> args) {
+ return new Function<Object, IterableWithMarker<VLANInfo>>() {
+ @Override
+ public IterableWithMarker<VLANInfo> apply(Object input) {
+ PaginationOptions paginationOptions = PaginationOptions.class.cast(input);
+ return api.listVLANs(paginationOptions);
+ }
+ };
+ }
+ }
+
+ public static class ToPagedIterableInfo extends ArgsToPagedIterable<VLANInfo, ToPagedIterable> {
+
+ private CloudSigma2Api api;
+
+ @Inject
+ public ToPagedIterableInfo(CloudSigma2Api api) {
+ this.api = api;
+ }
+
+ @Override
+ protected Function<Object, IterableWithMarker<VLANInfo>> markerToNextForArgs(List<Object> args) {
+ return new Function<Object, IterableWithMarker<VLANInfo>>() {
+ @Override
+ public IterableWithMarker<VLANInfo> apply(Object input) {
+ PaginationOptions paginationOptions = PaginationOptions.class.cast(input);
+ return api.listVLANInfo(paginationOptions);
+ }
+ };
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0bebb584/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/options/PaginationOptions.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/options/PaginationOptions.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/options/PaginationOptions.java
new file mode 100644
index 0000000..13e4463
--- /dev/null
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/options/PaginationOptions.java
@@ -0,0 +1,117 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.cloudsigma2.options;
+
+import org.jclouds.http.options.BaseHttpRequestOptions;
+
+import javax.inject.Named;
+import java.beans.ConstructorProperties;
+
+/**
+ * @author Vladimir Shevchenko
+ */
+public class PaginationOptions extends BaseHttpRequestOptions {
+
+ public static class Builder{
+ private int limit = PaginationOptions.DEFAULT_LIMIT;
+ private int offset = 0;
+
+ public Builder limit(int limit){
+ this.limit = limit;
+ return this;
+ }
+
+ public Builder offset(int offset){
+ this.offset = offset;
+ return this;
+ }
+
+ public PaginationOptions build() {
+ if (limit < 0) {
+ limit = PaginationOptions.DEFAULT_LIMIT;
+ }
+
+ if (offset < 0) {
+ offset = 0;
+ }
+
+ PaginationOptions paginationOptions = new PaginationOptions(limit, offset, 0);
+ paginationOptions.queryParameters.put("limit", String.valueOf(limit));
+ paginationOptions.queryParameters.put("offset", String.valueOf(offset));
+ return paginationOptions;
+ }
+ }
+
+ public static final int DEFAULT_LIMIT = 20;
+
+ private final int limit;
+ private final int offset;
+ @Named("total_count")
+ private final int totalCount;
+
+ @ConstructorProperties({"limit", "offset", "total_count"})
+ public PaginationOptions(int limit, int offset, int totalCount) {
+ this.limit = limit;
+ this.offset = offset;
+ this.totalCount = totalCount;
+ }
+
+ public int getTotalCount() {
+ return totalCount;
+ }
+
+ public int getOffset() {
+ return offset;
+ }
+
+ public int getLimit() {
+ return limit;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (!(o instanceof PaginationOptions)) return false;
+ if (!super.equals(o)) return false;
+
+ PaginationOptions that = (PaginationOptions) o;
+
+ if (limit != that.limit) return false;
+ if (offset != that.offset) return false;
+ if (totalCount != that.totalCount) return false;
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = super.hashCode();
+ result = 31 * result + limit;
+ result = 31 * result + offset;
+ result = 31 * result + totalCount;
+ return result;
+ }
+
+ @Override
+ public String toString() {
+ return "PaginationOptions{" +
+ "limit=" + limit +
+ ", offset=" + offset +
+ ", totalCount=" + totalCount +
+ "} " + super.toString();
+ }
+}
[12/13] JCLOUDS-291: Add pagination support to the cloudsigma2
provider.
Posted by na...@apache.org.
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0bebb584/cloudsigma2/src/test/java/org/jclouds/cloudsigma2/CloudSigma2ApiExpectTest.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/test/java/org/jclouds/cloudsigma2/CloudSigma2ApiExpectTest.java b/cloudsigma2/src/test/java/org/jclouds/cloudsigma2/CloudSigma2ApiExpectTest.java
index 857ac73..3d3b12a 100644
--- a/cloudsigma2/src/test/java/org/jclouds/cloudsigma2/CloudSigma2ApiExpectTest.java
+++ b/cloudsigma2/src/test/java/org/jclouds/cloudsigma2/CloudSigma2ApiExpectTest.java
@@ -42,10 +42,12 @@ import org.jclouds.cloudsigma2.domain.Tag;
import org.jclouds.cloudsigma2.domain.TagResource;
import org.jclouds.cloudsigma2.domain.Transaction;
import org.jclouds.cloudsigma2.domain.VLANInfo;
+import org.jclouds.cloudsigma2.options.PaginationOptions;
import org.jclouds.date.internal.SimpleDateFormatDateService;
import org.jclouds.http.HttpRequest;
import org.jclouds.http.HttpResponse;
import org.jclouds.rest.internal.BaseRestApiExpectTest;
+import org.testng.Assert;
import org.testng.annotations.Test;
import javax.ws.rs.core.MediaType;
@@ -105,30 +107,84 @@ public class CloudSigma2ApiExpectTest extends BaseRestApiExpectTest<CloudSigma2A
@Test
public void testListDrives() throws Exception {
+ CloudSigma2Api api = requestsSendResponses(
+ getBuilder()
+ .endpoint(endpoint + "drives/")
+ .build()
+ , responseBuilder()
+ .payload(payloadFromResourceWithContentType("/drives.json", MediaType.APPLICATION_JSON))
+ .build()
+ , getBuilder()
+ .endpoint(endpoint + "drives/")
+ .addQueryParam("limit", "2")
+ .addQueryParam("offset", "2")
+ .build()
+ , responseBuilder()
+ .payload(payloadFromResourceWithContentType("/drives-last-page.json", MediaType.APPLICATION_JSON))
+ .build());
+
+ List<Drive> drives = api.listDrives().concat().toList();
+
+ Assert.assertEquals(drives.size(), 3);
+ Assert.assertEquals(drives.get(0).getUuid(), "92ca1450-417e-4cc1-983b-1015777e2591");
+ Assert.assertEquals(drives.get(1).getUuid(), "414ad24b-ba41-47c0-9751-ef5060b6c391");
+ Assert.assertEquals(drives.get(2).getUuid(), "7bc04bc5-bd09-4269-b45d-16b58d6f71b4");
+ }
+
+ @Test
+ public void testListDrivesPaginatedCollection() throws Exception {
CloudSigma2Api api = requestSendsResponse(
getBuilder()
- .endpoint(endpoint + "drives/?limit=0")
+ .endpoint(endpoint + "drives/?limit=3&offset=3")
.build()
, responseBuilder()
.payload(payloadFromResourceWithContentType("/drives.json", MediaType.APPLICATION_JSON))
.build());
- List<Drive> result = api.listDrives();
- assertNotNull(result);
+ for(Drive drive : api.listDrives(new PaginationOptions.Builder().limit(3).offset(3).build())){
+ assertNotNull(drive);
+ }
}
@Test
public void testListDrivesInfo() throws Exception {
+ CloudSigma2Api api = requestsSendResponses(
+ getBuilder()
+ .endpoint(endpoint + "drives/detail/")
+ .build()
+ , responseBuilder()
+ .payload(payloadFromResourceWithContentType("/drives-detail-first-page.json", MediaType.APPLICATION_JSON))
+ .build()
+ , getBuilder()
+ .endpoint(endpoint + "drives/detail/")
+ .addQueryParam("limit", "2")
+ .addQueryParam("offset", "2")
+ .build()
+ , responseBuilder()
+ .payload(payloadFromResourceWithContentType("/drives-detail-last-page.json", MediaType.APPLICATION_JSON))
+ .build());
+
+ List<DriveInfo> drives = api.listDrivesInfo().concat().toList();
+
+ Assert.assertEquals(drives.size(), 3);
+ Assert.assertEquals(drives.get(0).getUuid(), "92ca1450-417e-4cc1-983b-1015777e2591");
+ Assert.assertEquals(drives.get(1).getUuid(), "414ad24b-ba41-47c0-9751-ef5060b6c391");
+ Assert.assertEquals(drives.get(2).getUuid(), "7bc04bc5-bd09-4269-b45d-16b58d6f71b4");
+ }
+
+ @Test
+ public void testListDrivesInfoPaginatedCollection() throws Exception {
CloudSigma2Api api = requestSendsResponse(
getBuilder()
- .endpoint(endpoint + "drives/detail/?limit=0")
+ .endpoint(endpoint + "drives/detail/?limit=3&offset=3")
.build()
, responseBuilder()
.payload(payloadFromResourceWithContentType("/drives-detail.json", MediaType.APPLICATION_JSON))
.build());
- List<DriveInfo> result = api.listDrivesInfo();
- assertNotNull(result);
+ for(DriveInfo driveInfo : api.listDrivesInfo(new PaginationOptions.Builder().limit(3).offset(3).build())){
+ assertNotNull(driveInfo);
+ }
}
@Test
@@ -275,16 +331,46 @@ public class CloudSigma2ApiExpectTest extends BaseRestApiExpectTest<CloudSigma2A
@Test
public void testListLibraryDrives() throws Exception {
+ CloudSigma2Api api = requestsSendResponses(
+ getBuilder()
+ .endpoint(endpoint + "libdrives/")
+ .build()
+ , responseBuilder()
+ .payload(payloadFromResourceWithContentType("/libdrives.json", MediaType.APPLICATION_JSON))
+ .build()
+ , getBuilder()
+ .endpoint(endpoint + "libdrives/")
+ .addQueryParam("limit", "2")
+ .addQueryParam("offset", "2")
+ .build()
+ , responseBuilder()
+ .payload(payloadFromResourceWithContentType("/libdrives-last-page.json", MediaType.APPLICATION_JSON))
+ .build());
+
+ List<LibraryDrive> drives = api.listLibraryDrives().concat().toList();
+
+ Assert.assertEquals(drives.size(), 3);
+ Assert.assertEquals(drives.get(0).getUuid(), "8c45d8d9-4efd-44ec-9833-8d52004b4298");
+ Assert.assertEquals(drives.get(1).getUuid(), "d1ec9f26-ba44-4002-bbdf-82a31a84b611");
+ Assert.assertEquals(drives.get(2).getUuid(), "dd9da460-b1ab-419a-9fa1-804540eee4c3");
+ }
+
+ @Test
+ public void testListLibraryDrivesPaginatedCollection() throws Exception {
CloudSigma2Api api = requestSendsResponse(
getBuilder()
- .endpoint(endpoint + "libdrives/?limit=0")
+ .endpoint(endpoint + "libdrives/?limit=3&offset=3")
.build()
, responseBuilder()
.payload(payloadFromResourceWithContentType("/libdrives.json", MediaType.APPLICATION_JSON))
.build());
- List<LibraryDrive> result = api.listLibraryDrives();
- assertNotNull(result);
+ for (LibraryDrive libraryDrive : api.listLibraryDrives(new PaginationOptions.Builder()
+ .limit(3)
+ .offset(3)
+ .build())) {
+ assertNotNull(libraryDrive);
+ }
}
@Test
@@ -325,30 +411,84 @@ public class CloudSigma2ApiExpectTest extends BaseRestApiExpectTest<CloudSigma2A
@Test
public void testListServers() throws Exception {
+ CloudSigma2Api api = requestsSendResponses(
+ getBuilder()
+ .endpoint(endpoint + "servers/")
+ .build()
+ , responseBuilder()
+ .payload(payloadFromResourceWithContentType("/servers.json", MediaType.APPLICATION_JSON))
+ .build()
+ , getBuilder()
+ .endpoint(endpoint + "servers/")
+ .addQueryParam("limit", "2")
+ .addQueryParam("offset", "2")
+ .build()
+ , responseBuilder()
+ .payload(payloadFromResourceWithContentType("/servers-last-page.json", MediaType.APPLICATION_JSON))
+ .build());
+
+ List<Server> servers = api.listServers().concat().toList();
+
+ Assert.assertEquals(servers.size(), 3);
+ Assert.assertEquals(servers.get(0).getUuid(), "61d61337-884b-4c87-b4de-f7f48f9cfc84");
+ Assert.assertEquals(servers.get(1).getUuid(), "33e71c37-0d0a-4a3a-a1ea-dc7265c9a154");
+ Assert.assertEquals(servers.get(2).getUuid(), "05c16b9a-f2f5-4da6-a1cb-b90722c32212");
+ }
+
+ @Test
+ public void testListServersPaginatedCollection() throws Exception {
CloudSigma2Api api = requestSendsResponse(
getBuilder()
- .endpoint(endpoint + "servers/?limit=0")
+ .endpoint(endpoint + "servers/?limit=3&offset=3")
.build()
, responseBuilder()
.payload(payloadFromResourceWithContentType("/servers.json", MediaType.APPLICATION_JSON))
.build());
- List<Server> result = api.listServers();
- assertNotNull(result);
+ for (Server sever : api.listServers(new PaginationOptions.Builder().limit(3).offset(3).build())) {
+ assertNotNull(sever);
+ }
}
@Test
public void testListServersInfo() throws Exception {
+ CloudSigma2Api api = requestsSendResponses(
+ getBuilder()
+ .endpoint(endpoint + "servers/detail/")
+ .build()
+ , responseBuilder()
+ .payload(payloadFromResourceWithContentType("/server-detail-first-page.json", MediaType.APPLICATION_JSON))
+ .build()
+ , getBuilder()
+ .endpoint(endpoint + "servers/detail/")
+ .addQueryParam("limit", "2")
+ .addQueryParam("offset", "2")
+ .build()
+ , responseBuilder()
+ .payload(payloadFromResourceWithContentType("/server-detail-last-page.json", MediaType.APPLICATION_JSON))
+ .build());
+
+ List<ServerInfo> serverInfos = api.listServersInfo().concat().toList();
+
+ Assert.assertEquals(serverInfos.size(), 3);
+ Assert.assertEquals(serverInfos.get(0).getUuid(), "a19a425f-9e92-42f6-89fb-6361203071bb");
+ Assert.assertEquals(serverInfos.get(1).getUuid(), "61d61337-884b-4c87-b4de-f7f48f9cfc84");
+ Assert.assertEquals(serverInfos.get(2).getUuid(), "33e71c37-0d0a-4a3a-a1ea-dc7265c9a154");
+ }
+
+ @Test
+ public void testListServersInfoPaginatedCollection() throws Exception {
CloudSigma2Api api = requestSendsResponse(
getBuilder()
- .endpoint(endpoint + "servers/detail/?limit=0")
+ .endpoint(endpoint + "servers/detail/?limit=3&offset=3")
.build()
, responseBuilder()
.payload(payloadFromResourceWithContentType("/server-detail.json", MediaType.APPLICATION_JSON))
.build());
- List<ServerInfo> result = api.listServersInfo();
- assertNotNull(result);
+ for(ServerInfo serverInfo : api.listServersInfo(new PaginationOptions.Builder().limit(3).offset(3).build())){
+ assertNotNull(serverInfo);
+ }
}
@Test
@@ -547,56 +687,95 @@ public class CloudSigma2ApiExpectTest extends BaseRestApiExpectTest<CloudSigma2A
public void testListServerAvailabilityGroup() throws Exception {
CloudSigma2Api api = requestSendsResponse(
getBuilder()
- .endpoint(endpoint + "servers/availability_groups/?limit=0")
+ .endpoint(endpoint + "servers/availability_groups/")
.build()
, responseBuilder()
.payload(payloadFromResourceWithContentType("/servers-availability-groups.json", MediaType.APPLICATION_JSON))
.build());
- List<List<String>> result = api.listServerAvailabilityGroup();
- assertNotNull(result);
+ for(List<String> availabilityGroup : api.listServerAvailabilityGroup()){
+ assertNotNull(availabilityGroup);
+ }
}
@Test
- public void testGetServerAvailabilityGroup() throws Exception {
- CloudSigma2Api api = requestSendsResponse(
+ public void testListFirewallPolicies() throws Exception {
+ CloudSigma2Api api = requestsSendResponses(
getBuilder()
- .endpoint(endpoint + "fwpolicies/?limit=0")
+ .endpoint(endpoint + "fwpolicies/")
.build()
, responseBuilder()
- .payload(payloadFromResourceWithContentType("/fwpolicies-detail.json", MediaType.APPLICATION_JSON))
+ .payload(payloadFromResourceWithContentType("/fwpolicies-detail-first-page.json", MediaType.APPLICATION_JSON))
+ .build()
+ , getBuilder()
+ .endpoint(endpoint + "fwpolicies/")
+ .addQueryParam("limit", "1")
+ .addQueryParam("offset", "1")
+ .build()
+ , responseBuilder()
+ .payload(payloadFromResourceWithContentType("/fwpolicies-detail-last-page.json", MediaType.APPLICATION_JSON))
.build());
- List<FirewallPolicy> result = api.listFirewallPolicies();
- assertNotNull(result);
+ List<FirewallPolicy> firewallPolicies = api.listFirewallPolicies().concat().toList();
+
+ Assert.assertEquals(firewallPolicies.size(), 2);
+ Assert.assertEquals(firewallPolicies.get(0).getUuid(), "b68dd907-69fc-4b3c-b954-c39d0046525b");
+ Assert.assertEquals(firewallPolicies.get(1).getUuid(), "cf8479b4-c98b-46c8-ab9c-108bb00c8218");
}
@Test
- public void testListFirewallPolicies() throws Exception {
+ public void testListFirewallPoliciesPaginatedCollection() throws Exception {
CloudSigma2Api api = requestSendsResponse(
getBuilder()
- .endpoint(endpoint + "fwpolicies/?limit=0")
+ .endpoint(endpoint + "fwpolicies/?limit=2&offset=2")
.build()
, responseBuilder()
.payload(payloadFromResourceWithContentType("/fwpolicies-detail.json", MediaType.APPLICATION_JSON))
.build());
- List<FirewallPolicy> result = api.listFirewallPolicies();
- assertNotNull(result);
+ for(FirewallPolicy firewallPolicy : api.listFirewallPolicies(new PaginationOptions.Builder().limit(2).offset(2).build())){
+ assertNotNull(firewallPolicy);
+ }
}
@Test
public void testListFirewallPoliciesInfo() throws Exception {
+ CloudSigma2Api api = requestsSendResponses(
+ getBuilder()
+ .endpoint(endpoint + "fwpolicies/detail/")
+ .build()
+ , responseBuilder()
+ .payload(payloadFromResourceWithContentType("/fwpolicies-detail-first-page.json", MediaType.APPLICATION_JSON))
+ .build()
+ , getBuilder()
+ .endpoint(endpoint + "fwpolicies/detail/")
+ .addQueryParam("limit", "1")
+ .addQueryParam("offset", "1")
+ .build()
+ , responseBuilder()
+ .payload(payloadFromResourceWithContentType("/fwpolicies-detail-last-page.json", MediaType.APPLICATION_JSON))
+ .build());
+
+ List<FirewallPolicy> firewallPolicies = api.listFirewallPoliciesInfo().concat().toList();
+
+ Assert.assertEquals(firewallPolicies.size(), 2);
+ Assert.assertEquals(firewallPolicies.get(0).getUuid(), "b68dd907-69fc-4b3c-b954-c39d0046525b");
+ Assert.assertEquals(firewallPolicies.get(1).getUuid(), "cf8479b4-c98b-46c8-ab9c-108bb00c8218");
+ }
+
+ @Test
+ public void testListFirewallPoliciesInfoPaginatedCollection() throws Exception {
CloudSigma2Api api = requestSendsResponse(
getBuilder()
- .endpoint(endpoint + "fwpolicies/detail/?limit=0")
+ .endpoint(endpoint + "fwpolicies/detail/?limit=2&offset=2")
.build()
, responseBuilder()
.payload(payloadFromResourceWithContentType("/fwpolicies-detail.json", MediaType.APPLICATION_JSON))
.build());
- List<FirewallPolicy> result = api.listFirewallPoliciesInfo();
- assertNotNull(result);
+ for(FirewallPolicy firewallPolicy : api.listFirewallPoliciesInfo(new PaginationOptions.Builder().limit(2).offset(2).build())){
+ assertNotNull(firewallPolicy);
+ }
}
@Test
@@ -793,30 +972,82 @@ public class CloudSigma2ApiExpectTest extends BaseRestApiExpectTest<CloudSigma2A
@Test
public void testListVLANs() throws Exception {
+ CloudSigma2Api api = requestsSendResponses(
+ getBuilder()
+ .endpoint(endpoint + "vlans/")
+ .build()
+ , responseBuilder()
+ .payload(payloadFromResourceWithContentType("/vlans.json", MediaType.APPLICATION_JSON))
+ .build()
+ , getBuilder()
+ .endpoint(endpoint + "vlans/")
+ .addQueryParam("limit", "1")
+ .addQueryParam("offset", "1")
+ .build()
+ , responseBuilder()
+ .payload(payloadFromResourceWithContentType("/vlans-last-page.json", MediaType.APPLICATION_JSON))
+ .build());
+
+ List<VLANInfo> vlans = api.listVLANs().concat().toList();
+
+ Assert.assertEquals(vlans.size(), 2);
+ Assert.assertEquals(vlans.get(0).getUuid(), "96537817-f4b6-496b-a861-e74192d3ccb0");
+ Assert.assertEquals(vlans.get(1).getUuid(), "00b445a9-3936-47e5-ba8a-38adcf43db20");
+ }
+
+ @Test
+ public void testListVLANsPaginatedCollection() throws Exception {
CloudSigma2Api api = requestSendsResponse(
getBuilder()
- .endpoint(endpoint + "vlans/?limit=0")
+ .endpoint(endpoint + "vlans/?limit=2&offset=2")
.build()
, responseBuilder()
.payload(payloadFromResourceWithContentType("/vlans.json", MediaType.APPLICATION_JSON))
.build());
- List<VLANInfo> result = api.listVLANs();
- assertNotNull(result);
+ for(VLANInfo vlanInfo : api.listVLANs(new PaginationOptions.Builder().limit(2).offset(2).build())){
+ assertNotNull(vlanInfo);
+ }
}
@Test
public void testListVLANInfo() throws Exception {
+ CloudSigma2Api api = requestsSendResponses(
+ getBuilder()
+ .endpoint(endpoint + "vlans/detail/")
+ .build()
+ , responseBuilder()
+ .payload(payloadFromResourceWithContentType("/vlans.json", MediaType.APPLICATION_JSON))
+ .build()
+ , getBuilder()
+ .endpoint(endpoint + "vlans/detail/")
+ .addQueryParam("limit", "1")
+ .addQueryParam("offset", "1")
+ .build()
+ , responseBuilder()
+ .payload(payloadFromResourceWithContentType("/vlans-last-page.json", MediaType.APPLICATION_JSON))
+ .build());
+
+ List<VLANInfo> vlanInfos = api.listVLANInfo().concat().toList();
+
+ Assert.assertEquals(vlanInfos.size(), 2);
+ Assert.assertEquals(vlanInfos.get(0).getUuid(), "96537817-f4b6-496b-a861-e74192d3ccb0");
+ Assert.assertEquals(vlanInfos.get(1).getUuid(), "00b445a9-3936-47e5-ba8a-38adcf43db20");
+ }
+
+ @Test
+ public void testListVLANInfoPaginatedCollection() throws Exception {
CloudSigma2Api api = requestSendsResponse(
getBuilder()
- .endpoint(endpoint + "vlans/detail/?limit=0")
+ .endpoint(endpoint + "vlans/detail/?limit=2&offset=2")
.build()
, responseBuilder()
.payload(payloadFromResourceWithContentType("/vlans.json", MediaType.APPLICATION_JSON))
.build());
- List<VLANInfo> result = api.listVLANInfo();
- assertNotNull(result);
+ for(VLANInfo vlanInfo : api.listVLANInfo(new PaginationOptions.Builder().limit(2).offset(2).build())){
+ assertNotNull(vlanInfo);
+ }
}
@Test
@@ -845,30 +1076,82 @@ public class CloudSigma2ApiExpectTest extends BaseRestApiExpectTest<CloudSigma2A
@Test
public void testListIPs() throws Exception {
+ CloudSigma2Api api = requestsSendResponses(
+ getBuilder()
+ .endpoint(endpoint + "ips/")
+ .build()
+ , responseBuilder()
+ .payload(payloadFromResourceWithContentType("/ips.json", MediaType.APPLICATION_JSON))
+ .build()
+ , getBuilder()
+ .endpoint(endpoint + "ips/")
+ .addQueryParam("limit", "1")
+ .addQueryParam("offset", "1")
+ .build()
+ , responseBuilder()
+ .payload(payloadFromResourceWithContentType("/ips-last-page.json", MediaType.APPLICATION_JSON))
+ .build());
+
+ List<IP> ips = api.listIPs().concat().toList();
+
+ Assert.assertEquals(ips.size(), 2);
+ Assert.assertEquals(ips.get(0).getUuid(), "185.12.6.183");
+ Assert.assertEquals(ips.get(1).getUuid(), "185.12.5.233");
+ }
+
+ @Test
+ public void testListIPsPaginatedCollection() throws Exception {
CloudSigma2Api api = requestSendsResponse(
getBuilder()
- .endpoint(endpoint + "ips/?limit=0")
+ .endpoint(endpoint + "ips/?limit=2&offset=2")
.build()
, responseBuilder()
.payload(payloadFromResourceWithContentType("/ips.json", MediaType.APPLICATION_JSON))
.build());
- List<IP> result = api.listIPs();
- assertNotNull(result);
+ for(IP ip : api.listIPs(new PaginationOptions.Builder().limit(2).offset(2).build())){
+ assertNotNull(ip);
+ }
}
@Test
public void testListIPInfo() throws Exception {
+ CloudSigma2Api api = requestsSendResponses(
+ getBuilder()
+ .endpoint(endpoint + "ips/detail/")
+ .build()
+ , responseBuilder()
+ .payload(payloadFromResourceWithContentType("/ips.json", MediaType.APPLICATION_JSON))
+ .build()
+ , getBuilder()
+ .endpoint(endpoint + "ips/detail/")
+ .addQueryParam("limit", "1")
+ .addQueryParam("offset", "1")
+ .build()
+ , responseBuilder()
+ .payload(payloadFromResourceWithContentType("/ips-last-page.json", MediaType.APPLICATION_JSON))
+ .build());
+
+ List<IPInfo> ipInfos = api.listIPInfo().concat().toList();
+
+ Assert.assertEquals(ipInfos.size(), 2);
+ Assert.assertEquals(ipInfos.get(0).getUuid(), "185.12.6.183");
+ Assert.assertEquals(ipInfos.get(1).getUuid(), "185.12.5.233");
+ }
+
+ @Test
+ public void testListIPInfoPaginatedCollection() throws Exception {
CloudSigma2Api api = requestSendsResponse(
getBuilder()
- .endpoint(endpoint + "ips/detail/?limit=0")
+ .endpoint(endpoint + "ips/detail/?limit=2&offset=2")
.build()
, responseBuilder()
.payload(payloadFromResourceWithContentType("/ips.json", MediaType.APPLICATION_JSON))
.build());
- List<IPInfo> result = api.listIPInfo();
- assertNotNull(result);
+ for(IPInfo ipInfo : api.listIPInfo(new PaginationOptions.Builder().limit(2).offset(2).build())){
+ assertNotNull(ipInfo);
+ }
}
@Test
@@ -912,30 +1195,83 @@ public class CloudSigma2ApiExpectTest extends BaseRestApiExpectTest<CloudSigma2A
@Test
public void testListTags() throws Exception {
+ CloudSigma2Api api = requestsSendResponses(
+ getBuilder()
+ .endpoint(endpoint + "tags/")
+ .build()
+ , responseBuilder()
+ .payload(payloadFromResourceWithContentType("/tags-detail-first-page.json", MediaType.APPLICATION_JSON))
+ .build()
+ , getBuilder()
+ .endpoint(endpoint + "tags/")
+ .addQueryParam("limit", "1")
+ .addQueryParam("offset", "1")
+ .build()
+ , responseBuilder()
+ .payload(payloadFromResourceWithContentType("/tags-detail-last-page.json", MediaType.APPLICATION_JSON))
+ .build());
+
+ List<Tag> tags = api.listTags().concat().toList();
+
+ Assert.assertEquals(tags.size(), 2);
+ Assert.assertEquals(tags.get(0).getUuid(), "956e2ca0-dee3-4b3f-a1be-a6e86f90946f");
+ Assert.assertEquals(tags.get(1).getUuid(), "68bb0cfc-0c76-4f37-847d-7bb705c5ae46");
+ }
+
+ @Test
+ public void testListTagsPaginatedCollection() throws Exception {
CloudSigma2Api api = requestSendsResponse(
getBuilder()
- .endpoint(endpoint + "tags/?limit=0")
+ .endpoint(endpoint + "tags/?limit=2&offset=2")
.build()
, responseBuilder()
.payload(payloadFromResourceWithContentType("/tags-detail.json", MediaType.APPLICATION_JSON))
.build());
- List<Tag> result = api.listTags();
- assertNotNull(result);
+ for(Tag tag : api.listTags(new PaginationOptions.Builder().limit(2).offset(2).build())){
+ assertNotNull(tag);
+ }
}
@Test
public void testListTagsInfo() throws Exception {
+ CloudSigma2Api api = requestsSendResponses(
+ getBuilder()
+ .endpoint(endpoint + "tags/detail/")
+ .build()
+ , responseBuilder()
+ .payload(payloadFromResourceWithContentType("/tags-detail-first-page.json", MediaType.APPLICATION_JSON))
+ .build()
+ , getBuilder()
+ .endpoint(endpoint + "tags/detail/")
+ .addQueryParam("limit", "1")
+ .addQueryParam("offset", "1")
+ .build()
+ , responseBuilder()
+ .payload(payloadFromResourceWithContentType("/tags-detail-last-page.json", MediaType.APPLICATION_JSON))
+ .build());
+
+ List<Tag> tags = api.listTagsInfo().concat().toList();
+
+ Assert.assertEquals(tags.size(), 2);
+ Assert.assertEquals(tags.get(0).getUuid(), "956e2ca0-dee3-4b3f-a1be-a6e86f90946f");
+ Assert.assertEquals(tags.get(1).getUuid(), "68bb0cfc-0c76-4f37-847d-7bb705c5ae46");
+ }
+
+
+ @Test
+ public void testListTagsInfoPaginatedCollection() throws Exception {
CloudSigma2Api api = requestSendsResponse(
getBuilder()
- .endpoint(endpoint + "tags/detail/?limit=0")
+ .endpoint(endpoint + "tags/detail/?limit=2&offset=2")
.build()
, responseBuilder()
.payload(payloadFromResourceWithContentType("/tags-detail.json", MediaType.APPLICATION_JSON))
.build());
- List<Tag> result = api.listTagsInfo();
- assertNotNull(result);
+ for(Tag tag : api.listTagsInfo(new PaginationOptions.Builder().limit(2).offset(2).build())){
+ assertNotNull(tag);
+ }
}
@Test
@@ -1140,30 +1476,84 @@ public class CloudSigma2ApiExpectTest extends BaseRestApiExpectTest<CloudSigma2A
@Test
public void testListSubscriptions() throws Exception {
+ CloudSigma2Api api = requestsSendResponses(
+ getBuilder()
+ .endpoint(endpoint + "subscriptions/")
+ .build()
+ , responseBuilder()
+ .payload(payloadFromResourceWithContentType("/subscriptions-first-page.json", MediaType.APPLICATION_JSON))
+ .build()
+ , getBuilder()
+ .endpoint(endpoint + "subscriptions/")
+ .addQueryParam("limit", "2")
+ .addQueryParam("offset", "2")
+ .build()
+ , responseBuilder()
+ .payload(payloadFromResourceWithContentType("/subscriptions-last-page.json", MediaType.APPLICATION_JSON))
+ .build());
+
+ List<Subscription> subscriptions = api.listSubscriptions().concat().toList();
+
+ Assert.assertEquals(subscriptions.size(), 3);
+ Assert.assertEquals(subscriptions.get(0).getUuid(), "509f8e27-1e64-49bb-aa5a-baec074b0210");
+ Assert.assertEquals(subscriptions.get(1).getUuid(), "c2423c1a-8768-462c-bdc3-4ca09c1e650b");
+ Assert.assertEquals(subscriptions.get(2).getUuid(), "9bb117d3-4bc5-4e2d-a907-b20abd48eaf9");
+ }
+
+ @Test
+ public void testListSubscriptionsPaginatedCollection() throws Exception {
CloudSigma2Api api = requestSendsResponse(
getBuilder()
- .endpoint(endpoint + "subscriptions/?limit=0")
+ .endpoint(endpoint + "subscriptions/?limit=3&offset=3")
.build()
, responseBuilder()
.payload(payloadFromResourceWithContentType("/subscriptions.json", MediaType.APPLICATION_JSON))
.build());
- List<Subscription> result = api.listSubscriptions();
- assertNotNull(result);
+ for(Subscription subscription : api.listSubscriptions(new PaginationOptions.Builder().limit(3).offset(3).build())){
+ assertNotNull(subscription);
+ }
}
@Test
public void testListSubscriptionsCalculator() throws Exception {
+ CloudSigma2Api api = requestsSendResponses(
+ getBuilder()
+ .endpoint(endpoint + "subscriptioncalculator/")
+ .build()
+ , responseBuilder()
+ .payload(payloadFromResourceWithContentType("/subscriptions-first-page.json", MediaType.APPLICATION_JSON))
+ .build()
+ , getBuilder()
+ .endpoint(endpoint + "subscriptioncalculator/")
+ .addQueryParam("limit", "2")
+ .addQueryParam("offset", "2")
+ .build()
+ , responseBuilder()
+ .payload(payloadFromResourceWithContentType("/subscriptions-last-page.json", MediaType.APPLICATION_JSON))
+ .build());
+
+ List<Subscription> subscriptions = api.listSubscriptionsCalculator().concat().toList();
+
+ Assert.assertEquals(subscriptions.size(), 3);
+ Assert.assertEquals(subscriptions.get(0).getUuid(), "509f8e27-1e64-49bb-aa5a-baec074b0210");
+ Assert.assertEquals(subscriptions.get(1).getUuid(), "c2423c1a-8768-462c-bdc3-4ca09c1e650b");
+ Assert.assertEquals(subscriptions.get(2).getUuid(), "9bb117d3-4bc5-4e2d-a907-b20abd48eaf9");
+ }
+
+ @Test
+ public void testListSubscriptionsCalculatorPaginatedCollection() throws Exception {
CloudSigma2Api api = requestSendsResponse(
getBuilder()
- .endpoint(endpoint + "subscriptioncalculator/?limit=0")
+ .endpoint(endpoint + "subscriptioncalculator/?limit=2&offset=2")
.build()
, responseBuilder()
.payload(payloadFromResourceWithContentType("/subscriptions.json", MediaType.APPLICATION_JSON))
.build());
- List<Subscription> result = api.listSubscriptionsCalculator();
- assertNotNull(result);
+ for(Subscription subscription : api.listSubscriptionsCalculator(new PaginationOptions.Builder().limit(2).offset(2).build())){
+ assertNotNull(subscription);
+ }
}
@Test
@@ -1273,43 +1663,127 @@ public class CloudSigma2ApiExpectTest extends BaseRestApiExpectTest<CloudSigma2A
@Test
public void testListDiscounts() throws Exception {
+ CloudSigma2Api api = requestsSendResponses(
+ getBuilder()
+ .endpoint(endpoint + "discount/")
+ .build()
+ , responseBuilder()
+ .payload(payloadFromResourceWithContentType("/discount.json", MediaType.APPLICATION_JSON))
+ .build()
+ , getBuilder()
+ .endpoint(endpoint + "discount/")
+ .addQueryParam("limit", "3")
+ .addQueryParam("offset", "3")
+ .build()
+ , responseBuilder()
+ .payload(payloadFromResourceWithContentType("/discount-last-page.json", MediaType.APPLICATION_JSON))
+ .build());
+
+ List<Discount> discounts = api.listDiscounts().concat().toList();
+
+ Assert.assertEquals(discounts.size(), 5);
+ Assert.assertEquals(discounts.get(0).getValue(), 0.03);
+ Assert.assertEquals(discounts.get(1).getValue(), 0.1);
+ Assert.assertEquals(discounts.get(2).getValue(), 0.25);
+ Assert.assertEquals(discounts.get(3).getValue(), 0.35);
+ Assert.assertEquals(discounts.get(4).getValue(), 0.45);
+ }
+
+ @Test
+ public void testListDiscountsPaginatedCollection() throws Exception {
CloudSigma2Api api = requestSendsResponse(
getBuilder()
- .endpoint(endpoint + "discount/?limit=0")
+ .endpoint(endpoint + "discount/?limit=5&offset=5")
.build()
, responseBuilder()
.payload(payloadFromResourceWithContentType("/discount.json", MediaType.APPLICATION_JSON))
.build());
- List<Discount> result = api.listDiscounts();
- assertNotNull(result);
+ for(Discount discount : api.listDiscounts(new PaginationOptions.Builder().limit(5).offset(5).build())){
+ assertNotNull(discount);
+ }
}
@Test
public void testListTransactions() throws Exception {
+ CloudSigma2Api api = requestsSendResponses(
+ getBuilder()
+ .endpoint(endpoint + "ledger/")
+ .build()
+ , responseBuilder()
+ .payload(payloadFromResourceWithContentType("/ledger.json", MediaType.APPLICATION_JSON))
+ .build()
+ , getBuilder()
+ .endpoint(endpoint + "ledger/")
+ .addQueryParam("limit", "2")
+ .addQueryParam("offset", "2")
+ .build()
+ , responseBuilder()
+ .payload(payloadFromResourceWithContentType("/ledger-last-page.json", MediaType.APPLICATION_JSON))
+ .build());
+
+ List<Transaction> transactions = api.listTransactions().concat().toList();
+
+ Assert.assertEquals(transactions.size(), 4);
+ Assert.assertEquals(transactions.get(0).getId(), "11042920");
+ Assert.assertEquals(transactions.get(1).getId(), "11042919");
+ Assert.assertEquals(transactions.get(2).getId(), "11042661");
+ Assert.assertEquals(transactions.get(3).getId(), "11042660");
+ }
+
+ @Test
+ public void testListTransactionsPaginatedCollection() throws Exception {
CloudSigma2Api api = requestSendsResponse(
getBuilder()
- .endpoint(endpoint + "ledger/?limit=0")
+ .endpoint(endpoint + "ledger/?limit=4&offset=4")
.build()
, responseBuilder()
.payload(payloadFromResourceWithContentType("/ledger.json", MediaType.APPLICATION_JSON))
.build());
- List<Transaction> result = api.listTransactions();
- assertNotNull(result);
+ for(Transaction transaction : api.listTransactions(new PaginationOptions.Builder().limit(4).offset(4).build())){
+ assertNotNull(transaction);
+ }
}
@Test
public void testListLicenses() throws Exception {
+ CloudSigma2Api api = requestsSendResponses(
+ getBuilder()
+ .endpoint(endpoint + "licenses/")
+ .build()
+ , responseBuilder()
+ .payload(payloadFromResourceWithContentType("/licences.json", MediaType.APPLICATION_JSON))
+ .build()
+ , getBuilder()
+ .endpoint(endpoint + "licenses/")
+ .addQueryParam("limit", "2")
+ .addQueryParam("offset", "2")
+ .build()
+ , responseBuilder()
+ .payload(payloadFromResourceWithContentType("/licences-last-page.json", MediaType.APPLICATION_JSON))
+ .build());
+
+ List<License> licenses = api.listLicenses().concat().toList();
+
+ Assert.assertEquals(licenses.size(), 3);
+ Assert.assertEquals(licenses.get(0).getName(), "msft_lwa_00135");
+ Assert.assertEquals(licenses.get(1).getName(), "msft_p73_04837");
+ Assert.assertEquals(licenses.get(2).getName(), "msft_tfa_00009");
+ }
+
+ @Test
+ public void testListLicensesPaginatedCollection() throws Exception {
CloudSigma2Api api = requestSendsResponse(
getBuilder()
- .endpoint(endpoint + "licenses/?limit=0")
+ .endpoint(endpoint + "licenses/?limit=3&offset=3")
.build()
, responseBuilder()
.payload(payloadFromResourceWithContentType("/licences.json", MediaType.APPLICATION_JSON))
.build());
- List<License> result = api.listLicenses();
- assertNotNull(result);
+ for(License license : api.listLicenses(new PaginationOptions.Builder().limit(3).offset(3).build())){
+ assertNotNull(license);
+ }
}
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0bebb584/cloudsigma2/src/test/java/org/jclouds/cloudsigma2/CloudSigma2ApiLiveTest.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/test/java/org/jclouds/cloudsigma2/CloudSigma2ApiLiveTest.java b/cloudsigma2/src/test/java/org/jclouds/cloudsigma2/CloudSigma2ApiLiveTest.java
index bef1bdd..1ba8fd6 100644
--- a/cloudsigma2/src/test/java/org/jclouds/cloudsigma2/CloudSigma2ApiLiveTest.java
+++ b/cloudsigma2/src/test/java/org/jclouds/cloudsigma2/CloudSigma2ApiLiveTest.java
@@ -19,6 +19,7 @@ package org.jclouds.cloudsigma2;
import com.google.common.collect.ImmutableList;
import org.jclouds.apis.BaseApiLiveTest;
import org.jclouds.cloudsigma2.domain.DeviceEmulationType;
+import org.jclouds.cloudsigma2.domain.Discount;
import org.jclouds.cloudsigma2.domain.Drive;
import org.jclouds.cloudsigma2.domain.DriveInfo;
import org.jclouds.cloudsigma2.domain.FirewallAction;
@@ -38,6 +39,7 @@ import org.jclouds.cloudsigma2.domain.ServerInfo;
import org.jclouds.cloudsigma2.domain.Subscription;
import org.jclouds.cloudsigma2.domain.Tag;
import org.jclouds.cloudsigma2.domain.TagResource;
+import org.jclouds.cloudsigma2.domain.Transaction;
import org.jclouds.cloudsigma2.domain.VLANInfo;
import org.testng.Assert;
import org.testng.annotations.Test;
@@ -77,7 +79,7 @@ public class CloudSigma2ApiLiveTest extends BaseApiLiveTest<CloudSigma2Api> {
@Test
public void testGetDriveInfo() throws Exception {
- for(Drive driveInfo : api.listDrives()){
+ for(Drive driveInfo : api.listDrives().concat()){
Assert.assertNotNull(api.getDriveInfo(driveInfo.getUuid()));
}
}
@@ -146,7 +148,7 @@ public class CloudSigma2ApiLiveTest extends BaseApiLiveTest<CloudSigma2Api> {
@Test
public void testGetLibraryDrive() throws Exception {
- for(LibraryDrive libraryDrive : api.listLibraryDrives()){
+ for(LibraryDrive libraryDrive : api.listLibraryDrives().concat()){
Assert.assertNotNull(libraryDrive.getUuid());
}
}
@@ -168,7 +170,7 @@ public class CloudSigma2ApiLiveTest extends BaseApiLiveTest<CloudSigma2Api> {
.memory(new BigInteger("5368709120"))
.cpu(3000)
.vncPassword("new_password")
- .drives(ImmutableList.of(api.listDrives().get(0).toServerDrive(1, "0:1", DeviceEmulationType.IDE)))
+ .drives(ImmutableList.of(api.listDrives().concat().get(0).toServerDrive(1, "0:1", DeviceEmulationType.IDE)))
.build();
createdServer = api.createServer(serverInfo);
@@ -213,7 +215,7 @@ public class CloudSigma2ApiLiveTest extends BaseApiLiveTest<CloudSigma2Api> {
@Test
public void testGetServerInfo() throws Exception {
- for(Server server : api.listServers()){
+ for(Server server : api.listServers().concat()){
Assert.assertNotNull(server.getUuid());
}
}
@@ -389,7 +391,7 @@ public class CloudSigma2ApiLiveTest extends BaseApiLiveTest<CloudSigma2Api> {
@Test
public void testGetVLANInfo() throws Exception {
- for(VLANInfo vlanInfo : api.listVLANs()){
+ for(VLANInfo vlanInfo : api.listVLANs().concat()){
Assert.assertNotNull(vlanInfo.getUuid());
}
}
@@ -404,7 +406,7 @@ public class CloudSigma2ApiLiveTest extends BaseApiLiveTest<CloudSigma2Api> {
.build();
if(api.listVLANs().size() > 0){
- checkVlAN(vlanInfo, api.editVLAN(api.listVLANs().get(0).getUuid(), vlanInfo));
+ checkVlAN(vlanInfo, api.editVLAN(api.listVLANs().concat().get(0).getUuid(), vlanInfo));
}
}
@@ -420,7 +422,7 @@ public class CloudSigma2ApiLiveTest extends BaseApiLiveTest<CloudSigma2Api> {
@Test
public void testGetIPInfo() throws Exception {
- for(IP ip : api.listIPs()){
+ for(IP ip : api.listIPs().concat()){
Assert.assertNotNull(api.getIPInfo(ip.getUuid()));
}
}
@@ -435,7 +437,7 @@ public class CloudSigma2ApiLiveTest extends BaseApiLiveTest<CloudSigma2Api> {
.build();
if(api.listIPs().size() > 0){
- checkIP(ip, api.editIP(api.listIPs().get(0).getUuid(), ip));
+ checkIP(ip, api.editIP(api.listIPs().concat().get(0).getUuid(), ip));
}
}
@@ -451,7 +453,7 @@ public class CloudSigma2ApiLiveTest extends BaseApiLiveTest<CloudSigma2Api> {
@Test
public void testGetTagInfo() throws Exception {
- for(Tag tag : api.listTags()){
+ for(Tag tag : api.listTags().concat()){
Assert.assertNotNull(api.getTagInfo(tag.getUuid()));
}
}
@@ -564,19 +566,23 @@ public class CloudSigma2ApiLiveTest extends BaseApiLiveTest<CloudSigma2Api> {
@Test
public void testListSubscriptions() throws Exception {
- Assert.assertNotNull(api.listSubscriptions());
+ for(Subscription subscription : api.listSubscriptions().concat()){
+ Assert.assertNotNull(subscription);
+ }
}
@Test
public void testGetSubscription() throws Exception {
- for(Subscription subscription : api.listSubscriptions()){
+ for(Subscription subscription : api.listSubscriptions().concat()){
Assert.assertNotNull(api.getSubscription(subscription.getId()));
}
}
@Test
public void testListSubscriptionsCalculator() throws Exception {
- Assert.assertNotNull(api.listSubscriptionsCalculator());
+ for(Subscription subscription : api.listSubscriptionsCalculator().concat()){
+ Assert.assertNotNull(subscription);
+ }
}
@Test
@@ -586,18 +592,23 @@ public class CloudSigma2ApiLiveTest extends BaseApiLiveTest<CloudSigma2Api> {
@Test
public void testListDiscounts() throws Exception {
- Assert.assertNotNull(api.listDiscounts());
+ for(Discount discount : api.listDiscounts().concat()){
+ Assert.assertNotNull(discount);
+ }
}
@Test
public void testListTransactions() throws Exception {
- Assert.assertNotNull(api.listTransactions());
+ for(Transaction transaction : api.listTransactions().concat()){
+ Assert.assertNotNull(transaction);
+ }
}
@Test
public void testListLicenses() throws Exception {
- List<License> licenses = api.listLicenses();
- Assert.assertNotNull(licenses);
+ for(License license : api.listLicenses().concat()){
+ Assert.assertNotNull(license);
+ }
}
private void checkDrive(DriveInfo newDrive, DriveInfo createdDrive){
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0bebb584/cloudsigma2/src/test/resources/discount-last-page.json
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/test/resources/discount-last-page.json b/cloudsigma2/src/test/resources/discount-last-page.json
new file mode 100644
index 0000000..fcbe550
--- /dev/null
+++ b/cloudsigma2/src/test/resources/discount-last-page.json
@@ -0,0 +1,17 @@
+{
+ "meta": {
+ "limit": 2,
+ "offset": 3,
+ "total_count": 5
+ },
+ "objects": [
+ {
+ "period": "2 years",
+ "value": "0.3500000000"
+ },
+ {
+ "period": "3 years",
+ "value": "0.4500000000"
+ }
+ ]
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0bebb584/cloudsigma2/src/test/resources/discount.json
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/test/resources/discount.json b/cloudsigma2/src/test/resources/discount.json
index 4282cef..8539b82 100644
--- a/cloudsigma2/src/test/resources/discount.json
+++ b/cloudsigma2/src/test/resources/discount.json
@@ -1,6 +1,6 @@
{
"meta": {
- "limit": 0,
+ "limit": 3,
"offset": 0,
"total_count": 5
},
@@ -16,14 +16,6 @@
{
"period": "1 year",
"value": "0.2500000000"
- },
- {
- "period": "2 years",
- "value": "0.3500000000"
- },
- {
- "period": "3 years",
- "value": "0.4500000000"
}
]
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0bebb584/cloudsigma2/src/test/resources/drives-detail-first-page.json
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/test/resources/drives-detail-first-page.json b/cloudsigma2/src/test/resources/drives-detail-first-page.json
new file mode 100644
index 0000000..56b90d7
--- /dev/null
+++ b/cloudsigma2/src/test/resources/drives-detail-first-page.json
@@ -0,0 +1,88 @@
+{
+ "meta": {
+ "limit": 2,
+ "offset": 0,
+ "total_count": 3
+ },
+ "objects": [
+ {
+ "affinities": [
+ "ssd",
+ "sample"
+ ],
+ "allow_multimount": true,
+ "jobs": [],
+ "licenses": [
+ {
+ "amount" : 1,
+ "license" : {
+ "burstable" : true,
+ "long_name" : "sample_longname",
+ "name" : "sample_name",
+ "resource_uri" : "/api/2.0/samples/",
+ "type" : "sample_type",
+ "user_metric" : sample
+ },
+ "user" : {
+ "resource_uri": "/api/2.0/user/5b4a69a3-8e78-4c45-a8ba-8b13f0895e23/",
+ "uuid": "5b4a69a3-8e78-4c45-a8ba-8b13f0895e23"
+ }
+ }
+ ],
+ "media": "disk",
+ "meta": {
+ "description": "",
+ "install_notes": ""
+ },
+ "mounted_on": [
+ {
+ "uuid" : "81f911f9-5152-4328-8671-02543bafbd0e",
+ "resource_uri" : "/api/2.0/servers/81f911f9-5152-4328-8671-02543bafbd0e/"
+ },
+ {
+ "uuid" : "19163e1a-a6d6-4e73-8087-157dd302c373",
+ "resource_uri" : "/api/2.0/servers/19163e1a-a6d6-4e73-8087-157dd302c373/"
+ }
+ ],
+ "name": "atom-sol3",
+ "owner": {
+ "resource_uri": "/api/2.0/user/5b4a69a3-8e78-4c45-a8ba-8b13f0895e23/",
+ "uuid": "5b4a69a3-8e78-4c45-a8ba-8b13f0895e23"
+ },
+ "resource_uri": "/api/2.0/drives/92ca1450-417e-4cc1-983b-1015777e2591/",
+ "size": 12348030976,
+ "status": "unmounted",
+ "tags": [
+ "tag_uuid_1",
+ "tag_uuid_2"
+ ],
+ "uuid": "92ca1450-417e-4cc1-983b-1015777e2591"
+ },
+ {
+ "affinities": [
+ "ssd"
+ ],
+ "allow_multimount": false,
+ "jobs": [],
+ "licenses": [],
+ "media": "disk",
+ "meta": {},
+ "mounted_on": [
+ {
+ "uuid" : "81f911f9-5152-4328-8671-02543bafbd0e",
+ "resource_uri" : "/api/2.0/servers/81f911f9-5152-4328-8671-02543bafbd0e/"
+ }
+ ],
+ "name": "test_drive_3",
+ "owner": {
+ "resource_uri": "/api/2.0/user/5b4a69a3-8e78-4c45-a8ba-8b13f0895e23/",
+ "uuid": "5b4a69a3-8e78-4c45-a8ba-8b13f0895e23"
+ },
+ "resource_uri": "/api/2.0/drives/414ad24b-ba41-47c0-9751-ef5060b6c391/",
+ "size": 1024000000,
+ "status": "unmounted",
+ "tags": [],
+ "uuid": "414ad24b-ba41-47c0-9751-ef5060b6c391"
+ }
+ ]
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0bebb584/cloudsigma2/src/test/resources/drives-detail-last-page.json
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/test/resources/drives-detail-last-page.json b/cloudsigma2/src/test/resources/drives-detail-last-page.json
new file mode 100644
index 0000000..3068a71
--- /dev/null
+++ b/cloudsigma2/src/test/resources/drives-detail-last-page.json
@@ -0,0 +1,31 @@
+{
+ "meta": {
+ "limit": 1,
+ "offset": 2,
+ "total_count": 3
+ },
+ "objects": [
+ {
+ "affinities": [],
+ "allow_multimount": false,
+ "jobs": [],
+ "licenses": [],
+ "media": "disk",
+ "meta": {
+ "description": "",
+ "install_notes": ""
+ },
+ "mounted_on": [],
+ "name": "otom",
+ "owner": {
+ "resource_uri": "/api/2.0/user/5b4a69a3-8e78-4c45-a8ba-8b13f0895e23/",
+ "uuid": "5b4a69a3-8e78-4c45-a8ba-8b13f0895e23"
+ },
+ "resource_uri": "/api/2.0/drives/7bc04bc5-bd09-4269-b45d-16b58d6f71b4/",
+ "size": 11811160064,
+ "status": "unmounted",
+ "tags": [],
+ "uuid": "7bc04bc5-bd09-4269-b45d-16b58d6f71b4"
+ }
+ ]
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0bebb584/cloudsigma2/src/test/resources/drives-last-page.json
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/test/resources/drives-last-page.json b/cloudsigma2/src/test/resources/drives-last-page.json
new file mode 100644
index 0000000..b7389f3
--- /dev/null
+++ b/cloudsigma2/src/test/resources/drives-last-page.json
@@ -0,0 +1,18 @@
+{
+ "meta": {
+ "limit": 1,
+ "offset": 2,
+ "total_count": 3
+ },
+ "objects": [
+ {
+ "owner": {
+ "resource_uri": "/api/2.0/user/5b4a69a3-8e78-4c45-a8ba-8b13f0895e23/",
+ "uuid": "5b4a69a3-8e78-4c45-a8ba-8b13f0895e23"
+ },
+ "resource_uri": "/api/2.0/drives/7bc04bc5-bd09-4269-b45d-16b58d6f71b4/",
+ "status": "mounted",
+ "uuid": "7bc04bc5-bd09-4269-b45d-16b58d6f71b4"
+ }
+ ]
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0bebb584/cloudsigma2/src/test/resources/drives.json
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/test/resources/drives.json b/cloudsigma2/src/test/resources/drives.json
index a842121..8a24942 100644
--- a/cloudsigma2/src/test/resources/drives.json
+++ b/cloudsigma2/src/test/resources/drives.json
@@ -1,6 +1,6 @@
{
"meta": {
- "limit": 0,
+ "limit": 2,
"offset": 0,
"total_count": 3
},
@@ -22,15 +22,6 @@
"resource_uri": "/api/2.0/drives/414ad24b-ba41-47c0-9751-ef5060b6c391/",
"status": "unmounted",
"uuid": "414ad24b-ba41-47c0-9751-ef5060b6c391"
- },
- {
- "owner": {
- "resource_uri": "/api/2.0/user/5b4a69a3-8e78-4c45-a8ba-8b13f0895e23/",
- "uuid": "5b4a69a3-8e78-4c45-a8ba-8b13f0895e23"
- },
- "resource_uri": "/api/2.0/drives/7bc04bc5-bd09-4269-b45d-16b58d6f71b4/",
- "status": "mounted",
- "uuid": "7bc04bc5-bd09-4269-b45d-16b58d6f71b4"
}
]
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0bebb584/cloudsigma2/src/test/resources/fwpolicies-detail-first-page.json
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/test/resources/fwpolicies-detail-first-page.json b/cloudsigma2/src/test/resources/fwpolicies-detail-first-page.json
new file mode 100644
index 0000000..b39a6a8
--- /dev/null
+++ b/cloudsigma2/src/test/resources/fwpolicies-detail-first-page.json
@@ -0,0 +1,32 @@
+{
+ "meta" : {
+ "limit": 1,
+ "offset": 0,
+ "total_count": 2
+ },
+ "objects": [
+ {
+ "meta": {},
+ "name": "New policy",
+ "owner": {
+ "resource_uri": "/api/2.0/user/5b4a69a3-8e78-4c45-a8ba-8b13f0895e23/",
+ "uuid": "5b4a69a3-8e78-4c45-a8ba-8b13f0895e23"
+ },
+ "resource_uri": "/api/2.0/fwpolicies/b68dd907-69fc-4b3c-b954-c39d0046525b/",
+ "rules": [
+ {
+ "action": "accept",
+ "comment": "Test comment",
+ "direction": "in",
+ "dst_ip": "192.168.1.132/32",
+ "dst_port": "1233",
+ "ip_proto": "tcp",
+ "src_ip": "255.255.255.12/32",
+ "src_port": "321"
+ }
+ ],
+ "servers": [],
+ "uuid": "b68dd907-69fc-4b3c-b954-c39d0046525b"
+ }
+ ]
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0bebb584/cloudsigma2/src/test/resources/fwpolicies-detail-last-page.json
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/test/resources/fwpolicies-detail-last-page.json b/cloudsigma2/src/test/resources/fwpolicies-detail-last-page.json
new file mode 100644
index 0000000..ffc324a
--- /dev/null
+++ b/cloudsigma2/src/test/resources/fwpolicies-detail-last-page.json
@@ -0,0 +1,79 @@
+{
+ "meta" : {
+ "limit": 1,
+ "offset": 1,
+ "total_count": 2
+ },
+ "objects": [
+ {
+ "meta": {
+ "description" : "test firewall policy"
+ },
+ "name": "My awesome policy",
+ "owner": {
+ "resource_uri": "/api/2.0/user/5b4a69a3-8e78-4c45-a8ba-8b13f0895e23/",
+ "uuid": "5b4a69a3-8e78-4c45-a8ba-8b13f0895e23"
+ },
+ "resource_uri": "/api/2.0/fwpolicies/cf8479b4-c98b-46c8-ab9c-108bb00c8218/",
+ "rules": [
+ {
+ "action": "drop",
+ "comment": "Drop traffic from the VM to IP address 23.0.0.0/32",
+ "direction": "out",
+ "dst_ip": "23.0.0.0/32",
+ "dst_port": null,
+ "ip_proto": null,
+ "src_ip": null,
+ "src_port": null
+ },
+ {
+ "action": "accept",
+ "comment": "Allow SSH traffic to the VM from our office in Dubai",
+ "direction": "in",
+ "dst_ip": null,
+ "dst_port": "22",
+ "ip_proto": "tcp",
+ "src_ip": "172.66.32.0/24",
+ "src_port": null
+ },
+ {
+ "action": "drop",
+ "comment": "Drop all other SSH traffic to the VM",
+ "direction": "in",
+ "dst_ip": null,
+ "dst_port": "22",
+ "ip_proto": "tcp",
+ "src_ip": null,
+ "src_port": null
+ },
+ {
+ "action": "drop",
+ "comment": "Drop all UDP traffic to the VM, not originating from 172.66.32.55",
+ "direction": "in",
+ "dst_ip": null,
+ "dst_port": null,
+ "ip_proto": "udp",
+ "src_ip": "!172.66.32.55/32",
+ "src_port": null
+ },
+ {
+ "action": "drop",
+ "comment": "Drop any traffic, to the VM with destination port not between 1-1024",
+ "direction": "in",
+ "dst_ip": null,
+ "dst_port": "!1:1024",
+ "ip_proto": "tcp",
+ "src_ip": null,
+ "src_port": null
+ }
+ ],
+ "servers": [
+ {
+ "uuid" : "81f911f9-5152-4328-8671-02543bafbd0e",
+ "resource_uri" : "/api/2.0/servers/81f911f9-5152-4328-8671-02543bafbd0e/"
+ }
+ ],
+ "uuid": "cf8479b4-c98b-46c8-ab9c-108bb00c8218"
+ }
+ ]
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0bebb584/cloudsigma2/src/test/resources/ips-last-page.json
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/test/resources/ips-last-page.json b/cloudsigma2/src/test/resources/ips-last-page.json
new file mode 100644
index 0000000..593fa47
--- /dev/null
+++ b/cloudsigma2/src/test/resources/ips-last-page.json
@@ -0,0 +1,28 @@
+{
+ "meta": {
+ "limit": 1,
+ "offset": 1,
+ "total_count": 2
+ },
+ "objects": [
+ {
+ "gateway": "185.12.5.1",
+ "meta": {},
+ "nameservers": [
+ "178.22.66.167",
+ "178.22.71.56",
+ "8.8.8.8"
+ ],
+ "netmask": 24,
+ "owner": {
+ "resource_uri": "/api/2.0/user/5b4a69a3-8e78-4c45-a8ba-8b13f0895e23/",
+ "uuid": "5b4a69a3-8e78-4c45-a8ba-8b13f0895e23"
+ },
+ "resource_uri": "/api/2.0/ips/185.12.5.233/",
+ "server": null,
+ "subscription": null,
+ "tags": [],
+ "uuid": "185.12.5.233"
+ }
+ ]
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0bebb584/cloudsigma2/src/test/resources/ips.json
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/test/resources/ips.json b/cloudsigma2/src/test/resources/ips.json
index 44004a0..df1e6d9 100644
--- a/cloudsigma2/src/test/resources/ips.json
+++ b/cloudsigma2/src/test/resources/ips.json
@@ -1,6 +1,6 @@
{
"meta": {
- "limit": 0,
+ "limit": 1,
"offset": 0,
"total_count": 2
},
@@ -28,25 +28,6 @@
},
"tags": [],
"uuid": "185.12.6.183"
- },
- {
- "gateway": "185.12.5.1",
- "meta": {},
- "nameservers": [
- "178.22.66.167",
- "178.22.71.56",
- "8.8.8.8"
- ],
- "netmask": 24,
- "owner": {
- "resource_uri": "/api/2.0/user/5b4a69a3-8e78-4c45-a8ba-8b13f0895e23/",
- "uuid": "5b4a69a3-8e78-4c45-a8ba-8b13f0895e23"
- },
- "resource_uri": "/api/2.0/ips/185.12.5.233/",
- "server": null,
- "subscription": null,
- "tags": [],
- "uuid": "185.12.5.233"
}
]
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0bebb584/cloudsigma2/src/test/resources/ledger-last-page.json
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/test/resources/ledger-last-page.json b/cloudsigma2/src/test/resources/ledger-last-page.json
new file mode 100644
index 0000000..208d592
--- /dev/null
+++ b/cloudsigma2/src/test/resources/ledger-last-page.json
@@ -0,0 +1,27 @@
+{
+ "meta": {
+ "limit": 2,
+ "offset": 2,
+ "total_count": 4
+ },
+ "objects": [
+ {
+ "amount": "0.00173818150273075810",
+ "billing_cycle": 68843,
+ "end": "128.20524192865676349824",
+ "id": "11042661",
+ "initial": "128.20698011015949425634",
+ "reason": "Burst: 57783091200 of dssd for 299 seconds at 2013-07-09 07:39:06+00:00",
+ "time": "2013-07-09T07:40:05+00:00"
+ },
+ {
+ "amount": "0.00174399481879340278",
+ "billing_cycle": 68843,
+ "end": "128.20698011015949425634",
+ "id": "11042660",
+ "initial": "128.20872410497828765912",
+ "reason": "Burst: 57783091200 of dssd for 300 seconds at 2013-07-09 07:34:06+00:00",
+ "time": "2013-07-09T07:40:04+00:00"
+ }
+ ]
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0bebb584/cloudsigma2/src/test/resources/ledger.json
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/test/resources/ledger.json b/cloudsigma2/src/test/resources/ledger.json
index efe75eb..8eb236e 100644
--- a/cloudsigma2/src/test/resources/ledger.json
+++ b/cloudsigma2/src/test/resources/ledger.json
@@ -1,10 +1,8 @@
{
"meta": {
- "limit": 20,
- "next": "/api/2.0/ledger/?limit=20&offset=20",
+ "limit": 2,
"offset": 0,
- "previous": null,
- "total_count": 9921
+ "total_count": 4
},
"objects": [
{
@@ -24,24 +22,6 @@
"initial": "128.20524192865676349824",
"reason": "Burst: 57783091200 of dssd for 300 seconds at 2013-07-09 07:44:06+00:00",
"time": "2013-07-09T07:49:54+00:00"
- },
- {
- "amount": "0.00173818150273075810",
- "billing_cycle": 68843,
- "end": "128.20524192865676349824",
- "id": "11042661",
- "initial": "128.20698011015949425634",
- "reason": "Burst: 57783091200 of dssd for 299 seconds at 2013-07-09 07:39:06+00:00",
- "time": "2013-07-09T07:40:05+00:00"
- },
- {
- "amount": "0.00174399481879340278",
- "billing_cycle": 68843,
- "end": "128.20698011015949425634",
- "id": "11042660",
- "initial": "128.20872410497828765912",
- "reason": "Burst: 57783091200 of dssd for 300 seconds at 2013-07-09 07:34:06+00:00",
- "time": "2013-07-09T07:40:04+00:00"
}
]
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0bebb584/cloudsigma2/src/test/resources/libdrives-last-page.json
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/test/resources/libdrives-last-page.json b/cloudsigma2/src/test/resources/libdrives-last-page.json
new file mode 100644
index 0000000..11f1c04
--- /dev/null
+++ b/cloudsigma2/src/test/resources/libdrives-last-page.json
@@ -0,0 +1,36 @@
+{
+ "meta": {
+ "limit": 1,
+ "offset": 2,
+ "total_count": 3
+ },
+ "objects": [
+ {
+ "affinities": [],
+ "allow_multimount": false,
+ "arch": "64",
+ "category": [
+ "general"
+ ],
+ "description": "",
+ "favourite": true,
+ "image_type": "install",
+ "install_notes": "",
+ "jobs": [],
+ "licenses": [],
+ "media": "cdrom",
+ "meta": {},
+ "mounted_on": [],
+ "name": "Windows_Server_2003_r2_standard_x64_with_sp2_cd1.iso pub",
+ "os": "windows",
+ "owner": null,
+ "paid": false,
+ "resource_uri": "/api/2.0/libdrives/dd9da460-b1ab-419a-9fa1-804540eee4c3/",
+ "size": 1000000000,
+ "status": "unmounted",
+ "tags": [],
+ "url": "test_url",
+ "uuid": "dd9da460-b1ab-419a-9fa1-804540eee4c3"
+ }
+ ]
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0bebb584/cloudsigma2/src/test/resources/libdrives.json
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/test/resources/libdrives.json b/cloudsigma2/src/test/resources/libdrives.json
index 78bcccf..79782ed 100644
--- a/cloudsigma2/src/test/resources/libdrives.json
+++ b/cloudsigma2/src/test/resources/libdrives.json
@@ -1,10 +1,8 @@
{
"meta": {
- "limit": 3,
- "next": "/api/2.0/libdrives/?limit=5&offset=5",
+ "limit": 2,
"offset": 0,
- "previous": null,
- "total_count": 97
+ "total_count": 3
},
"objects": [
{
@@ -63,33 +61,6 @@
"tags": [],
"url": "test_url",
"uuid": "d1ec9f26-ba44-4002-bbdf-82a31a84b611"
- },
- {
- "affinities": [],
- "allow_multimount": false,
- "arch": "64",
- "category": [
- "general"
- ],
- "description": "",
- "favourite": true,
- "image_type": "install",
- "install_notes": "",
- "jobs": [],
- "licenses": [],
- "media": "cdrom",
- "meta": {},
- "mounted_on": [],
- "name": "Windows_Server_2003_r2_standard_x64_with_sp2_cd1.iso pub",
- "os": "windows",
- "owner": null,
- "paid": false,
- "resource_uri": "/api/2.0/libdrives/dd9da460-b1ab-419a-9fa1-804540eee4c3/",
- "size": 1000000000,
- "status": "unmounted",
- "tags": [],
- "url": "test_url",
- "uuid": "dd9da460-b1ab-419a-9fa1-804540eee4c3"
}
]
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0bebb584/cloudsigma2/src/test/resources/licences-last-page.json
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/test/resources/licences-last-page.json b/cloudsigma2/src/test/resources/licences-last-page.json
new file mode 100644
index 0000000..189ed41
--- /dev/null
+++ b/cloudsigma2/src/test/resources/licences-last-page.json
@@ -0,0 +1,17 @@
+{
+ "meta": {
+ "limit": 1,
+ "offset": 2,
+ "total_count": 3
+ },
+ "objects": [
+ {
+ "burstable": false,
+ "long_name": "SQL Server Standard 2008",
+ "name": "msft_tfa_00009",
+ "resource_uri": "/api/2.0/licenses/11/",
+ "type": "instance",
+ "user_metric": ""
+ }
+ ]
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0bebb584/cloudsigma2/src/test/resources/licences.json
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/test/resources/licences.json b/cloudsigma2/src/test/resources/licences.json
index 2b210a7..b18af11 100644
--- a/cloudsigma2/src/test/resources/licences.json
+++ b/cloudsigma2/src/test/resources/licences.json
@@ -1,9 +1,7 @@
{
"meta": {
- "limit": 20,
- "next": null,
+ "limit": 2,
"offset": 0,
- "previous": null,
"total_count": 3
},
"objects": [
@@ -22,14 +20,6 @@
"resource_uri": "/api/2.0/licenses/10/",
"type": "instance",
"user_metric": ""
- },
- {
- "burstable": false,
- "long_name": "SQL Server Standard 2008",
- "name": "msft_tfa_00009",
- "resource_uri": "/api/2.0/licenses/11/",
- "type": "instance",
- "user_metric": ""
}
]
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0bebb584/cloudsigma2/src/test/resources/server-detail-first-page.json
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/test/resources/server-detail-first-page.json b/cloudsigma2/src/test/resources/server-detail-first-page.json
new file mode 100644
index 0000000..275a9a2
--- /dev/null
+++ b/cloudsigma2/src/test/resources/server-detail-first-page.json
@@ -0,0 +1,96 @@
+{
+ "meta": {
+ "limit": 2,
+ "offset": 0,
+ "total_count": 3
+ },
+ "objects": [
+ {
+ "cpu": 1000,
+ "cpus_instead_of_cores": false,
+ "drives": [
+ {
+ "boot_order": null,
+ "dev_channel": "0:0",
+ "device": "ide",
+ "drive": {
+ "resource_uri": "/api/2.0/drives/ae78e68c-9daa-4471-8878-0bb87fa80260/",
+ "uuid": "ae78e68c-9daa-4471-8878-0bb87fa80260"
+ }
+ },
+ {
+ "boot_order": 1,
+ "dev_channel": "0:0",
+ "device": "virtio",
+ "drive": {
+ "resource_uri": "/api/2.0/drives/22826af4-d6c8-4d39-bd41-9cea86df2976/",
+ "uuid": "22826af4-d6c8-4d39-bd41-9cea86df2976"
+ }
+ }
+ ],
+ "enable_numa": false,
+ "hv_relaxed": false,
+ "hv_tsc": false,
+ "mem": 268435456,
+ "meta": {
+ "description": "A full server with description"
+ },
+ "name": "test_acc_full_server",
+ "nics": [
+ {
+ "boot_order": null,
+ "firewall_policy": null,
+ "ip_v4_conf": {
+ "conf": "dhcp",
+ "ip": null
+ },
+ "ip_v6_conf": null,
+ "mac": "22:a7:a0:0d:43:48",
+ "model": "virtio",
+ "runtime": null,
+ "vlan": null
+ }
+ ],
+ "owner": {
+ "resource_uri": "/api/2.0/user/5b4a69a3-8e78-4c45-a8ba-8b13f0895e23/",
+ "uuid": "5b4a69a3-8e78-4c45-a8ba-8b13f0895e23"
+ },
+ "requirements": [],
+ "resource_uri": "/api/2.0/servers/a19a425f-9e92-42f6-89fb-6361203071bb/",
+ "runtime": null,
+ "smp": 1,
+ "status": "stopped",
+ "tags": [
+ "tag_uuid_1",
+ "tag_uuid_2"
+ ],
+ "uuid": "a19a425f-9e92-42f6-89fb-6361203071bb",
+ "vnc_password": "tester"
+ },
+ {
+ "cpu": 1000,
+ "cpus_instead_of_cores": false,
+ "drives": [],
+ "enable_numa": false,
+ "hv_relaxed": false,
+ "hv_tsc": false,
+ "mem": 536870912,
+ "meta": {},
+ "name": "test_server_3",
+ "nics": [],
+ "owner": {
+ "resource_uri": "/api/2.0/user/5b4a69a3-8e78-4c45-a8ba-8b13f0895e23/",
+ "uuid": "5b4a69a3-8e78-4c45-a8ba-8b13f0895e23"
+ },
+ "requirements": [],
+ "resource_uri": "/api/2.0/servers/61d61337-884b-4c87-b4de-f7f48f9cfc84/",
+ "runtime": null,
+ "smp": 1,
+ "status": "stopped",
+ "tags": [],
+ "uuid": "61d61337-884b-4c87-b4de-f7f48f9cfc84",
+ "vnc_password": "testserver"
+ }
+ ]
+}
+
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0bebb584/cloudsigma2/src/test/resources/server-detail-last-page.json
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/test/resources/server-detail-last-page.json b/cloudsigma2/src/test/resources/server-detail-last-page.json
new file mode 100644
index 0000000..9c450ff
--- /dev/null
+++ b/cloudsigma2/src/test/resources/server-detail-last-page.json
@@ -0,0 +1,34 @@
+{
+ "meta": {
+ "limit": 1,
+ "offset": 2,
+ "total_count": 3
+ },
+ "objects": [
+ {
+ "cpu": 1000,
+ "cpus_instead_of_cores": false,
+ "drives": [],
+ "enable_numa": false,
+ "hv_relaxed": false,
+ "hv_tsc": false,
+ "mem": 536870912,
+ "meta": {},
+ "name": "test_server_1",
+ "nics": [],
+ "owner": {
+ "resource_uri": "/api/2.0/user/5b4a69a3-8e78-4c45-a8ba-8b13f0895e23/",
+ "uuid": "5b4a69a3-8e78-4c45-a8ba-8b13f0895e23"
+ },
+ "requirements": [],
+ "resource_uri": "/api/2.0/servers/33e71c37-0d0a-4a3a-a1ea-dc7265c9a154/",
+ "runtime": null,
+ "smp": 1,
+ "status": "stopped",
+ "tags": [],
+ "uuid": "33e71c37-0d0a-4a3a-a1ea-dc7265c9a154",
+ "vnc_password": "testserver"
+ }
+ ]
+}
+
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0bebb584/cloudsigma2/src/test/resources/servers-last-page.json
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/test/resources/servers-last-page.json b/cloudsigma2/src/test/resources/servers-last-page.json
new file mode 100644
index 0000000..e3d25e7
--- /dev/null
+++ b/cloudsigma2/src/test/resources/servers-last-page.json
@@ -0,0 +1,20 @@
+{
+ "meta": {
+ "limit": 1,
+ "offset": 2,
+ "total_count": 3
+ },
+ "objects": [
+ {
+ "name": "test_server_2",
+ "owner": {
+ "resource_uri": "/api/2.0/user/5b4a69a3-8e78-4c45-a8ba-8b13f0895e23/",
+ "uuid": "5b4a69a3-8e78-4c45-a8ba-8b13f0895e23"
+ },
+ "resource_uri": "/api/2.0/servers/05c16b9a-f2f5-4da6-a1cb-b90722c32212/",
+ "runtime": null,
+ "status": "stopped",
+ "uuid": "05c16b9a-f2f5-4da6-a1cb-b90722c32212"
+ }
+ ]
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0bebb584/cloudsigma2/src/test/resources/servers.json
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/test/resources/servers.json b/cloudsigma2/src/test/resources/servers.json
index 8b42aee..0595423 100644
--- a/cloudsigma2/src/test/resources/servers.json
+++ b/cloudsigma2/src/test/resources/servers.json
@@ -1,6 +1,6 @@
{
"meta": {
- "limit": 0,
+ "limit": 2,
"offset": 0,
"total_count": 3
},
@@ -26,17 +26,6 @@
"runtime": null,
"status": "stopped",
"uuid": "33e71c37-0d0a-4a3a-a1ea-dc7265c9a154"
- },
- {
- "name": "test_server_2",
- "owner": {
- "resource_uri": "/api/2.0/user/5b4a69a3-8e78-4c45-a8ba-8b13f0895e23/",
- "uuid": "5b4a69a3-8e78-4c45-a8ba-8b13f0895e23"
- },
- "resource_uri": "/api/2.0/servers/05c16b9a-f2f5-4da6-a1cb-b90722c32212/",
- "runtime": null,
- "status": "stopped",
- "uuid": "05c16b9a-f2f5-4da6-a1cb-b90722c32212"
}
]
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0bebb584/cloudsigma2/src/test/resources/subscriptions-first-page.json
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/test/resources/subscriptions-first-page.json b/cloudsigma2/src/test/resources/subscriptions-first-page.json
new file mode 100644
index 0000000..46091fa
--- /dev/null
+++ b/cloudsigma2/src/test/resources/subscriptions-first-page.json
@@ -0,0 +1,47 @@
+{
+ "meta": {
+ "limit": 2,
+ "offset": 0,
+ "total_count": 3
+ },
+ "objects": [
+ {
+ "amount": "1",
+ "auto_renew": true,
+ "descendants": [],
+ "discount_amount": "10",
+ "discount_percent": "10",
+ "end_time": "2014-02-20T11:12:34+00:00",
+ "id": "7272",
+ "last_notification": null,
+ "period": "345 days, 0:00:00",
+ "price": "0E-20",
+ "remaining": "1",
+ "resource": "vlan",
+ "resource_uri": "/api/2.0/subscriptions/7272/",
+ "start_time": "2013-03-12T11:12:34+00:00",
+ "status": "active",
+ "subscribed_object": "96537817-f4b6-496b-a861-e74192d3ccb0",
+ "uuid": "509f8e27-1e64-49bb-aa5a-baec074b0210"
+ },
+ {
+ "amount": "1",
+ "auto_renew": true,
+ "descendants": [],
+ "discount_amount": null,
+ "discount_percent": null,
+ "end_time": "2014-02-20T11:12:41+00:00",
+ "id": "7273",
+ "last_notification": null,
+ "period": "345 days, 0:00:00",
+ "price": "0E-20",
+ "remaining": "1",
+ "resource": "ip",
+ "resource_uri": "/api/2.0/subscriptions/7273/",
+ "start_time": "2013-03-12T11:12:41+00:00",
+ "status": "active",
+ "subscribed_object": "185.12.6.183",
+ "uuid": "c2423c1a-8768-462c-bdc3-4ca09c1e650b"
+ }
+ ]
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0bebb584/cloudsigma2/src/test/resources/subscriptions-last-page.json
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/test/resources/subscriptions-last-page.json b/cloudsigma2/src/test/resources/subscriptions-last-page.json
new file mode 100644
index 0000000..265051e
--- /dev/null
+++ b/cloudsigma2/src/test/resources/subscriptions-last-page.json
@@ -0,0 +1,28 @@
+{
+ "meta": {
+ "limit": 1,
+ "offset": 2,
+ "total_count": 3
+ },
+ "objects": [
+ {
+ "amount": "17179869184",
+ "auto_renew": true,
+ "descendants": [],
+ "discount_amount": null,
+ "discount_percent": null,
+ "end_time": "2014-02-20T14:04:14+00:00",
+ "id": "3985",
+ "last_notification": null,
+ "period": "365 days, 0:00:00",
+ "price": "0E-20",
+ "remaining": "17179869184",
+ "resource": "mem",
+ "resource_uri": "/api/2.0/subscriptions/3985/",
+ "start_time": "2013-02-20T14:04:14+00:00",
+ "status": "active",
+ "subscribed_object": null,
+ "uuid": "9bb117d3-4bc5-4e2d-a907-b20abd48eaf9"
+ }
+ ]
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0bebb584/cloudsigma2/src/test/resources/tags-detail-first-page.json
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/test/resources/tags-detail-first-page.json b/cloudsigma2/src/test/resources/tags-detail-first-page.json
new file mode 100644
index 0000000..0411e7d
--- /dev/null
+++ b/cloudsigma2/src/test/resources/tags-detail-first-page.json
@@ -0,0 +1,20 @@
+{
+ "meta": {
+ "limit": 1,
+ "offset": 0,
+ "total_count": 2
+ },
+ "objects": [
+ {
+ "meta": {},
+ "name": "new tag",
+ "owner": {
+ "resource_uri": "/api/2.0/user/5b4a69a3-8e78-4c45-a8ba-8b13f0895e23/",
+ "uuid": "5b4a69a3-8e78-4c45-a8ba-8b13f0895e23"
+ },
+ "resource_uri": "/api/2.0/tags/956e2ca0-dee3-4b3f-a1be-a6e86f90946f/",
+ "resources": [],
+ "uuid": "956e2ca0-dee3-4b3f-a1be-a6e86f90946f"
+ },
+ ]
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0bebb584/cloudsigma2/src/test/resources/tags-detail-last-page.json
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/test/resources/tags-detail-last-page.json b/cloudsigma2/src/test/resources/tags-detail-last-page.json
new file mode 100644
index 0000000..b1c53cb
--- /dev/null
+++ b/cloudsigma2/src/test/resources/tags-detail-last-page.json
@@ -0,0 +1,59 @@
+{
+ "meta": {
+ "limit": 1,
+ "offset": 1,
+ "total_count": 2
+ },
+ "objects": [
+ {
+ "meta": {
+ "description": "test tag"
+ },
+ "name": "TagCreatedWithResource",
+ "owner": {
+ "resource_uri": "/api/2.0/user/5b4a69a3-8e78-4c45-a8ba-8b13f0895e23/",
+ "uuid": "5b4a69a3-8e78-4c45-a8ba-8b13f0895e23"
+ },
+ "resource_uri": "/api/2.0/tags/68bb0cfc-0c76-4f37-847d-7bb705c5ae46/",
+ "resources": [
+ {
+ "owner": {
+ "resource_uri": "/api/2.0/user/5b4a69a3-8e78-4c45-a8ba-8b13f0895e23/",
+ "uuid": "5b4a69a3-8e78-4c45-a8ba-8b13f0895e23"
+ },
+ "res_type": "vlans",
+ "resource_uri": "/api/2.0/vlans/96537817-f4b6-496b-a861-e74192d3ccb0/",
+ "uuid": "96537817-f4b6-496b-a861-e74192d3ccb0"
+ },
+ {
+ "owner": {
+ "resource_uri": "/api/2.0/user/5b4a69a3-8e78-4c45-a8ba-8b13f0895e23/",
+ "uuid": "5b4a69a3-8e78-4c45-a8ba-8b13f0895e23"
+ },
+ "res_type": "servers",
+ "resource_uri": "/api/2.0/servers/61bcc398-c034-42f1-81c9-f6d7f62c4ea0/",
+ "uuid": "61bcc398-c034-42f1-81c9-f6d7f62c4ea0"
+ },
+ {
+ "owner": {
+ "resource_uri": "/api/2.0/user/5b4a69a3-8e78-4c45-a8ba-8b13f0895e23/",
+ "uuid": "5b4a69a3-8e78-4c45-a8ba-8b13f0895e23"
+ },
+ "res_type": "drives",
+ "resource_uri": "/api/2.0/drives/3610d935-514a-4552-acf3-a40dd0a5f961/",
+ "uuid": "3610d935-514a-4552-acf3-a40dd0a5f961"
+ },
+ {
+ "owner": {
+ "resource_uri": "/api/2.0/user/5b4a69a3-8e78-4c45-a8ba-8b13f0895e23/",
+ "uuid": "5b4a69a3-8e78-4c45-a8ba-8b13f0895e23"
+ },
+ "res_type": "ips",
+ "resource_uri": "/api/2.0/ips/185.12.6.183/",
+ "uuid": "185.12.6.183"
+ }
+ ],
+ "uuid": "68bb0cfc-0c76-4f37-847d-7bb705c5ae46"
+ }
+ ]
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0bebb584/cloudsigma2/src/test/resources/vlans-last-page.json
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/test/resources/vlans-last-page.json b/cloudsigma2/src/test/resources/vlans-last-page.json
new file mode 100644
index 0000000..899290d
--- /dev/null
+++ b/cloudsigma2/src/test/resources/vlans-last-page.json
@@ -0,0 +1,21 @@
+{
+ "meta": {
+ "limit": 1,
+ "offset": 1,
+ "total_count": 2
+ },
+ "objects": [
+ {
+ "meta": {},
+ "owner": {
+ "resource_uri": "/api/2.0/user/5b4a69a3-8e78-4c45-a8ba-8b13f0895e23/",
+ "uuid": "5b4a69a3-8e78-4c45-a8ba-8b13f0895e23"
+ },
+ "resource_uri": "/api/2.0/vlans/00b445a9-3936-47e5-ba8a-38adcf43db20/",
+ "servers": [],
+ "subscription": null,
+ "tags": [],
+ "uuid": "00b445a9-3936-47e5-ba8a-38adcf43db20"
+ }
+ ]
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0bebb584/cloudsigma2/src/test/resources/vlans.json
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/test/resources/vlans.json b/cloudsigma2/src/test/resources/vlans.json
index 3b0feab..b067e10 100644
--- a/cloudsigma2/src/test/resources/vlans.json
+++ b/cloudsigma2/src/test/resources/vlans.json
@@ -1,6 +1,6 @@
{
"meta": {
- "limit": 0,
+ "limit": 1,
"offset": 0,
"total_count": 2
},
@@ -30,18 +30,6 @@
},
"tags": [],
"uuid": "96537817-f4b6-496b-a861-e74192d3ccb0"
- },
- {
- "meta": {},
- "owner": {
- "resource_uri": "/api/2.0/user/5b4a69a3-8e78-4c45-a8ba-8b13f0895e23/",
- "uuid": "5b4a69a3-8e78-4c45-a8ba-8b13f0895e23"
- },
- "resource_uri": "/api/2.0/vlans/00b445a9-3936-47e5-ba8a-38adcf43db20/",
- "servers": [],
- "subscription": null,
- "tags": [],
- "uuid": "00b445a9-3936-47e5-ba8a-38adcf43db20"
}
]
}
\ No newline at end of file
[04/13] Fix code style of the cloudsigma2 provider.
Posted by na...@apache.org.
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0d70c84a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/internal/ParseServers.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/internal/ParseServers.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/internal/ParseServers.java
index 4de20fa..2803c3b 100644
--- a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/internal/ParseServers.java
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/internal/ParseServers.java
@@ -38,37 +38,37 @@ import java.util.List;
@Singleton
public class ParseServers extends ParseJson<ParseServers.Servers> {
- static class Servers extends PaginatedCollection<Server>{
+ static class Servers extends PaginatedCollection<Server> {
- @ConstructorProperties({"objects", "meta"})
- public Servers(Iterable<Server> objects, PaginationOptions paginationOptions) {
- super(objects, paginationOptions);
- }
- }
+ @ConstructorProperties({"objects", "meta"})
+ public Servers(Iterable<Server> objects, PaginationOptions paginationOptions) {
+ super(objects, paginationOptions);
+ }
+ }
- @Inject
- public ParseServers(Json json) {
- super(json, TypeLiteral.get(Servers.class));
- }
+ @Inject
+ public ParseServers(Json json) {
+ super(json, TypeLiteral.get(Servers.class));
+ }
- public static class ToPagedIterable extends ArgsToPagedIterable<Server, ToPagedIterable> {
+ public static class ToPagedIterable extends ArgsToPagedIterable<Server, ToPagedIterable> {
- private CloudSigma2Api api;
+ private CloudSigma2Api api;
- @Inject
- public ToPagedIterable(CloudSigma2Api api) {
- this.api = api;
- }
+ @Inject
+ public ToPagedIterable(CloudSigma2Api api) {
+ this.api = api;
+ }
- @Override
- protected Function<Object, IterableWithMarker<Server>> markerToNextForArgs(List<Object> args) {
- return new Function<Object, IterableWithMarker<Server>>() {
- @Override
- public IterableWithMarker<Server> apply(Object input) {
- PaginationOptions paginationOptions = PaginationOptions.class.cast(input);
- return api.listServers(paginationOptions);
- }
- };
- }
- }
+ @Override
+ protected Function<Object, IterableWithMarker<Server>> markerToNextForArgs(List<Object> args) {
+ return new Function<Object, IterableWithMarker<Server>>() {
+ @Override
+ public IterableWithMarker<Server> apply(Object input) {
+ PaginationOptions paginationOptions = PaginationOptions.class.cast(input);
+ return api.listServers(paginationOptions);
+ }
+ };
+ }
+ }
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0d70c84a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/internal/ParseSubscriptions.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/internal/ParseSubscriptions.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/internal/ParseSubscriptions.java
index c8d4895..847f281 100644
--- a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/internal/ParseSubscriptions.java
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/internal/ParseSubscriptions.java
@@ -37,59 +37,59 @@ import java.util.List;
* @author Vladimir Shevchenko
*/
@Singleton
-public class ParseSubscriptions extends ParseJson<ParseSubscriptions.Subscriptions>{
- static class Subscriptions extends PaginatedCollection<Subscription> {
+public class ParseSubscriptions extends ParseJson<ParseSubscriptions.Subscriptions> {
+ static class Subscriptions extends PaginatedCollection<Subscription> {
- @ConstructorProperties({"objects", "meta"})
- public Subscriptions(Iterable<Subscription> objects, PaginationOptions paginationOptions) {
- super(objects, paginationOptions);
- }
- }
+ @ConstructorProperties({"objects", "meta"})
+ public Subscriptions(Iterable<Subscription> objects, PaginationOptions paginationOptions) {
+ super(objects, paginationOptions);
+ }
+ }
- @Inject
- public ParseSubscriptions(Json json) {
- super(json, TypeLiteral.get(Subscriptions.class));
- }
+ @Inject
+ public ParseSubscriptions(Json json) {
+ super(json, TypeLiteral.get(Subscriptions.class));
+ }
- public static class ToPagedIterable extends ArgsToPagedIterable<Subscription, ToPagedIterable> {
+ public static class ToPagedIterable extends ArgsToPagedIterable<Subscription, ToPagedIterable> {
- private CloudSigma2Api api;
+ private CloudSigma2Api api;
- @Inject
- public ToPagedIterable(CloudSigma2Api api) {
- this.api = api;
- }
+ @Inject
+ public ToPagedIterable(CloudSigma2Api api) {
+ this.api = api;
+ }
- @Override
- protected Function<Object, IterableWithMarker<Subscription>> markerToNextForArgs(List<Object> args) {
- return new Function<Object, IterableWithMarker<Subscription>>() {
- @Override
- public IterableWithMarker<Subscription> apply(Object input) {
- PaginationOptions paginationOptions = PaginationOptions.class.cast(input);
- return api.listSubscriptions(paginationOptions);
- }
- };
- }
- }
+ @Override
+ protected Function<Object, IterableWithMarker<Subscription>> markerToNextForArgs(List<Object> args) {
+ return new Function<Object, IterableWithMarker<Subscription>>() {
+ @Override
+ public IterableWithMarker<Subscription> apply(Object input) {
+ PaginationOptions paginationOptions = PaginationOptions.class.cast(input);
+ return api.listSubscriptions(paginationOptions);
+ }
+ };
+ }
+ }
- public static class ToPagedIterableCalculator extends ArgsToPagedIterable<Subscription, ToPagedIterable> {
+ public static class ToPagedIterableCalculator extends ArgsToPagedIterable<Subscription, ToPagedIterable> {
- private CloudSigma2Api api;
+ private CloudSigma2Api api;
- @Inject
- public ToPagedIterableCalculator(CloudSigma2Api api) {
- this.api = api;
- }
+ @Inject
+ public ToPagedIterableCalculator(CloudSigma2Api api) {
+ this.api = api;
+ }
- @Override
- protected Function<Object, IterableWithMarker<Subscription>> markerToNextForArgs(List<Object> args) {
- return new Function<Object, IterableWithMarker<Subscription>>() {
- @Override
- public IterableWithMarker<Subscription> apply(@Nullable Object input) {
- PaginationOptions paginationOptions = PaginationOptions.class.cast(input);
- return api.listSubscriptionsCalculator(paginationOptions);
- }
- };
- }
- }
+ @Override
+ protected Function<Object, IterableWithMarker<Subscription>> markerToNextForArgs(List<Object> args) {
+ return new Function<Object, IterableWithMarker<Subscription>>() {
+ @Override
+ public IterableWithMarker<Subscription> apply(@Nullable Object input) {
+ PaginationOptions paginationOptions = PaginationOptions.class.cast(input);
+ return api.listSubscriptionsCalculator(paginationOptions);
+ }
+ };
+ }
+ }
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0d70c84a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/internal/ParseTags.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/internal/ParseTags.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/internal/ParseTags.java
index 5757fa1..b6fa41b 100644
--- a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/internal/ParseTags.java
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/internal/ParseTags.java
@@ -37,58 +37,58 @@ import java.util.List;
*/
@Singleton
public class ParseTags extends ParseJson<ParseTags.Tags> {
- static class Tags extends PaginatedCollection<Tag> {
+ static class Tags extends PaginatedCollection<Tag> {
- @ConstructorProperties({"objects", "meta"})
- public Tags(Iterable<Tag> objects, PaginationOptions paginationOptions) {
- super(objects, paginationOptions);
- }
- }
+ @ConstructorProperties({"objects", "meta"})
+ public Tags(Iterable<Tag> objects, PaginationOptions paginationOptions) {
+ super(objects, paginationOptions);
+ }
+ }
- @Inject
- public ParseTags(Json json) {
- super(json, TypeLiteral.get(Tags.class));
- }
+ @Inject
+ public ParseTags(Json json) {
+ super(json, TypeLiteral.get(Tags.class));
+ }
- public static class ToPagedIterable extends ArgsToPagedIterable<Tag, ToPagedIterable> {
+ public static class ToPagedIterable extends ArgsToPagedIterable<Tag, ToPagedIterable> {
- private CloudSigma2Api api;
+ private CloudSigma2Api api;
- @Inject
- public ToPagedIterable(CloudSigma2Api api) {
- this.api = api;
- }
+ @Inject
+ public ToPagedIterable(CloudSigma2Api api) {
+ this.api = api;
+ }
- @Override
- protected Function<Object, IterableWithMarker<Tag>> markerToNextForArgs(List<Object> args) {
- return new Function<Object, IterableWithMarker<Tag>>() {
- @Override
- public IterableWithMarker<Tag> apply(Object input) {
- PaginationOptions paginationOptions = PaginationOptions.class.cast(input);
- return api.listTags(paginationOptions);
- }
- };
- }
- }
+ @Override
+ protected Function<Object, IterableWithMarker<Tag>> markerToNextForArgs(List<Object> args) {
+ return new Function<Object, IterableWithMarker<Tag>>() {
+ @Override
+ public IterableWithMarker<Tag> apply(Object input) {
+ PaginationOptions paginationOptions = PaginationOptions.class.cast(input);
+ return api.listTags(paginationOptions);
+ }
+ };
+ }
+ }
- public static class ToPagedIterableInfo extends ArgsToPagedIterable<Tag, ToPagedIterable> {
+ public static class ToPagedIterableInfo extends ArgsToPagedIterable<Tag, ToPagedIterable> {
- private CloudSigma2Api api;
+ private CloudSigma2Api api;
- @Inject
- public ToPagedIterableInfo(CloudSigma2Api api) {
- this.api = api;
- }
+ @Inject
+ public ToPagedIterableInfo(CloudSigma2Api api) {
+ this.api = api;
+ }
- @Override
- protected Function<Object, IterableWithMarker<Tag>> markerToNextForArgs(List<Object> args) {
- return new Function<Object, IterableWithMarker<Tag>>() {
- @Override
- public IterableWithMarker<Tag> apply(Object input) {
- PaginationOptions paginationOptions = PaginationOptions.class.cast(input);
- return api.listTagsInfo(paginationOptions);
- }
- };
- }
- }
+ @Override
+ protected Function<Object, IterableWithMarker<Tag>> markerToNextForArgs(List<Object> args) {
+ return new Function<Object, IterableWithMarker<Tag>>() {
+ @Override
+ public IterableWithMarker<Tag> apply(Object input) {
+ PaginationOptions paginationOptions = PaginationOptions.class.cast(input);
+ return api.listTagsInfo(paginationOptions);
+ }
+ };
+ }
+ }
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0d70c84a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/internal/ParseTransactions.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/internal/ParseTransactions.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/internal/ParseTransactions.java
index 4d51701..9ae885d 100644
--- a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/internal/ParseTransactions.java
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/internal/ParseTransactions.java
@@ -37,37 +37,37 @@ import java.util.List;
*/
@Singleton
public class ParseTransactions extends ParseJson<ParseTransactions.Transactions> {
- static class Transactions extends PaginatedCollection<Transaction> {
+ static class Transactions extends PaginatedCollection<Transaction> {
- @ConstructorProperties({"objects", "meta"})
- public Transactions(Iterable<Transaction> objects, PaginationOptions paginationOptions) {
- super(objects, paginationOptions);
- }
- }
+ @ConstructorProperties({"objects", "meta"})
+ public Transactions(Iterable<Transaction> objects, PaginationOptions paginationOptions) {
+ super(objects, paginationOptions);
+ }
+ }
- @Inject
- public ParseTransactions(Json json) {
- super(json, TypeLiteral.get(Transactions.class));
- }
+ @Inject
+ public ParseTransactions(Json json) {
+ super(json, TypeLiteral.get(Transactions.class));
+ }
- public static class ToPagedIterable extends ArgsToPagedIterable<Transaction, ToPagedIterable> {
+ public static class ToPagedIterable extends ArgsToPagedIterable<Transaction, ToPagedIterable> {
- private CloudSigma2Api api;
+ private CloudSigma2Api api;
- @Inject
- public ToPagedIterable(CloudSigma2Api api) {
- this.api = api;
- }
+ @Inject
+ public ToPagedIterable(CloudSigma2Api api) {
+ this.api = api;
+ }
- @Override
- protected Function<Object, IterableWithMarker<Transaction>> markerToNextForArgs(List<Object> args) {
- return new Function<Object, IterableWithMarker<Transaction>>() {
- @Override
- public IterableWithMarker<Transaction> apply(Object input) {
- PaginationOptions paginationOptions = PaginationOptions.class.cast(input);
- return api.listTransactions(paginationOptions);
- }
- };
- }
- }
+ @Override
+ protected Function<Object, IterableWithMarker<Transaction>> markerToNextForArgs(List<Object> args) {
+ return new Function<Object, IterableWithMarker<Transaction>>() {
+ @Override
+ public IterableWithMarker<Transaction> apply(Object input) {
+ PaginationOptions paginationOptions = PaginationOptions.class.cast(input);
+ return api.listTransactions(paginationOptions);
+ }
+ };
+ }
+ }
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0d70c84a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/internal/ParseVLANs.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/internal/ParseVLANs.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/internal/ParseVLANs.java
index c04d22c..acf084b 100644
--- a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/internal/ParseVLANs.java
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/internal/ParseVLANs.java
@@ -37,58 +37,58 @@ import java.util.List;
*/
@Singleton
public class ParseVLANs extends ParseJson<ParseVLANs.VLANs> {
- static class VLANs extends PaginatedCollection<VLANInfo> {
+ static class VLANs extends PaginatedCollection<VLANInfo> {
- @ConstructorProperties({"objects", "meta"})
- public VLANs(Iterable<VLANInfo> objects, PaginationOptions paginationOptions) {
- super(objects, paginationOptions);
- }
- }
+ @ConstructorProperties({"objects", "meta"})
+ public VLANs(Iterable<VLANInfo> objects, PaginationOptions paginationOptions) {
+ super(objects, paginationOptions);
+ }
+ }
- @Inject
- public ParseVLANs(Json json) {
- super(json, TypeLiteral.get(VLANs.class));
- }
+ @Inject
+ public ParseVLANs(Json json) {
+ super(json, TypeLiteral.get(VLANs.class));
+ }
- public static class ToPagedIterable extends ArgsToPagedIterable<VLANInfo, ToPagedIterable> {
+ public static class ToPagedIterable extends ArgsToPagedIterable<VLANInfo, ToPagedIterable> {
- private CloudSigma2Api api;
+ private CloudSigma2Api api;
- @Inject
- public ToPagedIterable(CloudSigma2Api api) {
- this.api = api;
- }
+ @Inject
+ public ToPagedIterable(CloudSigma2Api api) {
+ this.api = api;
+ }
- @Override
- protected Function<Object, IterableWithMarker<VLANInfo>> markerToNextForArgs(List<Object> args) {
- return new Function<Object, IterableWithMarker<VLANInfo>>() {
- @Override
- public IterableWithMarker<VLANInfo> apply(Object input) {
- PaginationOptions paginationOptions = PaginationOptions.class.cast(input);
- return api.listVLANs(paginationOptions);
- }
- };
- }
- }
+ @Override
+ protected Function<Object, IterableWithMarker<VLANInfo>> markerToNextForArgs(List<Object> args) {
+ return new Function<Object, IterableWithMarker<VLANInfo>>() {
+ @Override
+ public IterableWithMarker<VLANInfo> apply(Object input) {
+ PaginationOptions paginationOptions = PaginationOptions.class.cast(input);
+ return api.listVLANs(paginationOptions);
+ }
+ };
+ }
+ }
- public static class ToPagedIterableInfo extends ArgsToPagedIterable<VLANInfo, ToPagedIterable> {
+ public static class ToPagedIterableInfo extends ArgsToPagedIterable<VLANInfo, ToPagedIterable> {
- private CloudSigma2Api api;
+ private CloudSigma2Api api;
- @Inject
- public ToPagedIterableInfo(CloudSigma2Api api) {
- this.api = api;
- }
+ @Inject
+ public ToPagedIterableInfo(CloudSigma2Api api) {
+ this.api = api;
+ }
- @Override
- protected Function<Object, IterableWithMarker<VLANInfo>> markerToNextForArgs(List<Object> args) {
- return new Function<Object, IterableWithMarker<VLANInfo>>() {
- @Override
- public IterableWithMarker<VLANInfo> apply(Object input) {
- PaginationOptions paginationOptions = PaginationOptions.class.cast(input);
- return api.listVLANInfo(paginationOptions);
- }
- };
- }
- }
+ @Override
+ protected Function<Object, IterableWithMarker<VLANInfo>> markerToNextForArgs(List<Object> args) {
+ return new Function<Object, IterableWithMarker<VLANInfo>>() {
+ @Override
+ public IterableWithMarker<VLANInfo> apply(Object input) {
+ PaginationOptions paginationOptions = PaginationOptions.class.cast(input);
+ return api.listVLANInfo(paginationOptions);
+ }
+ };
+ }
+ }
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0d70c84a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/handlers/CloudSigmaErrorHandler.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/handlers/CloudSigmaErrorHandler.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/handlers/CloudSigmaErrorHandler.java
index 50b7f62..e97685d 100644
--- a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/handlers/CloudSigmaErrorHandler.java
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/handlers/CloudSigmaErrorHandler.java
@@ -33,13 +33,12 @@ import java.io.IOException;
/**
* This will parse and set an appropriate exception on the command object.
- *
+ * <p/>
* <p/>
* Errors are returned with an appropriate HTTP status code, an X-Elastic- Error header specifying
* the error type, and a text description in the HTTP body.
- *
+ *
* @author Vladimir Shevchenko
- *
*/
@Singleton
public class CloudSigmaErrorHandler implements HttpErrorHandler {
@@ -55,32 +54,32 @@ public class CloudSigmaErrorHandler implements HttpErrorHandler {
message = message != null ? message : String.format("%s -> %s", command.getCurrentRequest().getRequestLine(),
response.getStatusLine());
switch (response.getStatusCode()) {
- case 400:
- if ((command.getCurrentRequest().getEndpoint().getPath().endsWith("/info"))
- || (message != null && message.indexOf("could not be found") != -1))
- exception = new ResourceNotFoundException(message, exception);
- else if (message != null && message.indexOf("currently in use") != -1)
+ case 400:
+ if ((command.getCurrentRequest().getEndpoint().getPath().endsWith("/info"))
+ || (message != null && message.indexOf("could not be found") != -1))
+ exception = new ResourceNotFoundException(message, exception);
+ else if (message != null && message.indexOf("currently in use") != -1)
+ exception = new IllegalStateException(message, exception);
+ else
+ exception = new IllegalArgumentException(message, exception);
+ break;
+ case 401:
+ exception = new AuthorizationException(message, exception);
+ break;
+ case 402:
exception = new IllegalStateException(message, exception);
- else
+ break;
+ case 404:
+ if (!command.getCurrentRequest().getMethod().equals("DELETE")) {
+ exception = new ResourceNotFoundException(message, exception);
+ }
+ break;
+ case 405:
exception = new IllegalArgumentException(message, exception);
- break;
- case 401:
- exception = new AuthorizationException(message, exception);
- break;
- case 402:
- exception = new IllegalStateException(message, exception);
- break;
- case 404:
- if (!command.getCurrentRequest().getMethod().equals("DELETE")) {
- exception = new ResourceNotFoundException(message, exception);
- }
- break;
- case 405:
- exception = new IllegalArgumentException(message, exception);
- break;
- case 409:
- exception = new IllegalStateException(message, exception);
- break;
+ break;
+ case 409:
+ exception = new IllegalStateException(message, exception);
+ break;
}
} finally {
Closeables.closeQuietly(response.getPayload());
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0d70c84a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/options/PaginationOptions.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/options/PaginationOptions.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/options/PaginationOptions.java
index 13e4463..46282f7 100644
--- a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/options/PaginationOptions.java
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/options/PaginationOptions.java
@@ -26,92 +26,92 @@ import java.beans.ConstructorProperties;
*/
public class PaginationOptions extends BaseHttpRequestOptions {
- public static class Builder{
- private int limit = PaginationOptions.DEFAULT_LIMIT;
- private int offset = 0;
-
- public Builder limit(int limit){
- this.limit = limit;
- return this;
- }
-
- public Builder offset(int offset){
- this.offset = offset;
- return this;
- }
-
- public PaginationOptions build() {
- if (limit < 0) {
- limit = PaginationOptions.DEFAULT_LIMIT;
- }
-
- if (offset < 0) {
- offset = 0;
- }
-
- PaginationOptions paginationOptions = new PaginationOptions(limit, offset, 0);
- paginationOptions.queryParameters.put("limit", String.valueOf(limit));
- paginationOptions.queryParameters.put("offset", String.valueOf(offset));
- return paginationOptions;
- }
- }
-
- public static final int DEFAULT_LIMIT = 20;
-
- private final int limit;
- private final int offset;
- @Named("total_count")
- private final int totalCount;
-
- @ConstructorProperties({"limit", "offset", "total_count"})
- public PaginationOptions(int limit, int offset, int totalCount) {
- this.limit = limit;
- this.offset = offset;
- this.totalCount = totalCount;
- }
-
- public int getTotalCount() {
- return totalCount;
- }
-
- public int getOffset() {
- return offset;
- }
-
- public int getLimit() {
- return limit;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (!(o instanceof PaginationOptions)) return false;
- if (!super.equals(o)) return false;
-
- PaginationOptions that = (PaginationOptions) o;
-
- if (limit != that.limit) return false;
- if (offset != that.offset) return false;
- if (totalCount != that.totalCount) return false;
-
- return true;
- }
-
- @Override
- public int hashCode() {
- int result = super.hashCode();
- result = 31 * result + limit;
- result = 31 * result + offset;
- result = 31 * result + totalCount;
- return result;
- }
-
- @Override
- public String toString() {
- return "PaginationOptions{" +
- "limit=" + limit +
- ", offset=" + offset +
- ", totalCount=" + totalCount +
- "} " + super.toString();
- }
+ public static class Builder {
+ private int limit = PaginationOptions.DEFAULT_LIMIT;
+ private int offset = 0;
+
+ public Builder limit(int limit) {
+ this.limit = limit;
+ return this;
+ }
+
+ public Builder offset(int offset) {
+ this.offset = offset;
+ return this;
+ }
+
+ public PaginationOptions build() {
+ if (limit < 0) {
+ limit = PaginationOptions.DEFAULT_LIMIT;
+ }
+
+ if (offset < 0) {
+ offset = 0;
+ }
+
+ PaginationOptions paginationOptions = new PaginationOptions(limit, offset, 0);
+ paginationOptions.queryParameters.put("limit", String.valueOf(limit));
+ paginationOptions.queryParameters.put("offset", String.valueOf(offset));
+ return paginationOptions;
+ }
+ }
+
+ public static final int DEFAULT_LIMIT = 20;
+
+ private final int limit;
+ private final int offset;
+ @Named("total_count")
+ private final int totalCount;
+
+ @ConstructorProperties({"limit", "offset", "total_count"})
+ public PaginationOptions(int limit, int offset, int totalCount) {
+ this.limit = limit;
+ this.offset = offset;
+ this.totalCount = totalCount;
+ }
+
+ public int getTotalCount() {
+ return totalCount;
+ }
+
+ public int getOffset() {
+ return offset;
+ }
+
+ public int getLimit() {
+ return limit;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (!(o instanceof PaginationOptions)) return false;
+ if (!super.equals(o)) return false;
+
+ PaginationOptions that = (PaginationOptions) o;
+
+ if (limit != that.limit) return false;
+ if (offset != that.offset) return false;
+ if (totalCount != that.totalCount) return false;
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = super.hashCode();
+ result = 31 * result + limit;
+ result = 31 * result + offset;
+ result = 31 * result + totalCount;
+ return result;
+ }
+
+ @Override
+ public String toString() {
+ return "PaginationOptions{" +
+ "limit=" + limit +
+ ", offset=" + offset +
+ ", totalCount=" + totalCount +
+ "} " + super.toString();
+ }
}
[09/13] Fix code style of the cloudsigma2 provider.
Posted by na...@apache.org.
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0d70c84a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/Drive.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/Drive.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/Drive.java
index 13db449..744949a 100644
--- a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/Drive.java
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/Drive.java
@@ -27,148 +27,149 @@ import java.net.URI;
*/
public class Drive extends Item {
- public static class Builder extends Item.Builder {
- protected Owner owner;
- protected DriveStatus status = DriveStatus.UNMOUNTED;
-
- /**
- * @param owner Owner of the drive
- * @return Drive Builder
- */
- public Builder owner(Owner owner) {
- this.owner = owner;
- return this;
- }
-
- /**
- * @param status Status of the drive
- * @return Drive Builder
- */
- public Builder status(DriveStatus status) {
- this.status = status;
- return this;
- }
-
- /**
- * @param uuid UUID of the drive
- * @return Drive Builder
- */
- @Override
- public Builder uuid(String uuid) {
- return Builder.class.cast(super.uuid(uuid));
- }
-
- /**
- * @param name Human readable name of the drive
- * @return Drive Builder
- */
- @Override
- public Builder name(String name) {
- return Builder.class.cast(super.name(name));
- }
-
- /**
- * @return Drive Builder
- */
- @Override
- public Builder resourceUri(URI resourceUri) {
- return Builder.class.cast(super.resourceUri(resourceUri));
- }
-
- public Drive build() {
- return new Drive(uuid, name, resourceUri, owner, status);
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((name == null) ? 0 : name.hashCode());
- result = prime * result + ((owner == null) ? 0 : owner.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- Drive other = (Drive) obj;
- if (owner != other.owner)
- return false;
- if (!Objects.equal(status, other.status))
- return false;
- if (!Objects.equal(name, other.name))
- return false;
+ public static class Builder extends Item.Builder {
+ protected Owner owner;
+ protected DriveStatus status = DriveStatus.UNMOUNTED;
+
+ /**
+ * @param owner Owner of the drive
+ * @return Drive Builder
+ */
+ public Builder owner(Owner owner) {
+ this.owner = owner;
+ return this;
+ }
+
+ /**
+ * @param status Status of the drive
+ * @return Drive Builder
+ */
+ public Builder status(DriveStatus status) {
+ this.status = status;
+ return this;
+ }
+
+ /**
+ * @param uuid UUID of the drive
+ * @return Drive Builder
+ */
+ @Override
+ public Builder uuid(String uuid) {
+ return Builder.class.cast(super.uuid(uuid));
+ }
+
+ /**
+ * @param name Human readable name of the drive
+ * @return Drive Builder
+ */
+ @Override
+ public Builder name(String name) {
+ return Builder.class.cast(super.name(name));
+ }
+
+ /**
+ * @return Drive Builder
+ */
+ @Override
+ public Builder resourceUri(URI resourceUri) {
+ return Builder.class.cast(super.resourceUri(resourceUri));
+ }
+
+ public Drive build() {
+ return new Drive(uuid, name, resourceUri, owner, status);
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((name == null) ? 0 : name.hashCode());
+ result = prime * result + ((owner == null) ? 0 : owner.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
return true;
- }
- }
-
- protected final Owner owner;
- protected final DriveStatus status;
-
- @ConstructorProperties({
- "uuid", "name", "resource_uri", "owner", "status"
- })
- public Drive(@Nullable String uuid, String name, @Nullable URI resourceUri, @Nullable Owner owner, DriveStatus status) {
- super(uuid, name, resourceUri);
-
- this.owner = owner;
- this.status = status;
- }
-
- /**
- * @return Owner of the drive
- */
- public Owner getOwner() {
- return owner;
- }
-
- /**
- * @return Status of the drive
- */
- public DriveStatus getStatus() {
- return status;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (!(o instanceof Drive)) return false;
- if (!super.equals(o)) return false;
-
- Drive drive = (Drive) o;
-
- if (owner != null ? !owner.equals(drive.owner) : drive.owner != null) return false;
- if (status != drive.status) return false;
-
- return true;
- }
-
- @Override
- public int hashCode() {
- int result = super.hashCode();
- result = 31 * result + (owner != null ? owner.hashCode() : 0);
- result = 31 * result + (status != null ? status.hashCode() : 0);
- return result;
- }
-
- @Override
- public String toString() {
- return "[uuid=" + uuid + ", name=" + name + ", owner=" + owner + ", status=" + status + "]";
- }
-
- /**
- * Creates drive for attaching to server
- *
- * @param bootOrder drive boot order
- * @param deviceChannel device channel in format {controller:unit} ex. 0:1, 0:2, etc.
- * @param deviceEmulationType device emulation type
- */
- public ServerDrive toServerDrive(int bootOrder, String deviceChannel, DeviceEmulationType deviceEmulationType){
- return new ServerDrive(bootOrder, deviceChannel, deviceEmulationType, this.uuid);
- }
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ Drive other = (Drive) obj;
+ if (owner != other.owner)
+ return false;
+ if (!Objects.equal(status, other.status))
+ return false;
+ if (!Objects.equal(name, other.name))
+ return false;
+ return true;
+ }
+ }
+
+ protected final Owner owner;
+ protected final DriveStatus status;
+
+ @ConstructorProperties({
+ "uuid", "name", "resource_uri", "owner", "status"
+ })
+ public Drive(@Nullable String uuid, String name, @Nullable URI resourceUri, @Nullable Owner owner
+ , DriveStatus status) {
+ super(uuid, name, resourceUri);
+
+ this.owner = owner;
+ this.status = status;
+ }
+
+ /**
+ * @return Owner of the drive
+ */
+ public Owner getOwner() {
+ return owner;
+ }
+
+ /**
+ * @return Status of the drive
+ */
+ public DriveStatus getStatus() {
+ return status;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (!(o instanceof Drive)) return false;
+ if (!super.equals(o)) return false;
+
+ Drive drive = (Drive) o;
+
+ if (owner != null ? !owner.equals(drive.owner) : drive.owner != null) return false;
+ if (status != drive.status) return false;
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = super.hashCode();
+ result = 31 * result + (owner != null ? owner.hashCode() : 0);
+ result = 31 * result + (status != null ? status.hashCode() : 0);
+ return result;
+ }
+
+ @Override
+ public String toString() {
+ return "[uuid=" + uuid + ", name=" + name + ", owner=" + owner + ", status=" + status + "]";
+ }
+
+ /**
+ * Creates drive for attaching to server
+ *
+ * @param bootOrder drive boot order
+ * @param deviceChannel device channel in format {controller:unit} ex. 0:1, 0:2, etc.
+ * @param deviceEmulationType device emulation type
+ */
+ public ServerDrive toServerDrive(int bootOrder, String deviceChannel, DeviceEmulationType deviceEmulationType) {
+ return new ServerDrive(bootOrder, deviceChannel, deviceEmulationType, this.uuid);
+ }
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0d70c84a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/DriveInfo.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/DriveInfo.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/DriveInfo.java
index f5490d3..ba45c3c 100644
--- a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/DriveInfo.java
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/DriveInfo.java
@@ -29,301 +29,317 @@ import java.util.Map;
* @author Vladimir Shevchenko
*/
public class DriveInfo extends Drive {
- public static class Builder extends Drive.Builder {
-
- protected BigInteger size;
- protected boolean allowMultimount;
- protected List<String> affinities;
- protected List<String> jobs;
- protected List<DriveLicense> licenses;
- protected MediaType media = MediaType.UNRECOGNIZED;
- protected Map<String, String> meta;
- protected List<Server> mountedOn;
- protected List<String> tags;
-
- /**
- * @param size Size of the drive in bytes
- * @return DriveInfo Builder
- */
- public Builder size(BigInteger size) {
- this.size = size;
- return this;
- }
-
- /**
- * @param allowMultimount Allow the drive to be mounted on multiple guests
- * @return DriveInfo Builder
- */
- public Builder allowMultimount(boolean allowMultimount) {
- this.allowMultimount = allowMultimount;
- return this;
- }
-
- /**
- * @param affinities A list of affinities this drive should belong to
- * @return DriveInfo Builder
- */
- public Builder affinities(List<String> affinities) {
- this.affinities = ImmutableList.copyOf(affinities);
- return this;
- }
-
- /**
- * @param jobs Background jobs related to this resource
- * @return DriveInfo Builder
- */
- public Builder jobs(List<String> jobs) {
- this.jobs = ImmutableList.copyOf(jobs);
- return this;
- }
-
- /**
- * @param licenses A list of licences attached to this drive
- * @return DriveInfo Builder
- */
- public Builder licenses(List<DriveLicense> licenses) {
- this.licenses = licenses;
- return this;
- }
-
- /**
- * @param media Media representation type
- * @return DriveInfo Builder
- */
- public Builder media(MediaType media) {
- this.media = media;
- return this;
- }
-
- /**
- * @param meta User defined meta information
- * @return DriveInfo Builder
- */
- public Builder meta(Map<String, String> meta) {
- this.meta = meta;
- return this;
- }
-
- /**
- * @param mountedOn Servers on which this drive is mounted on
- * @return DriveInfo Builder
- */
- public Builder mountedOn(List<Server> mountedOn) {
- this.mountedOn = ImmutableList.copyOf(mountedOn);
- return this;
- }
-
- /**
- * @param tags Tags associated with this drive
- * @return DriveInfo Builder
- */
- public Builder tags(List<String> tags) {
- this.tags = ImmutableList.copyOf(tags);
- return this;
- }
-
- /**
- * {@inheritDoc}
- * @return DriveInfo Builder
- */
- @Override
- public Builder uuid(String uuid) {
- return Builder.class.cast(super.uuid(uuid));
- }
-
- /**
- * {@inheritDoc}
- * @return DriveInfo Builder
- */
- @Override
- public Builder name(String name) {
- return Builder.class.cast(super.name(name));
- }
-
- /**
- * {@inheritDoc}
- * @return DriveInfo Builder
- */
- @Override
- public Builder resourceUri(URI resourceUri) {
- return Builder.class.cast(super.resourceUri(resourceUri));
- }
-
- /**
- * {@inheritDoc}
- * @return DriveInfo Builder
- */
- @Override
- public Builder owner(Owner owner) {
- return Builder.class.cast(super.owner(owner));
- }
-
- /**
- * {@inheritDoc}
- * @return DriveInfo Builder
- */
- @Override
- public Builder status(DriveStatus status) {
- return Builder.class.cast(super.status(status));
- }
-
- public static Builder fromDriveInfo(DriveInfo in) {
- return new Builder().uuid(in.getUuid()).name(in.getName()).resourceUri(in.getResourceUri())
- .owner(in.getOwner()).status(in.getStatus()).size(in.getSize())
- .allowMultimount(in.isAllowMultimount()).affinities(in.getAffinities()).jobs(in.getJobs())
- .licenses(in.getLicenses()).media(in.getMedia()).meta(in.getMeta()).mountedOn(in.getMountedOn()).tags(in.getTags());
- }
-
- /**
- * Warning: media, name & size should be specified
- *
- * @return DriveInfo instance
- */
- @Override
- public DriveInfo build() {
- return new DriveInfo(uuid, name, resourceUri, size, owner, status, allowMultimount, affinities, jobs, licenses
- , media, meta, mountedOn, tags);
- }
-
- }
-
- protected final BigInteger size;
- @Named("allow_multimount")
- protected final boolean allowMultimount;
- protected final List<String> affinities;
- protected final List<String> jobs;
- protected final List<DriveLicense> licenses;
- protected final MediaType media;
- protected final Map<String, String> meta;
- @Named("mounted_on")
- protected final List<Server> mountedOn;
- protected final List<String> tags;
-
- @ConstructorProperties({
- "uuid", "name", "resource_uri", "size", "owner", "status",
- "allow_multimount", "affinities", "jobs", "licenses",
- "media", "meta", "mounted_on", "tags"
- })
- public DriveInfo(String uuid, String name, URI resourceUri,
- BigInteger size, Owner owner, DriveStatus status,
- boolean allowMultimount, List<String> affinities, List<String> jobs, List<DriveLicense> licenses,
- MediaType media, Map<String, String> meta, List<Server> mountedOn, List<String> tags) {
- super(uuid, name, resourceUri, owner, status);
- this.size = size;
- this.allowMultimount = allowMultimount;
- this.affinities = affinities;
- this.jobs = jobs;
- this.licenses = licenses;
- this.media = media;
- this.meta = meta;
- this.mountedOn = mountedOn;
- this.tags = tags;
- }
-
- /**
- * @return Size of the drive in bytes
- */
- public BigInteger getSize() {
- return size;
- }
-
- /**
- * @return A list of affinities this drive should belong to
- */
- public List<String> getAffinities() {
- return affinities;
- }
-
- /**
- * @return Allow the drive to be mounted on multiple guests
- */
- public boolean isAllowMultimount() {
- return allowMultimount;
- }
-
- /**
- * @return Background jobs related to this resource
- */
- public List<String> getJobs() {
- return jobs;
- }
-
- /**
- * @return A list of licences attached to this drive
- */
- public List<DriveLicense> getLicenses() {
- return licenses;
- }
-
- /**
- * @return Media representation type
- */
- public MediaType getMedia() {
- return media;
- }
-
- /**
- * @return User defined meta information
- */
- public Map<String, String> getMeta() {
- return meta;
- }
-
- /**
- * @return Servers on which this drive is mounted on
- */
- public List<Server> getMountedOn() {
- return mountedOn;
- }
-
- /**
- * @return Tags associated with this drive
- */
- public List<String> getTags() {
- return tags;
- }
-
- @Override
- public int hashCode() {
- int result = super.hashCode();
- result = 31 * result + (size != null ? size.hashCode() : 0);
- result = 31 * result + (allowMultimount ? 1 : 0);
- result = 31 * result + (affinities != null ? affinities.hashCode() : 0);
- result = 31 * result + (jobs != null ? jobs.hashCode() : 0);
- result = 31 * result + (licenses != null ? licenses.hashCode() : 0);
- result = 31 * result + (media != null ? media.hashCode() : 0);
- result = 31 * result + (meta != null ? meta.hashCode() : 0);
- result = 31 * result + (mountedOn != null ? mountedOn.hashCode() : 0);
- result = 31 * result + (tags != null ? tags.hashCode() : 0);
- return result;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (!(o instanceof DriveInfo)) return false;
- if (!super.equals(o)) return false;
-
- DriveInfo driveInfo = (DriveInfo) o;
-
- if (allowMultimount != driveInfo.allowMultimount) return false;
- if (affinities != null ? !affinities.equals(driveInfo.affinities) : driveInfo.affinities != null) return false;
- if (jobs != null ? !jobs.equals(driveInfo.jobs) : driveInfo.jobs != null) return false;
- if (licenses != null ? !licenses.equals(driveInfo.licenses) : driveInfo.licenses != null) return false;
- if (media != driveInfo.media) return false;
- if (meta != null ? !meta.equals(driveInfo.meta) : driveInfo.meta != null) return false;
- if (mountedOn != null ? !mountedOn.equals(driveInfo.mountedOn) : driveInfo.mountedOn != null) return false;
- if (size != null ? !size.equals(driveInfo.size) : driveInfo.size != null) return false;
- if (tags != null ? !tags.equals(driveInfo.tags) : driveInfo.tags != null) return false;
-
- return true;
- }
-
- @Override
- public String toString() {
- return "[uuid=" + uuid + ", name=" + name + ", size=" + size + ", owner=" + owner + ", status=" + status
- + ", affinities=" + affinities + ", jobs=" + jobs + ", licenses=" + licenses + ", media=" + media
- + ", meta=" + meta + ", mountedOn=" + mountedOn + ", tags=" + tags + "]";
- }
+ public static class Builder extends Drive.Builder {
+
+ protected BigInteger size;
+ protected boolean allowMultimount;
+ protected List<String> affinities;
+ protected List<String> jobs;
+ protected List<DriveLicense> licenses;
+ protected MediaType media = MediaType.UNRECOGNIZED;
+ protected Map<String, String> meta;
+ protected List<Server> mountedOn;
+ protected List<String> tags;
+
+ /**
+ * @param size Size of the drive in bytes
+ * @return DriveInfo Builder
+ */
+ public Builder size(BigInteger size) {
+ this.size = size;
+ return this;
+ }
+
+ /**
+ * @param allowMultimount Allow the drive to be mounted on multiple guests
+ * @return DriveInfo Builder
+ */
+ public Builder allowMultimount(boolean allowMultimount) {
+ this.allowMultimount = allowMultimount;
+ return this;
+ }
+
+ /**
+ * @param affinities A list of affinities this drive should belong to
+ * @return DriveInfo Builder
+ */
+ public Builder affinities(List<String> affinities) {
+ this.affinities = ImmutableList.copyOf(affinities);
+ return this;
+ }
+
+ /**
+ * @param jobs Background jobs related to this resource
+ * @return DriveInfo Builder
+ */
+ public Builder jobs(List<String> jobs) {
+ this.jobs = ImmutableList.copyOf(jobs);
+ return this;
+ }
+
+ /**
+ * @param licenses A list of licences attached to this drive
+ * @return DriveInfo Builder
+ */
+ public Builder licenses(List<DriveLicense> licenses) {
+ this.licenses = licenses;
+ return this;
+ }
+
+ /**
+ * @param media Media representation type
+ * @return DriveInfo Builder
+ */
+ public Builder media(MediaType media) {
+ this.media = media;
+ return this;
+ }
+
+ /**
+ * @param meta User defined meta information
+ * @return DriveInfo Builder
+ */
+ public Builder meta(Map<String, String> meta) {
+ this.meta = meta;
+ return this;
+ }
+
+ /**
+ * @param mountedOn Servers on which this drive is mounted on
+ * @return DriveInfo Builder
+ */
+ public Builder mountedOn(List<Server> mountedOn) {
+ this.mountedOn = ImmutableList.copyOf(mountedOn);
+ return this;
+ }
+
+ /**
+ * @param tags Tags associated with this drive
+ * @return DriveInfo Builder
+ */
+ public Builder tags(List<String> tags) {
+ this.tags = ImmutableList.copyOf(tags);
+ return this;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @return DriveInfo Builder
+ */
+ @Override
+ public Builder uuid(String uuid) {
+ return Builder.class.cast(super.uuid(uuid));
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @return DriveInfo Builder
+ */
+ @Override
+ public Builder name(String name) {
+ return Builder.class.cast(super.name(name));
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @return DriveInfo Builder
+ */
+ @Override
+ public Builder resourceUri(URI resourceUri) {
+ return Builder.class.cast(super.resourceUri(resourceUri));
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @return DriveInfo Builder
+ */
+ @Override
+ public Builder owner(Owner owner) {
+ return Builder.class.cast(super.owner(owner));
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @return DriveInfo Builder
+ */
+ @Override
+ public Builder status(DriveStatus status) {
+ return Builder.class.cast(super.status(status));
+ }
+
+ public static Builder fromDriveInfo(DriveInfo in) {
+ return new Builder()
+ .uuid(in.getUuid())
+ .name(in.getName())
+ .resourceUri(in.getResourceUri())
+ .owner(in.getOwner())
+ .status(in.getStatus())
+ .size(in.getSize())
+ .allowMultimount(in.isAllowMultimount())
+ .affinities(in.getAffinities())
+ .jobs(in.getJobs())
+ .licenses(in.getLicenses())
+ .media(in.getMedia())
+ .meta(in.getMeta())
+ .mountedOn(in.getMountedOn())
+ .tags(in.getTags());
+ }
+
+ /**
+ * Warning: media, name & size should be specified
+ *
+ * @return DriveInfo instance
+ */
+ @Override
+ public DriveInfo build() {
+ return new DriveInfo(uuid, name, resourceUri, size, owner, status, allowMultimount, affinities, jobs, licenses
+ , media, meta, mountedOn, tags);
+ }
+
+ }
+
+ protected final BigInteger size;
+ @Named("allow_multimount")
+ protected final boolean allowMultimount;
+ protected final List<String> affinities;
+ protected final List<String> jobs;
+ protected final List<DriveLicense> licenses;
+ protected final MediaType media;
+ protected final Map<String, String> meta;
+ @Named("mounted_on")
+ protected final List<Server> mountedOn;
+ protected final List<String> tags;
+
+ @ConstructorProperties({
+ "uuid", "name", "resource_uri", "size", "owner", "status",
+ "allow_multimount", "affinities", "jobs", "licenses",
+ "media", "meta", "mounted_on", "tags"
+ })
+ public DriveInfo(String uuid, String name, URI resourceUri,
+ BigInteger size, Owner owner, DriveStatus status,
+ boolean allowMultimount, List<String> affinities, List<String> jobs, List<DriveLicense> licenses,
+ MediaType media, Map<String, String> meta, List<Server> mountedOn, List<String> tags) {
+ super(uuid, name, resourceUri, owner, status);
+ this.size = size;
+ this.allowMultimount = allowMultimount;
+ this.affinities = affinities;
+ this.jobs = jobs;
+ this.licenses = licenses;
+ this.media = media;
+ this.meta = meta;
+ this.mountedOn = mountedOn;
+ this.tags = tags;
+ }
+
+ /**
+ * @return Size of the drive in bytes
+ */
+ public BigInteger getSize() {
+ return size;
+ }
+
+ /**
+ * @return A list of affinities this drive should belong to
+ */
+ public List<String> getAffinities() {
+ return affinities;
+ }
+
+ /**
+ * @return Allow the drive to be mounted on multiple guests
+ */
+ public boolean isAllowMultimount() {
+ return allowMultimount;
+ }
+
+ /**
+ * @return Background jobs related to this resource
+ */
+ public List<String> getJobs() {
+ return jobs;
+ }
+
+ /**
+ * @return A list of licences attached to this drive
+ */
+ public List<DriveLicense> getLicenses() {
+ return licenses;
+ }
+
+ /**
+ * @return Media representation type
+ */
+ public MediaType getMedia() {
+ return media;
+ }
+
+ /**
+ * @return User defined meta information
+ */
+ public Map<String, String> getMeta() {
+ return meta;
+ }
+
+ /**
+ * @return Servers on which this drive is mounted on
+ */
+ public List<Server> getMountedOn() {
+ return mountedOn;
+ }
+
+ /**
+ * @return Tags associated with this drive
+ */
+ public List<String> getTags() {
+ return tags;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = super.hashCode();
+ result = 31 * result + (size != null ? size.hashCode() : 0);
+ result = 31 * result + (allowMultimount ? 1 : 0);
+ result = 31 * result + (affinities != null ? affinities.hashCode() : 0);
+ result = 31 * result + (jobs != null ? jobs.hashCode() : 0);
+ result = 31 * result + (licenses != null ? licenses.hashCode() : 0);
+ result = 31 * result + (media != null ? media.hashCode() : 0);
+ result = 31 * result + (meta != null ? meta.hashCode() : 0);
+ result = 31 * result + (mountedOn != null ? mountedOn.hashCode() : 0);
+ result = 31 * result + (tags != null ? tags.hashCode() : 0);
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (!(o instanceof DriveInfo)) return false;
+ if (!super.equals(o)) return false;
+
+ DriveInfo driveInfo = (DriveInfo) o;
+
+ if (allowMultimount != driveInfo.allowMultimount) return false;
+ if (affinities != null ? !affinities.equals(driveInfo.affinities) : driveInfo.affinities != null) return false;
+ if (jobs != null ? !jobs.equals(driveInfo.jobs) : driveInfo.jobs != null) return false;
+ if (licenses != null ? !licenses.equals(driveInfo.licenses) : driveInfo.licenses != null) return false;
+ if (media != driveInfo.media) return false;
+ if (meta != null ? !meta.equals(driveInfo.meta) : driveInfo.meta != null) return false;
+ if (mountedOn != null ? !mountedOn.equals(driveInfo.mountedOn) : driveInfo.mountedOn != null) return false;
+ if (size != null ? !size.equals(driveInfo.size) : driveInfo.size != null) return false;
+ if (tags != null ? !tags.equals(driveInfo.tags) : driveInfo.tags != null) return false;
+
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ return "[uuid=" + uuid + ", name=" + name + ", size=" + size + ", owner=" + owner + ", status=" + status
+ + ", affinities=" + affinities + ", jobs=" + jobs + ", licenses=" + licenses + ", media=" + media
+ + ", meta=" + meta + ", mountedOn=" + mountedOn + ", tags=" + tags + "]";
+ }
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0d70c84a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/DriveLicense.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/DriveLicense.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/DriveLicense.java
index 48b75f7..4f02fcb 100644
--- a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/DriveLicense.java
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/DriveLicense.java
@@ -23,84 +23,84 @@ import java.beans.ConstructorProperties;
*/
public class DriveLicense {
- public static class Builder{
- private int amount;
- private License license;
- private Owner user;
-
- public Builder amount(int amount){
- this.amount = amount;
- return this;
- }
-
- public Builder license(License license){
- this.license = license;
- return this;
- }
-
- public Builder user(Owner user){
- this.user = user;
- return this;
- }
-
- public DriveLicense build(){
- return new DriveLicense(amount, license, user);
- }
- }
-
- private final int amount;
- private final License license;
- private final Owner user;
-
- @ConstructorProperties({
- "amount", "license", "user"
- })
- public DriveLicense(int amount, License license, Owner user) {
- this.amount = amount;
- this.license = license;
- this.user = user;
- }
-
- public int getAmount() {
- return amount;
- }
-
- public License getLicense() {
- return license;
- }
-
- public Owner getUser() {
- return user;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (!(o instanceof DriveLicense)) return false;
-
- DriveLicense that = (DriveLicense) o;
-
- if (amount != that.amount) return false;
- if (license != null ? !license.equals(that.license) : that.license != null) return false;
- if (user != null ? !user.equals(that.user) : that.user != null) return false;
-
- return true;
- }
-
- @Override
- public int hashCode() {
- int result = amount;
- result = 31 * result + (license != null ? license.hashCode() : 0);
- result = 31 * result + (user != null ? user.hashCode() : 0);
- return result;
- }
-
- @Override
- public String toString() {
- return "[" +
- "amount=" + amount +
- ", license='" + license + '\'' +
- ", user=" + user +
- "]";
- }
+ public static class Builder {
+ private int amount;
+ private License license;
+ private Owner user;
+
+ public Builder amount(int amount) {
+ this.amount = amount;
+ return this;
+ }
+
+ public Builder license(License license) {
+ this.license = license;
+ return this;
+ }
+
+ public Builder user(Owner user) {
+ this.user = user;
+ return this;
+ }
+
+ public DriveLicense build() {
+ return new DriveLicense(amount, license, user);
+ }
+ }
+
+ private final int amount;
+ private final License license;
+ private final Owner user;
+
+ @ConstructorProperties({
+ "amount", "license", "user"
+ })
+ public DriveLicense(int amount, License license, Owner user) {
+ this.amount = amount;
+ this.license = license;
+ this.user = user;
+ }
+
+ public int getAmount() {
+ return amount;
+ }
+
+ public License getLicense() {
+ return license;
+ }
+
+ public Owner getUser() {
+ return user;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (!(o instanceof DriveLicense)) return false;
+
+ DriveLicense that = (DriveLicense) o;
+
+ if (amount != that.amount) return false;
+ if (license != null ? !license.equals(that.license) : that.license != null) return false;
+ if (user != null ? !user.equals(that.user) : that.user != null) return false;
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = amount;
+ result = 31 * result + (license != null ? license.hashCode() : 0);
+ result = 31 * result + (user != null ? user.hashCode() : 0);
+ return result;
+ }
+
+ @Override
+ public String toString() {
+ return "[" +
+ "amount=" + amount +
+ ", license='" + license + '\'' +
+ ", user=" + user +
+ "]";
+ }
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0d70c84a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/DriveStatus.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/DriveStatus.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/DriveStatus.java
index e5f74e3..328a17f 100644
--- a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/DriveStatus.java
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/DriveStatus.java
@@ -19,7 +19,6 @@ package org.jclouds.cloudsigma2.domain;
import static com.google.common.base.Preconditions.checkNotNull;
/**
- *
* @author Adrian Cole
*/
public enum DriveStatus {
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0d70c84a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/DrivesListRequestFieldsGroup.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/DrivesListRequestFieldsGroup.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/DrivesListRequestFieldsGroup.java
index 17def00..ad8d3df 100644
--- a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/DrivesListRequestFieldsGroup.java
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/DrivesListRequestFieldsGroup.java
@@ -22,30 +22,30 @@ import java.util.Iterator;
* @author Vladimir Shevchenko
*/
public class DrivesListRequestFieldsGroup {
- private final Iterable<String> fields;
+ private final Iterable<String> fields;
- public DrivesListRequestFieldsGroup(Iterable<String> fields) {
- this.fields = fields;
- }
+ public DrivesListRequestFieldsGroup(Iterable<String> fields) {
+ this.fields = fields;
+ }
- public Iterable<String> getFields() {
- return fields;
- }
+ public Iterable<String> getFields() {
+ return fields;
+ }
- @Override
- public String toString() {
- String returnString = "";
+ @Override
+ public String toString() {
+ String returnString = "";
- Iterator iterator = fields.iterator();
+ Iterator iterator = fields.iterator();
- while (iterator.hasNext()){
- returnString += iterator.next();
+ while (iterator.hasNext()) {
+ returnString += iterator.next();
- if(iterator.hasNext()){
- returnString += ",";
- }
- }
+ if (iterator.hasNext()) {
+ returnString += ",";
+ }
+ }
- return returnString;
- }
+ return returnString;
+ }
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0d70c84a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/FirewallAction.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/FirewallAction.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/FirewallAction.java
index 9da05d3..8f5f279 100644
--- a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/FirewallAction.java
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/FirewallAction.java
@@ -22,22 +22,22 @@ import static com.google.common.base.Preconditions.checkNotNull;
* @author Vladimir Shevchenko
*/
public enum FirewallAction {
- DROP, ACCEPT;
+ DROP, ACCEPT;
- public String value() {
- return name().toLowerCase();
- }
+ public String value() {
+ return name().toLowerCase();
+ }
- @Override
- public String toString() {
- return value();
- }
+ @Override
+ public String toString() {
+ return value();
+ }
- public static FirewallAction fromValue(String type) {
- try {
- return valueOf(checkNotNull(type, "type").toUpperCase());
- } catch (IllegalArgumentException e) {
- return null;
- }
- }
+ public static FirewallAction fromValue(String type) {
+ try {
+ return valueOf(checkNotNull(type, "type").toUpperCase());
+ } catch (IllegalArgumentException e) {
+ return null;
+ }
+ }
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0d70c84a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/FirewallDirection.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/FirewallDirection.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/FirewallDirection.java
index 36e729a..10cff38 100644
--- a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/FirewallDirection.java
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/FirewallDirection.java
@@ -22,22 +22,22 @@ import static com.google.common.base.Preconditions.checkNotNull;
* @author Vladimir Shevchenko
*/
public enum FirewallDirection {
- IN, OUT, BOTH;
+ IN, OUT, BOTH;
- public String value() {
- return name().toLowerCase();
- }
+ public String value() {
+ return name().toLowerCase();
+ }
- @Override
- public String toString() {
- return value();
- }
+ @Override
+ public String toString() {
+ return value();
+ }
- public static FirewallDirection fromValue(String type) {
- try {
- return valueOf(checkNotNull(type, "type").toUpperCase());
- } catch (IllegalArgumentException e) {
- return null;
- }
- }
+ public static FirewallDirection fromValue(String type) {
+ try {
+ return valueOf(checkNotNull(type, "type").toUpperCase());
+ } catch (IllegalArgumentException e) {
+ return null;
+ }
+ }
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0d70c84a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/FirewallIpProtocol.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/FirewallIpProtocol.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/FirewallIpProtocol.java
index cd7ffcc..54f22c7 100644
--- a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/FirewallIpProtocol.java
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/FirewallIpProtocol.java
@@ -22,22 +22,22 @@ import static com.google.common.base.Preconditions.checkNotNull;
* @author Vladimir Shevchenko
*/
public enum FirewallIpProtocol {
- TCP, UDP;
+ TCP, UDP;
- public String value() {
- return name().toLowerCase();
- }
+ public String value() {
+ return name().toLowerCase();
+ }
- @Override
- public String toString() {
- return value();
- }
+ @Override
+ public String toString() {
+ return value();
+ }
- public static FirewallIpProtocol fromValue(String type) {
- try {
- return valueOf(checkNotNull(type, "type").toUpperCase());
- } catch (IllegalArgumentException e) {
- return null;
- }
- }
+ public static FirewallIpProtocol fromValue(String type) {
+ try {
+ return valueOf(checkNotNull(type, "type").toUpperCase());
+ } catch (IllegalArgumentException e) {
+ return null;
+ }
+ }
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0d70c84a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/FirewallPolicy.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/FirewallPolicy.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/FirewallPolicy.java
index efd17b9..e3caba6 100644
--- a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/FirewallPolicy.java
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/FirewallPolicy.java
@@ -27,191 +27,191 @@ import java.util.Map;
/**
* @author Vladimir Shevchenko
*/
-public class FirewallPolicy extends Item{
-
- public static class Builder extends Item.Builder{
- private Map<String, String> meta;
- private Owner owner;
- private List<FirewallRule> rules;
- private List<Server> servers;
-
- /**
- * @param meta User assigned meta information for this policy
- * @return
- */
- public Builder meta(Map<String, String> meta){
- this.meta = meta;
- return this;
- }
-
- /**
- * @param owner Owner of the policy
- * @return
- */
- public Builder owner(Owner owner){
- this.owner = owner;
- return this;
- }
-
- /**
- * @param rules List of rules to be applied for this policy
- * @return
- */
- public Builder rules(List<FirewallRule> rules){
- this.rules = ImmutableList.copyOf(rules);
- return this;
- }
-
- /**
- * @param servers Servers which have nics with this policy applied
- * @return
- */
- public Builder servers(List<Server> servers){
- this.servers = ImmutableList.copyOf(servers);
- return this;
- }
-
- /**
- * @param resourceUri Resource URI
- * @return
- */
- @Override
- public Builder resourceUri(URI resourceUri){
- this.resourceUri = resourceUri;
- return this;
- }
-
- /**
- * @param name Human readable name of the firewall policy
- * @return
- */
- @Override
- public Builder name(String name){
- this.name = name;
- return this;
- }
-
- /**
- * @param uuid UUID of the policy
- * @return
- */
- @Override
- public Builder uuid(String uuid){
- this.uuid = uuid;
- return this;
- }
-
- public FirewallPolicy build(){
- return new FirewallPolicy(meta, name, owner, resourceUri, rules, servers, uuid);
- }
- }
-
- private final Map<String, String> meta;
- private final Owner owner;
- private final List<FirewallRule> rules;
- private final List<Server> servers;
-
- @ConstructorProperties({
- "meta", "name", "owner", "resource_uri", "rules", "servers", "uuid"
- })
- public FirewallPolicy(Map<String, String> meta, String name, Owner owner, URI resourceUri, List<FirewallRule> rules
- , List<Server> servers, String uuid) {
- super(uuid, name, resourceUri);
- this.meta = meta;
- this.owner = owner;
- this.rules = rules == null ? new ArrayList<FirewallRule>() : rules;
- this.servers = servers == null ? new ArrayList<Server>() : servers;
- }
-
- /**
- * @return User assigned meta information for this policy
- */
- public Map<String, String> getMeta() {
- return meta;
- }
-
- /**
- * @return Human readable name of the firewall policy
- */
- public String getName() {
- return name;
- }
-
- /**
- * @return Owner of the policy
- */
- public Owner getOwner() {
- return owner;
- }
-
- /**
- * @return resource uri
- */
- public URI getResourceUri() {
- return resourceUri;
- }
-
- /**
- * @return List of rules to be applied for this policy
- */
- public List<FirewallRule> getRules() {
- return rules;
- }
-
- /**
- * @return Servers which have nics with this policy applied
- */
- public List<Server> getServers() {
- return servers;
- }
-
- /**
- * @return UUID of the policy
- */
- public String getUuid() {
- return uuid;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (!(o instanceof FirewallPolicy)) return false;
- if (!super.equals(o)) return false;
-
- FirewallPolicy that = (FirewallPolicy) o;
-
- if (meta != null ? !meta.equals(that.meta) : that.meta != null) return false;
- if (owner != null ? !owner.equals(that.owner) : that.owner != null) return false;
- if (rules != null ? !rules.equals(that.rules) : that.rules != null) return false;
- if (servers != null ? !servers.equals(that.servers) : that.servers != null) return false;
-
- return true;
- }
-
- @Override
- public int hashCode() {
- int result = super.hashCode();
- result = 31 * result + (meta != null ? meta.hashCode() : 0);
- result = 31 * result + (owner != null ? owner.hashCode() : 0);
- result = 31 * result + (rules != null ? rules.hashCode() : 0);
- result = 31 * result + (servers != null ? servers.hashCode() : 0);
- return result;
- }
-
- @Override
- public String toString() {
- return "[" +
- "meta=" + meta +
- ", name='" + name + '\'' +
- ", owner=" + owner +
- ", resourceUri='" + resourceUri + '\'' +
- ", rules=" + rules +
- ", servers=" + servers +
- ", uuid='" + uuid + '\'' +
- "]";
- }
-
- public NIC toNIC(){
- return new NIC.Builder().firewallPolicy(this).build();
- }
+public class FirewallPolicy extends Item {
+
+ public static class Builder extends Item.Builder {
+ private Map<String, String> meta;
+ private Owner owner;
+ private List<FirewallRule> rules;
+ private List<Server> servers;
+
+ /**
+ * @param meta User assigned meta information for this policy
+ * @return
+ */
+ public Builder meta(Map<String, String> meta) {
+ this.meta = meta;
+ return this;
+ }
+
+ /**
+ * @param owner Owner of the policy
+ * @return
+ */
+ public Builder owner(Owner owner) {
+ this.owner = owner;
+ return this;
+ }
+
+ /**
+ * @param rules List of rules to be applied for this policy
+ * @return
+ */
+ public Builder rules(List<FirewallRule> rules) {
+ this.rules = ImmutableList.copyOf(rules);
+ return this;
+ }
+
+ /**
+ * @param servers Servers which have nics with this policy applied
+ * @return
+ */
+ public Builder servers(List<Server> servers) {
+ this.servers = ImmutableList.copyOf(servers);
+ return this;
+ }
+
+ /**
+ * @param resourceUri Resource URI
+ * @return
+ */
+ @Override
+ public Builder resourceUri(URI resourceUri) {
+ this.resourceUri = resourceUri;
+ return this;
+ }
+
+ /**
+ * @param name Human readable name of the firewall policy
+ * @return
+ */
+ @Override
+ public Builder name(String name) {
+ this.name = name;
+ return this;
+ }
+
+ /**
+ * @param uuid UUID of the policy
+ * @return
+ */
+ @Override
+ public Builder uuid(String uuid) {
+ this.uuid = uuid;
+ return this;
+ }
+
+ public FirewallPolicy build() {
+ return new FirewallPolicy(meta, name, owner, resourceUri, rules, servers, uuid);
+ }
+ }
+
+ private final Map<String, String> meta;
+ private final Owner owner;
+ private final List<FirewallRule> rules;
+ private final List<Server> servers;
+
+ @ConstructorProperties({
+ "meta", "name", "owner", "resource_uri", "rules", "servers", "uuid"
+ })
+ public FirewallPolicy(Map<String, String> meta, String name, Owner owner, URI resourceUri, List<FirewallRule> rules
+ , List<Server> servers, String uuid) {
+ super(uuid, name, resourceUri);
+ this.meta = meta;
+ this.owner = owner;
+ this.rules = rules == null ? new ArrayList<FirewallRule>() : rules;
+ this.servers = servers == null ? new ArrayList<Server>() : servers;
+ }
+
+ /**
+ * @return User assigned meta information for this policy
+ */
+ public Map<String, String> getMeta() {
+ return meta;
+ }
+
+ /**
+ * @return Human readable name of the firewall policy
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * @return Owner of the policy
+ */
+ public Owner getOwner() {
+ return owner;
+ }
+
+ /**
+ * @return resource uri
+ */
+ public URI getResourceUri() {
+ return resourceUri;
+ }
+
+ /**
+ * @return List of rules to be applied for this policy
+ */
+ public List<FirewallRule> getRules() {
+ return rules;
+ }
+
+ /**
+ * @return Servers which have nics with this policy applied
+ */
+ public List<Server> getServers() {
+ return servers;
+ }
+
+ /**
+ * @return UUID of the policy
+ */
+ public String getUuid() {
+ return uuid;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (!(o instanceof FirewallPolicy)) return false;
+ if (!super.equals(o)) return false;
+
+ FirewallPolicy that = (FirewallPolicy) o;
+
+ if (meta != null ? !meta.equals(that.meta) : that.meta != null) return false;
+ if (owner != null ? !owner.equals(that.owner) : that.owner != null) return false;
+ if (rules != null ? !rules.equals(that.rules) : that.rules != null) return false;
+ if (servers != null ? !servers.equals(that.servers) : that.servers != null) return false;
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = super.hashCode();
+ result = 31 * result + (meta != null ? meta.hashCode() : 0);
+ result = 31 * result + (owner != null ? owner.hashCode() : 0);
+ result = 31 * result + (rules != null ? rules.hashCode() : 0);
+ result = 31 * result + (servers != null ? servers.hashCode() : 0);
+ return result;
+ }
+
+ @Override
+ public String toString() {
+ return "[" +
+ "meta=" + meta +
+ ", name='" + name + '\'' +
+ ", owner=" + owner +
+ ", resourceUri='" + resourceUri + '\'' +
+ ", rules=" + rules +
+ ", servers=" + servers +
+ ", uuid='" + uuid + '\'' +
+ "]";
+ }
+
+ public NIC toNIC() {
+ return new NIC.Builder().firewallPolicy(this).build();
+ }
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0d70c84a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/FirewallRule.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/FirewallRule.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/FirewallRule.java
index eaf9df0..f948ec7 100644
--- a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/FirewallRule.java
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/FirewallRule.java
@@ -24,224 +24,225 @@ import java.beans.ConstructorProperties;
*/
public class FirewallRule {
- public static class Builder{
- private FirewallAction action;
- private String comment;
- private FirewallDirection direction;
- private String destinationIp;
- private String destinationPort;
- private FirewallIpProtocol ipProtocol;
- private String sourceIp;
- private String sourcePort;
-
- /**
- * @param action Action to be taken
- * @return FirewallRule Builder
- */
- public Builder action(FirewallAction action){
- this.action = action;
- return this;
- }
-
- /**
- * @param comment Optional rule comment
- * @return FirewallRule Builder
- */
- public Builder comment(String comment){
- this.comment = comment;
- return this;
- }
-
- /**
- * @param direction Packet direction
- * @return FirewallRule Builder
- */
- public Builder direction(FirewallDirection direction){
- this.direction = direction;
- return this;
- }
-
- /**
- * @param destinationIp Destination IP address
- * @return FirewallRule Builder
- */
- public Builder destinationIp(String destinationIp){
- this.destinationIp = destinationIp;
- return this;
- }
-
- /**
- * @param destinationPort Destination port
- * @return FirewallRule Builder
- */
- public Builder destinationPort(String destinationPort){
- this.destinationPort = destinationPort;
- return this;
- }
-
- /**
- * @param ipProtocol IP protocol
- * @return FirewallRule Builder
- */
- public Builder ipProtocol(FirewallIpProtocol ipProtocol){
- this.ipProtocol = ipProtocol;
- return this;
- }
-
- /**
- * @param sourceIp Source IP address
- * @return FirewallRule Builder
- */
- public Builder sourceIp(String sourceIp){
- this.sourceIp = sourceIp;
- return this;
- }
-
- /**
- * @param sourcePort Source port
- * @return FirewallRule Builder
- */
- public Builder sourcePort(String sourcePort){
- this.sourcePort = sourcePort;
- return this;
- }
-
- public FirewallRule build(){
- return new FirewallRule(action, comment, direction, destinationIp, destinationPort, ipProtocol, sourceIp, sourcePort);
- }
- }
-
- private final FirewallAction action;
- private final String comment;
- private final FirewallDirection direction;
- @Named("dst_ip")
- private final String destinationIp;
- @Named("dst_port")
- private final String destinationPort;
- @Named("ip_proto")
- private final FirewallIpProtocol ipProtocol;
- @Named("src_ip")
- private final String sourceIp;
- @Named("src_port")
- private final String sourcePort;
-
- @ConstructorProperties({
- "action", "comment", "direction", "dst_ip",
- "dst_port", "ip_proto", "src_ip", "src_port"
- })
- public FirewallRule(FirewallAction action, String comment, FirewallDirection direction, String destinationIp
- , String destinationPort, FirewallIpProtocol ipProtocol, String sourceIp, String sourcePort) {
- this.action = action;
- this.comment = comment;
- this.direction = direction;
- this.destinationIp = destinationIp;
- this.destinationPort = destinationPort;
- this.ipProtocol = ipProtocol;
- this.sourceIp = sourceIp;
- this.sourcePort = sourcePort;
- }
-
- /**
- * @return Action to be taken
- */
- public FirewallAction getAction() {
- return action;
- }
-
- /**
- * @return Optional rule comment
- */
- public String getComment() {
- return comment;
- }
-
- /**
- * @return Packet direction
- */
- public FirewallDirection getDirection() {
- return direction;
- }
-
- /**
- * @return Destination IP address
- */
- public String getDestinationIp() {
- return destinationIp;
- }
-
- /**
- * @return Destination port
- */
- public String getDestinationPort() {
- return destinationPort;
- }
-
- /**
- * @return IP protocol
- */
- public FirewallIpProtocol getIpProtocol() {
- return ipProtocol;
- }
-
- /**
- * @return Source IP address
- */
- public String getSourceIp() {
- return sourceIp;
- }
-
- /**
- * @return Source port
- */
- public String getSourcePort() {
- return sourcePort;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (!(o instanceof FirewallRule)) return false;
-
- FirewallRule that = (FirewallRule) o;
-
- if (action != that.action) return false;
- if (comment != null ? !comment.equals(that.comment) : that.comment != null) return false;
- if (destinationIp != null ? !destinationIp.equals(that.destinationIp) : that.destinationIp != null)
- return false;
- if (destinationPort != null ? !destinationPort.equals(that.destinationPort) : that.destinationPort != null)
- return false;
- if (direction != that.direction) return false;
- if (ipProtocol != that.ipProtocol) return false;
- if (sourceIp != null ? !sourceIp.equals(that.sourceIp) : that.sourceIp != null) return false;
- if (sourcePort != null ? !sourcePort.equals(that.sourcePort) : that.sourcePort != null) return false;
-
- return true;
- }
-
- @Override
- public int hashCode() {
- int result = action != null ? action.hashCode() : 0;
- result = 31 * result + (comment != null ? comment.hashCode() : 0);
- result = 31 * result + (direction != null ? direction.hashCode() : 0);
- result = 31 * result + (destinationIp != null ? destinationIp.hashCode() : 0);
- result = 31 * result + (destinationPort != null ? destinationPort.hashCode() : 0);
- result = 31 * result + (ipProtocol != null ? ipProtocol.hashCode() : 0);
- result = 31 * result + (sourceIp != null ? sourceIp.hashCode() : 0);
- result = 31 * result + (sourcePort != null ? sourcePort.hashCode() : 0);
- return result;
- }
-
- @Override
- public String toString() {
- return "[" +
- "action=" + action +
- ", comment='" + comment + '\'' +
- ", direction=" + direction +
- ", destinationIp='" + destinationIp + '\'' +
- ", destinationPort='" + destinationPort + '\'' +
- ", ipProtocol=" + ipProtocol +
- ", sourceIp='" + sourceIp + '\'' +
- ", sourcePort='" + sourcePort + '\'' +
- "]";
- }
+ public static class Builder {
+ private FirewallAction action;
+ private String comment;
+ private FirewallDirection direction;
+ private String destinationIp;
+ private String destinationPort;
+ private FirewallIpProtocol ipProtocol;
+ private String sourceIp;
+ private String sourcePort;
+
+ /**
+ * @param action Action to be taken
+ * @return FirewallRule Builder
+ */
+ public Builder action(FirewallAction action) {
+ this.action = action;
+ return this;
+ }
+
+ /**
+ * @param comment Optional rule comment
+ * @return FirewallRule Builder
+ */
+ public Builder comment(String comment) {
+ this.comment = comment;
+ return this;
+ }
+
+ /**
+ * @param direction Packet direction
+ * @return FirewallRule Builder
+ */
+ public Builder direction(FirewallDirection direction) {
+ this.direction = direction;
+ return this;
+ }
+
+ /**
+ * @param destinationIp Destination IP address
+ * @return FirewallRule Builder
+ */
+ public Builder destinationIp(String destinationIp) {
+ this.destinationIp = destinationIp;
+ return this;
+ }
+
+ /**
+ * @param destinationPort Destination port
+ * @return FirewallRule Builder
+ */
+ public Builder destinationPort(String destinationPort) {
+ this.destinationPort = destinationPort;
+ return this;
+ }
+
+ /**
+ * @param ipProtocol IP protocol
+ * @return FirewallRule Builder
+ */
+ public Builder ipProtocol(FirewallIpProtocol ipProtocol) {
+ this.ipProtocol = ipProtocol;
+ return this;
+ }
+
+ /**
+ * @param sourceIp Source IP address
+ * @return FirewallRule Builder
+ */
+ public Builder sourceIp(String sourceIp) {
+ this.sourceIp = sourceIp;
+ return this;
+ }
+
+ /**
+ * @param sourcePort Source port
+ * @return FirewallRule Builder
+ */
+ public Builder sourcePort(String sourcePort) {
+ this.sourcePort = sourcePort;
+ return this;
+ }
+
+ public FirewallRule build() {
+ return new FirewallRule(action, comment, direction, destinationIp, destinationPort, ipProtocol, sourceIp
+ , sourcePort);
+ }
+ }
+
+ private final FirewallAction action;
+ private final String comment;
+ private final FirewallDirection direction;
+ @Named("dst_ip")
+ private final String destinationIp;
+ @Named("dst_port")
+ private final String destinationPort;
+ @Named("ip_proto")
+ private final FirewallIpProtocol ipProtocol;
+ @Named("src_ip")
+ private final String sourceIp;
+ @Named("src_port")
+ private final String sourcePort;
+
+ @ConstructorProperties({
+ "action", "comment", "direction", "dst_ip",
+ "dst_port", "ip_proto", "src_ip", "src_port"
+ })
+ public FirewallRule(FirewallAction action, String comment, FirewallDirection direction, String destinationIp
+ , String destinationPort, FirewallIpProtocol ipProtocol, String sourceIp, String sourcePort) {
+ this.action = action;
+ this.comment = comment;
+ this.direction = direction;
+ this.destinationIp = destinationIp;
+ this.destinationPort = destinationPort;
+ this.ipProtocol = ipProtocol;
+ this.sourceIp = sourceIp;
+ this.sourcePort = sourcePort;
+ }
+
+ /**
+ * @return Action to be taken
+ */
+ public FirewallAction getAction() {
+ return action;
+ }
+
+ /**
+ * @return Optional rule comment
+ */
+ public String getComment() {
+ return comment;
+ }
+
+ /**
+ * @return Packet direction
+ */
+ public FirewallDirection getDirection() {
+ return direction;
+ }
+
+ /**
+ * @return Destination IP address
+ */
+ public String getDestinationIp() {
+ return destinationIp;
+ }
+
+ /**
+ * @return Destination port
+ */
+ public String getDestinationPort() {
+ return destinationPort;
+ }
+
+ /**
+ * @return IP protocol
+ */
+ public FirewallIpProtocol getIpProtocol() {
+ return ipProtocol;
+ }
+
+ /**
+ * @return Source IP address
+ */
+ public String getSourceIp() {
+ return sourceIp;
+ }
+
+ /**
+ * @return Source port
+ */
+ public String getSourcePort() {
+ return sourcePort;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (!(o instanceof FirewallRule)) return false;
+
+ FirewallRule that = (FirewallRule) o;
+
+ if (action != that.action) return false;
+ if (comment != null ? !comment.equals(that.comment) : that.comment != null) return false;
+ if (destinationIp != null ? !destinationIp.equals(that.destinationIp) : that.destinationIp != null)
+ return false;
+ if (destinationPort != null ? !destinationPort.equals(that.destinationPort) : that.destinationPort != null)
+ return false;
+ if (direction != that.direction) return false;
+ if (ipProtocol != that.ipProtocol) return false;
+ if (sourceIp != null ? !sourceIp.equals(that.sourceIp) : that.sourceIp != null) return false;
+ if (sourcePort != null ? !sourcePort.equals(that.sourcePort) : that.sourcePort != null) return false;
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = action != null ? action.hashCode() : 0;
+ result = 31 * result + (comment != null ? comment.hashCode() : 0);
+ result = 31 * result + (direction != null ? direction.hashCode() : 0);
+ result = 31 * result + (destinationIp != null ? destinationIp.hashCode() : 0);
+ result = 31 * result + (destinationPort != null ? destinationPort.hashCode() : 0);
+ result = 31 * result + (ipProtocol != null ? ipProtocol.hashCode() : 0);
+ result = 31 * result + (sourceIp != null ? sourceIp.hashCode() : 0);
+ result = 31 * result + (sourcePort != null ? sourcePort.hashCode() : 0);
+ return result;
+ }
+
+ @Override
+ public String toString() {
+ return "[" +
+ "action=" + action +
+ ", comment='" + comment + '\'' +
+ ", direction=" + direction +
+ ", destinationIp='" + destinationIp + '\'' +
+ ", destinationPort='" + destinationPort + '\'' +
+ ", ipProtocol=" + ipProtocol +
+ ", sourceIp='" + sourceIp + '\'' +
+ ", sourcePort='" + sourcePort + '\'' +
+ "]";
+ }
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0d70c84a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/IOStats.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/IOStats.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/IOStats.java
index b71a369..4a10789 100644
--- a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/IOStats.java
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/IOStats.java
@@ -24,99 +24,99 @@ import java.beans.ConstructorProperties;
*/
public class IOStats {
- @Named("bytes_recv")
- private final String bytesReceived;
- @Named("bytes_sent")
- private final String bytesSent;
- @Named("packets_recv")
- private final String packetsReceived;
- @Named("packets_sent")
- private final String packetsSent;
+ @Named("bytes_recv")
+ private final String bytesReceived;
+ @Named("bytes_sent")
+ private final String bytesSent;
+ @Named("packets_recv")
+ private final String packetsReceived;
+ @Named("packets_sent")
+ private final String packetsSent;
- @ConstructorProperties({
- "bytes_recv", "bytes_sent", "packets_recv", "packets_sent"
- })
- public IOStats(String bytesReceived, String bytesSent, String packetsReceived, String packetsSent){
- this.bytesReceived = bytesReceived;
- this.bytesSent = bytesSent;
- this.packetsReceived = packetsReceived;
- this.packetsSent = packetsSent;
- }
+ @ConstructorProperties({
+ "bytes_recv", "bytes_sent", "packets_recv", "packets_sent"
+ })
+ public IOStats(String bytesReceived, String bytesSent, String packetsReceived, String packetsSent) {
+ this.bytesReceived = bytesReceived;
+ this.bytesSent = bytesSent;
+ this.packetsReceived = packetsReceived;
+ this.packetsSent = packetsSent;
+ }
- /**
- * @return Bytes received on this interface
- */
- public String getBytesReceived() {
- return bytesReceived;
- }
+ /**
+ * @return Bytes received on this interface
+ */
+ public String getBytesReceived() {
+ return bytesReceived;
+ }
- /**
- * @return Packets received on this interface
- */
- public String getBytesSent() {
- return bytesSent;
- }
+ /**
+ * @return Packets received on this interface
+ */
+ public String getBytesSent() {
+ return bytesSent;
+ }
- /**
- * @return Bytes sent from this interface
- */
- public String getPacketsReceived() {
- return packetsReceived;
- }
+ /**
+ * @return Bytes sent from this interface
+ */
+ public String getPacketsReceived() {
+ return packetsReceived;
+ }
- /**
- * @return Packets sent from this interface
- */
- public String getPacketsSent() {
- return packetsSent;
- }
+ /**
+ * @return Packets sent from this interface
+ */
+ public String getPacketsSent() {
+ return packetsSent;
+ }
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = super.hashCode();
- result = prime * result + ((bytesReceived == null) ? 0 : bytesReceived.hashCode());
- result = prime * result + ((bytesSent == null) ? 0 : bytesSent.hashCode());
- result = prime * result + ((packetsReceived == null) ? 0 : packetsReceived.hashCode());
- result = prime * result + ((packetsSent == null) ? 0 : packetsSent.hashCode());
- return result;
- }
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = super.hashCode();
+ result = prime * result + ((bytesReceived == null) ? 0 : bytesReceived.hashCode());
+ result = prime * result + ((bytesSent == null) ? 0 : bytesSent.hashCode());
+ result = prime * result + ((packetsReceived == null) ? 0 : packetsReceived.hashCode());
+ result = prime * result + ((packetsSent == null) ? 0 : packetsSent.hashCode());
+ return result;
+ }
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (!super.equals(obj))
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (!super.equals(obj))
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ IOStats other = (IOStats) obj;
+ if (bytesReceived == null) {
+ if (other.bytesReceived != null)
return false;
- if (getClass() != obj.getClass())
+ } else if (!bytesReceived.equals(other.bytesReceived))
+ return false;
+ if (bytesSent == null) {
+ if (other.bytesSent != null)
return false;
- IOStats other = (IOStats) obj;
- if (bytesReceived == null) {
- if (other.bytesReceived != null)
- return false;
- } else if (!bytesReceived.equals(other.bytesReceived))
+ } else if (!bytesSent.equals(other.bytesSent))
+ return false;
+ if (packetsReceived == null) {
+ if (other.packetsReceived != null)
return false;
- if (bytesSent == null) {
- if (other.bytesSent != null)
- return false;
- } else if (!bytesSent.equals(other.bytesSent))
+ } else if (!packetsReceived.equals(other.packetsReceived))
+ return false;
+ if (packetsSent == null) {
+ if (other.packetsSent != null)
return false;
- if (packetsReceived == null) {
- if (other.packetsReceived != null)
- return false;
- } else if (!packetsReceived.equals(other.packetsReceived))
- return false;
- if (packetsSent == null) {
- if (other.packetsSent != null)
- return false;
- } else if (!packetsSent.equals(other.packetsSent))
- return false;
- return true;
- }
+ } else if (!packetsSent.equals(other.packetsSent))
+ return false;
+ return true;
+ }
- @Override
- public String toString() {
- return "[bytesReceived=" + bytesReceived + ", bytesSent=" + bytesSent + ", packetsReceived=" + packetsReceived
- + ", packetsSent=" + packetsSent + "]";
- }
+ @Override
+ public String toString() {
+ return "[bytesReceived=" + bytesReceived + ", bytesSent=" + bytesSent + ", packetsReceived=" + packetsReceived
+ + ", packetsSent=" + packetsSent + "]";
+ }
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0d70c84a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/IP.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/IP.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/IP.java
index 730c031..de7891a 100644
--- a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/IP.java
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/IP.java
@@ -26,226 +26,226 @@ import java.net.URI;
*/
public class IP {
- public static class Builder {
- protected Owner owner;
- protected String uuid;
- protected Server server;
- protected URI resourceUri;
-
- /**
- * @param uuid Uuid of the ip.
- * @return IP Builder
- */
- public Builder uuid(String uuid) {
- this.uuid = uuid;
- return this;
- }
-
- /**
- * @param owner Owner of the ip.
- * @return IP Builder
- */
- public Builder owner(Owner owner) {
- this.owner = owner;
- return this;
- }
-
- /**
- * @param server Server this IP assigned to
- * @return IP Builder
- */
- public Builder server(Server server) {
- this.server = server;
- return this;
- }
-
- /**
- * @param resourceUri Resource uri
- * @return IP Builder
- */
- public Builder resourceUri(URI resourceUri) {
- this.resourceUri = resourceUri;
- return this;
- }
-
- public IP build() {
- return new IP(uuid, owner, server, resourceUri);
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (!(o instanceof Builder)) return false;
-
- Builder builder = (Builder) o;
-
- if (owner != null ? !owner.equals(builder.owner) : builder.owner != null) return false;
- if (resourceUri != null ? !resourceUri.equals(builder.resourceUri) : builder.resourceUri != null)
- return false;
- if (server != null ? !server.equals(builder.server) : builder.server != null) return false;
- if (uuid != null ? !uuid.equals(builder.uuid) : builder.uuid != null) return false;
-
- return true;
- }
-
- @Override
- public int hashCode() {
- int result = owner != null ? owner.hashCode() : 0;
- result = 31 * result + (uuid != null ? uuid.hashCode() : 0);
- result = 31 * result + (server != null ? server.hashCode() : 0);
- result = 31 * result + (resourceUri != null ? resourceUri.hashCode() : 0);
- return result;
- }
- }
-
- protected final Owner owner;
- protected final String uuid;
- protected final Server server;
- protected final URI resourceUri;
-
- @ConstructorProperties({
- "uuid", "owner", "server", "resource_uri"
- })
- public IP(String uuid, Owner owner, Server server, URI resourceUri) {
- this.owner = owner;
- this.uuid = uuid;
- this.server = server;
- this.resourceUri = resourceUri;
- }
-
- /**
- * @return Uuid of the ip.
- */
- @Nullable
- public String getUuid() {
- return uuid;
- }
-
- /**
- * @return Owner of the ip.
- */
- public Owner getOwner() {
- return owner;
- }
-
- /**
- * @return Server this IP assigned to
- */
- public Server getServer() {
- return server;
- }
-
- /**
- * @return Resource uri
- */
- public URI getResourceUri() {
- return resourceUri;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (!(o instanceof IP)) return false;
-
- IP ip = (IP) o;
-
- if (owner != null ? !owner.equals(ip.owner) : ip.owner != null) return false;
- if (resourceUri != null ? !resourceUri.equals(ip.resourceUri) : ip.resourceUri != null) return false;
- if (server != null ? !server.equals(ip.server) : ip.server != null) return false;
- if (uuid != null ? !uuid.equals(ip.uuid) : ip.uuid != null) return false;
-
- return true;
- }
-
- @Override
- public int hashCode() {
- int result = owner != null ? owner.hashCode() : 0;
- result = 31 * result + (uuid != null ? uuid.hashCode() : 0);
- result = 31 * result + (server != null ? server.hashCode() : 0);
- result = 31 * result + (resourceUri != null ? resourceUri.hashCode() : 0);
- return result;
- }
-
- @Override
- public String toString() {
- return "[" +
- "owner=" + owner +
- ", uuid='" + uuid + '\'' +
- ", server=" + server +
- ", resourceUri=" + resourceUri +
- "]";
- }
-
- /**
- * Creates DHCP V4 NIC for attaching to server
- *
- * @param model Interface model
- * @param firewallPolicy Firewall policy for interface
- * @return server's NIC
- */
- public static NIC createDHCPIPv4ConfNIC(Model model, FirewallPolicy firewallPolicy){
- return new NIC.Builder()
- .ipV4Configuration(new IPConfiguration(IPConfigurationType.DHCP, null))
- .model(model)
- .firewallPolicy(firewallPolicy)
- .build();
- }
-
- /**
- * Creates DHCP V4 NIC for attaching to server
- *
- * @param model Interface model
- * @return server's NIC
- */
- public static NIC createDHCPIPv4ConfNIC(Model model){
- return createDHCPIPv4ConfNIC(model, null);
- }
-
- /**
- * Creates DHCP V6 NIC for attaching to server
- *
- * @param model Interface model
- * @param firewallPolicy Firewall policy for interface
- * @return server's NIC
- */
- public static NIC createDHCPIPv6ConfNIC(Model model, FirewallPolicy firewallPolicy){
- return new NIC.Builder()
- .ipV4Configuration(new IPConfiguration(IPConfigurationType.DHCP, null))
- .model(model)
- .firewallPolicy(firewallPolicy)
- .build();
- }
-
- /**
- * Creates DHCP V6 NIC for attaching to server
- *
- * @param model Interface model
- * @return server's NIC
- */
- public static NIC createDHCPIPv6ConfNIC(Model model){
- return createDHCPIPv6ConfNIC(model, null);
- }
-
- /**
- * Creates NIC with static IP for attaching to server
- *
- * @param model Interface model
- * @param firewallPolicy Firewall policy
- * @return server's NIC
- */
- public NIC toNIC(Model model, FirewallPolicy firewallPolicy){
- return new NIC.Builder()
- .ipV4Configuration(new IPConfiguration(IPConfigurationType.STATIC, this))
- .firewallPolicy(firewallPolicy)
- .build();
- }
-
- /**
- * Creates NIC with static IP for attaching to server
- *
- * @return server's NIC
- */
- public NIC toNIC(){
- return toNIC(null, null);
- }
+ public static class Builder {
+ protected Owner owner;
+ protected String uuid;
+ protected Server server;
+ protected URI resourceUri;
+
+ /**
+ * @param uuid Uuid of the ip.
+ * @return IP Builder
+ */
+ public Builder uuid(String uuid) {
+ this.uuid = uuid;
+ return this;
+ }
+
+ /**
+ * @param owner Owner of the ip.
+ * @return IP Builder
+ */
+ public Builder owner(Owner owner) {
+ this.owner = owner;
+ return this;
+ }
+
+ /**
+ * @param server Server this IP assigned to
+ * @return IP Builder
+ */
+ public Builder server(Server server) {
+ this.server = server;
+ return this;
+ }
+
+ /**
+ * @param resourceUri Resource uri
+ * @return IP Builder
+ */
+ public Builder resourceUri(URI resourceUri) {
+ this.resourceUri = resourceUri;
+ return this;
+ }
+
+ public IP build() {
+ return new IP(uuid, owner, server, resourceUri);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (!(o instanceof Builder)) return false;
+
+ Builder builder = (Builder) o;
+
+ if (owner != null ? !owner.equals(builder.owner) : builder.owner != null) return false;
+ if (resourceUri != null ? !resourceUri.equals(builder.resourceUri) : builder.resourceUri != null)
+ return false;
+ if (server != null ? !server.equals(builder.server) : builder.server != null) return false;
+ if (uuid != null ? !uuid.equals(builder.uuid) : builder.uuid != null) return false;
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = owner != null ? owner.hashCode() : 0;
+ result = 31 * result + (uuid != null ? uuid.hashCode() : 0);
+ result = 31 * result + (server != null ? server.hashCode() : 0);
+ result = 31 * result + (resourceUri != null ? resourceUri.hashCode() : 0);
+ return result;
+ }
+ }
+
+ protected final Owner owner;
+ protected final String uuid;
+ protected final Server server;
+ protected final URI resourceUri;
+
+ @ConstructorProperties({
+ "uuid", "owner", "server", "resource_uri"
+ })
+ public IP(String uuid, Owner owner, Server server, URI resourceUri) {
+ this.owner = owner;
+ this.uuid = uuid;
+ this.server = server;
+ this.resourceUri = resourceUri;
+ }
+
+ /**
+ * @return Uuid of the ip.
+ */
+ @Nullable
+ public String getUuid() {
+ return uuid;
+ }
+
+ /**
+ * @return Owner of the ip.
+ */
+ public Owner getOwner() {
+ return owner;
+ }
+
+ /**
+ * @return Server this IP assigned to
+ */
+ public Server getServer() {
+ return server;
+ }
+
+ /**
+ * @return Resource uri
+ */
+ public URI getResourceUri() {
+ return resourceUri;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (!(o instanceof IP)) return false;
+
+ IP ip = (IP) o;
+
+ if (owner != null ? !owner.equals(ip.owner) : ip.owner != null) return false;
+ if (resourceUri != null ? !resourceUri.equals(ip.resourceUri) : ip.resourceUri != null) return false;
+ if (server != null ? !server.equals(ip.server) : ip.server != null) return false;
+ if (uuid != null ? !uuid.equals(ip.uuid) : ip.uuid != null) return false;
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = owner != null ? owner.hashCode() : 0;
+ result = 31 * result + (uuid != null ? uuid.hashCode() : 0);
+ result = 31 * result + (server != null ? server.hashCode() : 0);
+ result = 31 * result + (resourceUri != null ? resourceUri.hashCode() : 0);
+ return result;
+ }
+
+ @Override
+ public String toString() {
+ return "[" +
+ "owner=" + owner +
+ ", uuid='" + uuid + '\'' +
+ ", server=" + server +
+ ", resourceUri=" + resourceUri +
+ "]";
+ }
+
+ /**
+ * Creates DHCP V4 NIC for attaching to server
+ *
+ * @param model Interface model
+ * @param firewallPolicy Firewall policy for interface
+ * @return server's NIC
+ */
+ public static NIC createDHCPIPv4ConfNIC(Model model, FirewallPolicy firewallPolicy) {
+ return new NIC.Builder()
+ .ipV4Configuration(new IPConfiguration(IPConfigurationType.DHCP, null))
+ .model(model)
+ .firewallPolicy(firewallPolicy)
+ .build();
+ }
+
+ /**
+ * Creates DHCP V4 NIC for attaching to server
+ *
+ * @param model Interface model
+ * @return server's NIC
+ */
+ public static NIC createDHCPIPv4ConfNIC(Model model) {
+ return createDHCPIPv4ConfNIC(model, null);
+ }
+
+ /**
+ * Creates DHCP V6 NIC for attaching to server
+ *
+ * @param model Interface model
+ * @param firewallPolicy Firewall policy for interface
+ * @return server's NIC
+ */
+ public static NIC createDHCPIPv6ConfNIC(Model model, FirewallPolicy firewallPolicy) {
+ return new NIC.Builder()
+ .ipV4Configuration(new IPConfiguration(IPConfigurationType.DHCP, null))
+ .model(model)
+ .firewallPolicy(firewallPolicy)
+ .build();
+ }
+
+ /**
+ * Creates DHCP V6 NIC for attaching to server
+ *
+ * @param model Interface model
+ * @return server's NIC
+ */
+ public static NIC createDHCPIPv6ConfNIC(Model model) {
+ return createDHCPIPv6ConfNIC(model, null);
+ }
+
+ /**
+ * Creates NIC with static IP for attaching to server
+ *
+ * @param model Interface model
+ * @param firewallPolicy Firewall policy
+ * @return server's NIC
+ */
+ public NIC toNIC(Model model, FirewallPolicy firewallPolicy) {
+ return new NIC.Builder()
+ .ipV4Configuration(new IPConfiguration(IPConfigurationType.STATIC, this))
+ .firewallPolicy(firewallPolicy)
+ .build();
+ }
+
+ /**
+ * Creates NIC with static IP for attaching to server
+ *
+ * @return server's NIC
+ */
+ public NIC toNIC() {
+ return toNIC(null, null);
+ }
}
[11/13] git commit: Fix code style of the cloudsigma2 provider.
Posted by na...@apache.org.
Fix code style of the cloudsigma2 provider.
Project: http://git-wip-us.apache.org/repos/asf/jclouds-labs/repo
Commit: http://git-wip-us.apache.org/repos/asf/jclouds-labs/commit/0d70c84a
Tree: http://git-wip-us.apache.org/repos/asf/jclouds-labs/tree/0d70c84a
Diff: http://git-wip-us.apache.org/repos/asf/jclouds-labs/diff/0d70c84a
Branch: refs/heads/master
Commit: 0d70c84a3872e0ed85e4c8708e2b51a2dd6989fb
Parents: 0bebb58
Author: Vladimir Shevchenko <sh...@gmail.com>
Authored: Thu Nov 14 01:13:47 2013 +0700
Committer: Ignasi Barrera <na...@apache.org>
Committed: Thu Nov 14 12:20:57 2013 +0100
----------------------------------------------------------------------
cloudsigma2/pom.xml | 188 +-
.../org/jclouds/cloudsigma2/CloudSigma2Api.java | 2030 ++++++-----
.../cloudsigma2/CloudSigma2ApiMetadata.java | 30 +-
.../binders/BindCreateSubscriptionRequest.java | 35 +-
.../BindCreateSubscriptionRequestList.java | 49 +-
.../cloudsigma2/binders/BindDriveToJson.java | 34 +-
.../cloudsigma2/binders/BindDrivesToJson.java | 49 +-
.../BindFirewallPoliciesListToJsonRequest.java | 48 +-
.../BindFirewallPolicyToJsonRequest.java | 34 +-
.../binders/BindIPInfoToJsonRequest.java | 34 +-
.../binders/BindLibraryDriveToJson.java | 28 +-
.../binders/BindProfileInfoToJsonRequest.java | 28 +-
.../BindServerInfoListToJsonRequest.java | 49 +-
.../binders/BindServerInfoToJsonRequest.java | 28 +-
.../binders/BindTagListToJsonRequest.java | 48 +-
.../binders/BindTagToJsonRequest.java | 34 +-
.../binders/BindUuidStringsToJsonArray.java | 41 +-
.../binders/BindVLANToJsonRequest.java | 30 +-
.../config/CloudSigma2HttpApiModule.java | 12 +-
.../config/CloudSigma2ParserModule.java | 10 +-
.../config/CloudSigma2Properties.java | 11 +-
.../cloudsigma2/domain/AccountBalance.java | 92 +-
.../cloudsigma2/domain/AccountUsage.java | 421 +--
.../jclouds/cloudsigma2/domain/BurstLevel.java | 408 +--
.../domain/CreateSubscriptionRequest.java | 132 +-
.../cloudsigma2/domain/CurrentUsage.java | 130 +-
.../cloudsigma2/domain/DeviceEmulationType.java | 30 +-
.../jclouds/cloudsigma2/domain/Discount.java | 86 +-
.../org/jclouds/cloudsigma2/domain/Drive.java | 287 +-
.../jclouds/cloudsigma2/domain/DriveInfo.java | 608 ++--
.../cloudsigma2/domain/DriveLicense.java | 160 +-
.../jclouds/cloudsigma2/domain/DriveStatus.java | 1 -
.../domain/DrivesListRequestFieldsGroup.java | 38 +-
.../cloudsigma2/domain/FirewallAction.java | 30 +-
.../cloudsigma2/domain/FirewallDirection.java | 30 +-
.../cloudsigma2/domain/FirewallIpProtocol.java | 30 +-
.../cloudsigma2/domain/FirewallPolicy.java | 374 +-
.../cloudsigma2/domain/FirewallRule.java | 441 +--
.../org/jclouds/cloudsigma2/domain/IOStats.java | 166 +-
.../java/org/jclouds/cloudsigma2/domain/IP.java | 444 +--
.../cloudsigma2/domain/IPConfiguration.java | 148 +-
.../cloudsigma2/domain/IPConfigurationType.java | 30 +-
.../org/jclouds/cloudsigma2/domain/IPInfo.java | 442 +--
.../cloudsigma2/domain/InterfaceType.java | 30 +-
.../org/jclouds/cloudsigma2/domain/Item.java | 266 +-
.../cloudsigma2/domain/LibraryDrive.java | 696 ++--
.../org/jclouds/cloudsigma2/domain/License.java | 292 +-
.../jclouds/cloudsigma2/domain/MediaType.java | 2 +-
.../org/jclouds/cloudsigma2/domain/Model.java | 1 -
.../org/jclouds/cloudsigma2/domain/NIC.java | 400 +-
.../jclouds/cloudsigma2/domain/NICStats.java | 160 +-
.../org/jclouds/cloudsigma2/domain/Owner.java | 265 +-
.../cloudsigma2/domain/PaginatedCollection.java | 56 +-
.../org/jclouds/cloudsigma2/domain/Price.java | 386 +-
.../org/jclouds/cloudsigma2/domain/Pricing.java | 160 +-
.../jclouds/cloudsigma2/domain/ProfileInfo.java | 1009 +++---
.../org/jclouds/cloudsigma2/domain/Server.java | 277 +-
.../domain/ServerAvailabilityGroup.java | 62 +-
.../jclouds/cloudsigma2/domain/ServerDrive.java | 281 +-
.../jclouds/cloudsigma2/domain/ServerInfo.java | 826 +++--
.../cloudsigma2/domain/ServerRuntime.java | 114 +-
.../cloudsigma2/domain/ServerStatus.java | 2 +-
.../cloudsigma2/domain/Subscription.java | 864 ++---
.../domain/SubscriptionResource.java | 31 +-
.../org/jclouds/cloudsigma2/domain/Tag.java | 234 +-
.../jclouds/cloudsigma2/domain/TagResource.java | 246 +-
.../cloudsigma2/domain/TagResourceType.java | 30 +-
.../jclouds/cloudsigma2/domain/Transaction.java | 333 +-
.../org/jclouds/cloudsigma2/domain/Usage.java | 160 +-
.../jclouds/cloudsigma2/domain/VLANInfo.java | 432 +--
.../CreateSubscriptionRequestToJson.java | 34 +-
.../cloudsigma2/functions/DriveToJson.java | 48 +-
.../functions/FirewallPolicyToJson.java | 86 +-
.../cloudsigma2/functions/IPInfoToJson.java | 24 +-
.../functions/LibraryDriveToJson.java | 34 +-
.../functions/ProfileInfoToJson.java | 102 +-
.../cloudsigma2/functions/ServerInfoToJson.java | 200 +-
.../cloudsigma2/functions/TagToJson.java | 36 +-
.../cloudsigma2/functions/VLANInfoToJson.java | 22 +-
.../functions/internal/ParseDiscounts.java | 56 +-
.../functions/internal/ParseDriveInfos.java | 54 +-
.../functions/internal/ParseDrives.java | 54 +-
.../internal/ParseFirewallPolicies.java | 90 +-
.../functions/internal/ParseIPInfos.java | 56 +-
.../functions/internal/ParseIPs.java | 54 +-
.../functions/internal/ParseLibraryDrives.java | 54 +-
.../functions/internal/ParseLicenses.java | 54 +-
.../functions/internal/ParseServerInfos.java | 54 +-
.../functions/internal/ParseServers.java | 54 +-
.../functions/internal/ParseSubscriptions.java | 90 +-
.../functions/internal/ParseTags.java | 88 +-
.../functions/internal/ParseTransactions.java | 54 +-
.../functions/internal/ParseVLANs.java | 88 +-
.../handlers/CloudSigmaErrorHandler.java | 53 +-
.../cloudsigma2/options/PaginationOptions.java | 176 +-
.../cloudsigma2/CloudSigma2ApiExpectTest.java | 3414 +++++++++---------
.../cloudsigma2/CloudSigma2ApiLiveTest.java | 1168 +++---
.../functions/CloudSigma2ParserTest.java | 20 +-
.../CreateSubscriptionRequestToJsonTest.java | 40 +-
.../cloudsigma2/functions/DriveToJsonTest.java | 98 +-
.../functions/FirewallPolicyToJsonTest.java | 202 +-
.../cloudsigma2/functions/IPInfoToJsonTest.java | 82 +-
.../functions/LibraryDriveToJsonTest.java | 91 +-
.../functions/ProfileInfoToJsonTest.java | 120 +-
.../functions/ServerInfoToJsonTest.java | 226 +-
.../cloudsigma2/functions/TagToJsonTest.java | 94 +-
.../functions/VLANInfoToJsonTest.java | 77 +-
107 files changed, 11238 insertions(+), 11102 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0d70c84a/cloudsigma2/pom.xml
----------------------------------------------------------------------
diff --git a/cloudsigma2/pom.xml b/cloudsigma2/pom.xml
index 5b57f00..7863e2b 100644
--- a/cloudsigma2/pom.xml
+++ b/cloudsigma2/pom.xml
@@ -17,101 +17,107 @@
limitations under the License.
-->
-<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/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
+<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/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.jclouds.labs</groupId>
+ <artifactId>jclouds-labs</artifactId>
+ <version>1.7.0-SNAPSHOT</version>
+ </parent>
+
+ <!-- TODO: when out of labs, switch to org.jclouds.provider -->
<groupId>org.apache.jclouds.labs</groupId>
- <artifactId>jclouds-labs</artifactId>
+ <artifactId>cloudsigma2</artifactId>
<version>1.7.0-SNAPSHOT</version>
- </parent>
+ <name>jclouds CloudSigma v2 API</name>
+ <description>ComputeService binding to the CloudSigma v2 API</description>
+ <packaging>bundle</packaging>
- <!-- TODO: when out of labs, switch to org.jclouds.provider -->
- <groupId>org.apache.jclouds.labs</groupId>
- <artifactId>cloudsigma2</artifactId>
- <version>1.7.0-SNAPSHOT</version>
- <name>jclouds CloudSigma v2 API</name>
- <description>ComputeService binding to the CloudSigma v2 API</description>
- <packaging>bundle</packaging>
-
- <properties>
- <test.cloudsigma2.endpoint>https://zrh.cloudsigma.com/api/2.0/</test.cloudsigma2.endpoint>
- <test.cloudsigma2.api-version>2.0</test.cloudsigma2.api-version>
- <test.cloudsigma2.identity>FIXME</test.cloudsigma2.identity>
- <test.cloudsigma2.credential>FIXME</test.cloudsigma2.credential>
- <test.cloudsigma2.template>imageId=f3c7c665-cd54-4a78-8fd2-7ec2f028cf29</test.cloudsigma2.template>
- <jclouds.osgi.export>org.jclouds.cloudsigma2*;version="${project.version}"</jclouds.osgi.export>
- <jclouds.osgi.import>
- org.jclouds.compute.internal;version="${project.version}",
- org.jclouds.rest.internal;version="${project.version}",
- org.jclouds*;version="${project.version}",
- *
- </jclouds.osgi.import>
- </properties>
+ <properties>
+ <test.cloudsigma2.endpoint>https://zrh.cloudsigma.com/api/2.0/</test.cloudsigma2.endpoint>
+ <test.cloudsigma2.api-version>2.0</test.cloudsigma2.api-version>
+ <test.cloudsigma2.identity>FIXME</test.cloudsigma2.identity>
+ <test.cloudsigma2.credential>FIXME</test.cloudsigma2.credential>
+ <test.cloudsigma2.template>imageId=f3c7c665-cd54-4a78-8fd2-7ec2f028cf29</test.cloudsigma2.template>
+ <jclouds.osgi.export>org.jclouds.cloudsigma2*;version="${project.version}"</jclouds.osgi.export>
+ <jclouds.osgi.import>
+ org.jclouds.compute.internal;version="${project.version}",
+ org.jclouds.rest.internal;version="${project.version}",
+ org.jclouds*;version="${project.version}",
+ *
+ </jclouds.osgi.import>
+ </properties>
- <dependencies>
- <dependency>
- <groupId>org.apache.jclouds</groupId>
- <artifactId>jclouds-compute</artifactId>
- <version>${project.parent.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.jclouds.driver</groupId>
- <artifactId>jclouds-sshj</artifactId>
- <version>${project.parent.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.jclouds</groupId>
- <artifactId>jclouds-core</artifactId>
- <version>${project.parent.version}</version>
- <type>test-jar</type>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.jclouds</groupId>
- <artifactId>jclouds-compute</artifactId>
- <version>${project.parent.version}</version>
- <type>test-jar</type>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.jclouds.driver</groupId>
- <artifactId>jclouds-log4j</artifactId>
- <version>${project.parent.version}</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.jclouds</groupId>
+ <artifactId>jclouds-compute</artifactId>
+ <version>${project.parent.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.jclouds.driver</groupId>
+ <artifactId>jclouds-sshj</artifactId>
+ <version>${project.parent.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.jclouds</groupId>
+ <artifactId>jclouds-core</artifactId>
+ <version>${project.parent.version}</version>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.jclouds</groupId>
+ <artifactId>jclouds-compute</artifactId>
+ <version>${project.parent.version}</version>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.jclouds.driver</groupId>
+ <artifactId>jclouds-log4j</artifactId>
+ <version>${project.parent.version}</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
- <profiles>
- <profile>
- <id>live</id>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <executions>
- <execution>
- <id>integration</id>
- <phase>integration-test</phase>
- <goals>
- <goal>test</goal>
- </goals>
- <configuration>
- <systemPropertyVariables>
- <test.cloudsigma2.endpoint>${test.cloudsigma2.endpoint}</test.cloudsigma2.endpoint>
- <test.cloudsigma2.api-version>${test.cloudsigma2.api-version}</test.cloudsigma2.api-version>
- <test.cloudsigma2.build-version>${test.cloudsigma2.build-version}</test.cloudsigma2.build-version>
- <test.cloudsigma2.credential>${test.cloudsigma2.credential}</test.cloudsigma2.credential>
- <test.cloudsigma2.template>${test.cloudsigma2.template}</test.cloudsigma2.template>
- </systemPropertyVariables>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- </profile>
- </profiles>
+ <profiles>
+ <profile>
+ <id>live</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>integration</id>
+ <phase>integration-test</phase>
+ <goals>
+ <goal>test</goal>
+ </goals>
+ <configuration>
+ <systemPropertyVariables>
+ <test.cloudsigma2.endpoint>${test.cloudsigma2.endpoint}
+ </test.cloudsigma2.endpoint>
+ <test.cloudsigma2.api-version>${test.cloudsigma2.api-version}
+ </test.cloudsigma2.api-version>
+ <test.cloudsigma2.build-version>${test.cloudsigma2.build-version}
+ </test.cloudsigma2.build-version>
+ <test.cloudsigma2.credential>${test.cloudsigma2.credential}
+ </test.cloudsigma2.credential>
+ <test.cloudsigma2.template>${test.cloudsigma2.template}
+ </test.cloudsigma2.template>
+ </systemPropertyVariables>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
</project>
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0d70c84a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/CloudSigma2Api.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/CloudSigma2Api.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/CloudSigma2Api.java
index b594169..83886f4 100644
--- a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/CloudSigma2Api.java
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/CloudSigma2Api.java
@@ -106,1020 +106,1018 @@ import java.util.List;
@SkipEncoding({'?', '/', '='})
public interface CloudSigma2Api extends Closeable {
- /**
- * Gets the list of drives to which the authenticated user has access.
- *
- * @return list of drives or empty list if no drives are found
- */
- @Named("drive:listDrives")
- @GET
- @Path("/drives/")
- @ResponseParser(ParseDrives.class)
- @Transform(ParseDrives.ToPagedIterable.class)
- PagedIterable<Drive> listDrives();
-
- /**
- * Gets the list of drives to which the authenticated user has access.
- *
- * @return PaginatedCollection of drives
- */
- @Named("drive:listDrives")
- @GET
- @Path("/drives/")
- @ResponseParser(ParseDrives.class)
- PaginatedCollection<Drive> listDrives(PaginationOptions options);
-
- /**
- * Gets the list of drives to which the authenticated user has access.
- *
- * @param fields A set of field names specifying the returned fields
- * @param limit number of drives to show
- * @return or empty set if no drives are found
- */
- @Named("drive:listDrives")
- @GET
- @Path("/drives/")
- @SelectJson("objects")
- List<DriveInfo> listDrives(@QueryParam("fields") DrivesListRequestFieldsGroup fields
- , @DefaultValue("0") @QueryParam("limit") int limit);
-
- /**
- * Gets the detailed list of drives with additional information to which the authenticated user has access.
- *
- * @return list of drives or empty list if no drives are found
- */
- @Named("drive:listDrivesInfo")
- @GET
- @Path("/drives/detail/")
- @ResponseParser(ParseDriveInfos.class)
- @Transform(ParseDriveInfos.ToPagedIterable.class)
- PagedIterable<DriveInfo> listDrivesInfo();
-
- /**
- * Gets the detailed list of drives with additional information to which the authenticated user has access.
- *
- * @return PaginatedCollection of drives
- */
- @Named("drive:listDrivesInfo")
- @GET
- @Path("/drives/detail/")
- @ResponseParser(ParseDriveInfos.class)
- PaginatedCollection<DriveInfo> listDrivesInfo(PaginationOptions options);
-
- /**
- * Gets detailed information for drive identified by drive uuid
- *
- * @param uuid drive uuid to get
- * @return null, if not found
- */
- @Named("drive:getDriveInfo/{uuid}")
- @GET
- @Path("/drives/{uuid}/")
- @Fallback(Fallbacks.NullOnNotFoundOr404.class)
- DriveInfo getDriveInfo(@PathParam("uuid") String uuid);
-
- /**
- * Creates a new drive
- *
- * @param createDrive required parameters: name, size, media
- * @return newly created drive
- */
- @Named("drive:createDrive")
- @POST
- @Path("/drives/")
- @Fallback(Fallbacks.NullOnNotFoundOr404.class)
- @SelectJson("objects")
- @OnlyElement
- DriveInfo createDrive(@BinderParam(BindDriveToJson.class) DriveInfo createDrive);
-
- /**
- * Creates multiple new drives
- *
- * @param createDrives required parameters: name, size, media
- * @return newly created drives
- */
- @Named("drive:listDrives")
- @POST
- @Fallback(Fallbacks.NullOnNotFoundOr404.class)
- @SelectJson("objects")
- @Path("/drives/")
- List<DriveInfo> createDrives(@BinderParam(BindDrivesToJson.class) List<DriveInfo> createDrives);
-
- /**
- * Deletes a single mounted or unmounted drive.
- *
- * @param uuid what to delete
- */
- @Named("drive:deleteDrive/{uuid}")
- @DELETE
- @Path("/drives/{uuid}/")
- @Fallback(Fallbacks.VoidOnNotFoundOr404.class)
- void deleteDrive(@PathParam("uuid") String uuid);
-
- /**
- * Deletes multiple mounted or unmounted drives specified by their UUID’s.
- *
- * @param uuids what drives to delete
- */
- @Named("drive:deleteDrives")
- @DELETE
- @Path("/drives/")
- @Fallback(Fallbacks.VoidOnNotFoundOr404.class)
- void deleteDrives(@BinderParam(BindUuidStringsToJsonArray.class) Iterable<String> uuids);
-
- /**
- * Edits a mounted or unmounted drive. If mounted, the server mounted on should be stopped.
- *
- * @param sourceUuid source drive to edit
- * @param driveInfo drive parameters to change
- * @return changed drive
- */
- @Named("drive:editDrive/{uuid}")
- @PUT
- @Path("/drives/{uuid}/")
- @Fallback(Fallbacks.VoidOnNotFoundOr404.class)
- DriveInfo editDrive(@PathParam("uuid") String sourceUuid
- , @BinderParam(BindDriveToJson.class) DriveInfo driveInfo);
-
-
- /**
- * Clones a drive. Request body is optional and any or all of the key/value pairs can be omitted.
- *
- * @param sourceUuid source drive to clone
- * @param driveInfo drive parameters to change
- * @return new drive
- */
- @Named("drive:cloneDrive/{uuid}")
- @POST
- @Path("/drives/{uuid}/action/?do=clone")
- @Fallback(Fallbacks.VoidOnNotFoundOr404.class)
- DriveInfo cloneDrive(@PathParam("uuid") String sourceUuid
- , @Nullable @BinderParam(BindDriveToJson.class) DriveInfo driveInfo);
-
- /**
- * Gets the list of library drives to which the authenticated user has access.
- *
- * @return list of library drives to which the authenticated user has access
- */
- @Named("libdrive:listLibraryDrives")
- @GET
- @Path("/libdrives/")
- @ResponseParser(ParseLibraryDrives.class)
- @Transform(ParseLibraryDrives.ToPagedIterable.class)
- PagedIterable<LibraryDrive> listLibraryDrives();
-
- /**
- * Gets the list of library drives to which the authenticated user has access.
- *
- * @return PaginatedCollection of library drives
- */
- @Named("libdrive:listLibraryDrives")
- @GET
- @Path("/libdrives/")
- @ResponseParser(ParseLibraryDrives.class)
- PaginatedCollection<LibraryDrive> listLibraryDrives(PaginationOptions options);
-
- /**
- * Gets detailed information for library drive identified by uuid.
- *
- * @param uuid uuid of library drive to be listed
- * @return drive information or null if not found
- */
- @Named("libdrive:getLibraryDrive/{uuid}")
- @GET
- @Path("/libdrives/{uuid}/")
- @Fallback(Fallbacks.NullOnNotFoundOr404.class)
- LibraryDrive getLibraryDrive(@PathParam("uuid") String uuid);
-
- /**
- * If a library drive is not a CDROM, you have to clone it in your account in order to use it.
- *
- * @param uuid uuid of library drive to clone
- * @param libraryDrive cloned drive
- * @return cloned drive information or null if not found
- */
- @Named("libdrive:cloneLibraryDrive/{uuid}")
- @POST
- @Path("/libdrives/{uuid}/action/?do=clone")
- @Fallback(Fallbacks.VoidOnNotFoundOr404.class)
- LibraryDrive cloneLibraryDrive(@PathParam("uuid") String uuid
- , @Nullable @BinderParam(BindLibraryDriveToJson.class) LibraryDrive libraryDrive);
-
- /**
- * Gets the list of servers to which the authenticated user has access.
- *
- * @return list of servers or empty list if no servers are found
- */
- @Named("server:listServers")
- @GET
- @Path("/servers/")
- @ResponseParser(ParseServers.class)
- @Transform(ParseServers.ToPagedIterable.class)
- PagedIterable<Server> listServers();
-
- /**
- * Gets the list of servers to which the authenticated user has access.
- *
- * @return PaginatedCollection of servers
- */
- @Named("server:listServers")
- @GET
- @Path("/servers/")
- @ResponseParser(ParseServers.class)
- PaginatedCollection<Server> listServers(PaginationOptions options);
-
- /**
- * Gets the detailed list of servers to which the authenticated user has access.
- *
- * @return list of servers or empty list if no servers are found
- */
- @Named("server:listServersInfo")
- @GET
- @Path("/servers/detail/")
- @ResponseParser(ParseServerInfos.class)
- @Transform(ParseServerInfos.ToPagedIterable.class)
- PagedIterable<ServerInfo> listServersInfo();
-
- /**
- * Gets the detailed list of servers to which the authenticated user has access.
- *
- * @return PaginatedCollection of servers
- */
- @Named("server:listServersInfo")
- @GET
- @Path("/servers/detail/")
- @ResponseParser(ParseServerInfos.class)
- PaginatedCollection<ServerInfo> listServersInfo(PaginationOptions options);
-
- /**
- * Creates a new virtual server or multiple servers.
- * The minimial amount of information you need to set is:
- * cpu
- * memory
- * name
- * vncPassword
- *
- * @param createServer required parameters: cpu, memory, name, vncPassword
- * @return newly created server
- */
- @Named("server:createServer")
- @POST
- @Path("/servers/")
- @SelectJson("objects")
- @OnlyElement
- ServerInfo createServer(@BinderParam(BindServerInfoToJsonRequest.class) ServerInfo createServer);
-
- /**
- * create a new servers
- *
- * @param servers servers to create. Required parameters: cpu, memory, name, vncPassword
- * @return newly created servers
- */
- @Named("server:createServers")
- @POST
- @Path("/servers/")
- @SelectJson("objects")
- List<ServerInfo> createServers(@BinderParam(BindServerInfoListToJsonRequest.class) Iterable<ServerInfo> servers);
-
- /**
- * Edits a server. Used also for attaching NIC’s and drives to servers.
- *
- * @param uuid server uuid
- * @param server data to change
- * @return modified server
- */
- @Named("server:editServer/{uuid}")
- @PUT
- @Path("/servers/{uuid}/")
- @Fallback(Fallbacks.VoidOnNotFoundOr404.class)
- ServerInfo editServer(@PathParam("uuid") String uuid
- , @BinderParam(BindServerInfoToJsonRequest.class) ServerInfo server);
-
- /**
- * Deletes a single server.
- *
- * @param uuid uuid of server to delete
- */
- @Named("server:deleteServer/{uuid}")
- @DELETE
- @Path("/servers/{uuid}/")
- @Fallback(Fallbacks.VoidOnNotFoundOr404.class)
- void deleteServer(@PathParam("uuid") String uuid);
-
- /**
- * Deletes multiple servers specified by their UUID’s.
- *
- * @param uuids server uuids to delete
- */
- @Named("server:deleteServers")
- @DELETE
- @Path("/servers/")
- @Fallback(Fallbacks.VoidOnNotFoundOr404.class)
- void deleteServers(@BinderParam(BindUuidStringsToJsonArray.class) Iterable<String> uuids);
-
- /**
- * Clones a server. Empty body.
- * Does cascading clone of server drives.
- * IPs of the cloned server are set to DHCP.
- * All other properties of the clone are equal to the original.
- *
- * @param uuid server what to clone
- *
- * @return cloned server
- */
- @Named("server:cloneServer/{uuid}")
- @POST
- @Path("/servers/{uuid}/action/?do=clone")
- @Fallback(Fallbacks.VoidOnNotFoundOr404.class)
- ServerInfo cloneServer(@PathParam("uuid") String uuid);
-
- /**
- * Gets detailed information for server identified by server uuid.
- *
- * @param uuid server uuid
- * @return server info or null, if not found
- */
- @Named("server:getServerInfo/{uuid}")
- @GET
- @Path("/servers/{uuid}/")
- @Fallback(Fallbacks.NullOnNotFoundOr404.class)
- ServerInfo getServerInfo(@PathParam("uuid") String uuid);
-
- /**
- * Starts a server with specific UUID.
- *
- * @param uuid uuid of server to start
- */
- @Named("server:startServer/{uuid}")
- @POST
- @Path("/servers/{uuid}/action/?do=start")
- @Fallback(Fallbacks.NullOnNotFoundOr404.class)
- void startServer(@PathParam("uuid") String uuid);
-
- /**
- * Stops a server with specific UUID.
- *
- * @param uuid uuid of server to stop
- */
- @Named("server:stopServer/{uuid}")
- @POST
- @Path("/servers/{uuid}/action/?do=stop")
- @Fallback(Fallbacks.NullOnNotFoundOr404.class)
- void stopServer(@PathParam("uuid") String uuid);
-
- /**
- * Starts a server with specific UUID assuring that it is started on a different physical infrastructure host
- * from the other servers specified in the avoid argument which is
- * a single server UUID or a comma-separated list of server UUIDs.
- * This way the server specified by uuid is run in a distinct availability group from the other listed servers.
- * Note that it might not always be possible to run a server in a different availability group,
- * therefore the order of the avoid list also signifies the priority of avoiding other servers.
- *
- * @param uuid uuid of server to start
- * @param uuidGroup availability group to avoid
- */
- @Named("server:startServerInSeparateAvailabilityGroup/{uuid}")
- @POST
- @Path("/servers/{uuid}/action/?do=start")
- @Fallback(Fallbacks.NullOnNotFoundOr404.class)
- void startServerInSeparateAvailabilityGroup(@PathParam("uuid") String uuid
- , @QueryParam("avoid") List<String> uuidGroup);
-
- /**
- * Opens a VNC tunnel to a server with specific UUID.
- *
- * @param uuid uuid of server to open VNC tunnel
- */
- @Named("server:openServerVNCTunnel/{uuid}")
- @POST
- @Path("/servers/{uuid}/action/?do=open_vnc")
- @Fallback(Fallbacks.NullOnNotFoundOr404.class)
- void openServerVNCTunnel(@PathParam("uuid") String uuid);
-
- /**
- * Closes a VNC tunnel to a server with specific UUID.
- *
- * @param uuid uuid of server to close VNC tunnel
- */
- @Named("server:closeServerVCNTunnel/{uuid}")
- @POST
- @Path("/servers/{uuid}/action/?do=close_vnc")
- @Fallback(Fallbacks.NullOnNotFoundOr404.class)
- void closeServerVCNTunnel(@PathParam("uuid") String uuid);
-
- /**
- * @return which servers share same physical infrastructure host.
- */
- @Named("server:listServerAvailabilityGroup")
- @GET
- @Path("/servers/availability_groups/")
- List<List<String>> listServerAvailabilityGroup();
-
- /**
- * Queries which other servers share same physical host with the given one.
- *
- * @param uuid Uuid of server to find availability group
- *
- * @return an array holding server UUIDs. The response includes also the UUID of the queried server.
- */
- @Named("server:getServerAvailabilityGroup/{uuid}")
- @GET
- @PathParam("/servers/availability_groups/{uuid}/")
- @Fallback(Fallbacks.NullOnNotFoundOr404.class)
- ServerAvailabilityGroup getServerAvailabilityGroup(@PathParam("uuid") String uuid);
-
- /**
- * Gets the list of firewall policies to which the authenticated user has access.
- *
- * @return list of firewall policies to which the authenticated user has access.
- */
- @Named("fwpolicy:listFirewallPolicies")
- @GET
- @Path("/fwpolicies/")
- @ResponseParser(ParseFirewallPolicies.class)
- @Transform(ParseFirewallPolicies.ToPagedIterable.class)
- PagedIterable<FirewallPolicy> listFirewallPolicies();
-
- /**
- * Gets the list of firewall policies to which the authenticated user has access.
- *
- * @return PaginatedCollection of firewall policies
- */
- @Named("fwpolicy:listFirewallPolicies")
- @GET
- @Path("/fwpolicies/")
- @ResponseParser(ParseFirewallPolicies.class)
- PaginatedCollection<FirewallPolicy> listFirewallPolicies(PaginationOptions options);
-
- /**
- * Gets a detailed list of firewall policies to which the authenticated user has access.
- *
- * @return list of firewall policies to which the authenticated user has access.
- */
- @Named("fwpolicy:listFirewallPoliciesInfo")
- @GET
- @Path("/fwpolicies/detail/")
- @ResponseParser(ParseFirewallPolicies.class)
- @Transform(ParseFirewallPolicies.ToPagedIterableInfo.class)
- PagedIterable<FirewallPolicy> listFirewallPoliciesInfo();
-
- /**
- * Gets a detailed list of firewall policies to which the authenticated user has access.
- *
- * @return PaginatedCollection of firewall policies
- */
- @Named("fwpolicy:listFirewallPoliciesInfo")
- @GET
- @Path("/fwpolicies/detail/")
- @ResponseParser(ParseFirewallPolicies.class)
- PaginatedCollection<FirewallPolicy> listFirewallPoliciesInfo(PaginationOptions options);
-
- /**
- * Creates firewall policies.
- *
- * @param firewallPolicies firewall policies to create
- * @return list of created firewall policies
- */
- @Named("fwpolicy:createFirewallPolicies")
- @POST
- @Path("/fwpolicies/")
- @SelectJson("objects")
- List<FirewallPolicy> createFirewallPolicies(
- @BinderParam(BindFirewallPoliciesListToJsonRequest.class) List< FirewallPolicy > firewallPolicies);
-
- /**
- * Creates a firewall policy.
- *
- * @param firewallPolicy firewall policy to create
- * @return created firewall policy
- */
- @Named("fwpolicy:createFirewallPolicy")
- @POST
- @Path("/fwpolicies/")
- @SelectJson("objects")
- @OnlyElement
- FirewallPolicy createFirewallPolicy(
- @BinderParam(BindFirewallPolicyToJsonRequest.class) FirewallPolicy firewallPolicy);
-
- /**
- * Update an existing firewall policy
- *
- * @param uuid uuid of policy to update
- * @param firewallPolicy firewall policy data to update
- * @return updated firewall policy
- */
- @Named("fwpolicy:editFirewallPolicy/{uuid}")
- @PUT
- @Path("/fwpolicies/{uuid}/")
- FirewallPolicy editFirewallPolicy(@PathParam("uuid") String uuid
- , @BinderParam(BindFirewallPolicyToJsonRequest.class) FirewallPolicy firewallPolicy);
-
- /**
- * Gets detailed information for VLAN identified by VLAN uuid.
- *
- * @param uuid uuid of VLAN to get
- * @return null, if not found
- */
- @Named("vlan:getVLANInfo/{uuid}")
- @GET
- @Path("/vlans/{uuid}/")
- @Fallback(Fallbacks.NullOnNotFoundOr404.class)
- VLANInfo getVLANInfo(@PathParam("uuid") String uuid);
-
- /**
- * Gets the list of VLANs to which the authenticated user has access.
- *
- * @return list of VLANs or empty list if no vlans are found
- */
- @Named("vlan:listVLANs")
- @GET
- @Path("/vlans/")
- @ResponseParser(ParseVLANs.class)
- @Transform(ParseVLANs.ToPagedIterable.class)
- PagedIterable<VLANInfo> listVLANs();
-
- /**
- * Gets the list of VLANs to which the authenticated user has access.
- *
- * @return PaginatedCollection of VLANs
- */
- @Named("vlan:listVLANs")
- @GET
- @Path("/vlans/")
- @ResponseParser(ParseVLANs.class)
- PaginatedCollection<VLANInfo> listVLANs(PaginationOptions options);
-
- /**
- * Gets the list of VLANs to which the authenticated user has access.
- *
- * @return list of VLANs or empty list if no vlans are found
- */
- @Named("vlan:listVLANInfo")
- @GET
- @Path("/vlans/detail/")
- @ResponseParser(ParseVLANs.class)
- @Transform(ParseVLANs.ToPagedIterableInfo.class)
- PagedIterable<VLANInfo> listVLANInfo();
-
- /**
- * Gets the list of VLANs to which the authenticated user has access.
- *
- * @return PaginatedCollection of VLANs
- */
- @Named("vlan:listVLANInfo")
- @GET
- @Path("/vlans/detail/")
- @ResponseParser(ParseVLANs.class)
- PaginatedCollection<VLANInfo> listVLANInfo(PaginationOptions options);
-
- /**
- * Currently only VLAN meta field can be edited.
- *
- * @param uuid uuid of VLAN to edit
- * @param vlanInfo data to change
- * @return changed VLAN
- */
- @Named("vlan:listVLANInfo/{uuid}")
- @PUT
- @Path("/vlans/{uuid}/")
- @Fallback(Fallbacks.NullOnNotFoundOr404.class)
- VLANInfo editVLAN(@PathParam("uuid") String uuid
- , @BinderParam(BindVLANToJsonRequest.class) VLANInfo vlanInfo);
-
- /**
- * Gets the list of IPs to which the authenticated user has access.
- *
- * @return list of IPs or empty list if no ips are found
- */
- @Named("ip:listIPs")
- @GET
- @Path("/ips/")
- @ResponseParser(ParseIPs.class)
- @Transform(ParseIPs.ToPagedIterable.class)
- PagedIterable<IP> listIPs();
-
- /**
- * Gets the list of IPs to which the authenticated user has access.
- *
- * @return PaginatedCollection of IPs
- */
- @Named("ip:listIPs")
- @GET
- @Path("/ips/")
- @ResponseParser(ParseIPs.class)
- PaginatedCollection<IP> listIPs(PaginationOptions options);
-
- /**
- * Gets the detailed list of IPs with additional information to which the authenticated user has access.
- *
- * @return list of IPs or empty list if no ips are found
- */
- @Named("ip:listIPInfo")
- @GET
- @Path("/ips/detail/")
- @ResponseParser(ParseIPInfos.class)
- @Transform(ParseIPInfos.ToPagedIterable.class)
- PagedIterable<IPInfo> listIPInfo();
-
- /**
- * Gets the detailed list of IPs with additional information to which the authenticated user has access.
- *
- * @return PaginatedCollection of IPs
- */
- @Named("ip:listIPInfo")
- @GET
- @Path("/ips/detail/")
- @ResponseParser(ParseIPInfos.class)
- PaginatedCollection<IPInfo> listIPInfo(PaginationOptions options);
-
- /**
- * Gets detailed information for IP identified by IP uuid.
- *
- * @param uuid uuid of IP to get
- * @return null, if not found
- */
- @Named("ip:getIPInfo/{uuid}")
- @GET
- @Path("/ips/{uuid}/")
- @Fallback(Fallbacks.NullOnNotFoundOr404.class)
- IPInfo getIPInfo(@PathParam("uuid") String uuid);
-
- /**
- * Currently only IP meta field can be edited.
- *
- * @param uuid uuid of IP to edit
- * @param ipInfo data to change
- * @return changed IP
- */
- @Named("ip:editIP/{uuid}")
- @PUT
- @Path("/ips/{uuid}/")
- @Fallback(Fallbacks.NullOnNotFoundOr404.class)
- IPInfo editIP(@PathParam("uuid") String uuid
- , @BinderParam(BindIPInfoToJsonRequest.class) IPInfo ipInfo);
-
- /**
- * Gets the list of tags to which the authenticated user has access.
- *
- * @return list of tags to which the authenticated user has access
- */
- @Named("tag:listTags")
- @GET
- @Path("/tags/")
- @ResponseParser(ParseTags.class)
- @Transform(ParseTags.ToPagedIterable.class)
- PagedIterable<Tag> listTags();
-
- /**
- * Gets the list of tags to which the authenticated user has access.
- *
- * @return PaginatedCollection of tags to which the authenticated user has access
- */
- @Named("tag:listTags")
- @GET
- @Path("/tags/")
- @ResponseParser(ParseTags.class)
- PaginatedCollection<Tag> listTags(PaginationOptions options);
-
- /**
- * Gets the detailed list of tags with additional information to which the authenticated user has access,
- * like the tagged resource
- *
- * @return detailed listings of your tags
- */
- @Named("tag:listTagsInfo")
- @GET
- @Path("/tags/detail/")
- @ResponseParser(ParseTags.class)
- @Transform(ParseTags.ToPagedIterableInfo.class)
- PagedIterable<Tag> listTagsInfo();
-
- /**
- * Gets the detailed list of tags with additional information to which the authenticated user has access,
- * like the tagged resource
- *
- * @return PaginatedCollection of detailed tags
- */
- @Named("tag:listTagsInfo")
- @GET
- @Path("/tags/detail/")
- @ResponseParser(ParseTags.class)
- PaginatedCollection<Tag> listTagsInfo(PaginationOptions options);
-
- /**
- * Gets detailed information for tag identified by tag uuid.
- *
- * @param uuid tag uuid
- * @return detailed info of tag
- */
- @Named("tag:getTagInfo/{uuid}")
- @GET
- @Path("/tags/{uuid}/")
- @Fallback(Fallbacks.NullOnNotFoundOr404.class)
- Tag getTagInfo(@PathParam("uuid") String uuid);
-
- /**
- * Edits a tag.
- * It is possible to add or remove resources to a tag by replacing the resources list with a new one
- *
- * @param uuid tag uuid
- * @param tag info to change
- * @return detailed info of tag
- */
- @Named("tag:editTag/{uuid}")
- @PUT
- @Path("/tags/{uuid}/")
- @Fallback(Fallbacks.NullOnNotFoundOr404.class)
- Tag editTag(@PathParam("uuid") String uuid, @BinderParam(BindTagToJsonRequest.class) Tag tag);
-
- /**
- * Creates a new tag
- *
- * @param tag tag to create
- * @return created tag
- */
- @Named("tag:createTag")
- @POST
- @Path("/tags/")
- @SelectJson("objects")
- @OnlyElement
- Tag createTag(@BinderParam(BindTagToJsonRequest.class) Tag tag);
-
- /**
- * Deletes a single tag.
- *
- * @param uuid uuid of tag to delete
- */
- @Named("tag:deleteTag/{uuid}")
- @DELETE
- @Path("/tags/{uuid}/")
- @Fallback(Fallbacks.NullOnNotFoundOr404.class)
- void deleteTag(@PathParam("uuid")String uuid);
-
- /**
- * Creates a multiple new tags
- *
- * @param tags tags to create
- * @return created tags
- */
- @Named("tag:createTags")
- @POST
- @Path("/tags/")
- @SelectJson("objects")
- List<Tag> createTags(@BinderParam(BindTagListToJsonRequest.class) List<Tag> tags);
-
- /**
- * Gets the user profile.
- *
- * @return profile information
- */
- @Named("profile:getProfileInfo")
- @GET
- @Path("/profile/")
- ProfileInfo getProfileInfo();
-
- /**
- * Edits a user profile.
- *
- * @param profile data to change
- * @return info or null, if not found
- */
- @Named("profile:editProfileInfo")
- @PUT
- @Path("/profile/")
- ProfileInfo editProfileInfo(@BinderParam(BindProfileInfoToJsonRequest.class) ProfileInfo profile);
-
- /**
- * Get the balance and currency of the current account.
- *
- * @return current account balance and currency
- */
- @Named("balance:getAccountBalance")
- @GET
- @Path("/balance/")
- AccountBalance getAccountBalance();
-
- /**
- * Get the current usage of the user.
- *
- * @return current usage of the user
- */
- @Named("currentusage:getCurrentUsage")
- @GET
- @Path("/currentusage/")
- CurrentUsage getCurrentUsage();
-
- /**
- * Gets the list of subscriptions of the user.
- *
- * @return list of subscriptions of the user.
- */
- @Named("subscription:listSubscriptions")
- @GET
- @Path("/subscriptions/")
- @ResponseParser(ParseSubscriptions.class)
- @Transform(ParseSubscriptions.ToPagedIterable.class)
- PagedIterable<Subscription> listSubscriptions();
-
- /**
- * Gets the list of subscriptions of the user.
- *
- * @return PaginatedCollection of subscriptions of the user.
- */
- @Named("subscription:listSubscriptions")
- @GET
- @Path("/subscriptions/")
- @ResponseParser(ParseSubscriptions.class)
- PaginatedCollection<Subscription> listSubscriptions(PaginationOptions options);
-
- /**
- * Returns requested subscription
- *
- * @return requested subscription.
- */
- @Named("subscription:getSubscription")
- @GET
- @Path("/subscriptions/{id}/")
- @Fallback(Fallbacks.NullOnNotFoundOr404.class)
- Subscription getSubscription(@PathParam("id") String id);
-
- /**
- * This is identical to the listSubscriptions(), except that subscriptions are not actually bought.
- *
- * @return list of subscriptions that are not actually bought.
- */
- @Named("subscription:listSubscriptionsCalculator")
- @GET
- @Path("/subscriptioncalculator/")
- @ResponseParser(ParseSubscriptions.class)
- @Transform(ParseSubscriptions.ToPagedIterableCalculator.class)
- PagedIterable<Subscription> listSubscriptionsCalculator();
-
- /**
- * This is identical to the listSubscriptions(), except that subscriptions are not actually bought.
- *
- * @return PaginatedCollection of subscriptions that are not actually bought.
- */
- @Named("subscription:listSubscriptionsCalculator")
- @GET
- @Path("/subscriptioncalculator/")
- @ResponseParser(ParseSubscriptions.class)
- PaginatedCollection<Subscription> listSubscriptionsCalculator(PaginationOptions options);
-
- /**
- * Creates a new subscription.
- * Subscription times are rounded to noon UTC, using the following rules:
- * - End time is always rounded to the next noon.
- * - Start time is rounded to the maximum between the current time an the previous noon.
- * This means that subscriptions bought for now do start now, but subscriptions for the future start at the previous noon.
- *
- * @param subscriptionRequest subscription request object
- * @return created subscription
- */
- @Named("subscription:listSubscriptionsCalculator")
- @POST
- @Path("/subscriptions/")
- @SelectJson("objects")
- @OnlyElement
- Subscription createSubscription(
- @BinderParam(BindCreateSubscriptionRequest.class) CreateSubscriptionRequest subscriptionRequest);
-
- /**
- * Creates a new subscription. There is a limit of 500 subscriptions that can be purchased in one request.
- * Subscription times are rounded to noon UTC, using the following rules:
- * - End time is always rounded to the next noon.
- * - Start time is rounded to the maximum between the current time an the previous noon.
- * This means that subscriptions bought for now do start now, but subscriptions for the future start at the previous noon.
- *
- * @param subscriptionRequest parameters for new subscriptions
- * @return new subscriptions
- */
- @Named("subscription:createSubscriptions")
- @POST
- @Path("/subscriptions/")
- @SelectJson("objects")
- List<Subscription> createSubscriptions(
- @BinderParam(BindCreateSubscriptionRequestList.class) List<CreateSubscriptionRequest> subscriptionRequest);
-
- /**
- * Extends the subscription. An extended subscription is actually just another subscription that is linked to the original
- * If a period or and end_time are specified in the request,they are used. If neither are specified,
- * the creation length of the subscription is used.
- *
- * A caveat to this is that a subscription created initially with an end_time, the exact interval is used.
- * Subscriptions that are created with a period have the period parsed again in the context of the new start_time.
- * An example would be a subscription created on the 1st of February with a period of ‘1 month’ will be extended for 31 days,
- * but one that was created with an end date of 1st of March will be extended for 28 days.
- *
- * If the specified subscription has actually been extended, it traverses and extends the last subscription in the chain.
- *
- * @param id id of subscription to extend
- */
- @Named("subscription:extendSubscription/{id}")
- @POST
- @Path("/subscriptions/{id}/action/?do=extend")
- @Fallback(Fallbacks.NullOnNotFoundOr404.class)
- void extendSubscription(@PathParam("id") String id);
-
- /**
- * Toggles the autorenew flag of the subscription.
- *
- * @param id id of subscription to enable autorenew
- */
- @Named("subscription:enableSubscriptionAutorenew/{id}")
- @POST
- @Path("/subscriptions/{id}/action/?do=auto_renew")
- @Fallback(Fallbacks.NullOnNotFoundOr404.class)
- void enableSubscriptionAutorenew(@PathParam("id") String id);
-
- /**
- * Gets the pricing information that are applicable to the cloud. Subscription prices use a burst level of 0.
- *
- * @return pricing information that are applicable to the cloud.
- */
- @Named("pricing:getPricing")
- @GET
- @Path("/pricing/")
- Pricing getPricing();
-
- /**
- * Get discount information.
- *
- * @return discount information.
- */
- @Named("discount:listDiscounts")
- @GET
- @Path("/discount/")
- @ResponseParser(ParseDiscounts.class)
- @Transform(ParseDiscounts.ToPagedIterable.class)
- PagedIterable<Discount> listDiscounts();
-
- /**
- * Get discount information.
- *
- * @return PaginatedCollection of discount information.
- */
- @Named("discount:listDiscounts")
- @GET
- @Path("/discount/")
- @ResponseParser(ParseDiscounts.class)
- PaginatedCollection<Discount> listDiscounts(PaginationOptions options);
-
- /**
- * Get the transactions for the account.
- *
- * @return transactions for the account.
- */
- @Named("ledger:listTransactions")
- @GET
- @Path("/ledger/")
- @ResponseParser(ParseTransactions.class)
- @Transform(ParseTransactions.ToPagedIterable.class)
- PagedIterable<Transaction> listTransactions();
-
- /**
- * Get the transactions for the account.
- *
- * @return PaginatedCollection of account's transactions.
- */
- @Named("ledger:listTransactions")
- @GET
- @Path("/ledger/")
- @ResponseParser(ParseTransactions.class)
- PaginatedCollection<Transaction> listTransactions(PaginationOptions options);
-
- /**
- * Get the licenses available on the cloud. The type of the license can be one of:
- * install - These licenses are billed per installation, regardless of whether it is attached to a running guests or not.
- * instance - These licenses are billed per running instance of a guest. A license attached to a guest that’s stopped is not billed.
- * stub - These licenses are billed per a metric specified by the customer (i.e. per number of users license)
- *
- * The user metric field specifies what attribute on the instance of the guest is used for determining the number of licenses.
- * For example, “smp” will count one license for each CPU/core in the virtual machine.
- *
- * @return licenses available on the cloud
- */
- @Named("license:listLicenses")
- @GET
- @Path("/licenses/")
- @ResponseParser(ParseLicenses.class)
- @Transform(ParseLicenses.ToPagedIterable.class)
- PagedIterable<License> listLicenses();
-
- /**
- * Get the licenses available on the cloud. The type of the license can be one of:
- * install - These licenses are billed per installation, regardless of whether it is attached to a running guests or not.
- * instance - These licenses are billed per running instance of a guest. A license attached to a guest that’s stopped is not billed.
- * stub - These licenses are billed per a metric specified by the customer (i.e. per number of users license)
- *
- * The user metric field specifies what attribute on the instance of the guest is used for determining the number of licenses.
- * For example, “smp” will count one license for each CPU/core in the virtual machine.
- *
- * @return PaginatedCollection of licenses available on the cloud
- */
- @Named("license:listLicenses")
- @GET
- @Path("/licenses/")
- @ResponseParser(ParseLicenses.class)
- PaginatedCollection<License> listLicenses(PaginationOptions options);
+ /**
+ * Gets the list of drives to which the authenticated user has access.
+ *
+ * @return list of drives or empty list if no drives are found
+ */
+ @Named("drive:listDrives")
+ @GET
+ @Path("/drives/")
+ @ResponseParser(ParseDrives.class)
+ @Transform(ParseDrives.ToPagedIterable.class)
+ PagedIterable<Drive> listDrives();
+
+ /**
+ * Gets the list of drives to which the authenticated user has access.
+ *
+ * @return PaginatedCollection of drives
+ */
+ @Named("drive:listDrives")
+ @GET
+ @Path("/drives/")
+ @ResponseParser(ParseDrives.class)
+ PaginatedCollection<Drive> listDrives(PaginationOptions options);
+
+ /**
+ * Gets the list of drives to which the authenticated user has access.
+ *
+ * @param fields A set of field names specifying the returned fields
+ * @param limit number of drives to show
+ * @return or empty set if no drives are found
+ */
+ @Named("drive:listDrives")
+ @GET
+ @Path("/drives/")
+ @SelectJson("objects")
+ List<DriveInfo> listDrives(@QueryParam("fields") DrivesListRequestFieldsGroup fields
+ , @DefaultValue("0") @QueryParam("limit") int limit);
+
+ /**
+ * Gets the detailed list of drives with additional information to which the authenticated user has access.
+ *
+ * @return list of drives or empty list if no drives are found
+ */
+ @Named("drive:listDrivesInfo")
+ @GET
+ @Path("/drives/detail/")
+ @ResponseParser(ParseDriveInfos.class)
+ @Transform(ParseDriveInfos.ToPagedIterable.class)
+ PagedIterable<DriveInfo> listDrivesInfo();
+
+ /**
+ * Gets the detailed list of drives with additional information to which the authenticated user has access.
+ *
+ * @return PaginatedCollection of drives
+ */
+ @Named("drive:listDrivesInfo")
+ @GET
+ @Path("/drives/detail/")
+ @ResponseParser(ParseDriveInfos.class)
+ PaginatedCollection<DriveInfo> listDrivesInfo(PaginationOptions options);
+
+ /**
+ * Gets detailed information for drive identified by drive uuid
+ *
+ * @param uuid drive uuid to get
+ * @return null, if not found
+ */
+ @Named("drive:getDriveInfo/{uuid}")
+ @GET
+ @Path("/drives/{uuid}/")
+ @Fallback(Fallbacks.NullOnNotFoundOr404.class)
+ DriveInfo getDriveInfo(@PathParam("uuid") String uuid);
+
+ /**
+ * Creates a new drive
+ *
+ * @param createDrive required parameters: name, size, media
+ * @return newly created drive
+ */
+ @Named("drive:createDrive")
+ @POST
+ @Path("/drives/")
+ @Fallback(Fallbacks.NullOnNotFoundOr404.class)
+ @SelectJson("objects")
+ @OnlyElement
+ DriveInfo createDrive(@BinderParam(BindDriveToJson.class) DriveInfo createDrive);
+
+ /**
+ * Creates multiple new drives
+ *
+ * @param createDrives required parameters: name, size, media
+ * @return newly created drives
+ */
+ @Named("drive:listDrives")
+ @POST
+ @Fallback(Fallbacks.NullOnNotFoundOr404.class)
+ @SelectJson("objects")
+ @Path("/drives/")
+ List<DriveInfo> createDrives(@BinderParam(BindDrivesToJson.class) List<DriveInfo> createDrives);
+
+ /**
+ * Deletes a single mounted or unmounted drive.
+ *
+ * @param uuid what to delete
+ */
+ @Named("drive:deleteDrive/{uuid}")
+ @DELETE
+ @Path("/drives/{uuid}/")
+ @Fallback(Fallbacks.VoidOnNotFoundOr404.class)
+ void deleteDrive(@PathParam("uuid") String uuid);
+
+ /**
+ * Deletes multiple mounted or unmounted drives specified by their UUID’s.
+ *
+ * @param uuids what drives to delete
+ */
+ @Named("drive:deleteDrives")
+ @DELETE
+ @Path("/drives/")
+ @Fallback(Fallbacks.VoidOnNotFoundOr404.class)
+ void deleteDrives(@BinderParam(BindUuidStringsToJsonArray.class) Iterable<String> uuids);
+
+ /**
+ * Edits a mounted or unmounted drive. If mounted, the server mounted on should be stopped.
+ *
+ * @param sourceUuid source drive to edit
+ * @param driveInfo drive parameters to change
+ * @return changed drive
+ */
+ @Named("drive:editDrive/{uuid}")
+ @PUT
+ @Path("/drives/{uuid}/")
+ @Fallback(Fallbacks.VoidOnNotFoundOr404.class)
+ DriveInfo editDrive(@PathParam("uuid") String sourceUuid
+ , @BinderParam(BindDriveToJson.class) DriveInfo driveInfo);
+
+
+ /**
+ * Clones a drive. Request body is optional and any or all of the key/value pairs can be omitted.
+ *
+ * @param sourceUuid source drive to clone
+ * @param driveInfo drive parameters to change
+ * @return new drive
+ */
+ @Named("drive:cloneDrive/{uuid}")
+ @POST
+ @Path("/drives/{uuid}/action/?do=clone")
+ @Fallback(Fallbacks.VoidOnNotFoundOr404.class)
+ DriveInfo cloneDrive(@PathParam("uuid") String sourceUuid
+ , @Nullable @BinderParam(BindDriveToJson.class) DriveInfo driveInfo);
+
+ /**
+ * Gets the list of library drives to which the authenticated user has access.
+ *
+ * @return list of library drives to which the authenticated user has access
+ */
+ @Named("libdrive:listLibraryDrives")
+ @GET
+ @Path("/libdrives/")
+ @ResponseParser(ParseLibraryDrives.class)
+ @Transform(ParseLibraryDrives.ToPagedIterable.class)
+ PagedIterable<LibraryDrive> listLibraryDrives();
+
+ /**
+ * Gets the list of library drives to which the authenticated user has access.
+ *
+ * @return PaginatedCollection of library drives
+ */
+ @Named("libdrive:listLibraryDrives")
+ @GET
+ @Path("/libdrives/")
+ @ResponseParser(ParseLibraryDrives.class)
+ PaginatedCollection<LibraryDrive> listLibraryDrives(PaginationOptions options);
+
+ /**
+ * Gets detailed information for library drive identified by uuid.
+ *
+ * @param uuid uuid of library drive to be listed
+ * @return drive information or null if not found
+ */
+ @Named("libdrive:getLibraryDrive/{uuid}")
+ @GET
+ @Path("/libdrives/{uuid}/")
+ @Fallback(Fallbacks.NullOnNotFoundOr404.class)
+ LibraryDrive getLibraryDrive(@PathParam("uuid") String uuid);
+
+ /**
+ * If a library drive is not a CDROM, you have to clone it in your account in order to use it.
+ *
+ * @param uuid uuid of library drive to clone
+ * @param libraryDrive cloned drive
+ * @return cloned drive information or null if not found
+ */
+ @Named("libdrive:cloneLibraryDrive/{uuid}")
+ @POST
+ @Path("/libdrives/{uuid}/action/?do=clone")
+ @Fallback(Fallbacks.VoidOnNotFoundOr404.class)
+ LibraryDrive cloneLibraryDrive(@PathParam("uuid") String uuid
+ , @Nullable @BinderParam(BindLibraryDriveToJson.class) LibraryDrive libraryDrive);
+
+ /**
+ * Gets the list of servers to which the authenticated user has access.
+ *
+ * @return list of servers or empty list if no servers are found
+ */
+ @Named("server:listServers")
+ @GET
+ @Path("/servers/")
+ @ResponseParser(ParseServers.class)
+ @Transform(ParseServers.ToPagedIterable.class)
+ PagedIterable<Server> listServers();
+
+ /**
+ * Gets the list of servers to which the authenticated user has access.
+ *
+ * @return PaginatedCollection of servers
+ */
+ @Named("server:listServers")
+ @GET
+ @Path("/servers/")
+ @ResponseParser(ParseServers.class)
+ PaginatedCollection<Server> listServers(PaginationOptions options);
+
+ /**
+ * Gets the detailed list of servers to which the authenticated user has access.
+ *
+ * @return list of servers or empty list if no servers are found
+ */
+ @Named("server:listServersInfo")
+ @GET
+ @Path("/servers/detail/")
+ @ResponseParser(ParseServerInfos.class)
+ @Transform(ParseServerInfos.ToPagedIterable.class)
+ PagedIterable<ServerInfo> listServersInfo();
+
+ /**
+ * Gets the detailed list of servers to which the authenticated user has access.
+ *
+ * @return PaginatedCollection of servers
+ */
+ @Named("server:listServersInfo")
+ @GET
+ @Path("/servers/detail/")
+ @ResponseParser(ParseServerInfos.class)
+ PaginatedCollection<ServerInfo> listServersInfo(PaginationOptions options);
+
+ /**
+ * Creates a new virtual server or multiple servers.
+ * The minimial amount of information you need to set is:
+ * cpu
+ * memory
+ * name
+ * vncPassword
+ *
+ * @param createServer required parameters: cpu, memory, name, vncPassword
+ * @return newly created server
+ */
+ @Named("server:createServer")
+ @POST
+ @Path("/servers/")
+ @SelectJson("objects")
+ @OnlyElement
+ ServerInfo createServer(@BinderParam(BindServerInfoToJsonRequest.class) ServerInfo createServer);
+
+ /**
+ * create a new servers
+ *
+ * @param servers servers to create. Required parameters: cpu, memory, name, vncPassword
+ * @return newly created servers
+ */
+ @Named("server:createServers")
+ @POST
+ @Path("/servers/")
+ @SelectJson("objects")
+ List<ServerInfo> createServers(@BinderParam(BindServerInfoListToJsonRequest.class) Iterable<ServerInfo> servers);
+
+ /**
+ * Edits a server. Used also for attaching NIC’s and drives to servers.
+ *
+ * @param uuid server uuid
+ * @param server data to change
+ * @return modified server
+ */
+ @Named("server:editServer/{uuid}")
+ @PUT
+ @Path("/servers/{uuid}/")
+ @Fallback(Fallbacks.VoidOnNotFoundOr404.class)
+ ServerInfo editServer(@PathParam("uuid") String uuid
+ , @BinderParam(BindServerInfoToJsonRequest.class) ServerInfo server);
+
+ /**
+ * Deletes a single server.
+ *
+ * @param uuid uuid of server to delete
+ */
+ @Named("server:deleteServer/{uuid}")
+ @DELETE
+ @Path("/servers/{uuid}/")
+ @Fallback(Fallbacks.VoidOnNotFoundOr404.class)
+ void deleteServer(@PathParam("uuid") String uuid);
+
+ /**
+ * Deletes multiple servers specified by their UUID’s.
+ *
+ * @param uuids server uuids to delete
+ */
+ @Named("server:deleteServers")
+ @DELETE
+ @Path("/servers/")
+ @Fallback(Fallbacks.VoidOnNotFoundOr404.class)
+ void deleteServers(@BinderParam(BindUuidStringsToJsonArray.class) Iterable<String> uuids);
+
+ /**
+ * Clones a server. Empty body.
+ * Does cascading clone of server drives.
+ * IPs of the cloned server are set to DHCP.
+ * All other properties of the clone are equal to the original.
+ *
+ * @param uuid server what to clone
+ * @return cloned server
+ */
+ @Named("server:cloneServer/{uuid}")
+ @POST
+ @Path("/servers/{uuid}/action/?do=clone")
+ @Fallback(Fallbacks.VoidOnNotFoundOr404.class)
+ ServerInfo cloneServer(@PathParam("uuid") String uuid);
+
+ /**
+ * Gets detailed information for server identified by server uuid.
+ *
+ * @param uuid server uuid
+ * @return server info or null, if not found
+ */
+ @Named("server:getServerInfo/{uuid}")
+ @GET
+ @Path("/servers/{uuid}/")
+ @Fallback(Fallbacks.NullOnNotFoundOr404.class)
+ ServerInfo getServerInfo(@PathParam("uuid") String uuid);
+
+ /**
+ * Starts a server with specific UUID.
+ *
+ * @param uuid uuid of server to start
+ */
+ @Named("server:startServer/{uuid}")
+ @POST
+ @Path("/servers/{uuid}/action/?do=start")
+ @Fallback(Fallbacks.NullOnNotFoundOr404.class)
+ void startServer(@PathParam("uuid") String uuid);
+
+ /**
+ * Stops a server with specific UUID.
+ *
+ * @param uuid uuid of server to stop
+ */
+ @Named("server:stopServer/{uuid}")
+ @POST
+ @Path("/servers/{uuid}/action/?do=stop")
+ @Fallback(Fallbacks.NullOnNotFoundOr404.class)
+ void stopServer(@PathParam("uuid") String uuid);
+
+ /**
+ * Starts a server with specific UUID assuring that it is started on a different physical infrastructure host
+ * from the other servers specified in the avoid argument which is
+ * a single server UUID or a comma-separated list of server UUIDs.
+ * This way the server specified by uuid is run in a distinct availability group from the other listed servers.
+ * Note that it might not always be possible to run a server in a different availability group,
+ * therefore the order of the avoid list also signifies the priority of avoiding other servers.
+ *
+ * @param uuid uuid of server to start
+ * @param uuidGroup availability group to avoid
+ */
+ @Named("server:startServerInSeparateAvailabilityGroup/{uuid}")
+ @POST
+ @Path("/servers/{uuid}/action/?do=start")
+ @Fallback(Fallbacks.NullOnNotFoundOr404.class)
+ void startServerInSeparateAvailabilityGroup(@PathParam("uuid") String uuid
+ , @QueryParam("avoid") List<String> uuidGroup);
+
+ /**
+ * Opens a VNC tunnel to a server with specific UUID.
+ *
+ * @param uuid uuid of server to open VNC tunnel
+ */
+ @Named("server:openServerVNCTunnel/{uuid}")
+ @POST
+ @Path("/servers/{uuid}/action/?do=open_vnc")
+ @Fallback(Fallbacks.NullOnNotFoundOr404.class)
+ void openServerVNCTunnel(@PathParam("uuid") String uuid);
+
+ /**
+ * Closes a VNC tunnel to a server with specific UUID.
+ *
+ * @param uuid uuid of server to close VNC tunnel
+ */
+ @Named("server:closeServerVCNTunnel/{uuid}")
+ @POST
+ @Path("/servers/{uuid}/action/?do=close_vnc")
+ @Fallback(Fallbacks.NullOnNotFoundOr404.class)
+ void closeServerVCNTunnel(@PathParam("uuid") String uuid);
+
+ /**
+ * @return which servers share same physical infrastructure host.
+ */
+ @Named("server:listServerAvailabilityGroup")
+ @GET
+ @Path("/servers/availability_groups/")
+ List<List<String>> listServerAvailabilityGroup();
+
+ /**
+ * Queries which other servers share same physical host with the given one.
+ *
+ * @param uuid Uuid of server to find availability group
+ * @return an array holding server UUIDs. The response includes also the UUID of the queried server.
+ */
+ @Named("server:getServerAvailabilityGroup/{uuid}")
+ @GET
+ @PathParam("/servers/availability_groups/{uuid}/")
+ @Fallback(Fallbacks.NullOnNotFoundOr404.class)
+ ServerAvailabilityGroup getServerAvailabilityGroup(@PathParam("uuid") String uuid);
+
+ /**
+ * Gets the list of firewall policies to which the authenticated user has access.
+ *
+ * @return list of firewall policies to which the authenticated user has access.
+ */
+ @Named("fwpolicy:listFirewallPolicies")
+ @GET
+ @Path("/fwpolicies/")
+ @ResponseParser(ParseFirewallPolicies.class)
+ @Transform(ParseFirewallPolicies.ToPagedIterable.class)
+ PagedIterable<FirewallPolicy> listFirewallPolicies();
+
+ /**
+ * Gets the list of firewall policies to which the authenticated user has access.
+ *
+ * @return PaginatedCollection of firewall policies
+ */
+ @Named("fwpolicy:listFirewallPolicies")
+ @GET
+ @Path("/fwpolicies/")
+ @ResponseParser(ParseFirewallPolicies.class)
+ PaginatedCollection<FirewallPolicy> listFirewallPolicies(PaginationOptions options);
+
+ /**
+ * Gets a detailed list of firewall policies to which the authenticated user has access.
+ *
+ * @return list of firewall policies to which the authenticated user has access.
+ */
+ @Named("fwpolicy:listFirewallPoliciesInfo")
+ @GET
+ @Path("/fwpolicies/detail/")
+ @ResponseParser(ParseFirewallPolicies.class)
+ @Transform(ParseFirewallPolicies.ToPagedIterableInfo.class)
+ PagedIterable<FirewallPolicy> listFirewallPoliciesInfo();
+
+ /**
+ * Gets a detailed list of firewall policies to which the authenticated user has access.
+ *
+ * @return PaginatedCollection of firewall policies
+ */
+ @Named("fwpolicy:listFirewallPoliciesInfo")
+ @GET
+ @Path("/fwpolicies/detail/")
+ @ResponseParser(ParseFirewallPolicies.class)
+ PaginatedCollection<FirewallPolicy> listFirewallPoliciesInfo(PaginationOptions options);
+
+ /**
+ * Creates firewall policies.
+ *
+ * @param firewallPolicies firewall policies to create
+ * @return list of created firewall policies
+ */
+ @Named("fwpolicy:createFirewallPolicies")
+ @POST
+ @Path("/fwpolicies/")
+ @SelectJson("objects")
+ List<FirewallPolicy> createFirewallPolicies(
+ @BinderParam(BindFirewallPoliciesListToJsonRequest.class) List<FirewallPolicy> firewallPolicies);
+
+ /**
+ * Creates a firewall policy.
+ *
+ * @param firewallPolicy firewall policy to create
+ * @return created firewall policy
+ */
+ @Named("fwpolicy:createFirewallPolicy")
+ @POST
+ @Path("/fwpolicies/")
+ @SelectJson("objects")
+ @OnlyElement
+ FirewallPolicy createFirewallPolicy(
+ @BinderParam(BindFirewallPolicyToJsonRequest.class) FirewallPolicy firewallPolicy);
+
+ /**
+ * Update an existing firewall policy
+ *
+ * @param uuid uuid of policy to update
+ * @param firewallPolicy firewall policy data to update
+ * @return updated firewall policy
+ */
+ @Named("fwpolicy:editFirewallPolicy/{uuid}")
+ @PUT
+ @Path("/fwpolicies/{uuid}/")
+ FirewallPolicy editFirewallPolicy(@PathParam("uuid") String uuid
+ , @BinderParam(BindFirewallPolicyToJsonRequest.class) FirewallPolicy firewallPolicy);
+
+ /**
+ * Gets detailed information for VLAN identified by VLAN uuid.
+ *
+ * @param uuid uuid of VLAN to get
+ * @return null, if not found
+ */
+ @Named("vlan:getVLANInfo/{uuid}")
+ @GET
+ @Path("/vlans/{uuid}/")
+ @Fallback(Fallbacks.NullOnNotFoundOr404.class)
+ VLANInfo getVLANInfo(@PathParam("uuid") String uuid);
+
+ /**
+ * Gets the list of VLANs to which the authenticated user has access.
+ *
+ * @return list of VLANs or empty list if no vlans are found
+ */
+ @Named("vlan:listVLANs")
+ @GET
+ @Path("/vlans/")
+ @ResponseParser(ParseVLANs.class)
+ @Transform(ParseVLANs.ToPagedIterable.class)
+ PagedIterable<VLANInfo> listVLANs();
+
+ /**
+ * Gets the list of VLANs to which the authenticated user has access.
+ *
+ * @return PaginatedCollection of VLANs
+ */
+ @Named("vlan:listVLANs")
+ @GET
+ @Path("/vlans/")
+ @ResponseParser(ParseVLANs.class)
+ PaginatedCollection<VLANInfo> listVLANs(PaginationOptions options);
+
+ /**
+ * Gets the list of VLANs to which the authenticated user has access.
+ *
+ * @return list of VLANs or empty list if no vlans are found
+ */
+ @Named("vlan:listVLANInfo")
+ @GET
+ @Path("/vlans/detail/")
+ @ResponseParser(ParseVLANs.class)
+ @Transform(ParseVLANs.ToPagedIterableInfo.class)
+ PagedIterable<VLANInfo> listVLANInfo();
+
+ /**
+ * Gets the list of VLANs to which the authenticated user has access.
+ *
+ * @return PaginatedCollection of VLANs
+ */
+ @Named("vlan:listVLANInfo")
+ @GET
+ @Path("/vlans/detail/")
+ @ResponseParser(ParseVLANs.class)
+ PaginatedCollection<VLANInfo> listVLANInfo(PaginationOptions options);
+
+ /**
+ * Currently only VLAN meta field can be edited.
+ *
+ * @param uuid uuid of VLAN to edit
+ * @param vlanInfo data to change
+ * @return changed VLAN
+ */
+ @Named("vlan:listVLANInfo/{uuid}")
+ @PUT
+ @Path("/vlans/{uuid}/")
+ @Fallback(Fallbacks.NullOnNotFoundOr404.class)
+ VLANInfo editVLAN(@PathParam("uuid") String uuid
+ , @BinderParam(BindVLANToJsonRequest.class) VLANInfo vlanInfo);
+
+ /**
+ * Gets the list of IPs to which the authenticated user has access.
+ *
+ * @return list of IPs or empty list if no ips are found
+ */
+ @Named("ip:listIPs")
+ @GET
+ @Path("/ips/")
+ @ResponseParser(ParseIPs.class)
+ @Transform(ParseIPs.ToPagedIterable.class)
+ PagedIterable<IP> listIPs();
+
+ /**
+ * Gets the list of IPs to which the authenticated user has access.
+ *
+ * @return PaginatedCollection of IPs
+ */
+ @Named("ip:listIPs")
+ @GET
+ @Path("/ips/")
+ @ResponseParser(ParseIPs.class)
+ PaginatedCollection<IP> listIPs(PaginationOptions options);
+
+ /**
+ * Gets the detailed list of IPs with additional information to which the authenticated user has access.
+ *
+ * @return list of IPs or empty list if no ips are found
+ */
+ @Named("ip:listIPInfo")
+ @GET
+ @Path("/ips/detail/")
+ @ResponseParser(ParseIPInfos.class)
+ @Transform(ParseIPInfos.ToPagedIterable.class)
+ PagedIterable<IPInfo> listIPInfo();
+
+ /**
+ * Gets the detailed list of IPs with additional information to which the authenticated user has access.
+ *
+ * @return PaginatedCollection of IPs
+ */
+ @Named("ip:listIPInfo")
+ @GET
+ @Path("/ips/detail/")
+ @ResponseParser(ParseIPInfos.class)
+ PaginatedCollection<IPInfo> listIPInfo(PaginationOptions options);
+
+ /**
+ * Gets detailed information for IP identified by IP uuid.
+ *
+ * @param uuid uuid of IP to get
+ * @return null, if not found
+ */
+ @Named("ip:getIPInfo/{uuid}")
+ @GET
+ @Path("/ips/{uuid}/")
+ @Fallback(Fallbacks.NullOnNotFoundOr404.class)
+ IPInfo getIPInfo(@PathParam("uuid") String uuid);
+
+ /**
+ * Currently only IP meta field can be edited.
+ *
+ * @param uuid uuid of IP to edit
+ * @param ipInfo data to change
+ * @return changed IP
+ */
+ @Named("ip:editIP/{uuid}")
+ @PUT
+ @Path("/ips/{uuid}/")
+ @Fallback(Fallbacks.NullOnNotFoundOr404.class)
+ IPInfo editIP(@PathParam("uuid") String uuid
+ , @BinderParam(BindIPInfoToJsonRequest.class) IPInfo ipInfo);
+
+ /**
+ * Gets the list of tags to which the authenticated user has access.
+ *
+ * @return list of tags to which the authenticated user has access
+ */
+ @Named("tag:listTags")
+ @GET
+ @Path("/tags/")
+ @ResponseParser(ParseTags.class)
+ @Transform(ParseTags.ToPagedIterable.class)
+ PagedIterable<Tag> listTags();
+
+ /**
+ * Gets the list of tags to which the authenticated user has access.
+ *
+ * @return PaginatedCollection of tags to which the authenticated user has access
+ */
+ @Named("tag:listTags")
+ @GET
+ @Path("/tags/")
+ @ResponseParser(ParseTags.class)
+ PaginatedCollection<Tag> listTags(PaginationOptions options);
+
+ /**
+ * Gets the detailed list of tags with additional information to which the authenticated user has access,
+ * like the tagged resource
+ *
+ * @return detailed listings of your tags
+ */
+ @Named("tag:listTagsInfo")
+ @GET
+ @Path("/tags/detail/")
+ @ResponseParser(ParseTags.class)
+ @Transform(ParseTags.ToPagedIterableInfo.class)
+ PagedIterable<Tag> listTagsInfo();
+
+ /**
+ * Gets the detailed list of tags with additional information to which the authenticated user has access,
+ * like the tagged resource
+ *
+ * @return PaginatedCollection of detailed tags
+ */
+ @Named("tag:listTagsInfo")
+ @GET
+ @Path("/tags/detail/")
+ @ResponseParser(ParseTags.class)
+ PaginatedCollection<Tag> listTagsInfo(PaginationOptions options);
+
+ /**
+ * Gets detailed information for tag identified by tag uuid.
+ *
+ * @param uuid tag uuid
+ * @return detailed info of tag
+ */
+ @Named("tag:getTagInfo/{uuid}")
+ @GET
+ @Path("/tags/{uuid}/")
+ @Fallback(Fallbacks.NullOnNotFoundOr404.class)
+ Tag getTagInfo(@PathParam("uuid") String uuid);
+
+ /**
+ * Edits a tag.
+ * It is possible to add or remove resources to a tag by replacing the resources list with a new one
+ *
+ * @param uuid tag uuid
+ * @param tag info to change
+ * @return detailed info of tag
+ */
+ @Named("tag:editTag/{uuid}")
+ @PUT
+ @Path("/tags/{uuid}/")
+ @Fallback(Fallbacks.NullOnNotFoundOr404.class)
+ Tag editTag(@PathParam("uuid") String uuid, @BinderParam(BindTagToJsonRequest.class) Tag tag);
+
+ /**
+ * Creates a new tag
+ *
+ * @param tag tag to create
+ * @return created tag
+ */
+ @Named("tag:createTag")
+ @POST
+ @Path("/tags/")
+ @SelectJson("objects")
+ @OnlyElement
+ Tag createTag(@BinderParam(BindTagToJsonRequest.class) Tag tag);
+
+ /**
+ * Deletes a single tag.
+ *
+ * @param uuid uuid of tag to delete
+ */
+ @Named("tag:deleteTag/{uuid}")
+ @DELETE
+ @Path("/tags/{uuid}/")
+ @Fallback(Fallbacks.NullOnNotFoundOr404.class)
+ void deleteTag(@PathParam("uuid") String uuid);
+
+ /**
+ * Creates a multiple new tags
+ *
+ * @param tags tags to create
+ * @return created tags
+ */
+ @Named("tag:createTags")
+ @POST
+ @Path("/tags/")
+ @SelectJson("objects")
+ List<Tag> createTags(@BinderParam(BindTagListToJsonRequest.class) List<Tag> tags);
+
+ /**
+ * Gets the user profile.
+ *
+ * @return profile information
+ */
+ @Named("profile:getProfileInfo")
+ @GET
+ @Path("/profile/")
+ ProfileInfo getProfileInfo();
+
+ /**
+ * Edits a user profile.
+ *
+ * @param profile data to change
+ * @return info or null, if not found
+ */
+ @Named("profile:editProfileInfo")
+ @PUT
+ @Path("/profile/")
+ ProfileInfo editProfileInfo(@BinderParam(BindProfileInfoToJsonRequest.class) ProfileInfo profile);
+
+ /**
+ * Get the balance and currency of the current account.
+ *
+ * @return current account balance and currency
+ */
+ @Named("balance:getAccountBalance")
+ @GET
+ @Path("/balance/")
+ AccountBalance getAccountBalance();
+
+ /**
+ * Get the current usage of the user.
+ *
+ * @return current usage of the user
+ */
+ @Named("currentusage:getCurrentUsage")
+ @GET
+ @Path("/currentusage/")
+ CurrentUsage getCurrentUsage();
+
+ /**
+ * Gets the list of subscriptions of the user.
+ *
+ * @return list of subscriptions of the user.
+ */
+ @Named("subscription:listSubscriptions")
+ @GET
+ @Path("/subscriptions/")
+ @ResponseParser(ParseSubscriptions.class)
+ @Transform(ParseSubscriptions.ToPagedIterable.class)
+ PagedIterable<Subscription> listSubscriptions();
+
+ /**
+ * Gets the list of subscriptions of the user.
+ *
+ * @return PaginatedCollection of subscriptions of the user.
+ */
+ @Named("subscription:listSubscriptions")
+ @GET
+ @Path("/subscriptions/")
+ @ResponseParser(ParseSubscriptions.class)
+ PaginatedCollection<Subscription> listSubscriptions(PaginationOptions options);
+
+ /**
+ * Returns requested subscription
+ *
+ * @return requested subscription.
+ */
+ @Named("subscription:getSubscription")
+ @GET
+ @Path("/subscriptions/{id}/")
+ @Fallback(Fallbacks.NullOnNotFoundOr404.class)
+ Subscription getSubscription(@PathParam("id") String id);
+
+ /**
+ * This is identical to the listSubscriptions(), except that subscriptions are not actually bought.
+ *
+ * @return list of subscriptions that are not actually bought.
+ */
+ @Named("subscription:listSubscriptionsCalculator")
+ @GET
+ @Path("/subscriptioncalculator/")
+ @ResponseParser(ParseSubscriptions.class)
+ @Transform(ParseSubscriptions.ToPagedIterableCalculator.class)
+ PagedIterable<Subscription> listSubscriptionsCalculator();
+
+ /**
+ * This is identical to the listSubscriptions(), except that subscriptions are not actually bought.
+ *
+ * @return PaginatedCollection of subscriptions that are not actually bought.
+ */
+ @Named("subscription:listSubscriptionsCalculator")
+ @GET
+ @Path("/subscriptioncalculator/")
+ @ResponseParser(ParseSubscriptions.class)
+ PaginatedCollection<Subscription> listSubscriptionsCalculator(PaginationOptions options);
+
+ /**
+ * Creates a new subscription.
+ * Subscription times are rounded to noon UTC, using the following rules:
+ * - End time is always rounded to the next noon.
+ * - Start time is rounded to the maximum between the current time an the previous noon.
+ * This means that subscriptions bought for now do start now, but subscriptions for the future start at the previous noon.
+ *
+ * @param subscriptionRequest subscription request object
+ * @return created subscription
+ */
+ @Named("subscription:listSubscriptionsCalculator")
+ @POST
+ @Path("/subscriptions/")
+ @SelectJson("objects")
+ @OnlyElement
+ Subscription createSubscription(
+ @BinderParam(BindCreateSubscriptionRequest.class) CreateSubscriptionRequest subscriptionRequest);
+
+ /**
+ * Creates a new subscription. There is a limit of 500 subscriptions that can be purchased in one request.
+ * Subscription times are rounded to noon UTC, using the following rules:
+ * - End time is always rounded to the next noon.
+ * - Start time is rounded to the maximum between the current time an the previous noon.
+ * This means that subscriptions bought for now do start now, but subscriptions for the future start at the previous noon.
+ *
+ * @param subscriptionRequest parameters for new subscriptions
+ * @return new subscriptions
+ */
+ @Named("subscription:createSubscriptions")
+ @POST
+ @Path("/subscriptions/")
+ @SelectJson("objects")
+ List<Subscription> createSubscriptions(
+ @BinderParam(BindCreateSubscriptionRequestList.class) List<CreateSubscriptionRequest> subscriptionRequest);
+
+ /**
+ * Extends the subscription. An extended subscription is actually just another subscription that is linked to the original
+ * If a period or and end_time are specified in the request,they are used. If neither are specified,
+ * the creation length of the subscription is used.
+ * <p/>
+ * A caveat to this is that a subscription created initially with an end_time, the exact interval is used.
+ * Subscriptions that are created with a period have the period parsed again in the context of the new start_time.
+ * An example would be a subscription created on the 1st of February with a period of ‘1 month’ will be extended for 31 days,
+ * but one that was created with an end date of 1st of March will be extended for 28 days.
+ * <p/>
+ * If the specified subscription has actually been extended, it traverses and extends the last subscription in the chain.
+ *
+ * @param id id of subscription to extend
+ */
+ @Named("subscription:extendSubscription/{id}")
+ @POST
+ @Path("/subscriptions/{id}/action/?do=extend")
+ @Fallback(Fallbacks.NullOnNotFoundOr404.class)
+ void extendSubscription(@PathParam("id") String id);
+
+ /**
+ * Toggles the autorenew flag of the subscription.
+ *
+ * @param id id of subscription to enable autorenew
+ */
+ @Named("subscription:enableSubscriptionAutorenew/{id}")
+ @POST
+ @Path("/subscriptions/{id}/action/?do=auto_renew")
+ @Fallback(Fallbacks.NullOnNotFoundOr404.class)
+ void enableSubscriptionAutorenew(@PathParam("id") String id);
+
+ /**
+ * Gets the pricing information that are applicable to the cloud. Subscription prices use a burst level of 0.
+ *
+ * @return pricing information that are applicable to the cloud.
+ */
+ @Named("pricing:getPricing")
+ @GET
+ @Path("/pricing/")
+ Pricing getPricing();
+
+ /**
+ * Get discount information.
+ *
+ * @return discount information.
+ */
+ @Named("discount:listDiscounts")
+ @GET
+ @Path("/discount/")
+ @ResponseParser(ParseDiscounts.class)
+ @Transform(ParseDiscounts.ToPagedIterable.class)
+ PagedIterable<Discount> listDiscounts();
+
+ /**
+ * Get discount information.
+ *
+ * @return PaginatedCollection of discount information.
+ */
+ @Named("discount:listDiscounts")
+ @GET
+ @Path("/discount/")
+ @ResponseParser(ParseDiscounts.class)
+ PaginatedCollection<Discount> listDiscounts(PaginationOptions options);
+
+ /**
+ * Get the transactions for the account.
+ *
+ * @return transactions for the account.
+ */
+ @Named("ledger:listTransactions")
+ @GET
+ @Path("/ledger/")
+ @ResponseParser(ParseTransactions.class)
+ @Transform(ParseTransactions.ToPagedIterable.class)
+ PagedIterable<Transaction> listTransactions();
+
+ /**
+ * Get the transactions for the account.
+ *
+ * @return PaginatedCollection of account's transactions.
+ */
+ @Named("ledger:listTransactions")
+ @GET
+ @Path("/ledger/")
+ @ResponseParser(ParseTransactions.class)
+ PaginatedCollection<Transaction> listTransactions(PaginationOptions options);
+
+ /**
+ * Get the licenses available on the cloud. The type of the license can be one of:
+ * install - These licenses are billed per installation, regardless of whether it is attached to a running guests or not.
+ * instance - These licenses are billed per running instance of a guest. A license attached to a guest that’s stopped is not billed.
+ * stub - These licenses are billed per a metric specified by the customer (i.e. per number of users license)
+ * <p/>
+ * The user metric field specifies what attribute on the instance of the guest is used for determining the number of licenses.
+ * For example, “smp” will count one license for each CPU/core in the virtual machine.
+ *
+ * @return licenses available on the cloud
+ */
+ @Named("license:listLicenses")
+ @GET
+ @Path("/licenses/")
+ @ResponseParser(ParseLicenses.class)
+ @Transform(ParseLicenses.ToPagedIterable.class)
+ PagedIterable<License> listLicenses();
+
+ /**
+ * Get the licenses available on the cloud. The type of the license can be one of:
+ * install - These licenses are billed per installation, regardless of whether it is attached to a running guests or not.
+ * instance - These licenses are billed per running instance of a guest. A license attached to a guest that’s stopped is not billed.
+ * stub - These licenses are billed per a metric specified by the customer (i.e. per number of users license)
+ * <p/>
+ * The user metric field specifies what attribute on the instance of the guest is used for determining the number of licenses.
+ * For example, “smp” will count one license for each CPU/core in the virtual machine.
+ *
+ * @return PaginatedCollection of licenses available on the cloud
+ */
+ @Named("license:listLicenses")
+ @GET
+ @Path("/licenses/")
+ @ResponseParser(ParseLicenses.class)
+ PaginatedCollection<License> listLicenses(PaginationOptions options);
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0d70c84a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/CloudSigma2ApiMetadata.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/CloudSigma2ApiMetadata.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/CloudSigma2ApiMetadata.java
index c67f14c..5437a41 100644
--- a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/CloudSigma2ApiMetadata.java
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/CloudSigma2ApiMetadata.java
@@ -33,7 +33,7 @@ import static org.jclouds.reflect.Reflection2.typeToken;
/**
* Implementation of {@link BaseHttpApiMetadata} for the Cloud Sigma API
- *
+ *
* @author Vladimir Shevchenko
*/
public class CloudSigma2ApiMetadata extends BaseHttpApiMetadata<CloudSigma2Api> {
@@ -67,19 +67,19 @@ public class CloudSigma2ApiMetadata extends BaseHttpApiMetadata<CloudSigma2Api>
protected Builder() {
super(CloudSigma2Api.class);
id("cloudsigma2")
- .name("CloudSigma API")
- .defaultIdentity("email")
- .identityName("Email")
- .defaultCredential("Password")
- .credentialName("Password")
- .documentation(URI.create("http://cloudsigma.com/en/platform-details/the-api"))
- .version("2.0")
- .defaultEndpoint("https://zrh.cloudsigma.com/api/2.0")
- .defaultProperties(CloudSigma2ApiMetadata.defaultProperties())
- .view(typeToken(ComputeServiceContext.class))
- .defaultModules(ImmutableSet.<Class<? extends Module>>of(
- CloudSigma2HttpApiModule.class,
- CloudSigma2ParserModule.class));
+ .name("CloudSigma API")
+ .defaultIdentity("email")
+ .identityName("Email")
+ .defaultCredential("Password")
+ .credentialName("Password")
+ .documentation(URI.create("http://cloudsigma.com/en/platform-details/the-api"))
+ .version("2.0")
+ .defaultEndpoint("https://zrh.cloudsigma.com/api/2.0")
+ .defaultProperties(CloudSigma2ApiMetadata.defaultProperties())
+ .view(typeToken(ComputeServiceContext.class))
+ .defaultModules(ImmutableSet.<Class<? extends Module>>of(
+ CloudSigma2HttpApiModule.class,
+ CloudSigma2ParserModule.class));
}
@Override
@@ -94,7 +94,7 @@ public class CloudSigma2ApiMetadata extends BaseHttpApiMetadata<CloudSigma2Api>
@Override
public Builder fromApiMetadata(ApiMetadata in) {
- return this;
+ return this;
}
}
}
[02/13] Fix code style of the cloudsigma2 provider.
Posted by na...@apache.org.
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0d70c84a/cloudsigma2/src/test/java/org/jclouds/cloudsigma2/CloudSigma2ApiLiveTest.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/test/java/org/jclouds/cloudsigma2/CloudSigma2ApiLiveTest.java b/cloudsigma2/src/test/java/org/jclouds/cloudsigma2/CloudSigma2ApiLiveTest.java
index 1ba8fd6..3295579 100644
--- a/cloudsigma2/src/test/java/org/jclouds/cloudsigma2/CloudSigma2ApiLiveTest.java
+++ b/cloudsigma2/src/test/java/org/jclouds/cloudsigma2/CloudSigma2ApiLiveTest.java
@@ -55,273 +55,207 @@ import java.util.Map;
@Test(groups = "live")
public class CloudSigma2ApiLiveTest extends BaseApiLiveTest<CloudSigma2Api> {
- private DriveInfo createdDrive;
- private List<DriveInfo> createdDrives;
- private ServerInfo createdServer;
- private List<ServerInfo> createdServers;
- private FirewallPolicy createdFirewallPolicy;
- private Tag createdTag;
- private List<Tag> createdTags;
-
- public CloudSigma2ApiLiveTest() {
- provider = "cloudsigma2";
- }
-
- @Test
- public void testListDrives() throws Exception {
- Assert.assertNotNull(api.listDrives());
- }
-
- @Test
- public void testListDrivesInfo() throws Exception {
- Assert.assertNotNull(api.listDrivesInfo());
- }
-
- @Test
- public void testGetDriveInfo() throws Exception {
- for(Drive driveInfo : api.listDrives().concat()){
- Assert.assertNotNull(api.getDriveInfo(driveInfo.getUuid()));
- }
- }
-
- @Test
- public void testCreateDrive() throws Exception {
- DriveInfo newDrive = new DriveInfo.Builder()
- .name("test drive")
- .size(new BigInteger("2073741824"))
- .media(MediaType.DISK)
- .build();
- createdDrive = api.createDrive(newDrive);
- checkDrive(newDrive, createdDrive);
- }
-
- @Test
- public void testCreateDrives() throws Exception {
- List<DriveInfo> newDrives = ImmutableList.of(new DriveInfo.Builder()
- .name("New Drive")
- .size(new BigInteger("2073741824"))
- .media(MediaType.DISK)
- .build()
- , new DriveInfo.Builder()
- .name("Test Drive")
- .size(new BigInteger("6073741824"))
- .media(MediaType.DISK)
- .build());
-
- createdDrives = api.createDrives(newDrives);
- Assert.assertEquals(newDrives.size(), createdDrives.size());
-
- for(int i = 0; i < newDrives.size(); i++){
- checkDrive(newDrives.get(i), createdDrives.get(i));
- }
- }
-
- @Test(dependsOnMethods = {"testCreateDrive"})
- public void testEditDrive() throws Exception {
- DriveInfo editedDrive = new DriveInfo.Builder()
- .name("Edited Drive")
- .size(createdDrive.getSize())
- .media(MediaType.DISK)
- .build();
-
- checkDrive(editedDrive, api.editDrive(createdDrive.getUuid(), editedDrive));
- }
-
- @Test(dependsOnMethods = {"testEditDrive"})
- public void testDeleteDrive() throws Exception {
- api.deleteDrive(createdDrive.getUuid());
- }
-
- @Test(dependsOnMethods = {"testCreateDrives"})
- public void testDeleteDrives() throws Exception {
- ImmutableList.Builder<String> stringListBuilder = ImmutableList.builder();
- for(DriveInfo driveInfo : createdDrives){
- stringListBuilder.add(driveInfo.getUuid());
- }
- api.deleteDrives(stringListBuilder.build());
- }
-
- @Test
- public void testListLibraryDrives() throws Exception {
- Assert.assertNotNull(api.listLibraryDrives());
- }
-
- @Test
- public void testGetLibraryDrive() throws Exception {
- for(LibraryDrive libraryDrive : api.listLibraryDrives().concat()){
- Assert.assertNotNull(libraryDrive.getUuid());
- }
- }
-
- @Test
- public void testListServers() throws Exception {
- Assert.assertNotNull(api.listServers());
- }
-
- @Test
- public void testListServersInfo() throws Exception {
- Assert.assertNotNull(api.listServersInfo());
- }
-
- @Test
- public void testCreateServer() throws Exception {
- ServerInfo serverInfo = new ServerInfo.Builder()
- .name("New Server")
- .memory(new BigInteger("5368709120"))
- .cpu(3000)
- .vncPassword("new_password")
- .drives(ImmutableList.of(api.listDrives().concat().get(0).toServerDrive(1, "0:1", DeviceEmulationType.IDE)))
- .build();
-
- createdServer = api.createServer(serverInfo);
- checkServer(serverInfo, createdServer);
- }
-
- @Test
- public void testCreateServers() throws Exception {
- List<ServerInfo> newServerList = ImmutableList.of(
- new ServerInfo.Builder()
- .name("New Server")
- .memory(new BigInteger("5368709120"))
- .cpu(3000)
- .vncPassword("new_password")
- .build()
- , new ServerInfo.Builder()
- .name("Test Server")
- .memory(new BigInteger("5368709120"))
- .cpu(3000)
- .vncPassword("test_password")
- .build());
-
- createdServers = api.createServers(newServerList);
- Assert.assertEquals(newServerList.size(), createdServers.size());
-
- for(int i = 0; i < newServerList.size(); i++){
- checkServer(newServerList.get(i), createdServers.get(i));
- }
- }
-
- @Test(dependsOnMethods = {"testCreateServer"})
- public void testEditServer() throws Exception {
- ServerInfo serverInfo = new ServerInfo.Builder()
- .name("Edited Server")
- .memory(new BigInteger("5368709120"))
- .cpu(2000)
- .vncPassword("edited_password")
- .build();
-
- checkServer(serverInfo, api.editServer(createdServer.getUuid(), serverInfo));
- }
-
- @Test
- public void testGetServerInfo() throws Exception {
- for(Server server : api.listServers().concat()){
- Assert.assertNotNull(server.getUuid());
- }
- }
-
- @Test(dependsOnMethods = {"testEditServer"})
- public void testDeleteServer() throws Exception {
- api.deleteServer(createdServer.getUuid());
- }
-
- @Test(dependsOnMethods = {"testCreateServers"})
- public void testDeleteServers() throws Exception {
- ImmutableList.Builder<String> stringListBuilder = ImmutableList.builder();
- for(ServerInfo serverInfo : createdServers){
- stringListBuilder.add(serverInfo.getUuid());
- }
- api.deleteServers(stringListBuilder.build());
- }
-
- @Test
- public void testListFirewallPolicies() throws Exception {
- Assert.assertNotNull(api.listFirewallPolicies());
- }
-
- @Test
- public void testListFirewallPoliciesInfo() throws Exception {
- Assert.assertNotNull(api.listFirewallPoliciesInfo());
- }
-
- @Test
- public void testCreateFirewallPolicies() throws Exception {
- List<FirewallPolicy> newFirewallPolicies = ImmutableList.of(
- new FirewallPolicy.Builder()
- .name("My awesome policy")
- .rules(ImmutableList.of(
- new FirewallRule.Builder()
- .action(FirewallAction.DROP)
- .comment("Drop traffic from the VM to IP address 23.0.0.0/32")
- .direction(FirewallDirection.OUT)
- .destinationIp("23.0.0.0/32")
- .build()
- , new FirewallRule.Builder()
- .action(FirewallAction.ACCEPT)
- .comment("Allow SSH traffic to the VM from our office in Dubai")
- .direction(FirewallDirection.IN)
- .destinationPort("22")
- .ipProtocol(FirewallIpProtocol.TCP)
- .sourceIp("172.66.32.0/24")
- .build()
- , new FirewallRule.Builder()
- .action(FirewallAction.DROP)
- .comment("Drop all other SSH traffic to the VM")
- .direction(FirewallDirection.IN)
- .destinationPort("22")
- .ipProtocol(FirewallIpProtocol.TCP)
- .build()
- , new FirewallRule.Builder()
- .action(FirewallAction.DROP)
- .comment("Drop all UDP traffic to the VM, not originating from 172.66.32.55")
- .direction(FirewallDirection.IN)
- .ipProtocol(FirewallIpProtocol.UDP)
- .sourceIp("!172.66.32.55/32")
- .build()
- , new FirewallRule.Builder()
- .action(FirewallAction.DROP)
- .comment("Drop any traffic, to the VM with destination port not between 1-1024")
- .direction(FirewallDirection.IN)
- .destinationPort("!1:1024")
- .ipProtocol(FirewallIpProtocol.TCP)
- .build()
- ))
- .build()
- , new FirewallPolicy.Builder()
- .name("New policy")
- .rules(ImmutableList.of(
+ private DriveInfo createdDrive;
+ private List<DriveInfo> createdDrives;
+ private ServerInfo createdServer;
+ private List<ServerInfo> createdServers;
+ private FirewallPolicy createdFirewallPolicy;
+ private Tag createdTag;
+ private List<Tag> createdTags;
+
+ public CloudSigma2ApiLiveTest() {
+ provider = "cloudsigma2";
+ }
+
+ @Test
+ public void testListDrives() throws Exception {
+ Assert.assertNotNull(api.listDrives());
+ }
+
+ @Test
+ public void testListDrivesInfo() throws Exception {
+ Assert.assertNotNull(api.listDrivesInfo());
+ }
+
+ @Test
+ public void testGetDriveInfo() throws Exception {
+ for (Drive driveInfo : api.listDrives().concat()) {
+ Assert.assertNotNull(api.getDriveInfo(driveInfo.getUuid()));
+ }
+ }
+
+ @Test
+ public void testCreateDrive() throws Exception {
+ DriveInfo newDrive = new DriveInfo.Builder()
+ .name("test drive")
+ .size(new BigInteger("2073741824"))
+ .media(MediaType.DISK)
+ .build();
+ createdDrive = api.createDrive(newDrive);
+ checkDrive(newDrive, createdDrive);
+ }
+
+ @Test
+ public void testCreateDrives() throws Exception {
+ List<DriveInfo> newDrives = ImmutableList.of(new DriveInfo.Builder()
+ .name("New Drive")
+ .size(new BigInteger("2073741824"))
+ .media(MediaType.DISK)
+ .build()
+ , new DriveInfo.Builder()
+ .name("Test Drive")
+ .size(new BigInteger("6073741824"))
+ .media(MediaType.DISK)
+ .build());
+
+ createdDrives = api.createDrives(newDrives);
+ Assert.assertEquals(newDrives.size(), createdDrives.size());
+
+ for (int i = 0; i < newDrives.size(); i++) {
+ checkDrive(newDrives.get(i), createdDrives.get(i));
+ }
+ }
+
+ @Test(dependsOnMethods = {"testCreateDrive"})
+ public void testEditDrive() throws Exception {
+ DriveInfo editedDrive = new DriveInfo.Builder()
+ .name("Edited Drive")
+ .size(createdDrive.getSize())
+ .media(MediaType.DISK)
+ .build();
+
+ checkDrive(editedDrive, api.editDrive(createdDrive.getUuid(), editedDrive));
+ }
+
+ @Test(dependsOnMethods = {"testEditDrive"})
+ public void testDeleteDrive() throws Exception {
+ api.deleteDrive(createdDrive.getUuid());
+ }
+
+ @Test(dependsOnMethods = {"testCreateDrives"})
+ public void testDeleteDrives() throws Exception {
+ ImmutableList.Builder<String> stringListBuilder = ImmutableList.builder();
+ for (DriveInfo driveInfo : createdDrives) {
+ stringListBuilder.add(driveInfo.getUuid());
+ }
+ api.deleteDrives(stringListBuilder.build());
+ }
+
+ @Test
+ public void testListLibraryDrives() throws Exception {
+ Assert.assertNotNull(api.listLibraryDrives());
+ }
+
+ @Test
+ public void testGetLibraryDrive() throws Exception {
+ for (LibraryDrive libraryDrive : api.listLibraryDrives().concat()) {
+ Assert.assertNotNull(libraryDrive.getUuid());
+ }
+ }
+
+ @Test
+ public void testListServers() throws Exception {
+ Assert.assertNotNull(api.listServers());
+ }
+
+ @Test
+ public void testListServersInfo() throws Exception {
+ Assert.assertNotNull(api.listServersInfo());
+ }
+
+ @Test
+ public void testCreateServer() throws Exception {
+ ServerInfo serverInfo = new ServerInfo.Builder()
+ .name("New Server")
+ .memory(new BigInteger("5368709120"))
+ .cpu(3000)
+ .vncPassword("new_password")
+ .drives(ImmutableList.of(api.listDrives().concat().get(0).toServerDrive(1, "0:1", DeviceEmulationType.IDE)))
+ .build();
+
+ createdServer = api.createServer(serverInfo);
+ checkServer(serverInfo, createdServer);
+ }
+
+ @Test
+ public void testCreateServers() throws Exception {
+ List<ServerInfo> newServerList = ImmutableList.of(
+ new ServerInfo.Builder()
+ .name("New Server")
+ .memory(new BigInteger("5368709120"))
+ .cpu(3000)
+ .vncPassword("new_password")
+ .build()
+ , new ServerInfo.Builder()
+ .name("Test Server")
+ .memory(new BigInteger("5368709120"))
+ .cpu(3000)
+ .vncPassword("test_password")
+ .build());
+
+ createdServers = api.createServers(newServerList);
+ Assert.assertEquals(newServerList.size(), createdServers.size());
+
+ for (int i = 0; i < newServerList.size(); i++) {
+ checkServer(newServerList.get(i), createdServers.get(i));
+ }
+ }
+
+ @Test(dependsOnMethods = {"testCreateServer"})
+ public void testEditServer() throws Exception {
+ ServerInfo serverInfo = new ServerInfo.Builder()
+ .name("Edited Server")
+ .memory(new BigInteger("5368709120"))
+ .cpu(2000)
+ .vncPassword("edited_password")
+ .build();
+
+ checkServer(serverInfo, api.editServer(createdServer.getUuid(), serverInfo));
+ }
+
+ @Test
+ public void testGetServerInfo() throws Exception {
+ for (Server server : api.listServers().concat()) {
+ Assert.assertNotNull(server.getUuid());
+ }
+ }
+
+ @Test(dependsOnMethods = {"testEditServer"})
+ public void testDeleteServer() throws Exception {
+ api.deleteServer(createdServer.getUuid());
+ }
+
+ @Test(dependsOnMethods = {"testCreateServers"})
+ public void testDeleteServers() throws Exception {
+ ImmutableList.Builder<String> stringListBuilder = ImmutableList.builder();
+ for (ServerInfo serverInfo : createdServers) {
+ stringListBuilder.add(serverInfo.getUuid());
+ }
+ api.deleteServers(stringListBuilder.build());
+ }
+
+ @Test
+ public void testListFirewallPolicies() throws Exception {
+ Assert.assertNotNull(api.listFirewallPolicies());
+ }
+
+ @Test
+ public void testListFirewallPoliciesInfo() throws Exception {
+ Assert.assertNotNull(api.listFirewallPoliciesInfo());
+ }
+
+ @Test
+ public void testCreateFirewallPolicies() throws Exception {
+ List<FirewallPolicy> newFirewallPolicies = ImmutableList.of(
+ new FirewallPolicy.Builder()
+ .name("My awesome policy")
+ .rules(ImmutableList.of(
new FirewallRule.Builder()
- .action(FirewallAction.ACCEPT)
- .comment("Test comment")
- .direction(FirewallDirection.IN)
- .destinationIp("192.168.1.132/32")
- .destinationPort("1233")
- .ipProtocol(FirewallIpProtocol.TCP)
- .sourceIp("255.255.255.12/32")
- .sourcePort("321")
- .build()
- ))
- .build());
-
- List<FirewallPolicy> createdFirewallPolicies = api.createFirewallPolicies(newFirewallPolicies);
- Assert.assertEquals(newFirewallPolicies.size(), createdFirewallPolicies.size());
-
- for(int i = 0; i < newFirewallPolicies.size(); i++){
- checkFirewallPolicy(newFirewallPolicies.get(i), createdFirewallPolicies.get(i));
- }
- }
-
- @Test
- public void testCreateFirewallPolicy() throws Exception {
- FirewallPolicy newFirewallPolicy = new FirewallPolicy.Builder()
- .name("My awesome policy")
- .rules(ImmutableList.of(
- new FirewallRule.Builder()
- .action(FirewallAction.DROP)
- .comment("Drop traffic from the VM to IP address 23.0.0.0/32")
- .direction(FirewallDirection.OUT)
- .destinationIp("23.0.0.0/32")
- .build()
+ .action(FirewallAction.DROP)
+ .comment("Drop traffic from the VM to IP address 23.0.0.0/32")
+ .direction(FirewallDirection.OUT)
+ .destinationIp("23.0.0.0/32")
+ .build()
, new FirewallRule.Builder()
.action(FirewallAction.ACCEPT)
.comment("Allow SSH traffic to the VM from our office in Dubai")
@@ -351,324 +285,390 @@ public class CloudSigma2ApiLiveTest extends BaseApiLiveTest<CloudSigma2Api> {
.destinationPort("!1:1024")
.ipProtocol(FirewallIpProtocol.TCP)
.build()
- ))
- .build();
-
- createdFirewallPolicy = api.createFirewallPolicy(newFirewallPolicy);
- checkFirewallPolicy(newFirewallPolicy, createdFirewallPolicy);
- }
-
- @Test
- public void testEditFirewallPolicy() throws Exception {
- FirewallPolicy editedPolicy = new FirewallPolicy.Builder()
- .name("Edited policy")
- .rules(ImmutableList.of(
- new FirewallRule.Builder()
- .action(FirewallAction.ACCEPT)
- .comment("Edited policy rule comment")
- .direction(FirewallDirection.IN)
- .destinationIp("192.168.1.132/32")
- .destinationPort("1233")
- .ipProtocol(FirewallIpProtocol.TCP)
- .sourceIp("255.255.255.12/32")
- .sourcePort("321")
- .build()
- ))
- .build();
-
- checkFirewallPolicy(editedPolicy, api.editFirewallPolicy(createdFirewallPolicy.getUuid(), editedPolicy));
- }
-
- @Test
- public void testListVLANs() throws Exception {
- Assert.assertNotNull(api.listVLANs());
- }
-
- @Test
- public void testListVLANInfo() throws Exception {
- Assert.assertNotNull(api.listVLANInfo());
- }
-
- @Test
- public void testGetVLANInfo() throws Exception {
- for(VLANInfo vlanInfo : api.listVLANs().concat()){
- Assert.assertNotNull(vlanInfo.getUuid());
- }
- }
-
- @Test
- public void testEditVLAN() throws Exception {
- Map<String, String> meta = new HashMap<String, String>();
- meta.put("test", "test data");
-
- VLANInfo vlanInfo = new VLANInfo.Builder()
- .meta(meta)
- .build();
-
- if(api.listVLANs().size() > 0){
- checkVlAN(vlanInfo, api.editVLAN(api.listVLANs().concat().get(0).getUuid(), vlanInfo));
- }
- }
-
- @Test
- public void testListIPs() throws Exception {
- Assert.assertNotNull(api.listIPs());
- }
-
- @Test
- public void testListIPInfo() throws Exception {
- Assert.assertNotNull(api.listIPInfo());
- }
-
- @Test
- public void testGetIPInfo() throws Exception {
- for(IP ip : api.listIPs().concat()){
- Assert.assertNotNull(api.getIPInfo(ip.getUuid()));
- }
- }
-
- @Test
- public void testEditIP() throws Exception {
- Map<String, String> meta = new HashMap<String, String>();
- meta.put("test", "test data");
-
- IPInfo ip = new IPInfo.Builder()
- .meta(meta)
- .build();
-
- if(api.listIPs().size() > 0){
- checkIP(ip, api.editIP(api.listIPs().concat().get(0).getUuid(), ip));
- }
- }
-
- @Test
- public void testListTags() throws Exception {
- Assert.assertNotNull(api.listTags());
- }
-
- @Test
- public void testListTagsInfo() throws Exception {
- Assert.assertNotNull(api.listTagsInfo());
- }
-
- @Test
- public void testGetTagInfo() throws Exception {
- for(Tag tag : api.listTags().concat()){
- Assert.assertNotNull(api.getTagInfo(tag.getUuid()));
- }
- }
+ ))
+ .build()
+ , new FirewallPolicy.Builder()
+ .name("New policy")
+ .rules(ImmutableList.of(
+ new FirewallRule.Builder()
+ .action(FirewallAction.ACCEPT)
+ .comment("Test comment")
+ .direction(FirewallDirection.IN)
+ .destinationIp("192.168.1.132/32")
+ .destinationPort("1233")
+ .ipProtocol(FirewallIpProtocol.TCP)
+ .sourceIp("255.255.255.12/32")
+ .sourcePort("321")
+ .build()
+ ))
+ .build());
+
+ List<FirewallPolicy> createdFirewallPolicies = api.createFirewallPolicies(newFirewallPolicies);
+ Assert.assertEquals(newFirewallPolicies.size(), createdFirewallPolicies.size());
+
+ for (int i = 0; i < newFirewallPolicies.size(); i++) {
+ checkFirewallPolicy(newFirewallPolicies.get(i), createdFirewallPolicies.get(i));
+ }
+ }
+
+ @Test
+ public void testCreateFirewallPolicy() throws Exception {
+ FirewallPolicy newFirewallPolicy = new FirewallPolicy.Builder()
+ .name("My awesome policy")
+ .rules(ImmutableList.of(
+ new FirewallRule.Builder()
+ .action(FirewallAction.DROP)
+ .comment("Drop traffic from the VM to IP address 23.0.0.0/32")
+ .direction(FirewallDirection.OUT)
+ .destinationIp("23.0.0.0/32")
+ .build()
+ , new FirewallRule.Builder()
+ .action(FirewallAction.ACCEPT)
+ .comment("Allow SSH traffic to the VM from our office in Dubai")
+ .direction(FirewallDirection.IN)
+ .destinationPort("22")
+ .ipProtocol(FirewallIpProtocol.TCP)
+ .sourceIp("172.66.32.0/24")
+ .build()
+ , new FirewallRule.Builder()
+ .action(FirewallAction.DROP)
+ .comment("Drop all other SSH traffic to the VM")
+ .direction(FirewallDirection.IN)
+ .destinationPort("22")
+ .ipProtocol(FirewallIpProtocol.TCP)
+ .build()
+ , new FirewallRule.Builder()
+ .action(FirewallAction.DROP)
+ .comment("Drop all UDP traffic to the VM, not originating from 172.66.32.55")
+ .direction(FirewallDirection.IN)
+ .ipProtocol(FirewallIpProtocol.UDP)
+ .sourceIp("!172.66.32.55/32")
+ .build()
+ , new FirewallRule.Builder()
+ .action(FirewallAction.DROP)
+ .comment("Drop any traffic, to the VM with destination port not between 1-1024")
+ .direction(FirewallDirection.IN)
+ .destinationPort("!1:1024")
+ .ipProtocol(FirewallIpProtocol.TCP)
+ .build()
+ ))
+ .build();
+
+ createdFirewallPolicy = api.createFirewallPolicy(newFirewallPolicy);
+ checkFirewallPolicy(newFirewallPolicy, createdFirewallPolicy);
+ }
+
+ @Test
+ public void testEditFirewallPolicy() throws Exception {
+ FirewallPolicy editedPolicy = new FirewallPolicy.Builder()
+ .name("Edited policy")
+ .rules(ImmutableList.of(
+ new FirewallRule.Builder()
+ .action(FirewallAction.ACCEPT)
+ .comment("Edited policy rule comment")
+ .direction(FirewallDirection.IN)
+ .destinationIp("192.168.1.132/32")
+ .destinationPort("1233")
+ .ipProtocol(FirewallIpProtocol.TCP)
+ .sourceIp("255.255.255.12/32")
+ .sourcePort("321")
+ .build()
+ ))
+ .build();
+
+ checkFirewallPolicy(editedPolicy, api.editFirewallPolicy(createdFirewallPolicy.getUuid(), editedPolicy));
+ }
+
+ @Test
+ public void testListVLANs() throws Exception {
+ Assert.assertNotNull(api.listVLANs());
+ }
+
+ @Test
+ public void testListVLANInfo() throws Exception {
+ Assert.assertNotNull(api.listVLANInfo());
+ }
+
+ @Test
+ public void testGetVLANInfo() throws Exception {
+ for (VLANInfo vlanInfo : api.listVLANs().concat()) {
+ Assert.assertNotNull(vlanInfo.getUuid());
+ }
+ }
+
+ @Test
+ public void testEditVLAN() throws Exception {
+ Map<String, String> meta = new HashMap<String, String>();
+ meta.put("test", "test data");
+
+ VLANInfo vlanInfo = new VLANInfo.Builder()
+ .meta(meta)
+ .build();
+
+ if (api.listVLANs().size() > 0) {
+ checkVlAN(vlanInfo, api.editVLAN(api.listVLANs().concat().get(0).getUuid(), vlanInfo));
+ }
+ }
+
+ @Test
+ public void testListIPs() throws Exception {
+ Assert.assertNotNull(api.listIPs());
+ }
+
+ @Test
+ public void testListIPInfo() throws Exception {
+ Assert.assertNotNull(api.listIPInfo());
+ }
+
+ @Test
+ public void testGetIPInfo() throws Exception {
+ for (IP ip : api.listIPs().concat()) {
+ Assert.assertNotNull(api.getIPInfo(ip.getUuid()));
+ }
+ }
+
+ @Test
+ public void testEditIP() throws Exception {
+ Map<String, String> meta = new HashMap<String, String>();
+ meta.put("test", "test data");
+
+ IPInfo ip = new IPInfo.Builder()
+ .meta(meta)
+ .build();
+
+ if (api.listIPs().size() > 0) {
+ checkIP(ip, api.editIP(api.listIPs().concat().get(0).getUuid(), ip));
+ }
+ }
+
+ @Test
+ public void testListTags() throws Exception {
+ Assert.assertNotNull(api.listTags());
+ }
+
+ @Test
+ public void testListTagsInfo() throws Exception {
+ Assert.assertNotNull(api.listTagsInfo());
+ }
+
+ @Test
+ public void testGetTagInfo() throws Exception {
+ for (Tag tag : api.listTags().concat()) {
+ Assert.assertNotNull(api.getTagInfo(tag.getUuid()));
+ }
+ }
// Following test cases are disabled due to constant failing because of internal, server-side bug.
- // @Test(dependsOnMethods = {"testEditDrive"})
- // public void testCreateTag() throws Exception {
- // Map<String, String> meta = new HashMap<String, String>();
- // meta.put("description", "Test tag");
-
- // Tag newTag = new Tag.Builder()
- // .meta(meta)
- // .name("Cloudsigma2 Test tag")
- // .meta(new HashMap<String, String>())
- // .resources(ImmutableList.of(
- // new TagResource.Builder()
- // .uuid(createdDrive.getUuid())
- // .build()
- // ))
- // .build();
- // createdTag = api.createTag(newTag);
- // checkTag(newTag, createdTag);
- // }
-
- // @Test(dependsOnMethods = {"testEditDrive"})
- // public void testCreateTags() throws Exception {
- // List<Tag> newTagsList = ImmutableList.of(
- // new Tag.Builder()
- // .name("Cloudsigma2 New tag")
- // .meta(new HashMap<String, String>())
- // .build()
- // , new Tag.Builder()
- // .name("Cloudsigma2 tag with resource")
- // .meta(new HashMap<String, String>())
- // .resources(ImmutableList.of(
- // new TagResource.Builder()
- // .uuid(createdDrive.getUuid())
- // .build()
- // ))
- // .build());
-
- // createdTags = api.createTags(newTagsList);
- // Assert.assertEquals(newTagsList.size(), createdTags.size());
-
- // for(int i = 0; i < newTagsList.size(); i++){
- // checkTag(newTagsList.get(i), createdTags.get(i));
- // }
- // }
-
- // @Test(dependsOnMethods = {"testCreateTag"})
- // public void testEditTag() throws Exception {
- // Map<String, String> meta = new HashMap<String, String>();
- // meta.put("description", "test tag");
-
- // Tag editedTag = new Tag.Builder()
- // .meta(meta)
- // .name("Edited Tag")
- // .resources(ImmutableList.of(
- // new TagResource.Builder()
- // .uuid(createdDrive.getUuid())
- // .build()
- // ))
- // .build();
-
- // checkTag(editedTag, api.editTag(createdTag.getUuid(), editedTag));
- // }
-
- // @Test(dependsOnMethods = {"testEditTag"})
- // public void testDeleteTag() throws Exception{
- // api.deleteTag(createdTag.getUuid());
- // }
-
- // @Test(dependsOnMethods = {"testCreateTags"})
- // public void testDeleteTags() throws Exception{
- // for(Tag tag : createdTags){
- // api.deleteTag(tag.getUuid());
- // }
- // }
-
- @Test
- public void testGetProfileInfo() throws Exception {
- Assert.assertNotNull(api.getProfileInfo());
- }
-
- @Test
- public void testEditProfileInfo() throws Exception {
- ProfileInfo profileInfo = new ProfileInfo.Builder()
- .address("edited address")
- .bankReference("sigma111")
- .company("Awesome company")
- .country("USA")
- .email("user@example.com")
- .firstName("Tim")
- .lastName("Testersson")
- .town("New York")
- .build();
-
- checkProfileInfo(profileInfo, api.editProfileInfo(profileInfo));
- }
-
- @Test
- public void testGetAccountBalance() throws Exception {
- Assert.assertNotNull(api.getAccountBalance());
- }
-
- @Test
- public void testGetCurrentUsage() throws Exception {
- Assert.assertNotNull(api.getCurrentUsage());
- }
-
- @Test
- public void testListSubscriptions() throws Exception {
- for(Subscription subscription : api.listSubscriptions().concat()){
- Assert.assertNotNull(subscription);
- }
- }
-
- @Test
- public void testGetSubscription() throws Exception {
- for(Subscription subscription : api.listSubscriptions().concat()){
- Assert.assertNotNull(api.getSubscription(subscription.getId()));
- }
- }
-
- @Test
- public void testListSubscriptionsCalculator() throws Exception {
- for(Subscription subscription : api.listSubscriptionsCalculator().concat()){
- Assert.assertNotNull(subscription);
- }
- }
-
- @Test
- public void testGetPricing() throws Exception {
- Assert.assertNotNull(api.getPricing());
- }
-
- @Test
- public void testListDiscounts() throws Exception {
- for(Discount discount : api.listDiscounts().concat()){
- Assert.assertNotNull(discount);
- }
- }
-
- @Test
- public void testListTransactions() throws Exception {
- for(Transaction transaction : api.listTransactions().concat()){
- Assert.assertNotNull(transaction);
- }
- }
-
- @Test
- public void testListLicenses() throws Exception {
- for(License license : api.listLicenses().concat()){
- Assert.assertNotNull(license);
- }
- }
-
- private void checkDrive(DriveInfo newDrive, DriveInfo createdDrive){
- Assert.assertEquals(newDrive.getName(), createdDrive.getName());
- Assert.assertEquals(newDrive.getMedia(), createdDrive.getMedia());
- }
-
- private void checkServer(ServerInfo newServer, ServerInfo createdServer){
- Assert.assertEquals(newServer.getName(), createdServer.getName());
- Assert.assertEquals(newServer.getMemory(), createdServer.getMemory());
- Assert.assertEquals(newServer.getVncPassword(), createdServer.getVncPassword());
- Assert.assertEquals(newServer.getCpu(), createdServer.getCpu());
-
- Assert.assertEquals(newServer.getDrives().size(), createdServer.getDrives().size());
-
- for(int i = 0; i < newServer.getDrives().size(); i++){
- checkServerDrive(newServer.getDrives().get(i), createdServer.getDrives().get(i));
- }
- }
-
- private void checkServerDrive(ServerDrive newServerDrive, ServerDrive createdServerDrive){
- Assert.assertEquals(newServerDrive.getBootOrder(), createdServerDrive.getBootOrder());
- Assert.assertEquals(newServerDrive.getDeviceChannel(), createdServerDrive.getDeviceChannel());
- Assert.assertEquals(newServerDrive.getDeviceEmulationType(), createdServerDrive.getDeviceEmulationType());
- }
-
- private void checkFirewallPolicy(FirewallPolicy newFirewallPolicy, FirewallPolicy createdFirewallPolicy){
- Assert.assertEquals(newFirewallPolicy.getName(), createdFirewallPolicy.getName());
- Assert.assertEquals(newFirewallPolicy.getRules(), createdFirewallPolicy.getRules());
- }
-
- private void checkVlAN(VLANInfo newVLAN, VLANInfo createdVLAN){
- Assert.assertEquals(newVLAN.getMeta(), createdVLAN.getMeta());
- }
-
- private void checkIP(IPInfo newIP, IPInfo createdIP){
- Assert.assertEquals(newIP.getMeta(), createdIP.getMeta());
- }
-
- private void checkTag(Tag newTag, Tag createdTag){
- Assert.assertEquals(newTag.getName(), createdTag.getName());
- Assert.assertEquals(newTag.getMeta(), createdTag.getMeta());
-
- Assert.assertEquals(newTag.getResources().size(), createdTag.getResources().size());
-
- for(int i = 0; i < newTag.getResources().size(); i++){
- checkTagRes(newTag.getResources().get(i), createdTag.getResources().get(i));
- }
- }
-
- private void checkTagRes(TagResource newTagResource, TagResource createdTagResource){
- Assert.assertEquals(newTagResource.getUuid(), createdTagResource.getUuid());
- }
-
- private void checkProfileInfo(ProfileInfo newProfileInfo, ProfileInfo createdProfileInfo){
- Assert.assertEquals(newProfileInfo.getAddress(), createdProfileInfo.getAddress());
- Assert.assertEquals(newProfileInfo.getCompany(), createdProfileInfo.getCompany());
- Assert.assertEquals(newProfileInfo.getCountry(), createdProfileInfo.getCountry());
- Assert.assertEquals(newProfileInfo.getFirstName(), createdProfileInfo.getFirstName());
- Assert.assertEquals(newProfileInfo.getLastName(), createdProfileInfo.getLastName());
- Assert.assertEquals(newProfileInfo.getTown(), createdProfileInfo.getTown());
- }
+ // @Test(dependsOnMethods = {"testEditDrive"})
+ // public void testCreateTag() throws Exception {
+ // Map<String, String> meta = new HashMap<String, String>();
+ // meta.put("description", "Test tag");
+
+ // Tag newTag = new Tag.Builder()
+ // .meta(meta)
+ // .name("Cloudsigma2 Test tag")
+ // .meta(new HashMap<String, String>())
+ // .resources(ImmutableList.of(
+ // new TagResource.Builder()
+ // .uuid(createdDrive.getUuid())
+ // .build()
+ // ))
+ // .build();
+ // createdTag = api.createTag(newTag);
+ // checkTag(newTag, createdTag);
+ // }
+
+ // @Test(dependsOnMethods = {"testEditDrive"})
+ // public void testCreateTags() throws Exception {
+ // List<Tag> newTagsList = ImmutableList.of(
+ // new Tag.Builder()
+ // .name("Cloudsigma2 New tag")
+ // .meta(new HashMap<String, String>())
+ // .build()
+ // , new Tag.Builder()
+ // .name("Cloudsigma2 tag with resource")
+ // .meta(new HashMap<String, String>())
+ // .resources(ImmutableList.of(
+ // new TagResource.Builder()
+ // .uuid(createdDrive.getUuid())
+ // .build()
+ // ))
+ // .build());
+
+ // createdTags = api.createTags(newTagsList);
+ // Assert.assertEquals(newTagsList.size(), createdTags.size());
+
+ // for(int i = 0; i < newTagsList.size(); i++){
+ // checkTag(newTagsList.get(i), createdTags.get(i));
+ // }
+ // }
+
+ // @Test(dependsOnMethods = {"testCreateTag"})
+ // public void testEditTag() throws Exception {
+ // Map<String, String> meta = new HashMap<String, String>();
+ // meta.put("description", "test tag");
+
+ // Tag editedTag = new Tag.Builder()
+ // .meta(meta)
+ // .name("Edited Tag")
+ // .resources(ImmutableList.of(
+ // new TagResource.Builder()
+ // .uuid(createdDrive.getUuid())
+ // .build()
+ // ))
+ // .build();
+
+ // checkTag(editedTag, api.editTag(createdTag.getUuid(), editedTag));
+ // }
+
+ // @Test(dependsOnMethods = {"testEditTag"})
+ // public void testDeleteTag() throws Exception{
+ // api.deleteTag(createdTag.getUuid());
+ // }
+
+ // @Test(dependsOnMethods = {"testCreateTags"})
+ // public void testDeleteTags() throws Exception{
+ // for(Tag tag : createdTags){
+ // api.deleteTag(tag.getUuid());
+ // }
+ // }
+
+ @Test
+ public void testGetProfileInfo() throws Exception {
+ Assert.assertNotNull(api.getProfileInfo());
+ }
+
+ @Test
+ public void testEditProfileInfo() throws Exception {
+ ProfileInfo profileInfo = new ProfileInfo.Builder()
+ .address("edited address")
+ .bankReference("sigma111")
+ .company("Awesome company")
+ .country("USA")
+ .email("user@example.com")
+ .firstName("Tim")
+ .lastName("Testersson")
+ .town("New York")
+ .build();
+
+ checkProfileInfo(profileInfo, api.editProfileInfo(profileInfo));
+ }
+
+ @Test
+ public void testGetAccountBalance() throws Exception {
+ Assert.assertNotNull(api.getAccountBalance());
+ }
+
+ @Test
+ public void testGetCurrentUsage() throws Exception {
+ Assert.assertNotNull(api.getCurrentUsage());
+ }
+
+ @Test
+ public void testListSubscriptions() throws Exception {
+ for (Subscription subscription : api.listSubscriptions().concat()) {
+ Assert.assertNotNull(subscription);
+ }
+ }
+
+ @Test
+ public void testGetSubscription() throws Exception {
+ for (Subscription subscription : api.listSubscriptions().concat()) {
+ Assert.assertNotNull(api.getSubscription(subscription.getId()));
+ }
+ }
+
+ @Test
+ public void testListSubscriptionsCalculator() throws Exception {
+ for (Subscription subscription : api.listSubscriptionsCalculator().concat()) {
+ Assert.assertNotNull(subscription);
+ }
+ }
+
+ @Test
+ public void testGetPricing() throws Exception {
+ Assert.assertNotNull(api.getPricing());
+ }
+
+ @Test
+ public void testListDiscounts() throws Exception {
+ for (Discount discount : api.listDiscounts().concat()) {
+ Assert.assertNotNull(discount);
+ }
+ }
+
+ @Test
+ public void testListTransactions() throws Exception {
+ for (Transaction transaction : api.listTransactions().concat()) {
+ Assert.assertNotNull(transaction);
+ }
+ }
+
+ @Test
+ public void testListLicenses() throws Exception {
+ for (License license : api.listLicenses().concat()) {
+ Assert.assertNotNull(license);
+ }
+ }
+
+ private void checkDrive(DriveInfo newDrive, DriveInfo createdDrive) {
+ Assert.assertEquals(newDrive.getName(), createdDrive.getName());
+ Assert.assertEquals(newDrive.getMedia(), createdDrive.getMedia());
+ }
+
+ private void checkServer(ServerInfo newServer, ServerInfo createdServer) {
+ Assert.assertEquals(newServer.getName(), createdServer.getName());
+ Assert.assertEquals(newServer.getMemory(), createdServer.getMemory());
+ Assert.assertEquals(newServer.getVncPassword(), createdServer.getVncPassword());
+ Assert.assertEquals(newServer.getCpu(), createdServer.getCpu());
+
+ Assert.assertEquals(newServer.getDrives().size(), createdServer.getDrives().size());
+
+ for (int i = 0; i < newServer.getDrives().size(); i++) {
+ checkServerDrive(newServer.getDrives().get(i), createdServer.getDrives().get(i));
+ }
+ }
+
+ private void checkServerDrive(ServerDrive newServerDrive, ServerDrive createdServerDrive) {
+ Assert.assertEquals(newServerDrive.getBootOrder(), createdServerDrive.getBootOrder());
+ Assert.assertEquals(newServerDrive.getDeviceChannel(), createdServerDrive.getDeviceChannel());
+ Assert.assertEquals(newServerDrive.getDeviceEmulationType(), createdServerDrive.getDeviceEmulationType());
+ }
+
+ private void checkFirewallPolicy(FirewallPolicy newFirewallPolicy, FirewallPolicy createdFirewallPolicy) {
+ Assert.assertEquals(newFirewallPolicy.getName(), createdFirewallPolicy.getName());
+ Assert.assertEquals(newFirewallPolicy.getRules(), createdFirewallPolicy.getRules());
+ }
+
+ private void checkVlAN(VLANInfo newVLAN, VLANInfo createdVLAN) {
+ Assert.assertEquals(newVLAN.getMeta(), createdVLAN.getMeta());
+ }
+
+ private void checkIP(IPInfo newIP, IPInfo createdIP) {
+ Assert.assertEquals(newIP.getMeta(), createdIP.getMeta());
+ }
+
+ private void checkTag(Tag newTag, Tag createdTag) {
+ Assert.assertEquals(newTag.getName(), createdTag.getName());
+ Assert.assertEquals(newTag.getMeta(), createdTag.getMeta());
+
+ Assert.assertEquals(newTag.getResources().size(), createdTag.getResources().size());
+
+ for (int i = 0; i < newTag.getResources().size(); i++) {
+ checkTagRes(newTag.getResources().get(i), createdTag.getResources().get(i));
+ }
+ }
+
+ private void checkTagRes(TagResource newTagResource, TagResource createdTagResource) {
+ Assert.assertEquals(newTagResource.getUuid(), createdTagResource.getUuid());
+ }
+
+ private void checkProfileInfo(ProfileInfo newProfileInfo, ProfileInfo createdProfileInfo) {
+ Assert.assertEquals(newProfileInfo.getAddress(), createdProfileInfo.getAddress());
+ Assert.assertEquals(newProfileInfo.getCompany(), createdProfileInfo.getCompany());
+ Assert.assertEquals(newProfileInfo.getCountry(), createdProfileInfo.getCountry());
+ Assert.assertEquals(newProfileInfo.getFirstName(), createdProfileInfo.getFirstName());
+ Assert.assertEquals(newProfileInfo.getLastName(), createdProfileInfo.getLastName());
+ Assert.assertEquals(newProfileInfo.getTown(), createdProfileInfo.getTown());
+ }
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0d70c84a/cloudsigma2/src/test/java/org/jclouds/cloudsigma2/functions/CloudSigma2ParserTest.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/test/java/org/jclouds/cloudsigma2/functions/CloudSigma2ParserTest.java b/cloudsigma2/src/test/java/org/jclouds/cloudsigma2/functions/CloudSigma2ParserTest.java
index fe57c3a..f97b321 100644
--- a/cloudsigma2/src/test/java/org/jclouds/cloudsigma2/functions/CloudSigma2ParserTest.java
+++ b/cloudsigma2/src/test/java/org/jclouds/cloudsigma2/functions/CloudSigma2ParserTest.java
@@ -27,16 +27,16 @@ import java.io.InputStreamReader;
*/
public class CloudSigma2ParserTest {
- public String EMPTY_OBJECTS_ARRAY = "{\"objects\" : []}";
+ public String EMPTY_OBJECTS_ARRAY = "{\"objects\" : []}";
- public String getJsonResource(String path){
- InputStream inputStream = this.getClass().getResourceAsStream(path);
+ public String getJsonResource(String path) {
+ InputStream inputStream = this.getClass().getResourceAsStream(path);
- try {
- return CharStreams.toString(new InputStreamReader(inputStream));
- } catch (IOException e) {
- e.printStackTrace();
- return null;
- }
- }
+ try {
+ return CharStreams.toString(new InputStreamReader(inputStream));
+ } catch (IOException e) {
+ e.printStackTrace();
+ return null;
+ }
+ }
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0d70c84a/cloudsigma2/src/test/java/org/jclouds/cloudsigma2/functions/CreateSubscriptionRequestToJsonTest.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/test/java/org/jclouds/cloudsigma2/functions/CreateSubscriptionRequestToJsonTest.java b/cloudsigma2/src/test/java/org/jclouds/cloudsigma2/functions/CreateSubscriptionRequestToJsonTest.java
index 28b3992..d86f24c 100644
--- a/cloudsigma2/src/test/java/org/jclouds/cloudsigma2/functions/CreateSubscriptionRequestToJsonTest.java
+++ b/cloudsigma2/src/test/java/org/jclouds/cloudsigma2/functions/CreateSubscriptionRequestToJsonTest.java
@@ -30,28 +30,28 @@ import org.testng.annotations.Test;
@Test(groups = "unit")
public class CreateSubscriptionRequestToJsonTest {
- private static final CreateSubscriptionRequestToJson CREATE_SUBSCRIPTION_REQUEST_TO_JSON = Guice
- .createInjector()
- .getInstance(CreateSubscriptionRequestToJson.class);
+ private static final CreateSubscriptionRequestToJson CREATE_SUBSCRIPTION_REQUEST_TO_JSON = Guice
+ .createInjector()
+ .getInstance(CreateSubscriptionRequestToJson.class);
- private CreateSubscriptionRequest input;
- private JsonObject expected;
+ private CreateSubscriptionRequest input;
+ private JsonObject expected;
- @BeforeMethod
- public void setUp() throws Exception {
- input = new CreateSubscriptionRequest.Builder()
- .amount("30000")
- .period("1 month")
- .resource(SubscriptionResource.DSSD)
- .build();
+ @BeforeMethod
+ public void setUp() throws Exception {
+ input = new CreateSubscriptionRequest.Builder()
+ .amount("30000")
+ .period("1 month")
+ .resource(SubscriptionResource.DSSD)
+ .build();
- expected = new JsonObject();
- expected.addProperty("amount", "30000");
- expected.addProperty("period", "1 month");
- expected.addProperty("resource", "dssd");
- }
+ expected = new JsonObject();
+ expected.addProperty("amount", "30000");
+ expected.addProperty("period", "1 month");
+ expected.addProperty("resource", "dssd");
+ }
- public void test(){
- Assert.assertEquals(CREATE_SUBSCRIPTION_REQUEST_TO_JSON.apply(input), expected);
- }
+ public void test() {
+ Assert.assertEquals(CREATE_SUBSCRIPTION_REQUEST_TO_JSON.apply(input), expected);
+ }
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0d70c84a/cloudsigma2/src/test/java/org/jclouds/cloudsigma2/functions/DriveToJsonTest.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/test/java/org/jclouds/cloudsigma2/functions/DriveToJsonTest.java b/cloudsigma2/src/test/java/org/jclouds/cloudsigma2/functions/DriveToJsonTest.java
index 39f4df1..03d5e6b 100644
--- a/cloudsigma2/src/test/java/org/jclouds/cloudsigma2/functions/DriveToJsonTest.java
+++ b/cloudsigma2/src/test/java/org/jclouds/cloudsigma2/functions/DriveToJsonTest.java
@@ -39,61 +39,61 @@ import java.util.Map;
@Test(groups = "unit")
public class DriveToJsonTest {
- private final static DriveToJson DRIVE_TO_JSON = Guice.createInjector().getInstance(DriveToJson.class);
+ private final static DriveToJson DRIVE_TO_JSON = Guice.createInjector().getInstance(DriveToJson.class);
- private final static JsonObject result = new JsonObject();
- private DriveInfo input;
+ private final static JsonObject result = new JsonObject();
+ private DriveInfo input;
- @BeforeMethod
- public void setUp() throws Exception {
- List<String> affinities = ImmutableList.of("ssd", "sample");
- List<String> tags =ImmutableList.of("tag_uuid_1", "tag_uuid_2");
+ @BeforeMethod
+ public void setUp() throws Exception {
+ List<String> affinities = ImmutableList.of("ssd", "sample");
+ List<String> tags = ImmutableList.of("tag_uuid_1", "tag_uuid_2");
- Map<String, String> metaMap = new HashMap<String, String>();
- metaMap.put("description", "test_description");
- metaMap.put("install_notes", "test_install_notes");
+ Map<String, String> metaMap = new HashMap<String, String>();
+ metaMap.put("description", "test_description");
+ metaMap.put("install_notes", "test_install_notes");
- result.addProperty("name", "test");
- result.addProperty("size", "1024000000");
- result.addProperty("media", "disk");
- result.add("affinities", new JsonParser().parse(new Gson().toJson(affinities)));
- result.add("meta", new JsonParser().parse(new Gson().toJson(metaMap)));
- result.add("tags", new JsonParser().parse(new Gson().toJson(tags)));
- result.addProperty("allow_multimount", false);
+ result.addProperty("name", "test");
+ result.addProperty("size", "1024000000");
+ result.addProperty("media", "disk");
+ result.add("affinities", new JsonParser().parse(new Gson().toJson(affinities)));
+ result.add("meta", new JsonParser().parse(new Gson().toJson(metaMap)));
+ result.add("tags", new JsonParser().parse(new Gson().toJson(tags)));
+ result.addProperty("allow_multimount", false);
- input = new DriveInfo.Builder()
- .affinities(ImmutableList.of("ssd", "sample"))
- .allowMultimount(false)
- .jobs(new ArrayList<String>())
- .licenses(ImmutableList.of(new DriveLicense.Builder()
- .amount(1)
- .license(new License.Builder()
- .isBurstable(true)
- .longName("sample_longname")
- .name("sample_name")
- .resourceUri(new URI("/api/2.0/samples/"))
- .type("sample_type")
- .userMetric("sample")
- .build())
+ input = new DriveInfo.Builder()
+ .affinities(ImmutableList.of("ssd", "sample"))
+ .allowMultimount(false)
+ .jobs(new ArrayList<String>())
+ .licenses(ImmutableList.of(new DriveLicense.Builder()
+ .amount(1)
+ .license(new License.Builder()
+ .isBurstable(true)
+ .longName("sample_longname")
+ .name("sample_name")
+ .resourceUri(new URI("/api/2.0/samples/"))
+ .type("sample_type")
+ .userMetric("sample")
+ .build())
+ .build()))
+ .media(MediaType.DISK)
+ .meta(metaMap)
+ .mountedOn(ImmutableList.of(new Server.Builder()
+ .uuid("81f911f9-5152-4328-8671-02543bafbd0e")
+ .build(),
+ new Server.Builder()
+ .uuid("19163e1a-a6d6-4e73-8087-157dd302c373")
.build()))
- .media(MediaType.DISK)
- .meta(metaMap)
- .mountedOn(ImmutableList.of(new Server.Builder()
- .uuid("81f911f9-5152-4328-8671-02543bafbd0e")
- .build(),
- new Server.Builder()
- .uuid("19163e1a-a6d6-4e73-8087-157dd302c373")
- .build()))
- .name("test")
- .size(new BigInteger("1024000000"))
- .status(DriveStatus.UNMOUNTED)
- .tags(ImmutableList.of("tag_uuid_1", "tag_uuid_2"))
- .uuid("e96f3c63-6f50-47eb-9401-a56c5ccf6b32")
- .build();
- }
+ .name("test")
+ .size(new BigInteger("1024000000"))
+ .status(DriveStatus.UNMOUNTED)
+ .tags(ImmutableList.of("tag_uuid_1", "tag_uuid_2"))
+ .uuid("e96f3c63-6f50-47eb-9401-a56c5ccf6b32")
+ .build();
+ }
- public void test(){
- Assert.assertEquals(DRIVE_TO_JSON.apply(input), result);
- }
+ public void test() {
+ Assert.assertEquals(DRIVE_TO_JSON.apply(input), result);
+ }
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0d70c84a/cloudsigma2/src/test/java/org/jclouds/cloudsigma2/functions/FirewallPolicyToJsonTest.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/test/java/org/jclouds/cloudsigma2/functions/FirewallPolicyToJsonTest.java b/cloudsigma2/src/test/java/org/jclouds/cloudsigma2/functions/FirewallPolicyToJsonTest.java
index a30a763..f3a1074 100644
--- a/cloudsigma2/src/test/java/org/jclouds/cloudsigma2/functions/FirewallPolicyToJsonTest.java
+++ b/cloudsigma2/src/test/java/org/jclouds/cloudsigma2/functions/FirewallPolicyToJsonTest.java
@@ -35,116 +35,116 @@ import java.util.Map;
@Test(groups = "unit")
public class FirewallPolicyToJsonTest {
- private final static FirewallPolicyToJson FIREWALL_POLICY_TO_JSON = Guice
- .createInjector()
- .getInstance(FirewallPolicyToJson.class);
+ private final static FirewallPolicyToJson FIREWALL_POLICY_TO_JSON = Guice
+ .createInjector()
+ .getInstance(FirewallPolicyToJson.class);
- private FirewallPolicy input;
- private JsonObject expected;
+ private FirewallPolicy input;
+ private JsonObject expected;
- @BeforeMethod
- public void setUp() throws Exception {
- Map <String, String> meta = new HashMap<String, String>();
- meta.put("description", "test firewall policy");
- meta.put("test_key_1", "test_value_1");
- meta.put("test_key_2", "test_value_2");
+ @BeforeMethod
+ public void setUp() throws Exception {
+ Map<String, String> meta = new HashMap<String, String>();
+ meta.put("description", "test firewall policy");
+ meta.put("test_key_1", "test_value_1");
+ meta.put("test_key_2", "test_value_2");
- input = new FirewallPolicy.Builder()
- .meta(meta)
- .name("My awesome policy")
- .resourceUri(new URI("/api/2.0/fwpolicies/cf8479b4-c98b-46c8-ab9c-108bb00c8218/"))
- .rules(ImmutableList.of(
- new FirewallRule.Builder()
- .action(FirewallAction.DROP)
- .comment("Drop traffic from the VM to IP address 23.0.0.0/32")
- .direction(FirewallDirection.OUT)
- .destinationIp("23.0.0.0/32")
- .build()
- , new FirewallRule.Builder()
- .action(FirewallAction.ACCEPT)
- .comment("Allow SSH traffic to the VM from our office in Dubai")
- .direction(FirewallDirection.IN)
- .destinationPort("22")
- .ipProtocol(FirewallIpProtocol.TCP)
- .sourceIp("172.66.32.0/24")
- .build()
- , new FirewallRule.Builder()
- .action(FirewallAction.DROP)
- .comment("Drop all other SSH traffic to the VM")
- .direction(FirewallDirection.IN)
- .destinationPort("22")
- .ipProtocol(FirewallIpProtocol.TCP)
- .build()
- , new FirewallRule.Builder()
- .action(FirewallAction.DROP)
- .comment("Drop all UDP traffic to the VM, not originating from 172.66.32.55")
- .direction(FirewallDirection.IN)
- .ipProtocol(FirewallIpProtocol.UDP)
- .sourceIp("!172.66.32.55/32")
- .build()
- , new FirewallRule.Builder()
- .action(FirewallAction.DROP)
- .comment("Drop any traffic, to the VM with destination port not between 1-1024")
- .direction(FirewallDirection.IN)
- .destinationPort("!1:1024")
- .ipProtocol(FirewallIpProtocol.TCP)
- .build()
- ))
- .build();
+ input = new FirewallPolicy.Builder()
+ .meta(meta)
+ .name("My awesome policy")
+ .resourceUri(new URI("/api/2.0/fwpolicies/cf8479b4-c98b-46c8-ab9c-108bb00c8218/"))
+ .rules(ImmutableList.of(
+ new FirewallRule.Builder()
+ .action(FirewallAction.DROP)
+ .comment("Drop traffic from the VM to IP address 23.0.0.0/32")
+ .direction(FirewallDirection.OUT)
+ .destinationIp("23.0.0.0/32")
+ .build()
+ , new FirewallRule.Builder()
+ .action(FirewallAction.ACCEPT)
+ .comment("Allow SSH traffic to the VM from our office in Dubai")
+ .direction(FirewallDirection.IN)
+ .destinationPort("22")
+ .ipProtocol(FirewallIpProtocol.TCP)
+ .sourceIp("172.66.32.0/24")
+ .build()
+ , new FirewallRule.Builder()
+ .action(FirewallAction.DROP)
+ .comment("Drop all other SSH traffic to the VM")
+ .direction(FirewallDirection.IN)
+ .destinationPort("22")
+ .ipProtocol(FirewallIpProtocol.TCP)
+ .build()
+ , new FirewallRule.Builder()
+ .action(FirewallAction.DROP)
+ .comment("Drop all UDP traffic to the VM, not originating from 172.66.32.55")
+ .direction(FirewallDirection.IN)
+ .ipProtocol(FirewallIpProtocol.UDP)
+ .sourceIp("!172.66.32.55/32")
+ .build()
+ , new FirewallRule.Builder()
+ .action(FirewallAction.DROP)
+ .comment("Drop any traffic, to the VM with destination port not between 1-1024")
+ .direction(FirewallDirection.IN)
+ .destinationPort("!1:1024")
+ .ipProtocol(FirewallIpProtocol.TCP)
+ .build()
+ ))
+ .build();
- expected = new JsonObject();
+ expected = new JsonObject();
- expected.addProperty("name", "My awesome policy");
+ expected.addProperty("name", "My awesome policy");
- JsonObject metaObject = new JsonObject();
- metaObject.addProperty("description", "test firewall policy");
- metaObject.addProperty("test_key_1", "test_value_1");
- metaObject.addProperty("test_key_2", "test_value_2");
+ JsonObject metaObject = new JsonObject();
+ metaObject.addProperty("description", "test firewall policy");
+ metaObject.addProperty("test_key_1", "test_value_1");
+ metaObject.addProperty("test_key_2", "test_value_2");
- expected.add("meta", metaObject);
+ expected.add("meta", metaObject);
- JsonObject rule1Object = new JsonObject();
- rule1Object.addProperty("action", "drop");
- rule1Object.addProperty("comment", "Drop traffic from the VM to IP address 23.0.0.0/32");
- rule1Object.addProperty("direction", "out");
- rule1Object.addProperty("dst_ip", "23.0.0.0/32");
- JsonObject rule2Object = new JsonObject();
- rule2Object.addProperty("action", "accept");
- rule2Object.addProperty("comment", "Allow SSH traffic to the VM from our office in Dubai");
- rule2Object.addProperty("direction", "in");
- rule2Object.addProperty("dst_port", "22");
- rule2Object.addProperty("ip_proto", "tcp");
- rule2Object.addProperty("src_ip", "172.66.32.0/24");
- JsonObject rule3Object = new JsonObject();
- rule3Object.addProperty("action", "drop");
- rule3Object.addProperty("comment", "Drop all other SSH traffic to the VM");
- rule3Object.addProperty("direction", "in");
- rule3Object.addProperty("dst_port", "22");
- rule3Object.addProperty("ip_proto", "tcp");
- JsonObject rule4Object = new JsonObject();
- rule4Object.addProperty("action", "drop");
- rule4Object.addProperty("comment", "Drop all UDP traffic to the VM, not originating from 172.66.32.55");
- rule4Object.addProperty("direction", "in");
- rule4Object.addProperty("ip_proto", "udp");
- rule4Object.addProperty("src_ip", "!172.66.32.55/32");
- JsonObject rule5Object = new JsonObject();
- rule5Object.addProperty("action", "drop");
- rule5Object.addProperty("comment", "Drop any traffic, to the VM with destination port not between 1-1024");
- rule5Object.addProperty("direction", "in");
- rule5Object.addProperty("dst_port", "!1:1024");
- rule5Object.addProperty("ip_proto", "tcp");
+ JsonObject rule1Object = new JsonObject();
+ rule1Object.addProperty("action", "drop");
+ rule1Object.addProperty("comment", "Drop traffic from the VM to IP address 23.0.0.0/32");
+ rule1Object.addProperty("direction", "out");
+ rule1Object.addProperty("dst_ip", "23.0.0.0/32");
+ JsonObject rule2Object = new JsonObject();
+ rule2Object.addProperty("action", "accept");
+ rule2Object.addProperty("comment", "Allow SSH traffic to the VM from our office in Dubai");
+ rule2Object.addProperty("direction", "in");
+ rule2Object.addProperty("dst_port", "22");
+ rule2Object.addProperty("ip_proto", "tcp");
+ rule2Object.addProperty("src_ip", "172.66.32.0/24");
+ JsonObject rule3Object = new JsonObject();
+ rule3Object.addProperty("action", "drop");
+ rule3Object.addProperty("comment", "Drop all other SSH traffic to the VM");
+ rule3Object.addProperty("direction", "in");
+ rule3Object.addProperty("dst_port", "22");
+ rule3Object.addProperty("ip_proto", "tcp");
+ JsonObject rule4Object = new JsonObject();
+ rule4Object.addProperty("action", "drop");
+ rule4Object.addProperty("comment", "Drop all UDP traffic to the VM, not originating from 172.66.32.55");
+ rule4Object.addProperty("direction", "in");
+ rule4Object.addProperty("ip_proto", "udp");
+ rule4Object.addProperty("src_ip", "!172.66.32.55/32");
+ JsonObject rule5Object = new JsonObject();
+ rule5Object.addProperty("action", "drop");
+ rule5Object.addProperty("comment", "Drop any traffic, to the VM with destination port not between 1-1024");
+ rule5Object.addProperty("direction", "in");
+ rule5Object.addProperty("dst_port", "!1:1024");
+ rule5Object.addProperty("ip_proto", "tcp");
- JsonArray rulesArray = new JsonArray();
- rulesArray.add(rule1Object);
- rulesArray.add(rule2Object);
- rulesArray.add(rule3Object);
- rulesArray.add(rule4Object);
- rulesArray.add(rule5Object);
+ JsonArray rulesArray = new JsonArray();
+ rulesArray.add(rule1Object);
+ rulesArray.add(rule2Object);
+ rulesArray.add(rule3Object);
+ rulesArray.add(rule4Object);
+ rulesArray.add(rule5Object);
- expected.add("rules", rulesArray);
- }
+ expected.add("rules", rulesArray);
+ }
- public void test(){
- Assert.assertEquals(FIREWALL_POLICY_TO_JSON.apply(input), expected);
- }
+ public void test() {
+ Assert.assertEquals(FIREWALL_POLICY_TO_JSON.apply(input), expected);
+ }
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0d70c84a/cloudsigma2/src/test/java/org/jclouds/cloudsigma2/functions/IPInfoToJsonTest.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/test/java/org/jclouds/cloudsigma2/functions/IPInfoToJsonTest.java b/cloudsigma2/src/test/java/org/jclouds/cloudsigma2/functions/IPInfoToJsonTest.java
index f74f113..8b78c5e 100644
--- a/cloudsigma2/src/test/java/org/jclouds/cloudsigma2/functions/IPInfoToJsonTest.java
+++ b/cloudsigma2/src/test/java/org/jclouds/cloudsigma2/functions/IPInfoToJsonTest.java
@@ -38,53 +38,53 @@ import java.util.Map;
@Test(groups = "unit")
public class IPInfoToJsonTest {
- private final static IPInfoToJson IP_INFO_TO_JSON = Guice.createInjector().getInstance(IPInfoToJson.class);
+ private final static IPInfoToJson IP_INFO_TO_JSON = Guice.createInjector().getInstance(IPInfoToJson.class);
- private IPInfo input;
- private JsonObject expected;
+ private IPInfo input;
+ private JsonObject expected;
- @BeforeMethod
- public void setUp() throws Exception {
- Owner owner = new Owner.Builder()
- .resourceUri(new URI("/api/2.0/user/5b4a69a3-8e78-4c45-a8ba-8b13f0895e23/"))
- .uuid("5b4a69a3-8e78-4c45-a8ba-8b13f0895e23")
- .build();
+ @BeforeMethod
+ public void setUp() throws Exception {
+ Owner owner = new Owner.Builder()
+ .resourceUri(new URI("/api/2.0/user/5b4a69a3-8e78-4c45-a8ba-8b13f0895e23/"))
+ .uuid("5b4a69a3-8e78-4c45-a8ba-8b13f0895e23")
+ .build();
- Map<String, String> meta = new HashMap<String, String>();
- meta.put("description", "test ip");
- meta.put("test_key_1", "test_value_1");
- meta.put("test_key_2", "test_value_2");
+ Map<String, String> meta = new HashMap<String, String>();
+ meta.put("description", "test ip");
+ meta.put("test_key_1", "test_value_1");
+ meta.put("test_key_2", "test_value_2");
- input = new IPInfo.Builder()
- .gateway("185.12.6.1")
- .meta(meta)
- .nameservers(ImmutableList.of(
- "69.194.139.62",
- "178.22.66.167",
- "178.22.71.56"))
- .netmask(24)
- .owner(owner)
- .resourceUri(new URI("/api/2.0/ips/185.12.6.183/"))
- .server(null)
- .subscription(new Subscription.Builder()
- .id("7273")
- .resourceUri(new URI("/api/2.0/subscriptions/7273/"))
- .build())
- .tags(new ArrayList<Tag>())
- .uuid("185.12.6.183")
- .build();
+ input = new IPInfo.Builder()
+ .gateway("185.12.6.1")
+ .meta(meta)
+ .nameservers(ImmutableList.of(
+ "69.194.139.62",
+ "178.22.66.167",
+ "178.22.71.56"))
+ .netmask(24)
+ .owner(owner)
+ .resourceUri(new URI("/api/2.0/ips/185.12.6.183/"))
+ .server(null)
+ .subscription(new Subscription.Builder()
+ .id("7273")
+ .resourceUri(new URI("/api/2.0/subscriptions/7273/"))
+ .build())
+ .tags(new ArrayList<Tag>())
+ .uuid("185.12.6.183")
+ .build();
- expected = new JsonObject();
+ expected = new JsonObject();
- JsonObject metaObject = new JsonObject();
- metaObject.addProperty("description", "test ip");
- metaObject.addProperty("test_key_1", "test_value_1");
- metaObject.addProperty("test_key_2", "test_value_2");
+ JsonObject metaObject = new JsonObject();
+ metaObject.addProperty("description", "test ip");
+ metaObject.addProperty("test_key_1", "test_value_1");
+ metaObject.addProperty("test_key_2", "test_value_2");
- expected.add("meta", metaObject);
- }
+ expected.add("meta", metaObject);
+ }
- public void test(){
- Assert.assertEquals(IP_INFO_TO_JSON.apply(input), expected);
- }
+ public void test() {
+ Assert.assertEquals(IP_INFO_TO_JSON.apply(input), expected);
+ }
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0d70c84a/cloudsigma2/src/test/java/org/jclouds/cloudsigma2/functions/LibraryDriveToJsonTest.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/test/java/org/jclouds/cloudsigma2/functions/LibraryDriveToJsonTest.java b/cloudsigma2/src/test/java/org/jclouds/cloudsigma2/functions/LibraryDriveToJsonTest.java
index dc6c264..c25311d 100644
--- a/cloudsigma2/src/test/java/org/jclouds/cloudsigma2/functions/LibraryDriveToJsonTest.java
+++ b/cloudsigma2/src/test/java/org/jclouds/cloudsigma2/functions/LibraryDriveToJsonTest.java
@@ -36,52 +36,53 @@ import java.util.HashMap;
@Test(groups = "unit")
public class LibraryDriveToJsonTest {
- private static final DriveToJson DRIVE_TO_JSON = Guice.createInjector().getInstance(DriveToJson.class);
- private static final LibraryDriveToJson LIBRARY_DRIVE_TO_JSON = new LibraryDriveToJson(DRIVE_TO_JSON);
+ private static final DriveToJson DRIVE_TO_JSON = Guice.createInjector().getInstance(DriveToJson.class);
+ private static final LibraryDriveToJson LIBRARY_DRIVE_TO_JSON = new LibraryDriveToJson(DRIVE_TO_JSON);
- private JsonObject expected = new JsonObject();
- private LibraryDrive input;
- {
- expected.addProperty("name", "Vyatta-6.5-32bit-Virtualization-ISO");
- expected.addProperty("size", "1000000000");
- expected.addProperty("media", "cdrom");
- expected.add("meta", new JsonObject());
- expected.add("tags", new JsonArray());
- expected.addProperty("allow_multimount", false);
- expected.addProperty("favourite", true);
- expected.addProperty("description", "test_description");
+ private JsonObject expected = new JsonObject();
+ private LibraryDrive input;
- try {
- input = new LibraryDrive.Builder()
- .allowMultimount(false)
- .arch("32")
- .category(ImmutableList.of("general"))
- .description("test_description")
- .isFavorite(true)
- .imageType("install")
- .installNotes("test_install_notes")
- .jobs(new ArrayList<String>())
- .licenses(new ArrayList<DriveLicense>())
- .media(MediaType.CDROM)
- .meta(new HashMap<String, String>())
- .mountedOn(new ArrayList<Server>())
- .name("Vyatta-6.5-32bit-Virtualization-ISO")
- .os("linux")
- .owner(null)
- .isPaid(false)
- .resourceUri(new URI("/api/2.0/libdrives/6d53b92c-42dc-472b-a7b6-7021f45f377a/"))
- .size(new BigInteger("1000000000"))
- .status(DriveStatus.MOUNTED)
- .tags(new ArrayList<String>())
- .url("http://www.vyatta.org/")
- .uuid("6d53b92c-42dc-472b-a7b6-7021f45f377a")
- .build();
- } catch (URISyntaxException e) {
- e.printStackTrace();
- }
- }
+ {
+ expected.addProperty("name", "Vyatta-6.5-32bit-Virtualization-ISO");
+ expected.addProperty("size", "1000000000");
+ expected.addProperty("media", "cdrom");
+ expected.add("meta", new JsonObject());
+ expected.add("tags", new JsonArray());
+ expected.addProperty("allow_multimount", false);
+ expected.addProperty("favourite", true);
+ expected.addProperty("description", "test_description");
- public void test(){
- Assert.assertEquals(LIBRARY_DRIVE_TO_JSON.apply(input), expected);
- }
+ try {
+ input = new LibraryDrive.Builder()
+ .allowMultimount(false)
+ .arch("32")
+ .category(ImmutableList.of("general"))
+ .description("test_description")
+ .isFavorite(true)
+ .imageType("install")
+ .installNotes("test_install_notes")
+ .jobs(new ArrayList<String>())
+ .licenses(new ArrayList<DriveLicense>())
+ .media(MediaType.CDROM)
+ .meta(new HashMap<String, String>())
+ .mountedOn(new ArrayList<Server>())
+ .name("Vyatta-6.5-32bit-Virtualization-ISO")
+ .os("linux")
+ .owner(null)
+ .isPaid(false)
+ .resourceUri(new URI("/api/2.0/libdrives/6d53b92c-42dc-472b-a7b6-7021f45f377a/"))
+ .size(new BigInteger("1000000000"))
+ .status(DriveStatus.MOUNTED)
+ .tags(new ArrayList<String>())
+ .url("http://www.vyatta.org/")
+ .uuid("6d53b92c-42dc-472b-a7b6-7021f45f377a")
+ .build();
+ } catch (URISyntaxException e) {
+ e.printStackTrace();
+ }
+ }
+
+ public void test() {
+ Assert.assertEquals(LIBRARY_DRIVE_TO_JSON.apply(input), expected);
+ }
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0d70c84a/cloudsigma2/src/test/java/org/jclouds/cloudsigma2/functions/ProfileInfoToJsonTest.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/test/java/org/jclouds/cloudsigma2/functions/ProfileInfoToJsonTest.java b/cloudsigma2/src/test/java/org/jclouds/cloudsigma2/functions/ProfileInfoToJsonTest.java
index 5b1c4c2..4e769f0 100644
--- a/cloudsigma2/src/test/java/org/jclouds/cloudsigma2/functions/ProfileInfoToJsonTest.java
+++ b/cloudsigma2/src/test/java/org/jclouds/cloudsigma2/functions/ProfileInfoToJsonTest.java
@@ -33,71 +33,71 @@ import java.util.Map;
@Test(groups = "unit")
public class ProfileInfoToJsonTest {
- private static final ProfileInfoToJson PROFILE_INFO_TO_JSON = Guice.createInjector().getInstance(ProfileInfoToJson.class);
+ private static final ProfileInfoToJson PROFILE_INFO_TO_JSON = Guice.createInjector().getInstance(ProfileInfoToJson.class);
- private ProfileInfo input;
- private JsonObject expected;
+ private ProfileInfo input;
+ private JsonObject expected;
- @BeforeMethod
- public void setUp() throws Exception {
- Map<String, String> meta = new HashMap<String, String>();
- meta.put("description", "profile info");
+ @BeforeMethod
+ public void setUp() throws Exception {
+ Map<String, String> meta = new HashMap<String, String>();
+ meta.put("description", "profile info");
- input = new ProfileInfo.Builder()
- .address("test_address")
- .isApiHttpsOnly(false)
- .autotopupAmount("0E-16")
- .autotopupThreshold("0E-16")
- .bankReference("jdoe123")
- .company("Newly Set Company Name")
- .country("GB")
- .currency("USD")
- .email("user@example.com")
- .firstName("John")
- .hasAutotopup(false)
- .invoicing(true)
- .isKeyAuth(false)
- .language("en-au")
- .lastName("Doe")
- .isMailingListEnabled(true)
- .meta(meta)
- .myNotes("test notes")
- .nickname("test nickname")
- .phone("123456789")
- .postcode("12345")
- .reseller("test reseller")
- .signupTime(new SimpleDateFormatDateService().iso8601SecondsDateParse("2013-05-28T11:57:01+00:00"))
- .state("REGULAR")
- .taxRate(3.14)
- .taxName("test tax_name")
- .title("test title")
- .town("test town")
- .uuid("6f670b3c-a2e6-433f-aeab-b976b1cdaf03")
- .vat("test vat")
- .build();
+ input = new ProfileInfo.Builder()
+ .address("test_address")
+ .isApiHttpsOnly(false)
+ .autotopupAmount("0E-16")
+ .autotopupThreshold("0E-16")
+ .bankReference("jdoe123")
+ .company("Newly Set Company Name")
+ .country("GB")
+ .currency("USD")
+ .email("user@example.com")
+ .firstName("John")
+ .hasAutotopup(false)
+ .invoicing(true)
+ .isKeyAuth(false)
+ .language("en-au")
+ .lastName("Doe")
+ .isMailingListEnabled(true)
+ .meta(meta)
+ .myNotes("test notes")
+ .nickname("test nickname")
+ .phone("123456789")
+ .postcode("12345")
+ .reseller("test reseller")
+ .signupTime(new SimpleDateFormatDateService().iso8601SecondsDateParse("2013-05-28T11:57:01+00:00"))
+ .state("REGULAR")
+ .taxRate(3.14)
+ .taxName("test tax_name")
+ .title("test title")
+ .town("test town")
+ .uuid("6f670b3c-a2e6-433f-aeab-b976b1cdaf03")
+ .vat("test vat")
+ .build();
- expected = new JsonObject();
- expected.addProperty("address", "test_address");
- expected.addProperty("bank_reference", "jdoe123");
- expected.addProperty("company", "Newly Set Company Name");
- expected.addProperty("country", "GB");
- expected.addProperty("email", "user@example.com");
- expected.addProperty("first_name", "John");
- expected.addProperty("last_name", "Doe");
+ expected = new JsonObject();
+ expected.addProperty("address", "test_address");
+ expected.addProperty("bank_reference", "jdoe123");
+ expected.addProperty("company", "Newly Set Company Name");
+ expected.addProperty("country", "GB");
+ expected.addProperty("email", "user@example.com");
+ expected.addProperty("first_name", "John");
+ expected.addProperty("last_name", "Doe");
- JsonObject metaObject = new JsonObject();
- metaObject.addProperty("description", "profile info");
+ JsonObject metaObject = new JsonObject();
+ metaObject.addProperty("description", "profile info");
- expected.add("meta", metaObject);
- expected.addProperty("my_notes", "test notes");
- expected.addProperty("nickname", "test nickname");
- expected.addProperty("phone", "123456789");
- expected.addProperty("postcode", "12345");
- expected.addProperty("title", "test title");
- expected.addProperty("town", "test town");
- }
+ expected.add("meta", metaObject);
+ expected.addProperty("my_notes", "test notes");
+ expected.addProperty("nickname", "test nickname");
+ expected.addProperty("phone", "123456789");
+ expected.addProperty("postcode", "12345");
+ expected.addProperty("title", "test title");
+ expected.addProperty("town", "test town");
+ }
- public void test(){
- Assert.assertEquals(PROFILE_INFO_TO_JSON.apply(input), expected);
- }
+ public void test() {
+ Assert.assertEquals(PROFILE_INFO_TO_JSON.apply(input), expected);
+ }
}
[05/13] Fix code style of the cloudsigma2 provider.
Posted by na...@apache.org.
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0d70c84a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/Transaction.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/Transaction.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/Transaction.java
index 756646c..70f186d 100644
--- a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/Transaction.java
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/Transaction.java
@@ -25,169 +25,172 @@ import java.util.Date;
*/
public class Transaction {
- public static class Builder{
- private double amount;
- private long billingCycle;
- private double end;
- private String id;
- private double initial;
- private String reason;
- private Date time;
-
- public Builder amount(double amount){
- this.amount = amount;
- return this;
- }
-
- public Builder billingCycle(long billingCycle){
- this.billingCycle = billingCycle;
- return this;
- }
-
- public Builder end(double end){
- this.end = end;
- return this;
- }
- public Builder id(String id){
- this.id = id;
- return this;
- }
- public Builder initial(double initial){
- this.initial = initial;
- return this;
- }
-
- public Builder reason(String reason){
- this.reason = reason;
- return this;
- }
-
- public Builder time(Date time){
- this.time = time;
- return this;
- }
-
- public Transaction build(){
- return new Transaction(amount, billingCycle, end, id, initial, reason, time);
- }
- }
-
- private final double amount;
- @Named("billing_cycle")
- private final long billingCycle;
- private final double end;
- private final String id;
- private final double initial;
- private final String reason;
- private final Date time;
-
- @ConstructorProperties({
- "amount", "billing_cycle", "end", "id", "initial", "reason", "time"
- })
- public Transaction(double amount, long billingCycle, double end, String id, double initial, String reason, Date time) {
- this.amount = amount;
- this.billingCycle = billingCycle;
- this.end = end;
- this.id = id;
- this.initial = initial;
- this.reason = reason;
- this.time = time;
- }
-
- /**
- * @return Amount of the operation, positive for debits, negative for credits
- */
- public double getAmount() {
- return amount;
- }
-
- /**
- * @return Billing cycle that generated this charge
- */
- public long getBillingCycle() {
- return billingCycle;
- }
-
- /**
- * @return Amount of money after the operation
- */
- public double getEnd() {
- return end;
- }
-
- /**
- * @return Unique id
- */
- public String getId() {
- return id;
- }
-
- /**
- * @return Amount of money before the operation
- */
- public double getInitial() {
- return initial;
- }
-
- /**
- * @return Description of the operation
- */
- public String getReason() {
- return reason;
- }
-
- /**
- * @return date & time
- */
- public Date getTime() {
- return time;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (!(o instanceof Transaction)) return false;
-
- Transaction that = (Transaction) o;
-
- if (Double.compare(that.amount, amount) != 0) return false;
- if (billingCycle != that.billingCycle) return false;
- if (Double.compare(that.end, end) != 0) return false;
- if (Double.compare(that.initial, initial) != 0) return false;
- if (id != null ? !id.equals(that.id) : that.id != null) return false;
- if (reason != null ? !reason.equals(that.reason) : that.reason != null) return false;
- if (time != null ? !time.equals(that.time) : that.time != null) return false;
-
- return true;
- }
-
- @Override
- public int hashCode() {
- int result;
- long temp;
- temp = Double.doubleToLongBits(amount);
- result = (int) (temp ^ (temp >>> 32));
- result = 31 * result + (int) (billingCycle ^ (billingCycle >>> 32));
- temp = Double.doubleToLongBits(end);
- result = 31 * result + (int) (temp ^ (temp >>> 32));
- result = 31 * result + (id != null ? id.hashCode() : 0);
- temp = Double.doubleToLongBits(initial);
- result = 31 * result + (int) (temp ^ (temp >>> 32));
- result = 31 * result + (reason != null ? reason.hashCode() : 0);
- result = 31 * result + (time != null ? time.hashCode() : 0);
- return result;
- }
-
- @Override
- public String toString() {
- return "[" +
- "amount=" + amount +
- ", billingCycle=" + billingCycle +
- ", end=" + end +
- ", id='" + id + '\'' +
- ", initial=" + initial +
- ", reason='" + reason + '\'' +
- ", time=" + time +
- "]";
- }
+ public static class Builder {
+ private double amount;
+ private long billingCycle;
+ private double end;
+ private String id;
+ private double initial;
+ private String reason;
+ private Date time;
+
+ public Builder amount(double amount) {
+ this.amount = amount;
+ return this;
+ }
+
+ public Builder billingCycle(long billingCycle) {
+ this.billingCycle = billingCycle;
+ return this;
+ }
+
+ public Builder end(double end) {
+ this.end = end;
+ return this;
+ }
+
+ public Builder id(String id) {
+ this.id = id;
+ return this;
+ }
+
+ public Builder initial(double initial) {
+ this.initial = initial;
+ return this;
+ }
+
+ public Builder reason(String reason) {
+ this.reason = reason;
+ return this;
+ }
+
+ public Builder time(Date time) {
+ this.time = time;
+ return this;
+ }
+
+ public Transaction build() {
+ return new Transaction(amount, billingCycle, end, id, initial, reason, time);
+ }
+ }
+
+ private final double amount;
+ @Named("billing_cycle")
+ private final long billingCycle;
+ private final double end;
+ private final String id;
+ private final double initial;
+ private final String reason;
+ private final Date time;
+
+ @ConstructorProperties({
+ "amount", "billing_cycle", "end", "id", "initial", "reason", "time"
+ })
+ public Transaction(double amount, long billingCycle, double end, String id, double initial, String reason
+ , Date time) {
+ this.amount = amount;
+ this.billingCycle = billingCycle;
+ this.end = end;
+ this.id = id;
+ this.initial = initial;
+ this.reason = reason;
+ this.time = time;
+ }
+
+ /**
+ * @return Amount of the operation, positive for debits, negative for credits
+ */
+ public double getAmount() {
+ return amount;
+ }
+
+ /**
+ * @return Billing cycle that generated this charge
+ */
+ public long getBillingCycle() {
+ return billingCycle;
+ }
+
+ /**
+ * @return Amount of money after the operation
+ */
+ public double getEnd() {
+ return end;
+ }
+
+ /**
+ * @return Unique id
+ */
+ public String getId() {
+ return id;
+ }
+
+ /**
+ * @return Amount of money before the operation
+ */
+ public double getInitial() {
+ return initial;
+ }
+
+ /**
+ * @return Description of the operation
+ */
+ public String getReason() {
+ return reason;
+ }
+
+ /**
+ * @return date & time
+ */
+ public Date getTime() {
+ return time;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (!(o instanceof Transaction)) return false;
+
+ Transaction that = (Transaction) o;
+
+ if (Double.compare(that.amount, amount) != 0) return false;
+ if (billingCycle != that.billingCycle) return false;
+ if (Double.compare(that.end, end) != 0) return false;
+ if (Double.compare(that.initial, initial) != 0) return false;
+ if (id != null ? !id.equals(that.id) : that.id != null) return false;
+ if (reason != null ? !reason.equals(that.reason) : that.reason != null) return false;
+ if (time != null ? !time.equals(that.time) : that.time != null) return false;
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int result;
+ long temp;
+ temp = Double.doubleToLongBits(amount);
+ result = (int) (temp ^ (temp >>> 32));
+ result = 31 * result + (int) (billingCycle ^ (billingCycle >>> 32));
+ temp = Double.doubleToLongBits(end);
+ result = 31 * result + (int) (temp ^ (temp >>> 32));
+ result = 31 * result + (id != null ? id.hashCode() : 0);
+ temp = Double.doubleToLongBits(initial);
+ result = 31 * result + (int) (temp ^ (temp >>> 32));
+ result = 31 * result + (reason != null ? reason.hashCode() : 0);
+ result = 31 * result + (time != null ? time.hashCode() : 0);
+ return result;
+ }
+
+ @Override
+ public String toString() {
+ return "[" +
+ "amount=" + amount +
+ ", billingCycle=" + billingCycle +
+ ", end=" + end +
+ ", id='" + id + '\'' +
+ ", initial=" + initial +
+ ", reason='" + reason + '\'' +
+ ", time=" + time +
+ "]";
+ }
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0d70c84a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/Usage.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/Usage.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/Usage.java
index 15d9b2b..b9850fb 100644
--- a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/Usage.java
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/Usage.java
@@ -24,84 +24,84 @@ import java.math.BigInteger;
*/
public class Usage {
- public static class Builder{
- private BigInteger burst;
- private BigInteger subscribed;
- private BigInteger using;
-
- public Builder subscribed(BigInteger subscribed) {
- this.subscribed = subscribed;
- return this;
- }
-
- public Builder burst(BigInteger burst) {
- this.burst = burst;
- return this;
- }
-
- public Builder using(BigInteger using) {
- this.using = using;
- return this;
- }
-
- public Usage build(){
- return new Usage(burst, subscribed, using);
- }
- }
-
- private final BigInteger burst;
- private final BigInteger subscribed;
- private final BigInteger using;
-
- @ConstructorProperties({
- "burst", "subscribed", "using"
- })
- public Usage(BigInteger burst, BigInteger subscribed, BigInteger using) {
- this.burst = burst;
- this.subscribed = subscribed;
- this.using = using;
- }
-
- public BigInteger getUsing() {
- return using;
- }
-
- public BigInteger getBurst() {
- return burst;
- }
-
- public BigInteger getSubscribed() {
- return subscribed;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (!(o instanceof Usage)) return false;
-
- Usage usage = (Usage) o;
-
- if (burst != null ? !burst.equals(usage.burst) : usage.burst != null) return false;
- if (subscribed != null ? !subscribed.equals(usage.subscribed) : usage.subscribed != null) return false;
- if (using != null ? !using.equals(usage.using) : usage.using != null) return false;
-
- return true;
- }
-
- @Override
- public int hashCode() {
- int result = burst != null ? burst.hashCode() : 0;
- result = 31 * result + (subscribed != null ? subscribed.hashCode() : 0);
- result = 31 * result + (using != null ? using.hashCode() : 0);
- return result;
- }
-
- @Override
- public String toString() {
- return "[" +
- "burst=" + burst +
- ", subscribed=" + subscribed +
- ", using=" + using +
- "]";
- }
+ public static class Builder {
+ private BigInteger burst;
+ private BigInteger subscribed;
+ private BigInteger using;
+
+ public Builder subscribed(BigInteger subscribed) {
+ this.subscribed = subscribed;
+ return this;
+ }
+
+ public Builder burst(BigInteger burst) {
+ this.burst = burst;
+ return this;
+ }
+
+ public Builder using(BigInteger using) {
+ this.using = using;
+ return this;
+ }
+
+ public Usage build() {
+ return new Usage(burst, subscribed, using);
+ }
+ }
+
+ private final BigInteger burst;
+ private final BigInteger subscribed;
+ private final BigInteger using;
+
+ @ConstructorProperties({
+ "burst", "subscribed", "using"
+ })
+ public Usage(BigInteger burst, BigInteger subscribed, BigInteger using) {
+ this.burst = burst;
+ this.subscribed = subscribed;
+ this.using = using;
+ }
+
+ public BigInteger getUsing() {
+ return using;
+ }
+
+ public BigInteger getBurst() {
+ return burst;
+ }
+
+ public BigInteger getSubscribed() {
+ return subscribed;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (!(o instanceof Usage)) return false;
+
+ Usage usage = (Usage) o;
+
+ if (burst != null ? !burst.equals(usage.burst) : usage.burst != null) return false;
+ if (subscribed != null ? !subscribed.equals(usage.subscribed) : usage.subscribed != null) return false;
+ if (using != null ? !using.equals(usage.using) : usage.using != null) return false;
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = burst != null ? burst.hashCode() : 0;
+ result = 31 * result + (subscribed != null ? subscribed.hashCode() : 0);
+ result = 31 * result + (using != null ? using.hashCode() : 0);
+ return result;
+ }
+
+ @Override
+ public String toString() {
+ return "[" +
+ "burst=" + burst +
+ ", subscribed=" + subscribed +
+ ", using=" + using +
+ "]";
+ }
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0d70c84a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/VLANInfo.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/VLANInfo.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/VLANInfo.java
index 418937f..d0c67f4 100644
--- a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/VLANInfo.java
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/VLANInfo.java
@@ -29,220 +29,220 @@ import java.util.Map;
* @author Vladimir Shevchenko
*/
public class VLANInfo {
- public static class Builder {
- private Map<String, String> meta;
- private String uuid;
- private Owner owner;
- private URI resourceUri;
- private List<Server> servers;
- private Subscription subscription;
- private List<Tag> tags;
-
- /**
- * @param uuid VLAN UUID
- * @return VLANInfo Builder
- */
- public Builder uuid(String uuid) {
- this.uuid = uuid;
- return this;
- }
-
- /**
- * @param owner VLAN owner
- * @return VLANInfo Builder
- */
- public Builder owner(Owner owner) {
- this.owner = owner;
- return this;
- }
-
- /**
- * @param meta User defined meta information
- * @return VLANInfo Builder
- */
- public Builder meta(Map<String, String> meta) {
- this.meta = meta;
- return this;
- }
-
- /**
- * @param resourceUri Resource URI
- * @return VLANInfo Builder
- */
- public Builder resourceUri(URI resourceUri) {
- this.resourceUri = resourceUri;
- return this;
- }
-
- /**
- * @param servers Servers in this VLAN
- * @return VLANInfo Builder
- */
- public Builder servers(List<Server> servers) {
- this.servers = ImmutableList.copyOf(servers);
- return this;
- }
-
- /**
- * @param subscription Subscription related to this VLAN
- * @return VLANInfo Builder
- */
- public Builder subscription(Subscription subscription) {
- this.subscription = subscription;
- return this;
- }
-
- /**
- * @param tags Tags added to this VLAN
- * @return VLANInfo Builder
- */
- public Builder tags(List<Tag> tags) {
- this.tags = ImmutableList.copyOf(tags);
- return this;
- }
-
- public VLANInfo build() {
- return new VLANInfo(meta, uuid, owner, resourceUri, servers, subscription, tags);
- }
- }
-
- private final Map<String, String> meta;
- private final String uuid;
- private final Owner owner;
- @Named("resource_uri")
- private final URI resourceUri;
- private final List<Server> servers;
- private final Subscription subscription;
- private final List<Tag> tags;
-
- @ConstructorProperties({
- "meta", "uuid", "owner", "resource_uri", "servers", "subscription", "tags"
- })
- public VLANInfo(Map<String, String> meta, String uuid, Owner owner, URI resourceUri, List<Server> servers
- , Subscription subscription, List<Tag> tags) {
- this.meta = meta;
- this.uuid = uuid;
- this.owner = owner;
- this.resourceUri = resourceUri;
- this.servers = servers;
- this.subscription = subscription;
- this.tags = tags;
- }
-
- /**
- * @return VLAN UUID
- */
- @Nullable
- public String getUuid() {
- return uuid;
- }
-
- /**
- * @return VLAN owner
- */
- public Owner getOwner() {
- return owner;
- }
-
- /**
- * @return User defined meta information
- */
- public Map<String, String> getMeta() {
- return meta;
- }
-
- /**
- * @return Resource URI
- */
- public URI getResourceUri() {
- return resourceUri;
- }
-
- /**
- * @return Servers in this VLAN
- */
- public List<Server> getServers() {
- return servers;
- }
-
- /**
- * @return Subscription related to this VLAN
- */
- public Subscription getSubscription() {
- return subscription;
- }
-
- /**
- * @return Tags added to this VLAN
- */
- public List<Tag> getTags() {
- return tags;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (!(o instanceof VLANInfo)) return false;
-
- VLANInfo vlanInfo = (VLANInfo) o;
-
- if (meta != null ? !meta.equals(vlanInfo.meta) : vlanInfo.meta != null) return false;
- if (owner != null ? !owner.equals(vlanInfo.owner) : vlanInfo.owner != null) return false;
- if (resourceUri != null ? !resourceUri.equals(vlanInfo.resourceUri) : vlanInfo.resourceUri != null)
- return false;
- if (servers != null ? !servers.equals(vlanInfo.servers) : vlanInfo.servers != null) return false;
- if (subscription != null ? !subscription.equals(vlanInfo.subscription) : vlanInfo.subscription != null)
- return false;
- if (tags != null ? !tags.equals(vlanInfo.tags) : vlanInfo.tags != null) return false;
- if (uuid != null ? !uuid.equals(vlanInfo.uuid) : vlanInfo.uuid != null) return false;
-
- return true;
- }
-
- @Override
- public int hashCode() {
- int result = meta != null ? meta.hashCode() : 0;
- result = 31 * result + (uuid != null ? uuid.hashCode() : 0);
- result = 31 * result + (owner != null ? owner.hashCode() : 0);
- result = 31 * result + (resourceUri != null ? resourceUri.hashCode() : 0);
- result = 31 * result + (servers != null ? servers.hashCode() : 0);
- result = 31 * result + (subscription != null ? subscription.hashCode() : 0);
- result = 31 * result + (tags != null ? tags.hashCode() : 0);
- return result;
- }
-
- @Override
- public String toString() {
- return "[" +
- "meta=" + meta +
- ", uuid='" + uuid + '\'' +
- ", owner=" + owner +
- ", resourceUri=" + resourceUri +
- ", servers=" + servers +
- ", subscription=" + subscription +
- ", tags=" + tags +
- "]";
- }
-
- /**
- * Creates VLAN NIC
- *
- * @param firewallPolicy
- * @return server's NIC
- */
- public NIC toNIC(FirewallPolicy firewallPolicy){
- return new NIC.Builder()
- .vlan(new Builder().uuid(this.uuid).build())
- .firewallPolicy(firewallPolicy)
- .build();
- }
-
- /**
- * Creates VLAN NIC
- *
- * @return server's NIC
- */
- public NIC toNIC(){
- return toNIC(null);
- }
+ public static class Builder {
+ private Map<String, String> meta;
+ private String uuid;
+ private Owner owner;
+ private URI resourceUri;
+ private List<Server> servers;
+ private Subscription subscription;
+ private List<Tag> tags;
+
+ /**
+ * @param uuid VLAN UUID
+ * @return VLANInfo Builder
+ */
+ public Builder uuid(String uuid) {
+ this.uuid = uuid;
+ return this;
+ }
+
+ /**
+ * @param owner VLAN owner
+ * @return VLANInfo Builder
+ */
+ public Builder owner(Owner owner) {
+ this.owner = owner;
+ return this;
+ }
+
+ /**
+ * @param meta User defined meta information
+ * @return VLANInfo Builder
+ */
+ public Builder meta(Map<String, String> meta) {
+ this.meta = meta;
+ return this;
+ }
+
+ /**
+ * @param resourceUri Resource URI
+ * @return VLANInfo Builder
+ */
+ public Builder resourceUri(URI resourceUri) {
+ this.resourceUri = resourceUri;
+ return this;
+ }
+
+ /**
+ * @param servers Servers in this VLAN
+ * @return VLANInfo Builder
+ */
+ public Builder servers(List<Server> servers) {
+ this.servers = ImmutableList.copyOf(servers);
+ return this;
+ }
+
+ /**
+ * @param subscription Subscription related to this VLAN
+ * @return VLANInfo Builder
+ */
+ public Builder subscription(Subscription subscription) {
+ this.subscription = subscription;
+ return this;
+ }
+
+ /**
+ * @param tags Tags added to this VLAN
+ * @return VLANInfo Builder
+ */
+ public Builder tags(List<Tag> tags) {
+ this.tags = ImmutableList.copyOf(tags);
+ return this;
+ }
+
+ public VLANInfo build() {
+ return new VLANInfo(meta, uuid, owner, resourceUri, servers, subscription, tags);
+ }
+ }
+
+ private final Map<String, String> meta;
+ private final String uuid;
+ private final Owner owner;
+ @Named("resource_uri")
+ private final URI resourceUri;
+ private final List<Server> servers;
+ private final Subscription subscription;
+ private final List<Tag> tags;
+
+ @ConstructorProperties({
+ "meta", "uuid", "owner", "resource_uri", "servers", "subscription", "tags"
+ })
+ public VLANInfo(Map<String, String> meta, String uuid, Owner owner, URI resourceUri, List<Server> servers
+ , Subscription subscription, List<Tag> tags) {
+ this.meta = meta;
+ this.uuid = uuid;
+ this.owner = owner;
+ this.resourceUri = resourceUri;
+ this.servers = servers;
+ this.subscription = subscription;
+ this.tags = tags;
+ }
+
+ /**
+ * @return VLAN UUID
+ */
+ @Nullable
+ public String getUuid() {
+ return uuid;
+ }
+
+ /**
+ * @return VLAN owner
+ */
+ public Owner getOwner() {
+ return owner;
+ }
+
+ /**
+ * @return User defined meta information
+ */
+ public Map<String, String> getMeta() {
+ return meta;
+ }
+
+ /**
+ * @return Resource URI
+ */
+ public URI getResourceUri() {
+ return resourceUri;
+ }
+
+ /**
+ * @return Servers in this VLAN
+ */
+ public List<Server> getServers() {
+ return servers;
+ }
+
+ /**
+ * @return Subscription related to this VLAN
+ */
+ public Subscription getSubscription() {
+ return subscription;
+ }
+
+ /**
+ * @return Tags added to this VLAN
+ */
+ public List<Tag> getTags() {
+ return tags;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (!(o instanceof VLANInfo)) return false;
+
+ VLANInfo vlanInfo = (VLANInfo) o;
+
+ if (meta != null ? !meta.equals(vlanInfo.meta) : vlanInfo.meta != null) return false;
+ if (owner != null ? !owner.equals(vlanInfo.owner) : vlanInfo.owner != null) return false;
+ if (resourceUri != null ? !resourceUri.equals(vlanInfo.resourceUri) : vlanInfo.resourceUri != null)
+ return false;
+ if (servers != null ? !servers.equals(vlanInfo.servers) : vlanInfo.servers != null) return false;
+ if (subscription != null ? !subscription.equals(vlanInfo.subscription) : vlanInfo.subscription != null)
+ return false;
+ if (tags != null ? !tags.equals(vlanInfo.tags) : vlanInfo.tags != null) return false;
+ if (uuid != null ? !uuid.equals(vlanInfo.uuid) : vlanInfo.uuid != null) return false;
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = meta != null ? meta.hashCode() : 0;
+ result = 31 * result + (uuid != null ? uuid.hashCode() : 0);
+ result = 31 * result + (owner != null ? owner.hashCode() : 0);
+ result = 31 * result + (resourceUri != null ? resourceUri.hashCode() : 0);
+ result = 31 * result + (servers != null ? servers.hashCode() : 0);
+ result = 31 * result + (subscription != null ? subscription.hashCode() : 0);
+ result = 31 * result + (tags != null ? tags.hashCode() : 0);
+ return result;
+ }
+
+ @Override
+ public String toString() {
+ return "[" +
+ "meta=" + meta +
+ ", uuid='" + uuid + '\'' +
+ ", owner=" + owner +
+ ", resourceUri=" + resourceUri +
+ ", servers=" + servers +
+ ", subscription=" + subscription +
+ ", tags=" + tags +
+ "]";
+ }
+
+ /**
+ * Creates VLAN NIC
+ *
+ * @param firewallPolicy
+ * @return server's NIC
+ */
+ public NIC toNIC(FirewallPolicy firewallPolicy) {
+ return new NIC.Builder()
+ .vlan(new Builder().uuid(this.uuid).build())
+ .firewallPolicy(firewallPolicy)
+ .build();
+ }
+
+ /**
+ * Creates VLAN NIC
+ *
+ * @return server's NIC
+ */
+ public NIC toNIC() {
+ return toNIC(null);
+ }
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0d70c84a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/CreateSubscriptionRequestToJson.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/CreateSubscriptionRequestToJson.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/CreateSubscriptionRequestToJson.java
index c26a8a7..35d04e9 100644
--- a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/CreateSubscriptionRequestToJson.java
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/CreateSubscriptionRequestToJson.java
@@ -28,26 +28,26 @@ import javax.inject.Singleton;
*/
@Singleton
public class CreateSubscriptionRequestToJson implements Function<CreateSubscriptionRequest, JsonObject> {
- @Override
- public JsonObject apply(@Nullable CreateSubscriptionRequest input) {
- if(input == null){
- return null;
- }
+ @Override
+ public JsonObject apply(@Nullable CreateSubscriptionRequest input) {
+ if (input == null) {
+ return null;
+ }
- JsonObject createSubscriptionObject = new JsonObject();
+ JsonObject createSubscriptionObject = new JsonObject();
- if(input.getAmount() != null){
- createSubscriptionObject.addProperty("amount", input.getAmount());
- }
+ if (input.getAmount() != null) {
+ createSubscriptionObject.addProperty("amount", input.getAmount());
+ }
- if(input.getPeriod() != null){
- createSubscriptionObject.addProperty("period", input.getPeriod());
- }
+ if (input.getPeriod() != null) {
+ createSubscriptionObject.addProperty("period", input.getPeriod());
+ }
- if(input.getResource() != null){
- createSubscriptionObject.addProperty("resource", input.getResource().value());
- }
+ if (input.getResource() != null) {
+ createSubscriptionObject.addProperty("resource", input.getResource().value());
+ }
- return createSubscriptionObject;
- }
+ return createSubscriptionObject;
+ }
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0d70c84a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/DriveToJson.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/DriveToJson.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/DriveToJson.java
index 710d606..21f7527 100644
--- a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/DriveToJson.java
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/DriveToJson.java
@@ -29,35 +29,35 @@ import javax.inject.Singleton;
*/
@Singleton
public class DriveToJson implements Function<DriveInfo, JsonObject> {
- @Override
- public JsonObject apply(DriveInfo input) {
- JsonObject driveObject = new JsonObject();
+ @Override
+ public JsonObject apply(DriveInfo input) {
+ JsonObject driveObject = new JsonObject();
- if(input.getName() != null){
- driveObject.addProperty("name", input.getName());
- }
+ if (input.getName() != null) {
+ driveObject.addProperty("name", input.getName());
+ }
- if(input.getSize() != null){
- driveObject.addProperty("size", "" + input.getSize().toString());
- }
+ if (input.getSize() != null) {
+ driveObject.addProperty("size", "" + input.getSize().toString());
+ }
- if(input.getMedia() != null){
- driveObject.addProperty("media", input.getMedia().toString());
- }
+ if (input.getMedia() != null) {
+ driveObject.addProperty("media", input.getMedia().toString());
+ }
- if(input.getAffinities() != null){
- driveObject.add("affinities", new JsonParser().parse(new Gson().toJson(input.getAffinities())));
- }
+ if (input.getAffinities() != null) {
+ driveObject.add("affinities", new JsonParser().parse(new Gson().toJson(input.getAffinities())));
+ }
- if(input.getMeta() != null){
- driveObject.add("meta", new JsonParser().parse(new Gson().toJson(input.getMeta())));
- }
+ if (input.getMeta() != null) {
+ driveObject.add("meta", new JsonParser().parse(new Gson().toJson(input.getMeta())));
+ }
- if(input.getTags() != null){
- driveObject.add("tags", new JsonParser().parse(new Gson().toJson(input.getTags())));
- }
+ if (input.getTags() != null) {
+ driveObject.add("tags", new JsonParser().parse(new Gson().toJson(input.getTags())));
+ }
- driveObject.addProperty("allow_multimount", input.isAllowMultimount());
- return driveObject;
- }
+ driveObject.addProperty("allow_multimount", input.isAllowMultimount());
+ return driveObject;
+ }
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0d70c84a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/FirewallPolicyToJson.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/FirewallPolicyToJson.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/FirewallPolicyToJson.java
index 41b00af..3a996ce 100644
--- a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/FirewallPolicyToJson.java
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/FirewallPolicyToJson.java
@@ -32,61 +32,61 @@ import javax.inject.Singleton;
*/
@Singleton
public class FirewallPolicyToJson implements Function<FirewallPolicy, JsonObject> {
- @Override
- public JsonObject apply(@Nullable FirewallPolicy input) {
- JsonObject firewallObject = new JsonObject();
+ @Override
+ public JsonObject apply(@Nullable FirewallPolicy input) {
+ JsonObject firewallObject = new JsonObject();
- if(input.getName() != null){
- firewallObject.addProperty("name", input.getName());
- }
+ if (input.getName() != null) {
+ firewallObject.addProperty("name", input.getName());
+ }
- if(input.getMeta() != null){
- firewallObject.add("meta", new JsonParser().parse(new Gson().toJson(input.getMeta())));
- }
+ if (input.getMeta() != null) {
+ firewallObject.add("meta", new JsonParser().parse(new Gson().toJson(input.getMeta())));
+ }
- if(input.getRules() != null){
- JsonArray rulesArray = new JsonArray();
+ if (input.getRules() != null) {
+ JsonArray rulesArray = new JsonArray();
- for(FirewallRule rule : input.getRules()){
- JsonObject ruleObject = new JsonObject();
+ for (FirewallRule rule : input.getRules()) {
+ JsonObject ruleObject = new JsonObject();
- if(rule.getAction() != null){
- ruleObject.addProperty("action", rule.getAction().value());
- }
-
- if(rule.getComment() != null){
- ruleObject.addProperty("comment", rule.getComment());
- }
+ if (rule.getAction() != null) {
+ ruleObject.addProperty("action", rule.getAction().value());
+ }
- if(rule.getDirection() != null){
- ruleObject.addProperty("direction", rule.getDirection().value());
- }
+ if (rule.getComment() != null) {
+ ruleObject.addProperty("comment", rule.getComment());
+ }
- if(rule.getDestinationIp() != null){
- ruleObject.addProperty("dst_ip", rule.getDestinationIp());
- }
+ if (rule.getDirection() != null) {
+ ruleObject.addProperty("direction", rule.getDirection().value());
+ }
- if(rule.getDestinationPort() != null){
- ruleObject.addProperty("dst_port", rule.getDestinationPort());
- }
+ if (rule.getDestinationIp() != null) {
+ ruleObject.addProperty("dst_ip", rule.getDestinationIp());
+ }
- if(rule.getIpProtocol() != null){
- ruleObject.addProperty("ip_proto", rule.getIpProtocol().toString());
- }
+ if (rule.getDestinationPort() != null) {
+ ruleObject.addProperty("dst_port", rule.getDestinationPort());
+ }
- if(rule.getSourceIp() != null){
- ruleObject.addProperty("src_ip", rule.getSourceIp());
- }
+ if (rule.getIpProtocol() != null) {
+ ruleObject.addProperty("ip_proto", rule.getIpProtocol().toString());
+ }
- if(rule.getSourcePort() != null){
- ruleObject.addProperty("src_port", rule.getSourcePort());
- }
+ if (rule.getSourceIp() != null) {
+ ruleObject.addProperty("src_ip", rule.getSourceIp());
+ }
- rulesArray.add(ruleObject);
+ if (rule.getSourcePort() != null) {
+ ruleObject.addProperty("src_port", rule.getSourcePort());
}
- firewallObject.add("rules", rulesArray);
- }
- return firewallObject;
- }
+ rulesArray.add(ruleObject);
+ }
+
+ firewallObject.add("rules", rulesArray);
+ }
+ return firewallObject;
+ }
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0d70c84a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/IPInfoToJson.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/IPInfoToJson.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/IPInfoToJson.java
index 34507e4..e2cfef3 100644
--- a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/IPInfoToJson.java
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/IPInfoToJson.java
@@ -29,19 +29,19 @@ import javax.inject.Singleton;
* @author Vladimir Shevchenko
*/
@Singleton
-public class IPInfoToJson implements Function<IPInfo, JsonObject>{
- @Override
- public JsonObject apply(@Nullable IPInfo input) {
- if(input == null){
- return null;
- }
+public class IPInfoToJson implements Function<IPInfo, JsonObject> {
+ @Override
+ public JsonObject apply(@Nullable IPInfo input) {
+ if (input == null) {
+ return null;
+ }
- JsonObject ipObject = new JsonObject();
+ JsonObject ipObject = new JsonObject();
- if(input.getMeta() != null){
- ipObject.add("meta", new JsonParser().parse(new Gson().toJson(input.getMeta())));
- }
+ if (input.getMeta() != null) {
+ ipObject.add("meta", new JsonParser().parse(new Gson().toJson(input.getMeta())));
+ }
- return ipObject;
- }
+ return ipObject;
+ }
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0d70c84a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/LibraryDriveToJson.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/LibraryDriveToJson.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/LibraryDriveToJson.java
index 88f235a..ab2bda2 100644
--- a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/LibraryDriveToJson.java
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/LibraryDriveToJson.java
@@ -30,26 +30,26 @@ import javax.inject.Singleton;
@Singleton
public class LibraryDriveToJson implements Function<LibraryDrive, JsonObject> {
- private final DriveToJson infoJsonObjectFunction;
+ private final DriveToJson infoJsonObjectFunction;
- @Inject
- public LibraryDriveToJson(DriveToJson infoJsonObjectFunction) {
- this.infoJsonObjectFunction = infoJsonObjectFunction;
- }
+ @Inject
+ public LibraryDriveToJson(DriveToJson infoJsonObjectFunction) {
+ this.infoJsonObjectFunction = infoJsonObjectFunction;
+ }
- @Override
- public JsonObject apply(@Nullable LibraryDrive input) {
- JsonObject libraryDriveObject = infoJsonObjectFunction.apply(input);
+ @Override
+ public JsonObject apply(@Nullable LibraryDrive input) {
+ JsonObject libraryDriveObject = infoJsonObjectFunction.apply(input);
- if(libraryDriveObject == null){
- libraryDriveObject = new JsonObject();
- }
+ if (libraryDriveObject == null) {
+ libraryDriveObject = new JsonObject();
+ }
- libraryDriveObject.addProperty("favourite", input.isFavorite());
+ libraryDriveObject.addProperty("favourite", input.isFavorite());
- if(input.getDescription() != null){
- libraryDriveObject.addProperty("description", input.getDescription());
- }
- return libraryDriveObject;
- }
+ if (input.getDescription() != null) {
+ libraryDriveObject.addProperty("description", input.getDescription());
+ }
+ return libraryDriveObject;
+ }
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0d70c84a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/ProfileInfoToJson.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/ProfileInfoToJson.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/ProfileInfoToJson.java
index c42911a..ed8a700 100644
--- a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/ProfileInfoToJson.java
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/ProfileInfoToJson.java
@@ -29,71 +29,71 @@ import javax.inject.Singleton;
* @author Vladimir Shevchenko
*/
@Singleton
-public class ProfileInfoToJson implements Function<ProfileInfo, JsonObject>{
- @Override
- public JsonObject apply(@Nullable ProfileInfo input) {
- if(input == null){
- return null;
- }
+public class ProfileInfoToJson implements Function<ProfileInfo, JsonObject> {
+ @Override
+ public JsonObject apply(@Nullable ProfileInfo input) {
+ if (input == null) {
+ return null;
+ }
- JsonObject profileJson = new JsonObject();
+ JsonObject profileJson = new JsonObject();
- if(input.getAddress() != null){
- profileJson.addProperty("address", input.getAddress());
- }
+ if (input.getAddress() != null) {
+ profileJson.addProperty("address", input.getAddress());
+ }
- if(input.getBankReference() != null){
- profileJson.addProperty("bank_reference", input.getBankReference());
- }
+ if (input.getBankReference() != null) {
+ profileJson.addProperty("bank_reference", input.getBankReference());
+ }
- if(input.getCompany() != null){
- profileJson.addProperty("company", input.getCompany());
- }
+ if (input.getCompany() != null) {
+ profileJson.addProperty("company", input.getCompany());
+ }
- if(input.getCountry() != null){
- profileJson.addProperty("country", input.getCountry());
- }
+ if (input.getCountry() != null) {
+ profileJson.addProperty("country", input.getCountry());
+ }
- if(input.getEmail() != null){
- profileJson.addProperty("email", input.getEmail());
- }
+ if (input.getEmail() != null) {
+ profileJson.addProperty("email", input.getEmail());
+ }
- if(input.getFirstName() != null){
- profileJson.addProperty("first_name", input.getFirstName());
- }
+ if (input.getFirstName() != null) {
+ profileJson.addProperty("first_name", input.getFirstName());
+ }
- if(input.getLastName() != null){
- profileJson.addProperty("last_name", input.getLastName());
- }
+ if (input.getLastName() != null) {
+ profileJson.addProperty("last_name", input.getLastName());
+ }
- if(input.getMeta() != null){
- profileJson.add("meta", new JsonParser().parse(new Gson().toJson(input.getMeta())));
- }
+ if (input.getMeta() != null) {
+ profileJson.add("meta", new JsonParser().parse(new Gson().toJson(input.getMeta())));
+ }
- if(input.getMyNotes() != null){
- profileJson.addProperty("my_notes", input.getMyNotes());
- }
+ if (input.getMyNotes() != null) {
+ profileJson.addProperty("my_notes", input.getMyNotes());
+ }
- if(input.getNickname() != null){
- profileJson.addProperty("nickname", input.getNickname());
- }
+ if (input.getNickname() != null) {
+ profileJson.addProperty("nickname", input.getNickname());
+ }
- if(input.getPhone() != null){
- profileJson.addProperty("phone", input.getPhone());
- }
+ if (input.getPhone() != null) {
+ profileJson.addProperty("phone", input.getPhone());
+ }
- if(input.getPostcode() != null){
- profileJson.addProperty("postcode", input.getPostcode());
- }
+ if (input.getPostcode() != null) {
+ profileJson.addProperty("postcode", input.getPostcode());
+ }
- if(input.getTitle() != null){
- profileJson.addProperty("title", input.getTitle());
- }
+ if (input.getTitle() != null) {
+ profileJson.addProperty("title", input.getTitle());
+ }
- if(input.getTown() != null){
- profileJson.addProperty("town", input.getTown());
- }
+ if (input.getTown() != null) {
+ profileJson.addProperty("town", input.getTown());
+ }
- return profileJson;
- }
+ return profileJson;
+ }
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0d70c84a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/ServerInfoToJson.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/ServerInfoToJson.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/ServerInfoToJson.java
index c086326..07d57f7 100644
--- a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/ServerInfoToJson.java
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/ServerInfoToJson.java
@@ -33,113 +33,113 @@ import javax.inject.Singleton;
*/
@Singleton
public class ServerInfoToJson implements Function<ServerInfo, JsonObject> {
- @Override
- public JsonObject apply(ServerInfo input) {
- JsonObject serverObject = new JsonObject();
-
- if(input.getName() != null){
- serverObject.addProperty("name", input.getName());
- }
-
- if(input.getCpu() > 0){
- serverObject.addProperty("cpu", input.getCpu());
- }
-
- if(input.getMemory() != null){
- serverObject.addProperty("mem", input.getMemory().toString());
- }
-
- if(input.getMeta() != null){
- serverObject.add("meta", new JsonParser().parse(new Gson().toJson(input.getMeta())));
- }
-
- if(input.getRequirements() != null){
- serverObject.add("requirements", new JsonParser().parse(new Gson().toJson(input.getRequirements())));
- }
-
- if(input.getTags() != null){
- serverObject.add("tags", new JsonParser().parse(new Gson().toJson(input.getTags())));
- }
-
- if(input.getVncPassword() != null){
- serverObject.addProperty("vnc_password", input.getVncPassword());
- }
-
- if(input.getNics() != null){
- JsonArray nics = new JsonArray();
-
- for(NIC nic : input.getNics()){
- JsonObject nicObject = new JsonObject();
-
- if(nic.getFirewallPolicy() != null){
- nicObject.addProperty("firewall_policy", nic.getFirewallPolicy().getUuid());
- }
-
- if(nic.getVlan() != null){
- nicObject.addProperty("vlan", nic.getVlan().getUuid());
- } else if(nic.getIpV4Configuration() != null){
- nicObject.add("ip_v4_conf", ipConfigurationToJsonObject(nic.getIpV4Configuration()));
-
- if(nic.getModel() != null){
- nicObject.addProperty("model", nic.getModel().value());
- }
- if(nic.getMac() != null){
- nicObject.addProperty("mac", nic.getMac());
- }
- } else if(nic.getIpV6Configuration() != null){
- nicObject.add("ip_v6_conf", ipConfigurationToJsonObject(nic.getIpV6Configuration()));
-
- if(nic.getModel() != null){
- nicObject.addProperty("model", nic.getModel().value());
- }
- if(nic.getMac() != null){
- nicObject.addProperty("mac", nic.getMac());
- }
- }
-
- nics.add(nicObject);
+ @Override
+ public JsonObject apply(ServerInfo input) {
+ JsonObject serverObject = new JsonObject();
+
+ if (input.getName() != null) {
+ serverObject.addProperty("name", input.getName());
+ }
+
+ if (input.getCpu() > 0) {
+ serverObject.addProperty("cpu", input.getCpu());
+ }
+
+ if (input.getMemory() != null) {
+ serverObject.addProperty("mem", input.getMemory().toString());
+ }
+
+ if (input.getMeta() != null) {
+ serverObject.add("meta", new JsonParser().parse(new Gson().toJson(input.getMeta())));
+ }
+
+ if (input.getRequirements() != null) {
+ serverObject.add("requirements", new JsonParser().parse(new Gson().toJson(input.getRequirements())));
+ }
+
+ if (input.getTags() != null) {
+ serverObject.add("tags", new JsonParser().parse(new Gson().toJson(input.getTags())));
+ }
+
+ if (input.getVncPassword() != null) {
+ serverObject.addProperty("vnc_password", input.getVncPassword());
+ }
+
+ if (input.getNics() != null) {
+ JsonArray nics = new JsonArray();
+
+ for (NIC nic : input.getNics()) {
+ JsonObject nicObject = new JsonObject();
+
+ if (nic.getFirewallPolicy() != null) {
+ nicObject.addProperty("firewall_policy", nic.getFirewallPolicy().getUuid());
}
- serverObject.add("nics", nics);
- }
+ if (nic.getVlan() != null) {
+ nicObject.addProperty("vlan", nic.getVlan().getUuid());
+ } else if (nic.getIpV4Configuration() != null) {
+ nicObject.add("ip_v4_conf", ipConfigurationToJsonObject(nic.getIpV4Configuration()));
+
+ if (nic.getModel() != null) {
+ nicObject.addProperty("model", nic.getModel().value());
+ }
+ if (nic.getMac() != null) {
+ nicObject.addProperty("mac", nic.getMac());
+ }
+ } else if (nic.getIpV6Configuration() != null) {
+ nicObject.add("ip_v6_conf", ipConfigurationToJsonObject(nic.getIpV6Configuration()));
+
+ if (nic.getModel() != null) {
+ nicObject.addProperty("model", nic.getModel().value());
+ }
+ if (nic.getMac() != null) {
+ nicObject.addProperty("mac", nic.getMac());
+ }
+ }
- if(input.getDrives() != null){
- JsonArray serverDrives = new JsonArray();
+ nics.add(nicObject);
+ }
- for(ServerDrive serverDrive : input.getDrives()){
- JsonObject driveObject = new JsonObject();
- driveObject.addProperty("boot_order", serverDrive.getBootOrder());
+ serverObject.add("nics", nics);
+ }
- if(serverDrive.getDeviceChannel() != null){
- driveObject.addProperty("dev_channel", serverDrive.getDeviceChannel());
- }
+ if (input.getDrives() != null) {
+ JsonArray serverDrives = new JsonArray();
- if(serverDrive.getDeviceEmulationType() != null){
- driveObject.addProperty("device", serverDrive.getDeviceEmulationType().value());
- }
+ for (ServerDrive serverDrive : input.getDrives()) {
+ JsonObject driveObject = new JsonObject();
+ driveObject.addProperty("boot_order", serverDrive.getBootOrder());
- if(serverDrive.getDriveUuid() != null){
- driveObject.addProperty("drive", serverDrive.getDriveUuid());
- } else if(serverDrive.getDrive() != null){
- driveObject.addProperty("drive", serverDrive.getDrive().getUuid());
- }
+ if (serverDrive.getDeviceChannel() != null) {
+ driveObject.addProperty("dev_channel", serverDrive.getDeviceChannel());
+ }
- serverDrives.add(driveObject);
+ if (serverDrive.getDeviceEmulationType() != null) {
+ driveObject.addProperty("device", serverDrive.getDeviceEmulationType().value());
}
- serverObject.add("drives", serverDrives);
- }
-
- return serverObject;
- }
-
- private JsonObject ipConfigurationToJsonObject(IPConfiguration ipConfiguration){
- JsonObject ipConfObject = new JsonObject();
- if(ipConfiguration.getConfigurationType() != null){
- ipConfObject.addProperty("conf", ipConfiguration.getConfigurationType().value());
- }
- if(ipConfiguration.getIp() != null){
- ipConfObject.addProperty("ip", ipConfiguration.getIp().getUuid());
- }
- return ipConfObject;
- }
+
+ if (serverDrive.getDriveUuid() != null) {
+ driveObject.addProperty("drive", serverDrive.getDriveUuid());
+ } else if (serverDrive.getDrive() != null) {
+ driveObject.addProperty("drive", serverDrive.getDrive().getUuid());
+ }
+
+ serverDrives.add(driveObject);
+ }
+ serverObject.add("drives", serverDrives);
+ }
+
+ return serverObject;
+ }
+
+ private JsonObject ipConfigurationToJsonObject(IPConfiguration ipConfiguration) {
+ JsonObject ipConfObject = new JsonObject();
+ if (ipConfiguration.getConfigurationType() != null) {
+ ipConfObject.addProperty("conf", ipConfiguration.getConfigurationType().value());
+ }
+ if (ipConfiguration.getIp() != null) {
+ ipConfObject.addProperty("ip", ipConfiguration.getIp().getUuid());
+ }
+ return ipConfObject;
+ }
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0d70c84a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/TagToJson.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/TagToJson.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/TagToJson.java
index 6beb728..d02f29e 100644
--- a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/TagToJson.java
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/TagToJson.java
@@ -33,28 +33,28 @@ import javax.inject.Singleton;
*/
@Singleton
public class TagToJson implements Function<Tag, JsonObject> {
- @Override
- public JsonObject apply(@Nullable Tag input) {
- JsonObject jsonTag = new JsonObject();
+ @Override
+ public JsonObject apply(@Nullable Tag input) {
+ JsonObject jsonTag = new JsonObject();
- if(input.getName() != null){
- jsonTag.addProperty("name", input.getName());
- }
+ if (input.getName() != null) {
+ jsonTag.addProperty("name", input.getName());
+ }
- if(input.getMeta() != null){
- jsonTag.add("meta", new JsonParser().parse(new Gson().toJson(input.getMeta())));
- }
+ if (input.getMeta() != null) {
+ jsonTag.add("meta", new JsonParser().parse(new Gson().toJson(input.getMeta())));
+ }
- if(input.getResources() != null && input.getResources().size() != 0){
- JsonArray uuidsArray = new JsonArray();
+ if (input.getResources() != null && input.getResources().size() != 0) {
+ JsonArray uuidsArray = new JsonArray();
- for(TagResource tagResource : input.getResources()){
- uuidsArray.add(new JsonPrimitive(tagResource.getUuid()));
- }
+ for (TagResource tagResource : input.getResources()) {
+ uuidsArray.add(new JsonPrimitive(tagResource.getUuid()));
+ }
- jsonTag.add("resources", uuidsArray);
- }
+ jsonTag.add("resources", uuidsArray);
+ }
- return jsonTag;
- }
+ return jsonTag;
+ }
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0d70c84a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/VLANInfoToJson.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/VLANInfoToJson.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/VLANInfoToJson.java
index 60d3d31..71eeedb 100644
--- a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/VLANInfoToJson.java
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/VLANInfoToJson.java
@@ -30,18 +30,18 @@ import org.jclouds.javax.annotation.Nullable;
@Singleton
public class VLANInfoToJson implements Function<VLANInfo, JsonObject> {
- @Override
- public JsonObject apply(@Nullable VLANInfo input) {
- if(input == null){
- return null;
- }
+ @Override
+ public JsonObject apply(@Nullable VLANInfo input) {
+ if (input == null) {
+ return null;
+ }
- JsonObject vlanObject = new JsonObject();
+ JsonObject vlanObject = new JsonObject();
- if(input.getMeta() != null){
- vlanObject.add("meta", new JsonParser().parse(new Gson().toJson(input.getMeta())));
- }
+ if (input.getMeta() != null) {
+ vlanObject.add("meta", new JsonParser().parse(new Gson().toJson(input.getMeta())));
+ }
- return vlanObject;
- }
+ return vlanObject;
+ }
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0d70c84a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/internal/ParseDiscounts.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/internal/ParseDiscounts.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/internal/ParseDiscounts.java
index 8085563..04b59cf 100644
--- a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/internal/ParseDiscounts.java
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/internal/ParseDiscounts.java
@@ -36,38 +36,38 @@ import java.util.List;
* @author Vladimir Shevchenko
*/
@Singleton
-public class ParseDiscounts extends ParseJson<ParseDiscounts.Discounts>{
- static class Discounts extends PaginatedCollection<Discount> {
+public class ParseDiscounts extends ParseJson<ParseDiscounts.Discounts> {
+ static class Discounts extends PaginatedCollection<Discount> {
- @ConstructorProperties({"objects", "meta"})
- public Discounts(Iterable<Discount> objects, PaginationOptions paginationOptions) {
- super(objects, paginationOptions);
- }
- }
+ @ConstructorProperties({"objects", "meta"})
+ public Discounts(Iterable<Discount> objects, PaginationOptions paginationOptions) {
+ super(objects, paginationOptions);
+ }
+ }
- @Inject
- public ParseDiscounts(Json json) {
- super(json, TypeLiteral.get(Discounts.class));
- }
+ @Inject
+ public ParseDiscounts(Json json) {
+ super(json, TypeLiteral.get(Discounts.class));
+ }
- public static class ToPagedIterable extends ArgsToPagedIterable<Discount, ToPagedIterable> {
+ public static class ToPagedIterable extends ArgsToPagedIterable<Discount, ToPagedIterable> {
- private CloudSigma2Api api;
+ private CloudSigma2Api api;
- @Inject
- public ToPagedIterable(CloudSigma2Api api) {
- this.api = api;
- }
+ @Inject
+ public ToPagedIterable(CloudSigma2Api api) {
+ this.api = api;
+ }
- @Override
- protected Function<Object, IterableWithMarker<Discount>> markerToNextForArgs(List<Object> args) {
- return new Function<Object, IterableWithMarker<Discount>>() {
- @Override
- public IterableWithMarker<Discount> apply(Object input) {
- PaginationOptions paginationOptions = PaginationOptions.class.cast(input);
- return api.listDiscounts(paginationOptions);
- }
- };
- }
- }
+ @Override
+ protected Function<Object, IterableWithMarker<Discount>> markerToNextForArgs(List<Object> args) {
+ return new Function<Object, IterableWithMarker<Discount>>() {
+ @Override
+ public IterableWithMarker<Discount> apply(Object input) {
+ PaginationOptions paginationOptions = PaginationOptions.class.cast(input);
+ return api.listDiscounts(paginationOptions);
+ }
+ };
+ }
+ }
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0d70c84a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/internal/ParseDriveInfos.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/internal/ParseDriveInfos.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/internal/ParseDriveInfos.java
index 791d78c..20c3b7d 100644
--- a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/internal/ParseDriveInfos.java
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/internal/ParseDriveInfos.java
@@ -38,37 +38,37 @@ import java.util.List;
@Singleton
public class ParseDriveInfos extends ParseJson<ParseDriveInfos.DriveInfos> {
- static class DriveInfos extends PaginatedCollection<DriveInfo>{
+ static class DriveInfos extends PaginatedCollection<DriveInfo> {
- @ConstructorProperties({"objects", "meta"})
- public DriveInfos(Iterable<DriveInfo> objects, PaginationOptions paginationOptions) {
- super(objects, paginationOptions);
- }
- }
+ @ConstructorProperties({"objects", "meta"})
+ public DriveInfos(Iterable<DriveInfo> objects, PaginationOptions paginationOptions) {
+ super(objects, paginationOptions);
+ }
+ }
- @Inject
- public ParseDriveInfos(Json json) {
- super(json, TypeLiteral.get(DriveInfos.class));
- }
+ @Inject
+ public ParseDriveInfos(Json json) {
+ super(json, TypeLiteral.get(DriveInfos.class));
+ }
- public static class ToPagedIterable extends ArgsToPagedIterable<DriveInfo, ToPagedIterable> {
+ public static class ToPagedIterable extends ArgsToPagedIterable<DriveInfo, ToPagedIterable> {
- private CloudSigma2Api api;
+ private CloudSigma2Api api;
- @Inject
- public ToPagedIterable(CloudSigma2Api api) {
- this.api = api;
- }
+ @Inject
+ public ToPagedIterable(CloudSigma2Api api) {
+ this.api = api;
+ }
- @Override
- protected Function<Object, IterableWithMarker<DriveInfo>> markerToNextForArgs(List<Object> args) {
- return new Function<Object, IterableWithMarker<DriveInfo>>() {
- @Override
- public IterableWithMarker<DriveInfo> apply(Object input) {
- PaginationOptions paginationOptions = PaginationOptions.class.cast(input);
- return api.listDrivesInfo(paginationOptions);
- }
- };
- }
- }
+ @Override
+ protected Function<Object, IterableWithMarker<DriveInfo>> markerToNextForArgs(List<Object> args) {
+ return new Function<Object, IterableWithMarker<DriveInfo>>() {
+ @Override
+ public IterableWithMarker<DriveInfo> apply(Object input) {
+ PaginationOptions paginationOptions = PaginationOptions.class.cast(input);
+ return api.listDrivesInfo(paginationOptions);
+ }
+ };
+ }
+ }
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0d70c84a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/internal/ParseDrives.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/internal/ParseDrives.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/internal/ParseDrives.java
index 0338a84..9475aa5 100644
--- a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/internal/ParseDrives.java
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/internal/ParseDrives.java
@@ -37,37 +37,37 @@ import java.util.List;
*/
@Singleton
public class ParseDrives extends ParseJson<ParseDrives.Drives> {
- static class Drives extends PaginatedCollection<Drive>{
+ static class Drives extends PaginatedCollection<Drive> {
- @ConstructorProperties({"objects", "meta"})
- public Drives(Iterable<Drive> objects, PaginationOptions paginationOptions) {
- super(objects, paginationOptions);
- }
- }
+ @ConstructorProperties({"objects", "meta"})
+ public Drives(Iterable<Drive> objects, PaginationOptions paginationOptions) {
+ super(objects, paginationOptions);
+ }
+ }
- @Inject
- public ParseDrives(Json json) {
- super(json, TypeLiteral.get(Drives.class));
- }
+ @Inject
+ public ParseDrives(Json json) {
+ super(json, TypeLiteral.get(Drives.class));
+ }
- public static class ToPagedIterable extends ArgsToPagedIterable<Drive, ToPagedIterable> {
+ public static class ToPagedIterable extends ArgsToPagedIterable<Drive, ToPagedIterable> {
- private CloudSigma2Api api;
+ private CloudSigma2Api api;
- @Inject
- public ToPagedIterable(CloudSigma2Api api) {
- this.api = api;
- }
+ @Inject
+ public ToPagedIterable(CloudSigma2Api api) {
+ this.api = api;
+ }
- @Override
- protected Function<Object, IterableWithMarker<Drive>> markerToNextForArgs(List<Object> args) {
- return new Function<Object, IterableWithMarker<Drive>>() {
- @Override
- public IterableWithMarker<Drive> apply(Object input) {
- PaginationOptions paginationOptions = PaginationOptions.class.cast(input);
- return api.listDrives(paginationOptions);
- }
- };
- }
- }
+ @Override
+ protected Function<Object, IterableWithMarker<Drive>> markerToNextForArgs(List<Object> args) {
+ return new Function<Object, IterableWithMarker<Drive>>() {
+ @Override
+ public IterableWithMarker<Drive> apply(Object input) {
+ PaginationOptions paginationOptions = PaginationOptions.class.cast(input);
+ return api.listDrives(paginationOptions);
+ }
+ };
+ }
+ }
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0d70c84a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/internal/ParseFirewallPolicies.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/internal/ParseFirewallPolicies.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/internal/ParseFirewallPolicies.java
index f4d50bd..6080a97 100644
--- a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/internal/ParseFirewallPolicies.java
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/internal/ParseFirewallPolicies.java
@@ -36,59 +36,59 @@ import java.util.List;
* @author Vladimir Shevchenko
*/
@Singleton
-public class ParseFirewallPolicies extends ParseJson<ParseFirewallPolicies.FirewallPolicies>{
- static class FirewallPolicies extends PaginatedCollection<FirewallPolicy>{
+public class ParseFirewallPolicies extends ParseJson<ParseFirewallPolicies.FirewallPolicies> {
+ static class FirewallPolicies extends PaginatedCollection<FirewallPolicy> {
- @ConstructorProperties({"objects", "meta"})
- FirewallPolicies(Iterable<FirewallPolicy> objects, PaginationOptions paginationOptions) {
- super(objects, paginationOptions);
- }
- }
+ @ConstructorProperties({"objects", "meta"})
+ FirewallPolicies(Iterable<FirewallPolicy> objects, PaginationOptions paginationOptions) {
+ super(objects, paginationOptions);
+ }
+ }
- @Inject
- public ParseFirewallPolicies(Json json) {
- super(json, TypeLiteral.get(FirewallPolicies.class));
- }
+ @Inject
+ public ParseFirewallPolicies(Json json) {
+ super(json, TypeLiteral.get(FirewallPolicies.class));
+ }
- public static class ToPagedIterable extends ArgsToPagedIterable<FirewallPolicy, ToPagedIterable> {
+ public static class ToPagedIterable extends ArgsToPagedIterable<FirewallPolicy, ToPagedIterable> {
- private CloudSigma2Api api;
+ private CloudSigma2Api api;
- @Inject
- public ToPagedIterable(CloudSigma2Api api) {
- this.api = api;
- }
+ @Inject
+ public ToPagedIterable(CloudSigma2Api api) {
+ this.api = api;
+ }
- @Override
- protected Function<Object, IterableWithMarker<FirewallPolicy>> markerToNextForArgs(List<Object> args) {
- return new Function<Object, IterableWithMarker<FirewallPolicy>>() {
- @Override
- public IterableWithMarker<FirewallPolicy> apply(Object input) {
- PaginationOptions paginationOptions = PaginationOptions.class.cast(input);
- return api.listFirewallPolicies(paginationOptions);
- }
- };
- }
- }
+ @Override
+ protected Function<Object, IterableWithMarker<FirewallPolicy>> markerToNextForArgs(List<Object> args) {
+ return new Function<Object, IterableWithMarker<FirewallPolicy>>() {
+ @Override
+ public IterableWithMarker<FirewallPolicy> apply(Object input) {
+ PaginationOptions paginationOptions = PaginationOptions.class.cast(input);
+ return api.listFirewallPolicies(paginationOptions);
+ }
+ };
+ }
+ }
- public static class ToPagedIterableInfo extends ArgsToPagedIterable<FirewallPolicy, ToPagedIterable> {
+ public static class ToPagedIterableInfo extends ArgsToPagedIterable<FirewallPolicy, ToPagedIterable> {
- private CloudSigma2Api api;
+ private CloudSigma2Api api;
- @Inject
- public ToPagedIterableInfo(CloudSigma2Api api) {
- this.api = api;
- }
+ @Inject
+ public ToPagedIterableInfo(CloudSigma2Api api) {
+ this.api = api;
+ }
- @Override
- protected Function<Object, IterableWithMarker<FirewallPolicy>> markerToNextForArgs(List<Object> args) {
- return new Function<Object, IterableWithMarker<FirewallPolicy>>() {
- @Override
- public IterableWithMarker<FirewallPolicy> apply(Object input) {
- PaginationOptions paginationOptions = PaginationOptions.class.cast(input);
- return api.listFirewallPoliciesInfo(paginationOptions);
- }
- };
- }
- }
+ @Override
+ protected Function<Object, IterableWithMarker<FirewallPolicy>> markerToNextForArgs(List<Object> args) {
+ return new Function<Object, IterableWithMarker<FirewallPolicy>>() {
+ @Override
+ public IterableWithMarker<FirewallPolicy> apply(Object input) {
+ PaginationOptions paginationOptions = PaginationOptions.class.cast(input);
+ return api.listFirewallPoliciesInfo(paginationOptions);
+ }
+ };
+ }
+ }
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0d70c84a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/internal/ParseIPInfos.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/internal/ParseIPInfos.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/internal/ParseIPInfos.java
index 29f23c2..48c7712 100644
--- a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/internal/ParseIPInfos.java
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/internal/ParseIPInfos.java
@@ -36,38 +36,38 @@ import java.util.List;
* @author Vladimir Shevchenko
*/
@Singleton
-public class ParseIPInfos extends ParseJson<ParseIPInfos.IPInfos>{
- static class IPInfos extends PaginatedCollection<IPInfo> {
+public class ParseIPInfos extends ParseJson<ParseIPInfos.IPInfos> {
+ static class IPInfos extends PaginatedCollection<IPInfo> {
- @ConstructorProperties({"objects", "meta"})
- public IPInfos(Iterable<IPInfo> objects, PaginationOptions paginationOptions) {
- super(objects, paginationOptions);
- }
- }
+ @ConstructorProperties({"objects", "meta"})
+ public IPInfos(Iterable<IPInfo> objects, PaginationOptions paginationOptions) {
+ super(objects, paginationOptions);
+ }
+ }
- @Inject
- public ParseIPInfos(Json json) {
- super(json, TypeLiteral.get(IPInfos.class));
- }
+ @Inject
+ public ParseIPInfos(Json json) {
+ super(json, TypeLiteral.get(IPInfos.class));
+ }
- public static class ToPagedIterable extends ArgsToPagedIterable<IPInfo, ToPagedIterable> {
+ public static class ToPagedIterable extends ArgsToPagedIterable<IPInfo, ToPagedIterable> {
- private CloudSigma2Api api;
+ private CloudSigma2Api api;
- @Inject
- public ToPagedIterable(CloudSigma2Api api) {
- this.api = api;
- }
+ @Inject
+ public ToPagedIterable(CloudSigma2Api api) {
+ this.api = api;
+ }
- @Override
- protected Function<Object, IterableWithMarker<IPInfo>> markerToNextForArgs(List<Object> args) {
- return new Function<Object, IterableWithMarker<IPInfo>>() {
- @Override
- public IterableWithMarker<IPInfo> apply(Object input) {
- PaginationOptions paginationOptions = PaginationOptions.class.cast(input);
- return api.listIPInfo(paginationOptions);
- }
- };
- }
- }
+ @Override
+ protected Function<Object, IterableWithMarker<IPInfo>> markerToNextForArgs(List<Object> args) {
+ return new Function<Object, IterableWithMarker<IPInfo>>() {
+ @Override
+ public IterableWithMarker<IPInfo> apply(Object input) {
+ PaginationOptions paginationOptions = PaginationOptions.class.cast(input);
+ return api.listIPInfo(paginationOptions);
+ }
+ };
+ }
+ }
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0d70c84a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/internal/ParseIPs.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/internal/ParseIPs.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/internal/ParseIPs.java
index d8bf6b9..7fe045f 100644
--- a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/internal/ParseIPs.java
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/internal/ParseIPs.java
@@ -37,37 +37,37 @@ import java.util.List;
*/
@Singleton
public class ParseIPs extends ParseJson<ParseIPs.IPs> {
- static class IPs extends PaginatedCollection<IP> {
+ static class IPs extends PaginatedCollection<IP> {
- @ConstructorProperties({"objects", "meta"})
- public IPs(Iterable<IP> objects, PaginationOptions paginationOptions) {
- super(objects, paginationOptions);
- }
- }
+ @ConstructorProperties({"objects", "meta"})
+ public IPs(Iterable<IP> objects, PaginationOptions paginationOptions) {
+ super(objects, paginationOptions);
+ }
+ }
- @Inject
- public ParseIPs(Json json) {
- super(json, TypeLiteral.get(IPs.class));
- }
+ @Inject
+ public ParseIPs(Json json) {
+ super(json, TypeLiteral.get(IPs.class));
+ }
- public static class ToPagedIterable extends ArgsToPagedIterable<IP, ToPagedIterable> {
+ public static class ToPagedIterable extends ArgsToPagedIterable<IP, ToPagedIterable> {
- private CloudSigma2Api api;
+ private CloudSigma2Api api;
- @Inject
- public ToPagedIterable(CloudSigma2Api api) {
- this.api = api;
- }
+ @Inject
+ public ToPagedIterable(CloudSigma2Api api) {
+ this.api = api;
+ }
- @Override
- protected Function<Object, IterableWithMarker<IP>> markerToNextForArgs(List<Object> args) {
- return new Function<Object, IterableWithMarker<IP>>() {
- @Override
- public IterableWithMarker<IP> apply(Object input) {
- PaginationOptions paginationOptions = PaginationOptions.class.cast(input);
- return api.listIPs(paginationOptions);
- }
- };
- }
- }
+ @Override
+ protected Function<Object, IterableWithMarker<IP>> markerToNextForArgs(List<Object> args) {
+ return new Function<Object, IterableWithMarker<IP>>() {
+ @Override
+ public IterableWithMarker<IP> apply(Object input) {
+ PaginationOptions paginationOptions = PaginationOptions.class.cast(input);
+ return api.listIPs(paginationOptions);
+ }
+ };
+ }
+ }
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0d70c84a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/internal/ParseLibraryDrives.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/internal/ParseLibraryDrives.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/internal/ParseLibraryDrives.java
index 457e855..91c89b3 100644
--- a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/internal/ParseLibraryDrives.java
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/internal/ParseLibraryDrives.java
@@ -37,37 +37,37 @@ import java.util.List;
*/
@Singleton
public class ParseLibraryDrives extends ParseJson<ParseLibraryDrives.LibraryDrives> {
- static class LibraryDrives extends PaginatedCollection<LibraryDrive>{
+ static class LibraryDrives extends PaginatedCollection<LibraryDrive> {
- @ConstructorProperties({"objects", "meta"})
- public LibraryDrives(Iterable<LibraryDrive> objects, PaginationOptions paginationOptions) {
- super(objects, paginationOptions);
- }
- }
+ @ConstructorProperties({"objects", "meta"})
+ public LibraryDrives(Iterable<LibraryDrive> objects, PaginationOptions paginationOptions) {
+ super(objects, paginationOptions);
+ }
+ }
- @Inject
- public ParseLibraryDrives(Json json) {
- super(json, TypeLiteral.get(LibraryDrives.class));
- }
+ @Inject
+ public ParseLibraryDrives(Json json) {
+ super(json, TypeLiteral.get(LibraryDrives.class));
+ }
- public static class ToPagedIterable extends ArgsToPagedIterable<LibraryDrive, ToPagedIterable> {
+ public static class ToPagedIterable extends ArgsToPagedIterable<LibraryDrive, ToPagedIterable> {
- private CloudSigma2Api api;
+ private CloudSigma2Api api;
- @Inject
- public ToPagedIterable(CloudSigma2Api api) {
- this.api = api;
- }
+ @Inject
+ public ToPagedIterable(CloudSigma2Api api) {
+ this.api = api;
+ }
- @Override
- protected Function<Object, IterableWithMarker<LibraryDrive>> markerToNextForArgs(List<Object> args) {
- return new Function<Object, IterableWithMarker<LibraryDrive>>() {
- @Override
- public IterableWithMarker<LibraryDrive> apply(Object input) {
- PaginationOptions paginationOptions = PaginationOptions.class.cast(input);
- return api.listLibraryDrives(paginationOptions);
- }
- };
- }
- }
+ @Override
+ protected Function<Object, IterableWithMarker<LibraryDrive>> markerToNextForArgs(List<Object> args) {
+ return new Function<Object, IterableWithMarker<LibraryDrive>>() {
+ @Override
+ public IterableWithMarker<LibraryDrive> apply(Object input) {
+ PaginationOptions paginationOptions = PaginationOptions.class.cast(input);
+ return api.listLibraryDrives(paginationOptions);
+ }
+ };
+ }
+ }
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0d70c84a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/internal/ParseLicenses.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/internal/ParseLicenses.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/internal/ParseLicenses.java
index 0b9b6c6..7b8e107 100644
--- a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/internal/ParseLicenses.java
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/internal/ParseLicenses.java
@@ -37,37 +37,37 @@ import java.util.List;
*/
@Singleton
public class ParseLicenses extends ParseJson<ParseLicenses.Licenses> {
- static class Licenses extends PaginatedCollection<License> {
+ static class Licenses extends PaginatedCollection<License> {
- @ConstructorProperties({"objects", "meta"})
- public Licenses(Iterable<License> objects, PaginationOptions meta) {
- super(objects, meta);
- }
- }
+ @ConstructorProperties({"objects", "meta"})
+ public Licenses(Iterable<License> objects, PaginationOptions meta) {
+ super(objects, meta);
+ }
+ }
- @Inject
- public ParseLicenses(Json json) {
- super(json, TypeLiteral.get(Licenses.class));
- }
+ @Inject
+ public ParseLicenses(Json json) {
+ super(json, TypeLiteral.get(Licenses.class));
+ }
- public static class ToPagedIterable extends ArgsToPagedIterable<License, ToPagedIterable> {
+ public static class ToPagedIterable extends ArgsToPagedIterable<License, ToPagedIterable> {
- private CloudSigma2Api api;
+ private CloudSigma2Api api;
- @Inject
- public ToPagedIterable(CloudSigma2Api api) {
- this.api = api;
- }
+ @Inject
+ public ToPagedIterable(CloudSigma2Api api) {
+ this.api = api;
+ }
- @Override
- protected Function<Object, IterableWithMarker<License>> markerToNextForArgs(List<Object> args) {
- return new Function<Object, IterableWithMarker<License>>() {
- @Override
- public IterableWithMarker<License> apply(Object input) {
- PaginationOptions paginationOptions = PaginationOptions.class.cast(input);
- return api.listLicenses(paginationOptions);
- }
- };
- }
- }
+ @Override
+ protected Function<Object, IterableWithMarker<License>> markerToNextForArgs(List<Object> args) {
+ return new Function<Object, IterableWithMarker<License>>() {
+ @Override
+ public IterableWithMarker<License> apply(Object input) {
+ PaginationOptions paginationOptions = PaginationOptions.class.cast(input);
+ return api.listLicenses(paginationOptions);
+ }
+ };
+ }
+ }
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/0d70c84a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/internal/ParseServerInfos.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/internal/ParseServerInfos.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/internal/ParseServerInfos.java
index 7dca37c..cbc7a56 100644
--- a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/internal/ParseServerInfos.java
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/internal/ParseServerInfos.java
@@ -38,37 +38,37 @@ import java.util.List;
@Singleton
public class ParseServerInfos extends ParseJson<ParseServerInfos.ServerInfos> {
- static class ServerInfos extends PaginatedCollection<ServerInfo> {
+ static class ServerInfos extends PaginatedCollection<ServerInfo> {
- @ConstructorProperties({"objects", "meta"})
- public ServerInfos(Iterable<ServerInfo> objects, PaginationOptions paginationOptions) {
- super(objects, paginationOptions);
- }
- }
+ @ConstructorProperties({"objects", "meta"})
+ public ServerInfos(Iterable<ServerInfo> objects, PaginationOptions paginationOptions) {
+ super(objects, paginationOptions);
+ }
+ }
- @Inject
- public ParseServerInfos(Json json) {
- super(json, TypeLiteral.get(ServerInfos.class));
- }
+ @Inject
+ public ParseServerInfos(Json json) {
+ super(json, TypeLiteral.get(ServerInfos.class));
+ }
- public static class ToPagedIterable extends ArgsToPagedIterable<ServerInfo, ToPagedIterable> {
+ public static class ToPagedIterable extends ArgsToPagedIterable<ServerInfo, ToPagedIterable> {
- private CloudSigma2Api api;
+ private CloudSigma2Api api;
- @Inject
- public ToPagedIterable(CloudSigma2Api api) {
- this.api = api;
- }
+ @Inject
+ public ToPagedIterable(CloudSigma2Api api) {
+ this.api = api;
+ }
- @Override
- protected Function<Object, IterableWithMarker<ServerInfo>> markerToNextForArgs(List<Object> args) {
- return new Function<Object, IterableWithMarker<ServerInfo>>() {
- @Override
- public IterableWithMarker<ServerInfo> apply(Object input) {
- PaginationOptions paginationOptions = PaginationOptions.class.cast(input);
- return api.listServersInfo(paginationOptions);
- }
- };
- }
- }
+ @Override
+ protected Function<Object, IterableWithMarker<ServerInfo>> markerToNextForArgs(List<Object> args) {
+ return new Function<Object, IterableWithMarker<ServerInfo>>() {
+ @Override
+ public IterableWithMarker<ServerInfo> apply(Object input) {
+ PaginationOptions paginationOptions = PaginationOptions.class.cast(input);
+ return api.listServersInfo(paginationOptions);
+ }
+ };
+ }
+ }
}
\ No newline at end of file