Skip to content

Instantly share code, notes, and snippets.

@SlavD
Created August 12, 2013 12:39
Show Gist options
  • Save SlavD/6210492 to your computer and use it in GitHub Desktop.
Save SlavD/6210492 to your computer and use it in GitHub Desktop.
<Disk xmlns="http://schemas.microsoft.com/windowsazure" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<OS>$osType</OS>
<Label>$diskDescription</Label>
<MediaLink>$blobUri</MediaLink>
<Name>$diskName</Name>
</Disk>
VelocityEngine ve = new VelocityEngine();
ve.init();
Template t = ve.getTemplate("templates/Azure-AddDisk.vm");
VelocityContext context = new VelocityContext();
context.put("osType", "Windows");
context.put("diskDescription", "My First Azure Disk");
context.put("blobUri", "http://myStorageAccount.blob.core.windows.net/vhds/firstDisk.vhd");
context.put("diskName", "FirstDisk");
StringWriter writer = new StringWriter();
t.merge( context, writer );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment