You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jclouds.apache.org by za...@apache.org on 2014/01/08 20:40:31 UTC
[1/2] Renames multiple domain classes for consistency
Updated Branches:
refs/heads/master 2e4f67c7f -> 90c7a3a53
http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/90c7a3a5/rackspace-autoscale/src/test/java/org/jclouds/rackspace/autoscale/v1/features/ScalingPolicyApiLiveTest.java
----------------------------------------------------------------------
diff --git a/rackspace-autoscale/src/test/java/org/jclouds/rackspace/autoscale/v1/features/ScalingPolicyApiLiveTest.java b/rackspace-autoscale/src/test/java/org/jclouds/rackspace/autoscale/v1/features/ScalingPolicyApiLiveTest.java
index cd1c664..a99f32d 100644
--- a/rackspace-autoscale/src/test/java/org/jclouds/rackspace/autoscale/v1/features/ScalingPolicyApiLiveTest.java
+++ b/rackspace-autoscale/src/test/java/org/jclouds/rackspace/autoscale/v1/features/ScalingPolicyApiLiveTest.java
@@ -31,11 +31,11 @@ import org.jclouds.rackspace.autoscale.v1.domain.LaunchConfiguration;
import org.jclouds.rackspace.autoscale.v1.domain.LaunchConfiguration.LaunchConfigurationType;
import org.jclouds.rackspace.autoscale.v1.domain.LoadBalancer;
import org.jclouds.rackspace.autoscale.v1.domain.Personality;
+import org.jclouds.rackspace.autoscale.v1.domain.CreateScalingPolicy;
+import org.jclouds.rackspace.autoscale.v1.domain.CreateScalingPolicy.ScalingPolicyScheduleType;
+import org.jclouds.rackspace.autoscale.v1.domain.CreateScalingPolicy.ScalingPolicyTargetType;
+import org.jclouds.rackspace.autoscale.v1.domain.CreateScalingPolicy.ScalingPolicyType;
import org.jclouds.rackspace.autoscale.v1.domain.ScalingPolicy;
-import org.jclouds.rackspace.autoscale.v1.domain.ScalingPolicy.ScalingPolicyScheduleType;
-import org.jclouds.rackspace.autoscale.v1.domain.ScalingPolicy.ScalingPolicyTargetType;
-import org.jclouds.rackspace.autoscale.v1.domain.ScalingPolicy.ScalingPolicyType;
-import org.jclouds.rackspace.autoscale.v1.domain.ScalingPolicyResponse;
import org.jclouds.rackspace.autoscale.v1.internal.BaseAutoscaleApiLiveTest;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
@@ -89,9 +89,9 @@ public class ScalingPolicyApiLiveTest extends BaseAutoscaleApiLiveTest {
.contents("VGhpcyBpcyBhIHRlc3QgZmlsZS4=").build()))
.type(LaunchConfigurationType.LAUNCH_SERVER).build();
- List<ScalingPolicy> scalingPolicies = Lists.newArrayList();
+ List<CreateScalingPolicy> scalingPolicies = Lists.newArrayList();
- ScalingPolicy scalingPolicy = ScalingPolicy.builder().cooldown(3).type(ScalingPolicyType.WEBHOOK)
+ CreateScalingPolicy scalingPolicy = CreateScalingPolicy.builder().cooldown(3).type(ScalingPolicyType.WEBHOOK)
.name("scale up by 1").targetType(ScalingPolicyTargetType.INCREMENTAL).target("1").build();
scalingPolicies.add(scalingPolicy);
@@ -152,9 +152,9 @@ public class ScalingPolicyApiLiveTest extends BaseAutoscaleApiLiveTest {
PolicyApi policyApi = api.getPolicyApiForZoneAndGroup(zone, created.get(zone).get(0).getId());
- List<ScalingPolicy> scalingPolicies = Lists.newArrayList();
+ List<CreateScalingPolicy> scalingPolicies = Lists.newArrayList();
- ScalingPolicy scalingPolicy = ScalingPolicy.builder()
+ CreateScalingPolicy scalingPolicy = CreateScalingPolicy.builder()
.cooldown(3)
.type(ScalingPolicyType.WEBHOOK)
.name("scale up by one server")
@@ -163,7 +163,7 @@ public class ScalingPolicyApiLiveTest extends BaseAutoscaleApiLiveTest {
.build();
scalingPolicies.add(scalingPolicy);
- FluentIterable<ScalingPolicyResponse> scalingPolicyResponse = policyApi.create(scalingPolicies);
+ FluentIterable<ScalingPolicy> scalingPolicyResponse = policyApi.create(scalingPolicies);
assertNotNull(scalingPolicyResponse.iterator().next().getId());
assertEquals(scalingPolicyResponse.iterator().next().getCooldown(), 3);
assertEquals(scalingPolicyResponse.iterator().next().getTarget(), "1");
@@ -176,9 +176,9 @@ public class ScalingPolicyApiLiveTest extends BaseAutoscaleApiLiveTest {
PolicyApi policyApi = api.getPolicyApiForZoneAndGroup(zone, created.get(zone).get(0).getId());
- List<ScalingPolicy> scalingPolicies = Lists.newArrayList();
+ List<CreateScalingPolicy> scalingPolicies = Lists.newArrayList();
- ScalingPolicy scalingPolicy = ScalingPolicy.builder()
+ CreateScalingPolicy scalingPolicy = CreateScalingPolicy.builder()
.cooldown(3)
.type(ScalingPolicyType.SCHEDULE)
.name("scale up by one server")
@@ -188,7 +188,7 @@ public class ScalingPolicyApiLiveTest extends BaseAutoscaleApiLiveTest {
.build();
scalingPolicies.add(scalingPolicy);
- FluentIterable<ScalingPolicyResponse> scalingPolicyResponse = policyApi.create(scalingPolicies);
+ FluentIterable<ScalingPolicy> scalingPolicyResponse = policyApi.create(scalingPolicies);
assertNotNull(scalingPolicyResponse.iterator().next().getId());
assertEquals(scalingPolicyResponse.iterator().next().getCooldown(), 3);
assertEquals(scalingPolicyResponse.iterator().next().getTarget(), "1");
@@ -203,9 +203,9 @@ public class ScalingPolicyApiLiveTest extends BaseAutoscaleApiLiveTest {
PolicyApi policyApi = api.getPolicyApiForZoneAndGroup(zone, created.get(zone).get(0).getId());
- List<ScalingPolicy> scalingPolicies = Lists.newArrayList();
+ List<CreateScalingPolicy> scalingPolicies = Lists.newArrayList();
- ScalingPolicy scalingPolicy = ScalingPolicy.builder()
+ CreateScalingPolicy scalingPolicy = CreateScalingPolicy.builder()
.cooldown(3)
.type(ScalingPolicyType.SCHEDULE)
.name("scale up by one server")
@@ -215,7 +215,7 @@ public class ScalingPolicyApiLiveTest extends BaseAutoscaleApiLiveTest {
.build();
scalingPolicies.add(scalingPolicy);
- FluentIterable<ScalingPolicyResponse> scalingPolicyResponse = policyApi.create(scalingPolicies);
+ FluentIterable<ScalingPolicy> scalingPolicyResponse = policyApi.create(scalingPolicies);
assertNotNull(scalingPolicyResponse.iterator().next().getId());
assertEquals(scalingPolicyResponse.iterator().next().getCooldown(), 3);
assertEquals(scalingPolicyResponse.iterator().next().getTarget(), "1");
@@ -230,7 +230,7 @@ public class ScalingPolicyApiLiveTest extends BaseAutoscaleApiLiveTest {
PolicyApi policyApi = api.getPolicyApiForZoneAndGroup(zone, created.get(zone).get(0).getId());
- FluentIterable<ScalingPolicyResponse> scalingPolicyResponse = policyApi.list();
+ FluentIterable<ScalingPolicy> scalingPolicyResponse = policyApi.list();
assertNotNull(scalingPolicyResponse.iterator().next().getId());
}
}
@@ -242,8 +242,8 @@ public class ScalingPolicyApiLiveTest extends BaseAutoscaleApiLiveTest {
PolicyApi policyApi = api.getPolicyApiForZoneAndGroup(zone, created.get(zone).get(0).getId());
assertNotNull(policyApi);
- ScalingPolicyResponse listResponse = policyApi.list().iterator().next();
- ScalingPolicyResponse getResponse = policyApi.get(listResponse.getId());
+ ScalingPolicy listResponse = policyApi.list().iterator().next();
+ ScalingPolicy getResponse = policyApi.get(listResponse.getId());
assertEquals(listResponse.getId(), getResponse.getId());
assertEquals(listResponse.getName(), getResponse.getName());
assertEquals(listResponse.getCooldown(), getResponse.getCooldown());
@@ -260,9 +260,9 @@ public class ScalingPolicyApiLiveTest extends BaseAutoscaleApiLiveTest {
PolicyApi policyApi = api.getPolicyApiForZoneAndGroup(zone, created.get(zone).get(0).getId());
- List<ScalingPolicy> scalingPolicies = Lists.newArrayList();
+ List<CreateScalingPolicy> scalingPolicies = Lists.newArrayList();
- ScalingPolicy scalingPolicy = ScalingPolicy.builder()
+ CreateScalingPolicy scalingPolicy = CreateScalingPolicy.builder()
.cooldown(3)
.type(ScalingPolicyType.WEBHOOK)
.name("scale up by one server")
@@ -271,7 +271,7 @@ public class ScalingPolicyApiLiveTest extends BaseAutoscaleApiLiveTest {
.build();
scalingPolicies.add(scalingPolicy);
- ScalingPolicy updated = ScalingPolicy.builder()
+ CreateScalingPolicy updated = CreateScalingPolicy.builder()
.cooldown(3)
.type(ScalingPolicyType.WEBHOOK)
.name("scale up by 2 PERCENT server")
@@ -280,14 +280,14 @@ public class ScalingPolicyApiLiveTest extends BaseAutoscaleApiLiveTest {
.build();
- FluentIterable<ScalingPolicyResponse> scalingPolicyResponse = policyApi.create(scalingPolicies);
+ FluentIterable<ScalingPolicy> scalingPolicyResponse = policyApi.create(scalingPolicies);
String policyId = scalingPolicyResponse.iterator().next().getId();
assertNotNull(policyId);
boolean result = policyApi.update(policyId, updated);
assertTrue(result);
- ScalingPolicyResponse updatedResponse = policyApi.get(policyId);
+ ScalingPolicy updatedResponse = policyApi.get(policyId);
assertNotNull(updatedResponse.getId());
assertEquals(updatedResponse.getCooldown(), 3);
@@ -304,9 +304,9 @@ public class ScalingPolicyApiLiveTest extends BaseAutoscaleApiLiveTest {
PolicyApi policyApi = api.getPolicyApiForZoneAndGroup(zone, created.get(zone).get(0).getId());
- List<ScalingPolicy> scalingPolicies = Lists.newArrayList();
+ List<CreateScalingPolicy> scalingPolicies = Lists.newArrayList();
- ScalingPolicy scalingPolicy = ScalingPolicy.builder()
+ CreateScalingPolicy scalingPolicy = CreateScalingPolicy.builder()
.cooldown(3)
.type(ScalingPolicyType.WEBHOOK)
.name("scale up by one server")
@@ -315,7 +315,7 @@ public class ScalingPolicyApiLiveTest extends BaseAutoscaleApiLiveTest {
.build();
scalingPolicies.add(scalingPolicy);
- FluentIterable<ScalingPolicyResponse> scalingPolicyResponse = policyApi.create(scalingPolicies);
+ FluentIterable<ScalingPolicy> scalingPolicyResponse = policyApi.create(scalingPolicies);
String policyId = scalingPolicyResponse.iterator().next().getId();
assertNotNull(policyId);
@@ -330,9 +330,9 @@ public class ScalingPolicyApiLiveTest extends BaseAutoscaleApiLiveTest {
PolicyApi policyApi = api.getPolicyApiForZoneAndGroup(zone, created.get(zone).get(0).getId());
- List<ScalingPolicy> scalingPolicies = Lists.newArrayList();
+ List<CreateScalingPolicy> scalingPolicies = Lists.newArrayList();
- ScalingPolicy scalingPolicy = ScalingPolicy.builder()
+ CreateScalingPolicy scalingPolicy = CreateScalingPolicy.builder()
.cooldown(3)
.type(ScalingPolicyType.WEBHOOK)
.name("scale up by 0 server")
@@ -341,7 +341,7 @@ public class ScalingPolicyApiLiveTest extends BaseAutoscaleApiLiveTest {
.build();
scalingPolicies.add(scalingPolicy);
- FluentIterable<ScalingPolicyResponse> scalingPolicyResponse = policyApi.create(scalingPolicies);
+ FluentIterable<ScalingPolicy> scalingPolicyResponse = policyApi.create(scalingPolicies);
String policyId = scalingPolicyResponse.iterator().next().getId();
assertNotNull(policyId);
@@ -358,15 +358,15 @@ public class ScalingPolicyApiLiveTest extends BaseAutoscaleApiLiveTest {
for (Group group : created.get(zone)) {
PolicyApi policyApi = api.getPolicyApiForZoneAndGroup(zone, group.getId());
if(policyApi == null)continue;
- for(ScalingPolicyResponse sgr : policyApi.list()) {
+ for(ScalingPolicy sgr : policyApi.list()) {
if(!policyApi.delete(sgr.getId())) {
System.out.println("Could not delete an autoscale policy after tests!");
}
}
- List<ScalingPolicy> scalingPolicies = Lists.newArrayList();
+ List<CreateScalingPolicy> scalingPolicies = Lists.newArrayList();
- ScalingPolicy scalingPolicy = ScalingPolicy.builder()
+ CreateScalingPolicy scalingPolicy = CreateScalingPolicy.builder()
.cooldown(3)
.type(ScalingPolicyType.WEBHOOK)
.name("0 machines")
@@ -375,7 +375,7 @@ public class ScalingPolicyApiLiveTest extends BaseAutoscaleApiLiveTest {
.build();
scalingPolicies.add(scalingPolicy);
- FluentIterable<ScalingPolicyResponse> scalingPolicyResponse = policyApi.create(scalingPolicies);
+ FluentIterable<ScalingPolicy> scalingPolicyResponse = policyApi.create(scalingPolicies);
String policyId = scalingPolicyResponse.first().get().getId();
Uninterruptibles.sleepUninterruptibly(10, TimeUnit.SECONDS);
http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/90c7a3a5/rackspace-autoscale/src/test/java/org/jclouds/rackspace/autoscale/v1/features/ScalingPolicyApiMockTest.java
----------------------------------------------------------------------
diff --git a/rackspace-autoscale/src/test/java/org/jclouds/rackspace/autoscale/v1/features/ScalingPolicyApiMockTest.java b/rackspace-autoscale/src/test/java/org/jclouds/rackspace/autoscale/v1/features/ScalingPolicyApiMockTest.java
index 0a324cc..f62f287 100644
--- a/rackspace-autoscale/src/test/java/org/jclouds/rackspace/autoscale/v1/features/ScalingPolicyApiMockTest.java
+++ b/rackspace-autoscale/src/test/java/org/jclouds/rackspace/autoscale/v1/features/ScalingPolicyApiMockTest.java
@@ -26,11 +26,11 @@ import java.io.IOException;
import java.util.List;
import org.jclouds.rackspace.autoscale.v1.AutoscaleApi;
+import org.jclouds.rackspace.autoscale.v1.domain.CreateScalingPolicy;
+import org.jclouds.rackspace.autoscale.v1.domain.CreateScalingPolicy.ScalingPolicyScheduleType;
+import org.jclouds.rackspace.autoscale.v1.domain.CreateScalingPolicy.ScalingPolicyTargetType;
+import org.jclouds.rackspace.autoscale.v1.domain.CreateScalingPolicy.ScalingPolicyType;
import org.jclouds.rackspace.autoscale.v1.domain.ScalingPolicy;
-import org.jclouds.rackspace.autoscale.v1.domain.ScalingPolicy.ScalingPolicyScheduleType;
-import org.jclouds.rackspace.autoscale.v1.domain.ScalingPolicy.ScalingPolicyTargetType;
-import org.jclouds.rackspace.autoscale.v1.domain.ScalingPolicy.ScalingPolicyType;
-import org.jclouds.rackspace.autoscale.v1.domain.ScalingPolicyResponse;
import org.jclouds.rackspace.autoscale.v1.internal.BaseAutoscaleApiMockTest;
import org.testng.annotations.Test;
@@ -56,9 +56,9 @@ public class ScalingPolicyApiMockTest extends BaseAutoscaleApiMockTest {
AutoscaleApi autoscaleApi = api(server.getUrl("/").toString(), "rackspace-autoscale", overrides);
PolicyApi api = autoscaleApi.getPolicyApiForZoneAndGroup("DFW", "groupId1");
- List<ScalingPolicy> scalingPolicies = Lists.newArrayList();
+ List<CreateScalingPolicy> scalingPolicies = Lists.newArrayList();
- ScalingPolicy scalingPolicy = ScalingPolicy.builder()
+ CreateScalingPolicy scalingPolicy = CreateScalingPolicy.builder()
.cooldown(1800)
.type(ScalingPolicyType.WEBHOOK)
.name("scale up by one server")
@@ -67,7 +67,7 @@ public class ScalingPolicyApiMockTest extends BaseAutoscaleApiMockTest {
.build();
scalingPolicies.add(scalingPolicy);
- FluentIterable<ScalingPolicyResponse> scalingPolicyResponse = api.create(scalingPolicies);
+ FluentIterable<ScalingPolicy> scalingPolicyResponse = api.create(scalingPolicies);
/*
* Check request
@@ -99,9 +99,9 @@ public class ScalingPolicyApiMockTest extends BaseAutoscaleApiMockTest {
AutoscaleApi autoscaleApi = api(server.getUrl("/").toString(), "rackspace-autoscale", overrides);
PolicyApi api = autoscaleApi.getPolicyApiForZoneAndGroup("DFW", "groupId1");
- List<ScalingPolicy> scalingPolicies = Lists.newArrayList();
+ List<CreateScalingPolicy> scalingPolicies = Lists.newArrayList();
- ScalingPolicy scalingPolicy = ScalingPolicy.builder()
+ CreateScalingPolicy scalingPolicy = CreateScalingPolicy.builder()
.cooldown(1800)
.type(ScalingPolicyType.WEBHOOK)
.name("scale up by one server")
@@ -110,7 +110,7 @@ public class ScalingPolicyApiMockTest extends BaseAutoscaleApiMockTest {
.build();
scalingPolicies.add(scalingPolicy);
- FluentIterable<ScalingPolicyResponse> scalingPolicyResponse = api.create(scalingPolicies);
+ FluentIterable<ScalingPolicy> scalingPolicyResponse = api.create(scalingPolicies);
/*
* Check request
@@ -136,9 +136,9 @@ public class ScalingPolicyApiMockTest extends BaseAutoscaleApiMockTest {
AutoscaleApi autoscaleApi = api(server.getUrl("/").toString(), "rackspace-autoscale", overrides);
PolicyApi api = autoscaleApi.getPolicyApiForZoneAndGroup("DFW", "groupId1");
- List<ScalingPolicy> scalingPolicies = Lists.newArrayList();
+ List<CreateScalingPolicy> scalingPolicies = Lists.newArrayList();
- ScalingPolicy scalingPolicy = ScalingPolicy.builder()
+ CreateScalingPolicy scalingPolicy = CreateScalingPolicy.builder()
.cooldown(2)
.type(ScalingPolicyType.SCHEDULE)
.name("scale down by 5.5 percent at 11pm")
@@ -148,7 +148,7 @@ public class ScalingPolicyApiMockTest extends BaseAutoscaleApiMockTest {
.build();
scalingPolicies.add(scalingPolicy);
- FluentIterable<ScalingPolicyResponse> scalingPolicyResponse = api.create(scalingPolicies);
+ FluentIterable<ScalingPolicy> scalingPolicyResponse = api.create(scalingPolicies);
/*
* Check request
@@ -183,9 +183,9 @@ public class ScalingPolicyApiMockTest extends BaseAutoscaleApiMockTest {
AutoscaleApi autoscaleApi = api(server.getUrl("/").toString(), "rackspace-autoscale", overrides);
PolicyApi api = autoscaleApi.getPolicyApiForZoneAndGroup("DFW", "groupId1");
- List<ScalingPolicy> scalingPolicies = Lists.newArrayList();
+ List<CreateScalingPolicy> scalingPolicies = Lists.newArrayList();
- ScalingPolicy scalingPolicy = ScalingPolicy.builder()
+ CreateScalingPolicy scalingPolicy = CreateScalingPolicy.builder()
.cooldown(2)
.type(ScalingPolicyType.SCHEDULE)
.name("scale down by 5.5 percent on the 5th")
@@ -195,7 +195,7 @@ public class ScalingPolicyApiMockTest extends BaseAutoscaleApiMockTest {
.build();
scalingPolicies.add(scalingPolicy);
- FluentIterable<ScalingPolicyResponse> scalingPolicyResponse = api.create(scalingPolicies);
+ FluentIterable<ScalingPolicy> scalingPolicyResponse = api.create(scalingPolicies);
/*
* Check request
@@ -230,7 +230,7 @@ public class ScalingPolicyApiMockTest extends BaseAutoscaleApiMockTest {
AutoscaleApi autoscaleApi = api(server.getUrl("/").toString(), "rackspace-autoscale", overrides);
PolicyApi api = autoscaleApi.getPolicyApiForZoneAndGroup("DFW", "groupId1");
- FluentIterable<ScalingPolicyResponse> scalingPolicyResponse = api.list();
+ FluentIterable<ScalingPolicy> scalingPolicyResponse = api.list();
/*
* Check request
@@ -262,7 +262,7 @@ public class ScalingPolicyApiMockTest extends BaseAutoscaleApiMockTest {
AutoscaleApi autoscaleApi = api(server.getUrl("/").toString(), "rackspace-autoscale", overrides);
PolicyApi api = autoscaleApi.getPolicyApiForZoneAndGroup("DFW", "groupId1");
- FluentIterable<ScalingPolicyResponse> scalingPolicyResponse = api.list();
+ FluentIterable<ScalingPolicy> scalingPolicyResponse = api.list();
/*
* Check request
@@ -288,7 +288,7 @@ public class ScalingPolicyApiMockTest extends BaseAutoscaleApiMockTest {
AutoscaleApi autoscaleApi = api(server.getUrl("/").toString(), "rackspace-autoscale", overrides);
PolicyApi api = autoscaleApi.getPolicyApiForZoneAndGroup("DFW", "groupId1");
- ScalingPolicyResponse scalingPolicyResponse = api.get("policyId");
+ ScalingPolicy scalingPolicyResponse = api.get("policyId");
/*
* Check request
@@ -319,7 +319,7 @@ public class ScalingPolicyApiMockTest extends BaseAutoscaleApiMockTest {
AutoscaleApi autoscaleApi = api(server.getUrl("/").toString(), "rackspace-autoscale", overrides);
PolicyApi api = autoscaleApi.getPolicyApiForZoneAndGroup("DFW", "groupId1");
- ScalingPolicyResponse scalingPolicyResponse = api.get("policyId");
+ ScalingPolicy scalingPolicyResponse = api.get("policyId");
/*
* Check request
@@ -345,7 +345,7 @@ public class ScalingPolicyApiMockTest extends BaseAutoscaleApiMockTest {
AutoscaleApi autoscaleApi = api(server.getUrl("/").toString(), "rackspace-autoscale", overrides);
PolicyApi api = autoscaleApi.getPolicyApiForZoneAndGroup("DFW", "groupId1");
- ScalingPolicy scalingPolicy = ScalingPolicy.builder()
+ CreateScalingPolicy scalingPolicy = CreateScalingPolicy.builder()
.cooldown(6)
.type(ScalingPolicyType.WEBHOOK)
.name("scale down by 5 percent")
@@ -379,7 +379,7 @@ public class ScalingPolicyApiMockTest extends BaseAutoscaleApiMockTest {
AutoscaleApi autoscaleApi = api(server.getUrl("/").toString(), "rackspace-autoscale", overrides);
PolicyApi api = autoscaleApi.getPolicyApiForZoneAndGroup("DFW", "groupId1");
- ScalingPolicy scalingPolicy = ScalingPolicy.builder()
+ CreateScalingPolicy scalingPolicy = CreateScalingPolicy.builder()
.cooldown(6)
.type(ScalingPolicyType.WEBHOOK)
.name("scale down by 5 percent")
http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/90c7a3a5/rackspace-autoscale/src/test/java/org/jclouds/rackspace/autoscale/v1/features/WebhookApiLiveTest.java
----------------------------------------------------------------------
diff --git a/rackspace-autoscale/src/test/java/org/jclouds/rackspace/autoscale/v1/features/WebhookApiLiveTest.java b/rackspace-autoscale/src/test/java/org/jclouds/rackspace/autoscale/v1/features/WebhookApiLiveTest.java
index 58adad6..2e84fd9 100644
--- a/rackspace-autoscale/src/test/java/org/jclouds/rackspace/autoscale/v1/features/WebhookApiLiveTest.java
+++ b/rackspace-autoscale/src/test/java/org/jclouds/rackspace/autoscale/v1/features/WebhookApiLiveTest.java
@@ -36,12 +36,12 @@ import org.jclouds.rackspace.autoscale.v1.domain.LaunchConfiguration;
import org.jclouds.rackspace.autoscale.v1.domain.LaunchConfiguration.LaunchConfigurationType;
import org.jclouds.rackspace.autoscale.v1.domain.LoadBalancer;
import org.jclouds.rackspace.autoscale.v1.domain.Personality;
+import org.jclouds.rackspace.autoscale.v1.domain.CreateScalingPolicy;
+import org.jclouds.rackspace.autoscale.v1.domain.CreateScalingPolicy.ScalingPolicyTargetType;
+import org.jclouds.rackspace.autoscale.v1.domain.CreateScalingPolicy.ScalingPolicyType;
import org.jclouds.rackspace.autoscale.v1.domain.ScalingPolicy;
-import org.jclouds.rackspace.autoscale.v1.domain.ScalingPolicy.ScalingPolicyTargetType;
-import org.jclouds.rackspace.autoscale.v1.domain.ScalingPolicy.ScalingPolicyType;
-import org.jclouds.rackspace.autoscale.v1.domain.ScalingPolicyResponse;
+import org.jclouds.rackspace.autoscale.v1.domain.CreateWebhook;
import org.jclouds.rackspace.autoscale.v1.domain.Webhook;
-import org.jclouds.rackspace.autoscale.v1.domain.WebhookResponse;
import org.jclouds.rackspace.autoscale.v1.internal.BaseAutoscaleApiLiveTest;
import org.jclouds.rackspace.autoscale.v1.utils.AutoscaleUtils;
import org.testng.annotations.AfterClass;
@@ -96,9 +96,9 @@ public class WebhookApiLiveTest extends BaseAutoscaleApiLiveTest {
.contents("VGhpcyBpcyBhIHRlc3QgZmlsZS4=").build()))
.type(LaunchConfigurationType.LAUNCH_SERVER).build();
- List<ScalingPolicy> scalingPolicies = Lists.newArrayList();
+ List<CreateScalingPolicy> scalingPolicies = Lists.newArrayList();
- ScalingPolicy scalingPolicy = ScalingPolicy.builder().cooldown(3).type(ScalingPolicyType.WEBHOOK)
+ CreateScalingPolicy scalingPolicy = CreateScalingPolicy.builder().cooldown(3).type(ScalingPolicyType.WEBHOOK)
.name("scale up by 1").targetType(ScalingPolicyTargetType.INCREMENTAL).target("1").build();
scalingPolicies.add(scalingPolicy);
@@ -161,7 +161,7 @@ public class WebhookApiLiveTest extends BaseAutoscaleApiLiveTest {
for (String zone : api.getConfiguredZones()) {
Group g = created.get(zone).get(0);
WebhookApi webhookApi = api.getWebhookApiForZoneAndGroupAndPolicy(zone, g.getId(), g.getScalingPolicies().iterator().next().getId());
- WebhookResponse webhook = webhookApi.create("test1", ImmutableMap.<String, Object>of("notes", "test metadata")).first().get();
+ Webhook webhook = webhookApi.create("test1", ImmutableMap.<String, Object>of("notes", "test metadata")).first().get();
assertEquals(webhook.getName(), "test1");
assertEquals(webhook.getMetadata().get("notes"), "test metadata");
@@ -173,10 +173,10 @@ public class WebhookApiLiveTest extends BaseAutoscaleApiLiveTest {
for (String zone : api.getConfiguredZones()) {
Group g = created.get(zone).get(0);
WebhookApi webhookApi = api.getWebhookApiForZoneAndGroupAndPolicy(zone, g.getId(), g.getScalingPolicies().iterator().next().getId());
- FluentIterable<WebhookResponse> webhookResponse = webhookApi.create(
+ FluentIterable<Webhook> webhookResponse = webhookApi.create(
ImmutableList.of(
- Webhook.builder().name("test5").metadata(null).build(),
- Webhook.builder().name("test6").metadata(ImmutableMap.<String, Object>of("notes2", "different test")).build()
+ CreateWebhook.builder().name("test5").metadata(null).build(),
+ CreateWebhook.builder().name("test6").metadata(ImmutableMap.<String, Object>of("notes2", "different test")).build()
));
assertEquals(webhookResponse.get(0).getName(), "test5");
@@ -194,7 +194,7 @@ public class WebhookApiLiveTest extends BaseAutoscaleApiLiveTest {
String webhookId = webhookApi.list().first().get().getId();
assertTrue( webhookApi.update(webhookId, "updated_name", ImmutableMap.<String, Object>of()) );
- WebhookResponse webhook= webhookApi.get(webhookId);
+ Webhook webhook= webhookApi.get(webhookId);
assertEquals(webhook.getName(), "updated_name");
assertTrue( webhook.getMetadata().isEmpty() );
}
@@ -206,11 +206,11 @@ public class WebhookApiLiveTest extends BaseAutoscaleApiLiveTest {
Group g = created.get(zone).get(0);
WebhookApi webhookApi;
boolean foundWebhook = false;
- for (ScalingPolicyResponse sp : g.getScalingPolicies()) {
+ for (ScalingPolicy sp : g.getScalingPolicies()) {
webhookApi = api.getWebhookApiForZoneAndGroupAndPolicy(zone, g.getId(), sp.getId());
- WebhookResponse webhookResponse = webhookApi.list().first().get();
+ Webhook webhookResponse = webhookApi.list().first().get();
if (webhookResponse != null) {
- WebhookResponse webhookGet = webhookApi.get(webhookResponse.getId());
+ Webhook webhookGet = webhookApi.get(webhookResponse.getId());
assertEquals(webhookResponse, webhookGet);
foundWebhook = true;
}
@@ -233,7 +233,7 @@ public class WebhookApiLiveTest extends BaseAutoscaleApiLiveTest {
for (String zone : api.getConfiguredZones()) {
Group g = created.get(zone).get(0);
WebhookApi webhookApi = api.getWebhookApiForZoneAndGroupAndPolicy(zone, g.getId(), g.getScalingPolicies().iterator().next().getId());
- WebhookResponse webhook = webhookApi.create("test1", ImmutableMap.<String, Object>of("notes", "test metadata")).first().get();
+ Webhook webhook = webhookApi.create("test1", ImmutableMap.<String, Object>of("notes", "test metadata")).first().get();
assertEquals(webhook.getName(), "test1");
assertEquals(webhook.getMetadata().get("notes"), "test metadata");
@@ -248,7 +248,7 @@ public class WebhookApiLiveTest extends BaseAutoscaleApiLiveTest {
for (String zone : api.getConfiguredZones()) {
Group g = created.get(zone).get(0);
WebhookApi webhookApi = api.getWebhookApiForZoneAndGroupAndPolicy(zone, g.getId(), g.getScalingPolicies().iterator().next().getId());
- WebhookResponse webhook = webhookApi.create("test_execute", ImmutableMap.<String, Object>of("notes", "test metadata")).first().get();
+ Webhook webhook = webhookApi.create("test_execute", ImmutableMap.<String, Object>of("notes", "test metadata")).first().get();
assertTrue( AutoscaleUtils.execute(webhook.getAnonymousExecutionURI().get()) , " for " + webhook + " in " + zone);
}
@@ -259,7 +259,7 @@ public class WebhookApiLiveTest extends BaseAutoscaleApiLiveTest {
for (String zone : api.getConfiguredZones()) {
Group g = created.get(zone).get(0);
WebhookApi webhookApi = api.getWebhookApiForZoneAndGroupAndPolicy(zone, g.getId(), g.getScalingPolicies().iterator().next().getId());
- WebhookResponse webhook = webhookApi.create("test_execute_fail", ImmutableMap.<String, Object>of("notes", "test metadata")).first().get();
+ Webhook webhook = webhookApi.create("test_execute_fail", ImmutableMap.<String, Object>of("notes", "test metadata")).first().get();
URI uri = new URI(webhook.getAnonymousExecutionURI().get().toString() + "123");
assertFalse( AutoscaleUtils.execute(uri) );
@@ -274,15 +274,15 @@ public class WebhookApiLiveTest extends BaseAutoscaleApiLiveTest {
for (Group group : created.get(zone)) {
PolicyApi policyApi = api.getPolicyApiForZoneAndGroup(zone, group.getId());
if(policyApi == null)continue;
- for(ScalingPolicyResponse sgr : policyApi.list()) {
+ for(ScalingPolicy sgr : policyApi.list()) {
if(!policyApi.delete(sgr.getId())) {
System.out.println("Could not delete an autoscale policy after tests!");
}
}
- List<ScalingPolicy> scalingPolicies = Lists.newArrayList();
+ List<CreateScalingPolicy> scalingPolicies = Lists.newArrayList();
- ScalingPolicy scalingPolicy = ScalingPolicy.builder()
+ CreateScalingPolicy scalingPolicy = CreateScalingPolicy.builder()
.cooldown(2)
.type(ScalingPolicyType.WEBHOOK)
.name("0 machines")
@@ -291,7 +291,7 @@ public class WebhookApiLiveTest extends BaseAutoscaleApiLiveTest {
.build();
scalingPolicies.add(scalingPolicy);
- FluentIterable<ScalingPolicyResponse> scalingPolicyResponse = policyApi.create(scalingPolicies);
+ FluentIterable<ScalingPolicy> scalingPolicyResponse = policyApi.create(scalingPolicies);
String policyId = scalingPolicyResponse.iterator().next().getId();
Uninterruptibles.sleepUninterruptibly(10, TimeUnit.SECONDS);
http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/90c7a3a5/rackspace-autoscale/src/test/java/org/jclouds/rackspace/autoscale/v1/features/WebhookApiMockTest.java
----------------------------------------------------------------------
diff --git a/rackspace-autoscale/src/test/java/org/jclouds/rackspace/autoscale/v1/features/WebhookApiMockTest.java b/rackspace-autoscale/src/test/java/org/jclouds/rackspace/autoscale/v1/features/WebhookApiMockTest.java
index de3a3db..da39ec3 100644
--- a/rackspace-autoscale/src/test/java/org/jclouds/rackspace/autoscale/v1/features/WebhookApiMockTest.java
+++ b/rackspace-autoscale/src/test/java/org/jclouds/rackspace/autoscale/v1/features/WebhookApiMockTest.java
@@ -24,8 +24,8 @@ import static org.testng.Assert.assertTrue;
import java.io.IOException;
import org.jclouds.rackspace.autoscale.v1.AutoscaleApi;
+import org.jclouds.rackspace.autoscale.v1.domain.CreateWebhook;
import org.jclouds.rackspace.autoscale.v1.domain.Webhook;
-import org.jclouds.rackspace.autoscale.v1.domain.WebhookResponse;
import org.jclouds.rackspace.autoscale.v1.internal.BaseAutoscaleApiMockTest;
import org.testng.annotations.Test;
@@ -52,7 +52,7 @@ public class WebhookApiMockTest extends BaseAutoscaleApiMockTest {
AutoscaleApi autoscaleApi = api(server.getUrl("/").toString(), "rackspace-autoscale", overrides);
WebhookApi api = autoscaleApi.getWebhookApiForZoneAndGroupAndPolicy("DFW", "1234567890", "321456");
- FluentIterable<WebhookResponse> webhooks = api.create("PagerDuty", ImmutableMap.<String, Object>of("notes", "PagerDuty will fire this webhook"));
+ FluentIterable<Webhook> webhooks = api.create("PagerDuty", ImmutableMap.<String, Object>of("notes", "PagerDuty will fire this webhook"));
/*
* Check request
@@ -79,7 +79,7 @@ public class WebhookApiMockTest extends BaseAutoscaleApiMockTest {
AutoscaleApi autoscaleApi = api(server.getUrl("/").toString(), "rackspace-autoscale", overrides);
WebhookApi api = autoscaleApi.getWebhookApiForZoneAndGroupAndPolicy("DFW", "1234567890", "321456");
- FluentIterable<WebhookResponse> webhooks = api.create("PagerDuty", ImmutableMap.<String, Object>of("notes", "PagerDuty will fire this webhook"));
+ FluentIterable<Webhook> webhooks = api.create("PagerDuty", ImmutableMap.<String, Object>of("notes", "PagerDuty will fire this webhook"));
/*
* Check request
@@ -105,9 +105,9 @@ public class WebhookApiMockTest extends BaseAutoscaleApiMockTest {
AutoscaleApi autoscaleApi = api(server.getUrl("/").toString(), "rackspace-autoscale", overrides);
WebhookApi api = autoscaleApi.getWebhookApiForZoneAndGroupAndPolicy("DFW", "1234567890", "321456");
- FluentIterable<WebhookResponse> webhooks = api.create(ImmutableList.of(
- Webhook.builder().name("PagerDuty").metadata(ImmutableMap.<String, Object>of("notes", "PagerDuty will fire this webhook")).build(),
- Webhook.builder().name("Nagios").metadata(ImmutableMap.<String, Object>of()).build()
+ FluentIterable<Webhook> webhooks = api.create(ImmutableList.of(
+ CreateWebhook.builder().name("PagerDuty").metadata(ImmutableMap.<String, Object>of("notes", "PagerDuty will fire this webhook")).build(),
+ CreateWebhook.builder().name("Nagios").metadata(ImmutableMap.<String, Object>of()).build()
));
/*
@@ -136,9 +136,9 @@ public class WebhookApiMockTest extends BaseAutoscaleApiMockTest {
AutoscaleApi autoscaleApi = api(server.getUrl("/").toString(), "rackspace-autoscale", overrides);
WebhookApi api = autoscaleApi.getWebhookApiForZoneAndGroupAndPolicy("DFW", "1234567890", "321456");
- FluentIterable<WebhookResponse> webhooks = api.create(ImmutableList.of(
- Webhook.builder().name("PagerDuty").metadata(ImmutableMap.<String, Object>of("notes", "PagerDuty will fire this webhook")).build(),
- Webhook.builder().name("Nagios").metadata(ImmutableMap.<String, Object>of()).build()
+ FluentIterable<Webhook> webhooks = api.create(ImmutableList.of(
+ CreateWebhook.builder().name("PagerDuty").metadata(ImmutableMap.<String, Object>of("notes", "PagerDuty will fire this webhook")).build(),
+ CreateWebhook.builder().name("Nagios").metadata(ImmutableMap.<String, Object>of()).build()
));
/*
@@ -165,7 +165,7 @@ public class WebhookApiMockTest extends BaseAutoscaleApiMockTest {
AutoscaleApi autoscaleApi = api(server.getUrl("/").toString(), "rackspace-autoscale", overrides);
WebhookApi api = autoscaleApi.getWebhookApiForZoneAndGroupAndPolicy("DFW", "1234567890", "321456");
- FluentIterable<WebhookResponse> webhooks = api.list();
+ FluentIterable<Webhook> webhooks = api.list();
/*
* Check request
@@ -193,7 +193,7 @@ public class WebhookApiMockTest extends BaseAutoscaleApiMockTest {
AutoscaleApi autoscaleApi = api(server.getUrl("/").toString(), "rackspace-autoscale", overrides);
WebhookApi api = autoscaleApi.getWebhookApiForZoneAndGroupAndPolicy("DFW", "1234567890", "321456");
- FluentIterable<WebhookResponse> webhooks = api.list();
+ FluentIterable<Webhook> webhooks = api.list();
/*
* Check request
@@ -271,7 +271,7 @@ public class WebhookApiMockTest extends BaseAutoscaleApiMockTest {
AutoscaleApi autoscaleApi = api(server.getUrl("/").toString(), "rackspace-autoscale", overrides);
WebhookApi api = autoscaleApi.getWebhookApiForZoneAndGroupAndPolicy("DFW", "1234567890", "321456");
- WebhookResponse webhook = api.get("5555");
+ Webhook webhook = api.get("5555");
/*
* Check request
@@ -298,7 +298,7 @@ public class WebhookApiMockTest extends BaseAutoscaleApiMockTest {
AutoscaleApi autoscaleApi = api(server.getUrl("/").toString(), "rackspace-autoscale", overrides);
WebhookApi api = autoscaleApi.getWebhookApiForZoneAndGroupAndPolicy("DFW", "1234567890", "321456");
- WebhookResponse webhook = api.get("5555");
+ Webhook webhook = api.get("5555");
/*
* Check request
[2/2] git commit: Renames multiple domain classes for consistency
Posted by za...@apache.org.
Renames multiple domain classes for consistency
Project: http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/commit/90c7a3a5
Tree: http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/tree/90c7a3a5
Diff: http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/diff/90c7a3a5
Branch: refs/heads/master
Commit: 90c7a3a5361229c53e93f60fdc0a2ac4e332ac7e
Parents: 2e4f67c
Author: Zack Shoylev <za...@rackspace.com>
Authored: Tue Jan 7 16:25:26 2014 -0600
Committer: Zack Shoylev <za...@rackspace.com>
Committed: Wed Jan 8 13:37:23 2014 -0600
----------------------------------------------------------------------
.../v1/binders/BindScalingPolicyToJson.java | 4 +-
.../v1/binders/BindWebhooksToJson.java | 4 +-
.../v1/domain/CreateScalingPolicy.java | 396 +++++++++++++++++++
.../autoscale/v1/domain/CreateWebhook.java | 134 +++++++
.../rackspace/autoscale/v1/domain/Group.java | 12 +-
.../autoscale/v1/domain/ScalingPolicy.java | 361 ++---------------
.../v1/domain/ScalingPolicyResponse.java | 91 -----
.../rackspace/autoscale/v1/domain/Webhook.java | 126 +++---
.../autoscale/v1/domain/WebhookResponse.java | 106 -----
.../autoscale/v1/features/GroupApi.java | 6 +-
.../autoscale/v1/features/PolicyApi.java | 22 +-
.../autoscale/v1/features/WebhookApi.java | 34 +-
.../v1/functions/ParseGroupResponse.java | 12 +-
.../functions/ParseScalingPoliciesResponse.java | 16 +-
.../functions/ParseScalingPolicyResponse.java | 14 +-
.../autoscale/v1/internal/ParseHelper.java | 10 +-
.../autoscale/v1/utils/AutoscaleUtils.java | 4 +-
.../autoscale/v1/features/GroupApiLiveTest.java | 10 +-
.../autoscale/v1/features/GroupApiMockTest.java | 14 +-
.../v1/features/ScalingPolicyApiLiveTest.java | 66 ++--
.../v1/features/ScalingPolicyApiMockTest.java | 44 +--
.../v1/features/WebhookApiLiveTest.java | 42 +-
.../v1/features/WebhookApiMockTest.java | 26 +-
23 files changed, 777 insertions(+), 777 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/90c7a3a5/rackspace-autoscale/src/main/java/org/jclouds/rackspace/autoscale/v1/binders/BindScalingPolicyToJson.java
----------------------------------------------------------------------
diff --git a/rackspace-autoscale/src/main/java/org/jclouds/rackspace/autoscale/v1/binders/BindScalingPolicyToJson.java b/rackspace-autoscale/src/main/java/org/jclouds/rackspace/autoscale/v1/binders/BindScalingPolicyToJson.java
index ec77508..2a598c1 100644
--- a/rackspace-autoscale/src/main/java/org/jclouds/rackspace/autoscale/v1/binders/BindScalingPolicyToJson.java
+++ b/rackspace-autoscale/src/main/java/org/jclouds/rackspace/autoscale/v1/binders/BindScalingPolicyToJson.java
@@ -19,7 +19,7 @@ package org.jclouds.rackspace.autoscale.v1.binders;
import java.util.Map;
import org.jclouds.http.HttpRequest;
-import org.jclouds.rackspace.autoscale.v1.domain.ScalingPolicy;
+import org.jclouds.rackspace.autoscale.v1.domain.CreateScalingPolicy;
import org.jclouds.rackspace.autoscale.v1.internal.ParseHelper;
import org.jclouds.rest.MapBinder;
import org.jclouds.rest.binders.BindToJsonPayload;
@@ -41,7 +41,7 @@ public class BindScalingPolicyToJson implements MapBinder {
@Override
public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) {
- ScalingPolicy scalingPolicy = (ScalingPolicy) postParams.get("scalingPolicy");
+ CreateScalingPolicy scalingPolicy = (CreateScalingPolicy) postParams.get("scalingPolicy");
return jsonBinder.bindToRequest(request, ParseHelper.buildScalingPolicyMap(scalingPolicy));
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/90c7a3a5/rackspace-autoscale/src/main/java/org/jclouds/rackspace/autoscale/v1/binders/BindWebhooksToJson.java
----------------------------------------------------------------------
diff --git a/rackspace-autoscale/src/main/java/org/jclouds/rackspace/autoscale/v1/binders/BindWebhooksToJson.java b/rackspace-autoscale/src/main/java/org/jclouds/rackspace/autoscale/v1/binders/BindWebhooksToJson.java
index 2185b67..6fd9904 100644
--- a/rackspace-autoscale/src/main/java/org/jclouds/rackspace/autoscale/v1/binders/BindWebhooksToJson.java
+++ b/rackspace-autoscale/src/main/java/org/jclouds/rackspace/autoscale/v1/binders/BindWebhooksToJson.java
@@ -20,7 +20,7 @@ import java.util.List;
import java.util.Map;
import org.jclouds.http.HttpRequest;
-import org.jclouds.rackspace.autoscale.v1.domain.Webhook;
+import org.jclouds.rackspace.autoscale.v1.domain.CreateWebhook;
import org.jclouds.rest.MapBinder;
import org.jclouds.rest.binders.BindToJsonPayload;
@@ -47,7 +47,7 @@ public class BindWebhooksToJson implements MapBinder {
// Refactoring will depend on whether this call will change any further.
public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) {
ImmutableList.Builder<Map<String, Object>> webhookListBuilder = ImmutableList.builder();
- for(Webhook webhook : (List<Webhook>)postParams.get("webhooks") ) {
+ for(CreateWebhook webhook : (List<CreateWebhook>)postParams.get("webhooks") ) {
ImmutableMap.Builder<String, Object> webhookMap = ImmutableMap.builder();
webhookMap.put("name", webhook.getName());
if(!webhook.getMetadata().isEmpty()) {
http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/90c7a3a5/rackspace-autoscale/src/main/java/org/jclouds/rackspace/autoscale/v1/domain/CreateScalingPolicy.java
----------------------------------------------------------------------
diff --git a/rackspace-autoscale/src/main/java/org/jclouds/rackspace/autoscale/v1/domain/CreateScalingPolicy.java b/rackspace-autoscale/src/main/java/org/jclouds/rackspace/autoscale/v1/domain/CreateScalingPolicy.java
new file mode 100644
index 0000000..33e824b
--- /dev/null
+++ b/rackspace-autoscale/src/main/java/org/jclouds/rackspace/autoscale/v1/domain/CreateScalingPolicy.java
@@ -0,0 +1,396 @@
+/*
+ * 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.rackspace.autoscale.v1.domain;
+
+import static com.google.common.base.Preconditions.checkArgument;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.beans.ConstructorProperties;
+import java.util.EnumSet;
+import java.util.Map;
+
+
+import com.google.common.base.Objects;
+import com.google.common.base.Objects.ToStringHelper;
+import com.google.common.base.Optional;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.Maps;
+
+/**
+ * Auto Scale ScalingPolicy. This class is used for requests.
+ *
+ * @see GroupApi#create(GroupConfiguration, LaunchConfiguration, java.util.List)
+ * @see Group#getScalingPolicies()
+ * @see ScalingPolicy
+ * @author Zack Shoylev
+ */
+public class CreateScalingPolicy implements Comparable<CreateScalingPolicy> {
+ private final String name;
+ private final ScalingPolicyType type;
+ private final int cooldown;
+ private final String target;
+ private final ScalingPolicyTargetType targetType;
+ private final Map<String, String> args;
+
+ @ConstructorProperties({
+ "name", "type", "cooldown", "target", "targetType", "args"
+ })
+ protected CreateScalingPolicy(String name, ScalingPolicyType type, int cooldown, String target, ScalingPolicyTargetType targetType, Map<String, String> args) {
+ this.name = checkNotNull(name, "name required");
+ this.type = type;
+ checkArgument(cooldown >= 0, "cooldown should be non-negative");
+ this.cooldown = cooldown;
+ this.target = target;
+ this.targetType = targetType;
+ this.args = args;
+ }
+
+ /**
+ * @return the name of this ScalingPolicy.
+ * @see CreateScalingPolicy.Builder#name(String)
+ */
+ public String getName() {
+ return this.name;
+ }
+
+ /**
+ * @return the type for this ScalingPolicy.
+ * @see ScalingPolicyType
+ * @see CreateScalingPolicy.Builder#type(String)
+ */
+ public ScalingPolicyType getType() {
+ return this.type;
+ }
+
+ /**
+ * @return the cooldown for this ScalingPolicy.
+ * @see CreateScalingPolicy.Builder#cooldown(int)
+ */
+ public int getCooldown() {
+ return this.cooldown;
+ }
+
+ /**
+ * @return the target for this ScalingPolicy. This is a numeric value, but could represent a 0-100% for some target types. Scale-down policies might have negative values.
+ *
+ * @see CreateScalingPolicy.Builder#target(int)
+ */
+ public String getTarget() {
+ return this.target;
+ }
+
+ /**
+ * @return the target type for this ScalingPolicy.
+ * @see ScalingPolicyTargetType
+ * @see CreateScalingPolicy.Builder#targetType(int)
+ */
+ public ScalingPolicyTargetType getTargetType() {
+ return this.targetType;
+ }
+
+ /**
+ * @return The scheduling string, if any.
+ * @see CreateScalingPolicy.Builder#atSchedule(String)
+ * @see CreateScalingPolicy.Builder#cronSchedule(String)
+ */
+ protected Map<String, String> getSchedulingArgs() {
+ return this.args;
+ }
+
+ /**
+ * @return The scheduling string, if any.
+ * @see CreateScalingPolicy.Builder#atSchedule(String)
+ * @see CreateScalingPolicy.Builder#cronSchedule(String)
+ */
+ public String getSchedulingString() {
+ if (this.args != null) {
+ for (Map.Entry<String, String> entry : this.args.entrySet()) {
+ return entry.getValue();
+ }
+ }
+ return null;
+ }
+
+ /**
+ * @return The type of the schedule this policy uses.
+ */
+ public ScalingPolicyScheduleType getSchedulingType() {
+ if(this.args != null) {
+ for (ScalingPolicyScheduleType type : ScalingPolicyScheduleType.values()) {
+ if (this.args.get(type.toString()) != null) {
+ return type;
+ }
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(name, type, cooldown, target, targetType, args);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) return true;
+ if (obj == null || getClass() != obj.getClass()) return false;
+ CreateScalingPolicy that = CreateScalingPolicy.class.cast(obj);
+ return Objects.equal(this.name, that.name) &&
+ Objects.equal(this.type, that.type) &&
+ Objects.equal(this.cooldown, that.cooldown) &&
+ Objects.equal(this.target, that.target) &&
+ Objects.equal(this.targetType, that.targetType) &&
+ Objects.equal(this.args, that.args);
+ }
+
+ protected ToStringHelper string() {
+ return Objects.toStringHelper(this)
+ .add("name", name)
+ .add("type", type)
+ .add("cooldown", cooldown)
+ .add("target", target)
+ .add("targetType", targetType)
+ .add("args", args);
+ }
+
+ @Override
+ public String toString() {
+ return string().toString();
+ }
+
+ public static Builder builder() {
+ return new Builder();
+ }
+
+ public Builder toBuilder() {
+ return new Builder().fromScalingPolicy(this);
+ }
+
+ public static class Builder {
+ protected String name;
+ protected ScalingPolicyType type;
+ protected int cooldown;
+ protected String target;
+ protected ScalingPolicyTargetType targetType;
+ protected Map<String, String> args;
+
+ /**
+ * @param name The name of this ScalingPolicy.
+ * @return The builder object.
+ * @see CreateScalingPolicy#getName()
+ */
+ public Builder name(String name) {
+ this.name = name;
+ return this;
+ }
+
+ /**
+ * @param type The type for this ScalingPolicy.
+ * @return The builder object.
+ * @see ScalingPolicyType
+ * @see CreateScalingPolicy#getType()
+ */
+ public Builder type(ScalingPolicyType type) {
+ this.type = type;
+ return this;
+ }
+
+ /**
+ * @param cooldown The cooldown of this ScalingPolicy.
+ * @return The builder object.
+ * @see CreateScalingPolicy#getCooldown()
+ */
+ public Builder cooldown(int cooldown) {
+ this.cooldown = cooldown;
+ return this;
+ }
+
+ /**
+ * @param target The target of this ScalingPolicy.
+ * @return The builder object.
+ * @see CreateScalingPolicy#getTarget()
+ */
+ public Builder target(String target) {
+ this.target = target;
+ return this;
+ }
+
+ /**
+ * @param targetType The target type of this ScalingPolicy.
+ * @return The builder object.
+ * @see ScalingPolicyTargetType
+ * @see CreateScalingPolicy#getTargetType()
+ */
+ public Builder targetType(ScalingPolicyTargetType targetType) {
+ this.targetType = targetType;
+ return this;
+ }
+
+ /**
+ * @param cron This parameter specifies the recurring time when the policy will be executed as a cron entry.
+ * For example, if this is parameter is set to "1 0 * * *",
+ * the policy will be executed at one minute past midnight (00:01)
+ * every day of the month, and every day of the week.
+ * You can either provide "cron" or "at" for a given policy, but not both.
+ * @return The builder object.
+ * @see ScalingPolicyTargetType
+ * @see CreateScalingPolicy#getTargetType()
+ * @see <a href="http://en.wikipedia.org/wiki/Cron">Cron</a>
+ */
+ public Builder cronSchedule(String cron) {
+ this.type = ScalingPolicyType.SCHEDULE;
+ this.args = ImmutableMap.of("cron", cron);
+ return this;
+ }
+
+ /**
+ * @param at This parameter specifies the time at which this policy will be executed.
+ * This property is mutually exclusive with the "cron" parameter.
+ * You can either provide "cron" or "at" for a given policy, but not both.
+ * Example date string: "2013-12-05T03:12:00Z"
+ * @return The builder object.
+ * @see ScalingPolicyTargetType
+ * @see CreateScalingPolicy#getTargetType()
+ */
+ public Builder atSchedule(String at) {
+ this.type = ScalingPolicyType.SCHEDULE;
+ this.args = ImmutableMap.of("at", at);
+ return this;
+ }
+
+ private Builder scheduleArgs(Map<String, String> args) {
+ this.args = args;
+ return this;
+ }
+
+ /**
+ * @return A new ScalingPolicy object.
+ */
+ public CreateScalingPolicy build() {
+ return new CreateScalingPolicy(name, type, cooldown, target, targetType, args);
+ }
+
+ /**
+ * @param in The target scaling policy
+ * @return The scaling policy builder
+ */
+ public Builder fromScalingPolicy(CreateScalingPolicy in) {
+ return this
+ .name(in.getName())
+ .type(in.getType())
+ .cooldown(in.getCooldown())
+ .target(in.getTarget())
+ .targetType(in.getTargetType())
+ .scheduleArgs(in.getSchedulingArgs());
+ }
+ }
+
+ @Override
+ public int compareTo(CreateScalingPolicy that) {
+ return this.getName().compareTo(that.getName());
+ }
+
+ /**
+ * Enumerates different types of scaling policies
+ */
+ public static enum ScalingPolicyType {
+ WEBHOOK("webhook"),
+ SCHEDULE("schedule");
+
+ private final String name;
+
+ private ScalingPolicyType(String name) {
+ this.name = name;
+ }
+
+ public String toString() {
+ return name;
+ }
+
+ public static Optional<ScalingPolicyType> getByValue(String value){
+ for (final ScalingPolicyType element : EnumSet.allOf(ScalingPolicyType.class)) {
+ if (element.toString().equals(value)) {
+ return Optional.of(element);
+ }
+ }
+ return Optional.absent();
+ }
+ }
+
+ /**
+ * Enumerates different types of targets a policy might have
+ */
+ public static enum ScalingPolicyTargetType {
+ INCREMENTAL("change"),
+ DESIRED_CAPACITY("desiredCapacity"),
+ PERCENT_CHANGE("changePercent");
+
+ private final String name;
+
+ private ScalingPolicyTargetType(String name) {
+ this.name = name;
+ }
+
+ public String toString() {
+ return name;
+ }
+
+ public static Optional<ScalingPolicyTargetType> getByValue(String value){
+ for (final ScalingPolicyTargetType element : EnumSet.allOf(ScalingPolicyTargetType.class)) {
+ if (element.toString().equals(value)) {
+ return Optional.of(element);
+ }
+ }
+ return Optional.absent();
+ }
+ }
+
+ /**
+ * Enumerates different types of targets a policy might have
+ */
+ public static enum ScalingPolicyScheduleType {
+ /**
+ * Example: "1 0 * * *"
+ * @see ScalingPolicy.Builder#cronSchedule(String)
+ */
+ AT("at"),
+ /**
+ * Example date string: "2013-12-05T03:12:00Z"
+ * @see ScalingPolicy.Builder#atSchedule(String)
+ */
+ CRON("cron");
+
+ private final String name;
+
+ private ScalingPolicyScheduleType(String name) {
+ this.name = name;
+ }
+
+ public String toString() {
+ return name;
+ }
+
+ public static Optional<ScalingPolicyTargetType> getByValue(String value){
+ for (final ScalingPolicyTargetType element : EnumSet.allOf(ScalingPolicyTargetType.class)) {
+ if (element.toString().equals(value)) {
+ return Optional.of(element);
+ }
+ }
+ return Optional.absent();
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/90c7a3a5/rackspace-autoscale/src/main/java/org/jclouds/rackspace/autoscale/v1/domain/CreateWebhook.java
----------------------------------------------------------------------
diff --git a/rackspace-autoscale/src/main/java/org/jclouds/rackspace/autoscale/v1/domain/CreateWebhook.java b/rackspace-autoscale/src/main/java/org/jclouds/rackspace/autoscale/v1/domain/CreateWebhook.java
new file mode 100644
index 0000000..4e6ae12
--- /dev/null
+++ b/rackspace-autoscale/src/main/java/org/jclouds/rackspace/autoscale/v1/domain/CreateWebhook.java
@@ -0,0 +1,134 @@
+/*
+ * 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.rackspace.autoscale.v1.domain;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.beans.ConstructorProperties;
+import java.util.Map;
+
+import org.jclouds.javax.annotation.Nullable;
+
+import com.google.common.base.Objects;
+import com.google.common.base.Objects.ToStringHelper;
+import com.google.common.collect.ImmutableMap;
+
+/**
+ * An Autoscale Webhook for a specific group and policy.
+ *
+ * @see Group
+ * @see CreateScalingPolicy
+ * @author Zack Shoylev
+ */
+public class CreateWebhook {
+ private final String name;
+ private final ImmutableMap<String, Object> metadata;
+
+ @ConstructorProperties({ "name", "metadata" })
+ protected CreateWebhook(String name, @Nullable Map<String, Object> metadata) {
+ this.name = checkNotNull(name, "name should not be null");
+ if (metadata == null) {
+ this.metadata = ImmutableMap.of();
+ } else {
+ this.metadata = ImmutableMap.copyOf(metadata);
+ }
+ }
+
+ /**
+ * @return the name of this Webhook.
+ * @see CreateWebhook.Builder#name(String)
+ */
+ public String getName() {
+ return this.name;
+ }
+
+ /**
+ * @return the metadata for this Webhook.
+ * @see CreateWebhook.Builder#metadata(Map)
+ */
+ public ImmutableMap<String, Object> getMetadata() {
+ return this.metadata;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(name, metadata);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null || getClass() != obj.getClass())
+ return false;
+ CreateWebhook that = CreateWebhook.class.cast(obj);
+ return Objects.equal(this.name, that.name) && Objects.equal(this.metadata, that.metadata);
+ }
+
+ protected ToStringHelper string() {
+ return Objects.toStringHelper(this).add("name", name).add("metadata", metadata);
+ }
+
+ @Override
+ public String toString() {
+ return string().toString();
+ }
+
+ public static Builder builder() {
+ return new Builder();
+ }
+
+ public Builder toBuilder() {
+ return new Builder().fromWebhook(this);
+ }
+
+ public static class Builder {
+ protected String name;
+ protected Map<String, Object> metadata;
+
+ /**
+ * @param name The name of this Webhook.
+ * @return The builder object.
+ * @see CreateWebhook#getName()
+ */
+ public Builder name(String name) {
+ this.name = name;
+ return this;
+ }
+
+ /**
+ * @param metadata The metadata of this Webhook.
+ * @return The builder object.
+ * @see CreateWebhook#getMetadata()
+ */
+ public Builder metadata(Map<String, Object> metadata) {
+ this.metadata = metadata;
+ return this;
+ }
+
+ /**
+ * @return A new Webhook object.
+ */
+ public CreateWebhook build() {
+ return new CreateWebhook(name, metadata);
+ }
+
+ public Builder fromWebhook(CreateWebhook in) {
+ return this.name(in.getName()).metadata(in.getMetadata());
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/90c7a3a5/rackspace-autoscale/src/main/java/org/jclouds/rackspace/autoscale/v1/domain/Group.java
----------------------------------------------------------------------
diff --git a/rackspace-autoscale/src/main/java/org/jclouds/rackspace/autoscale/v1/domain/Group.java b/rackspace-autoscale/src/main/java/org/jclouds/rackspace/autoscale/v1/domain/Group.java
index 091143c..b079a91 100644
--- a/rackspace-autoscale/src/main/java/org/jclouds/rackspace/autoscale/v1/domain/Group.java
+++ b/rackspace-autoscale/src/main/java/org/jclouds/rackspace/autoscale/v1/domain/Group.java
@@ -34,11 +34,11 @@ import com.google.common.collect.ImmutableList;
public class Group {
private final String id;
private final ImmutableList<Link> links;
- private final ImmutableList<ScalingPolicyResponse> scalingPolicy;
+ private final ImmutableList<ScalingPolicy> scalingPolicy;
private final GroupConfiguration groupConfiguration;
private final LaunchConfiguration launchConfiguration;
- protected Group(String id, ImmutableList<Link> links, ImmutableList<ScalingPolicyResponse> scalingPolicy, GroupConfiguration groupConfiguration, LaunchConfiguration launchConfiguration) {
+ protected Group(String id, ImmutableList<Link> links, ImmutableList<ScalingPolicy> scalingPolicy, GroupConfiguration groupConfiguration, LaunchConfiguration launchConfiguration) {
this.id = id;
this.links = links;
this.scalingPolicy = scalingPolicy;
@@ -66,10 +66,10 @@ public class Group {
/**
* @return A list of scaling policies for this Group.
- * @see ScalingPolicy
+ * @see CreateScalingPolicy
* @see Group.Builder#scalingPolicy(List)
*/
- public ImmutableList<ScalingPolicyResponse> getScalingPolicies() {
+ public ImmutableList<ScalingPolicy> getScalingPolicies() {
return this.scalingPolicy;
}
@@ -133,7 +133,7 @@ public class Group {
public static class Builder {
protected String id;
protected ImmutableList<Link> links;
- protected ImmutableList<ScalingPolicyResponse> scalingPolicy;
+ protected ImmutableList<ScalingPolicy> scalingPolicy;
protected GroupConfiguration groupConfiguration;
protected LaunchConfiguration launchConfiguration;
@@ -162,7 +162,7 @@ public class Group {
* @return The builder object.
* @see Group#getScalingPolicy()
*/
- public Builder scalingPolicy(List<ScalingPolicyResponse> scalingPolicy) {
+ public Builder scalingPolicy(List<ScalingPolicy> scalingPolicy) {
this.scalingPolicy = ImmutableList.copyOf(scalingPolicy);
return this;
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/90c7a3a5/rackspace-autoscale/src/main/java/org/jclouds/rackspace/autoscale/v1/domain/ScalingPolicy.java
----------------------------------------------------------------------
diff --git a/rackspace-autoscale/src/main/java/org/jclouds/rackspace/autoscale/v1/domain/ScalingPolicy.java b/rackspace-autoscale/src/main/java/org/jclouds/rackspace/autoscale/v1/domain/ScalingPolicy.java
index 6420ee3..acbf634 100644
--- a/rackspace-autoscale/src/main/java/org/jclouds/rackspace/autoscale/v1/domain/ScalingPolicy.java
+++ b/rackspace-autoscale/src/main/java/org/jclouds/rackspace/autoscale/v1/domain/ScalingPolicy.java
@@ -16,132 +16,56 @@
*/
package org.jclouds.rackspace.autoscale.v1.domain;
-import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
import java.beans.ConstructorProperties;
-import java.util.EnumSet;
+import java.util.List;
import java.util.Map;
+import org.jclouds.openstack.v2_0.domain.Link;
import com.google.common.base.Objects;
import com.google.common.base.Objects.ToStringHelper;
-import com.google.common.base.Optional;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.Maps;
+import com.google.common.collect.ImmutableList;
/**
- * Auto Scale ScalingPolicy. This class is used for requests.
+ * Autoscale ScalingPolicyResponse. Extends ScalingPolicy with id and links.
*
- * @see GroupApi#create(GroupConfiguration, LaunchConfiguration, java.util.List)
* @see Group#getScalingPolicies()
- * @see ScalingPolicyResponse
* @author Zack Shoylev
*/
-public class ScalingPolicy implements Comparable<ScalingPolicy>{
- private final String name;
- private final ScalingPolicyType type;
- private final int cooldown;
- private final String target;
- private final ScalingPolicyTargetType targetType;
- private final Map<String, String> args;
+public class ScalingPolicy extends CreateScalingPolicy{
+ private final ImmutableList<Link> links;
+ private final String id;
@ConstructorProperties({
- "name", "type", "cooldown", "target", "targetType", "args"
+ "name", "type", "cooldown", "target", "targetType", "args", "links", "id"
})
- protected ScalingPolicy(String name, ScalingPolicyType type, int cooldown, String target, ScalingPolicyTargetType targetType, Map<String, String> args) {
- this.name = checkNotNull(name, "name required");
- this.type = type;
- checkArgument(cooldown >= 0, "cooldown should be non-negative");
- this.cooldown = cooldown;
- this.target = target;
- this.targetType = targetType;
- this.args = args;
+ public ScalingPolicy(String name, ScalingPolicyType type, int cooldown, String target, ScalingPolicyTargetType targetType, Map<String, String> args, List<Link> links, String id) {
+ super(name, type, cooldown, target, targetType, args);
+ this.id = checkNotNull(id, "id required");
+ this.links = ImmutableList.copyOf(checkNotNull(links, "links required"));
}
/**
- * @return the name of this ScalingPolicy.
- * @see ScalingPolicy.Builder#name(String)
+ * @return the unique id of this ScalingPolicy.
+ * @see ScalingPolicyResponse.Builder#id(String)
*/
- public String getName() {
- return this.name;
+ public String getId() {
+ return this.id;
}
/**
- * @return the type for this ScalingPolicy.
- * @see ScalingPolicyType
- * @see ScalingPolicy.Builder#type(String)
+ * @return the links to this ScalingPolicy.
+ * @see ScalingPolicyResponse.Builder#links(String)
*/
- public ScalingPolicyType getType() {
- return this.type;
- }
-
- /**
- * @return the cooldown for this ScalingPolicy.
- * @see ScalingPolicy.Builder#cooldown(int)
- */
- public int getCooldown() {
- return this.cooldown;
- }
-
- /**
- * @return the target for this ScalingPolicy. This is a numeric value, but could represent a 0-100% for some target types. Scale-down policies might have negative values.
- *
- * @see ScalingPolicy.Builder#target(int)
- */
- public String getTarget() {
- return this.target;
- }
-
- /**
- * @return the target type for this ScalingPolicy.
- * @see ScalingPolicyTargetType
- * @see ScalingPolicy.Builder#targetType(int)
- */
- public ScalingPolicyTargetType getTargetType() {
- return this.targetType;
- }
-
- /**
- * @return The scheduling string, if any.
- * @see ScalingPolicy.Builder#atSchedule(String)
- * @see ScalingPolicy.Builder#cronSchedule(String)
- */
- protected Map<String, String> getSchedulingArgs() {
- return this.args;
- }
-
- /**
- * @return The scheduling string, if any.
- * @see ScalingPolicy.Builder#atSchedule(String)
- * @see ScalingPolicy.Builder#cronSchedule(String)
- */
- public String getSchedulingString() {
- if (this.args != null) {
- for (Map.Entry<String, String> entry : this.args.entrySet()) {
- return entry.getValue();
- }
- }
- return null;
- }
-
- /**
- * @return The type of the schedule this policy uses.
- */
- public ScalingPolicyScheduleType getSchedulingType() {
- if(this.args != null) {
- for (ScalingPolicyScheduleType type : ScalingPolicyScheduleType.values()) {
- if (this.args.get(type.toString()) != null) {
- return type;
- }
- }
- }
- return null;
+ public ImmutableList<Link> getLinks() {
+ return this.links;
}
@Override
public int hashCode() {
- return Objects.hashCode(name, type, cooldown, target, targetType, args);
+ return Objects.hashCode(super.hashCode(), links, id);
}
@Override
@@ -149,248 +73,19 @@ public class ScalingPolicy implements Comparable<ScalingPolicy>{
if (this == obj) return true;
if (obj == null || getClass() != obj.getClass()) return false;
ScalingPolicy that = ScalingPolicy.class.cast(obj);
- return Objects.equal(this.name, that.name) &&
- Objects.equal(this.type, that.type) &&
- Objects.equal(this.cooldown, that.cooldown) &&
- Objects.equal(this.target, that.target) &&
- Objects.equal(this.targetType, that.targetType) &&
- Objects.equal(this.args, that.args);
+ return Objects.equal(this.id, that.id) &&
+ Objects.equal(this.links, that.links) &&
+ super.equals(obj);
}
protected ToStringHelper string() {
- return Objects.toStringHelper(this)
- .add("name", name)
- .add("type", type)
- .add("cooldown", cooldown)
- .add("target", target)
- .add("targetType", targetType)
- .add("args", args);
+ return super.string()
+ .add("links", links)
+ .add("id", id);
}
@Override
public String toString() {
return string().toString();
- }
-
- public static Builder builder() {
- return new Builder();
- }
-
- public Builder toBuilder() {
- return new Builder().fromScalingPolicy(this);
- }
-
- public static class Builder {
- protected String name;
- protected ScalingPolicyType type;
- protected int cooldown;
- protected String target;
- protected ScalingPolicyTargetType targetType;
- protected Map<String, String> args;
-
- /**
- * @param name The name of this ScalingPolicy.
- * @return The builder object.
- * @see ScalingPolicy#getName()
- */
- public Builder name(String name) {
- this.name = name;
- return this;
- }
-
- /**
- * @param type The type for this ScalingPolicy.
- * @return The builder object.
- * @see ScalingPolicyType
- * @see ScalingPolicy#getType()
- */
- public Builder type(ScalingPolicyType type) {
- this.type = type;
- return this;
- }
-
- /**
- * @param cooldown The cooldown of this ScalingPolicy.
- * @return The builder object.
- * @see ScalingPolicy#getCooldown()
- */
- public Builder cooldown(int cooldown) {
- this.cooldown = cooldown;
- return this;
- }
-
- /**
- * @param target The target of this ScalingPolicy.
- * @return The builder object.
- * @see ScalingPolicy#getTarget()
- */
- public Builder target(String target) {
- this.target = target;
- return this;
- }
-
- /**
- * @param targetType The target type of this ScalingPolicy.
- * @return The builder object.
- * @see ScalingPolicyTargetType
- * @see ScalingPolicy#getTargetType()
- */
- public Builder targetType(ScalingPolicyTargetType targetType) {
- this.targetType = targetType;
- return this;
- }
-
- /**
- * @param cron This parameter specifies the recurring time when the policy will be executed as a cron entry.
- * For example, if this is parameter is set to "1 0 * * *",
- * the policy will be executed at one minute past midnight (00:01)
- * every day of the month, and every day of the week.
- * You can either provide "cron" or "at" for a given policy, but not both.
- * @return The builder object.
- * @see ScalingPolicyTargetType
- * @see ScalingPolicy#getTargetType()
- * @see <a href="http://en.wikipedia.org/wiki/Cron">Cron</a>
- */
- public Builder cronSchedule(String cron) {
- this.type = ScalingPolicyType.SCHEDULE;
- this.args = ImmutableMap.of("cron", cron);
- return this;
- }
-
- /**
- * @param at This parameter specifies the time at which this policy will be executed.
- * This property is mutually exclusive with the "cron" parameter.
- * You can either provide "cron" or "at" for a given policy, but not both.
- * Example date string: "2013-12-05T03:12:00Z"
- * @return The builder object.
- * @see ScalingPolicyTargetType
- * @see ScalingPolicy#getTargetType()
- */
- public Builder atSchedule(String at) {
- this.type = ScalingPolicyType.SCHEDULE;
- this.args = ImmutableMap.of("at", at);
- return this;
- }
-
- private Builder scheduleArgs(Map<String, String> args) {
- this.args = args;
- return this;
- }
-
- /**
- * @return A new ScalingPolicy object.
- */
- public ScalingPolicy build() {
- return new ScalingPolicy(name, type, cooldown, target, targetType, args);
- }
-
- /**
- * @param in The target scaling policy
- * @return The scaling policy builder
- */
- public Builder fromScalingPolicy(ScalingPolicy in) {
- return this
- .name(in.getName())
- .type(in.getType())
- .cooldown(in.getCooldown())
- .target(in.getTarget())
- .targetType(in.getTargetType())
- .scheduleArgs(in.getSchedulingArgs());
- }
- }
-
- @Override
- public int compareTo(ScalingPolicy that) {
- return this.getName().compareTo(that.getName());
- }
-
- /**
- * Enumerates different types of scaling policies
- */
- public static enum ScalingPolicyType {
- WEBHOOK("webhook"),
- SCHEDULE("schedule");
-
- private final String name;
-
- private ScalingPolicyType(String name) {
- this.name = name;
- }
-
- public String toString() {
- return name;
- }
-
- public static Optional<ScalingPolicyType> getByValue(String value){
- for (final ScalingPolicyType element : EnumSet.allOf(ScalingPolicyType.class)) {
- if (element.toString().equals(value)) {
- return Optional.of(element);
- }
- }
- return Optional.absent();
- }
- }
-
- /**
- * Enumerates different types of targets a policy might have
- */
- public static enum ScalingPolicyTargetType {
- INCREMENTAL("change"),
- DESIRED_CAPACITY("desiredCapacity"),
- PERCENT_CHANGE("changePercent");
-
- private final String name;
-
- private ScalingPolicyTargetType(String name) {
- this.name = name;
- }
-
- public String toString() {
- return name;
- }
-
- public static Optional<ScalingPolicyTargetType> getByValue(String value){
- for (final ScalingPolicyTargetType element : EnumSet.allOf(ScalingPolicyTargetType.class)) {
- if (element.toString().equals(value)) {
- return Optional.of(element);
- }
- }
- return Optional.absent();
- }
- }
-
- /**
- * Enumerates different types of targets a policy might have
- */
- public static enum ScalingPolicyScheduleType {
- /**
- * Example: "1 0 * * *"
- * @see ScalingPolicy.Builder#cronSchedule(String)
- */
- AT("at"),
- /**
- * Example date string: "2013-12-05T03:12:00Z"
- * @see ScalingPolicy.Builder#atSchedule(String)
- */
- CRON("cron");
-
- private final String name;
-
- private ScalingPolicyScheduleType(String name) {
- this.name = name;
- }
-
- public String toString() {
- return name;
- }
-
- public static Optional<ScalingPolicyTargetType> getByValue(String value){
- for (final ScalingPolicyTargetType element : EnumSet.allOf(ScalingPolicyTargetType.class)) {
- if (element.toString().equals(value)) {
- return Optional.of(element);
- }
- }
- return Optional.absent();
- }
- }
+ }
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/90c7a3a5/rackspace-autoscale/src/main/java/org/jclouds/rackspace/autoscale/v1/domain/ScalingPolicyResponse.java
----------------------------------------------------------------------
diff --git a/rackspace-autoscale/src/main/java/org/jclouds/rackspace/autoscale/v1/domain/ScalingPolicyResponse.java b/rackspace-autoscale/src/main/java/org/jclouds/rackspace/autoscale/v1/domain/ScalingPolicyResponse.java
deleted file mode 100644
index 0bf0302..0000000
--- a/rackspace-autoscale/src/main/java/org/jclouds/rackspace/autoscale/v1/domain/ScalingPolicyResponse.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * 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.rackspace.autoscale.v1.domain;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.beans.ConstructorProperties;
-import java.util.List;
-import java.util.Map;
-
-import org.jclouds.openstack.v2_0.domain.Link;
-
-import com.google.common.base.Objects;
-import com.google.common.base.Objects.ToStringHelper;
-import com.google.common.collect.ImmutableList;
-
-/**
- * Autoscale ScalingPolicyResponse. Extends ScalingPolicy with id and links.
- *
- * @see Group#getScalingPolicies()
- * @author Zack Shoylev
- */
-public class ScalingPolicyResponse extends ScalingPolicy{
- private final ImmutableList<Link> links;
- private final String id;
-
- @ConstructorProperties({
- "name", "type", "cooldown", "target", "targetType", "args", "links", "id"
- })
- public ScalingPolicyResponse(String name, ScalingPolicyType type, int cooldown, String target, ScalingPolicyTargetType targetType, Map<String, String> args, List<Link> links, String id) {
- super(name, type, cooldown, target, targetType, args);
- this.id = checkNotNull(id, "id required");
- this.links = ImmutableList.copyOf(checkNotNull(links, "links required"));
- }
-
- /**
- * @return the unique id of this ScalingPolicy.
- * @see ScalingPolicyResponse.Builder#id(String)
- */
- public String getId() {
- return this.id;
- }
-
- /**
- * @return the links to this ScalingPolicy.
- * @see ScalingPolicyResponse.Builder#links(String)
- */
- public ImmutableList<Link> getLinks() {
- return this.links;
- }
-
- @Override
- public int hashCode() {
- return Objects.hashCode(super.hashCode(), links, id);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) return true;
- if (obj == null || getClass() != obj.getClass()) return false;
- ScalingPolicyResponse that = ScalingPolicyResponse.class.cast(obj);
- return Objects.equal(this.id, that.id) &&
- Objects.equal(this.links, that.links) &&
- super.equals(obj);
- }
-
- protected ToStringHelper string() {
- return super.string()
- .add("links", links)
- .add("id", id);
- }
-
- @Override
- public String toString() {
- return string().toString();
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/90c7a3a5/rackspace-autoscale/src/main/java/org/jclouds/rackspace/autoscale/v1/domain/Webhook.java
----------------------------------------------------------------------
diff --git a/rackspace-autoscale/src/main/java/org/jclouds/rackspace/autoscale/v1/domain/Webhook.java b/rackspace-autoscale/src/main/java/org/jclouds/rackspace/autoscale/v1/domain/Webhook.java
index 76bff6f..07e8ab7 100644
--- a/rackspace-autoscale/src/main/java/org/jclouds/rackspace/autoscale/v1/domain/Webhook.java
+++ b/rackspace-autoscale/src/main/java/org/jclouds/rackspace/autoscale/v1/domain/Webhook.java
@@ -19,116 +19,88 @@ package org.jclouds.rackspace.autoscale.v1.domain;
import static com.google.common.base.Preconditions.checkNotNull;
import java.beans.ConstructorProperties;
+import java.net.URI;
+import java.util.List;
import java.util.Map;
import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.openstack.v2_0.domain.Link;
+import org.jclouds.openstack.v2_0.domain.Link.Relation;
import com.google.common.base.Objects;
import com.google.common.base.Objects.ToStringHelper;
-import com.google.common.collect.ImmutableMap;
+import com.google.common.base.Optional;
+import com.google.common.collect.ImmutableList;
/**
- * An Autoscale Webhook for a specific group and policy.
+ * Autoscale WebhookResponse. Extends Webhook with id and links.
*
- * @see Group
- * @see ScalingPolicy
+ * @see CreateWebhook#getWebhooks()
* @author Zack Shoylev
*/
-public class Webhook {
- private final String name;
- private final ImmutableMap<String, Object> metadata;
-
- @ConstructorProperties({ "name", "metadata" })
- protected Webhook(String name, @Nullable Map<String, Object> metadata) {
- this.name = checkNotNull(name, "name should not be null");
- if (metadata == null) {
- this.metadata = ImmutableMap.of();
- } else {
- this.metadata = ImmutableMap.copyOf(metadata);
- }
+public class Webhook extends CreateWebhook {
+ private final ImmutableList<Link> links;
+ private final String id;
+
+ @ConstructorProperties({
+ "name", "metadata", "links", "id"
+ })
+ public Webhook(String name, @Nullable Map<String, Object> metadata, List<Link> links, String id) {
+ super(name, metadata);
+ this.id = checkNotNull(id, "id required");
+ this.links = ImmutableList.copyOf(checkNotNull(links, "links required"));
}
/**
- * @return the name of this Webhook.
- * @see Webhook.Builder#name(String)
+ * @return the unique id of this ScalingPolicy.
+ * @see ScalingPolicyResponse.Builder#id(String)
*/
- public String getName() {
- return this.name;
- }
+ public String getId() {
+ return this.id;
+ }
/**
- * @return the metadata for this Webhook.
- * @see Webhook.Builder#metadata(Map)
+ * The capability Link for the webhook can be called with a POST request to execute the webhook anonymously.
+ * @return the links to this ScalingPolicy.
+ * @see ScalingPolicyResponse.Builder#links(String)
*/
- public ImmutableMap<String, Object> getMetadata() {
- return this.metadata;
+ public ImmutableList<Link> getLinks() {
+ return this.links;
+ }
+
+ public Optional<URI> getAnonymousExecutionURI() {
+ // TODO: Add Relation.CAPABILITY to openstack Link
+ for (Link l : this.links) {
+ if (l.getRelation() == Relation.UNRECOGNIZED) {
+ return Optional.of(l.getHref());
+ }
+ }
+ return Optional.absent();
}
@Override
public int hashCode() {
- return Objects.hashCode(name, metadata);
+ return Objects.hashCode(super.hashCode(), links, id);
}
@Override
public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null || getClass() != obj.getClass())
- return false;
+ if (this == obj) return true;
+ if (obj == null || getClass() != obj.getClass()) return false;
Webhook that = Webhook.class.cast(obj);
- return Objects.equal(this.name, that.name) && Objects.equal(this.metadata, that.metadata);
+ return Objects.equal(this.id, that.id) &&
+ Objects.equal(this.links, that.links) &&
+ super.equals(obj);
}
protected ToStringHelper string() {
- return Objects.toStringHelper(this).add("name", name).add("metadata", metadata);
+ return super.string()
+ .add("links", links)
+ .add("id", id);
}
@Override
public String toString() {
return string().toString();
- }
-
- public static Builder builder() {
- return new Builder();
- }
-
- public Builder toBuilder() {
- return new Builder().fromWebhook(this);
- }
-
- public static class Builder {
- protected String name;
- protected Map<String, Object> metadata;
-
- /**
- * @param name The name of this Webhook.
- * @return The builder object.
- * @see Webhook#getName()
- */
- public Builder name(String name) {
- this.name = name;
- return this;
- }
-
- /**
- * @param metadata The metadata of this Webhook.
- * @return The builder object.
- * @see Webhook#getMetadata()
- */
- public Builder metadata(Map<String, Object> metadata) {
- this.metadata = metadata;
- return this;
- }
-
- /**
- * @return A new Webhook object.
- */
- public Webhook build() {
- return new Webhook(name, metadata);
- }
-
- public Builder fromWebhook(Webhook in) {
- return this.name(in.getName()).metadata(in.getMetadata());
- }
- }
+ }
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/90c7a3a5/rackspace-autoscale/src/main/java/org/jclouds/rackspace/autoscale/v1/domain/WebhookResponse.java
----------------------------------------------------------------------
diff --git a/rackspace-autoscale/src/main/java/org/jclouds/rackspace/autoscale/v1/domain/WebhookResponse.java b/rackspace-autoscale/src/main/java/org/jclouds/rackspace/autoscale/v1/domain/WebhookResponse.java
deleted file mode 100644
index 8abe691..0000000
--- a/rackspace-autoscale/src/main/java/org/jclouds/rackspace/autoscale/v1/domain/WebhookResponse.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * 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.rackspace.autoscale.v1.domain;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.beans.ConstructorProperties;
-import java.net.URI;
-import java.util.List;
-import java.util.Map;
-
-import org.jclouds.javax.annotation.Nullable;
-import org.jclouds.openstack.v2_0.domain.Link;
-import org.jclouds.openstack.v2_0.domain.Link.Relation;
-
-import com.google.common.base.Objects;
-import com.google.common.base.Objects.ToStringHelper;
-import com.google.common.base.Optional;
-import com.google.common.collect.ImmutableList;
-
-/**
- * Autoscale WebhookResponse. Extends Webhook with id and links.
- *
- * @see Webhook#getWebhooks()
- * @author Zack Shoylev
- */
-public class WebhookResponse extends Webhook{
- private final ImmutableList<Link> links;
- private final String id;
-
- @ConstructorProperties({
- "name", "metadata", "links", "id"
- })
- public WebhookResponse(String name, @Nullable Map<String, Object> metadata, List<Link> links, String id) {
- super(name, metadata);
- this.id = checkNotNull(id, "id required");
- this.links = ImmutableList.copyOf(checkNotNull(links, "links required"));
- }
-
- /**
- * @return the unique id of this ScalingPolicy.
- * @see ScalingPolicyResponse.Builder#id(String)
- */
- public String getId() {
- return this.id;
- }
-
- /**
- * The capability Link for the webhook can be called with a POST request to execute the webhook anonymously.
- * @return the links to this ScalingPolicy.
- * @see ScalingPolicyResponse.Builder#links(String)
- */
- public ImmutableList<Link> getLinks() {
- return this.links;
- }
-
- public Optional<URI> getAnonymousExecutionURI() {
- // TODO: Add Relation.CAPABILITY to openstack Link
- for (Link l : this.links) {
- if (l.getRelation() == Relation.UNRECOGNIZED) {
- return Optional.of(l.getHref());
- }
- }
- return Optional.absent();
- }
-
- @Override
- public int hashCode() {
- return Objects.hashCode(super.hashCode(), links, id);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) return true;
- if (obj == null || getClass() != obj.getClass()) return false;
- WebhookResponse that = WebhookResponse.class.cast(obj);
- return Objects.equal(this.id, that.id) &&
- Objects.equal(this.links, that.links) &&
- super.equals(obj);
- }
-
- protected ToStringHelper string() {
- return super.string()
- .add("links", links)
- .add("id", id);
- }
-
- @Override
- public String toString() {
- return string().toString();
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/90c7a3a5/rackspace-autoscale/src/main/java/org/jclouds/rackspace/autoscale/v1/features/GroupApi.java
----------------------------------------------------------------------
diff --git a/rackspace-autoscale/src/main/java/org/jclouds/rackspace/autoscale/v1/features/GroupApi.java b/rackspace-autoscale/src/main/java/org/jclouds/rackspace/autoscale/v1/features/GroupApi.java
index c78f658..9b9cb48 100644
--- a/rackspace-autoscale/src/main/java/org/jclouds/rackspace/autoscale/v1/features/GroupApi.java
+++ b/rackspace-autoscale/src/main/java/org/jclouds/rackspace/autoscale/v1/features/GroupApi.java
@@ -39,7 +39,7 @@ import org.jclouds.rackspace.autoscale.v1.domain.Group;
import org.jclouds.rackspace.autoscale.v1.domain.GroupConfiguration;
import org.jclouds.rackspace.autoscale.v1.domain.GroupState;
import org.jclouds.rackspace.autoscale.v1.domain.LaunchConfiguration;
-import org.jclouds.rackspace.autoscale.v1.domain.ScalingPolicy;
+import org.jclouds.rackspace.autoscale.v1.domain.CreateScalingPolicy;
import org.jclouds.rackspace.autoscale.v1.functions.ParseGroupLaunchConfigurationResponse;
import org.jclouds.rackspace.autoscale.v1.functions.ParseGroupResponse;
import org.jclouds.rest.annotations.Fallback;
@@ -68,7 +68,7 @@ public interface GroupApi extends Closeable {
* @return Group The group created by this call.
* @see GroupConfiguration
* @see LaunchConfiguration
- * @see ScalingPolicy
+ * @see CreateScalingPolicy
* @see Group
*/
@Named("Group:create")
@@ -79,7 +79,7 @@ public interface GroupApi extends Closeable {
@ResponseParser(ParseGroupResponse.class)
Group create(@PayloadParam("groupConfiguration") GroupConfiguration groupConfiguration,
@PayloadParam("launchConfiguration") LaunchConfiguration launchConfiguration,
- @PayloadParam("scalingPolicies") List<ScalingPolicy> scalingPolicies);
+ @PayloadParam("scalingPolicies") List<CreateScalingPolicy> scalingPolicies);
/**
* This operation pauses the specified Autoscaling Group
http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/90c7a3a5/rackspace-autoscale/src/main/java/org/jclouds/rackspace/autoscale/v1/features/PolicyApi.java
----------------------------------------------------------------------
diff --git a/rackspace-autoscale/src/main/java/org/jclouds/rackspace/autoscale/v1/features/PolicyApi.java b/rackspace-autoscale/src/main/java/org/jclouds/rackspace/autoscale/v1/features/PolicyApi.java
index 2e3f2b1..7424a72 100644
--- a/rackspace-autoscale/src/main/java/org/jclouds/rackspace/autoscale/v1/features/PolicyApi.java
+++ b/rackspace-autoscale/src/main/java/org/jclouds/rackspace/autoscale/v1/features/PolicyApi.java
@@ -36,8 +36,8 @@ import org.jclouds.Fallbacks.NullOnNotFoundOr404;
import org.jclouds.openstack.keystone.v2_0.filters.AuthenticateRequest;
import org.jclouds.rackspace.autoscale.v1.binders.BindScalingPoliciesToJson;
import org.jclouds.rackspace.autoscale.v1.binders.BindScalingPolicyToJson;
+import org.jclouds.rackspace.autoscale.v1.domain.CreateScalingPolicy;
import org.jclouds.rackspace.autoscale.v1.domain.ScalingPolicy;
-import org.jclouds.rackspace.autoscale.v1.domain.ScalingPolicyResponse;
import org.jclouds.rackspace.autoscale.v1.functions.ParseScalingPoliciesResponse;
import org.jclouds.rackspace.autoscale.v1.functions.ParseScalingPolicyResponse;
import org.jclouds.rest.annotations.Fallback;
@@ -60,8 +60,8 @@ public interface PolicyApi extends Closeable {
* Create a scaling policy.
* @param scalingPolicies The list of scaling policies.
* @return List of the created scaling policies
+ * @see CreateScalingPolicy
* @see ScalingPolicy
- * @see ScalingPolicyResponse
*/
@Named("Policy:create")
@POST
@@ -69,48 +69,48 @@ public interface PolicyApi extends Closeable {
@Fallback(EmptyFluentIterableOnNotFoundOr404.class)
@MapBinder(BindScalingPoliciesToJson.class)
@ResponseParser(ParseScalingPoliciesResponse.class)
- FluentIterable<ScalingPolicyResponse> create(@PayloadParam("scalingPolicies") List<ScalingPolicy> scalingPolicies);
+ FluentIterable<ScalingPolicy> create(@PayloadParam("scalingPolicies") List<CreateScalingPolicy> scalingPolicies);
/**
* This operation lists all scaling policies.
* @return A list of scaling policy responses.
- * @see ScalingPolicyResponse
+ * @see ScalingPolicy
*/
@Named("Policy:list")
@GET
@Path("/policies")
@ResponseParser(ParseScalingPoliciesResponse.class)
@Fallback(EmptyFluentIterableOnNotFoundOr404.class)
- FluentIterable<ScalingPolicyResponse> list();
+ FluentIterable<ScalingPolicy> list();
/**
* This operation returns the details for a single scaling policy.
* @return Existing scaling policy details
- * @see ScalingPolicyResponse
+ * @see ScalingPolicy
*/
@Named("Policy:get")
@GET
@Path("/policies/{scalingPolicyId}")
@ResponseParser(ParseScalingPolicyResponse.class)
@Fallback(NullOnNotFoundOr404.class)
- ScalingPolicyResponse get(@PathParam("scalingPolicyId") String scalingPolicyId);
+ ScalingPolicy get(@PathParam("scalingPolicyId") String scalingPolicyId);
/**
* This operation updates a specific scaling policy.
* @return true if successful.
- * @see ScalingPolicy
+ * @see CreateScalingPolicy
*/
@Named("Policy:update")
@PUT
@Path("/policies/{scalingPolicyId}")
@MapBinder(BindScalingPolicyToJson.class)
@Fallback(FalseOnNotFoundOr404.class)
- boolean update(@PathParam("scalingPolicyId") String scalingPolicyId, @PayloadParam("scalingPolicy") ScalingPolicy scalingPolicy);
+ boolean update(@PathParam("scalingPolicyId") String scalingPolicyId, @PayloadParam("scalingPolicy") CreateScalingPolicy scalingPolicy);
/**
* This operation deletes a specific scaling policy.
* @return true if successful.
- * @see ScalingPolicy
+ * @see CreateScalingPolicy
*/
@Named("Policy:delete")
@DELETE
@@ -121,7 +121,7 @@ public interface PolicyApi extends Closeable {
/**
* This operation executes a specific scaling policy.
* @return true if successful.
- * @see ScalingPolicy
+ * @see CreateScalingPolicy
*/
@Named("Policy:execute")
@POST
http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/90c7a3a5/rackspace-autoscale/src/main/java/org/jclouds/rackspace/autoscale/v1/features/WebhookApi.java
----------------------------------------------------------------------
diff --git a/rackspace-autoscale/src/main/java/org/jclouds/rackspace/autoscale/v1/features/WebhookApi.java b/rackspace-autoscale/src/main/java/org/jclouds/rackspace/autoscale/v1/features/WebhookApi.java
index 96677bc..bacb11a 100644
--- a/rackspace-autoscale/src/main/java/org/jclouds/rackspace/autoscale/v1/features/WebhookApi.java
+++ b/rackspace-autoscale/src/main/java/org/jclouds/rackspace/autoscale/v1/features/WebhookApi.java
@@ -37,8 +37,8 @@ import org.jclouds.openstack.keystone.v2_0.filters.AuthenticateRequest;
import org.jclouds.rackspace.autoscale.v1.binders.BindWebhookToJson;
import org.jclouds.rackspace.autoscale.v1.binders.BindWebhookUpdateToJson;
import org.jclouds.rackspace.autoscale.v1.binders.BindWebhooksToJson;
+import org.jclouds.rackspace.autoscale.v1.domain.CreateWebhook;
import org.jclouds.rackspace.autoscale.v1.domain.Webhook;
-import org.jclouds.rackspace.autoscale.v1.domain.WebhookResponse;
import org.jclouds.rest.annotations.Fallback;
import org.jclouds.rest.annotations.MapBinder;
import org.jclouds.rest.annotations.PayloadParam;
@@ -59,10 +59,10 @@ public interface WebhookApi extends Closeable {
* @param name The webhook name. Required.
* @param metadata A map of associated metadata. Use String keys. Required.
* @return WebhookResponse The webhook created by this call.
+ * @see CreateWebhook
* @see Webhook
- * @see WebhookResponse
* @see Group
- * @see ScalingPolicy
+ * @see CreateScalingPolicy
*/
@Named("Webhook:create")
@POST
@@ -70,16 +70,16 @@ public interface WebhookApi extends Closeable {
@Fallback(EmptyFluentIterableOnNotFoundOr404.class)
@MapBinder(BindWebhookToJson.class)
@SelectJson("webhooks")
- FluentIterable<WebhookResponse> create(@PayloadParam("name") String name, @PayloadParam("metadata") Map<String, Object> metadata);
+ FluentIterable<Webhook> create(@PayloadParam("name") String name, @PayloadParam("metadata") Map<String, Object> metadata);
/**
* Create webhooks.
* @param webhooks A list of webhooks.
* @return WebhookResponse The webhook created by this call.
+ * @see CreateWebhook
* @see Webhook
- * @see WebhookResponse
* @see Group
- * @see ScalingPolicy
+ * @see CreateScalingPolicy
*/
@Named("Webhook:create")
@POST
@@ -87,38 +87,38 @@ public interface WebhookApi extends Closeable {
@Fallback(EmptyFluentIterableOnNotFoundOr404.class)
@MapBinder(BindWebhooksToJson.class)
@SelectJson("webhooks")
- FluentIterable<WebhookResponse> create(@PayloadParam("webhooks") List<Webhook> webhooks);
+ FluentIterable<Webhook> create(@PayloadParam("webhooks") List<CreateWebhook> webhooks);
/**
* List webhooks.
* @return A list of webhooks
+ * @see CreateWebhook
* @see Webhook
- * @see WebhookResponse
* @see Group
- * @see ScalingPolicy
+ * @see CreateScalingPolicy
*/
@Named("Webhook:list")
@GET
@Path("/webhooks")
@Fallback(EmptyFluentIterableOnNotFoundOr404.class)
@SelectJson("webhooks")
- FluentIterable<WebhookResponse> list();
+ FluentIterable<Webhook> list();
/**
* Get a webhook.
* @param String id The id of the webhook.
* @return The webhook
+ * @see CreateWebhook
* @see Webhook
- * @see WebhookResponse
* @see Group
- * @see ScalingPolicy
+ * @see CreateScalingPolicy
*/
@Named("Webhook:get")
@GET
@Path("/webhooks/{webhookId}")
@Fallback(NullOnNotFoundOr404.class)
@SelectJson("webhook")
- WebhookResponse get(@PathParam("webhookId") String id);
+ Webhook get(@PathParam("webhookId") String id);
/**
* Update a webhook.
@@ -126,10 +126,10 @@ public interface WebhookApi extends Closeable {
* @param name The webhook name
* @param metadata A map of associated metadata. Use String keys.
* @return true when successful.
+ * @see CreateWebhook
* @see Webhook
- * @see WebhookResponse
* @see Group
- * @see ScalingPolicy
+ * @see CreateScalingPolicy
*/
@Named("Webhook:update")
@PUT
@@ -142,10 +142,10 @@ public interface WebhookApi extends Closeable {
* Delete a webhook.
* @param String id The id of the webhook.
* @return true if successful.
+ * @see CreateWebhook
* @see Webhook
- * @see WebhookResponse
* @see Group
- * @see ScalingPolicy
+ * @see CreateScalingPolicy
*/
@Named("Webhook:delete")
@DELETE
http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/90c7a3a5/rackspace-autoscale/src/main/java/org/jclouds/rackspace/autoscale/v1/functions/ParseGroupResponse.java
----------------------------------------------------------------------
diff --git a/rackspace-autoscale/src/main/java/org/jclouds/rackspace/autoscale/v1/functions/ParseGroupResponse.java b/rackspace-autoscale/src/main/java/org/jclouds/rackspace/autoscale/v1/functions/ParseGroupResponse.java
index 27d6309..4abe892 100644
--- a/rackspace-autoscale/src/main/java/org/jclouds/rackspace/autoscale/v1/functions/ParseGroupResponse.java
+++ b/rackspace-autoscale/src/main/java/org/jclouds/rackspace/autoscale/v1/functions/ParseGroupResponse.java
@@ -32,9 +32,9 @@ import org.jclouds.rackspace.autoscale.v1.domain.LaunchConfiguration;
import org.jclouds.rackspace.autoscale.v1.domain.LaunchConfiguration.LaunchConfigurationType;
import org.jclouds.rackspace.autoscale.v1.domain.LoadBalancer;
import org.jclouds.rackspace.autoscale.v1.domain.Personality;
-import org.jclouds.rackspace.autoscale.v1.domain.ScalingPolicy.ScalingPolicyTargetType;
-import org.jclouds.rackspace.autoscale.v1.domain.ScalingPolicy.ScalingPolicyType;
-import org.jclouds.rackspace.autoscale.v1.domain.ScalingPolicyResponse;
+import org.jclouds.rackspace.autoscale.v1.domain.CreateScalingPolicy.ScalingPolicyTargetType;
+import org.jclouds.rackspace.autoscale.v1.domain.CreateScalingPolicy.ScalingPolicyType;
+import org.jclouds.rackspace.autoscale.v1.domain.ScalingPolicy;
import com.google.common.base.Function;
import com.google.common.collect.ImmutableList;
@@ -67,7 +67,7 @@ public class ParseGroupResponse implements Function<HttpResponse, Group> {
Map<String, Object> group = (Map<String, Object>) result.get("group");
Map<String, Object> groupConfigurationMap = (Map<String, Object>) group.get("groupConfiguration");
Map<String, Object> launchConfigurationMap = (Map<String, Object>) group.get("launchConfiguration");
- ImmutableList.Builder<ScalingPolicyResponse> scalingPoliciesList = ImmutableList.builder();
+ ImmutableList.Builder<ScalingPolicy> scalingPoliciesList = ImmutableList.builder();
Map<String, Object> args = (Map<String, Object>) launchConfigurationMap.get("args");
Map<String, Object> server = (Map<String, Object>) args.get("server");
@@ -125,8 +125,8 @@ public class ParseGroupResponse implements Function<HttpResponse, Group> {
Double d = (Double)scalingPolicyMap.get(targetType.toString()); // GSON only knows double now
- ScalingPolicyResponse scalingPolicyResponse =
- new ScalingPolicyResponse(
+ ScalingPolicy scalingPolicyResponse =
+ new ScalingPolicy(
(String)scalingPolicyMap.get("name"),
ScalingPolicyType.getByValue((String)scalingPolicyMap.get("type")).get(),
((Double)scalingPolicyMap.get("cooldown")).intValue(),
http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/90c7a3a5/rackspace-autoscale/src/main/java/org/jclouds/rackspace/autoscale/v1/functions/ParseScalingPoliciesResponse.java
----------------------------------------------------------------------
diff --git a/rackspace-autoscale/src/main/java/org/jclouds/rackspace/autoscale/v1/functions/ParseScalingPoliciesResponse.java b/rackspace-autoscale/src/main/java/org/jclouds/rackspace/autoscale/v1/functions/ParseScalingPoliciesResponse.java
index c003575..4fa2fdc 100644
--- a/rackspace-autoscale/src/main/java/org/jclouds/rackspace/autoscale/v1/functions/ParseScalingPoliciesResponse.java
+++ b/rackspace-autoscale/src/main/java/org/jclouds/rackspace/autoscale/v1/functions/ParseScalingPoliciesResponse.java
@@ -26,9 +26,9 @@ import org.jclouds.http.HttpResponse;
import org.jclouds.http.functions.ParseJson;
import org.jclouds.openstack.v2_0.domain.Link;
import org.jclouds.openstack.v2_0.domain.Link.Relation;
-import org.jclouds.rackspace.autoscale.v1.domain.ScalingPolicy.ScalingPolicyTargetType;
-import org.jclouds.rackspace.autoscale.v1.domain.ScalingPolicy.ScalingPolicyType;
-import org.jclouds.rackspace.autoscale.v1.domain.ScalingPolicyResponse;
+import org.jclouds.rackspace.autoscale.v1.domain.CreateScalingPolicy.ScalingPolicyTargetType;
+import org.jclouds.rackspace.autoscale.v1.domain.CreateScalingPolicy.ScalingPolicyType;
+import org.jclouds.rackspace.autoscale.v1.domain.ScalingPolicy;
import com.google.common.base.Function;
import com.google.common.collect.FluentIterable;
@@ -40,7 +40,7 @@ import com.google.inject.Inject;
* This parses the scaling policy response and decouples domain objects from the json object returned by the service.
* @author Zack Shoylev
*/
-public class ParseScalingPoliciesResponse implements Function<HttpResponse, FluentIterable<ScalingPolicyResponse>> {
+public class ParseScalingPoliciesResponse implements Function<HttpResponse, FluentIterable<ScalingPolicy>> {
private final ParseJson<Map<String, List<Map<String, Object>>>> json;
@@ -53,13 +53,13 @@ public class ParseScalingPoliciesResponse implements Function<HttpResponse, Flue
* Parse a list of scaling policy responses
*/
@SuppressWarnings("unchecked")
- public FluentIterable<ScalingPolicyResponse> apply(HttpResponse from) {
+ public FluentIterable<ScalingPolicy> apply(HttpResponse from) {
// This needs to be refactored when the service is in a more final state and changing less often
// A lot of the complexity is expected to go away
Map<String, List<Map<String, Object>>> singleMap = (Map<String, List<Map<String, Object>>>) json.apply(from);
List<Map<String, Object>> result = singleMap.get("policies");
- ImmutableList.Builder<ScalingPolicyResponse> scalingPoliciesList = ImmutableList.builder();
+ ImmutableList.Builder<ScalingPolicy> scalingPoliciesList = ImmutableList.builder();
for(Map<String, Object> scalingPolicyMap : result) {
ScalingPolicyTargetType targetType = null;
@@ -77,8 +77,8 @@ public class ParseScalingPoliciesResponse implements Function<HttpResponse, Flue
}
Double d = (Double)scalingPolicyMap.get(targetType.toString()); // GSON only knows double now
- ScalingPolicyResponse scalingPolicyResponse =
- new ScalingPolicyResponse(
+ ScalingPolicy scalingPolicyResponse =
+ new ScalingPolicy(
(String)scalingPolicyMap.get("name"),
ScalingPolicyType.getByValue((String)scalingPolicyMap.get("type")).get(),
((Double)scalingPolicyMap.get("cooldown")).intValue(),
http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/90c7a3a5/rackspace-autoscale/src/main/java/org/jclouds/rackspace/autoscale/v1/functions/ParseScalingPolicyResponse.java
----------------------------------------------------------------------
diff --git a/rackspace-autoscale/src/main/java/org/jclouds/rackspace/autoscale/v1/functions/ParseScalingPolicyResponse.java b/rackspace-autoscale/src/main/java/org/jclouds/rackspace/autoscale/v1/functions/ParseScalingPolicyResponse.java
index 392761f..6e69700 100644
--- a/rackspace-autoscale/src/main/java/org/jclouds/rackspace/autoscale/v1/functions/ParseScalingPolicyResponse.java
+++ b/rackspace-autoscale/src/main/java/org/jclouds/rackspace/autoscale/v1/functions/ParseScalingPolicyResponse.java
@@ -26,9 +26,9 @@ import org.jclouds.http.HttpResponse;
import org.jclouds.http.functions.ParseJson;
import org.jclouds.openstack.v2_0.domain.Link;
import org.jclouds.openstack.v2_0.domain.Link.Relation;
-import org.jclouds.rackspace.autoscale.v1.domain.ScalingPolicy.ScalingPolicyTargetType;
-import org.jclouds.rackspace.autoscale.v1.domain.ScalingPolicy.ScalingPolicyType;
-import org.jclouds.rackspace.autoscale.v1.domain.ScalingPolicyResponse;
+import org.jclouds.rackspace.autoscale.v1.domain.CreateScalingPolicy.ScalingPolicyTargetType;
+import org.jclouds.rackspace.autoscale.v1.domain.CreateScalingPolicy.ScalingPolicyType;
+import org.jclouds.rackspace.autoscale.v1.domain.ScalingPolicy;
import com.google.common.base.Function;
import com.google.common.collect.ImmutableList;
@@ -39,7 +39,7 @@ import com.google.inject.Inject;
* This parses the scaling policy response and decouples domain objects from the json object returned by the service.
* @author Zack Shoylev
*/
-public class ParseScalingPolicyResponse implements Function<HttpResponse, ScalingPolicyResponse> {
+public class ParseScalingPolicyResponse implements Function<HttpResponse, ScalingPolicy> {
private final ParseJson<Map<String, Object>> json;
@@ -52,7 +52,7 @@ public class ParseScalingPolicyResponse implements Function<HttpResponse, Scalin
* Parse a single scaling policy response
*/
@SuppressWarnings("unchecked")
- public ScalingPolicyResponse apply(HttpResponse from) {
+ public ScalingPolicy apply(HttpResponse from) {
// This needs to be refactored when the service is in a more final state and changing less often
// A lot of the complexity is expected to go away
@@ -74,8 +74,8 @@ public class ParseScalingPolicyResponse implements Function<HttpResponse, Scalin
}
Double d = (Double)scalingPolicyMap.get(targetType.toString()); // GSON only knows double now
- ScalingPolicyResponse scalingPolicyResponse =
- new ScalingPolicyResponse(
+ ScalingPolicy scalingPolicyResponse =
+ new ScalingPolicy(
(String)scalingPolicyMap.get("name"),
ScalingPolicyType.getByValue((String)scalingPolicyMap.get("type")).get(),
((Double)scalingPolicyMap.get("cooldown")).intValue(),
http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/90c7a3a5/rackspace-autoscale/src/main/java/org/jclouds/rackspace/autoscale/v1/internal/ParseHelper.java
----------------------------------------------------------------------
diff --git a/rackspace-autoscale/src/main/java/org/jclouds/rackspace/autoscale/v1/internal/ParseHelper.java b/rackspace-autoscale/src/main/java/org/jclouds/rackspace/autoscale/v1/internal/ParseHelper.java
index 8dc43f3..2f72f3e 100644
--- a/rackspace-autoscale/src/main/java/org/jclouds/rackspace/autoscale/v1/internal/ParseHelper.java
+++ b/rackspace-autoscale/src/main/java/org/jclouds/rackspace/autoscale/v1/internal/ParseHelper.java
@@ -20,7 +20,7 @@ import java.util.List;
import java.util.Map;
import org.jclouds.rackspace.autoscale.v1.domain.LaunchConfiguration;
-import org.jclouds.rackspace.autoscale.v1.domain.ScalingPolicy;
+import org.jclouds.rackspace.autoscale.v1.domain.CreateScalingPolicy;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
@@ -28,7 +28,7 @@ import com.google.common.collect.Maps;
import com.google.common.primitives.Floats;
import com.google.common.primitives.Ints;
-import static org.jclouds.rackspace.autoscale.v1.domain.ScalingPolicy.ScalingPolicyType;
+import static org.jclouds.rackspace.autoscale.v1.domain.CreateScalingPolicy.ScalingPolicyType;
/**
* @author Zack Shoylev
@@ -69,16 +69,16 @@ public class ParseHelper {
@SuppressWarnings("unchecked")
public static ImmutableList<Map<String, Object>> buildScalingPoliciesRequestList(Map<String, Object> postParams) {
- List<ScalingPolicy> scalingPoliciesRequest = (List<ScalingPolicy>) postParams.get("scalingPolicies");
+ List<CreateScalingPolicy> scalingPoliciesRequest = (List<CreateScalingPolicy>) postParams.get("scalingPolicies");
ImmutableList.Builder<Map<String, Object>> scalingPoliciesListBuilder = ImmutableList.builder();
- for (ScalingPolicy scalingPolicy : scalingPoliciesRequest) {
+ for (CreateScalingPolicy scalingPolicy : scalingPoliciesRequest) {
scalingPoliciesListBuilder.add(buildScalingPolicyMap(scalingPolicy));
}
return scalingPoliciesListBuilder.build();
}
- public static ImmutableMap<String, Object> buildScalingPolicyMap(ScalingPolicy scalingPolicy) {
+ public static ImmutableMap<String, Object> buildScalingPolicyMap(CreateScalingPolicy scalingPolicy) {
ImmutableMap.Builder<String, Object> scalingPolicyMapBuilder = ImmutableMap.builder();
scalingPolicyMapBuilder.put("cooldown", scalingPolicy.getCooldown());
scalingPolicyMapBuilder.put("type", scalingPolicy.getType().toString());
http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/90c7a3a5/rackspace-autoscale/src/main/java/org/jclouds/rackspace/autoscale/v1/utils/AutoscaleUtils.java
----------------------------------------------------------------------
diff --git a/rackspace-autoscale/src/main/java/org/jclouds/rackspace/autoscale/v1/utils/AutoscaleUtils.java b/rackspace-autoscale/src/main/java/org/jclouds/rackspace/autoscale/v1/utils/AutoscaleUtils.java
index b8466fe..8cc15bf 100644
--- a/rackspace-autoscale/src/main/java/org/jclouds/rackspace/autoscale/v1/utils/AutoscaleUtils.java
+++ b/rackspace-autoscale/src/main/java/org/jclouds/rackspace/autoscale/v1/utils/AutoscaleUtils.java
@@ -21,7 +21,7 @@ import java.net.HttpURLConnection;
import java.net.URI;
import java.net.URL;
-import org.jclouds.rackspace.autoscale.v1.domain.WebhookResponse;
+import org.jclouds.rackspace.autoscale.v1.domain.Webhook;
/**
* @author Zack Shoylev
@@ -46,7 +46,7 @@ public class AutoscaleUtils {
return code == 202;
}
- public static boolean execute(WebhookResponse webhook) throws IOException {
+ public static boolean execute(Webhook webhook) throws IOException {
return execute(webhook.getAnonymousExecutionURI().get());
}
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/90c7a3a5/rackspace-autoscale/src/test/java/org/jclouds/rackspace/autoscale/v1/features/GroupApiLiveTest.java
----------------------------------------------------------------------
diff --git a/rackspace-autoscale/src/test/java/org/jclouds/rackspace/autoscale/v1/features/GroupApiLiveTest.java b/rackspace-autoscale/src/test/java/org/jclouds/rackspace/autoscale/v1/features/GroupApiLiveTest.java
index 929e7f6..74a25a9 100644
--- a/rackspace-autoscale/src/test/java/org/jclouds/rackspace/autoscale/v1/features/GroupApiLiveTest.java
+++ b/rackspace-autoscale/src/test/java/org/jclouds/rackspace/autoscale/v1/features/GroupApiLiveTest.java
@@ -33,9 +33,9 @@ import org.jclouds.rackspace.autoscale.v1.domain.LaunchConfiguration;
import org.jclouds.rackspace.autoscale.v1.domain.LaunchConfiguration.LaunchConfigurationType;
import org.jclouds.rackspace.autoscale.v1.domain.LoadBalancer;
import org.jclouds.rackspace.autoscale.v1.domain.Personality;
-import org.jclouds.rackspace.autoscale.v1.domain.ScalingPolicy;
-import org.jclouds.rackspace.autoscale.v1.domain.ScalingPolicy.ScalingPolicyTargetType;
-import org.jclouds.rackspace.autoscale.v1.domain.ScalingPolicy.ScalingPolicyType;
+import org.jclouds.rackspace.autoscale.v1.domain.CreateScalingPolicy;
+import org.jclouds.rackspace.autoscale.v1.domain.CreateScalingPolicy.ScalingPolicyTargetType;
+import org.jclouds.rackspace.autoscale.v1.domain.CreateScalingPolicy.ScalingPolicyType;
import org.jclouds.rackspace.autoscale.v1.internal.BaseAutoscaleApiLiveTest;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
@@ -88,9 +88,9 @@ public class GroupApiLiveTest extends BaseAutoscaleApiLiveTest {
.contents("VGhpcyBpcyBhIHRlc3QgZmlsZS4=").build()))
.type(LaunchConfigurationType.LAUNCH_SERVER).build();
- List<ScalingPolicy> scalingPolicies = Lists.newArrayList();
+ List<CreateScalingPolicy> scalingPolicies = Lists.newArrayList();
- ScalingPolicy scalingPolicy = ScalingPolicy.builder().cooldown(1).type(ScalingPolicyType.WEBHOOK)
+ CreateScalingPolicy scalingPolicy = CreateScalingPolicy.builder().cooldown(1).type(ScalingPolicyType.WEBHOOK)
.name("scale up by 1").targetType(ScalingPolicyTargetType.INCREMENTAL).target("1").build();
scalingPolicies.add(scalingPolicy);
http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/90c7a3a5/rackspace-autoscale/src/test/java/org/jclouds/rackspace/autoscale/v1/features/GroupApiMockTest.java
----------------------------------------------------------------------
diff --git a/rackspace-autoscale/src/test/java/org/jclouds/rackspace/autoscale/v1/features/GroupApiMockTest.java b/rackspace-autoscale/src/test/java/org/jclouds/rackspace/autoscale/v1/features/GroupApiMockTest.java
index 3e1f4db..c40c271 100644
--- a/rackspace-autoscale/src/test/java/org/jclouds/rackspace/autoscale/v1/features/GroupApiMockTest.java
+++ b/rackspace-autoscale/src/test/java/org/jclouds/rackspace/autoscale/v1/features/GroupApiMockTest.java
@@ -34,9 +34,9 @@ import org.jclouds.rackspace.autoscale.v1.domain.LaunchConfiguration;
import org.jclouds.rackspace.autoscale.v1.domain.LaunchConfiguration.LaunchConfigurationType;
import org.jclouds.rackspace.autoscale.v1.domain.LoadBalancer;
import org.jclouds.rackspace.autoscale.v1.domain.Personality;
-import org.jclouds.rackspace.autoscale.v1.domain.ScalingPolicy;
-import org.jclouds.rackspace.autoscale.v1.domain.ScalingPolicy.ScalingPolicyTargetType;
-import org.jclouds.rackspace.autoscale.v1.domain.ScalingPolicy.ScalingPolicyType;
+import org.jclouds.rackspace.autoscale.v1.domain.CreateScalingPolicy;
+import org.jclouds.rackspace.autoscale.v1.domain.CreateScalingPolicy.ScalingPolicyTargetType;
+import org.jclouds.rackspace.autoscale.v1.domain.CreateScalingPolicy.ScalingPolicyType;
import org.jclouds.rackspace.autoscale.v1.internal.BaseAutoscaleApiMockTest;
import org.testng.annotations.Test;
@@ -84,9 +84,9 @@ public class GroupApiMockTest extends BaseAutoscaleApiMockTest {
.type(LaunchConfigurationType.LAUNCH_SERVER)
.build();
- List<ScalingPolicy> scalingPolicies = Lists.newArrayList();
+ List<CreateScalingPolicy> scalingPolicies = Lists.newArrayList();
- ScalingPolicy scalingPolicy = ScalingPolicy.builder()
+ CreateScalingPolicy scalingPolicy = CreateScalingPolicy.builder()
.cooldown(0)
.type(ScalingPolicyType.WEBHOOK)
.name("scale up by 1")
@@ -181,9 +181,9 @@ public class GroupApiMockTest extends BaseAutoscaleApiMockTest {
.type(LaunchConfigurationType.LAUNCH_SERVER)
.build();
- List<ScalingPolicy> scalingPolicies = Lists.newArrayList();
+ List<CreateScalingPolicy> scalingPolicies = Lists.newArrayList();
- ScalingPolicy scalingPolicy = ScalingPolicy.builder()
+ CreateScalingPolicy scalingPolicy = CreateScalingPolicy.builder()
.cooldown(0)
.type(ScalingPolicyType.WEBHOOK)
.name("scale up by 1")