本文整理了Java中org.jclouds.openstack.nova.v2_0.domain.zonescoped.ZoneAndId.fromSlashEncoded()
方法的一些代码示例,展示了ZoneAndId.fromSlashEncoded()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZoneAndId.fromSlashEncoded()
方法的具体详情如下:
包路径:org.jclouds.openstack.nova.v2_0.domain.zonescoped.ZoneAndId
类名称:ZoneAndId
方法名:fromSlashEncoded
暂无
代码示例来源:origin: io.cloudsoft.jclouds.api/openstack-nova
@Override
public SecurityGroup getSecurityGroupById(String id) {
ZoneAndId zoneAndId = ZoneAndId.fromSlashEncoded(checkNotNull(id, "id"));
String zone = zoneAndId.getZone();
String groupId = zoneAndId.getId();
Optional<? extends SecurityGroupApi> sgApi = api.getSecurityGroupExtensionForZone(zone);
if (!sgApi.isPresent()) {
return null;
}
SecurityGroupInZone rawGroup = new SecurityGroupInZone(sgApi.get().get(groupId), zone);
return groupConverter.apply(rawGroup);
}
代码示例来源:origin: jclouds/legacy-jclouds
@Override
public void suspendNode(String id) {
ZoneAndId zoneAndId = ZoneAndId.fromSlashEncoded(id);
if (novaApi.getServerAdminExtensionForZone(zoneAndId.getZone()).isPresent()) {
novaApi.getServerAdminExtensionForZone(zoneAndId.getZone()).get().suspend(zoneAndId.getId());
}
throw new UnsupportedOperationException("suspend requires installation of the Admin Actions extension");
}
代码示例来源:origin: jclouds/legacy-jclouds
@Override
public void resumeNode(String id) {
ZoneAndId zoneAndId = ZoneAndId.fromSlashEncoded(id);
if (novaApi.getServerAdminExtensionForZone(zoneAndId.getZone()).isPresent()) {
novaApi.getServerAdminExtensionForZone(zoneAndId.getZone()).get().resume(zoneAndId.getId());
}
throw new UnsupportedOperationException("resume requires installation of the Admin Actions extension");
}
代码示例来源:origin: io.cloudsoft.jclouds.api/openstack-nova
@Override
public void resumeNode(String id) {
ZoneAndId zoneAndId = ZoneAndId.fromSlashEncoded(id);
if (novaApi.getServerAdminExtensionForZone(zoneAndId.getZone()).isPresent()) {
novaApi.getServerAdminExtensionForZone(zoneAndId.getZone()).get().resume(zoneAndId.getId());
}
throw new UnsupportedOperationException("resume requires installation of the Admin Actions extension");
}
代码示例来源:origin: org.jclouds.api/openstack-nova
@Override
public void resumeNode(String id) {
ZoneAndId zoneAndId = ZoneAndId.fromSlashEncoded(id);
if (novaApi.getServerAdminExtensionForZone(zoneAndId.getZone()).isPresent()) {
novaApi.getServerAdminExtensionForZone(zoneAndId.getZone()).get().resume(zoneAndId.getId());
}
throw new UnsupportedOperationException("resume requires installation of the Admin Actions extension");
}
代码示例来源:origin: org.jclouds.api/openstack-nova
@Override
public void suspendNode(String id) {
ZoneAndId zoneAndId = ZoneAndId.fromSlashEncoded(id);
if (novaApi.getServerAdminExtensionForZone(zoneAndId.getZone()).isPresent()) {
novaApi.getServerAdminExtensionForZone(zoneAndId.getZone()).get().suspend(zoneAndId.getId());
}
throw new UnsupportedOperationException("suspend requires installation of the Admin Actions extension");
}
代码示例来源:origin: org.jclouds.api/openstack-nova
@Override
public boolean deleteImage(String id) {
ZoneAndId zoneAndId = ZoneAndId.fromSlashEncoded(id);
try {
this.novaApi.getImageApiForZone(zoneAndId.getZone()).delete(zoneAndId.getId());
} catch (Exception e) {
return false;
}
return true;
}
代码示例来源:origin: jclouds/legacy-jclouds
@Override
public void rebootNode(String id) {
ZoneAndId zoneAndId = ZoneAndId.fromSlashEncoded(id);
novaApi.getServerApiForZone(zoneAndId.getZone()).reboot(zoneAndId.getId(), RebootType.HARD);
}
代码示例来源:origin: jclouds/legacy-jclouds
@Override
public boolean deleteImage(String id) {
ZoneAndId zoneAndId = ZoneAndId.fromSlashEncoded(id);
try {
this.novaApi.getImageApiForZone(zoneAndId.getZone()).delete(zoneAndId.getId());
} catch (Exception e) {
return false;
}
return true;
}
代码示例来源:origin: io.cloudsoft.jclouds.api/openstack-nova
@Override
public void rebootNode(String id) {
ZoneAndId zoneAndId = ZoneAndId.fromSlashEncoded(id);
novaApi.getServerApiForZone(zoneAndId.getZone()).reboot(zoneAndId.getId(), RebootType.HARD);
}
代码示例来源:origin: io.cloudsoft.jclouds.api/openstack-nova
@Override
public boolean deleteImage(String id) {
ZoneAndId zoneAndId = ZoneAndId.fromSlashEncoded(id);
try {
this.novaApi.getImageApiForZone(zoneAndId.getZone()).delete(zoneAndId.getId());
} catch (Exception e) {
return false;
}
return true;
}
代码示例来源:origin: jclouds/legacy-jclouds
@Override
public void destroyNode(String id) {
ZoneAndId zoneAndId = ZoneAndId.fromSlashEncoded(id);
if (novaApi.getFloatingIPExtensionForZone(zoneAndId.getZone()).isPresent()) {
try {
removeFloatingIpFromNodeAndDeallocate.apply(zoneAndId);
} catch (RuntimeException e) {
logger.warn(e, "<< error removing and deallocating ip from node(%s): %s", id, e.getMessage());
}
}
novaApi.getServerApiForZone(zoneAndId.getZone()).delete(zoneAndId.getId());
}
代码示例来源:origin: io.cloudsoft.jclouds.api/openstack-nova
@Override
public void destroyNode(String id) {
ZoneAndId zoneAndId = ZoneAndId.fromSlashEncoded(id);
if (novaApi.getFloatingIPExtensionForZone(zoneAndId.getZone()).isPresent()) {
try {
removeFloatingIpFromNodeAndDeallocate.apply(zoneAndId);
} catch (RuntimeException e) {
logger.warn(e, "<< error removing and deallocating ip from node(%s): %s", id, e.getMessage());
}
}
novaApi.getServerApiForZone(zoneAndId.getZone()).delete(zoneAndId.getId());
}
代码示例来源:origin: jclouds/legacy-jclouds
@Override
public ImageTemplate buildImageTemplateFromNode(String name, final String id) {
ZoneAndId zoneAndId = ZoneAndId.fromSlashEncoded(id);
Server server = novaApi.getServerApiForZone(zoneAndId.getZone()).get(zoneAndId.getId());
if (server == null)
throw new NoSuchElementException("Cannot find server with id: " + zoneAndId);
CloneImageTemplate template = new ImageTemplateBuilder.CloneImageTemplateBuilder().nodeId(id).name(name).build();
return template;
}
代码示例来源:origin: io.cloudsoft.jclouds.api/openstack-nova
@Override
public ImageTemplate buildImageTemplateFromNode(String name, final String id) {
ZoneAndId zoneAndId = ZoneAndId.fromSlashEncoded(id);
Server server = novaApi.getServerApiForZone(zoneAndId.getZone()).get(zoneAndId.getId());
if (server == null)
throw new NoSuchElementException("Cannot find server with id: " + zoneAndId);
CloneImageTemplate template = new ImageTemplateBuilder.CloneImageTemplateBuilder().nodeId(id).name(name).build();
return template;
}
代码示例来源:origin: org.jclouds.api/openstack-nova
@Override
public ServerInZone getNode(String id) {
ZoneAndId zoneAndId = ZoneAndId.fromSlashEncoded(id);
Server server = novaApi.getServerApiForZone(zoneAndId.getZone()).get(zoneAndId.getId());
return server == null ? null : new ServerInZone(server, zoneAndId.getZone());
}
代码示例来源:origin: jclouds/legacy-jclouds
@Override
public ServerInZone getNode(String id) {
ZoneAndId zoneAndId = ZoneAndId.fromSlashEncoded(id);
Server server = novaApi.getServerApiForZone(zoneAndId.getZone()).get(zoneAndId.getId());
return server == null ? null : new ServerInZone(server, zoneAndId.getZone());
}
代码示例来源:origin: jclouds/legacy-jclouds
@Override
public ImageInZone getImage(String id) {
ZoneAndId zoneAndId = ZoneAndId.fromSlashEncoded(id);
Image image = novaApi.getImageApiForZone(zoneAndId.getZone()).get(zoneAndId.getId());
return image == null ? null : new ImageInZone(image, zoneAndId.getZone());
}
代码示例来源:origin: io.cloudsoft.jclouds.api/openstack-nova
@Override
public ServerInZone getNode(String id) {
ZoneAndId zoneAndId = ZoneAndId.fromSlashEncoded(id);
Server server = novaApi.getServerApiForZone(zoneAndId.getZone()).get(zoneAndId.getId());
return server == null ? null : new ServerInZone(server, zoneAndId.getZone());
}
代码示例来源:origin: io.cloudsoft.jclouds.api/openstack-nova
@Override
public ImageInZone getImage(String id) {
ZoneAndId zoneAndId = ZoneAndId.fromSlashEncoded(id);
Image image = novaApi.getImageApiForZone(zoneAndId.getZone()).get(zoneAndId.getId());
return image == null ? null : new ImageInZone(image, zoneAndId.getZone());
}
内容来源于网络,如有侵权,请联系作者删除!