Package org.jclouds.openstack.nova.v2_0.domain

Examples of org.jclouds.openstack.nova.v2_0.domain.ServerWithSecurityGroups$ConcreteBuilder


      return props;
   }
  
   protected Server createServerInZone(String zoneId) {
      ServerApi serverApi = api.getServerApiForZone(zoneId);
      ServerCreated server = serverApi.create(hostName, imageIdForZone(zoneId), flavorRefForZone(zoneId));
      blockUntilServerInState(server.getId(), serverApi, Status.ACTIVE);
      return serverApi.get(server.getId());
   }
View Full Code Here


      if (!serverApi.isPresent() || !sgApi.isPresent()) {
         return ImmutableSet.of();
      }

      ServerWithSecurityGroups instance = serverApi.get().get(instanceId);
      if (instance == null) {
         return ImmutableSet.of();
      }

      Set<String> groupNames = instance.getSecurityGroupNames();
      Set<? extends SecurityGroupInZone> rawGroups =
              sgApi.get().list().filter(nameIn(groupNames)).transform(groupToGroupInZone(zone)).toSet();

      return ImmutableSet.copyOf(transform(filter(rawGroups, notNull()), groupConverter));
   }
View Full Code Here

   public void testGetServer() {
      if (apiOption.isPresent()) {

         for (Resource server : serverApi.list().concat()) {
            ServerWithSecurityGroups serverWithGroups = apiOption.get().get(server.getId());
            assertEquals(serverWithGroups.getId(), server.getId());
            assertEquals(serverWithGroups.getName(), server.getName());
            assertNotNull(serverWithGroups.getSecurityGroupNames());
         }

         // Create a new server to verify the groups work as expected
         Server testServer = null;
         try {
            testServer = createServerInZone(zone);
           
            ServerWithSecurityGroups results = apiOption.get().get(testServer.getId());
            assertEquals(results.getId(), testServer.getId());
            assertEquals(results.getSecurityGroupNames(), ImmutableSet.of("default"));
         } finally {
            if (testServer != null) {
               serverApi.delete(testServer.getId());
            }
         }
View Full Code Here

            responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
            authenticatedGET().endpoint(endpoint).build(),
            HttpResponse.builder().statusCode(200).payload(payloadFromResource("/server_with_security_groups.json")).build()
      ).getServerWithSecurityGroupsExtensionForZone("az-1.region-a.geo-1").get();

      ServerWithSecurityGroups server = api.get("8d0a6ca5-8849-4b3d-b86e-f24c92490ebb");
      assertEquals(server.getId(), "8d0a6ca5-8849-4b3d-b86e-f24c92490ebb");
      assertEquals(server.getSecurityGroupNames(), ImmutableSet.of("default", "group1"));
   }
View Full Code Here

            responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
            authenticatedGET().endpoint(endpoint).build(),
            HttpResponse.builder().statusCode(200).payload(payloadFromResource("/server_with_security_groups.json")).build()
      ).getServerWithSecurityGroupsExtensionForZone("az-1.region-a.geo-1").get();

      ServerWithSecurityGroups server = api.get("8d0a6ca5-8849-4b3d-b86e-f24c92490ebb");
      assertEquals(server.getId(), "8d0a6ca5-8849-4b3d-b86e-f24c92490ebb");
      assertEquals(server.getSecurityGroupNames(), ImmutableSet.of("default", "group1"));
   }
View Full Code Here

   public void testGetServer() {
      if (apiOption.isPresent()) {

         for (Resource server : serverApi.list().concat()) {
            ServerWithSecurityGroups serverWithGroups = apiOption.get().get(server.getId());
            assertEquals(serverWithGroups.getId(), server.getId());
            assertEquals(serverWithGroups.getName(), server.getName());
            assertNotNull(serverWithGroups.getSecurityGroupNames());
         }

         // Create a new server to verify the groups work as expected
         Server testServer = null;
         try {
            testServer = createServerInZone(zone);
           
            ServerWithSecurityGroups results = apiOption.get().get(testServer.getId());
            assertEquals(results.getId(), testServer.getId());
            assertEquals(results.getSecurityGroupNames(), ImmutableSet.of("default"));
         } finally {
            if (testServer != null) {
               serverApi.delete(testServer.getId());
            }
         }
View Full Code Here

      if (!serverApi.isPresent() || !sgApi.isPresent()) {
         return ImmutableSet.of();
      }

      ServerWithSecurityGroups instance = serverApi.get().get(instanceId);
      if (instance == null) {
         return ImmutableSet.of();
      }

      Set<String> groupNames = instance.getSecurityGroupNames();
      Set<? extends SecurityGroupInZone> rawGroups =
              sgApi.get().list().filter(nameIn(groupNames)).transform(groupToGroupInZone(zone)).toSet();

      return ImmutableSet.copyOf(transform(filter(rawGroups, notNull()), groupConverter));
   }
View Full Code Here

            responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
            authenticatedGET().endpoint(endpoint).build(),
            HttpResponse.builder().statusCode(200).payload(payloadFromResource("/server_with_security_groups.json")).build()
      ).getServerWithSecurityGroupsExtensionForZone("az-1.region-a.geo-1").get();

      ServerWithSecurityGroups server = api.get("8d0a6ca5-8849-4b3d-b86e-f24c92490ebb");
      assertEquals(server.getId(), "8d0a6ca5-8849-4b3d-b86e-f24c92490ebb");
      assertEquals(server.getSecurityGroupNames(), ImmutableSet.of("default", "group1"));
   }
View Full Code Here

   public void testGetServer() {
      if (apiOption.isPresent()) {

         for (Resource server : serverApi.list().concat()) {
            ServerWithSecurityGroups serverWithGroups = apiOption.get().get(server.getId());
            assertEquals(serverWithGroups.getId(), server.getId());
            assertEquals(serverWithGroups.getName(), server.getName());
            assertNotNull(serverWithGroups.getSecurityGroupNames());
         }

         // Create a new server to verify the groups work as expected
         Server testServer = null;
         try {
            testServer = createServerInZone(zone);
           
            ServerWithSecurityGroups results = apiOption.get().get(testServer.getId());
            assertEquals(results.getId(), testServer.getId());
            assertEquals(results.getSecurityGroupNames(), ImmutableSet.of("default"));
         } finally {
            if (testServer != null) {
               serverApi.delete(testServer.getId());
            }
         }
View Full Code Here

      if (!serverApi.isPresent() || !sgApi.isPresent()) {
         return ImmutableSet.of();
      }

      ServerWithSecurityGroups instance = serverApi.get().get(instanceId);
      if (instance == null) {
         return ImmutableSet.of();
      }

      Set<String> groupNames = instance.getSecurityGroupNames();
      Set<? extends SecurityGroupInRegion> rawGroups =
              sgApi.get().list().filter(nameIn(groupNames)).transform(groupToGroupInRegion(region)).toSet();

      return ImmutableSet.copyOf(transform(filter(rawGroups, notNull()), groupConverter));
   }
View Full Code Here

TOP

Related Classes of org.jclouds.openstack.nova.v2_0.domain.ServerWithSecurityGroups$ConcreteBuilder

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.