Examples of LocationBuilder


Examples of org.jclouds.domain.LocationBuilder

      requestResponseMap.put(extensionsOfNovaRequest, extensionsOfNovaResponse);
      requestResponseMap.put(list, listResponse).build();

      SecurityGroupExtension extension = requestsSendResponses(requestResponseMap.build()).getSecurityGroupExtension().get();

      Set<SecurityGroup> groups = extension.listSecurityGroupsInLocation(new LocationBuilder()
              .scope(LocationScope.ZONE)
              .id(zone)
              .description("zone")
              .build());
      assertEquals(groups.size(), 1);
View Full Code Here

Examples of org.jclouds.domain.LocationBuilder

      requestResponseMap.put(list, listResponse);
      requestResponseMap.put(getSecurityGroup, getSecurityGroupResponse).build();

      SecurityGroupExtension extension = requestsSendResponses(requestResponseMap.build()).getSecurityGroupExtension().get();

      SecurityGroup group = extension.createSecurityGroup("test", new LocationBuilder()
              .scope(LocationScope.ZONE)
              .id(zone)
              .description("zone")
              .build());
      assertEquals(group.getId(), zone + "/160");
View Full Code Here

Examples of org.jclouds.domain.LocationBuilder

      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)
                  .parent(provider);
         if (isoCodesById.containsKey(region))
            builder.iso3166Codes(isoCodesById.get(region).get());
         locations.add(builder.build());
      }
      return locations.build();
   }
View Full Code Here

Examples of org.jclouds.domain.LocationBuilder

      if (!Iterables.all(regionsOrJustProvider, LocationPredicates.isProvider()))
         locations.addAll(regionsOrJustProvider);
      for (Map.Entry<String, Location> entry : zoneIdToParent.entrySet()) {
         String zoneId = entry.getKey();
         Location parent = entry.getValue();
         LocationBuilder builder = new LocationBuilder().scope(LocationScope.ZONE).id(zoneId).description(zoneId)
                  .parent(parent);
         if (isoCodesById.containsKey(zoneId))
            builder.iso3166Codes(isoCodesById.get(zoneId).get());
         // be cautious.. only inherit iso codes if the parent is a region
         // regions may be added dynamically, and we prefer to inherit an
         // empty set of codes from a region, then a provider, whose code
         // are likely hard-coded.
         else if (parent.getScope() == LocationScope.REGION)
            builder.iso3166Codes(parent.getIso3166Codes());
         locations.add(builder.build());
      }
      return locations.build();
   }
View Full Code Here

Examples of org.jclouds.domain.LocationBuilder

      this.provider = checkNotNull(provider, "provider");
   }

   @Override
   public Location apply(Datacenter from) {
      return new LocationBuilder().scope(LocationScope.ZONE).id(from.id + "").description(from.name).parent(
               provider.get().get()).build();
   }
View Full Code Here

Examples of org.jclouds.domain.LocationBuilder

      checkState(zoneIds.size() > 0, "no zones found for provider %s, using supplier %s", provider, zoneIdsSupplier);
      Map<String, Supplier<Set<String>>> isoCodesById = isoCodesByIdSupplier.get();

      Builder<Location> locations = ImmutableSet.builder();
      for (String zoneId : zoneIds) {
         LocationBuilder builder = new LocationBuilder().scope(LocationScope.ZONE).id(zoneId).description(zoneId)
                  .parent(provider);
         if (isoCodesById.containsKey(zoneId))
            builder.iso3166Codes(isoCodesById.get(zoneId).get());
         locations.add(builder.build());
      }
      return locations.build();
   }
View Full Code Here

Examples of org.jclouds.domain.LocationBuilder

      Map<String, Supplier<Set<String>>> isoCodesById = isoCodesByIdSupplier.get();
      if (regions.size() == 0)
         return locations.add(provider).build();
      else
         for (String region : regions) {
            LocationBuilder builder = new LocationBuilder().scope(LocationScope.REGION).id(region).description(region)
                     .parent(provider);
            if (isoCodesById.containsKey(region))
               builder.iso3166Codes(isoCodesById.get(region).get());
            locations.add(builder.build());
         }
      return locations.build();
   }
View Full Code Here

Examples of org.jclouds.domain.LocationBuilder

      this.isoCodesSupplier = checkNotNull(isoCodesSupplier, "isoCodes");
   }

   @Override
   public Set<? extends Location> get() {
      return ImmutableSet.of(new LocationBuilder().scope(LocationScope.PROVIDER).id(providerName)
            .description(endpointSupplier.get().toASCIIString()).iso3166Codes(isoCodesSupplier).build());
   }
View Full Code Here

Examples of org.jclouds.domain.LocationBuilder

      this.provider = checkNotNull(provider, "provider");
   }

   @Override
   public Location apply(String datacenter) {
      return new LocationBuilder().scope(LocationScope.ZONE).description(datacenter).id(datacenter)
      // TODO: iso3166Codes
               .parent(Iterables.getOnlyElement(provider.get())).build();
   }
View Full Code Here

Examples of org.jclouds.domain.LocationBuilder

      this.provider = checkNotNull(provider, "provider");
   }

   @Override
   public Location apply(Zone zone) {
      return new LocationBuilder().scope(LocationScope.ZONE).metadata(ImmutableMap.<String, Object> of())
          .description(zone.getName()).id(zone.getId())
            .parent(Iterables.getOnlyElement(provider.get())).build();
   }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.