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

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


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

         GroupConfiguration gc = api.getGroupConfiguration("1234567890");

         /*
          * Check request
          */
         assertAuthentication(server);
         assertRequest(server.takeRequest(), "GET", "/v1.0/888888/groups/1234567890/config");

         /*
          * Check response
          */
         assertEquals(gc.getCooldown(), 60);
         assertEquals(gc.getMaxEntities(), 100);
      } finally {
         server.shutdown();
      }
   }
View Full Code Here


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

         GroupConfiguration gc = api.getGroupConfiguration("1234567890");

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

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

         GroupConfiguration gc = GroupConfiguration.builder()
               .name("workers")
               .cooldown(60)
               .minEntities(5)
               .maxEntities(100)
               .metadata(ImmutableMap.of("firstkey", "this is a string", "secondkey", "1"))
View Full Code Here

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

         GroupConfiguration gc = GroupConfiguration.builder()
               .name("workers")
               .cooldown(60)
               .minEntities(5)
               .maxEntities(100)
               .metadata(ImmutableMap.of("firstkey", "this is a string", "secondkey", "1"))
View Full Code Here

            .personalities(personalities.build())
            .networks(networks.build())
            .type(LaunchConfigurationType.getByValue((String) launchConfigurationMap.get("type")).get())
            .build();

      GroupConfiguration groupConfiguration = GroupConfiguration.builder()
            .cooldown(((Double) groupConfigurationMap.get("cooldown")).intValue())
            .minEntities(((Double) groupConfigurationMap.get("minEntities")).intValue())
            .maxEntities(((Double) groupConfigurationMap.get("maxEntities")).intValue())
            .name((String) groupConfigurationMap.get("name"))
            .metadata((Map<String, String>) groupConfigurationMap.get("metadata"))
View Full Code Here

   @Test
   public void testGetState() {
      for (String zone : api.getConfiguredZones()) {
         GroupApi groupApi = api.getGroupApiForZone(zone);
         String groupId = created.get(zone).get(0).getId();
         GroupState testGroup = groupApi.getState(groupId);
         assertNull(testGroup.getId()); // The id recently changed to not be included when getting state.
      }
   }
View Full Code Here

            responseWithKeystoneAccess,
            authenticatedGET().endpoint(endpoint).build(),
            HttpResponse.builder().statusCode(200).payload(payloadFromResource("/autoscale_groups_state_response.json")).build()
            ).getGroupApiForZone("DFW");

      GroupState gs = api.getState("1234567890");
      assertEquals(gs.getId(), "1234567890");
      assertEquals(gs.getGroupInstances().size(), 2);
      assertEquals(gs.getGroupInstances().get(0).getId(), "444444");
   }
View Full Code Here

            responseWithKeystoneAccess,
            authenticatedGET().endpoint(endpoint).build(),
            HttpResponse.builder().statusCode(404).payload(payloadFromResource("/autoscale_groups_state_response.json")).build()
            ).getGroupApiForZone("DFW");

      GroupState gs = api.getState("1234567890");
      assertNull(gs);
   }
View Full Code Here

         loadBalancers.add(
               LoadBalancer.builder().id( ((Double)jsonLoadBalancer.get("loadBalancerId")).intValue() ).port( ((Double)jsonLoadBalancer.get("port")).intValue() ).build()
               );
      }

      LaunchConfiguration launchConfiguration = LaunchConfiguration.builder()
            .loadBalancers(loadBalancers.build())
            .serverName((String) server.get("name"))
            .serverImageRef((String) server.get("imageRef"))
            .serverFlavorRef((String) server.get("flavorRef"))
            .serverDiskConfig((String) server.get("OS-DCF:diskConfig"))
View Full Code Here

*
* Helper methods for parsing autoscale JSON
*/
public class ParseHelper {
   public static ImmutableMap<String, Object> buildLaunchConfigurationRequestMap(Map<String, Object> postParams) {
      LaunchConfiguration launchConfigurationRequest = (LaunchConfiguration) postParams.get("launchConfiguration");

      ImmutableMap.Builder<String, Object> launchConfigurationMapBuilder = ImmutableMap.builder();
      ImmutableMap.Builder<String, Object> argsBuilder = ImmutableMap.builder();
      ImmutableMap.Builder<String, Object> serverBuilder = ImmutableMap.builder();
      ImmutableList.Builder<Map<String, String>> networksBuilder = ImmutableList.builder();

      for (String networkId : launchConfigurationRequest.getNetworks()) {
         Map<String, String> network = Maps.newHashMap();
         network.put("uuid", networkId);
         networksBuilder.add(network);
      }

      serverBuilder.put("name", launchConfigurationRequest.getServerName());
      serverBuilder.put("imageRef", launchConfigurationRequest.getServerImageRef());
      serverBuilder.put("flavorRef", launchConfigurationRequest.getServerFlavorRef());
      serverBuilder.put("OS-DCF:diskConfig", launchConfigurationRequest.getServerDiskConfig());
      serverBuilder.put("metadata", launchConfigurationRequest.getServerMetadata());
      serverBuilder.put("personality", launchConfigurationRequest.getPersonalities());
      serverBuilder.put("networks", networksBuilder.build());

      argsBuilder.put("loadBalancers", launchConfigurationRequest.getLoadBalancers());
      argsBuilder.put("server", serverBuilder.build());

      launchConfigurationMapBuilder.put("type", launchConfigurationRequest.getType().toString());
      launchConfigurationMapBuilder.put("args", argsBuilder.build());

      return launchConfigurationMapBuilder.build();
   }
View Full Code Here

TOP

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