Search in sources :

Example 1 with FileEntry

use of com.vmware.photon.controller.model.resources.DiskService.DiskState.BootConfig.FileEntry in project photon-model by vmware.

the class TestVSphereProvisionWithCloudConfigTask method createBootDisk.

private DiskState createBootDisk(String cloudConfig) throws Throwable {
    DiskState res = new DiskState();
    res.bootOrder = 1;
    res.type = DiskType.HDD;
    res.id = res.name = "boot-disk";
    res.sourceImageReference = URI.create("file:///dev/null");
    res.bootConfig = new BootConfig();
    res.bootConfig.files = new FileEntry[] { new FileEntry(), new FileEntry() };
    res.bootConfig.files[0].path = "user-data";
    res.bootConfig.files[0].contents = cloudConfig;
    res.bootConfig.files[1].path = "public-keys";
    res.bootConfig.files[1].contents = IOUtils.toString(new File("src/test/resources/testkey.pub").toURI());
    return TestUtils.doPost(this.host, res, DiskState.class, UriUtils.buildUri(this.host, DiskService.FACTORY_LINK));
}
Also used : BootConfig(com.vmware.photon.controller.model.resources.DiskService.DiskState.BootConfig) DiskState(com.vmware.photon.controller.model.resources.DiskService.DiskState) FileEntry(com.vmware.photon.controller.model.resources.DiskService.DiskState.BootConfig.FileEntry) File(java.io.File)

Example 2 with FileEntry

use of com.vmware.photon.controller.model.resources.DiskService.DiskState.BootConfig.FileEntry in project photon-model by vmware.

the class TestVSphereProvisionWithStaticIpTask method createBootDisk.

@SuppressWarnings("unused")
private DiskState createBootDisk(String cloudConfig) throws Throwable {
    DiskState res = new DiskState();
    res.bootOrder = 1;
    res.type = DiskType.HDD;
    res.id = res.name = "boot-disk";
    res.sourceImageReference = URI.create("file:///dev/null");
    res.bootConfig = new BootConfig();
    res.bootConfig.files = new FileEntry[] { new FileEntry(), new FileEntry() };
    res.bootConfig.files[0].path = "user-data";
    res.bootConfig.files[0].contents = cloudConfig;
    res.bootConfig.files[1].path = "public-keys";
    res.bootConfig.files[1].contents = IOUtils.toString(new File("src/test/resources/testkey.pub").toURI());
    return TestUtils.doPost(this.host, res, DiskState.class, UriUtils.buildUri(this.host, DiskService.FACTORY_LINK));
}
Also used : BootConfig(com.vmware.photon.controller.model.resources.DiskService.DiskState.BootConfig) DiskState(com.vmware.photon.controller.model.resources.DiskService.DiskState) FileEntry(com.vmware.photon.controller.model.resources.DiskService.DiskState.BootConfig.FileEntry) File(java.io.File)

Aggregations

DiskState (com.vmware.photon.controller.model.resources.DiskService.DiskState)2 BootConfig (com.vmware.photon.controller.model.resources.DiskService.DiskState.BootConfig)2 FileEntry (com.vmware.photon.controller.model.resources.DiskService.DiskState.BootConfig.FileEntry)2 File (java.io.File)2