org.jclouds.openstack.nova.v2_0.domain.zonescoped.ZoneAndId.fromZoneAndId()方法的使用及代码示例

x33g5p2x  于2022-02-05 转载在 其他  
字(9.1k)|赞(0)|评价(0)|浏览(122)

本文整理了Java中org.jclouds.openstack.nova.v2_0.domain.zonescoped.ZoneAndId.fromZoneAndId()方法的一些代码示例,展示了ZoneAndId.fromZoneAndId()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZoneAndId.fromZoneAndId()方法的具体详情如下:
包路径:org.jclouds.openstack.nova.v2_0.domain.zonescoped.ZoneAndId
类名称:ZoneAndId
方法名:fromZoneAndId

ZoneAndId.fromZoneAndId介绍

暂无

代码示例

代码示例来源:origin: jclouds/legacy-jclouds

@Override
 public boolean apply(T input) {
   return input.getId().equals(ZoneAndId.fromZoneAndId(serverInZone.getZone(), objectId).slashEncode());
 }
});

代码示例来源:origin: io.cloudsoft.jclouds.api/openstack-nova

@Override
 public boolean apply(T input) {
   return input.getId().equals(ZoneAndId.fromZoneAndId(serverInZone.getZone(), objectId).slashEncode());
 }
});

代码示例来源:origin: org.jclouds.api/openstack-nova

@Override
 public boolean apply(T input) {
   return input.getId().equals(ZoneAndId.fromZoneAndId(serverInZone.getZone(), objectId).slashEncode());
 }
});

代码示例来源:origin: jclouds/legacy-jclouds

@Test
public void testReturnsNullWhenNotFound() throws Exception {
 NovaApi api = createMock(NovaApi.class);
 FloatingIPApi ipApi = createMock(FloatingIPApi.class);
 expect(api.getFloatingIPExtensionForZone("Zone")).andReturn((Optional) Optional.of(ipApi)).atLeastOnce();
 expect(ipApi.list()).andReturn((FluentIterable) FluentIterable.from(ImmutableSet.<FloatingIP> of()))
 .atLeastOnce();
 replay(api);
 replay(ipApi);
 LoadFloatingIpsForInstance parser = new LoadFloatingIpsForInstance(api);
 assertFalse(parser.load(ZoneAndId.fromZoneAndId("Zone", "i-blah")).iterator().hasNext());
 verify(api);
 verify(ipApi);
}

代码示例来源:origin: jclouds/legacy-jclouds

@Test
public void testReturnsNullWhenNotAssigned() throws Exception {
 NovaApi api = createMock(NovaApi.class);
 FloatingIPApi ipApi = createMock(FloatingIPApi.class);
 expect(api.getFloatingIPExtensionForZone("Zone")).andReturn((Optional) Optional.of(ipApi)).atLeastOnce();
 expect(ipApi.list()).andReturn((FluentIterable) FluentIterable.from(ImmutableSet.<FloatingIP> of(FloatingIP.builder().id("1").ip("1.1.1.1").build())))
 .atLeastOnce();
 replay(api);
 replay(ipApi);
 LoadFloatingIpsForInstance parser = new LoadFloatingIpsForInstance(api);
 assertFalse(parser.load(ZoneAndId.fromZoneAndId("Zone", "i-blah")).iterator().hasNext());
 verify(api);
 verify(ipApi);
}

代码示例来源:origin: jclouds/legacy-jclouds

@Test
public void testReturnsPublicIpOnMatch() throws Exception {
 NovaApi api = createMock(NovaApi.class);
 FloatingIPApi ipApi = createMock(FloatingIPApi.class);
 FloatingIP testIp = FloatingIP.builder().id("1").ip("1.1.1.1").fixedIp("10.1.1.1").instanceId("i-blah").build();
 expect(api.getFloatingIPExtensionForZone("Zone")).andReturn((Optional) Optional.of(ipApi)).atLeastOnce();
 expect(ipApi.list()).andReturn((FluentIterable) FluentIterable.from(ImmutableSet.<FloatingIP> of(testIp)))
      .atLeastOnce();
 replay(api);
 replay(ipApi);
 LoadFloatingIpsForInstance parser = new LoadFloatingIpsForInstance(api);
 assertEquals(ImmutableSet.copyOf(parser.load(ZoneAndId.fromZoneAndId("Zone", "i-blah"))), ImmutableSet.of(testIp));
 verify(api);
 verify(ipApi);
}

代码示例来源:origin: io.cloudsoft.jclouds.api/openstack-nova

return getSecurityGroupById(ZoneAndId.fromZoneAndId(zone, id).slashEncode());

代码示例来源:origin: jclouds/legacy-jclouds

addMetadataAndParseTagsFromCommaDelimitedValue(builder, from.getMetadata());
builder.group(nodeNamingConvention.groupInUniqueNameOrNull(from.getName()));
builder.imageId(ZoneAndId.fromZoneAndId(serverInZone.getZone(), from.getImage().getId()).slashEncode());
builder.operatingSystem(findOperatingSystemForServerOrNull(serverInZone));
builder.hardware(findHardwareForServerOrNull(serverInZone));

代码示例来源:origin: org.jclouds.api/openstack-nova

addMetadataAndParseTagsFromCommaDelimitedValue(builder, from.getMetadata());
builder.group(nodeNamingConvention.groupInUniqueNameOrNull(from.getName()));
builder.imageId(ZoneAndId.fromZoneAndId(serverInZone.getZone(), from.getImage().getId()).slashEncode());
builder.operatingSystem(findOperatingSystemForServerOrNull(serverInZone));
builder.hardware(findHardwareForServerOrNull(serverInZone));

代码示例来源:origin: io.cloudsoft.jclouds.api/openstack-nova

