@Override public Set<? extends Location> get() { return ImmutableSet.of(new LocationBuilder().scope(LocationScope.PROVIDER).id(providerName) .description(endpointSupplier.get().toASCIIString()).iso3166Codes(isoCodesSupplier).build()); }
@Override public Set<? extends Location> get() { return ImmutableSet.of(new LocationBuilder().scope(LocationScope.PROVIDER).id(providerName) .description(endpointSupplier.get().toASCIIString()).iso3166Codes(isoCodesSupplier).build()); }
@Override public Set<? extends Location> get() { return ImmutableSet.of(new LocationBuilder().scope(LocationScope.PROVIDER).id(providerName) .description(endpointSupplier.get().toASCIIString()).iso3166Codes(isoCodesSupplier).build()); }
@Override public Set<? extends Location> get() { return ImmutableSet.of(new LocationBuilder().scope(LocationScope.PROVIDER).id(providerName) .description(endpointSupplier.get().toASCIIString()).iso3166Codes(isoCodesSupplier).build()); }
@Override public Set<? extends Location> get() { return ImmutableSet.of(new LocationBuilder().scope(LocationScope.PROVIDER).id(providerName) .description(endpointSupplier.get().toASCIIString()).iso3166Codes(isoCodesSupplier).build()); }
@Override public Location apply(Option from) { LocationBuilder builder = new LocationBuilder().scope(LocationScope.ZONE).id(from.getId() + "").description( from.getDescription()).parent(provider); Map<String, Supplier<Set<String>>> isoCodesById = isoCodesByIdSupplier.get(); if (isoCodesById.containsKey(from.getId() + "")) builder.iso3166Codes(isoCodesById.get(from.getId() + "").get()); return builder.build(); } }
@Override public Location apply(Option from) { LocationBuilder builder = new LocationBuilder().scope(LocationScope.ZONE).id(from.getId() + "").description( from.getDescription()).parent(provider); Map<String, Supplier<Set<String>>> isoCodesById = isoCodesByIdSupplier.get(); if (isoCodesById.containsKey(from.getId() + "")) builder.iso3166Codes(isoCodesById.get(from.getId() + "").get()); return builder.build(); } }
@Override public Location apply(Option from) { LocationBuilder builder = new LocationBuilder().scope(LocationScope.ZONE).id(from.getId() + "").description( from.getDescription()).parent(provider); Map<String, Supplier<Set<String>>> isoCodesById = isoCodesByIdSupplier.get(); if (isoCodesById.containsKey(from.getId() + "")) builder.iso3166Codes(isoCodesById.get(from.getId() + "").get()); return builder.build(); } }
@Override public Location apply(Option from) { LocationBuilder builder = new LocationBuilder().scope(LocationScope.ZONE).id(from.getId() + "").description( from.getDescription()).parent(provider); Map<String, Supplier<Set<String>>> isoCodesById = isoCodesByIdSupplier.get(); if (isoCodesById.containsKey(from.getId() + "")) builder.iso3166Codes(isoCodesById.get(from.getId() + "").get()); return builder.build(); } }
@Override public Location apply(Option from) { LocationBuilder builder = new LocationBuilder().scope(LocationScope.ZONE).id(from.getId() + "").description( from.getDescription()).parent(provider); Map<String, Supplier<Set<String>>> isoCodesById = isoCodesByIdSupplier.get(); if (isoCodesById.containsKey(from.getId() + "")) builder.iso3166Codes(isoCodesById.get(from.getId() + "").get()); return builder.build(); } }
@Override public Location apply(Datacenter datacenter) { return new LocationBuilder().scope(LocationScope.ZONE) .metadata(ImmutableMap.<String, Object>of()) .description(datacenter.getLongName()) .id(Long.toString(datacenter.getId())) .iso3166Codes(createIso3166Codes(datacenter.getLocationAddress())) .parent(Iterables.getOnlyElement(provider.get())) .build(); }
@Test public void test() throws SecurityException, NoSuchMethodException { JustProvider fn = new JustProvider("servo", Suppliers.ofInstance(URI.create("http://servo")), ImmutableSet.of("US")); assertEquals( fn.get(), ImmutableSet.of(new LocationBuilder().scope(LocationScope.PROVIDER).id("servo").description("http://servo") .iso3166Codes(ImmutableSet.of("US")).build())); }
@Override public Location apply(Datacenter datacenter) { return new LocationBuilder().scope(LocationScope.ZONE) .metadata(ImmutableMap.<String, Object>of()) .description(datacenter.getLongName()) .id(Long.toString(datacenter.getId())) .iso3166Codes(createIso3166Codes(datacenter.getLocationAddress())) .parent(Iterables.getOnlyElement(provider.get())) .build(); }
@Override public Location apply(Region input) { LocationBuilder builder = new LocationBuilder(); builder.id(input.slug()); builder.description(input.name()); builder.scope(LocationScope.REGION); builder.parent(getOnlyElement(justProvider.get())); builder.iso3166Codes(ImmutableSet.<String> of()); builder.metadata(ImmutableMap.<String, Object> of("available", input.available(), "features", input.features())); return builder.build(); } }
@Override public Location apply(Region input) { LocationBuilder builder = new LocationBuilder(); builder.id(input.slug()); builder.description(input.name()); builder.scope(LocationScope.REGION); builder.parent(getOnlyElement(justProvider.get())); builder.iso3166Codes(ImmutableSet.<String> of()); builder.metadata(ImmutableMap.<String, Object> of("available", input.available(), "features", input.features())); return builder.build(); } }
@Override public Location apply(Realm from) { return new LocationBuilder().scope(LocationScope.ZONE).id(from.getHref().toASCIIString()).description(from.getName()).parent( new LocationBuilder().scope(LocationScope.PROVIDER).iso3166Codes(isoCodes).id(providerName).description( endpoint.get().toASCIIString()).parent(null).build()).build(); } }
@Override public Location apply(Datacenter datacenter) { return new LocationBuilder().id(datacenter.getName()) .description(datacenter.getLongName()) .scope(LocationScope.ZONE) .iso3166Codes(createIso3166Codes(datacenter.getLocationAddress())) .parent(Iterables.getOnlyElement(provider.get())) .metadata(ImmutableMap.<String, Object>of("name", datacenter.getName())) .build(); }
@Override public Location apply(Datacenter datacenter) { return new LocationBuilder().id(datacenter.getName()) .description(datacenter.getLongName()) .scope(LocationScope.ZONE) .iso3166Codes(createIso3166Codes(datacenter.getLocationAddress())) .parent(Iterables.getOnlyElement(provider.get())) .metadata(ImmutableMap.<String, Object>of("name", datacenter.getName())) .build(); }
@Override public Location apply(Datacenter datacenter) { return new LocationBuilder().id(datacenter.getName()) .description(datacenter.getLongName()) .scope(LocationScope.ZONE) .iso3166Codes(createIso3166Codes(datacenter.getLocationAddress())) .parent(Iterables.getOnlyElement(provider.get())) .metadata(ImmutableMap.<String, Object>of("name", datacenter.getName())) .build(); }
@Override public Location apply(Datacenter datacenter) { return new LocationBuilder().id(datacenter.getName()) .description(datacenter.getLongName()) .scope(LocationScope.ZONE) .iso3166Codes(createIso3166Codes(datacenter.getLocationAddress())) .parent(Iterables.getOnlyElement(provider.get())) .metadata(ImmutableMap.<String, Object>of("name", datacenter.getName())) .build(); }