> +                      "    \"template\" : " + template + ", " +
> +                      "    \"mode\" : \"" + mode + "\", " +
> +                      "    \"parameters\" : " + parameters + " " +
> +                      "  } " +
> +                      "}";
> +        return body;
> +    }
> +
> +    @Test(groups = "live")
> +    public void testCreate() {
> +        Long now = System.currentTimeMillis();
> +        resourceName = "jcres" + now;
> +        deploymentName = "jcdep" + now;
> +        String template = 
> "{\"$schema\":\"https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#\",\"contentVersion\":\"1.0.0.0\",\"parameters\":{\"newStorageAccountName\":{\"type\":\"string\",\"metadata\":{\"description\":\"Name
>  of the Storage 
> Account\"}},\"storageAccountType\":{\"type\":\"string\",\"defaultValue\":\"Standard_LRS\",\"allowedValues\":[\"Standard_LRS\",\"Standard_GRS\",\"Standard_ZRS\"],\"metadata\":{\"description\":\"Storage
>  Account type\"}},\"location\":{\"type\":\"string\",\"allowedValues\":[\"East 
> US\",\"West US\",\"West Europe\",\"East Asia\",\"Southeast 
> Asia\"],\"metadata\":{\"description\":\"Location of storage 
> account\"}}},\"resources\":[{\"type\":\"Microsoft.Storage/storageAccounts\",\"name\":\"[parameters('newStorageAccountName')]\",\"apiVersion\":\"2015-05-01-preview\",\"location\":\"[parameters('location')]\",\"properties\":{\"accountType\":\"[parameters('storageAccountType')]\"}}]}";
> +        String parameters = "{\"newStorageAccountName\":{\"value\":\"" + 
> resourceName + 
> "\"},\"storageAccountType\":{\"value\":\"Standard_LRS\"},\"location\":{\"value\":\"West
>  US\"}}";
> +        String properties = getPutBody(template, "Incremental", parameters);

> But the user experience, in this case is worse: Users have to build on their 
> own that json. They can use the builders, but they have to manually serialize 
> the template into a json, just because our DeploymentApi methods expect the 
> template to be a json String.

I agree the user experience is not great today, but this is how users are 
interfacing with the Azure ARM template deployment process today and this is 
the intended behavior of the original Deployment API. From the official API 
doc, the template "Specifies the JSON definition for the template. You use this 
element when you want to pass the template syntax directly in the request 
rather than link to an existing template."

If users can call the DeploymentApi directly, then in this case, users will 
expect to pass in a raw json template to the api much like how they interface 
with the original api anywhere whether it's thru a REST api call, or thru the 
Azure CLI, or thru an SDK. [Here is the 
reference](https://azure.microsoft.com/en-us/documentation/articles/resource-group-authoring-templates/)

Given that this is the design of this particular Deployment API and the Azure 
ARM template deployment process, we should probably follow the intent of the 
original api and ensure we give users the same experience as they expect it 
elsewhere. 

However if users use this thru the jclouds api, then we want to abstract all 
this raw template business by providing developers with the 
`DeploymentTemplateBuilder` so they do not have to deal with creating the raw 
json but instead pass in the parameters and we will build the json template for 
them.

@nacx WDYT? The current implementation allows users to use the DeploymentApi 
directly with the raw json template as intended by the original api, but it 
also supports abstracting the raw json template with a builder if users use 
jclouds apis.

---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/273/files/74f8e9bf66e7427298c5c3c9567aa7d8284e0987#r65021912

Reply via email to