Package org.jclouds.domain

Examples of org.jclouds.domain.Location


   private Location findLocationWithId(final String locationId) {
      if (locationId == null)
         return null;
      try {
         Location location = Iterables.find(locations.get(), new Predicate<Location>() {

            @Override
            public boolean apply(Location input) {
               return input.getId().equals(locationId);
            }
View Full Code Here


      Set<String> addresses = addressesBuilder.build();

      builder.publicAddresses(filter(addresses, not(IsPrivateIPAddress.INSTANCE)));
      builder.privateAddresses(filter(addresses, IsPrivateIPAddress.INSTANCE));
      builder.hardware(parseHardware(instance));
      Location location = getLocationForAvailabilityZoneOrRegion(instance);
      builder.location(location);
      builder.imageId(instance.getRegion() + "/" + instance.getImageId());

      // extract the operating system from the image
      RegionAndName regionAndName = new RegionAndName(instance.getRegion(), instance.getImageId());
View Full Code Here

         return null;
      }
   }

   private Location getLocationForAvailabilityZoneOrRegion(final RunningInstance instance) {
      Location location = findLocationWithId(instance.getAvailabilityZone());
      if (location == null)
         location = findLocationWithId(instance.getRegion());
      return location;
   }
View Full Code Here

   private Location findLocationWithId(final String locationId) {
      if (locationId == null)
         return null;
      try {
         Location location = Iterables.find(locations.get(), new Predicate<Location>() {

            @Override
            public boolean apply(Location input) {
               return input.getId().equals(locationId);
            }
View Full Code Here

      expect(server.getName()).andReturn("group-ff").atLeastOnce();
      expect(server.getState()).andReturn(ServerState.ON).atLeastOnce();

      expect(serverStateToNodeStatus.get(ServerState.ON)).andReturn(Status.RUNNING);

      Location location = new LocationBuilder().scope(LocationScope.ZONE).id("1").description("US-West-1").build();
      Set< ? extends Location> locations = ImmutableSet.< Location> of( location);
     
      expect(server.getIp()).andReturn(Ip.builder().ip("127.0.0.1").build());

      ServerImage image = createMock(ServerImage.class);
View Full Code Here

               "classpath:///test1.yaml").build(ComputeServiceContext.class));
   }

   private void assertNodesParse(String endpoint, ComputeServiceContext context) {
      try {
         Location providerLocation = expectedProviderLocationFromResource(endpoint);

         Supplier<LoadingCache<String, Node>> supplier = supplier(context);

         assertEquals(supplier.get().size(), context.getComputeService().listNodes().size());
         assertEquals(supplier.get().asMap(),
View Full Code Here

         Supplier<LoadingCache<String, Node>> supplier = supplier(context);

         assertEquals(supplier.get().size(), context.getComputeService().listNodes().size());
         assertEquals(supplier.get().asMap(), ImmutableMap.<String, Node> of(NodesFromYamlTest.TEST2.getId(),
               NodesFromYamlTest.TEST2, NodesFromYamlTest.TEST3.getId(), NodesFromYamlTest.TEST3));
         Location providerLocation = expectedProviderLocationFromResource(endpoint);

         Location virginia = zoneCalled("virginia", providerLocation);
         Location maryland = zoneCalled("maryland", providerLocation);

         assertEquals(
               context.getComputeService().listNodes().toString(),
               ImmutableSet.of(expectedNodeMetadataFromResource(1, endpoint, virginia),
                     expectedNodeMetadataFromResource(2, endpoint, maryland, 2022)).toString());
View Full Code Here

   protected Location findLocationWithId(final String locationId) {
      if (locationId == null)
         return null;
      try {
         Location location = Iterables.find(locations.get(), new Predicate<Location>() {

            @Override
            public boolean apply(Location input) {
               return input.getId().equals(locationId);
            }
View Full Code Here

         }
      }

      // Try to create the same bucket successfully created above in one of the non-US regions to ensure an error is
      // encountered as expected.
      Location location = null;

      for (Location pLocation : store.listAssignableLocations()) {
         if (!ImmutableSet.of(Region.US_STANDARD, Region.US_EAST_1, Region.US_WEST_1, Region.US_WEST_2)
            .contains(pLocation.getId())) {
            location = pLocation;
View Full Code Here

   }

   @Override
   public Set<? extends Location> get() {
      Builder<Location> locations = ImmutableSet.builder();
      Location provider = Iterables.getOnlyElement(justProvider.get());
      Set<String> regions = regionsSupplier.get();
      checkState(regions.size() > 0, "no regions found for provider %s, using supplier %s", provider, regionsSupplier);
      Map<String, Supplier<Set<String>>> isoCodesById = isoCodesByIdSupplier.get();
      for (String region : regions) {
         LocationBuilder builder = new LocationBuilder().scope(LocationScope.REGION).id(region).description(region)
View Full Code Here

TOP

Related Classes of org.jclouds.domain.Location

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.