本文整理了Java中org.jclouds.location.suppliers.all.ZoneToRegionToProviderOrJustProvider
类的一些代码示例,展示了ZoneToRegionToProviderOrJustProvider
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZoneToRegionToProviderOrJustProvider
类的具体详情如下:
包路径:org.jclouds.location.suppliers.all.ZoneToRegionToProviderOrJustProvider
类名称:ZoneToRegionToProviderOrJustProvider
暂无
代码示例来源:origin: apache/jclouds
@Test
public void testRegionAndZoneFilter() {
Supplier<Set<String>> regionIdsSupplier = Suppliers.<Set<String>> ofInstance(ImmutableSet.of("region2"));
Supplier<Set<String>> zoneIdsSupplier = Suppliers.<Set<String>> ofInstance(ImmutableSet.<String> of("zone2"));
RegionToProviderOrJustProvider regionToProviderOrJustProvider = new RegionToProviderOrJustProvider(justProvider, regionIdsSupplier, locationToIsoCodes);
ZoneToRegionToProviderOrJustProvider fn = new ZoneToRegionToProviderOrJustProvider(regionToProviderOrJustProvider, zoneIdsSupplier, locationToIsoCodes, regionToZones);
assertEquals(fn.get(), ImmutableSet.of(region2, zone2));
}
}
代码示例来源:origin: com.amysta.jclouds/jclouds-core
@Override
public Set<? extends Location> get() {
Set<? extends Location> regionsOrJustProvider = regionToProviderOrJustProvider.get();
Set<String> zoneIds = zoneIdsSupplier.get();
if (zoneIds.isEmpty())
return regionsOrJustProvider;
Map<String, Location> zoneIdToParent = setParentOfZoneToRegionOrProvider(zoneIds, regionsOrJustProvider);
Map<String, Supplier<Set<String>>> isoCodesById = isoCodesByIdSupplier.get();
Builder<Location> locations = ImmutableSet.builder();
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();
}
代码示例来源:origin: jclouds/legacy-jclouds
@Override
public Set<? extends Location> get() {
Set<? extends Location> regionsOrJustProvider = regionToProviderOrJustProvider.get();
Set<String> zoneIds = zoneIdsSupplier.get();
if (zoneIds.size() == 0)
return regionsOrJustProvider;
Map<String, Location> zoneIdToParent = setParentOfZoneToRegionOrProvider(zoneIds, regionsOrJustProvider);
Map<String, Supplier<Set<String>>> isoCodesById = isoCodesByIdSupplier.get();
Builder<Location> locations = ImmutableSet.builder();
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();
}
代码示例来源:origin: org.jclouds/jclouds-core
@Override
public Set<? extends Location> get() {
Set<? extends Location> regionsOrJustProvider = regionToProviderOrJustProvider.get();
Set<String> zoneIds = zoneIdsSupplier.get();
if (zoneIds.size() == 0)
return regionsOrJustProvider;
Map<String, Location> zoneIdToParent = setParentOfZoneToRegionOrProvider(zoneIds, regionsOrJustProvider);
Map<String, Supplier<Set<String>>> isoCodesById = isoCodesByIdSupplier.get();
Builder<Location> locations = ImmutableSet.builder();
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();
}
代码示例来源:origin: apache/jclouds
@Test
public void testGetAll() {
Supplier<Set<String>> regionIdsSupplier = Suppliers.<Set<String>> ofInstance(ImmutableSet.of("region1", "region2"));
Supplier<Set<String>> zoneIdsSupplier = Suppliers.<Set<String>> ofInstance(ImmutableSet.of("zone1", "zone2", "zone3"));
RegionToProviderOrJustProvider regionToProviderOrJustProvider = new RegionToProviderOrJustProvider(justProvider, regionIdsSupplier, locationToIsoCodes);
ZoneToRegionToProviderOrJustProvider fn = new ZoneToRegionToProviderOrJustProvider(regionToProviderOrJustProvider, zoneIdsSupplier, locationToIsoCodes, regionToZones);
assertEquals(fn.get(), ImmutableSet.of(region1, region2, zone1, zone2, zone3));
}
代码示例来源:origin: io.cloudsoft.jclouds/jclouds-core
@Override
public Set<? extends Location> get() {
Set<? extends Location> regionsOrJustProvider = regionToProviderOrJustProvider.get();
Set<String> zoneIds = zoneIdsSupplier.get();
if (zoneIds.size() == 0)
return regionsOrJustProvider;
Map<String, Location> zoneIdToParent = setParentOfZoneToRegionOrProvider(zoneIds, regionsOrJustProvider);
Map<String, Supplier<Set<String>>> isoCodesById = isoCodesByIdSupplier.get();
Builder<Location> locations = ImmutableSet.builder();
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();
}
代码示例来源:origin: Nextdoor/bender
@Override
public Set<? extends Location> get() {
Set<? extends Location> regionsOrJustProvider = regionToProviderOrJustProvider.get();
Set<String> zoneIds = zoneIdsSupplier.get();
if (zoneIds.isEmpty())
return regionsOrJustProvider;
Map<String, Location> zoneIdToParent = setParentOfZoneToRegionOrProvider(zoneIds, regionsOrJustProvider);
Map<String, Supplier<Set<String>>> isoCodesById = isoCodesByIdSupplier.get();
Builder<Location> locations = ImmutableSet.builder();
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();
}
代码示例来源:origin: apache/jclouds
@Override
public Set<? extends Location> get() {
Set<? extends Location> regionsOrJustProvider = regionToProviderOrJustProvider.get();
Set<String> zoneIds = zoneIdsSupplier.get();
if (zoneIds.isEmpty())
return regionsOrJustProvider;
Map<String, Location> zoneIdToParent = setParentOfZoneToRegionOrProvider(zoneIds, regionsOrJustProvider);
Map<String, Supplier<Set<String>>> isoCodesById = isoCodesByIdSupplier.get();
Builder<Location> locations = ImmutableSet.builder();
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();
}
内容来源于网络,如有侵权,请联系作者删除!