Package org.jclouds.rackspace.autoscale.v1.domain

Examples of org.jclouds.rackspace.autoscale.v1.domain.ScalingPolicy$Builder


         PolicyApi policyApi = api.getPolicyApiForZoneAndGroup(zone, created.get(zone).get(0).getId());

         List<ScalingPolicy> scalingPolicies = Lists.newArrayList();

         ScalingPolicy scalingPolicy = ScalingPolicy.builder()
               .cooldown(3)
               .type(ScalingPolicyType.WEBHOOK)
               .name("scale up by 0 server")
               .targetType(ScalingPolicyTargetType.INCREMENTAL)
               .target("1")
View Full Code Here


               }
            }

            List<ScalingPolicy> scalingPolicies = Lists.newArrayList();

            ScalingPolicy scalingPolicy = ScalingPolicy.builder()
                  .cooldown(3)
                  .type(ScalingPolicyType.WEBHOOK)
                  .name("0 machines")
                  .targetType(ScalingPolicyTargetType.DESIRED_CAPACITY)
                  .target("0")
View Full Code Here

                                       .contents("VGhpcyBpcyBhIHRlc3QgZmlsZS4=").build()))
                                       .type(LaunchConfigurationType.LAUNCH_SERVER).build();

         List<ScalingPolicy> scalingPolicies = Lists.newArrayList();

         ScalingPolicy scalingPolicy = ScalingPolicy.builder().cooldown(3).type(ScalingPolicyType.WEBHOOK)
               .name("scale up by 1").targetType(ScalingPolicyTargetType.INCREMENTAL).target("1").build();
         scalingPolicies.add(scalingPolicy);

         Group g = groupApi.create(groupConfiguration, launchConfiguration, scalingPolicies);
         createdGroupList.add(g);
View Full Code Here

               }
            }

            List<ScalingPolicy> scalingPolicies = Lists.newArrayList();

            ScalingPolicy scalingPolicy = ScalingPolicy.builder()
                  .cooldown(2)
                  .type(ScalingPolicyType.WEBHOOK)
                  .name("0 machines")
                  .targetType(ScalingPolicyTargetType.DESIRED_CAPACITY)
                  .target("0")
View Full Code Here

      try {
         AutoscaleApi autoscaleApi = api(server.getUrl("/").toString(), "rackspace-autoscale", overrides);
         PolicyApi api = autoscaleApi.getPolicyApiForZoneAndGroup("DFW", "groupId1");        

         ScalingPolicy scalingPolicyResponse = api.get("policyId");

         /*
          * Check request
          */
         assertAuthentication(server);
         assertRequest(server.takeRequest(), "GET", "/v1.0/888888/groups/groupId1/policies/policyId");

         /*
          * Check response
          */
         assertNotNull(scalingPolicyResponse);
         assertEquals(scalingPolicyResponse.getCooldown(), 150);
         assertEquals(scalingPolicyResponse.getId(), "policyId");
         assertEquals(scalingPolicyResponse.getName(), "scale up by one server");
         assertEquals(scalingPolicyResponse.getTarget(), "1");
         assertEquals(scalingPolicyResponse.getLinks().size(), 1);
      } finally {
         server.shutdown();
      }
   }
View Full Code Here

      try {
         AutoscaleApi autoscaleApi = api(server.getUrl("/").toString(), "rackspace-autoscale", overrides);
         PolicyApi api = autoscaleApi.getPolicyApiForZoneAndGroup("DFW", "groupId1");        

         ScalingPolicy scalingPolicyResponse = api.get("policyId");

         /*
          * Check request
          */
         assertAuthentication(server);
View Full Code Here

      for (String zone : api.getConfiguredZones()) {

         PolicyApi policyApi = api.getPolicyApiForZoneAndGroup(zone, created.get(zone).get(0).getId());

         assertNotNull(policyApi);
         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());
         assertEquals(listResponse.getLinks(), getResponse.getLinks());
         assertEquals(listResponse.getTarget(), getResponse.getTarget());
         assertEquals(listResponse.getTargetType(), getResponse.getTargetType());
         assertEquals(listResponse.getType(), getResponse.getType());
      }
   }
View Full Code Here

         assertNotNull(policyId);

         boolean result = policyApi.update(policyId, updated);
         assertTrue(result);

         ScalingPolicy updatedResponse = policyApi.get(policyId);

         assertNotNull(updatedResponse.getId());
         assertEquals(updatedResponse.getCooldown(), 3);
         assertEquals(updatedResponse.getTarget(), "2");
         assertEquals(updatedResponse.getTargetType(), ScalingPolicyTargetType.PERCENT_CHANGE);
         assertEquals(updatedResponse.getType(), ScalingPolicyType.WEBHOOK);
         assertEquals(updatedResponse.getName(), "scale up by 2 PERCENT server");
      }
   }
View Full Code Here

         Link link = Link.builder().href(URI.create(linkMap.get("href"))).relation(Relation.fromValue(linkMap.get("rel"))).build();
         links.add(link);
      }

      Double d = (Double)scalingPolicyMap.get(targetType.toString()); // GSON only knows double now
      ScalingPolicy scalingPolicyResponse =
            new ScalingPolicy(
                  (String)scalingPolicyMap.get("name"),
                  ScalingPolicyType.getByValue((String)scalingPolicyMap.get("type")).get(),
                  ((Double)scalingPolicyMap.get("cooldown")).intValue(),
                  DoubleMath.isMathematicalInteger(d) ? Integer.toString(d.intValue()) : Double.toString(d),
                        targetType,
View Full Code Here

            Link link = Link.builder().href(URI.create(linkMap.get("href"))).relation(Relation.fromValue(linkMap.get("rel"))).build();
            links.add(link);
         }

         Double d = (Double)scalingPolicyMap.get(targetType.toString()); // GSON only knows double now
         ScalingPolicy scalingPolicyResponse =
               new ScalingPolicy(
                     (String)scalingPolicyMap.get("name"),
                     ScalingPolicyType.getByValue((String)scalingPolicyMap.get("type")).get(),
                     ((Double)scalingPolicyMap.get("cooldown")).intValue(),
                     DoubleMath.isMathematicalInteger(d) ? Integer.toString(d.intValue()) : Double.toString(d),
                           targetType,
View Full Code Here

TOP

Related Classes of org.jclouds.rackspace.autoscale.v1.domain.ScalingPolicy$Builder

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.