Examples of LocationBuilder


Examples of org.jclouds.domain.LocationBuilder

    ClusterControllerFactory factory = mock(ClusterControllerFactory.class);
    ClusterController controller = mock(ClusterController.class);
    when(factory.create((String) any())).thenReturn(controller);

    NodeMetadata node1 = new NodeMetadataBuilder().name("name1").ids("id1")
        .location(new LocationBuilder().scope(LocationScope.PROVIDER)
          .id("location-id1").description("location-desc1").build())
        .imageId("image-id").state(NodeState.RUNNING)
        .publicAddresses(Lists.newArrayList("127.0.0.1"))
        .privateAddresses(Lists.newArrayList("127.0.0.1")).build();

    NodeMetadata node2 = new NodeMetadataBuilder().name("name2").ids("id2")
        .location(new LocationBuilder().scope(LocationScope.PROVIDER)
          .id("location-id2").description("location-desc2").build())
        .imageId("image-id").state(NodeState.RUNNING)
        .publicAddresses(Lists.newArrayList("127.0.0.2"))
        .privateAddresses(Lists.newArrayList("127.0.0.2")).build();
View Full Code Here

Examples of org.jclouds.domain.LocationBuilder

      hardwares = ImmutableSet.of(new HardwareBuilder().id("2gb").providerId("1").name("mock hardware")
            .processor(new Processor(1.0, 1.0)).ram(2048)
            .volume(new VolumeBuilder().size(20f).type(Type.LOCAL).build()).build());

      locations = ImmutableSet.of(new LocationBuilder()
            .id("1")
            .description("1/mock location")
            .scope(LocationScope.REGION)
            .parent(
                  new LocationBuilder().id("0").description("mock parent location").scope(LocationScope.PROVIDER)
                        .build()).build());

      credentials = LoginCredentials.builder().user("foo").password("bar").build();

      function = createNodeParser(hardwares, images, locations, ImmutableMap.of("node#1", (Credentials) credentials));
View Full Code Here

Examples of org.jclouds.domain.LocationBuilder

      DigitalOceanProviderMetadata metadata = new DigitalOceanProviderMetadata();
      JustProvider locationsSupplier = new JustProvider(metadata.getId(), Suppliers.<URI> ofInstance(URI
            .create(metadata.getEndpoint())), ImmutableSet.<String> of());

      Region region = new Region(1, "Region 1", "reg1");
      Location expected = new LocationBuilder().id("reg1").description("1/Region 1")
            .parent(getOnlyElement(locationsSupplier.get())).scope(LocationScope.REGION).build();

      RegionToLocation function = new RegionToLocation(locationsSupplier);
      assertEquals(function.apply(region), expected);
   }
View Full Code Here

Examples of org.jclouds.domain.LocationBuilder

      this.justProvider = checkNotNull(justProvider, "justProvider cannot be null");
   }

   @Override
   public Location apply(Region input) {
      LocationBuilder builder = new LocationBuilder();
      builder.id(input.getSlug());
      builder.description(encodeRegionIdAndName(input));
      builder.scope(LocationScope.REGION);
      builder.parent(getOnlyElement(justProvider.get()));
      builder.iso3166Codes(ImmutableSet.<String> of());
      return builder.build();
   }
View Full Code Here

Examples of org.jclouds.domain.LocationBuilder

         // Success
      }
   }

   private static Location location(String description) {
      return new LocationBuilder().id("location").description(description).scope(LocationScope.REGION).build();
   }
View Full Code Here

Examples of org.jclouds.domain.LocationBuilder

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

   @Override
   public Location apply(final VirtualDatacenter vdc) {
      LocationBuilder builder = new LocationBuilder();
      builder.id(vdc.getId().toString());
      builder.description(vdc.getName());
      builder.metadata(ImmutableMap.<String, Object> of());
      builder.scope(LocationScope.ZONE);
      builder.iso3166Codes(ImmutableSet.<String> of());

      Datacenter parent = regionMap.get().get(vdc.unwrap().getIdFromLink(ParentLinkName.DATACENTER));
      builder.parent(datacenterToLocation.apply(parent));

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

Examples of org.jclouds.domain.LocationBuilder

@Singleton
public class DatacenterToLocation implements Function<Datacenter, Location> {

   @Override
   public Location apply(final Datacenter datacenter) {
      LocationBuilder builder = new LocationBuilder();
      builder.id(datacenter.getId().toString());
      builder.description(datacenter.getName() + " [" + datacenter.getLocation() + "]");
      builder.metadata(ImmutableMap.<String, Object> of());
      builder.scope(LocationScope.REGION);
      builder.iso3166Codes(ImmutableSet.<String> of());

      builder.parent(new LocationBuilder().scope(LocationScope.PROVIDER).id("abiquo").description("abiquo").build());

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

Examples of org.jclouds.domain.LocationBuilder

      for (VSystem system : api.getVirtualDCApi().listVirtualSystems()) {

         VSystemWithDetails systemWithDetails = api.getVirtualSystemApi().getDetails(system.getId());

         Location systemLocation = new LocationBuilder().scope(LocationScope.SYSTEM)
               .parent(Iterables.getOnlyElement(regionProvider.get())).description(system.getName()).id(system.getId())
               .build();

         for (VNet net : systemWithDetails.getNetworks()) {

            locations.add(new LocationBuilder().scope(LocationScope.NETWORK).parent(systemLocation)
                  .description(net.getNetworkId().replaceFirst(".+-N-", "")).id(net.getNetworkId())
                  .build());
         }
      }
View Full Code Here

Examples of org.jclouds.domain.LocationBuilder

      Supplier<Set<? extends Location>> locations = new Supplier<Set< ? extends Location>>() {
         @Override
         public Set<? extends Location> get() {

            return ImmutableSet.of(
                    new LocationBuilder()
                            .id("docker")
                            .description("http://localhost:2375")
                            .scope(LocationScope.PROVIDER)
                            .build()
            );
View Full Code Here

Examples of org.jclouds.domain.LocationBuilder

   @Override
   public Location apply(Network from) {
      Matcher matcher = netPattern.matcher(from.getHref().toASCIIString());
      if (matcher.find()) {
         Location provider = new LocationBuilder().scope(LocationScope.PROVIDER).id(providerName).description(
                  endpoint.get().toASCIIString()).iso3166Codes(isoCodes).build();

         Org org = api.getBrowsingApi().getOrg(matcher.group(1));

         Location orgLocation = new LocationBuilder().scope(LocationScope.REGION).id(org.getId()).description(
                  org.getDescription()).parent(provider).build();

         VDC vdc = api.getBrowsingApi().getVDCInOrg(org.getId(), matcher.group(2));

         Location vdcLocation = new LocationBuilder().scope(LocationScope.ZONE).id(vdc.getId()).description(
                  vdc.getDescription()).parent(orgLocation).build();

         return new LocationBuilder().scope(LocationScope.NETWORK).id(from.getId()).description(from.getName()).parent(
                  vdcLocation).build();
      } else {
         throw new IllegalArgumentException("network unparsable: " + from);
      }
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.