Identity
// V2 authentication
OSClientV2 os = OSFactory.builderV2()
.endpoint("http://127.0.0.1:5000/v2.0")
.credentials("admin","secret")
.tenantName("admin")
.authenticate(); // V3 authentication
OSClientV3 os = OSFactory.builderV3()
.endpoint("http://127.0.0.1:5000/v3")
.credentials("admin", "secret", Identifier.byName("Default"))
.scopeToProject(Identifier.byName("admin"))
.authenticate();
Compute
// Create a Server Model Object
Server server = Builders.server()
.name("Ubuntu 2")
.flavor("large")
.image("imageId")
.build(); // Boot the Server
Server server = os.compute().servers().boot(server); // Create a Snapshot
os.compute().servers().createSnapshot("id", "name");
Image
// Create an Image
Image image = os.images().create(Builders.image()
.name("Cirros 0.3.0 x64")
.isPublic(true)
.containerFormat(ContainerFormat.BARE)
.diskFormat(DiskFormat.QCOW2)
.build()
), Payloads.create(new File("cirros.img")));
Network
// Create a Port
Port port = os.networking().port()
.create(Builders.port()
.name("port1")
.networkId("networkId")
.fixedIp("52.51.1.253", "subnetId")
.build());

openstack4j的更多相关文章

  1. Openstack4j 在 Maven 中的构建

    什么是 Openstack4j ? OpenStack的官方SDK是基于Python语言的,对于Java程序猿来说,将Python翻译过来未免麻烦.在Openstack官方的Wiki中(戳我直达),我 ...

  2. openstack4j接口调试

    //import java.util.List;////import org.openstack4j.api.OSClient.OSClientV3;//import org.openstack4j. ...

  3. OpenStack-API开发

    介绍两种OpenStack-API(Java版)--jcoulds && openstack4j Jclouds 1.介绍 jclouds -该API提供云计算环境的可移植抽象层以及云 ...

  4. 收集整理的openstack java封装 api的第三方实现的选择

    Apache jclouds 地址:http://jclouds.apache.org/guides/openstack/ 一个开源库,java实现,支持cloudstack,openstack以及各 ...

  5. jar包冲突时怎么办

    因为项目中会依赖许多jar包,免不得就会有冲突,那怎么解决呢? 使用 mvn dependency:tree 可以看到各个包的依赖关系 [INFO] | +- commons-cli:commons- ...

随机推荐

  1. DBA_Oracle性能优化的基本方法概述(方法论)

    2014-12-18 Created By BaoXinjian

  2. PO_PO系列 - 安全文件管控管理分析(案例)

    2014-07-01 Created By BaoXinjian

  3. DBA_Oracle DBA常用表汇总(概念)

    2014-06-20 Created By BaoXinjian

  4. Linux命令(17)du 查看文件和目录磁盘使用情况

    Linux du命令也是查看使用空间的,但是与df命令不同的是Linux du命令是对文件和目录磁盘使用的空间的查看,还是和df命令有一些区别的. 1.命令格式: du [选项][文件] 2.命令功能 ...

  5. ylbtech-dbs-m-QQ邮箱

    ylbtech-dbs:ylbtech-dbs-m-QQ邮箱 -- =============================================-- DatabaseName:QQ-Em ...

  6. [Java] 通过文件流拷贝文件

    package test.stream; import java.io.FileInputStream; import java.io.FileNotFoundException; import ja ...

  7. [Java] Collections的简单运用

    package test.collections; import java.util.ArrayList; import java.util.Collection; import java.util. ...

  8. sqlite 时间排序

    select * from tb_QuantifyResult where iSamplingOrCalibration = 1 and cComponentName <> ' + Quo ...

  9. ubuntu 永久设置dns信息

    ubuntu 自从12.04后,会自动刷写 /etc/resolv.conf 文件,导致写入的dns信息会在重启的时候丢失. ============================ 转自:http: ...

  10. [SQL]SQL类似统计功能的sql文

    declare @t table(name varchar(),type int) insert into @t union all union all union all union all if ...