public void getVirtualMachineImage() throws InterruptedException { server.enqueue(jsonResponse("/virtualmachineimageget.json")); ImageApi imageApi = api.getVirtualMachineImageApi(resourcegroup); Image result = imageApi.get(imageName); assertSent(server, "GET", PATH); assertEquals(result.name(), imageName); assertEquals(result.location(), location); assertNotNull(result.properties().sourceVirtualMachine()); assertNotNull(result.properties().storageProfile()); }
public void createVirtualMachineImage() throws InterruptedException { server.enqueue(jsonResponse("/virtualmachineimagecreate.json")); ImageApi imageApi = api.getVirtualMachineImageApi(resourcegroup); Image result = imageApi.createOrUpdate(imageName, location, newVirtualMachineImage().properties()); assertSent(server, "PUT", PATH, "{\"location\":\"" + location + "\"," + "\"properties\":{\"sourceVirtualMachine\":{\"id\":\"vmId\"}," + "\"storageProfile\":{\"osDisk\":{\"osType\":\"Linux\",\"name\":\"Ubuntu\"},\"dataDisks\":[]}," + "\"provisioningState\":\"Succeeded\"}}"); assertEquals(result.name(), imageName); assertEquals(result.location(), location); }
@Override public VMImage apply(Image input) { return VMImage.customImage().resourceGroup(extractResourceGroup(input.id())).customImageId(input.id()).location(input.location()).name(input.name()) .offer(input.properties().storageProfile().osDisk().osType()).build(); } }
@Override public VMImage apply(Image input) { return VMImage.customImage().resourceGroup(extractResourceGroup(input.id())).customImageId(input.id()).location(input.location()).name(input.name()) .offer(input.properties().storageProfile().osDisk().osType()).build(); } }