当前位置: 首页>>代码示例>>Java>>正文


Java Server.getAddresses方法代码示例

本文整理汇总了Java中org.openstack4j.model.compute.Server.getAddresses方法的典型用法代码示例。如果您正苦于以下问题:Java Server.getAddresses方法的具体用法?Java Server.getAddresses怎么用?Java Server.getAddresses使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.openstack4j.model.compute.Server的用法示例。


在下文中一共展示了Server.getAddresses方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addServerRow

import org.openstack4j.model.compute.Server; //导入方法依赖的package包/类
private static void addServerRow(TableBuilder tb,Server server){
    String metadata="";
    String imageName="";
    String addresses="";
    Map<String,String> metadataMap=server.getMetadata();
    if(metadataMap!=null && !metadataMap.isEmpty())
        metadata=metadataMap.toString();
    Image image=server.getImage();
    if(image!=null)
        imageName=image.getName();
    Addresses addressesobj= server.getAddresses();
    if(addresses!=null)
        addresses=addressesobj.toString();
    tb.addRow(server.getId(),server.getName(),imageName,server.getFlavor().getName(),server.getStatus().toString(),server.getPowerState(),server.getAccessIPv4(),server.getAccessIPv6(),addresses,metadata);
}
 
开发者ID:vinodborole,项目名称:openstack4j-shell,代码行数:16,代码来源:NovaAPI.java

示例2: asMachine

import org.openstack4j.model.compute.Server; //导入方法依赖的package包/类
/**
 * Converts a {@link Server} from the OpenStack API to its {@link Machine}
 * representation.
 */
private Machine asMachine(Server server) {

    Builder builder = Machine.builder();
    builder.id(server.getId());
    builder.cloudProvider(this.cloudProvider);
    builder.region(this.region);
    builder.machineSize(server.getFlavor().getName());
    builder.machineState(new StatusToMachineState().apply(server.getStatus()));
    builder.requestTime(new DateTime(server.getCreated(), DateTimeZone.UTC));
    builder.launchTime(new DateTime(server.getLaunchedAt(), DateTimeZone.UTC));

    Addresses serverAddresses = server.getAddresses();
    if (serverAddresses != null) {
        collectIps(builder, server.getAddresses());
    }

    // extract membership status if tag has been set on server
    MembershipStatus membershipStatus = MembershipStatus.defaultStatus();
    if (server.getMetadata().containsKey(Constants.MEMBERSHIP_STATUS_TAG)) {
        membershipStatus = JsonUtils.toObject(
                JsonUtils.parseJsonString(server.getMetadata().get(Constants.MEMBERSHIP_STATUS_TAG)),
                MembershipStatus.class);
    }
    builder.membershipStatus(membershipStatus);

    // extract service state if tag has been set on server
    ServiceState serviceState = ServiceState.UNKNOWN;
    if (server.getMetadata().containsKey(Constants.SERVICE_STATE_TAG)) {
        serviceState = ServiceState.valueOf(server.getMetadata().get(Constants.SERVICE_STATE_TAG));
    }
    builder.serviceState(serviceState);

    builder.metadata(JsonUtils.toJson(server).getAsJsonObject());

    return builder.build();

}
 
开发者ID:elastisys,项目名称:scale.cloudpool,代码行数:42,代码来源:ServerToMachine.java


注:本文中的org.openstack4j.model.compute.Server.getAddresses方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。