builder.group(groupFromMapOrName(from.getMetadata(), from.getName(), nodeNamingConvention));
addMetadataAndParseTagsFromCommaDelimitedValue(builder, from.getMetadata());
builder.imageId(ZoneAndId.fromZoneAndId(serverInZone.getZone(), from.getImage().getId()).slashEncode());
builder.operatingSystem(findOperatingSystemForServerOrNull(serverInZone));
builder.hardware(findHardwareForServerOrNull(serverInZone));

代码示例来源:origin: jclouds/legacy-jclouds

@Override
public ListenableFuture<Image> createImage(ImageTemplate template) {
 checkState(template instanceof CloneImageTemplate,
      " openstack-nova only supports creating images through cloning.");
 CloneImageTemplate cloneTemplate = (CloneImageTemplate) template;
 ZoneAndId sourceImageZoneAndId = ZoneAndId.fromSlashEncoded(cloneTemplate.getSourceNodeId());
 String newImageId = novaApi.getServerApiForZone(sourceImageZoneAndId.getZone()).createImageFromServer(
      cloneTemplate.getName(), sourceImageZoneAndId.getId());
 final ZoneAndId targetImageZoneAndId = ZoneAndId.fromZoneAndId(sourceImageZoneAndId.getZone(), newImageId);
 logger.info(">> Registered new Image %s, waiting for it to become available.", newImageId);
 
 final AtomicReference<Image> image = Atomics.newReference(new ImageBuilder()
    .location(find(locations.get(), idEquals(targetImageZoneAndId.getZone())))
    .id(targetImageZoneAndId.slashEncode())
    .providerId(targetImageZoneAndId.getId())
    .description(cloneTemplate.getName())
    .operatingSystem(OperatingSystem.builder().description(cloneTemplate.getName()).build())
    .status(Image.Status.PENDING).build());
 return userExecutor.submit(new Callable<Image>() {
   @Override
   public Image call() throws Exception {
    if (imageAvailablePredicate.apply(image))
      return image.get();
    // TODO: get rid of the expectation that the image will be available, as it is very brittle
    throw new UncheckedTimeoutException("Image was not created within the time limit: " + image.get());
   }
 });
}

代码示例来源:origin: org.jclouds.api/openstack-nova

@Override
public ListenableFuture<Image> createImage(ImageTemplate template) {
 checkState(template instanceof CloneImageTemplate,
      " openstack-nova only supports creating images through cloning.");
 CloneImageTemplate cloneTemplate = (CloneImageTemplate) template;
 ZoneAndId sourceImageZoneAndId = ZoneAndId.fromSlashEncoded(cloneTemplate.getSourceNodeId());
 String newImageId = novaApi.getServerApiForZone(sourceImageZoneAndId.getZone()).createImageFromServer(
      cloneTemplate.getName(), sourceImageZoneAndId.getId());
 final ZoneAndId targetImageZoneAndId = ZoneAndId.fromZoneAndId(sourceImageZoneAndId.getZone(), newImageId);
 logger.info(">> Registered new Image %s, waiting for it to become available.", newImageId);
 
 final AtomicReference<Image> image = Atomics.newReference(new ImageBuilder()
    .location(find(locations.get(), idEquals(targetImageZoneAndId.getZone())))
    .id(targetImageZoneAndId.slashEncode())
    .providerId(targetImageZoneAndId.getId())
    .description(cloneTemplate.getName())
    .operatingSystem(OperatingSystem.builder().description(cloneTemplate.getName()).build())
    .status(Image.Status.PENDING).build());
 return userExecutor.submit(new Callable<Image>() {
   @Override
   public Image call() throws Exception {
    if (imageAvailablePredicate.apply(image))
      return image.get();
    // TODO: get rid of the expectation that the image will be available, as it is very brittle
    throw new UncheckedTimeoutException("Image was not created within the time limit: " + image.get());
   }
 });
}

代码示例来源:origin: io.cloudsoft.jclouds.api/openstack-nova

@Override
public ListenableFuture<Image> createImage(ImageTemplate template) {
 checkState(template instanceof CloneImageTemplate,
      " openstack-nova only supports creating images through cloning.");
 CloneImageTemplate cloneTemplate = (CloneImageTemplate) template;
 ZoneAndId sourceImageZoneAndId = ZoneAndId.fromSlashEncoded(cloneTemplate.getSourceNodeId());
 String newImageId = novaApi.getServerApiForZone(sourceImageZoneAndId.getZone()).createImageFromServer(
      cloneTemplate.getName(), sourceImageZoneAndId.getId());
 final ZoneAndId targetImageZoneAndId = ZoneAndId.fromZoneAndId(sourceImageZoneAndId.getZone(), newImageId);
 logger.info(">> Registered new Image %s, waiting for it to become available.", newImageId);
 
 final AtomicReference<Image> image = Atomics.newReference(new ImageBuilder()
    .location(find(locations.get(), idEquals(targetImageZoneAndId.getZone())))
    .id(targetImageZoneAndId.slashEncode())
    .providerId(targetImageZoneAndId.getId())
    .description(cloneTemplate.getName())
    .operatingSystem(OperatingSystem.builder().description(cloneTemplate.getName()).build())
    .status(Image.Status.PENDING).build());
 return userExecutor.submit(new Callable<Image>() {
   @Override
   public Image call() throws Exception {
    if (imageAvailablePredicate.apply(image))
      return image.get();
    // TODO: get rid of the expectation that the image will be available, as it is very brittle
    throw new UncheckedTimeoutException("Image was not created within the time limit: " + image.get());
   }
 });
}

代码示例来源:origin: io.cloudsoft.jclouds.api/openstack-nova

return getSecurityGroupById(ZoneAndId.fromZoneAndId(zone, id).slashEncode());

相关文章