Skip to content
Permalink
Browse files
Renames domain classes for consitency
  • Loading branch information
zack-shoylev committed Feb 12, 2014
1 parent d7ed1bf commit 5768bc91140815d225281a51619c571aec0205ae
Showing 7 changed files with 22 additions and 27 deletions.
@@ -22,7 +22,7 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<properties>
<jclouds.version>1.7.0</jclouds.version>
<jclouds.version>1.7.1</jclouds.version>
</properties>
<groupId>org.apache.jclouds.examples</groupId>
<artifactId>rackspace-examples</artifactId>
@@ -115,11 +115,6 @@
<artifactId>rackspace-cloudqueues-uk</artifactId>
<version>${jclouds.version}</version>
</dependency>
<dependency>
<groupId>org.apache.jclouds.labs</groupId>
<artifactId>rackspace-autoscale</artifactId>
<version>${jclouds.version}</version>
</dependency>
<dependency>
<groupId>org.apache.jclouds.labs</groupId>
<artifactId>rackspace-autoscale-us</artifactId>
@@ -29,10 +29,10 @@
import org.jclouds.ContextBuilder;
import org.jclouds.rackspace.autoscale.v1.AutoscaleApi;
import org.jclouds.rackspace.autoscale.v1.domain.GroupState;
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.features.GroupApi;
import org.jclouds.rackspace.autoscale.v1.features.PolicyApi;

@@ -84,7 +84,7 @@ private void autoscaleCleanup() {
// Remove ALL policies and groups with that name
for (GroupState g : groupApi.listGroupStates()) {
PolicyApi pa = autoscaleApi.getPolicyApiForZoneAndGroup(ZONE, g.getId());
for(ScalingPolicyResponse p : pa.list()) {
for(ScalingPolicy p : pa.list()) {
if(p.getName().equals(NAME)) {
System.out.format("Found matching policy: %s with cooldown %s%n", p.getId(), p.getCooldown());
String policyId = p.getId();
@@ -93,7 +93,7 @@ private void autoscaleCleanup() {
System.out.format("Removing servers %n");

// Update policy to 0 servers
ScalingPolicy scalingPolicy = ScalingPolicy.builder()
CreateScalingPolicy scalingPolicy = CreateScalingPolicy.builder()
.cooldown(3)
.type(ScalingPolicyType.WEBHOOK)
.name(NAME)
@@ -34,9 +34,9 @@
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.features.GroupApi;

import com.google.common.collect.ImmutableList;
@@ -109,9 +109,9 @@ private void createPolicy() {
.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(NAME)
@@ -27,7 +27,7 @@

import org.jclouds.ContextBuilder;
import org.jclouds.rackspace.autoscale.v1.AutoscaleApi;
import org.jclouds.rackspace.autoscale.v1.domain.WebhookResponse;
import org.jclouds.rackspace.autoscale.v1.domain.Webhook;
import org.jclouds.rackspace.autoscale.v1.features.GroupApi;
import org.jclouds.rackspace.autoscale.v1.features.PolicyApi;
import org.jclouds.rackspace.autoscale.v1.features.WebhookApi;
@@ -83,7 +83,7 @@ public CreateWebhook(String username, String apiKey) {
private void createWebhook() {
System.out.format("Create Webhook%n");

FluentIterable<WebhookResponse> result = webhookApi.create(NAME, ImmutableMap.<String, Object>of());
FluentIterable<Webhook> result = webhookApi.create(NAME, ImmutableMap.<String, Object>of());

System.out.format(" %s%n", result.first().get());
}
@@ -27,7 +27,7 @@

import org.jclouds.ContextBuilder;
import org.jclouds.rackspace.autoscale.v1.AutoscaleApi;
import org.jclouds.rackspace.autoscale.v1.domain.WebhookResponse;
import org.jclouds.rackspace.autoscale.v1.domain.Webhook;
import org.jclouds.rackspace.autoscale.v1.features.GroupApi;
import org.jclouds.rackspace.autoscale.v1.features.PolicyApi;
import org.jclouds.rackspace.autoscale.v1.features.WebhookApi;
@@ -94,7 +94,7 @@ private void executeWebhook() {

System.out.format("Execute Webhook - again, anonymously%n");

WebhookResponse webhook = webhookApi.list().first().get();
Webhook webhook = webhookApi.list().first().get();
try {
result = AutoscaleUtils.execute(webhook.getAnonymousExecutionURI().get());
} catch (IOException e) {
@@ -27,9 +27,9 @@

import org.jclouds.ContextBuilder;
import org.jclouds.rackspace.autoscale.v1.AutoscaleApi;
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.features.GroupApi;
import org.jclouds.rackspace.autoscale.v1.features.PolicyApi;

@@ -81,7 +81,7 @@ private void updatePolicy() {

String policyId = policyApi.list().first().get().getId();

ScalingPolicy scalingPolicy = ScalingPolicy.builder()
CreateScalingPolicy scalingPolicy = CreateScalingPolicy.builder()
.cooldown(3)
.type(ScalingPolicyType.WEBHOOK)
.name(NAME)
@@ -22,7 +22,7 @@

import org.jclouds.rackspace.autoscale.v1.domain.Group;
import org.jclouds.rackspace.autoscale.v1.domain.GroupState;
import org.jclouds.rackspace.autoscale.v1.domain.ScalingPolicyResponse;
import org.jclouds.rackspace.autoscale.v1.domain.ScalingPolicy;
import org.jclouds.rackspace.autoscale.v1.features.GroupApi;
import org.jclouds.rackspace.autoscale.v1.features.PolicyApi;

@@ -35,7 +35,7 @@ public class Utils {
public static String getGroupId(GroupApi groupApi) {
for ( GroupState state : groupApi.listGroupStates() ) {
Group g = groupApi.get(state.getId());
for ( ScalingPolicyResponse policy : g.getScalingPolicies() ) {
for ( ScalingPolicy policy : g.getScalingPolicies() ) {
if (policy.getName().equals(NAME)) return g.getId();
}
}
@@ -44,7 +44,7 @@ public static String getGroupId(GroupApi groupApi) {
}

public static String getPolicyId(PolicyApi policyApi) {
for ( ScalingPolicyResponse policy : policyApi.list() ) {
for ( ScalingPolicy policy : policyApi.list() ) {
if (policy.getName().equals(NAME)) return policy.getId();
}

0 comments on commit 5768bc9

Please sign in to comment.