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

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


      this.jsonBinder = jsonBinder;
   }

   @Override   
   public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) {
      ScalingPolicy scalingPolicy = (ScalingPolicy) postParams.get("scalingPolicy");
      return jsonBinder.bindToRequest(request, ParseHelper.buildScalingPolicyMap(scalingPolicy));
   }
View Full Code Here


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

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

         ScalingPolicy scalingPolicy = ScalingPolicy.builder().cooldown(1).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

                                       .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

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

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

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

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

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

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

         ScalingPolicy updated = ScalingPolicy.builder()
               .cooldown(3)
               .type(ScalingPolicyType.WEBHOOK)
               .name("scale up by 2 PERCENT server")
               .targetType(ScalingPolicyTargetType.PERCENT_CHANGE)
               .target("2")
View Full Code Here

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

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

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

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

         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

      // A lot of the complexity is expected to go away

      Map<String, Object> singleMap = json.apply(from);
      Map<String, Object> scalingPolicyMap = (Map<String, Object>) singleMap.get("policy");

      ScalingPolicyTargetType targetType = null;
      for(String key : scalingPolicyMap.keySet()) {
         if(ScalingPolicyTargetType.getByValue(key).isPresent()) {
            targetType = ScalingPolicyTargetType.getByValue(key).get();
            break;
        
      }

      ImmutableList.Builder<Link> links = ImmutableList.builder();
      for(Map<String, String> linkMap : (List<Map<String, String>>) scalingPolicyMap.get("links")) {
         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
      ScalingPolicyResponse scalingPolicyResponse =
            new ScalingPolicyResponse(
                  (String)scalingPolicyMap.get("name"),
                  ScalingPolicyType.getByValue((String)scalingPolicyMap.get("type")).get(),
                  ((Double)scalingPolicyMap.get("cooldown")).intValue(),
View Full Code Here

      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();

      for(Map<String, Object> scalingPolicyMap : result) {
         ScalingPolicyTargetType targetType = null;
         for(String key : scalingPolicyMap.keySet()) {
            if(ScalingPolicyTargetType.getByValue(key).isPresent()) {
               targetType = ScalingPolicyTargetType.getByValue(key).get();
               break;
           
         }

         ImmutableList.Builder<Link> links = ImmutableList.builder();
         for(Map<String, String> linkMap : (List<Map<String, String>>) scalingPolicyMap.get("links")) {
            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
         ScalingPolicyResponse scalingPolicyResponse =
               new ScalingPolicyResponse(
                     (String)scalingPolicyMap.get("name"),
                     ScalingPolicyType.getByValue((String)scalingPolicyMap.get("type")).get(),
                     ((Double)scalingPolicyMap.get("cooldown")).intValue(),
View Full Code Here

TOP

Related Classes of org.jclouds.rackspace.autoscale.v1.domain.Group$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.