@Override public Location apply(Datacenter from) { return new LocationBuilder().scope(LocationScope.ZONE).id(from.id + "").description(from.name).parent( provider.get().get()).build(); }
@Override public Location apply(Zone input) { return new LocationBuilder() .description(input.getDescription().orNull()) .metadata(ImmutableMap.of("selfLink", (Object) checkNotNull(input.getSelfLink(), "zone URI"))) .id(input.getName()) .scope(LocationScope.ZONE) .parent(GOOGLE_PROVIDER_LOCATION) .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(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(String datacenter) { return new LocationBuilder().scope(LocationScope.ZONE).description(datacenter).id(datacenter) // TODO: iso3166Codes .parent(Iterables.getOnlyElement(provider.get())).build(); }
@Override public Location apply(Region input) { return new LocationBuilder() .description(input.getDescription().orNull()) .metadata(ImmutableMap.of("selfLink", (Object) checkNotNull(input.getSelfLink(), "region URI"))) .id(input.getName()) .scope(LocationScope.REGION) .parent(GOOGLE_PROVIDER_LOCATION) .build(); } }
@Override public Location apply(Zone input) { return new LocationBuilder() .description(input.getDescription().orNull()) .metadata(ImmutableMap.of("selfLink", (Object) checkNotNull(input.getSelfLink(), "zone URI"))) .id(input.getName()) .scope(LocationScope.ZONE) .parent(GOOGLE_PROVIDER_LOCATION) .build(); } }
@Override public Location apply(String datacenter) { return new LocationBuilder().scope(LocationScope.ZONE).description(datacenter).id(datacenter) // TODO: iso3166Codes .parent(Iterables.getOnlyElement(provider.get())).build(); }
@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(); }
private static Location createRegionLocation( BlobStoreProperties config, Location provider ) { return config.location != null ? new LocationBuilder() .scope( LocationScope.REGION ) .id( config.location ) .description( config.location ) .parent( provider ) .build() : null; }
@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(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(); }
@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(); }
@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(final Facility facility) { final LocationBuilder builder = new LocationBuilder(); builder.id(facility.code()); builder.description(facility.name()); builder.parent(getOnlyElement(justProvider.get())); builder.scope(LocationScope.REGION); return builder.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(); }